Files
portfolio/public/node_modules/.cache/babel-loader/de3134e22ce267ac1d99434596a22299fdd2a6fbe1f670587245b54cdecb0a31.json
T
2024-12-18 12:31:06 -07:00

1 line
14 KiB
JSON

{"ast":null,"code":"const _excluded = [\"as\", \"onSelect\", \"activeKey\", \"role\", \"onKeyDown\"];\nfunction _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (e.indexOf(n) >= 0) continue;\n t[n] = r[n];\n }\n return t;\n}\nimport qsa from 'dom-helpers/querySelectorAll';\nimport * as React from 'react';\nimport { useContext, useEffect, useRef } from 'react';\nimport useForceUpdate from '@restart/hooks/useForceUpdate';\nimport useMergedRefs from '@restart/hooks/useMergedRefs';\nimport NavContext from './NavContext';\nimport SelectableContext, { makeEventKey } from './SelectableContext';\nimport TabContext from './TabContext';\nimport { dataAttr, dataProp } from './DataKey';\nimport NavItem from './NavItem';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => {};\nconst EVENT_KEY_ATTR = dataAttr('event-key');\nconst Nav = /*#__PURE__*/React.forwardRef((_ref, ref) => {\n let {\n // Need to define the default \"as\" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595\n as: Component = 'div',\n onSelect,\n activeKey,\n role,\n onKeyDown\n } = _ref,\n props = _objectWithoutPropertiesLoose(_ref, _excluded);\n // A ref and forceUpdate for refocus, b/c we only want to trigger when needed\n // and don't want to reset the set in the effect\n const forceUpdate = useForceUpdate();\n const needsRefocusRef = useRef(false);\n const parentOnSelect = useContext(SelectableContext);\n const tabContext = useContext(TabContext);\n let getControlledId, getControllerId;\n if (tabContext) {\n role = role || 'tablist';\n activeKey = tabContext.activeKey;\n // TODO: do we need to duplicate these?\n getControlledId = tabContext.getControlledId;\n getControllerId = tabContext.getControllerId;\n }\n const listNode = useRef(null);\n const getNextActiveTab = offset => {\n const currentListNode = listNode.current;\n if (!currentListNode) return null;\n const items = qsa(currentListNode, `[${EVENT_KEY_ATTR}]:not([aria-disabled=true])`);\n const activeChild = currentListNode.querySelector('[aria-selected=true]');\n if (!activeChild || activeChild !== document.activeElement) return null;\n const index = items.indexOf(activeChild);\n if (index === -1) return null;\n let nextIndex = index + offset;\n if (nextIndex >= items.length) nextIndex = 0;\n if (nextIndex < 0) nextIndex = items.length - 1;\n return items[nextIndex];\n };\n const handleSelect = (key, event) => {\n if (key == null) return;\n onSelect == null ? void 0 : onSelect(key, event);\n parentOnSelect == null ? void 0 : parentOnSelect(key, event);\n };\n const handleKeyDown = event => {\n onKeyDown == null ? void 0 : onKeyDown(event);\n if (!tabContext) {\n return;\n }\n let nextActiveChild;\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n nextActiveChild = getNextActiveTab(-1);\n break;\n case 'ArrowRight':\n case 'ArrowDown':\n nextActiveChild = getNextActiveTab(1);\n break;\n default:\n return;\n }\n if (!nextActiveChild) return;\n event.preventDefault();\n handleSelect(nextActiveChild.dataset[dataProp('EventKey')] || null, event);\n needsRefocusRef.current = true;\n forceUpdate();\n };\n useEffect(() => {\n if (listNode.current && needsRefocusRef.current) {\n const activeChild = listNode.current.querySelector(`[${EVENT_KEY_ATTR}][aria-selected=true]`);\n activeChild == null ? void 0 : activeChild.focus();\n }\n needsRefocusRef.current = false;\n });\n const mergedRef = useMergedRefs(ref, listNode);\n return /*#__PURE__*/_jsx(SelectableContext.Provider, {\n value: handleSelect,\n children: /*#__PURE__*/_jsx(NavContext.Provider, {\n value: {\n role,\n // used by NavLink to determine it's role\n activeKey: makeEventKey(activeKey),\n getControlledId: getControlledId || noop,\n getControllerId: getControllerId || noop\n },\n children: /*#__PURE__*/_jsx(Component, Object.assign({}, props, {\n onKeyDown: handleKeyDown,\n ref: mergedRef,\n role: role\n }))\n })\n });\n});\nNav.displayName = 'Nav';\nexport default Object.assign(Nav, {\n Item: NavItem\n});","map":{"version":3,"names":["_excluded","_objectWithoutPropertiesLoose","r","e","t","n","hasOwnProperty","call","indexOf","qsa","React","useContext","useEffect","useRef","useForceUpdate","useMergedRefs","NavContext","SelectableContext","makeEventKey","TabContext","dataAttr","dataProp","NavItem","jsx","_jsx","noop","EVENT_KEY_ATTR","Nav","forwardRef","_ref","ref","as","Component","onSelect","activeKey","role","onKeyDown","props","forceUpdate","needsRefocusRef","parentOnSelect","tabContext","getControlledId","getControllerId","listNode","getNextActiveTab","offset","currentListNode","current","items","activeChild","querySelector","document","activeElement","index","nextIndex","length","handleSelect","key","event","handleKeyDown","nextActiveChild","preventDefault","dataset","focus","mergedRef","Provider","value","children","Object","assign","displayName","Item"],"sources":["/home/violet/documents/development/portfolio/public/node_modules/react-bootstrap/node_modules/@restart/ui/esm/Nav.js"],"sourcesContent":["const _excluded = [\"as\", \"onSelect\", \"activeKey\", \"role\", \"onKeyDown\"];\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }\nimport qsa from 'dom-helpers/querySelectorAll';\nimport * as React from 'react';\nimport { useContext, useEffect, useRef } from 'react';\nimport useForceUpdate from '@restart/hooks/useForceUpdate';\nimport useMergedRefs from '@restart/hooks/useMergedRefs';\nimport NavContext from './NavContext';\nimport SelectableContext, { makeEventKey } from './SelectableContext';\nimport TabContext from './TabContext';\nimport { dataAttr, dataProp } from './DataKey';\nimport NavItem from './NavItem';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => {};\nconst EVENT_KEY_ATTR = dataAttr('event-key');\nconst Nav = /*#__PURE__*/React.forwardRef((_ref, ref) => {\n let {\n // Need to define the default \"as\" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595\n as: Component = 'div',\n onSelect,\n activeKey,\n role,\n onKeyDown\n } = _ref,\n props = _objectWithoutPropertiesLoose(_ref, _excluded);\n // A ref and forceUpdate for refocus, b/c we only want to trigger when needed\n // and don't want to reset the set in the effect\n const forceUpdate = useForceUpdate();\n const needsRefocusRef = useRef(false);\n const parentOnSelect = useContext(SelectableContext);\n const tabContext = useContext(TabContext);\n let getControlledId, getControllerId;\n if (tabContext) {\n role = role || 'tablist';\n activeKey = tabContext.activeKey;\n // TODO: do we need to duplicate these?\n getControlledId = tabContext.getControlledId;\n getControllerId = tabContext.getControllerId;\n }\n const listNode = useRef(null);\n const getNextActiveTab = offset => {\n const currentListNode = listNode.current;\n if (!currentListNode) return null;\n const items = qsa(currentListNode, `[${EVENT_KEY_ATTR}]:not([aria-disabled=true])`);\n const activeChild = currentListNode.querySelector('[aria-selected=true]');\n if (!activeChild || activeChild !== document.activeElement) return null;\n const index = items.indexOf(activeChild);\n if (index === -1) return null;\n let nextIndex = index + offset;\n if (nextIndex >= items.length) nextIndex = 0;\n if (nextIndex < 0) nextIndex = items.length - 1;\n return items[nextIndex];\n };\n const handleSelect = (key, event) => {\n if (key == null) return;\n onSelect == null ? void 0 : onSelect(key, event);\n parentOnSelect == null ? void 0 : parentOnSelect(key, event);\n };\n const handleKeyDown = event => {\n onKeyDown == null ? void 0 : onKeyDown(event);\n if (!tabContext) {\n return;\n }\n let nextActiveChild;\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n nextActiveChild = getNextActiveTab(-1);\n break;\n case 'ArrowRight':\n case 'ArrowDown':\n nextActiveChild = getNextActiveTab(1);\n break;\n default:\n return;\n }\n if (!nextActiveChild) return;\n event.preventDefault();\n handleSelect(nextActiveChild.dataset[dataProp('EventKey')] || null, event);\n needsRefocusRef.current = true;\n forceUpdate();\n };\n useEffect(() => {\n if (listNode.current && needsRefocusRef.current) {\n const activeChild = listNode.current.querySelector(`[${EVENT_KEY_ATTR}][aria-selected=true]`);\n activeChild == null ? void 0 : activeChild.focus();\n }\n needsRefocusRef.current = false;\n });\n const mergedRef = useMergedRefs(ref, listNode);\n return /*#__PURE__*/_jsx(SelectableContext.Provider, {\n value: handleSelect,\n children: /*#__PURE__*/_jsx(NavContext.Provider, {\n value: {\n role,\n // used by NavLink to determine it's role\n activeKey: makeEventKey(activeKey),\n getControlledId: getControlledId || noop,\n getControllerId: getControllerId || noop\n },\n children: /*#__PURE__*/_jsx(Component, Object.assign({}, props, {\n onKeyDown: handleKeyDown,\n ref: mergedRef,\n role: role\n }))\n })\n });\n});\nNav.displayName = 'Nav';\nexport default Object.assign(Nav, {\n Item: NavItem\n});"],"mappings":"AAAA,MAAMA,SAAS,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC;AACtE,SAASC,6BAA6BA,CAACC,CAAC,EAAEC,CAAC,EAAE;EAAE,IAAI,IAAI,IAAID,CAAC,EAAE,OAAO,CAAC,CAAC;EAAE,IAAIE,CAAC,GAAG,CAAC,CAAC;EAAE,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAI,CAAC,CAAC,CAACI,cAAc,CAACC,IAAI,CAACL,CAAC,EAAEG,CAAC,CAAC,EAAE;IAAE,IAAIF,CAAC,CAACK,OAAO,CAACH,CAAC,CAAC,IAAI,CAAC,EAAE;IAAUD,CAAC,CAACC,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,CAAC;EAAE;EAAE,OAAOD,CAAC;AAAE;AACpM,OAAOK,GAAG,MAAM,8BAA8B;AAC9C,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACrD,OAAOC,cAAc,MAAM,+BAA+B;AAC1D,OAAOC,aAAa,MAAM,8BAA8B;AACxD,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,iBAAiB,IAAIC,YAAY,QAAQ,qBAAqB;AACrE,OAAOC,UAAU,MAAM,cAAc;AACrC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,WAAW;AAC9C,OAAOC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