@oracle/oraclejet-preact 17.0.2 → 17.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/amd/{BarChart-be1d51d4.js → BarChart-6c921af0.js} +2 -2
- package/amd/{BarChart-be1d51d4.js.map → BarChart-6c921af0.js.map} +1 -1
- package/amd/{Chart-4796be31.js → Chart-0f54dae3.js} +2 -2
- package/amd/{Chart-4796be31.js.map → Chart-0f54dae3.js.map} +1 -1
- package/amd/CheckboxSetContext-2e486ea8.js +2 -0
- package/amd/CheckboxSetContext-2e486ea8.js.map +1 -0
- package/amd/InputDatePicker-da5d8728.js +2 -0
- package/amd/{InputDatePicker-0012b304.js.map → InputDatePicker-da5d8728.js.map} +1 -1
- package/amd/{LineAreaChart-2057f8b4.js → LineAreaChart-337cac30.js} +2 -2
- package/amd/{LineAreaChart-2057f8b4.js.map → LineAreaChart-337cac30.js.map} +1 -1
- package/amd/MaxLengthCounter-caafceef.js +2 -0
- package/amd/MaxLengthCounter-caafceef.js.map +1 -0
- package/amd/PRIVATE_Chart.js +1 -1
- package/amd/TextArea-44c90bc4.js +2 -0
- package/amd/TextArea-44c90bc4.js.map +1 -0
- package/amd/TextAreaAutosize-0a023972.js +2 -0
- package/amd/{TextAreaAutosize-9dc5bffe.js.map → TextAreaAutosize-0a023972.js.map} +1 -1
- package/amd/Theme-redwood/theme.css +237 -237
- package/amd/Theme-stable/theme.css +356 -356
- package/amd/TooltipContentStyles.styles.css +1 -0
- package/amd/UNSAFE_BarChart/__test__/BarChart.spec.js +1 -1
- package/amd/UNSAFE_BarChart.js +1 -1
- package/amd/UNSAFE_CheckboxItem.js +1 -1
- package/amd/UNSAFE_CheckboxItem.js.map +1 -1
- package/amd/UNSAFE_CheckboxSet.js +1 -1
- package/amd/UNSAFE_CheckboxSet.js.map +1 -1
- package/amd/UNSAFE_InputDatePicker.js +1 -1
- package/amd/UNSAFE_LineAreaChart/__test__/LineChart.spec.js +1 -1
- package/amd/UNSAFE_LineAreaChart.js +1 -1
- package/amd/UNSAFE_TextArea.js +1 -1
- package/amd/UNSAFE_TextAreaAutosize.js +1 -1
- package/amd/hooks/UNSAFE_useContainerBreakpointValues.js +1 -1
- package/cjs/{useNavigationListItem-74009187.js → BaseNavigationListItem-070d75bc.js} +40 -2
- package/cjs/BaseNavigationListItem-070d75bc.js.map +1 -0
- package/cjs/{NavigationList-5218562e.js → NavigationListItem-12a76e7d.js} +18 -3
- package/cjs/NavigationListItem-12a76e7d.js.map +1 -0
- package/cjs/{OverflowTabBarItem-1de46588.js → OverflowTabBarItem-c0a592fd.js} +4 -5
- package/cjs/{OverflowTabBarItem-1de46588.js.map → OverflowTabBarItem-c0a592fd.js.map} +1 -1
- package/cjs/{RemovableNavigationListItem-eb2c8156.js → RemovableNavigationListItem-6231df42.js} +3 -4
- package/cjs/{RemovableNavigationListItem-eb2c8156.js.map → RemovableNavigationListItem-6231df42.js.map} +1 -1
- package/cjs/{ReorderableTabBar-025a0d71.js → ReorderableTabBar-5743c66a.js} +2 -2
- package/cjs/{ReorderableTabBar-025a0d71.js.map → ReorderableTabBar-5743c66a.js.map} +1 -1
- package/cjs/{TabBar-e77706d0.js → TabBar-73bb6c97.js} +1 -6
- package/cjs/{TabBar-e77706d0.js.map → TabBar-73bb6c97.js.map} +1 -1
- package/cjs/{TabBarMixed-bc696a46.js → TabBarMixed-426fcaf1.js} +1 -6
- package/cjs/{TabBarMixed-bc696a46.js.map → TabBarMixed-426fcaf1.js.map} +1 -1
- package/cjs/Theme-redwood/theme.css +267 -267
- package/cjs/Theme-stable/theme.css +277 -277
- package/cjs/TooltipContentStyles.styles.css +1 -0
- package/cjs/UNSAFE_NavigationList.js +14 -16
- package/cjs/UNSAFE_NavigationList.js.map +1 -1
- package/cjs/UNSAFE_NavigationListCommon.js +54 -55
- package/cjs/UNSAFE_NavigationListCommon.js.map +1 -1
- package/cjs/UNSAFE_OverflowTabBar.js +21 -23
- package/cjs/UNSAFE_OverflowTabBar.js.map +1 -1
- package/cjs/UNSAFE_ReorderableTabBar.js +7 -21
- package/cjs/UNSAFE_ReorderableTabBar.js.map +1 -1
- package/cjs/UNSAFE_TabBar.js +22 -24
- package/cjs/UNSAFE_TabBar.js.map +1 -1
- package/cjs/UNSAFE_TabBarCommon.js +18 -20
- package/cjs/UNSAFE_TabBarCommon.js.map +1 -1
- package/cjs/UNSAFE_TabBarMixed.js +22 -24
- package/cjs/UNSAFE_TabBarMixed.js.map +1 -1
- package/es/MaxLengthCounter-cead2dac.js +25 -0
- package/es/MaxLengthCounter-cead2dac.js.map +1 -0
- package/es/{TextArea-979496a0.js → TextArea-d97aac1f.js} +8 -25
- package/es/TextArea-d97aac1f.js.map +1 -0
- package/es/{TextAreaAutosize-b73aaa2f.js → TextAreaAutosize-68a4786d.js} +2 -2
- package/es/{TextAreaAutosize-b73aaa2f.js.map → TextAreaAutosize-68a4786d.js.map} +1 -1
- package/es/Theme-redwood/theme.css +442 -442
- package/es/Theme-stable/theme.css +356 -356
- package/es/TooltipContentStyles.styles.css +1 -0
- package/es/UNSAFE_TextArea.js +3 -2
- package/es/UNSAFE_TextArea.js.map +1 -1
- package/es/UNSAFE_TextAreaAutosize.js +2 -2
- package/es/hooks/UNSAFE_useContainerBreakpointValues.js +1 -1
- package/package.json +2 -2
- package/amd/CheckboxSet-9c883a32.js +0 -2
- package/amd/CheckboxSet-9c883a32.js.map +0 -1
- package/amd/InputDatePicker-0012b304.js +0 -2
- package/amd/TextArea-2c7af40c.js +0 -2
- package/amd/TextArea-2c7af40c.js.map +0 -1
- package/amd/TextAreaAutosize-9dc5bffe.js +0 -2
- package/cjs/BaseNavigationListItem-175a3f35.js +0 -49
- package/cjs/BaseNavigationListItem-175a3f35.js.map +0 -1
- package/cjs/NavigationList-5218562e.js.map +0 -1
- package/cjs/NavigationListItem-b80c41dc.js +0 -12
- package/cjs/NavigationListItem-b80c41dc.js.map +0 -1
- package/cjs/useNavigationListItem-74009187.js.map +0 -1
- package/es/TextArea-979496a0.js.map +0 -1
|
@@ -9,15 +9,14 @@ var clientHints = require('./clientHints-9e411b6e.js');
|
|
|
9
9
|
var mergeInterpolations = require('./mergeInterpolations-6727b536.js');
|
|
10
10
|
var flexitem = require('./flexitem-fee13e26.js');
|
|
11
11
|
var classNames = require('./classNames-c14c6ef3.js');
|
|
12
|
-
var NavigationList = require('./NavigationList-5218562e.js');
|
|
13
|
-
var NavigationListItem = require('./NavigationListItem-b80c41dc.js');
|
|
14
12
|
var Icon = require('./Icon-3ffd13dc.js');
|
|
15
13
|
var useTabBarContext = require('./useTabBarContext-2a6a796c.js');
|
|
16
14
|
var Dropdown = require('./Dropdown-820dc3fe.js');
|
|
17
15
|
var Sheet = require('./Sheet-a6267b5f.js');
|
|
18
16
|
var TabBarItem = require('./TabBarItem-2b3039aa.js');
|
|
19
17
|
var UNSAFE_TabBarCommon_themes_OverflowTabBarItemStyles_css = require('./UNSAFE_TabBarCommon/themes/OverflowTabBarItemStyles.css.js');
|
|
20
|
-
var
|
|
18
|
+
var NavigationListItem = require('./NavigationListItem-12a76e7d.js');
|
|
19
|
+
var RemovableNavigationListItem = require('./RemovableNavigationListItem-6231df42.js');
|
|
21
20
|
|
|
22
21
|
const SvgOverflowH = (props) => (jsxRuntime.jsx(Icon.Icon, { viewBox: "0 0 24 24", ...props, children: jsxRuntime.jsx("g", { fill: "none", children: jsxRuntime.jsx("path", { d: "M6 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0z", fill: "currentcolor" }) }) }));
|
|
23
22
|
|
|
@@ -68,7 +67,7 @@ function OverflowTabBarItem({ overflowItemKey, icon, badge, overflowItems, isOpe
|
|
|
68
67
|
}
|
|
69
68
|
}, [navigationListRef]);
|
|
70
69
|
const getNavigationList = hooks.useCallback(() => {
|
|
71
|
-
return (jsxRuntime.jsx("div", { onKeyDown: handleKeyDown, tabIndex: 0, ref: navContainerRef, class: navContainerClasses, children: jsxRuntime.jsx(
|
|
70
|
+
return (jsxRuntime.jsx("div", { onKeyDown: handleKeyDown, tabIndex: 0, ref: navContainerRef, class: navContainerClasses, children: jsxRuntime.jsx(NavigationListItem.NavigationList, { ref: navigationListRef, selection: selection, onSelectionChange: handleSelectionChange, onRemove: onRemove, children: overflowItems?.map((item) => item.isRemovable ? (jsxRuntime.jsx(RemovableNavigationListItem.RemovableNavigationListItem, { itemKey: item.itemKey, label: item.label, badge: item.badge, metadata: item.metadata, severity: item.severity })) : (jsxRuntime.jsx(NavigationListItem.NavigationListItem, { itemKey: item.itemKey, label: item.label, badge: item.badge, metadata: item.metadata, severity: item.severity }))) }) }));
|
|
72
71
|
}, [
|
|
73
72
|
handleKeyDown,
|
|
74
73
|
navContainerClasses,
|
|
@@ -86,4 +85,4 @@ const getIsMobile = () => {
|
|
|
86
85
|
};
|
|
87
86
|
|
|
88
87
|
exports.OverflowTabBarItem = OverflowTabBarItem;
|
|
89
|
-
//# sourceMappingURL=OverflowTabBarItem-
|
|
88
|
+
//# sourceMappingURL=OverflowTabBarItem-c0a592fd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverflowTabBarItem-1de46588.js","sources":["../../src/UNSAFE_RedwoodIcons/OverflowH/OverflowH.tsx","../../src/UNSAFE_TabBarCommon/OverflowTabBarItem.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n// DO NOT MODIFY THIS FILE MANUALLY!\n// This file is automatically generated based on the corresponding SVG image in\n// the packages/oraclejet-preact/resources/icons folder.\nimport { ComponentProps } from 'preact';\nimport { Icon } from '../../UNSAFE_Icon';\ntype Props = Omit<ComponentProps<typeof Icon>, 'viewBox'>;\nconst SvgOverflowH = (props: Props) => (\n <Icon viewBox=\"0 0 24 24\" {...props}>\n <g fill=\"none\">\n <path\n d=\"M6 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0z\"\n fill=\"currentcolor\"\n />\n </g>\n </Icon>\n);\nexport { SvgOverflowH as OverflowH };\n","import { ComponentChild, ComponentProps, createRef } from 'preact';\nimport { useCallback, useRef } from 'preact/hooks';\nimport type { BundleType } from '../resources/nls/bundle';\nimport { useTranslationBundle } from '../hooks/UNSAFE_useTranslationBundle';\nimport { getClientHints } from '../utils/PRIVATE_clientHints';\nimport { mergeInterpolations } from '../utils/UNSAFE_mergeInterpolations';\nimport { flexitemInterpolations } from '../utils/UNSAFE_interpolations/flexitem';\nimport type { FlexitemProps } from '../utils/UNSAFE_interpolations/flexitem';\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport {\n NavigationListItem,\n NavigationList,\n RemovableNavigationListItem,\n FocusableHandle\n} from '../UNSAFE_NavigationList';\nimport { OverflowH } from '../UNSAFE_RedwoodIcons/OverflowH';\nimport { useTabBarContext } from './useTabBarContext';\nimport { Dropdown } from '../UNSAFE_Dropdown';\nimport { Sheet } from '../UNSAFE_Sheet';\nimport { BaseTabBarItem } from './BaseTabBarItem';\nimport { styles } from './themes/OverflowTabBarItemStyles.css';\nimport { TabBarItem } from './TabBarItem';\n\nexport type OverflowSelectionDetail<K> = {\n value: K;\n};\n\nexport type CloseDetail = {\n /**\n * dismissed represents dismissing the DropDown\n */\n reason: 'dismissed' | 'itemAction' | 'outsideMousedown';\n};\n\nexport type Item<K extends string | number> = Omit<\n ComponentProps<typeof TabBarItem<K>>,\n 'testId' | 'aria-controls'\n> & {\n isRemovable?: boolean;\n /**\n * Accepts the tabpanel element's ID associated with the tab item\n **/\n tabPanelId?: string;\n};\n\nexport type OverflowTabBarItemProps<K extends string | number> = {\n /**\n * Key of the TabBarItem\n */\n overflowItemKey: K;\n /**\n * Whether to open the popup\n */\n isOpen: boolean;\n /**\n * Property that triggers a callback when DropDown is supposed to be closed.\n */\n onClose?: (detail: CloseDetail) => void;\n /**\n * The icon of the OverflowTabBarItem\n */\n icon?: ComponentChild;\n /**\n * The content to be rendered inside the Badge component.\n */\n badge?: string;\n /**\n * An array of data used by NavigationList to render individual overflow items.\n */\n overflowItems?: Item<K>[];\n};\n\n/**\n * An OverflowTabBarItem renders TabBarItems in a device appropriate popup. OverflowTabBarItem is used internally in an OverflowTabBar.\n */\n\nexport function OverflowTabBarItem<K extends string | number>({\n overflowItemKey,\n icon,\n badge,\n overflowItems,\n isOpen,\n onClose\n}: OverflowTabBarItemProps<K>) {\n const { selection, showFocusRing, isEdgeBottom, onSelect, onRemove, layout } = useTabBarContext();\n\n const isPointerSelection = useRef<boolean>(false);\n\n const overflowTabBarItemRef = useRef<HTMLDivElement>(null);\n const navigationListRef = createRef<FocusableHandle>();\n\n const handleSelectionChange = useCallback<\n Required<ComponentProps<typeof NavigationList>>['onSelectionChange']\n >(\n (detail: { value: string | number; reason?: 'pointer' | 'keyboard' }) => {\n if (detail.reason === 'pointer') {\n isPointerSelection.current = true;\n }\n onSelect?.({ value: detail.value });\n onClose?.({ reason: 'itemAction' });\n },\n [onSelect, onClose]\n );\n\n const handleDropdownClose = useCallback(\n (e: CloseDetail) => {\n onClose?.({ reason: e.reason });\n },\n [onClose]\n );\n\n const handleSheetClose = useCallback(() => {\n onClose?.({ reason: 'dismissed' });\n }, [onClose]);\n\n //When NavigationList steals focus the app resets it. Not always would it be reset to\n //parent of OverflowTabBarItem. Though currentKey would be correct, but focusRing would would not be visible\n //Hence we check for isPointerSelection.current\n\n const focusRingRequirement = showFocusRing && !isPointerSelection.current && !getIsMobile();\n\n const overflowContainsKey = (searchKey: K) => {\n return overflowItems?.find((item) => item.itemKey === searchKey) != null;\n };\n\n const currentPanelId = overflowItems?.find((item) => item.itemKey === selection)?.tabPanelId;\n\n const translations = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n\n const isSelected = selection !== undefined && overflowContainsKey(selection as K);\n\n //instead of specifying flex: '1 0 auto' in cssProps var\n const styleInterpolations = mergeInterpolations<FlexitemProps>([\n ...Object.values(flexitemInterpolations)\n ]);\n const flexDimensions = styleInterpolations({\n flex: layout === 'stretch' ? '1 0 auto' : '0 0 auto'\n });\n\n const navContainerClasses = classNames([styles.navContainerBase]);\n\n const navContainerRef = useRef<HTMLDivElement>(null);\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n navigationListRef.current?.focus();\n }\n },\n [navigationListRef]\n );\n const getNavigationList = useCallback(() => {\n return (\n <div onKeyDown={handleKeyDown} tabIndex={0} ref={navContainerRef} class={navContainerClasses}>\n <NavigationList\n ref={navigationListRef}\n selection={selection}\n onSelectionChange={handleSelectionChange}\n onRemove={onRemove}>\n {overflowItems?.map((item) =>\n item.isRemovable ? (\n <RemovableNavigationListItem\n itemKey={item.itemKey}\n label={item.label}\n badge={item.badge}\n metadata={item.metadata}\n severity={item.severity}\n />\n ) : (\n <NavigationListItem\n itemKey={item.itemKey}\n label={item.label}\n badge={item.badge}\n metadata={item.metadata}\n severity={item.severity}\n />\n )\n )}\n </NavigationList>\n </div>\n );\n }, [\n handleKeyDown,\n navContainerClasses,\n navigationListRef,\n selection,\n handleSelectionChange,\n onRemove,\n overflowItems\n ]);\n\n return (\n <>\n {overflowItems && overflowItems.length > 0 && (\n <div ref={overflowTabBarItemRef} style={flexDimensions}>\n <BaseTabBarItem\n aria-controls={currentPanelId}\n itemKey={overflowItemKey}\n label={translations.overflowItemLabel()}\n icon={icon ? icon : <OverflowH />}\n badge={badge}\n showFocusRingOverride={focusRingRequirement}\n selectionOverride={isSelected}\n displayOverride={'icons'}\n aria-haspopup={true}\n />\n </div>\n )}\n {getIsMobile() ? (\n <Sheet isOpen={isOpen} onClose={handleSheetClose}>\n {getNavigationList()}\n </Sheet>\n ) : (\n <Dropdown\n initialFocus=\"firstFocusable\"\n isOpen={isOpen}\n onClose={handleDropdownClose}\n placement={isEdgeBottom ? 'top-end' : 'bottom-end'}\n anchorRef={overflowTabBarItemRef}>\n {getNavigationList()}\n </Dropdown>\n )}\n </>\n );\n}\n\nconst getIsMobile = () => {\n const { deviceType } = getClientHints();\n return deviceType === 'phone';\n};\n"],"names":["_jsx","Icon","useTabBarContext","useRef","createRef","useCallback","useTranslationBundle","mergeInterpolations","flexitemInterpolations","classNames","styles","NavigationList","RemovableNavigationListItem","NavigationListItem","_jsxs","_Fragment","BaseTabBarItem","OverflowH","Sheet","Dropdown","getClientHints"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,YAAY,GAAG,CAAC,KAAY,MAChCA,cAAA,CAACC,SAAI,EAAC,EAAA,OAAO,EAAC,WAAW,KAAK,KAAK,EAAA,QAAA,EACjCD,cAAG,CAAA,GAAA,EAAA,EAAA,IAAI,EAAC,MAAM,EACZ,QAAA,EAAAA,cAAA,CAAA,MAAA,EAAA,EACE,CAAC,EAAC,sGAAsG,EACxG,IAAI,EAAC,cAAc,EAAA,CACnB,EACA,CAAA,EAAA,CACC,CACR;;ACkDD;;AAEG;AAEa,SAAA,kBAAkB,CAA4B,EAC5D,eAAe,EACf,IAAI,EACJ,KAAK,EACL,aAAa,EACb,MAAM,EACN,OAAO,EACoB,EAAA;AAC3B,IAAA,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAGE,iCAAgB,EAAE,CAAC;AAElG,IAAA,MAAM,kBAAkB,GAAGC,YAAM,CAAU,KAAK,CAAC,CAAC;AAElD,IAAA,MAAM,qBAAqB,GAAGA,YAAM,CAAiB,IAAI,CAAC,CAAC;AAC3D,IAAA,MAAM,iBAAiB,GAAGC,gBAAS,EAAmB,CAAC;AAEvD,IAAA,MAAM,qBAAqB,GAAGC,iBAAW,CAGvC,CAAC,MAAmE,KAAI;AACtE,QAA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MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,EAClD,SAAS,EAAE,qBAAqB,EAC/B,QAAA,EAAA,iBAAiB,EAAE,EAAA,CACX,CACZ,CAAA,EAAA,CACA,EACH;AACJ,CAAC;AAED,MAAM,WAAW,GAAG,MAAK;AACvB,IAAA,MAAM,EAAE,UAAU,EAAE,GAAGC,0BAAc,EAAE,CAAC;IACxC,OAAO,UAAU,KAAK,OAAO,CAAC;AAChC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"OverflowTabBarItem-c0a592fd.js","sources":["../../src/UNSAFE_RedwoodIcons/OverflowH/OverflowH.tsx","../../src/UNSAFE_TabBarCommon/OverflowTabBarItem.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n// DO NOT MODIFY THIS FILE MANUALLY!\n// This file is automatically generated based on the corresponding SVG image in\n// the packages/oraclejet-preact/resources/icons folder.\nimport { ComponentProps } from 'preact';\nimport { Icon } from '../../UNSAFE_Icon';\ntype Props = Omit<ComponentProps<typeof Icon>, 'viewBox'>;\nconst SvgOverflowH = (props: Props) => (\n <Icon viewBox=\"0 0 24 24\" {...props}>\n <g fill=\"none\">\n <path\n d=\"M6 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm8 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0z\"\n fill=\"currentcolor\"\n />\n </g>\n </Icon>\n);\nexport { SvgOverflowH as OverflowH };\n","import { ComponentChild, ComponentProps, createRef } from 'preact';\nimport { useCallback, useRef } from 'preact/hooks';\nimport type { BundleType } from '../resources/nls/bundle';\nimport { useTranslationBundle } from '../hooks/UNSAFE_useTranslationBundle';\nimport { getClientHints } from '../utils/PRIVATE_clientHints';\nimport { mergeInterpolations } from '../utils/UNSAFE_mergeInterpolations';\nimport { flexitemInterpolations } from '../utils/UNSAFE_interpolations/flexitem';\nimport type { FlexitemProps } from '../utils/UNSAFE_interpolations/flexitem';\nimport { classNames } from '../utils/UNSAFE_classNames';\nimport {\n NavigationListItem,\n NavigationList,\n RemovableNavigationListItem,\n FocusableHandle\n} from '../UNSAFE_NavigationList';\nimport { OverflowH } from '../UNSAFE_RedwoodIcons/OverflowH';\nimport { useTabBarContext } from './useTabBarContext';\nimport { Dropdown } from '../UNSAFE_Dropdown';\nimport { Sheet } from '../UNSAFE_Sheet';\nimport { BaseTabBarItem } from './BaseTabBarItem';\nimport { styles } from './themes/OverflowTabBarItemStyles.css';\nimport { TabBarItem } from './TabBarItem';\n\nexport type OverflowSelectionDetail<K> = {\n value: K;\n};\n\nexport type CloseDetail = {\n /**\n * dismissed represents dismissing the DropDown\n */\n reason: 'dismissed' | 'itemAction' | 'outsideMousedown';\n};\n\nexport type Item<K extends string | number> = Omit<\n ComponentProps<typeof TabBarItem<K>>,\n 'testId' | 'aria-controls'\n> & {\n isRemovable?: boolean;\n /**\n * Accepts the tabpanel element's ID associated with the tab item\n **/\n tabPanelId?: string;\n};\n\nexport type OverflowTabBarItemProps<K extends string | number> = {\n /**\n * Key of the TabBarItem\n */\n overflowItemKey: K;\n /**\n * Whether to open the popup\n */\n isOpen: boolean;\n /**\n * Property that triggers a callback when DropDown is supposed to be closed.\n */\n onClose?: (detail: CloseDetail) => void;\n /**\n * The icon of the OverflowTabBarItem\n */\n icon?: ComponentChild;\n /**\n * The content to be rendered inside the Badge component.\n */\n badge?: string;\n /**\n * An array of data used by NavigationList to render individual overflow items.\n */\n overflowItems?: Item<K>[];\n};\n\n/**\n * An OverflowTabBarItem renders TabBarItems in a device appropriate popup. OverflowTabBarItem is used internally in an OverflowTabBar.\n */\n\nexport function OverflowTabBarItem<K extends string | number>({\n overflowItemKey,\n icon,\n badge,\n overflowItems,\n isOpen,\n onClose\n}: OverflowTabBarItemProps<K>) {\n const { selection, showFocusRing, isEdgeBottom, onSelect, onRemove, layout } = useTabBarContext();\n\n const isPointerSelection = useRef<boolean>(false);\n\n const overflowTabBarItemRef = useRef<HTMLDivElement>(null);\n const navigationListRef = createRef<FocusableHandle>();\n\n const handleSelectionChange = useCallback<\n Required<ComponentProps<typeof NavigationList>>['onSelectionChange']\n >(\n (detail: { value: string | number; reason?: 'pointer' | 'keyboard' }) => {\n if (detail.reason === 'pointer') {\n isPointerSelection.current = true;\n }\n onSelect?.({ value: detail.value });\n onClose?.({ reason: 'itemAction' });\n },\n [onSelect, onClose]\n );\n\n const handleDropdownClose = useCallback(\n (e: CloseDetail) => {\n onClose?.({ reason: e.reason });\n },\n [onClose]\n );\n\n const handleSheetClose = useCallback(() => {\n onClose?.({ reason: 'dismissed' });\n }, [onClose]);\n\n //When NavigationList steals focus the app resets it. Not always would it be reset to\n //parent of OverflowTabBarItem. Though currentKey would be correct, but focusRing would would not be visible\n //Hence we check for isPointerSelection.current\n\n const focusRingRequirement = showFocusRing && !isPointerSelection.current && !getIsMobile();\n\n const overflowContainsKey = (searchKey: K) => {\n return overflowItems?.find((item) => item.itemKey === searchKey) != null;\n };\n\n const currentPanelId = overflowItems?.find((item) => item.itemKey === selection)?.tabPanelId;\n\n const translations = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n\n const isSelected = selection !== undefined && overflowContainsKey(selection as K);\n\n //instead of specifying flex: '1 0 auto' in cssProps var\n const styleInterpolations = mergeInterpolations<FlexitemProps>([\n ...Object.values(flexitemInterpolations)\n ]);\n const flexDimensions = styleInterpolations({\n flex: layout === 'stretch' ? '1 0 auto' : '0 0 auto'\n });\n\n const navContainerClasses = classNames([styles.navContainerBase]);\n\n const navContainerRef = useRef<HTMLDivElement>(null);\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n navigationListRef.current?.focus();\n }\n },\n [navigationListRef]\n );\n const getNavigationList = useCallback(() => {\n return (\n <div onKeyDown={handleKeyDown} tabIndex={0} ref={navContainerRef} class={navContainerClasses}>\n <NavigationList\n ref={navigationListRef}\n selection={selection}\n onSelectionChange={handleSelectionChange}\n onRemove={onRemove}>\n {overflowItems?.map((item) =>\n item.isRemovable ? (\n <RemovableNavigationListItem\n itemKey={item.itemKey}\n label={item.label}\n badge={item.badge}\n metadata={item.metadata}\n severity={item.severity}\n />\n ) : (\n <NavigationListItem\n itemKey={item.itemKey}\n label={item.label}\n badge={item.badge}\n metadata={item.metadata}\n severity={item.severity}\n />\n )\n )}\n </NavigationList>\n </div>\n );\n }, [\n handleKeyDown,\n navContainerClasses,\n navigationListRef,\n selection,\n handleSelectionChange,\n onRemove,\n overflowItems\n ]);\n\n return (\n <>\n {overflowItems && overflowItems.length > 0 && (\n <div ref={overflowTabBarItemRef} style={flexDimensions}>\n <BaseTabBarItem\n aria-controls={currentPanelId}\n itemKey={overflowItemKey}\n label={translations.overflowItemLabel()}\n icon={icon ? icon : <OverflowH />}\n badge={badge}\n showFocusRingOverride={focusRingRequirement}\n selectionOverride={isSelected}\n displayOverride={'icons'}\n aria-haspopup={true}\n />\n </div>\n )}\n {getIsMobile() ? (\n <Sheet isOpen={isOpen} onClose={handleSheetClose}>\n {getNavigationList()}\n </Sheet>\n ) : (\n <Dropdown\n initialFocus=\"firstFocusable\"\n isOpen={isOpen}\n onClose={handleDropdownClose}\n placement={isEdgeBottom ? 'top-end' : 'bottom-end'}\n anchorRef={overflowTabBarItemRef}>\n {getNavigationList()}\n </Dropdown>\n )}\n </>\n );\n}\n\nconst getIsMobile = () => {\n const { deviceType } = getClientHints();\n return deviceType === 'phone';\n};\n"],"names":["_jsx","Icon","useTabBarContext","useRef","createRef","useCallback","useTranslationBundle","mergeInterpolations","flexitemInterpolations","classNames","styles","NavigationList","RemovableNavigationListItem","NavigationListItem","_jsxs","_Fragment","BaseTabBarItem","OverflowH","Sheet","Dropdown","getClient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156.js → RemovableNavigationListItem-6231df42.js}
RENAMED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('preact/jsx-runtime');
|
|
5
|
-
var BaseNavigationListItem = require('./BaseNavigationListItem-
|
|
6
|
-
var useNavigationListItem = require('./useNavigationListItem-74009187.js');
|
|
5
|
+
var BaseNavigationListItem = require('./BaseNavigationListItem-070d75bc.js');
|
|
7
6
|
var Close = require('./Close-2adc0f0f.js');
|
|
8
7
|
var hooks = require('preact/hooks');
|
|
9
8
|
var useHover = require('./useHover-910b8e32.js');
|
|
@@ -11,7 +10,7 @@ var useTranslationBundle = require('./useTranslationBundle-9da032d6.js');
|
|
|
11
10
|
var EmbeddedIconButton = require('./EmbeddedIconButton-cadadca0.js');
|
|
12
11
|
|
|
13
12
|
function RemovableNavigationListItem({ itemKey, label, badge, metadata, severity }) {
|
|
14
|
-
const { selection, currentKey, onRemove } =
|
|
13
|
+
const { selection, currentKey, onRemove } = BaseNavigationListItem.useNavigationListContext();
|
|
15
14
|
const isSelected = selection === itemKey;
|
|
16
15
|
const isCurrent = currentKey === itemKey;
|
|
17
16
|
const handleRemove = hooks.useCallback(() => {
|
|
@@ -24,4 +23,4 @@ function RemovableNavigationListItem({ itemKey, label, badge, metadata, severity
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
exports.RemovableNavigationListItem = RemovableNavigationListItem;
|
|
27
|
-
//# sourceMappingURL=RemovableNavigationListItem-
|
|
26
|
+
//# sourceMappingURL=RemovableNavigationListItem-6231df42.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemovableNavigationListItem-
|
|
1
|
+
{"version":3,"file":"RemovableNavigationListItem-6231df42.js","sources":["../../src/UNSAFE_NavigationListCommon/RemovableNavigationListItem.tsx"],"sourcesContent":["import { BaseNavigationListItem, BaseNavigationListItemProps } from './BaseNavigationListItem';\nimport { useNavigationListContext } from './useNavigationListContext';\nimport { Close } from '../UNSAFE_RedwoodIcons/Close';\nimport { EmbeddedIconButton } from '../PRIVATE_EmbeddedIconButton';\nimport { useCallback } from 'preact/hooks';\nimport { useHover } from '#hooks/UNSAFE_useHover';\nimport { useTranslationBundle } from '../hooks/UNSAFE_useTranslationBundle';\nimport type { BundleType } from '../resources/nls/bundle';\n\ntype RemovableNavigationListItemProps<K extends string | number> = Omit<\n BaseNavigationListItemProps<K>,\n 'removeIcon'\n>;\n\nexport function RemovableNavigationListItem<K extends string | number>({\n itemKey,\n label,\n badge,\n metadata,\n severity\n}: RemovableNavigationListItemProps<K>) {\n const { selection, currentKey, onRemove } = useNavigationListContext();\n const isSelected = selection === itemKey;\n const isCurrent = currentKey === itemKey;\n\n const handleRemove = useCallback(() => {\n onRemove?.({ value: itemKey as K });\n }, [onRemove, itemKey]);\n\n const { hoverProps, isHover } = useHover({});\n\n const translations = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n\n //instead of specifying flex: '1 0 auto' in cssProps var\n return (\n <div {...hoverProps}>\n <BaseNavigationListItem\n itemKey={itemKey}\n label={label}\n badge={badge}\n metadata={metadata}\n severity={severity}\n removeIcon={\n <span data-oj-navigationlist-item-remove-icon={true}>\n <EmbeddedIconButton\n aria-label={translations.tabBarNavigationList_removeCueText()}\n size=\"xs\"\n onAction={handleRemove}>\n {(isHover || isSelected || isCurrent) && <Close />}\n </EmbeddedIconButton>\n </span>\n }\n />\n </div>\n );\n}\n"],"names":["useNavigationListContext","useCallback","useHover","useTranslationBundle","_jsx","BaseNavigationListItem","EmbeddedIconButton","Close"],"mappings":";;;;;;;;;;;AAcgB,SAAA,2BAA2B,CAA4B,EACrE,OAAO,EACP,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EAC4B,EAAA;IACpC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAGA,+CAAwB,EAAE,CAAC;AACvE,IAAA,MAAM,UAAU,GAAG,SAAS,KAAK,OAAO,CAAC;AACzC,IAAA,MAAM,SAAS,GAAG,UAAU,KAAK,OAAO,CAAC;AAEzC,IAAA,MAAM,YAAY,GAAGC,iBAAW,CAAC,MAAK;QACpC,QAAQ,GAAG,EAAE,KAAK,EAAE,OAAY,EAAE,CAAC,CAAC;AACtC,KAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAExB,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAGC,iBAAQ,CAAC,EAAE,CAAC,CAAC;AAE7C,IAAA,MAAM,YAAY,GAAGC,yCAAoB,CAAa,0BAA0B,CAAC,CAAC;;AAGlF,IAAA,QACEC,cAAA,CAAA,KAAA,EAAA,EAAA,GAAS,UAAU,EAAA,QAAA,EACjBA,cAAC,CAAAC,6CAAsB,EACrB,EAAA,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EACRD,oEAA+C,IAAI,EAAA,QAAA,EACjDA,cAAC,CAAAE,qCAAkB,EACL,EAAA,YAAA,EAAA,YAAY,CAAC,kCAAkC,EAAE,EAC7D,IAAI,EAAC,IAAI,EACT,QAAQ,EAAE,YAAY,EACrB,QAAA,EAAA,CAAC,OAAO,IAAI,UAAU,IAAI,SAAS,KAAKF,cAAA,CAACG,cAAK,EAAA,EAAA,CAAG,EAC/B,CAAA,EAAA,CAChB,EAET,CAAA,EAAA,CACE,EACN;AACJ;;;;"}
|
|
@@ -6,7 +6,7 @@ var preact = require('preact');
|
|
|
6
6
|
var hooks = require('preact/hooks');
|
|
7
7
|
var HiddenAccessible = require('./HiddenAccessible-087eb49a.js');
|
|
8
8
|
var LiveRegion = require('./LiveRegion-1315adeb.js');
|
|
9
|
-
var TabBar = require('./TabBar-
|
|
9
|
+
var TabBar = require('./TabBar-73bb6c97.js');
|
|
10
10
|
var mergeInterpolations = require('./mergeInterpolations-6727b536.js');
|
|
11
11
|
var flexitem = require('./flexitem-fee13e26.js');
|
|
12
12
|
var collectionUtils = require('./collectionUtils-1535080e.js');
|
|
@@ -78,4 +78,4 @@ function ReorderableTabBar({ 'aria-label': ariaLabel, 'aria-labelledby': ariaLab
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
exports.ReorderableTabBar = ReorderableTabBar;
|
|
81
|
-
//# sourceMappingURL=ReorderableTabBar-
|
|
81
|
+
//# sourceMappingURL=ReorderableTabBar-5743c66a.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReorderableTabBar-
|
|
1
|
+
{"version":3,"file":"ReorderableTabBar-5743c66a.js","sources":["../../src/UNSAFE_ReorderableTabBar/ReorderableTabBarItem.tsx","../../src/UNSAFE_ReorderableTabBar/ReorderableTabBar.tsx"],"sourcesContent":["import { useRef, useCallback } from 'preact/hooks';\nimport { mergeInterpolations } from '../utils/UNSAFE_mergeInterpolations';\nimport { flexitemInterpolations } from '../utils/UNSAFE_interpolations/flexitem';\nimport type { FlexitemProps } from '../utils/UNSAFE_interpolations/flexitem';\nimport { getKey } from '../utils/PRIVATE_collectionUtils';\nimport { useReorderableItem } from '../hooks/PRIVATE_useReorderable';\nimport { ReorderableItemProps } from '../UNSAFE_Collection/Reorderable.types';\nimport { useTabBarContext } from '../UNSAFE_TabBar';\nimport { styles } from './themes/ReorderableTabBarItemStyles.css';\n\nexport const ITEM_SELECTOR = '[role=\"tab\"]';\n\ntype ReorderableTabBarItem<K extends string | number> = ReorderableItemProps<K> & {\n layout: 'stretch' | 'condense' | undefined;\n};\n\n/**\n * A private item that will be used by ReorderableTabBar, location TBD (could be moved to PRIVATE_TabBar)\n */\nexport function ReorderableTabBarItem<K extends string | number>({\n children,\n dragKey,\n setDragKey,\n onReorder,\n layout,\n rootRef\n}: ReorderableTabBarItem<K>) {\n const tabBarItemRef = useRef<HTMLDivElement | null>(null);\n const getItem = useCallback(\n () => tabBarItemRef?.current?.querySelector(ITEM_SELECTOR) as HTMLElement,\n []\n );\n const setTransferData = useCallback(\n (event: DragEvent) => {\n event.dataTransfer?.setData('text/tabbar-item-key', getKey(getItem()) + '');\n },\n [getItem]\n );\n\n const { currentKey } = useTabBarContext();\n const { rootProps, isDragged, overlayZoneBeforeProps, overlayZoneAfterProps } =\n useReorderableItem({\n currentKey: currentKey as K,\n isDisabled: onReorder ? false : true,\n draggable: onReorder ? true : false,\n dragKey,\n setDragKey,\n onReorder,\n rootRef,\n ref: tabBarItemRef,\n getItem,\n setTransferData,\n itemStyles: styles,\n itemSelector: ITEM_SELECTOR\n });\n\n //instead of specifying flex: '1 0 auto' in style\n const styleInterpolations = mergeInterpolations<FlexitemProps>([\n ...Object.values(flexitemInterpolations)\n ]);\n const flexDimensions = styleInterpolations({\n flex: layout === 'stretch' ? '1 0 auto' : '0 0 auto'\n });\n\n return (\n <div {...rootProps} style={flexDimensions}>\n {children}\n {!isDragged && dragKey && (\n <>\n <div {...overlayZoneBeforeProps}></div>\n <div {...overlayZoneAfterProps}></div>\n </>\n )}\n </div>\n );\n}\n","import { toChildArray } from 'preact';\nimport { useRef, useState } from 'preact/hooks';\nimport { HiddenAccessible } from '../UNSAFE_HiddenAccessible';\nimport { LiveRegion } from '../UNSAFE_LiveRegion';\nimport { TestIdProps } from '../hooks/UNSAFE_useTestId';\nimport { TabBar, TabBarProps } from '../UNSAFE_TabBar';\nimport { ReorderableTabBarItem, ITEM_SELECTOR } from './ReorderableTabBarItem';\nimport { ReorderableContext, useReorderable } from '../hooks/PRIVATE_useReorderable';\nimport { ReorderProps } from '../UNSAFE_Collection/Reorderable.types';\n\nexport type ReorderableTabBarProps<K extends string | number> = Omit<\n TabBarProps<K>,\n 'aria-describedby'\n> &\n ReorderProps<K> &\n TestIdProps;\n\n/**\n * A component that allows reordering of tabs within a TabBar.\n */\nexport function ReorderableTabBar<K extends string | number>({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n children,\n layout = 'stretch',\n display = 'standard',\n size = 'md',\n edge = 'top',\n selection,\n onSelect,\n onRemove,\n onReorder,\n testId\n}: ReorderableTabBarProps<K>) {\n const rootRef = useRef<HTMLDivElement>(null);\n const [dragKey, setDragKey] = useState<K | undefined>(undefined);\n\n const displayStackProps = {\n display: display\n };\n const displayNonStackProps = {\n display: display,\n size: size\n };\n const displayProps = display === 'stacked' ? displayStackProps : displayNonStackProps;\n\n const {\n reorderProps,\n reorderContext,\n reorderInstructionsId,\n reorderStatus,\n reorderInstructions\n } = useReorderable({\n onReorder,\n rootRef,\n itemSelector: ITEM_SELECTOR\n });\n\n return (\n <div ref={rootRef} {...reorderProps}>\n <ReorderableContext.Provider value={reorderContext}>\n <TabBar\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n layout={layout}\n edge={edge}\n selection={selection}\n onSelect={onSelect}\n onRemove={onRemove}\n testId={testId}\n {...displayProps}\n aria-describedby={reorderInstructionsId}>\n {toChildArray(children).map((child) => {\n return (\n <ReorderableTabBarItem\n dragKey={dragKey}\n setDragKey={setDragKey}\n onReorder={onReorder}\n layout={layout}\n rootRef={rootRef}>\n {child}\n </ReorderableTabBarItem>\n );\n })}\n </TabBar>\n </ReorderableContext.Provider>\n <span id={reorderInstructionsId}>\n <HiddenAccessible>{reorderInstructions}</HiddenAccessible>\n </span>\n <LiveRegion>{reorderStatus}</LiveRegion>\n </div>\n );\n}\n"],"names":["useRef","useCallback","getKey","useTabBarContext","useReorderableItem","styles","mergeInterpolations","flexitemInterpolations","_jsxs","_Fragment","_jsx","useState","useReorderable","ReorderableContext","TabBar","toChildArray","HiddenAccessible","LiveRegion"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUO,MAAM,aAAa,GAAG,cAAc,CAAC;AAM5C;;AAEG;AACa,SAAA,qBAAqB,CAA4B,EAC/D,QAAQ,EACR,OAAO,EACP,UAAU,EACV,SAAS,EACT,MAAM,EACN,OAAO,EACkB,EAAA;AACzB,IAAA,MAAM,aAAa,GAAGA,YAAM,CAAwB,IAAI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AAC,EAAA,KAAK,EAAE,cAAc,EAChD,QAAA,EAAAH,cAAA,CAACI,aAAM,EAAA,EAAA,YAAA,EACO,SAAS,EAAA,iBAAA,EACJ,cAAc,EAC/B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACV,GAAA,YAAY,EACE,kBAAA,EAAA,qBAAqB,EACtC,QAAA,EAAAC,mBAAY,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAI;wBACpC,QACEL,cAAC,CAAA,qBAAqB,EACpB,EAAA,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EACf,QAAA,EAAA,KAAK,EACgB,CAAA,EACxB;qBACH,CAAC,GACK,EACmB,CAAA,EAC9BA,yBAAM,EAAE,EAAE,qBAAqB,EAAA,QAAA,EAC7BA,cAAC,CAAAM,iCAAgB,cAAE,mBAAmB,EAAA,CAAoB,EACrD,CAAA,EACPN,cAAC,CAAAO,qBAAU,cAAE,aAAa,EAAA,CAAc,CACpC,EAAA,CAAA,EACN;AACJ;;;;"}
|
|
@@ -19,11 +19,6 @@ require('./ConveyorBeltContext-bfe84b44.js');
|
|
|
19
19
|
require('preact');
|
|
20
20
|
require('./useTooltipControlled-706a3651.js');
|
|
21
21
|
|
|
22
|
-
require('./NavigationList-5218562e.js');
|
|
23
|
-
require('./useNavigationListItem-74009187.js');
|
|
24
|
-
require('./UNSAFE_NavigationList/themes/NavigationListItemStyles.css.js');
|
|
25
|
-
|
|
26
|
-
require('./UNSAFE_NavigationList/themes/redwood/NavigationListItemVariants.css.js');
|
|
27
22
|
require('./Floating-1280c2ce.js');
|
|
28
23
|
|
|
29
24
|
require('./keyboardUtils-f835e1ee.js');
|
|
@@ -67,4 +62,4 @@ const TabBar = compat.forwardRef(({ children, layout = 'stretch', display = 'sta
|
|
|
67
62
|
});
|
|
68
63
|
|
|
69
64
|
exports.TabBar = TabBar;
|
|
70
|
-
//# sourceMappingURL=TabBar-
|
|
65
|
+
//# sourceMappingURL=TabBar-73bb6c97.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar-
|
|
1
|
+
{"version":3,"file":"TabBar-73bb6c97.js","sources":["../../src/UNSAFE_TabBar/TabBar.tsx"],"sourcesContent":["import { ComponentChildren, Ref } from 'preact';\nimport { useImperativeHandle, useRef } from 'preact/hooks';\nimport { TabBarContext, TabBarLayout } from '../UNSAFE_TabBarCommon';\nimport { styles } from './themes/TabBarStyles.css';\nimport { TestIdProps } from '../hooks/UNSAFE_useTestId';\nimport { useTabBar } from '../hooks/PRIVATE_useTabBar';\nimport { forwardRef } from 'preact/compat';\nexport {\n TabBarItem,\n RemovableTabBarItem,\n OverflowTabBarItem,\n TabBarContext,\n useTabBarContext,\n TabBarLayout\n} from '../UNSAFE_TabBarCommon';\n\nexport type FocusableHandle = {\n focus: () => void;\n blur: () => void;\n};\n\n/**\n * type for payload of current key change event handler\n */\nexport type CurrentKeyDetail<K> = {\n value: K;\n};\n\n/**\n * type for payload of selection change event handler\n */\ntype SelectionDetail<K> = {\n value: K;\n};\n\n/**\n * type for payload of remove event handler\n */\ntype RemoveDetail<K> = {\n value: K;\n};\n\ntype DisplayProps =\n | {\n /**\n * Controls the content layout of the TabBarItem: 'standard' lays out the contents horizontally,\n *'icons' hides the label,\n */\n display?: 'standard' | 'icons';\n /**\n * The size indicates how tall the TabBarItem is rendered.\n * Note: It is not possible to specify 'size' when 'display=\"stacked\".\n */\n size?: 'md' | 'lg';\n }\n | {\n /**\n *'stacked' stacks the icon on top of the label.\n * Note: It is not possible to specify 'size' when 'display=\"stacked\".\n */\n display?: 'stacked';\n size?: 'never';\n };\n\nexport type TabBarProps<K extends string | number> = DisplayProps & {\n /**\n * A set of TabBarItem(s) that TabBar will hold\n */\n children: ComponentChildren;\n /**\n * Whether to stretch the tab bar items to occupy available space or to condense items\n */\n layout?: 'stretch' | 'condense';\n /**\n * The position of the TabBar. Valid Values: top and bottom.\n * 'top' is used when TabBar is placed on top of content section and the selection\n * indicator would be placed below the TabBarItem.\n * 'bottom' is used when TabBar is placed on bottom of content section and the selection\n * indicator would be placed above the TabBarItem.\n */\n edge?: 'top' | 'bottom';\n /**\n * Key of the selected item.\n */\n selection?: K;\n /**\n * Callback function to handle when user selects a tab.\n * The callback is also invoked when a user selects a tab that is already selected.\n */\n onSelect?: <K extends string | number>(detail: SelectionDetail<K>) => void;\n /**\n * Callback function to handle remove\n */\n onRemove?: <K extends string | number>(detail: RemoveDetail<K>) => void;\n /**\n * Accepts the ID of an element that provides instructions for interaction with the TabBar.\n */\n 'aria-describedby'?: string;\n /**\n * An aria-label which defines a string value that labels this TabBar.\n * Either aria-label or aria-labelledby should be specified in order to make TabBar accessible.\n */\n 'aria-label'?: string;\n\n /**\n * An aria-labelledby which identifies the element(s) that labels this TabBar.\n * Either aria-label or aria-labelledby should be specified in order to make TabBar accessible.\n */\n 'aria-labelledby'?: string;\n};\n/**\n * A tab bar allows navigation between different content sections.\n */\nexport const TabBar = forwardRef(\n <K extends string | number>(\n {\n children,\n layout = 'stretch',\n display = 'standard',\n size = 'md',\n edge = 'top',\n selection,\n onSelect,\n onRemove,\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n }: TabBarProps<K> & TestIdProps,\n ref?: Ref<FocusableHandle>\n ) => {\n const rootRef = useRef<HTMLDivElement>(null);\n\n //Allows to call focus on rootRef without having to expose it\n useImperativeHandle(ref!, () => ({\n focus: () => {\n if (rootRef.current) {\n rootRef.current.focus();\n }\n },\n blur: () => {\n if (rootRef.current) {\n rootRef.current.focus();\n }\n }\n }));\n\n const { rootProps, tabBarContext } = useTabBar({\n class: styles.tabBarBase,\n edge: edge,\n onRemove,\n onSelect,\n ref: rootRef,\n selection,\n size,\n children\n });\n return (\n <TabBarContext.Provider value={tabBarContext}>\n <div\n {...rootProps}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedBy}>\n <TabBarLayout layout={layout} display={display}>\n {children}\n </TabBarLayout>\n </div>\n </TabBarContext.Provider>\n );\n }\n);\n"],"names":["forwardRef","useRef","useImperativeHandle","useTabBar","styles","_jsx","TabBarContext","TabBarLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GA;;AAEG;MACU,MAAM,GAAGA,iBAAU,CAC9B,CACE,EACE,QAAQ,EACR,MAAM,GAAG,SAAS,EAClB,OAAO,GAAG,UAAU,EACpB,IAAI,GAAG,IAAI,EACX,IAAI,GAAG,KAAK,EACZ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAAE,eAAe,EACnC,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACJ,EAC/B,GAA0B,KACxB;AACF,IAAA,MAAM,OAAO,GAAGC,YAAM,CAAiB,IAAI,CAAC,CAAC;;AAG7C,IAAAC,yBAAmB,CAAC,GAAI,EAAE,OAAO;QAC/B,KAAK,EAAE,MAAK;AACV,YAAA,IAAI,OAAO,CAAC,OAAO,EAAE;AACnB,gBAAA,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;aACzB;SACF;QACD,IAAI,EAAE,MAAK;AACT,YAAA,IAAI,OAAO,CAAC,OAAO,EAAE;AACnB,gBAAA,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;aACzB;SACF;AACF,KAAA,CAAC,CAAC,CAAC;AAEJ,IAAA,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAGC,mBAAS,CAAC;QAC7C,KAAK,EAAEC,4CAAM,CAAC,UAAU;AACxB,QAAA,IAAI,EAAE,IAAI;QACV,QAAQ;QACR,QAAQ;AACR,QAAA,GAAG,EAAE,OAAO;QACZ,SAAS;QACT,IAAI;QACJ,QAAQ;AACT,KAAA,CAAC,CAAC;AACH,IAAA,QACEC,cAAA,CAACC,8BAAa,CAAC,QAAQ,EAAC,EAAA,KAAK,EAAE,aAAa,YAC1CD,cACM,CAAA,KAAA,EAAA,EAAA,GAAA,SAAS,EACD,YAAA,EAAA,SAAS,qBACJ,cAAc,EAAA,kBAAA,EACb,eAAe,EAAA,QAAA,EACjCA,eAACE,yBAAY,EAAA,EAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,YAC3C,QAAQ,EAAA,CACI,EACX,CAAA,EAAA,CACiB,EACzB;AACJ,CAAC;;;;"}
|
|
@@ -19,11 +19,6 @@ require('./ConveyorBeltContext-bfe84b44.js');
|
|
|
19
19
|
require('preact');
|
|
20
20
|
require('./useTooltipControlled-706a3651.js');
|
|
21
21
|
|
|
22
|
-
require('./NavigationList-5218562e.js');
|
|
23
|
-
require('./useNavigationListItem-74009187.js');
|
|
24
|
-
require('./UNSAFE_NavigationList/themes/NavigationListItemStyles.css.js');
|
|
25
|
-
|
|
26
|
-
require('./UNSAFE_NavigationList/themes/redwood/NavigationListItemVariants.css.js');
|
|
27
22
|
require('./Floating-1280c2ce.js');
|
|
28
23
|
|
|
29
24
|
require('./keyboardUtils-f835e1ee.js');
|
|
@@ -77,4 +72,4 @@ const TabBarMixed = compat.forwardRef((props, focusHandleRef) => {
|
|
|
77
72
|
});
|
|
78
73
|
|
|
79
74
|
exports.TabBarMixed = TabBarMixed;
|
|
80
|
-
//# sourceMappingURL=TabBarMixed-
|
|
75
|
+
//# sourceMappingURL=TabBarMixed-426fcaf1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarMixed-
|
|
1
|
+
{"version":3,"file":"TabBarMixed-426fcaf1.js","sources":["../../src/UNSAFE_TabBarMixed/useTabBarMixed.ts","../../src/UNSAFE_TabBarMixed/TabBarMixed.tsx"],"sourcesContent":["import { ComponentProps, ContextType, RefObject } from 'preact';\nimport type { TabBarContext, TabBarLayout } from '../UNSAFE_TabBarCommon';\n\nimport { useTabBar } from '../hooks/PRIVATE_useTabBar';\n\ntype TabBarContextValue = ContextType<typeof TabBarContext>;\n\nexport type useTabBarOptions = {\n class?: string;\n display?: TabBarContextValue['display'];\n edge?: 'bottom' | 'top';\n onRemove?: TabBarContextValue['onRemove'];\n onSelect?: TabBarContextValue['onSelect'];\n ref?: RefObject<HTMLDivElement>;\n selection?: TabBarContextValue['selection'];\n size?: TabBarContextValue['size'];\n children?: ComponentProps<typeof TabBarLayout>['children'];\n};\n\n/**\n * A thin wrapper around useTabBar hook\n */\nexport function useTabBarMixed(options: useTabBarOptions) {\n return useTabBar(options);\n}\n","import type { ComponentChildren } from 'preact';\nimport { useRef } from 'preact/hooks';\nimport { Ref } from 'preact';\nimport { forwardRef, useImperativeHandle } from 'preact/compat';\nimport { TabBarContext } from '../UNSAFE_TabBarCommon';\nimport { styles } from './themes/TabBarMixedStyles.css';\nimport { useTabBarMixed as useTabBar } from './useTabBarMixed';\n\ntype UseTabBarOptions = Parameters<typeof useTabBar>[0];\n\n/**\n * Component props expected to be pased to **TabBarMixed**.\n *\n * @see {@link TabBarMixed}\n */\ntype TabBarMixedProps<K extends string | number> = {\n /**\n * Component children that will be rendered within the **TabBarMixed**\n * root element.\n *\n * It is expected that **TabBarLayout** and **ConveyorBelt** elements are\n * provided. The same **TabBarItem**, **RemovableTabBarItem**,\n * and **OverflowTabBarItem** elements should also be used.\n */\n children?: ComponentChildren;\n /**\n * Callback fired when a tab item is removed.\n */\n onRemove?: UseTabBarOptions['onRemove'];\n /**\n * Callback fired when a tab item is selected.\n */\n onSelect?: UseTabBarOptions['onSelect'];\n /**\n * The item key of the selected tab item.\n */\n selection?: K;\n /**\n * The height of the the tab bar.\n *\n * @default \"md\"\n */\n size?: UseTabBarOptions['size'];\n /**\n * An aria-label which defines a string value that labels this TabBarMixed.\n * Either aria-label or aria-labelledby should be specified in order to make TabBarMixed accessible.\n */\n 'aria-label'?: string;\n\n /**\n * An aria-labelledby which identifies the element(s) that labels this TabBarMixed.\n * Either aria-label or aria-labelledby should be specified in order to make TabBarMixed accessible.\n */\n 'aria-labelledby'?: string;\n};\n\nexport type FocusableHandle = {\n focus: () => void;\n blur: () => void;\n};\n\n/**\n * A navigation component that enables horizontal navigation between distinct content with a mixture of static and dynamic tabs.\n *\n * @param {TabBarMixedProps} props TabBarMixed component props.\n * @returns {JSX.Element} TabBarMixed component element.\n */\nexport const TabBarMixed = forwardRef(\n <K extends string | number>(\n props: TabBarMixedProps<K>,\n focusHandleRef?: Ref<FocusableHandle>\n ) => {\n const {\n children,\n onRemove,\n onSelect,\n selection,\n size,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby\n } = props;\n\n const rootRef = useRef<HTMLDivElement>(null);\n\n const { rootProps, tabBarContext } = useTabBar({\n class: styles.tabBarBase,\n edge: 'bottom',\n onRemove,\n onSelect,\n ref: rootRef,\n selection,\n size,\n children\n });\n\n //Allows to call focus on rootRef without having to expose it\n useImperativeHandle(focusHandleRef!, () => ({\n focus: () => {\n if (rootRef.current) {\n rootRef.current.focus();\n }\n },\n blur: () => {\n if (rootRef.current) {\n rootRef.current.blur();\n }\n }\n }));\n\n return (\n <TabBarContext.Provider value={tabBarContext}>\n <div aria-label={ariaLabel} aria-labelledby={ariaLabelledby} {...rootProps}>\n {children}\n </div>\n </TabBarContext.Provider>\n );\n }\n);\n"],"names":["useTabBar","forwardRef","useRef","styles","useImperativeHandle","_jsx","TabBarContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA;;AAEG;AACG,SAAU,cAAc,CAAC,OAAyB,EAAA;AACtD,IAAA,OAAOA,mBAAS,CAAC,OAAO,CAAC,CAAC;AAC5B;;ACqCA;;;;;AAKG;AACU,MAAA,WAAW,GAAGC,iBAAU,CACnC,CACE,KAA0B,EAC1B,cAAqC,KACnC;IACF,MAAM,EACJ,QAAQ,EACR,QAA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