@react-spectrum/s2 0.10.0 → 0.11.0
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/dist/Accordion.cjs +2 -2
- package/dist/Accordion.css +2 -2
- package/dist/Accordion.mjs +2 -2
- package/dist/ActionBar.cjs +62 -62
- package/dist/ActionBar.css +61 -61
- package/dist/ActionBar.mjs +62 -62
- package/dist/ActionButton.cjs +202 -202
- package/dist/ActionButton.css +138 -138
- package/dist/ActionButton.mjs +202 -202
- package/dist/ActionButtonGroup.cjs +15 -15
- package/dist/ActionButtonGroup.css +9 -9
- package/dist/ActionButtonGroup.mjs +15 -15
- package/dist/Add.cjs +10 -10
- package/dist/Add.css +6 -6
- package/dist/Add.mjs +10 -10
- package/dist/AlertDialog.cjs +3 -3
- package/dist/AlertDialog.css +3 -3
- package/dist/AlertDialog.mjs +3 -3
- package/dist/Asterisk.cjs +6 -6
- package/dist/Asterisk.css +4 -4
- package/dist/Asterisk.mjs +6 -6
- package/dist/Avatar.cjs +14 -14
- package/dist/Avatar.css +14 -14
- package/dist/Avatar.mjs +14 -14
- package/dist/AvatarGroup.cjs +134 -134
- package/dist/AvatarGroup.css +33 -33
- package/dist/AvatarGroup.mjs +134 -134
- package/dist/Badge.cjs +206 -206
- package/dist/Badge.css +127 -127
- package/dist/Badge.mjs +206 -206
- package/dist/Breadcrumbs.cjs +254 -254
- package/dist/Breadcrumbs.css +109 -109
- package/dist/Breadcrumbs.mjs +254 -254
- package/dist/Button.cjs +341 -341
- package/dist/Button.css +177 -177
- package/dist/Button.mjs +341 -341
- package/dist/ButtonGroup.cjs +20 -20
- package/dist/ButtonGroup.css +15 -15
- package/dist/ButtonGroup.mjs +20 -20
- package/dist/Calendar.cjs +151 -139
- package/dist/Calendar.cjs.map +1 -1
- package/dist/Calendar.css +134 -134
- package/dist/Calendar.css.map +1 -1
- package/dist/Calendar.mjs +153 -141
- package/dist/Calendar.mjs.map +1 -1
- package/dist/Card.cjs +304 -304
- package/dist/Card.css +209 -209
- package/dist/Card.mjs +304 -304
- package/dist/CardView.cjs +16 -16
- package/dist/CardView.css +16 -16
- package/dist/CardView.mjs +16 -16
- package/dist/CenterBaseline.cjs +1 -1
- package/dist/CenterBaseline.css +2 -2
- package/dist/CenterBaseline.mjs +1 -1
- package/dist/Checkbox.cjs +170 -170
- package/dist/Checkbox.css +92 -92
- package/dist/Checkbox.mjs +170 -170
- package/dist/CheckboxGroup.cjs +45 -45
- package/dist/CheckboxGroup.css +38 -38
- package/dist/CheckboxGroup.mjs +45 -45
- package/dist/Checkmark.cjs +12 -12
- package/dist/Checkmark.css +8 -8
- package/dist/Checkmark.mjs +12 -12
- package/dist/Chevron.cjs +12 -12
- package/dist/Chevron.css +10 -10
- package/dist/Chevron.mjs +12 -12
- package/dist/ClearButton.cjs +29 -29
- package/dist/ClearButton.css +29 -29
- package/dist/ClearButton.mjs +29 -29
- package/dist/CloseButton.cjs +54 -54
- package/dist/CloseButton.css +46 -46
- package/dist/CloseButton.mjs +54 -54
- package/dist/ColorArea.cjs +16 -16
- package/dist/ColorArea.css +16 -16
- package/dist/ColorArea.mjs +16 -16
- package/dist/ColorField.cjs +32 -32
- package/dist/ColorField.css +28 -28
- package/dist/ColorField.mjs +32 -32
- package/dist/ColorHandle.cjs +27 -27
- package/dist/ColorHandle.css +42 -42
- package/dist/ColorHandle.mjs +27 -27
- package/dist/ColorSlider.cjs +118 -118
- package/dist/ColorSlider.css +54 -54
- package/dist/ColorSlider.mjs +118 -118
- package/dist/ColorSwatch.cjs +29 -29
- package/dist/ColorSwatch.css +29 -29
- package/dist/ColorSwatch.mjs +29 -29
- package/dist/ColorSwatchPicker.cjs +27 -27
- package/dist/ColorSwatchPicker.css +46 -46
- package/dist/ColorSwatchPicker.mjs +27 -27
- package/dist/ColorWheel.cjs +26 -26
- package/dist/ColorWheel.css +17 -17
- package/dist/ColorWheel.mjs +26 -26
- package/dist/ComboBox.cjs +415 -400
- package/dist/ComboBox.cjs.map +1 -1
- package/dist/ComboBox.css +181 -181
- package/dist/ComboBox.css.map +1 -1
- package/dist/ComboBox.mjs +415 -400
- package/dist/ComboBox.mjs.map +1 -1
- package/dist/ContextualHelp.cjs +5 -5
- package/dist/ContextualHelp.css +60 -60
- package/dist/ContextualHelp.mjs +5 -5
- package/dist/Cross.cjs +14 -14
- package/dist/Cross.css +10 -10
- package/dist/Cross.mjs +14 -14
- package/dist/CustomDialog.cjs +25 -25
- package/dist/CustomDialog.css +25 -25
- package/dist/CustomDialog.mjs +25 -25
- package/dist/Dash.cjs +10 -10
- package/dist/Dash.css +6 -6
- package/dist/Dash.mjs +10 -10
- package/dist/DateField.cjs +73 -73
- package/dist/DateField.css +77 -77
- package/dist/DateField.mjs +73 -73
- package/dist/DatePicker.cjs +182 -185
- package/dist/DatePicker.cjs.map +1 -1
- package/dist/DatePicker.css +126 -126
- package/dist/DatePicker.css.map +1 -1
- package/dist/DatePicker.mjs +182 -185
- package/dist/DatePicker.mjs.map +1 -1
- package/dist/DateRangePicker.cjs +58 -61
- package/dist/DateRangePicker.cjs.map +1 -1
- package/dist/DateRangePicker.css +60 -60
- package/dist/DateRangePicker.css.map +1 -1
- package/dist/DateRangePicker.mjs +58 -61
- package/dist/DateRangePicker.mjs.map +1 -1
- package/dist/Dialog.cjs +17 -17
- package/dist/Dialog.css +82 -82
- package/dist/Dialog.mjs +17 -17
- package/dist/Disclosure.cjs +135 -135
- package/dist/Disclosure.css +106 -106
- package/dist/Disclosure.mjs +135 -135
- package/dist/Divider.cjs +25 -25
- package/dist/Divider.css +25 -25
- package/dist/Divider.mjs +25 -25
- package/dist/DropZone.cjs +62 -62
- package/dist/DropZone.css +58 -58
- package/dist/DropZone.mjs +62 -62
- package/dist/Field.cjs +370 -370
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +142 -142
- package/dist/Field.mjs +370 -370
- package/dist/Field.mjs.map +1 -1
- package/dist/Form.cjs +9 -9
- package/dist/Form.css +9 -9
- package/dist/Form.mjs +9 -9
- package/dist/FullscreenDialog.cjs +5 -5
- package/dist/FullscreenDialog.css +91 -91
- package/dist/FullscreenDialog.mjs +5 -5
- package/dist/IllustratedMessage.cjs +256 -256
- package/dist/IllustratedMessage.css +78 -78
- package/dist/IllustratedMessage.mjs +256 -256
- package/dist/Image.cjs +13 -13
- package/dist/Image.css +14 -14
- package/dist/Image.mjs +13 -13
- package/dist/InlineAlert.cjs +117 -117
- package/dist/InlineAlert.css +98 -98
- package/dist/InlineAlert.mjs +117 -117
- package/dist/Link.cjs +54 -54
- package/dist/Link.css +46 -46
- package/dist/Link.mjs +54 -54
- package/dist/LinkOut.cjs +8 -8
- package/dist/LinkOut.css +8 -8
- package/dist/LinkOut.mjs +8 -8
- package/dist/Menu.cjs +459 -459
- package/dist/Menu.css +185 -185
- package/dist/Menu.mjs +459 -459
- package/dist/Meter.cjs +163 -163
- package/dist/Meter.css +93 -93
- package/dist/Meter.mjs +163 -163
- package/dist/Modal.cjs +58 -58
- package/dist/Modal.css +50 -50
- package/dist/Modal.mjs +58 -58
- package/dist/NotificationBadge.cjs +58 -58
- package/dist/NotificationBadge.css +51 -51
- package/dist/NotificationBadge.mjs +58 -58
- package/dist/NumberField.cjs +115 -115
- package/dist/NumberField.css +100 -100
- package/dist/NumberField.mjs +115 -115
- package/dist/Picker.cjs +283 -283
- package/dist/Picker.css +169 -169
- package/dist/Picker.mjs +283 -283
- package/dist/Popover.cjs +86 -86
- package/dist/Popover.css +66 -66
- package/dist/Popover.mjs +86 -86
- package/dist/ProgressBar.cjs +173 -173
- package/dist/ProgressBar.css +101 -101
- package/dist/ProgressBar.mjs +173 -173
- package/dist/ProgressCircle.cjs +31 -31
- package/dist/ProgressCircle.css +24 -24
- package/dist/ProgressCircle.mjs +31 -31
- package/dist/Provider.cjs +11 -11
- package/dist/Provider.css +10 -10
- package/dist/Provider.mjs +11 -11
- package/dist/Radio.cjs +154 -154
- package/dist/Radio.css +79 -79
- package/dist/Radio.mjs +154 -154
- package/dist/RadioGroup.cjs +42 -42
- package/dist/RadioGroup.css +38 -38
- package/dist/RadioGroup.mjs +42 -42
- package/dist/RangeCalendar.cjs +32 -20
- package/dist/RangeCalendar.cjs.map +1 -1
- package/dist/RangeCalendar.css +10 -10
- package/dist/RangeCalendar.css.map +1 -1
- package/dist/RangeCalendar.mjs +34 -22
- package/dist/RangeCalendar.mjs.map +1 -1
- package/dist/SearchField.cjs +42 -42
- package/dist/SearchField.css +46 -46
- package/dist/SearchField.mjs +42 -42
- package/dist/SegmentedControl.cjs +181 -181
- package/dist/SegmentedControl.css +118 -118
- package/dist/SegmentedControl.mjs +181 -181
- package/dist/SelectBoxGroup.cjs +342 -0
- package/dist/SelectBoxGroup.cjs.map +1 -0
- package/dist/SelectBoxGroup.css +503 -0
- package/dist/SelectBoxGroup.css.map +1 -0
- package/dist/SelectBoxGroup.mjs +335 -0
- package/dist/SelectBoxGroup.mjs.map +1 -0
- package/dist/SkeletonCollection.cjs +6 -1
- package/dist/SkeletonCollection.cjs.map +1 -1
- package/dist/SkeletonCollection.mjs +7 -2
- package/dist/SkeletonCollection.mjs.map +1 -1
- package/dist/Slider.cjs +299 -299
- package/dist/Slider.css +151 -151
- package/dist/Slider.mjs +299 -299
- package/dist/StatusLight.cjs +125 -125
- package/dist/StatusLight.css +61 -61
- package/dist/StatusLight.mjs +125 -125
- package/dist/Switch.cjs +162 -162
- package/dist/Switch.css +74 -74
- package/dist/Switch.mjs +162 -162
- package/dist/TableView.cjs +319 -319
- package/dist/TableView.css +172 -172
- package/dist/TableView.mjs +319 -319
- package/dist/Tabs.cjs +213 -188
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css +105 -101
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +213 -188
- package/dist/Tabs.mjs.map +1 -1
- package/dist/TabsPicker.cjs +127 -127
- package/dist/TabsPicker.css +111 -111
- package/dist/TabsPicker.mjs +127 -127
- package/dist/TagGroup.cjs +213 -213
- package/dist/TagGroup.css +147 -147
- package/dist/TagGroup.mjs +213 -213
- package/dist/TextField.cjs +59 -59
- package/dist/TextField.css +54 -54
- package/dist/TextField.mjs +59 -59
- package/dist/TimeField.cjs +52 -52
- package/dist/TimeField.css +48 -48
- package/dist/TimeField.mjs +52 -52
- package/dist/Toast.cjs +120 -120
- package/dist/Toast.css +107 -107
- package/dist/Toast.mjs +120 -120
- package/dist/ToggleButton.cjs +3 -3
- package/dist/ToggleButton.css +12 -12
- package/dist/ToggleButton.mjs +3 -3
- package/dist/Tooltip.cjs +83 -83
- package/dist/Tooltip.css +70 -70
- package/dist/Tooltip.mjs +83 -83
- package/dist/TreeView.cjs +146 -146
- package/dist/TreeView.css +147 -147
- package/dist/TreeView.mjs +146 -146
- package/dist/main.cjs +5 -0
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +3 -1
- package/dist/module.mjs.map +1 -1
- package/dist/types.d.ts +43 -1
- package/dist/types.d.ts.map +1 -1
- package/icons/Icon.cjs +10 -10
- package/icons/Icon.css +9 -9
- package/icons/Icon.mjs +10 -10
- package/icons/Skeleton.cjs +2 -2
- package/icons/Skeleton.cjs.map +1 -1
- package/icons/Skeleton.css +6 -6
- package/icons/Skeleton.mjs +2 -2
- package/icons/Skeleton.mjs.map +1 -1
- package/package.json +21 -21
- package/src/Calendar.tsx +13 -6
- package/src/ComboBox.tsx +20 -5
- package/src/DatePicker.tsx +1 -7
- package/src/DateRangePicker.tsx +1 -7
- package/src/RangeCalendar.tsx +13 -6
- package/src/SelectBoxGroup.tsx +408 -0
- package/src/SkeletonCollection.tsx +6 -2
- package/src/Tabs.tsx +49 -24
- package/src/index.ts +2 -0
- package/style/__tests__/style-macro.test.js +162 -166
- package/style/dist/main.cjs +24 -24
- package/style/dist/module.mjs +13 -13
- package/style/dist/properties.mjs +3 -3
- package/style/dist/spectrum-theme.cjs +219 -219
- package/style/dist/spectrum-theme.mjs +210 -210
- package/style/dist/style-macro.cjs +80 -80
- package/style/dist/style-macro.mjs +75 -75
package/dist/Tabs.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AC0Fa;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAwEG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6DR;;;;EAAA;;;;EAgBkB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA4Cd;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA+CC;;;;EAAA;;;;EAsCO;;;;EAAA;;;;EAU4C;;;;EAwE/C;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA8EA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA+CA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAreJ;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAqJa;EAAA;IAAA;;;;IAAA;;;;IA4Cd;;;;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAAA","sources":["d333cabc54201ea1","packages/@react-spectrum/s2/src/Tabs.tsx"],"sourcesContent":["@import \"575a5a16650d7070\";\n@import \"7a0058ba44ec735a\";\n@import \"ea0c0ad20f1e1c01\";\n@import \"1a91a7d853a67795\";\n@import \"b645d7882760dc18\";\n@import \"5aa00674bbf9e612\";\n@import \"9d65793a05791106\";\n@import \"2976d7d1f8a0759d\";\n@import \"713e94facc5ee3f3\";\n@import \"64129d49d07323ce\";\n@import \"5458e36ec7f2a11f\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TabListProps as AriaTabListProps,\n TabPanel as AriaTabPanel,\n TabPanelProps as AriaTabPanelProps,\n TabProps as AriaTabProps,\n TabsProps as AriaTabsProps,\n ContextValue,\n Group,\n Provider,\n Tab as RACTab,\n TabList as RACTabList,\n Tabs as RACTabs,\n TabListStateContext,\n TabRenderProps\n} from 'react-aria-components';\nimport {baseColor, focusRing, size, style} from '../style' with {type: 'macro'};\nimport {centerBaseline} from './CenterBaseline';\nimport {Collection, DOMRef, DOMRefValue, GlobalDOMAttributes, Key, Node, Orientation, RefObject} from '@react-types/shared';\nimport {CollectionBuilder} from '@react-aria/collections';\nimport {createContext, forwardRef, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {getAllowedOverrides, StyleProps, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {inertValue, useEffectEvent, useId, useLabels, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {Picker, PickerItem} from './TabsPicker';\nimport {Text, TextContext} from './Content';\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef, useMediaQuery} from '@react-spectrum/utils';\nimport {useHasTabbableChild} from '@react-aria/focus';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style' | 'children' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the tabs. */\n children: ReactNode,\n /**\n * The amount of space between the tabs.\n * @default 'regular'\n */\n density?: 'compact' | 'regular',\n /**\n * Defines if the text within the tabs should be hidden and only the icon should be shown.\n * The text is always visible when the item is collapsed into a picker.\n * @default 'show'\n */\n labelBehavior?: 'show' | 'hide'\n}\n\nexport interface TabProps extends Omit<AriaTabProps, 'children' | 'style' | 'className' | 'onClick' | keyof GlobalDOMAttributes>, StyleProps {\n /** The content to display in the tab. */\n children: ReactNode\n}\n\nexport interface TabListProps<T> extends Omit<AriaTabListProps<T>, 'style' | 'className' | 'aria-label' | 'aria-labelledby' | keyof GlobalDOMAttributes>, StyleProps {\n /** The content to display in the tablist. */\n children: ReactNode | ((item: T) => ReactNode)\n}\n\nexport interface TabPanelProps extends Omit<AriaTabPanelProps, 'children' | 'style' | 'className' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the tab panels. */\n children: ReactNode\n}\n\nexport const TabsContext = createContext<ContextValue<Partial<TabsProps>, DOMRefValue<HTMLDivElement>>>(null);\nconst InternalTabsContext = createContext<Partial<TabsProps> & {\n tablistRef?: RefObject<HTMLDivElement | null>,\n prevRef?: RefObject<DOMRect | null>,\n selectedKey?: Key | null\n}>({});\nconst CollapseContext = createContext({\n showTabs: true,\n menuId: '',\n valueId: ''\n});\n\nconst tabs = style({\n position: 'relative',\n display: 'flex',\n flexShrink: 0,\n font: 'ui',\n flexDirection: {\n orientation: {\n horizontal: 'column'\n }\n }\n}, getAllowedOverrides({height: true}));\n\n/**\n * Tabs organize content into multiple sections and allow users to navigate between them. The content under the set of tabs should be related and form a coherent unit.\n */\nexport const Tabs = forwardRef(function Tabs(props: TabsProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TabsContext);\n let {\n density = 'regular',\n isDisabled,\n disabledKeys,\n orientation = 'horizontal',\n labelBehavior = 'show'\n } = props;\n let domRef = useDOMRef(ref);\n let [value, setValue] = useControlledState(props.selectedKey, props.defaultSelectedKey ?? null!, props.onSelectionChange);\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n throw new Error('An aria-label or aria-labelledby prop is required on Tabs for accessibility.');\n }\n\n let tablistRef = useRef<HTMLDivElement | null>(null);\n let prevRef = useRef<DOMRect | null>(null);\n\n let onChange = useEffectEvent((val: Key) => {\n if (tablistRef.current) {\n prevRef.current = tablistRef.current.querySelector('[role=tab][data-selected=true]')?.getBoundingClientRect() ?? null;\n }\n setValue(val);\n });\n\n return (\n <Provider\n values={[\n [InternalTabsContext, {\n density,\n isDisabled,\n orientation,\n disabledKeys,\n selectedKey: value,\n tablistRef,\n prevRef,\n onSelectionChange: onChange,\n labelBehavior,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby']\n }]\n ]}>\n <CollectionBuilder content={props.children}>\n {collection => (\n <CollapsingTabs\n {...props}\n selectedKey={value}\n onSelectionChange={onChange}\n collection={collection}\n containerRef={domRef} />\n )}\n </CollectionBuilder>\n </Provider>\n );\n});\n\nconst tablist = style({\n display: 'flex',\n gap: {\n orientation: {\n horizontal: {\n density: {\n compact: 24,\n regular: 32\n },\n labelBehavior: {\n hide: {\n density: {\n compact: 16,\n regular: 24\n }\n }\n }\n }\n }\n },\n flexDirection: {\n orientation: {\n vertical: 'column'\n }\n },\n marginEnd: {\n orientation: {\n vertical: 20\n }\n },\n marginStart: {\n orientation: {\n vertical: 12\n }\n },\n minWidth: 'min'\n});\n\nexport function TabList<T extends object>(props: TabListProps<T>): ReactNode | null {\n let {showTabs} = useContext(CollapseContext) ?? {};\n\n if (showTabs) {\n return <TabListInner {...props} />;\n }\n return null;\n}\n\nfunction TabListInner<T extends object>(props: TabListProps<T>) {\n let {\n tablistRef,\n density,\n labelBehavior,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = useContext(InternalTabsContext) ?? {};\n\n return (\n <div\n style={props.UNSAFE_style}\n className={\n (props.UNSAFE_className || '') +\n style({\n position: 'relative',\n flexGrow: 0,\n flexShrink: 0,\n minWidth: 'min'\n }, getAllowedOverrides())(null, props.styles)}>\n <RACTabList\n {...props}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n ref={tablistRef}\n className={renderProps => tablist({...renderProps, labelBehavior, density})} />\n </div>\n );\n}\n\nconst selectedIndicator = style<{isDisabled: boolean, orientation?: Orientation}>({\n position: 'absolute',\n backgroundColor: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n height: {\n default: 'full',\n orientation: {\n horizontal: '[2px]'\n }\n },\n width: {\n default: 'full',\n orientation: {\n vertical: '[2px]'\n }\n },\n bottom: {\n default: 0\n },\n top: {\n orientation: {\n vertical: 0\n }\n },\n left: {\n orientation: {\n horizontal: 0\n }\n },\n insetStart: {\n orientation: {\n vertical: -12\n }\n },\n borderStyle: 'none',\n borderRadius: 'full'\n});\n\nconst tab = style<TabRenderProps & {density?: 'compact' | 'regular', labelBehavior?: 'show' | 'hide', orientation?: Orientation}>({\n ...focusRing(),\n display: 'flex',\n color: {\n default: baseColor('neutral-subdued'),\n isSelected: baseColor('neutral'),\n isDisabled: 'disabled',\n forcedColors: {\n isSelected: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'sm',\n gap: 'text-to-visual',\n height: {\n orientation: {\n horizontal: {\n density: {\n compact: 32,\n regular: 48\n }\n }\n }\n },\n minHeight: {\n orientation: {\n vertical: {\n density: {\n compact: 32,\n regular: 48\n }\n }\n }\n },\n alignItems: 'center',\n position: 'relative',\n cursor: 'default',\n flexShrink: 0,\n transition: 'default',\n paddingX: {\n labelBehavior: {\n hide: size(6)\n }\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\nconst icon = style({\n display: 'block',\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport function Tab(props: TabProps): ReactNode {\n let {density, orientation, labelBehavior, prevRef} = useContext(InternalTabsContext) ?? {};\n\n let contentId = useId();\n let ariaLabelledBy = props['aria-labelledby'] || '';\n\n return (\n <RACTab\n {...props}\n // @ts-ignore\n originalProps={props}\n aria-labelledby={`${labelBehavior === 'hide' ? contentId : ''} ${ariaLabelledBy}`}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tab({...renderProps, density, labelBehavior, orientation}, props.styles)}>\n {({\n // @ts-ignore\n isMenu,\n isSelected,\n isDisabled\n }) => {\n if (isMenu) {\n return props.children;\n } else {\n return (\n <Provider\n values={[\n [TextContext, {\n id: contentId,\n styles:\n style({\n order: 1,\n display: {\n labelBehavior: {\n hide: 'none'\n }\n }\n })({labelBehavior})\n }],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: icon\n }]\n ]}>\n <TabInner\n isSelected={isSelected}\n orientation={orientation!}\n isDisabled={isDisabled}\n prevRef={prevRef}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </TabInner>\n </Provider>\n );\n }\n }}\n </RACTab>\n );\n}\n\nfunction TabInner({isSelected, isDisabled, orientation, children, prevRef}: {\n isSelected: boolean,\n isDisabled: boolean,\n orientation: Orientation,\n children: ReactNode,\n prevRef?: RefObject<DOMRect | null>\n}) {\n let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n let ref = useRef<HTMLDivElement | null>(null);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && ref?.current && !reduceMotion) {\n let currentItem = ref?.current.getBoundingClientRect();\n\n if (orientation === 'horizontal') {\n let deltaX = prevRef.current.left - currentItem.left;\n ref.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef.current.width}px`},\n {transform: 'translateX(0px)', width: '100%'}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n } else {\n let deltaY = prevRef.current.top - currentItem.top;\n ref.current.animate(\n [\n {transform: `translateY(${deltaY}px)`, height: `${prevRef.current.height}px`},\n {transform: 'translateY(0px)', height: '100%'}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n }\n\n prevRef.current = null;\n }\n }, [isSelected, reduceMotion, prevRef, orientation]);\n\n return (\n <>\n {isSelected && <div ref={ref} className={selectedIndicator({isDisabled, orientation})} />}\n {children}\n </>\n );\n}\n\n\nconst tabPanel = style({\n ...focusRing(),\n marginTop: 4,\n color: 'gray-800',\n flexGrow: 1,\n minHeight: 0\n}, getAllowedOverrides({height: true}));\n\nexport function TabPanel(props: TabPanelProps): ReactNode | null {\n let {showTabs} = useContext(CollapseContext);\n let {selectedKey} = useContext(InternalTabsContext);\n if (showTabs) {\n return (\n <AriaTabPanel\n {...props}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className ?? '') + tabPanel(renderProps, props.styles)} />\n );\n }\n\n if (props.id !== selectedKey) {\n return null;\n }\n\n return <CollapsedTabPanel {...props} />;\n}\n\nfunction CollapsedTabPanel(props: TabPanelProps) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {UNSAFE_style, UNSAFE_className = '', id, ...otherProps} = props;\n let {menuId, valueId} = useContext(CollapseContext);\n let ref = useRef(null);\n let tabIndex = useHasTabbableChild(ref) ? undefined : 0;\n\n return (\n <Group\n {...otherProps}\n ref={ref}\n aria-labelledby={menuId + ' ' + valueId}\n tabIndex={tabIndex}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + tabPanel(renderProps, props.styles)} />\n );\n}\n\nfunction isEveryTabDisabled<T>(collection: Collection<Node<T>> | undefined, disabledKeys: Set<Key>) {\n let testKey: Key | null = null;\n if (collection && collection.size > 0) {\n testKey = collection.getFirstKey();\n\n let index = 0;\n while (testKey && index < collection.size) {\n // We have to check if the item in the collection has a key in disabledKeys or has the isDisabled prop set directly on it\n if (!disabledKeys.has(testKey) && !collection.getItem(testKey)?.props?.isDisabled) {\n return false;\n }\n\n testKey = collection.getKeyAfter(testKey);\n index++;\n }\n return true;\n }\n return false;\n}\n\nlet HiddenTabs = function (props: {\n listRef: RefObject<HTMLDivElement | null>,\n items: Array<Node<any>>,\n size?: string,\n density?: 'compact' | 'regular'\n}) {\n let {listRef, items, size, density} = props;\n\n return (\n <div\n // @ts-ignore\n inert={inertValue(true)}\n ref={listRef}\n className={style({\n display: 'inherit',\n flexDirection: 'inherit',\n gap: 'inherit',\n flexWrap: 'inherit',\n position: 'absolute',\n inset: 0,\n visibility: 'hidden',\n overflow: 'hidden',\n opacity: 0\n })}>\n {items.map((item) => {\n // pull off individual props as an allow list, don't want refs or other props getting through\n return (\n <div\n data-hidden-tab\n style={item.props.UNSAFE_style}\n key={item.key}\n className={item.props.className({size, density})}>\n {item.props.children({size, density})}\n </div>\n );\n })}\n </div>\n );\n};\n\nlet TabsMenu = (props: {valueId: string, items: Array<Node<any>>, onSelectionChange: TabsProps['onSelectionChange']} & Omit<TabsProps, 'children'>) => {\n let {id, items, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, valueId} = props;\n let {density, onSelectionChange: _onSelectionChange, selectedKey, isDisabled, disabledKeys, labelBehavior} = useContext(InternalTabsContext);\n let onSelectionChange = useCallback((key: Key | null) => {\n if (key != null) {\n _onSelectionChange?.(key);\n }\n }, [_onSelectionChange]);\n let state = useContext(TabListStateContext);\n let allKeysDisabled = useMemo(() => {\n return isEveryTabDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set());\n }, [state?.collection, disabledKeys]);\n let labelProps = useLabels({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n });\n\n return (\n <div\n className={style({\n display: 'flex',\n flexShrink: 0,\n alignItems: 'center',\n height: {\n density: {\n compact: 32,\n regular: 48\n }\n }})({density})}>\n <Picker\n id={id}\n valueId={valueId}\n {...labelProps}\n aria-describedby={props['aria-describedby']}\n aria-details={props['aria-details']}\n isDisabled={isDisabled || allKeysDisabled}\n density={density!}\n labelBehavior={labelBehavior}\n items={items}\n disabledKeys={disabledKeys}\n selectedKey={selectedKey}\n onSelectionChange={onSelectionChange}>\n {(item: Node<any>) => {\n return (\n <PickerItem\n {...item.props.originalProps}\n isDisabled={isDisabled || allKeysDisabled}\n key={item.key}>\n {item.props.children({density, isMenu: true})}\n </PickerItem>\n );\n }}\n </Picker>\n </div>\n );\n};\n\nlet CollapsingTabs = ({collection, containerRef, ...props}: {collection: Collection<Node<unknown>>, containerRef: any} & TabsProps) => {\n let {density = 'regular', orientation = 'horizontal', labelBehavior = 'show', onSelectionChange} = props;\n let [showItems, _setShowItems] = useState(true);\n showItems = orientation === 'vertical' ? true : showItems;\n let setShowItems = useCallback((value: boolean) => {\n if (orientation === 'vertical') {\n // if orientation is vertical, we always show the items\n _setShowItems(true);\n } else {\n _setShowItems(value);\n }\n }, [orientation]);\n\n let {direction} = useLocale();\n\n let children = useMemo(() => [...collection], [collection]);\n\n let listRef = useRef<HTMLDivElement | null>(null);\n let updateOverflow = useEffectEvent(() => {\n if (orientation === 'vertical' || !listRef.current || !containerRef?.current) {\n return;\n }\n let container = listRef.current;\n let containerRect = container.getBoundingClientRect();\n let tabs = container.querySelectorAll('[data-hidden-tab]');\n let lastTab = tabs[tabs.length - 1];\n let lastTabRect = lastTab.getBoundingClientRect();\n if (direction === 'ltr') {\n setShowItems?.(lastTabRect.right <= containerRect.right);\n } else {\n setShowItems?.(lastTabRect.left >= containerRect.left);\n }\n });\n\n useResizeObserver({ref: containerRef, onResize: updateOverflow});\n\n useLayoutEffect(() => {\n if (collection.size > 0) {\n queueMicrotask(updateOverflow);\n }\n }, [collection.size, updateOverflow]);\n\n // start with null so that the first render won't have a flicker\n let prevOrientation = useRef<Orientation | null>(null);\n useLayoutEffect(() => {\n if (collection.size > 0 && prevOrientation.current !== orientation) {\n updateOverflow();\n }\n prevOrientation.current = orientation;\n }, [collection.size, updateOverflow, orientation]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateOverflow());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let menuId = useId();\n let valueId = useId();\n\n let contents: ReactNode;\n if (showItems) {\n contents = (\n <RACTabs\n {...props}\n style={{display: 'contents'}}>\n {props.children}\n </RACTabs>\n );\n } else {\n contents = (\n <>\n <TabsMenu\n id={menuId}\n valueId={valueId}\n items={children}\n onSelectionChange={onSelectionChange}\n aria-label={props['aria-label']}\n aria-describedby={props['aria-labelledby']} />\n <CollapseContext.Provider value={{showTabs: false, menuId, valueId}}>\n {props.children}\n </CollapseContext.Provider>\n </>\n );\n }\n\n return (\n <div style={props.UNSAFE_style} className={(props.UNSAFE_className || '') + tabs({orientation}, props.styles)} ref={containerRef}>\n <div className={tablist({orientation, labelBehavior, density})}>\n <HiddenTabs items={children} density={density} listRef={listRef} />\n </div>\n <CollapseContext.Provider value={{showTabs: true, menuId, valueId}}>\n {contents}\n </CollapseContext.Provider>\n </div>\n );\n};\n"],"names":[],"version":3,"file":"Tabs.css.map"}
|
|
1
|
+
{"mappings":"ACuGa;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAwEG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAsCO;;;;EAAA;;;;EA6DG;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA4Cd;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA+CC;;;;EAAA;;;;EAsCO;;;;EAAA;;;;EAU4C;;;;EAwE/C;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA8EA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA+CA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA3fJ;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AA2Ka;EAAA;IAAA;;;;IAAA;;;;IA4Cd;;;;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAAA","sources":["d333cabc54201ea1","packages/@react-spectrum/s2/src/Tabs.tsx"],"sourcesContent":["@import \"575a5a16650d7070\";\n@import \"7a0058ba44ec735a\";\n@import \"ea0c0ad20f1e1c01\";\n@import \"1a91a7d853a67795\";\n@import \"b645d7882760dc18\";\n@import \"5aa00674bbf9e612\";\n@import \"9d65793a05791106\";\n@import \"2976d7d1f8a0759d\";\n@import \"713e94facc5ee3f3\";\n@import \"64129d49d07323ce\";\n@import \"5458e36ec7f2a11f\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TabListProps as AriaTabListProps,\n TabPanel as AriaTabPanel,\n TabPanelProps as AriaTabPanelProps,\n TabProps as AriaTabProps,\n TabsProps as AriaTabsProps,\n ContextValue,\n Group,\n Provider,\n Tab as RACTab,\n TabList as RACTabList,\n Tabs as RACTabs,\n TabListStateContext,\n TabRenderProps\n} from 'react-aria-components';\nimport {baseColor, focusRing, size, style} from '../style' with {type: 'macro'};\nimport {centerBaseline} from './CenterBaseline';\nimport {Collection, DOMRef, DOMRefValue, GlobalDOMAttributes, Key, Node, Orientation, RefObject} from '@react-types/shared';\nimport {CollectionBuilder} from '@react-aria/collections';\nimport {createContext, forwardRef, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {getAllowedOverrides, StyleProps, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {inertValue, useEffectEvent, useId, useLabels, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {Picker, PickerItem} from './TabsPicker';\nimport {Text, TextContext} from './Content';\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef, useMediaQuery} from '@react-spectrum/utils';\nimport {useHasTabbableChild} from '@react-aria/focus';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style' | 'children' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the tabs. */\n children: ReactNode,\n /**\n * The amount of space between the tabs.\n * @default 'regular'\n */\n density?: 'compact' | 'regular',\n /**\n * Defines if the text within the tabs should be hidden and only the icon should be shown.\n * The text is always visible when the item is collapsed into a picker.\n * @default 'show'\n */\n labelBehavior?: 'show' | 'hide'\n}\n\nexport interface TabProps extends Omit<AriaTabProps, 'children' | 'style' | 'className' | 'onClick' | keyof GlobalDOMAttributes>, StyleProps {\n /** The content to display in the tab. */\n children: ReactNode\n}\n\nexport interface TabListProps<T> extends Omit<AriaTabListProps<T>, 'style' | 'className' | 'aria-label' | 'aria-labelledby' | keyof GlobalDOMAttributes>, StyleProps {\n /** The content to display in the tablist. */\n children: ReactNode | ((item: T) => ReactNode)\n}\n\nexport interface TabPanelProps extends Omit<AriaTabPanelProps, 'children' | 'style' | 'className' | keyof GlobalDOMAttributes>, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the tab panels. */\n children: ReactNode\n}\n\nexport const TabsContext = createContext<ContextValue<Partial<TabsProps>, DOMRefValue<HTMLDivElement>>>(null);\nconst InternalTabsContext = createContext<Partial<TabsProps> & {\n tablistRef?: RefObject<HTMLDivElement | null>,\n prevRef?: RefObject<DOMRect | null>,\n selectedKey?: Key | null\n}>({});\n\ninterface CollapseContextType {\n showTabs: boolean,\n menuId: string,\n valueId: string,\n ariaLabel?: string | undefined,\n ariaDescribedBy?: string | undefined,\n tabs: Array<Node<any>>,\n listRef?: RefObject<HTMLDivElement | null>,\n onSelectionChange?: (key: Key) => void\n}\n\nconst CollapseContext = createContext<CollapseContextType>({\n showTabs: true,\n menuId: '',\n valueId: '',\n tabs: []\n});\n\nconst tabs = style({\n position: 'relative',\n display: 'flex',\n flexShrink: 0,\n font: 'ui',\n flexDirection: {\n orientation: {\n horizontal: 'column'\n }\n }\n}, getAllowedOverrides({height: true}));\n\n/**\n * Tabs organize content into multiple sections and allow users to navigate between them. The content under the set of tabs should be related and form a coherent unit.\n */\nexport const Tabs = forwardRef(function Tabs(props: TabsProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TabsContext);\n let {\n density = 'regular',\n isDisabled,\n disabledKeys,\n orientation = 'horizontal',\n labelBehavior = 'show'\n } = props;\n let domRef = useDOMRef(ref);\n let [value, setValue] = useControlledState(props.selectedKey, props.defaultSelectedKey ?? null!, props.onSelectionChange);\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n throw new Error('An aria-label or aria-labelledby prop is required on Tabs for accessibility.');\n }\n\n let tablistRef = useRef<HTMLDivElement | null>(null);\n let prevRef = useRef<DOMRect | null>(null);\n\n let onChange = useEffectEvent((val: Key) => {\n if (tablistRef.current) {\n prevRef.current = tablistRef.current.querySelector('[role=tab][data-selected=true]')?.getBoundingClientRect() ?? null;\n }\n setValue(val);\n });\n\n return (\n <Provider\n values={[\n [InternalTabsContext, {\n density,\n isDisabled,\n orientation,\n disabledKeys,\n selectedKey: value,\n tablistRef,\n prevRef,\n onSelectionChange: onChange,\n labelBehavior,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': props['aria-labelledby']\n }]\n ]}>\n <CollectionBuilder content={props.children}>\n {collection => (\n <CollapsingTabs\n {...props}\n selectedKey={value}\n onSelectionChange={onChange}\n collection={collection}\n containerRef={domRef} />\n )}\n </CollectionBuilder>\n </Provider>\n );\n});\n\nconst tablist = style({\n display: 'flex',\n gap: {\n orientation: {\n horizontal: {\n density: {\n compact: 24,\n regular: 32\n },\n labelBehavior: {\n hide: {\n density: {\n compact: 16,\n regular: 24\n }\n }\n }\n }\n }\n },\n flexDirection: {\n orientation: {\n vertical: 'column'\n }\n },\n marginEnd: {\n orientation: {\n vertical: 20\n }\n },\n marginStart: {\n orientation: {\n vertical: 12\n }\n },\n minWidth: 'min'\n});\n\nconst tablistWrapper = style({\n position: 'relative',\n minWidth: 0,\n flexShrink: 0,\n flexGrow: 0\n}, getAllowedOverrides());\n\nexport function TabList<T extends object>(props: TabListProps<T>): ReactNode | null {\n let {showTabs, menuId, valueId, tabs, listRef, onSelectionChange, ariaLabel, ariaDescribedBy} = useContext(CollapseContext) ?? {};\n let {density, orientation, labelBehavior} = useContext(InternalTabsContext);\n\n if (showTabs) {\n return <TabListInner {...props} />;\n }\n \n return (\n <div className={tablistWrapper(null, props.styles)}>\n {listRef && <div className={tablist({orientation, labelBehavior, density})}>\n <HiddenTabs items={tabs} density={density} listRef={listRef} />\n </div>}\n <TabsMenu\n id={menuId}\n valueId={valueId}\n items={tabs}\n onSelectionChange={onSelectionChange}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy} />\n </div>\n );\n}\n\nfunction TabListInner<T extends object>(props: TabListProps<T>) {\n let {\n tablistRef,\n orientation,\n density,\n labelBehavior,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = useContext(InternalTabsContext) ?? {};\n let {tabs, listRef} = useContext(CollapseContext) ?? {};\n\n return (\n <div\n style={props.UNSAFE_style}\n className={\n (props.UNSAFE_className || '') +\n tablistWrapper(null, props.styles)}>\n {listRef && <div className={tablist({orientation, labelBehavior, density})}>\n <HiddenTabs items={tabs} density={density} listRef={listRef} />\n </div>}\n <RACTabList\n {...props}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n ref={tablistRef}\n className={renderProps => tablist({...renderProps, labelBehavior, density})} />\n </div>\n );\n}\n\nconst selectedIndicator = style<{isDisabled: boolean, orientation?: Orientation}>({\n position: 'absolute',\n backgroundColor: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n height: {\n default: 'full',\n orientation: {\n horizontal: '[2px]'\n }\n },\n width: {\n default: 'full',\n orientation: {\n vertical: '[2px]'\n }\n },\n bottom: {\n default: 0\n },\n top: {\n orientation: {\n vertical: 0\n }\n },\n left: {\n orientation: {\n horizontal: 0\n }\n },\n insetStart: {\n orientation: {\n vertical: -12\n }\n },\n borderStyle: 'none',\n borderRadius: 'full'\n});\n\nconst tab = style<TabRenderProps & {density?: 'compact' | 'regular', labelBehavior?: 'show' | 'hide', orientation?: Orientation}>({\n ...focusRing(),\n display: 'flex',\n color: {\n default: baseColor('neutral-subdued'),\n isSelected: baseColor('neutral'),\n isDisabled: 'disabled',\n forcedColors: {\n isSelected: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'sm',\n gap: 'text-to-visual',\n height: {\n orientation: {\n horizontal: {\n density: {\n compact: 32,\n regular: 48\n }\n }\n }\n },\n minHeight: {\n orientation: {\n vertical: {\n density: {\n compact: 32,\n regular: 48\n }\n }\n }\n },\n alignItems: 'center',\n position: 'relative',\n cursor: 'default',\n flexShrink: 0,\n transition: 'default',\n paddingX: {\n labelBehavior: {\n hide: size(6)\n }\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\nconst icon = style({\n display: 'block',\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport function Tab(props: TabProps): ReactNode {\n let {density, orientation, labelBehavior, prevRef} = useContext(InternalTabsContext) ?? {};\n\n let contentId = useId();\n let ariaLabelledBy = props['aria-labelledby'] || '';\n\n return (\n <RACTab\n {...props}\n // @ts-ignore\n originalProps={props}\n aria-labelledby={`${labelBehavior === 'hide' ? contentId : ''} ${ariaLabelledBy}`}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tab({...renderProps, density, labelBehavior, orientation}, props.styles)}>\n {({\n // @ts-ignore\n isMenu,\n isSelected,\n isDisabled\n }) => {\n if (isMenu) {\n return props.children;\n } else {\n return (\n <Provider\n values={[\n [TextContext, {\n id: contentId,\n styles:\n style({\n order: 1,\n display: {\n labelBehavior: {\n hide: 'none'\n }\n }\n })({labelBehavior})\n }],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: icon\n }]\n ]}>\n <TabInner\n isSelected={isSelected}\n orientation={orientation!}\n isDisabled={isDisabled}\n prevRef={prevRef}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </TabInner>\n </Provider>\n );\n }\n }}\n </RACTab>\n );\n}\n\nfunction TabInner({isSelected, isDisabled, orientation, children, prevRef}: {\n isSelected: boolean,\n isDisabled: boolean,\n orientation: Orientation,\n children: ReactNode,\n prevRef?: RefObject<DOMRect | null>\n}) {\n let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n let ref = useRef<HTMLDivElement | null>(null);\n\n useLayoutEffect(() => {\n if (isSelected && prevRef?.current && ref?.current && !reduceMotion) {\n let currentItem = ref?.current.getBoundingClientRect();\n\n if (orientation === 'horizontal') {\n let deltaX = prevRef.current.left - currentItem.left;\n ref.current.animate(\n [\n {transform: `translateX(${deltaX}px)`, width: `${prevRef.current.width}px`},\n {transform: 'translateX(0px)', width: '100%'}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n } else {\n let deltaY = prevRef.current.top - currentItem.top;\n ref.current.animate(\n [\n {transform: `translateY(${deltaY}px)`, height: `${prevRef.current.height}px`},\n {transform: 'translateY(0px)', height: '100%'}\n ],\n {\n duration: 200,\n easing: 'ease-out'\n }\n );\n }\n\n prevRef.current = null;\n }\n }, [isSelected, reduceMotion, prevRef, orientation]);\n\n return (\n <>\n {isSelected && <div ref={ref} className={selectedIndicator({isDisabled, orientation})} />}\n {children}\n </>\n );\n}\n\n\nconst tabPanel = style({\n ...focusRing(),\n marginTop: 4,\n color: 'gray-800',\n flexGrow: 1,\n minHeight: 0\n}, getAllowedOverrides({height: true}));\n\nexport function TabPanel(props: TabPanelProps): ReactNode | null {\n let {showTabs} = useContext(CollapseContext);\n let {selectedKey} = useContext(InternalTabsContext);\n if (showTabs) {\n return (\n <AriaTabPanel\n {...props}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className ?? '') + tabPanel(renderProps, props.styles)} />\n );\n }\n\n if (props.id !== selectedKey) {\n return null;\n }\n\n return <CollapsedTabPanel {...props} />;\n}\n\nfunction CollapsedTabPanel(props: TabPanelProps) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {UNSAFE_style, UNSAFE_className = '', id, ...otherProps} = props;\n let {menuId, valueId} = useContext(CollapseContext);\n let ref = useRef(null);\n let tabIndex = useHasTabbableChild(ref) ? undefined : 0;\n\n return (\n <Group\n {...otherProps}\n ref={ref}\n aria-labelledby={menuId + ' ' + valueId}\n tabIndex={tabIndex}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + tabPanel(renderProps, props.styles)} />\n );\n}\n\nfunction isEveryTabDisabled<T>(collection: Collection<Node<T>> | undefined, disabledKeys: Set<Key>) {\n let testKey: Key | null = null;\n if (collection && collection.size > 0) {\n testKey = collection.getFirstKey();\n\n let index = 0;\n while (testKey && index < collection.size) {\n // We have to check if the item in the collection has a key in disabledKeys or has the isDisabled prop set directly on it\n if (!disabledKeys.has(testKey) && !collection.getItem(testKey)?.props?.isDisabled) {\n return false;\n }\n\n testKey = collection.getKeyAfter(testKey);\n index++;\n }\n return true;\n }\n return false;\n}\n\nlet HiddenTabs = function (props: {\n listRef: RefObject<HTMLDivElement | null>,\n items: Array<Node<any>>,\n size?: string,\n density?: 'compact' | 'regular'\n}) {\n let {listRef, items = [], size, density} = props;\n\n return (\n <div\n // @ts-ignore\n inert={inertValue(true)}\n ref={listRef}\n className={style({\n display: 'inherit',\n flexDirection: 'inherit',\n gap: 'inherit',\n flexWrap: 'inherit',\n position: 'absolute',\n inset: 0,\n visibility: 'hidden',\n overflow: 'hidden',\n opacity: 0\n })}>\n {items.map((item) => {\n // pull off individual props as an allow list, don't want refs or other props getting through\n return (\n <div\n data-hidden-tab\n style={item.props.UNSAFE_style}\n key={item.key}\n className={item.props.className({size, density})}>\n {item.props.children({size, density})}\n </div>\n );\n })}\n </div>\n );\n};\n\nlet TabsMenu = (props: {valueId: string, items: Array<Node<any>>, onSelectionChange: TabsProps['onSelectionChange']} & Omit<TabsProps, 'children'>) => {\n let {id, items, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, valueId} = props;\n let {density, onSelectionChange: _onSelectionChange, selectedKey, isDisabled, disabledKeys, labelBehavior} = useContext(InternalTabsContext);\n let onSelectionChange = useCallback((key: Key | null) => {\n if (key != null) {\n _onSelectionChange?.(key);\n }\n }, [_onSelectionChange]);\n let state = useContext(TabListStateContext);\n let allKeysDisabled = useMemo(() => {\n return isEveryTabDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set());\n }, [state?.collection, disabledKeys]);\n let labelProps = useLabels({\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n });\n\n return (\n <div\n className={style({\n display: 'flex',\n flexShrink: 0,\n alignItems: 'center',\n height: {\n density: {\n compact: 32,\n regular: 48\n }\n }})({density})}>\n <Picker\n id={id}\n valueId={valueId}\n {...labelProps}\n aria-describedby={props['aria-describedby']}\n aria-details={props['aria-details']}\n isDisabled={isDisabled || allKeysDisabled}\n density={density!}\n labelBehavior={labelBehavior}\n items={items}\n disabledKeys={disabledKeys}\n selectedKey={selectedKey}\n onSelectionChange={onSelectionChange}>\n {(item: Node<any>) => {\n return (\n <PickerItem\n {...item.props.originalProps}\n isDisabled={isDisabled || allKeysDisabled}\n key={item.key}>\n {item.props.children({density, isMenu: true})}\n </PickerItem>\n );\n }}\n </Picker>\n </div>\n );\n};\n\nlet CollapsingTabs = ({collection, containerRef, ...props}: {collection: Collection<Node<unknown>>, containerRef: any} & TabsProps) => {\n let {orientation = 'horizontal', onSelectionChange} = props;\n let [showItems, _setShowItems] = useState(true);\n showItems = orientation === 'vertical' ? true : showItems;\n let setShowItems = useCallback((value: boolean) => {\n if (orientation === 'vertical') {\n // if orientation is vertical, we always show the items\n _setShowItems(true);\n } else {\n _setShowItems(value);\n }\n }, [orientation]);\n\n let {direction} = useLocale();\n\n let children = useMemo(() => [...collection], [collection]);\n\n let listRef = useRef<HTMLDivElement | null>(null);\n let updateOverflow = useEffectEvent(() => {\n if (orientation === 'vertical' || !listRef.current || !containerRef?.current) {\n return;\n }\n let container = listRef.current;\n let containerRect = container.getBoundingClientRect();\n let tabs = container.querySelectorAll('[data-hidden-tab]');\n let lastTab = tabs[tabs.length - 1];\n let lastTabRect = lastTab.getBoundingClientRect();\n if (direction === 'ltr') {\n setShowItems?.(lastTabRect.right <= containerRect.right);\n } else {\n setShowItems?.(lastTabRect.left >= containerRect.left);\n }\n });\n\n useResizeObserver({ref: containerRef, onResize: updateOverflow});\n\n useLayoutEffect(() => {\n if (collection.size > 0) {\n queueMicrotask(updateOverflow);\n }\n }, [collection.size, updateOverflow]);\n\n // start with null so that the first render won't have a flicker\n let prevOrientation = useRef<Orientation | null>(null);\n useLayoutEffect(() => {\n if (collection.size > 0 && prevOrientation.current !== orientation) {\n updateOverflow();\n }\n prevOrientation.current = orientation;\n }, [collection.size, updateOverflow, orientation]);\n\n useEffect(() => {\n // Recalculate visible tags when fonts are loaded.\n document.fonts?.ready.then(() => updateOverflow());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let menuId = useId();\n let valueId = useId();\n\n let contents: ReactNode;\n if (showItems) {\n contents = (\n <RACTabs\n {...props}\n style={{display: 'contents'}}>\n {props.children}\n </RACTabs>\n );\n } else {\n contents = (\n <>\n <CollapseContext.Provider value={{showTabs: false, tabs: children, menuId, valueId, listRef: listRef, onSelectionChange, ariaLabel: props['aria-label'], ariaDescribedBy: props['aria-labelledby']}}>\n {props.children}\n </CollapseContext.Provider>\n </>\n );\n }\n\n return (\n <div style={props.UNSAFE_style} className={(props.UNSAFE_className || '') + tabs({orientation}, props.styles)} ref={containerRef}>\n <CollapseContext.Provider value={{showTabs: true, menuId, valueId, tabs: children, listRef: listRef}}>\n {contents}\n </CollapseContext.Provider>\n </div>\n );\n};\n"],"names":[],"version":3,"file":"Tabs.css.map"}
|
package/dist/Tabs.mjs
CHANGED
|
@@ -43,7 +43,8 @@ const $79e2b4a1b34d1592$var$InternalTabsContext = /*#__PURE__*/ (0, $8bRfI$creat
|
|
|
43
43
|
const $79e2b4a1b34d1592$var$CollapseContext = /*#__PURE__*/ (0, $8bRfI$createContext)({
|
|
44
44
|
showTabs: true,
|
|
45
45
|
menuId: '',
|
|
46
|
-
valueId: ''
|
|
46
|
+
valueId: '',
|
|
47
|
+
tabs: []
|
|
47
48
|
});
|
|
48
49
|
const $79e2b4a1b34d1592$var$tabs = function anonymous(props, overrides) {
|
|
49
50
|
let rules = " ";
|
|
@@ -55,28 +56,28 @@ const $79e2b4a1b34d1592$var$tabs = function anonymous(props, overrides) {
|
|
|
55
56
|
if (p[1] === "_v") flexShrink = true;
|
|
56
57
|
rules += p[0];
|
|
57
58
|
}
|
|
58
|
-
if (!position) rules += '
|
|
59
|
-
rules += '
|
|
60
|
-
if (!flexShrink) rules += '
|
|
61
|
-
rules += '
|
|
62
|
-
rules += '
|
|
63
|
-
rules += '
|
|
64
|
-
rules += '
|
|
65
|
-
rules += '
|
|
66
|
-
rules += '
|
|
67
|
-
rules += '
|
|
68
|
-
rules += '
|
|
69
|
-
rules += '
|
|
70
|
-
rules += ' -_6BNtrc-
|
|
71
|
-
rules += '
|
|
72
|
-
rules += '
|
|
73
|
-
rules += '
|
|
74
|
-
rules += '
|
|
75
|
-
rules += '
|
|
76
|
-
rules += '
|
|
77
|
-
rules += '
|
|
78
|
-
rules += '
|
|
79
|
-
if (props.orientation === "horizontal") rules += '
|
|
59
|
+
if (!position) rules += ' _Pc11';
|
|
60
|
+
rules += ' sd11';
|
|
61
|
+
if (!flexShrink) rules += ' _va11';
|
|
62
|
+
rules += ' uk11';
|
|
63
|
+
rules += ' uch11';
|
|
64
|
+
rules += ' udi11';
|
|
65
|
+
rules += ' uea11';
|
|
66
|
+
rules += ' ugb11';
|
|
67
|
+
rules += ' uhd11';
|
|
68
|
+
rules += ' uje11';
|
|
69
|
+
rules += ' u2NhKxcl11';
|
|
70
|
+
rules += ' uic11';
|
|
71
|
+
rules += ' -_6BNtrc-c11';
|
|
72
|
+
rules += ' vx11';
|
|
73
|
+
rules += ' wb11';
|
|
74
|
+
rules += ' xb11';
|
|
75
|
+
rules += ' _xa11';
|
|
76
|
+
rules += ' _Fd11';
|
|
77
|
+
rules += ' _FezxGHba11';
|
|
78
|
+
rules += ' _FnuYUweb11';
|
|
79
|
+
rules += ' pt11';
|
|
80
|
+
if (props.orientation === "horizontal") rules += ' _ta11';
|
|
80
81
|
return rules;
|
|
81
82
|
};
|
|
82
83
|
const $79e2b4a1b34d1592$export$b2539bed5023c21c = /*#__PURE__*/ (0, $8bRfI$forwardRef)(function Tabs(props, ref) {
|
|
@@ -124,91 +125,132 @@ const $79e2b4a1b34d1592$export$b2539bed5023c21c = /*#__PURE__*/ (0, $8bRfI$forwa
|
|
|
124
125
|
});
|
|
125
126
|
const $79e2b4a1b34d1592$var$tablist = function anonymous(props) {
|
|
126
127
|
let rules = " ";
|
|
127
|
-
rules += '
|
|
128
|
+
rules += ' sd11';
|
|
128
129
|
if (props.orientation === "horizontal") {
|
|
129
130
|
if (props.labelBehavior === "hide") {
|
|
130
|
-
if (props.density === "regular") rules += '
|
|
131
|
-
else if (props.density === "compact") rules += '
|
|
132
|
-
} else if (props.density === "regular") rules += '
|
|
133
|
-
else if (props.density === "compact") rules += '
|
|
131
|
+
if (props.density === "regular") rules += ' Uj11';
|
|
132
|
+
else if (props.density === "compact") rules += ' Ul11';
|
|
133
|
+
} else if (props.density === "regular") rules += ' Up11';
|
|
134
|
+
else if (props.density === "compact") rules += ' Uj11';
|
|
134
135
|
}
|
|
135
136
|
if (props.orientation === "horizontal") {
|
|
136
137
|
if (props.labelBehavior === "hide") {
|
|
137
|
-
if (props.density === "regular") rules += '
|
|
138
|
-
else if (props.density === "compact") rules += '
|
|
139
|
-
} else if (props.density === "regular") rules += '
|
|
140
|
-
else if (props.density === "compact") rules += '
|
|
138
|
+
if (props.density === "regular") rules += ' qj11';
|
|
139
|
+
else if (props.density === "compact") rules += ' ql11';
|
|
140
|
+
} else if (props.density === "regular") rules += ' qp11';
|
|
141
|
+
else if (props.density === "compact") rules += ' qj11';
|
|
141
142
|
}
|
|
142
|
-
if (props.orientation === "vertical") rules += '
|
|
143
|
-
if (props.orientation === "vertical") rules += '
|
|
144
|
-
if (props.orientation === "vertical") rules += '
|
|
145
|
-
rules += '
|
|
143
|
+
if (props.orientation === "vertical") rules += ' _ta11';
|
|
144
|
+
if (props.orientation === "vertical") rules += ' Hz11';
|
|
145
|
+
if (props.orientation === "vertical") rules += ' Ix11';
|
|
146
|
+
rules += ' Nq11';
|
|
147
|
+
return rules;
|
|
148
|
+
};
|
|
149
|
+
const $79e2b4a1b34d1592$var$tablistWrapper = function anonymous(props, overrides) {
|
|
150
|
+
let rules = " ";
|
|
151
|
+
let position = false;
|
|
152
|
+
let minWidth = false;
|
|
153
|
+
let flexShrink = false;
|
|
154
|
+
let flexGrow = false;
|
|
155
|
+
let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|Z|N|L)[^\s]+/g);
|
|
156
|
+
for (let p of matches){
|
|
157
|
+
if (p[1] === "_P") position = true;
|
|
158
|
+
if (p[1] === "N") minWidth = true;
|
|
159
|
+
if (p[1] === "_v") flexShrink = true;
|
|
160
|
+
if (p[1] === "_u") flexGrow = true;
|
|
161
|
+
rules += p[0];
|
|
162
|
+
}
|
|
163
|
+
if (!position) rules += ' _Pc11';
|
|
164
|
+
if (!minWidth) rules += ' Na11';
|
|
165
|
+
if (!flexShrink) rules += ' _va11';
|
|
166
|
+
if (!flexGrow) rules += ' _ua11';
|
|
146
167
|
return rules;
|
|
147
168
|
};
|
|
148
169
|
function $79e2b4a1b34d1592$export$e51a686c67fdaa2d(props) {
|
|
149
|
-
let { showTabs: showTabs } = (0, $8bRfI$useContext)($79e2b4a1b34d1592$var$CollapseContext) ?? {};
|
|
170
|
+
let { showTabs: showTabs, menuId: menuId, valueId: valueId, tabs: tabs, listRef: listRef, onSelectionChange: onSelectionChange, ariaLabel: ariaLabel, ariaDescribedBy: ariaDescribedBy } = (0, $8bRfI$useContext)($79e2b4a1b34d1592$var$CollapseContext) ?? {};
|
|
171
|
+
let { density: density, orientation: orientation, labelBehavior: labelBehavior } = (0, $8bRfI$useContext)($79e2b4a1b34d1592$var$InternalTabsContext);
|
|
150
172
|
if (showTabs) return /*#__PURE__*/ (0, $8bRfI$jsx)($79e2b4a1b34d1592$var$TabListInner, {
|
|
151
173
|
...props
|
|
152
174
|
});
|
|
153
|
-
return
|
|
175
|
+
return /*#__PURE__*/ (0, $8bRfI$jsxs)("div", {
|
|
176
|
+
className: $79e2b4a1b34d1592$var$tablistWrapper(null, props.styles),
|
|
177
|
+
children: [
|
|
178
|
+
listRef && /*#__PURE__*/ (0, $8bRfI$jsx)("div", {
|
|
179
|
+
className: $79e2b4a1b34d1592$var$tablist({
|
|
180
|
+
orientation: orientation,
|
|
181
|
+
labelBehavior: labelBehavior,
|
|
182
|
+
density: density
|
|
183
|
+
}),
|
|
184
|
+
children: /*#__PURE__*/ (0, $8bRfI$jsx)($79e2b4a1b34d1592$var$HiddenTabs, {
|
|
185
|
+
items: tabs,
|
|
186
|
+
density: density,
|
|
187
|
+
listRef: listRef
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
/*#__PURE__*/ (0, $8bRfI$jsx)($79e2b4a1b34d1592$var$TabsMenu, {
|
|
191
|
+
id: menuId,
|
|
192
|
+
valueId: valueId,
|
|
193
|
+
items: tabs,
|
|
194
|
+
onSelectionChange: onSelectionChange,
|
|
195
|
+
"aria-label": ariaLabel,
|
|
196
|
+
"aria-describedby": ariaDescribedBy
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
});
|
|
154
200
|
}
|
|
155
|
-
function $79e2b4a1b34d1592$var$TabListInner(
|
|
156
|
-
let { tablistRef: tablistRef, density: density, labelBehavior: labelBehavior, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = (0, $8bRfI$useContext)($79e2b4a1b34d1592$var$InternalTabsContext) ?? {};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|Z|N|L)[^\s]+/g);
|
|
166
|
-
for (let p of matches){
|
|
167
|
-
if (p[1] === "_P") position = true;
|
|
168
|
-
if (p[1] === "_u") flexGrow = true;
|
|
169
|
-
if (p[1] === "_v") flexShrink = true;
|
|
170
|
-
if (p[1] === "N") minWidth = true;
|
|
171
|
-
rules += p[0];
|
|
172
|
-
}
|
|
173
|
-
if (!position) rules += ' _Pc1';
|
|
174
|
-
if (!flexGrow) rules += ' _ua1';
|
|
175
|
-
if (!flexShrink) rules += ' _va1';
|
|
176
|
-
if (!minWidth) rules += ' Nq1';
|
|
177
|
-
return rules;
|
|
178
|
-
}(null, props1.styles),
|
|
179
|
-
children: /*#__PURE__*/ (0, $8bRfI$jsx)((0, $8bRfI$TabList), {
|
|
180
|
-
...props1,
|
|
181
|
-
"aria-label": ariaLabel,
|
|
182
|
-
"aria-labelledby": ariaLabelledBy,
|
|
183
|
-
ref: tablistRef,
|
|
184
|
-
className: (renderProps)=>$79e2b4a1b34d1592$var$tablist({
|
|
185
|
-
...renderProps,
|
|
201
|
+
function $79e2b4a1b34d1592$var$TabListInner(props) {
|
|
202
|
+
let { tablistRef: tablistRef, orientation: orientation, density: density, labelBehavior: labelBehavior, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = (0, $8bRfI$useContext)($79e2b4a1b34d1592$var$InternalTabsContext) ?? {};
|
|
203
|
+
let { tabs: tabs, listRef: listRef } = (0, $8bRfI$useContext)($79e2b4a1b34d1592$var$CollapseContext) ?? {};
|
|
204
|
+
return /*#__PURE__*/ (0, $8bRfI$jsxs)("div", {
|
|
205
|
+
style: props.UNSAFE_style,
|
|
206
|
+
className: (props.UNSAFE_className || '') + $79e2b4a1b34d1592$var$tablistWrapper(null, props.styles),
|
|
207
|
+
children: [
|
|
208
|
+
listRef && /*#__PURE__*/ (0, $8bRfI$jsx)("div", {
|
|
209
|
+
className: $79e2b4a1b34d1592$var$tablist({
|
|
210
|
+
orientation: orientation,
|
|
186
211
|
labelBehavior: labelBehavior,
|
|
187
212
|
density: density
|
|
213
|
+
}),
|
|
214
|
+
children: /*#__PURE__*/ (0, $8bRfI$jsx)($79e2b4a1b34d1592$var$HiddenTabs, {
|
|
215
|
+
items: tabs,
|
|
216
|
+
density: density,
|
|
217
|
+
listRef: listRef
|
|
188
218
|
})
|
|
189
|
-
|
|
219
|
+
}),
|
|
220
|
+
/*#__PURE__*/ (0, $8bRfI$jsx)((0, $8bRfI$TabList), {
|
|
221
|
+
...props,
|
|
222
|
+
"aria-label": ariaLabel,
|
|
223
|
+
"aria-labelledby": ariaLabelledBy,
|
|
224
|
+
ref: tablistRef,
|
|
225
|
+
className: (renderProps)=>$79e2b4a1b34d1592$var$tablist({
|
|
226
|
+
...renderProps,
|
|
227
|
+
labelBehavior: labelBehavior,
|
|
228
|
+
density: density
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
]
|
|
190
232
|
});
|
|
191
233
|
}
|
|
192
234
|
const $79e2b4a1b34d1592$var$selectedIndicator = function anonymous(props) {
|
|
193
235
|
let rules = " ";
|
|
194
|
-
rules += '
|
|
195
|
-
if (props.isDisabled) rules += '
|
|
196
|
-
else rules += '
|
|
197
|
-
if (props.isDisabled) rules += '
|
|
198
|
-
else rules += '
|
|
199
|
-
if (props.orientation === "horizontal") rules += '
|
|
200
|
-
else rules += '
|
|
201
|
-
if (props.orientation === "vertical") rules += '
|
|
202
|
-
else rules += '
|
|
203
|
-
rules += '
|
|
204
|
-
if (props.orientation === "vertical") rules += '
|
|
205
|
-
if (props.orientation === "horizontal") rules += '
|
|
206
|
-
if (props.orientation === "vertical") rules += '
|
|
207
|
-
rules += '
|
|
208
|
-
rules += '
|
|
209
|
-
rules += '
|
|
210
|
-
rules += '
|
|
211
|
-
rules += '
|
|
236
|
+
rules += ' _Pa11';
|
|
237
|
+
if (props.isDisabled) rules += ' gH11';
|
|
238
|
+
else rules += ' g011';
|
|
239
|
+
if (props.isDisabled) rules += ' gld11';
|
|
240
|
+
else rules += ' gle11';
|
|
241
|
+
if (props.orientation === "horizontal") rules += ' FLvNfn11';
|
|
242
|
+
else rules += ' Fb11';
|
|
243
|
+
if (props.orientation === "vertical") rules += ' ZLvNfn11';
|
|
244
|
+
else rules += ' Za11';
|
|
245
|
+
rules += ' _lr11';
|
|
246
|
+
if (props.orientation === "vertical") rules += ' Wr11';
|
|
247
|
+
if (props.orientation === "horizontal") rules += ' _Er11';
|
|
248
|
+
if (props.orientation === "vertical") rules += ' _Aa11';
|
|
249
|
+
rules += ' _je11';
|
|
250
|
+
rules += ' og11';
|
|
251
|
+
rules += ' ng11';
|
|
252
|
+
rules += ' kg11';
|
|
253
|
+
rules += ' jg11';
|
|
212
254
|
return rules;
|
|
213
255
|
};
|
|
214
256
|
const $79e2b4a1b34d1592$var$tab = function anonymous(props, overrides) {
|
|
@@ -221,55 +263,55 @@ const $79e2b4a1b34d1592$var$tab = function anonymous(props, overrides) {
|
|
|
221
263
|
if (p[1] === "_v") flexShrink = true;
|
|
222
264
|
rules += p[0];
|
|
223
265
|
}
|
|
224
|
-
if (props.isFocusVisible) rules += '
|
|
225
|
-
else rules += '
|
|
226
|
-
rules += '
|
|
227
|
-
rules += '
|
|
228
|
-
rules += '
|
|
229
|
-
rules += '
|
|
230
|
-
if (props.isDisabled) rules += '
|
|
266
|
+
if (props.isFocusVisible) rules += ' _Lf11';
|
|
267
|
+
else rules += ' _Le11';
|
|
268
|
+
rules += ' Oh11';
|
|
269
|
+
rules += ' _Mc11';
|
|
270
|
+
rules += ' _Kd11';
|
|
271
|
+
rules += ' sd11';
|
|
272
|
+
if (props.isDisabled) rules += ' pp11';
|
|
231
273
|
else if (props.isSelected) {
|
|
232
|
-
if (props.isPressed) rules += '
|
|
233
|
-
else if (props.isFocusVisible) rules += '
|
|
234
|
-
else if (props.isHovered) rules += '
|
|
235
|
-
else rules += '
|
|
274
|
+
if (props.isPressed) rules += ' po11';
|
|
275
|
+
else if (props.isFocusVisible) rules += ' po11';
|
|
276
|
+
else if (props.isHovered) rules += ' po11';
|
|
277
|
+
else rules += ' pt11';
|
|
236
278
|
} else {
|
|
237
|
-
if (props.isPressed) rules += '
|
|
238
|
-
else if (props.isFocusVisible) rules += '
|
|
239
|
-
else if (props.isHovered) rules += '
|
|
240
|
-
else rules += '
|
|
279
|
+
if (props.isPressed) rules += ' pt11';
|
|
280
|
+
else if (props.isFocusVisible) rules += ' pt11';
|
|
281
|
+
else if (props.isHovered) rules += ' pt11';
|
|
282
|
+
else rules += ' pv11';
|
|
241
283
|
}
|
|
242
|
-
if (props.isDisabled) rules += '
|
|
243
|
-
else if (props.isSelected) rules += '
|
|
244
|
-
rules += '
|
|
245
|
-
rules += '
|
|
246
|
-
rules += '
|
|
247
|
-
rules += '
|
|
248
|
-
rules += '
|
|
249
|
-
rules += '
|
|
250
|
-
rules += '
|
|
251
|
-
rules += '
|
|
284
|
+
if (props.isDisabled) rules += ' plc11';
|
|
285
|
+
else if (props.isSelected) rules += ' pld11';
|
|
286
|
+
rules += ' oa11';
|
|
287
|
+
rules += ' na11';
|
|
288
|
+
rules += ' ka11';
|
|
289
|
+
rules += ' ja11';
|
|
290
|
+
rules += ' Uc11';
|
|
291
|
+
rules += ' Usd11';
|
|
292
|
+
rules += ' qc11';
|
|
293
|
+
rules += ' qsd11';
|
|
252
294
|
if (props.orientation === "horizontal") {
|
|
253
|
-
if (props.density === "regular") rules += '
|
|
254
|
-
else if (props.density === "compact") rules += '
|
|
295
|
+
if (props.density === "regular") rules += ' Fz11';
|
|
296
|
+
else if (props.density === "compact") rules += ' Fx11';
|
|
255
297
|
}
|
|
256
298
|
if (props.orientation === "vertical") {
|
|
257
|
-
if (props.density === "regular") rules += '
|
|
258
|
-
else if (props.density === "compact") rules += '
|
|
299
|
+
if (props.density === "regular") rules += ' Mk11';
|
|
300
|
+
else if (props.density === "compact") rules += ' Mi11';
|
|
259
301
|
}
|
|
260
|
-
rules += '
|
|
261
|
-
if (!position) rules += '
|
|
262
|
-
rules += '
|
|
263
|
-
if (!flexShrink) rules += '
|
|
264
|
-
rules += '
|
|
265
|
-
rules += '
|
|
266
|
-
rules += '
|
|
267
|
-
if (props.labelBehavior === "hide") rules += '
|
|
268
|
-
if (props.labelBehavior === "hide") rules += '
|
|
269
|
-
rules += '
|
|
302
|
+
rules += ' eb11';
|
|
303
|
+
if (!position) rules += ' _Pc11';
|
|
304
|
+
rules += ' ri11';
|
|
305
|
+
if (!flexShrink) rules += ' _va11';
|
|
306
|
+
rules += ' Yd11';
|
|
307
|
+
rules += ' Xb11';
|
|
308
|
+
rules += ' _2b11';
|
|
309
|
+
if (props.labelBehavior === "hide") rules += ' SssxDec11';
|
|
310
|
+
if (props.labelBehavior === "hide") rules += ' RssxDec11';
|
|
311
|
+
rules += ' __ca11';
|
|
270
312
|
return rules;
|
|
271
313
|
};
|
|
272
|
-
const $79e2b4a1b34d1592$var$icon = "
|
|
314
|
+
const $79e2b4a1b34d1592$var$icon = " sb11 _va11 -_8sjo0b-t5ZbAob11";
|
|
273
315
|
function $79e2b4a1b34d1592$export$3e41faf802a29e71(props1) {
|
|
274
316
|
let { density: density, orientation: orientation, labelBehavior: labelBehavior, prevRef: prevRef } = (0, $8bRfI$useContext)($79e2b4a1b34d1592$var$InternalTabsContext) ?? {};
|
|
275
317
|
let contentId = (0, $8bRfI$useId)();
|
|
@@ -297,8 +339,8 @@ function $79e2b4a1b34d1592$export$3e41faf802a29e71(props1) {
|
|
|
297
339
|
id: contentId,
|
|
298
340
|
styles: function anonymous(props) {
|
|
299
341
|
let rules = " ";
|
|
300
|
-
rules += '
|
|
301
|
-
if (props.labelBehavior === "hide") rules += '
|
|
342
|
+
rules += ' _Jb11';
|
|
343
|
+
if (props.labelBehavior === "hide") rules += ' sk11';
|
|
302
344
|
return rules;
|
|
303
345
|
}({
|
|
304
346
|
labelBehavior: labelBehavior
|
|
@@ -310,7 +352,7 @@ function $79e2b4a1b34d1592$export$3e41faf802a29e71(props1) {
|
|
|
310
352
|
{
|
|
311
353
|
render: (0, $1f4b04be3f24aae3$export$9d7e2342a7e53afa)({
|
|
312
354
|
slot: 'icon',
|
|
313
|
-
styles: "
|
|
355
|
+
styles: " _Ja11"
|
|
314
356
|
}),
|
|
315
357
|
styles: $79e2b4a1b34d1592$var$icon
|
|
316
358
|
}
|
|
@@ -399,15 +441,15 @@ const $79e2b4a1b34d1592$var$tabPanel = function anonymous(props, overrides) {
|
|
|
399
441
|
if (p[1] === "M") minHeight = true;
|
|
400
442
|
rules += p[0];
|
|
401
443
|
}
|
|
402
|
-
if (props.isFocusVisible) rules += '
|
|
403
|
-
else rules += '
|
|
404
|
-
rules += '
|
|
405
|
-
rules += '
|
|
406
|
-
rules += '
|
|
407
|
-
if (!marginTop) rules += '
|
|
408
|
-
rules += '
|
|
409
|
-
if (!flexGrow) rules += '
|
|
410
|
-
if (!minHeight) rules += '
|
|
444
|
+
if (props.isFocusVisible) rules += ' _Lf11';
|
|
445
|
+
else rules += ' _Le11';
|
|
446
|
+
rules += ' Oh11';
|
|
447
|
+
rules += ' _Mc11';
|
|
448
|
+
rules += ' _Kd11';
|
|
449
|
+
if (!marginTop) rules += ' Js11';
|
|
450
|
+
rules += ' pt11';
|
|
451
|
+
if (!flexGrow) rules += ' _ub11';
|
|
452
|
+
if (!minHeight) rules += ' Ma11';
|
|
411
453
|
return rules;
|
|
412
454
|
};
|
|
413
455
|
function $79e2b4a1b34d1592$export$3d96ec278d3efce4(props) {
|
|
@@ -454,12 +496,12 @@ function $79e2b4a1b34d1592$var$isEveryTabDisabled(collection, disabledKeys) {
|
|
|
454
496
|
return false;
|
|
455
497
|
}
|
|
456
498
|
let $79e2b4a1b34d1592$var$HiddenTabs = function(props) {
|
|
457
|
-
let { listRef: listRef, items: items, size: size, density: density } = props;
|
|
499
|
+
let { listRef: listRef, items: items = [], size: size, density: density } = props;
|
|
458
500
|
return /*#__PURE__*/ (0, $8bRfI$jsx)("div", {
|
|
459
501
|
// @ts-ignore
|
|
460
502
|
inert: (0, $8bRfI$inertValue)(true),
|
|
461
503
|
ref: listRef,
|
|
462
|
-
className: "
|
|
504
|
+
className: " s40ub4c11 _t40ub4c11 U40ub4c11 q40ub4c11 _w40ub4c11 _Pa11 Wr11 _lr11 _Ar11 _zr11 _6b11 _Nc11 Pc11 _Ia11",
|
|
463
505
|
children: items.map((item)=>{
|
|
464
506
|
// pull off individual props as an allow list, don't want refs or other props getting through
|
|
465
507
|
return /*#__PURE__*/ (0, $8bRfI$jsx)("div", {
|
|
@@ -500,11 +542,11 @@ let $79e2b4a1b34d1592$var$TabsMenu = (props1)=>{
|
|
|
500
542
|
return /*#__PURE__*/ (0, $8bRfI$jsx)("div", {
|
|
501
543
|
className: function anonymous(props) {
|
|
502
544
|
let rules = " ";
|
|
503
|
-
rules += '
|
|
504
|
-
rules += '
|
|
505
|
-
rules += '
|
|
506
|
-
if (props.density === "regular") rules += '
|
|
507
|
-
else if (props.density === "compact") rules += '
|
|
545
|
+
rules += ' sd11';
|
|
546
|
+
rules += ' _va11';
|
|
547
|
+
rules += ' eb11';
|
|
548
|
+
if (props.density === "regular") rules += ' Fz11';
|
|
549
|
+
else if (props.density === "compact") rules += ' Fx11';
|
|
508
550
|
return rules;
|
|
509
551
|
}({
|
|
510
552
|
density: density
|
|
@@ -536,7 +578,7 @@ let $79e2b4a1b34d1592$var$TabsMenu = (props1)=>{
|
|
|
536
578
|
});
|
|
537
579
|
};
|
|
538
580
|
let $79e2b4a1b34d1592$var$CollapsingTabs = ({ collection: collection, containerRef: containerRef, ...props })=>{
|
|
539
|
-
let {
|
|
581
|
+
let { orientation: orientation = 'horizontal', onSelectionChange: onSelectionChange } = props;
|
|
540
582
|
let [showItems, _setShowItems] = (0, $8bRfI$useState)(true);
|
|
541
583
|
showItems = orientation === 'vertical' ? true : showItems;
|
|
542
584
|
let setShowItems = (0, $8bRfI$useCallback)((value)=>{
|
|
@@ -598,54 +640,37 @@ let $79e2b4a1b34d1592$var$CollapsingTabs = ({ collection: collection, containerR
|
|
|
598
640
|
},
|
|
599
641
|
children: props.children
|
|
600
642
|
});
|
|
601
|
-
else contents = /*#__PURE__*/ (0, $8bRfI$
|
|
602
|
-
children:
|
|
603
|
-
|
|
604
|
-
|
|
643
|
+
else contents = /*#__PURE__*/ (0, $8bRfI$jsx)((0, $8bRfI$Fragment), {
|
|
644
|
+
children: /*#__PURE__*/ (0, $8bRfI$jsx)($79e2b4a1b34d1592$var$CollapseContext.Provider, {
|
|
645
|
+
value: {
|
|
646
|
+
showTabs: false,
|
|
647
|
+
tabs: children,
|
|
648
|
+
menuId: menuId,
|
|
605
649
|
valueId: valueId,
|
|
606
|
-
|
|
650
|
+
listRef: listRef,
|
|
607
651
|
onSelectionChange: onSelectionChange,
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
showTabs: false,
|
|
614
|
-
menuId: menuId,
|
|
615
|
-
valueId: valueId
|
|
616
|
-
},
|
|
617
|
-
children: props.children
|
|
618
|
-
})
|
|
619
|
-
]
|
|
652
|
+
ariaLabel: props['aria-label'],
|
|
653
|
+
ariaDescribedBy: props['aria-labelledby']
|
|
654
|
+
},
|
|
655
|
+
children: props.children
|
|
656
|
+
})
|
|
620
657
|
});
|
|
621
|
-
return /*#__PURE__*/ (0, $8bRfI$
|
|
658
|
+
return /*#__PURE__*/ (0, $8bRfI$jsx)("div", {
|
|
622
659
|
style: props.UNSAFE_style,
|
|
623
660
|
className: (props.UNSAFE_className || '') + $79e2b4a1b34d1592$var$tabs({
|
|
624
661
|
orientation: orientation
|
|
625
662
|
}, props.styles),
|
|
626
663
|
ref: containerRef,
|
|
627
|
-
children:
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
listRef: listRef
|
|
638
|
-
})
|
|
639
|
-
}),
|
|
640
|
-
/*#__PURE__*/ (0, $8bRfI$jsx)($79e2b4a1b34d1592$var$CollapseContext.Provider, {
|
|
641
|
-
value: {
|
|
642
|
-
showTabs: true,
|
|
643
|
-
menuId: menuId,
|
|
644
|
-
valueId: valueId
|
|
645
|
-
},
|
|
646
|
-
children: contents
|
|
647
|
-
})
|
|
648
|
-
]
|
|
664
|
+
children: /*#__PURE__*/ (0, $8bRfI$jsx)($79e2b4a1b34d1592$var$CollapseContext.Provider, {
|
|
665
|
+
value: {
|
|
666
|
+
showTabs: true,
|
|
667
|
+
menuId: menuId,
|
|
668
|
+
valueId: valueId,
|
|
669
|
+
tabs: children,
|
|
670
|
+
listRef: listRef
|
|
671
|
+
},
|
|
672
|
+
children: contents
|
|
673
|
+
})
|
|
649
674
|
});
|
|
650
675
|
};
|
|
651
676
|
|