@react-spectrum/s2 3.0.0-nightly-b0f156972-241201 → 3.0.0-nightly-e94e36431-241203

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/Tabs.mjs.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAyDM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAwD;AAE/F,MAAM;;;;;;;;;;;;;;;;;;;;;;;;AASC,SAAS,0CAAS,KAAoB;IAC3C,qBACE,gBAAC,CAAA,GAAA,eAAW;QACT,GAAG,KAAK;QACT,OAAO,MAAM,YAAY;QACzB,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,+BAAS,MAAM,MAAM,MAAM;;AAE7E;AAEA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BN,MAAM;AAQC,SAAS,0CAAI,KAAe;IACjC,IAAI,WAAC,OAAO,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE,8CAAgB,CAAC;IAEnD,qBACE,gBAAC,CAAA,GAAA,UAAK;QACH,GAAG,KAAK;QACT,OAAO,MAAM,YAAY;QACzB,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,0BAAI;gBAAC,GAAG,WAAW;yBAAE;YAAO,GAAG,MAAM,MAAM;kBACtG,cAAA,gBAAC,CAAA,GAAA,eAAO;YACN,QAAQ;gBACN;oBAAC,CAAA,GAAA,yCAAU;oBAAG;wBAAC,MAAM;oBAAmB;iBAAE;gBAC1C;oBAAC,CAAA,GAAA,yCAAU;oBAAG;wBACZ,QAAQ,CAAA,GAAA,yCAAa,EAAE;4BAAC,MAAM;4BAAQ,MAAM;wBAAmB;wBAC/D,QAAQ;oBACV;iBAAE;aACH;sBACA,OAAO,MAAM,QAAQ,KAAK,yBAAW,gBA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OAAO,GAAG,CAAC;YAE7B,IAAI,gBAAgB,cAClB,SAAS,KAAK,GAAG,GAAG,YAAY,WAAW,CAAC,EAAE,CAAC;iBAE/C,SAAS,MAAM,GAAG,GAAG,YAAY,YAAY,CAAC,EAAE,CAAC;YAEnD,SAAS;QACX;IACF,GAAG;QAAC;QAAW;QAAU;QAAa;KAAY;IAElD,CAAA,GAAA,sBAAc,EAAE;QACd;IACF,GAAG;QAAC;QAAU,OAAO,cAAc;QAAK;QAAW;QAAa;KAAQ;IAExE,qBACE,gBAAC;QAAI,OAAO;YAAC,GAAG,KAAK;QAAA;QAAG,WAAW,wCAAkB;wBAAC;yBAAY;QAAW;;AAEjF;AAEA,MAAM;;;;;;;;;;;;;;;;;;;;AAeC,MAAM,0DAAO,CAAA,GAAA,iBAAS,EAAE,SAAS,KAAK,KAAgB,EAAE,GAA2B;IACxF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,WACF,UAAU,uBACV,UAAU,gBACV,YAAY,eACZ,cAAc,cACf,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,qBACE,gBAAC,CAAA,GAAA,WAAM;QACJ,GAAG,KAAK;QACT,KAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,2BAAK;gBAAC,GAAG,WAAW;YAAA,GAAG,MAAM,MAAM;kBAC9F,cAAA,gBAAC,CAAA,GAAA,eAAO;YACN,QAAQ;gBACN;oBAAC;oBAAa;iCAAC;oCAAS;sCAAY;qCAAc;oBAAW;iBAAE;aAChE;sBACA,MAAM,QAAQ;;;AAIvB","sources":["packages/@react-spectrum/s2/src/Tabs.tsx"],"sourcesContent":["/*\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 Provider,\n Tab as RACTab,\n TabList as RACTabList,\n Tabs as RACTabs,\n TabListStateContext,\n useSlottedContext\n } from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Collection, DOMRef, DOMRefValue, Key, Node, Orientation} from '@react-types/shared';\nimport {createContext, forwardRef, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {Text, TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style' | 'children'>, 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\nexport interface TabProps extends Omit<AriaTabProps, 'children' | 'style' | 'className'>, StyleProps {\n /** The content to display in the tab. */\n children?: ReactNode\n}\n\nexport interface TabListProps<T> extends Omit<AriaTabListProps<T>, 'children' | 'style' | 'className'>, StyleProps {\n /** The content to display in the tablist. */\n children?: ReactNode\n}\n\nexport interface TabPanelProps extends Omit<AriaTabPanelProps, 'children' | 'style' | 'className'>, 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<TabsProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst tabPanel = style({\n marginTop: 4,\n color: 'gray-800',\n flexGrow: 1,\n flexBasis: '[0%]',\n minHeight: 0,\n minWidth: 0\n}, getAllowedOverrides({height: true}));\n\nexport function TabPanel(props: TabPanelProps) {\n return (\n <AriaTabPanel\n {...props}\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + tabPanel(null, props.styles)} />\n );\n}\n\nconst tab = style({\n ...focusRing(),\n display: 'flex',\n color: {\n default: 'neutral-subdued',\n isSelected: 'neutral',\n isHovered: 'neutral-subdued',\n isDisabled: 'disabled',\n forcedColors: {\n isSelected: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'sm',\n gap: 'text-to-visual',\n height: {\n density: {\n compact: 32,\n regular: 48\n }\n },\n alignItems: 'center',\n position: 'relative',\n cursor: 'default',\n flexShrink: 0,\n transition: 'default'\n}, getAllowedOverrides());\n\nconst icon = style({\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport function Tab(props: TabProps) {\n let {density} = useSlottedContext(TabsContext) ?? {};\n\n return (\n <RACTab\n {...props}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tab({...renderProps, density}, props.styles)}>\n <Provider\n values={[\n [TextContext, {styles: style({order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: icon\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACTab>\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 }\n }\n },\n flexDirection: {\n orientation: {\n vertical: 'column'\n }\n },\n paddingEnd: {\n orientation: {\n vertical: 20\n }\n },\n paddingStart: {\n orientation: {\n vertical: 12\n }\n },\n flexShrink: 0,\n flexBasis: '[0%]'\n});\n\nexport function TabList<T extends object>(props: TabListProps<T>) {\n let {density, isDisabled, disabledKeys, orientation} = useSlottedContext(TabsContext) ?? {};\n let state = useContext(TabListStateContext);\n let [selectedTab, setSelectedTab] = useState<HTMLElement | undefined>(undefined);\n let tablistRef = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n if (tablistRef?.current) {\n let tab: HTMLElement | null = tablistRef.current.querySelector('[role=tab][data-selected=true]');\n\n if (tab != null) {\n setSelectedTab(tab);\n }\n }\n }, [tablistRef, state?.selectedItem?.key]);\n\n return (\n <div\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + style({position: 'relative'}, getAllowedOverrides())(null, props.styles)}>\n {orientation === 'vertical' &&\n <TabLine disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}\n <RACTabList\n {...props}\n ref={tablistRef}\n className={renderProps => tablist({...renderProps, density})} />\n {orientation === 'horizontal' &&\n <TabLine disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}\n </div>\n );\n}\n\nfunction isAllTabsDisabled<T>(collection: Collection<Node<T>> | null, 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\ninterface TabLineProps {\n disabledKeys: Iterable<Key> | undefined,\n isDisabled: boolean | undefined,\n selectedTab: HTMLElement | undefined,\n orientation?: Orientation,\n density?: 'compact' | 'regular'\n}\n\nconst selectedIndicator = style({\n position: 'absolute',\n backgroundColor: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n height: {\n orientation: {\n horizontal: '[2px]'\n }\n },\n width: {\n orientation: {\n vertical: '[2px]'\n }\n },\n bottom: {\n orientation: {\n horizontal: 0\n }\n },\n borderStyle: 'none',\n borderRadius: 'full',\n transitionDuration: 130,\n transitionTimingFunction: 'in-out'\n});\n\nfunction TabLine(props: TabLineProps) {\n let {\n disabledKeys,\n isDisabled: isTabsDisabled,\n selectedTab,\n orientation,\n density\n } = props;\n let {direction} = useLocale();\n let state = useContext(TabListStateContext);\n\n // We want to add disabled styling to the selection indicator only if all the Tabs are disabled\n let [isDisabled, setIsDisabled] = useState<boolean>(false);\n useEffect(() => {\n let isDisabled = isTabsDisabled || isAllTabsDisabled(state?.collection || null, disabledKeys ? new Set(disabledKeys) : new Set(null));\n setIsDisabled(isDisabled);\n }, [state?.collection, disabledKeys, isTabsDisabled, setIsDisabled]);\n\n let [style, setStyle] = useState<{transform: string | undefined, width: string | undefined, height: string | undefined}>({\n transform: undefined,\n width: undefined,\n height: undefined\n });\n\n let onResize = useCallback(() => {\n if (selectedTab) {\n let styleObj: { transform: string | undefined, width: string | undefined, height: string | undefined } = {\n transform: undefined,\n width: undefined,\n height: undefined\n };\n\n // In RTL, calculate the transform from the right edge of the tablist so that resizing the window doesn't break the Tabline position due to offsetLeft changes\n let offset = direction === 'rtl' ? -1 * ((selectedTab.offsetParent as HTMLElement)?.offsetWidth - selectedTab.offsetWidth - selectedTab.offsetLeft) : selectedTab.offsetLeft;\n styleObj.transform = orientation === 'vertical'\n ? `translateY(${selectedTab.offsetTop}px)`\n : `translateX(${offset}px)`;\n\n if (orientation === 'horizontal') {\n styleObj.width = `${selectedTab.offsetWidth}px`;\n } else {\n styleObj.height = `${selectedTab.offsetHeight}px`;\n }\n setStyle(styleObj);\n }\n }, [direction, setStyle, selectedTab, orientation]);\n\n useLayoutEffect(() => {\n onResize();\n }, [onResize, state?.selectedItem?.key, direction, orientation, density]);\n\n return (\n <div style={{...style}} className={selectedIndicator({isDisabled, orientation})} />\n );\n}\n\nconst tabs = style({\n display: 'flex',\n flexShrink: 0,\n fontFamily: 'sans',\n fontWeight: 'normal',\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 } = props;\n let domRef = useDOMRef(ref);\n\n return (\n <RACTabs\n {...props}\n ref={domRef}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tabs({...renderProps}, props.styles)}>\n <Provider\n values={[\n [TabsContext, {density, isDisabled, disabledKeys, orientation}]\n ]}>\n {props.children}\n </Provider>\n </RACTabs>\n );\n});\n"],"names":[],"version":3,"file":"Tabs.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAgEM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAwD;AAC/F,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAiF;IAAC,SAAS,KAAO;AAAC;AAE3I,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAcC,MAAM,0DAAO,CAAA,GAAA,iBAAS,EAAE,SAAS,KAAK,KAAgB,EAAE,GAA2B;IACxF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,WACF,UAAU,uBACV,UAAU,gBACV,YAAY,eACZ,cAAc,wBACd,WAAW,OACZ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,E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,GAAG;mBAAzB,KAAK,GAAG,mBAE5C;0BACE,cAAA,gBAAC;oBAAS,OAAO;oBAAU,mBAAmB;;;;;AAKxD","sources":["packages/@react-spectrum/s2/src/Tabs.tsx"],"sourcesContent":["/*\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 CollectionRenderer,\n ContextValue,\n Provider,\n Tab as RACTab,\n TabList as RACTabList,\n Tabs as RACTabs,\n TabListStateContext,\n UNSTABLE_CollectionRendererContext,\n UNSTABLE_DefaultCollectionRenderer\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Collection, DOMRef, DOMRefValue, FocusableRef, FocusableRefValue, Key, Node, Orientation, RefObject} from '@react-types/shared';\nimport {createContext, forwardRef, Fragment, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Picker, PickerItem} from './TabsPicker';\nimport {Text, TextContext} from './Content';\nimport {useControlledState} from '@react-stately/utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useEffectEvent, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style' | 'children'>, 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 * If the tabs should only display icons and no text.\n */\n iconOnly?: boolean\n}\n\nexport interface TabProps extends Omit<AriaTabProps, 'children' | 'style' | 'className'>, StyleProps {\n /** The content to display in the tab. */\n children: ReactNode\n}\n\nexport interface TabListProps<T> extends Omit<AriaTabListProps<T>, 'style' | 'className'>, StyleProps {}\n\nexport interface TabPanelProps extends Omit<AriaTabPanelProps, 'children' | 'style' | 'className'>, 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<TabsProps, DOMRefValue<HTMLDivElement>>>(null);\nconst InternalTabsContext = createContext<TabsProps & {onFocus:() => void, pickerRef?: FocusableRef<HTMLButtonElement>}>({onFocus: () => {}});\n\nconst tabs = style({\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 iconOnly = false\n } = props;\n let domRef = useDOMRef(ref);\n let [value, setValue] = useControlledState(props.selectedKey, props.defaultSelectedKey ?? null!, props.onSelectionChange);\n let pickerRef = useRef<FocusableRefValue<HTMLButtonElement>>(null);\n\n return (\n <Provider\n values={[\n [InternalTabsContext, {\n density,\n isDisabled,\n orientation,\n disabledKeys,\n selectedKey: value,\n onSelectionChange: setValue,\n iconOnly,\n onFocus: () => pickerRef.current?.focus(),\n pickerRef\n }]\n ]}>\n <CollapsingCollection containerRef={domRef}>\n <RACTabs\n {...props}\n ref={domRef}\n selectedKey={value}\n onSelectionChange={setValue}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tabs({...renderProps}, props.styles)}>\n {props.children}\n </RACTabs>\n </CollapsingCollection>\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 isIconOnly: {\n density: {\n compact: 16,\n regular: 24\n }\n }\n }\n }\n },\n flexDirection: {\n orientation: {\n vertical: 'column'\n }\n },\n paddingEnd: {\n orientation: {\n vertical: 20\n }\n },\n paddingStart: {\n orientation: {\n vertical: 12\n }\n },\n flexShrink: 0,\n flexBasis: '[0%]'\n});\n\nexport function TabList<T extends object>(props: TabListProps<T>) {\n let {density, isDisabled, disabledKeys, orientation, iconOnly, onFocus} = useContext(InternalTabsContext) ?? {};\n let {showItems} = useContext(CollapseContext) ?? {};\n let state = useContext(TabListStateContext);\n let [selectedTab, setSelectedTab] = useState<HTMLElement | undefined>(undefined);\n let tablistRef = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n if (tablistRef?.current && showItems) {\n let tab: HTMLElement | null = tablistRef.current.querySelector('[role=tab][data-selected=true]');\n\n if (tab != null) {\n setSelectedTab(tab);\n }\n } else if (tablistRef?.current) {\n let picker: HTMLElement | null = tablistRef.current.querySelector('button');\n if (picker != null) {\n setSelectedTab(picker);\n }\n }\n }, [tablistRef, state?.selectedItem?.key, showItems]);\n\n let prevFocused = useRef<boolean | undefined>(false);\n useLayoutEffect(() => {\n if (!showItems && !prevFocused.current && state?.selectionManager.isFocused) {\n onFocus();\n }\n prevFocused.current = state?.selectionManager.isFocused;\n }, [state?.selectionManager.isFocused, state?.selectionManager.focusedKey, showItems]);\n\n return (\n <div\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + style({position: 'relative'}, getAllowedOverrides())(null, props.styles)}>\n {showItems && orientation === 'vertical' &&\n <TabLine disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}\n <RACTabList\n {...props}\n ref={tablistRef}\n className={renderProps => tablist({...renderProps, isIconOnly: iconOnly, density})} />\n {orientation === 'horizontal' &&\n <TabLine showItems={showItems} disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}\n </div>\n );\n}\n\ninterface TabLineProps {\n disabledKeys: Iterable<Key> | undefined,\n isDisabled: boolean | undefined,\n selectedTab: HTMLElement | undefined,\n orientation?: Orientation,\n density?: 'compact' | 'regular',\n showItems?: boolean\n}\n\nconst selectedIndicator = style({\n position: 'absolute',\n backgroundColor: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n height: {\n orientation: {\n horizontal: '[2px]'\n }\n },\n width: {\n orientation: {\n vertical: '[2px]'\n }\n },\n bottom: {\n orientation: {\n horizontal: 0\n }\n },\n borderStyle: 'none',\n borderRadius: 'full',\n transitionDuration: 130,\n transitionTimingFunction: 'in-out'\n});\n\nfunction TabLine(props: TabLineProps) {\n let {\n disabledKeys,\n isDisabled: isTabsDisabled,\n selectedTab,\n orientation,\n density\n } = props;\n let {direction} = useLocale();\n let state = useContext(TabListStateContext);\n\n let isDisabled = useMemo(() => {\n return isTabsDisabled || isAllTabsDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set());\n }, [state?.collection, disabledKeys, isTabsDisabled]);\n\n let [style, setStyle] = useState<{transform: string | undefined, width: string | undefined, height: string | undefined}>({\n transform: undefined,\n width: undefined,\n height: undefined\n });\n\n let onResize = useCallback(() => {\n if (selectedTab) {\n let styleObj: { transform: string | undefined, width: string | undefined, height: string | undefined } = {\n transform: undefined,\n width: undefined,\n height: undefined\n };\n\n // In RTL, calculate the transform from the right edge of the tablist so that resizing the window doesn't break the Tabline position due to offsetLeft changes\n let offset = direction === 'rtl' ? -1 * ((selectedTab.offsetParent as HTMLElement)?.offsetWidth - selectedTab.offsetWidth - selectedTab.offsetLeft) : selectedTab.offsetLeft;\n styleObj.transform = orientation === 'vertical'\n ? `translateY(${selectedTab.offsetTop}px)`\n : `translateX(${offset}px)`;\n\n if (orientation === 'horizontal') {\n styleObj.width = `${selectedTab.offsetWidth}px`;\n } else {\n styleObj.height = `${selectedTab.offsetHeight}px`;\n }\n setStyle(styleObj);\n }\n }, [direction, setStyle, selectedTab, orientation]);\n\n useLayoutEffect(() => {\n onResize();\n }, [onResize, state?.selectedItem?.key, direction, orientation, density]);\n\n return (\n <div style={{...style}} className={selectedIndicator({isDisabled, orientation})} />\n );\n}\n\nconst tab = style({\n ...focusRing(),\n display: 'flex',\n color: {\n default: 'neutral-subdued',\n isSelected: 'neutral',\n isHovered: 'neutral-subdued',\n isDisabled: 'disabled',\n forcedColors: {\n isSelected: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'sm',\n gap: 'text-to-visual',\n height: {\n density: {\n compact: 32,\n regular: 48\n }\n },\n alignItems: 'center',\n position: 'relative',\n cursor: 'default',\n flexShrink: 0,\n transition: 'default'\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) {\n let {density, iconOnly} = useContext(InternalTabsContext) ?? {};\n\n return (\n <RACTab\n {...props}\n // @ts-ignore\n originalProps={props}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tab({...renderProps, density}, props.styles)}>\n {({\n // @ts-ignore\n isMenu\n }) => {\n if (isMenu) {\n return props.children;\n } else {\n return (\n <Provider\n values={[\n [TextContext, {\n styles:\n style({\n order: 1,\n display: {\n isIconOnly: 'none'\n }\n })({isIconOnly: iconOnly})\n }],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: icon\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n );\n }\n }}\n </RACTab>\n );\n}\n\nconst tabPanel = style({\n marginTop: 4,\n color: 'gray-800',\n flexGrow: 1,\n flexBasis: '[0%]',\n minHeight: 0,\n minWidth: 0\n}, getAllowedOverrides({height: true}));\n\nexport function TabPanel(props: TabPanelProps) {\n return (\n <AriaTabPanel\n {...props}\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + tabPanel(null, props.styles)} />\n );\n}\n\nfunction isAllTabsDisabled<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=\"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: {items: Array<Node<any>>, onSelectionChange: TabsProps['onSelectionChange']}) => {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {items} = props;\n let {density, onSelectionChange, selectedKey, isDisabled, disabledKeys, pickerRef} = useContext(InternalTabsContext);\n let state = useContext(TabListStateContext);\n let allKeysDisabled = useMemo(() => {\n return isAllTabsDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set());\n }, [state?.collection, disabledKeys]);\n\n return (\n <UNSTABLE_CollectionRendererContext.Provider value={UNSTABLE_DefaultCollectionRenderer}>\n <div\n className={style({\n display: 'flex',\n alignItems: 'center',\n height: {\n density: {\n compact: 32,\n regular: 48\n }\n }})({density})}>\n <Picker\n ref={pickerRef ? pickerRef : undefined}\n isDisabled={isDisabled || allKeysDisabled}\n density={density!}\n items={items}\n disabledKeys={disabledKeys}\n selectedKey={selectedKey}\n onSelectionChange={onSelectionChange}\n aria-label={stringFormatter.format('tabs.selectorLabel')}>\n {(item: Node<any>) => {\n // need to determine the best way to handle icon only -> icon and text\n // good enough to aria-label the picker item?\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 </UNSTABLE_CollectionRendererContext.Provider>\n );\n};\n\n// Context for passing the count for the custom renderer\nlet CollapseContext = createContext<{\n containerRef: RefObject<HTMLDivElement | null>,\n showItems: boolean,\n setShowItems:(value: boolean) => void\n} | null>(null);\n\nfunction CollapsingCollection({children, containerRef}) {\n let [showItems, _setShowItems] = useState(true);\n let {orientation} = useContext(InternalTabsContext);\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 return (\n <CollapseContext.Provider value={{containerRef, showItems: orientation === 'vertical' ? true : showItems, setShowItems}}>\n <UNSTABLE_CollectionRendererContext.Provider value={CollapsingCollectionRenderer}>\n {children}\n </UNSTABLE_CollectionRendererContext.Provider>\n </CollapseContext.Provider>\n );\n}\n\nlet CollapsingCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection}) {\n return useCollectionRender(collection);\n },\n CollectionBranch({collection}) {\n return useCollectionRender(collection);\n }\n};\n\n\nlet useCollectionRender = (collection: Collection<Node<unknown>>) => {\n let {containerRef, showItems, setShowItems} = useContext(CollapseContext) ?? {};\n let {density = 'regular', orientation = 'horizontal', onSelectionChange} = useContext(InternalTabsContext);\n let {direction} = useLocale();\n\n let children = useMemo(() => {\n let result: Node<any>[] = [];\n for (let key of collection.getKeys()) {\n result.push(collection.getItem(key)!);\n }\n return result;\n }, [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 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 return (\n <>\n <HiddenTabs items={children} density={density} listRef={listRef} />\n {showItems ? (\n children.map(node => <Fragment key={node.key}>{node.render?.(node)}</Fragment>)\n ) : (\n <>\n <TabsMenu items={children} onSelectionChange={onSelectionChange} />\n </>\n )}\n </>\n );\n};\n"],"names":[],"version":3,"file":"Tabs.mjs.map"}
@@ -0,0 +1,364 @@
1
+ require("./TabsPicker.css");
2
+ var $e991cbcdf82ced71$exports = require("./CenterBaseline.cjs");
3
+ var $e741ea6b88ce4866$exports = require("./Menu.cjs");
4
+ var $dba2b18fc5727f9b$exports = require("./Checkmark.cjs");
5
+ var $1df9f1c9262ce5df$exports = require("./Chevron.cjs");
6
+ var $a0b996a550bb0891$exports = require("./Field.cjs");
7
+ var $6367bc87eb7d24ad$exports = require("./Content.cjs");
8
+ var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
9
+ var $4526404114e78c80$exports = require("./intlStrings.cjs");
10
+ var $493371ef39bf7a55$exports = require("./Popover.cjs");
11
+ var $2061c83559b50a66$exports = require("./pressScale.cjs");
12
+ var $bfa4962d90c8af48$exports = require("./Form.cjs");
13
+ var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
14
+ var $7pV4n$reactjsxruntime = require("react/jsx-runtime");
15
+ var $7pV4n$reactariacomponents = require("react-aria-components");
16
+ var $7pV4n$react = require("react");
17
+ var $7pV4n$reactspectrumutils = require("@react-spectrum/utils");
18
+ var $7pV4n$reactariai18n = require("@react-aria/i18n");
19
+
20
+
21
+ function $parcel$interopDefault(a) {
22
+ return a && a.__esModule ? a.default : a;
23
+ }
24
+
25
+ function $parcel$export(e, n, v, s) {
26
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
27
+ }
28
+
29
+ $parcel$export(module.exports, "Picker", () => $9d2c38978395d44a$export$ba25329847403e11);
30
+ $parcel$export(module.exports, "PickerItem", () => $9d2c38978395d44a$export$d601881f38163e28);
31
+ /*
32
+ * Copyright 2024 Adobe. All rights reserved.
33
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
34
+ * you may not use this file except in compliance with the License. You may obtain a copy
35
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing, software distributed under
38
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
39
+ * OF ANY KIND, either express or implied. See the License for the specific language
40
+ * governing permissions and limitations under the License.
41
+ */
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+ const $9d2c38978395d44a$export$b72b8dade9393cd5 = /*#__PURE__*/ (0, $7pV4n$react.createContext)(null);
59
+ const $9d2c38978395d44a$var$inputButton = function anonymous(props) {
60
+ let rules = " .";
61
+ if (props.isFocusVisible) rules += ' _Lb';
62
+ else rules += ' _La';
63
+ rules += ' da_____z';
64
+ rules += ' dx';
65
+ rules += ' _Nc';
66
+ rules += ' _M-3t1z';
67
+ rules += ' __a-4cfph1';
68
+ rules += ' __b-4cfph1';
69
+ rules += ' __c-4cfph1';
70
+ rules += ' __d-4cfph1';
71
+ if (props.size === "XL") rules += ' qj';
72
+ else if (props.size === "L") rules += ' qi';
73
+ else if (props.size === "S") rules += ' qh';
74
+ else if (props.size === "XS") rules += ' qg';
75
+ else rules += ' qf';
76
+ if (props.isQuiet) rules += ' __ma';
77
+ else rules += ' __m-1s8glxue';
78
+ if (props.size === "XL") rules += ' -usygro_l-____g';
79
+ else if (props.size === "L") rules += ' -usygro_l-___0';
80
+ else if (props.size === "S") rules += ' -usygro_l-___u';
81
+ else rules += ' -usygro_l-___K';
82
+ rules += ' m-rwozxi';
83
+ rules += ' Uc';
84
+ rules += ' _c-bc1l9oh';
85
+ rules += ' _c-1uotwbwg';
86
+ rules += ' _c-eo0c6sf';
87
+ rules += ' _c-enzzrge';
88
+ rules += ' _c-enzykdd';
89
+ rules += ' _c-enzwzjc';
90
+ rules += ' _c-enzrfpb';
91
+ rules += ' _ca';
92
+ rules += ' _dbf';
93
+ rules += ' _de';
94
+ rules += ' _eb';
95
+ rules += ' _f-1x99dlob';
96
+ rules += ' _fa';
97
+ if (props.isDisabled) rules += ' aj';
98
+ else {
99
+ if (props.isPressed) rules += ' ao';
100
+ else if (props.isFocusVisible) rules += ' ao';
101
+ else if (props.isHovered) rules += ' ao';
102
+ else rules += ' an';
103
+ }
104
+ rules += ' _Zd';
105
+ rules += ' _ja';
106
+ rules += ' wf';
107
+ rules += ' _vb';
108
+ rules += ' _wb';
109
+ rules += ' _xb';
110
+ rules += ' _yb';
111
+ rules += ' _1c';
112
+ rules += ' _Oa';
113
+ rules += ' _Q-375x7f';
114
+ rules += ' _Ra';
115
+ rules += ' jbH';
116
+ rules += ' jG';
117
+ rules += ' C-375tnm';
118
+ rules += ' D-375tnn';
119
+ rules += ' ba';
120
+ if (props.isQuiet) rules += ' rd';
121
+ rules += ' __R-yksgrp';
122
+ if (props.density === "compact") rules += ' kU';
123
+ else rules += ' k_a';
124
+ rules += ' __na';
125
+ rules += ' -_375tnm_C-a';
126
+ rules += ' -_375tnn_D-a';
127
+ return rules;
128
+ };
129
+ let $9d2c38978395d44a$export$b1e5508a851be14d = function anonymous(props) {
130
+ let rules = " .";
131
+ rules += ' _La';
132
+ rules += ' _Zf';
133
+ rules += ' __h-1kgdida';
134
+ rules += ' __na';
135
+ rules += ' p-17zqamw';
136
+ rules += ' __va';
137
+ rules += ' __wa';
138
+ rules += ' Ed';
139
+ rules += ' Fd';
140
+ rules += ' Cd';
141
+ rules += ' Dd';
142
+ rules += ' _c-bc1l9oh';
143
+ rules += ' _c-1uotwbwg';
144
+ rules += ' _c-eo0c6sf';
145
+ rules += ' _c-enzzrge';
146
+ rules += ' _c-enzykdd';
147
+ rules += ' _c-enzwzjc';
148
+ rules += ' _c-enzrfpb';
149
+ rules += ' _ca';
150
+ if (props.size === "XL") {
151
+ rules += ' _dbj';
152
+ rules += ' _di';
153
+ } else if (props.size === "L") {
154
+ rules += ' _dbh';
155
+ rules += ' _dg';
156
+ } else if (props.size === "S") {
157
+ rules += ' _dbd';
158
+ rules += ' _dc';
159
+ } else if (props.size === "XS") {
160
+ rules += ' _dbb';
161
+ rules += ' _da';
162
+ } else {
163
+ rules += ' _dbf';
164
+ rules += ' _de';
165
+ }
166
+ return rules;
167
+ };
168
+ const $9d2c38978395d44a$var$valueStyles = " . _9-3t1x __vb __wb _ma _pb _Zd _1c kb";
169
+ const $9d2c38978395d44a$var$iconStyles = " . _8-3t1x R-3hn0u -rwx0fg_e-b";
170
+ let $9d2c38978395d44a$var$InsideSelectValueContext = /*#__PURE__*/ (0, $7pV4n$react.createContext)(false);
171
+ function $9d2c38978395d44a$var$Picker(props, ref) {
172
+ let stringFormatter = (0, $7pV4n$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
173
+ [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $9d2c38978395d44a$export$b72b8dade9393cd5);
174
+ let domRef = (0, $7pV4n$reactspectrumutils.useFocusableRef)(ref);
175
+ props = (0, $bfa4962d90c8af48$exports.useFormProps)(props);
176
+ let { direction: direction = 'bottom', align: align = 'start', shouldFlip: shouldFlip = true, children: children, items: items, placeholder: placeholder = stringFormatter.format('picker.placeholder'), density: density, ...pickerProps } = props;
177
+ let isQuiet = true;
178
+ const menuOffset = 6;
179
+ const size = 'M';
180
+ return /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $7pV4n$reactariacomponents.Select), {
181
+ ...pickerProps,
182
+ placeholder: placeholder,
183
+ children: ({ isOpen: isOpen })=>/*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsxs)((0, $7pV4n$reactjsxruntime.Fragment), {
184
+ children: [
185
+ /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldLabel), {
186
+ isQuiet: isQuiet
187
+ }),
188
+ /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsxs)((0, $7pV4n$reactariacomponents.Button), {
189
+ ref: domRef,
190
+ style: (renderProps)=>(0, $2061c83559b50a66$exports.pressScale)(domRef)(renderProps),
191
+ // Prevent press scale from sticking while Picker is open.
192
+ // @ts-ignore
193
+ isPressed: false,
194
+ className: (renderProps)=>$9d2c38978395d44a$var$inputButton({
195
+ ...renderProps,
196
+ size: 'M',
197
+ isOpen: isOpen,
198
+ isQuiet: isQuiet,
199
+ density: density
200
+ }),
201
+ children: [
202
+ /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $7pV4n$reactariacomponents.SelectValue), {
203
+ className: $9d2c38978395d44a$var$valueStyles + ' ' + "-u6zm92",
204
+ children: ({ defaultChildren: defaultChildren })=>{
205
+ return /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $7pV4n$reactariacomponents.Provider), {
206
+ values: [
207
+ [
208
+ (0, $bde97c91243ed164$exports.IconContext),
209
+ {
210
+ slots: {
211
+ icon: {
212
+ render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
213
+ slot: 'icon',
214
+ styles: (0, $e741ea6b88ce4866$exports.iconCenterWrapper)
215
+ }),
216
+ styles: (0, $e741ea6b88ce4866$exports.icon)
217
+ }
218
+ }
219
+ }
220
+ ],
221
+ [
222
+ (0, $6367bc87eb7d24ad$exports.TextContext),
223
+ {
224
+ slots: {
225
+ // Default slot is useful when converting other collections to PickerItems.
226
+ [(0, $7pV4n$reactariacomponents.DEFAULT_SLOT)]: {
227
+ styles: " . _Za _9-3t1y __vb __wb _ma _pb"
228
+ }
229
+ }
230
+ }
231
+ ],
232
+ [
233
+ $9d2c38978395d44a$var$InsideSelectValueContext,
234
+ true
235
+ ]
236
+ ],
237
+ children: defaultChildren
238
+ });
239
+ }
240
+ }),
241
+ /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $1df9f1c9262ce5df$exports.default), {
242
+ size: size,
243
+ className: $9d2c38978395d44a$var$iconStyles
244
+ })
245
+ ]
246
+ }),
247
+ /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $493371ef39bf7a55$exports.PopoverBase), {
248
+ hideArrow: true,
249
+ offset: menuOffset,
250
+ placement: `${direction} ${align}`,
251
+ shouldFlip: shouldFlip,
252
+ styles: " . y-375tp4 q___u l-13f72lm -_375tp4_y-M",
253
+ children: /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $7pV4n$reactariacomponents.Provider), {
254
+ values: [
255
+ [
256
+ (0, $6367bc87eb7d24ad$exports.HeaderContext),
257
+ {
258
+ styles: (0, $e741ea6b88ce4866$exports.sectionHeader)({
259
+ size: size
260
+ })
261
+ }
262
+ ],
263
+ [
264
+ (0, $6367bc87eb7d24ad$exports.HeadingContext),
265
+ {
266
+ styles: (0, $e741ea6b88ce4866$exports.sectionHeading)
267
+ }
268
+ ],
269
+ [
270
+ (0, $6367bc87eb7d24ad$exports.TextContext),
271
+ {
272
+ slots: {
273
+ description: {
274
+ styles: (0, $e741ea6b88ce4866$exports.description)({
275
+ size: size
276
+ })
277
+ }
278
+ }
279
+ }
280
+ ]
281
+ ],
282
+ children: /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $7pV4n$reactariacomponents.ListBox), {
283
+ items: items,
284
+ className: $9d2c38978395d44a$export$b1e5508a851be14d,
285
+ children: children
286
+ })
287
+ })
288
+ })
289
+ ]
290
+ })
291
+ });
292
+ }
293
+ /**
294
+ * Pickers allow users to choose a single option from a collapsible list of options when space is limited.
295
+ */ let $9d2c38978395d44a$export$ba25329847403e11 = /*#__PURE__*/ (0, $7pV4n$react.forwardRef)($9d2c38978395d44a$var$Picker);
296
+ function $9d2c38978395d44a$export$d601881f38163e28(props) {
297
+ let ref = (0, $7pV4n$react.useRef)(null);
298
+ let isLink = props.href != null;
299
+ const size = 'M';
300
+ return /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $7pV4n$reactariacomponents.ListBoxItem), {
301
+ ...props,
302
+ ref: ref,
303
+ textValue: props.textValue || (typeof props.children === 'string' ? props.children : undefined),
304
+ style: (0, $2061c83559b50a66$exports.pressScale)(ref, props.UNSAFE_style),
305
+ className: (renderProps)=>(props.UNSAFE_className || '') + (0, $e741ea6b88ce4866$exports.menuitem)({
306
+ ...renderProps,
307
+ size: size,
308
+ isLink: isLink
309
+ }, props.styles),
310
+ children: (renderProps)=>{
311
+ let { children: children } = props;
312
+ return /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)($9d2c38978395d44a$var$DefaultProvider, {
313
+ context: (0, $bde97c91243ed164$exports.IconContext),
314
+ value: {
315
+ slots: {
316
+ icon: {
317
+ render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
318
+ slot: 'icon',
319
+ styles: (0, $e741ea6b88ce4866$exports.iconCenterWrapper)
320
+ }),
321
+ styles: (0, $e741ea6b88ce4866$exports.icon)
322
+ }
323
+ }
324
+ },
325
+ children: /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsxs)($9d2c38978395d44a$var$DefaultProvider, {
326
+ context: (0, $6367bc87eb7d24ad$exports.TextContext),
327
+ value: {
328
+ slots: {
329
+ [(0, $7pV4n$reactariacomponents.DEFAULT_SLOT)]: {
330
+ styles: (0, $e741ea6b88ce4866$exports.label)({
331
+ size: size
332
+ })
333
+ }
334
+ }
335
+ },
336
+ children: [
337
+ !isLink && /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $dba2b18fc5727f9b$exports.default), {
338
+ size: size,
339
+ className: (0, $e741ea6b88ce4866$exports.checkmark)({
340
+ ...renderProps,
341
+ size: size
342
+ })
343
+ }),
344
+ typeof children === 'string' ? /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
345
+ children: children
346
+ }) : children
347
+ ]
348
+ })
349
+ });
350
+ }
351
+ });
352
+ }
353
+ // A Context.Provider that only sets a value if not inside SelectValue.
354
+ function $9d2c38978395d44a$var$DefaultProvider({ context: context, value: value, children: children }) {
355
+ let inSelectValue = (0, $7pV4n$react.useContext)($9d2c38978395d44a$var$InsideSelectValueContext);
356
+ if (inSelectValue) return children;
357
+ return /*#__PURE__*/ (0, $7pV4n$reactjsxruntime.jsx)(context.Provider, {
358
+ value: value,
359
+ children: children
360
+ });
361
+ }
362
+
363
+
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wBAChF,OAAO,aAAa,yBAAW,gCAAC,CAAA,GAAA,8BAAG;sCAAG;6BAAmB;;;;QAIlE;;AAGN;AAEA,uEAAuE;AACvE,SAAS,sCAAgB,WAAC,OAAO,SAAE,KAAK,YAAE,QAAQ,EAA2D;IAC3G,IAAI,gBAAgB,CAAA,GAAA,uBAAS,EAAE;IAC/B,IAAI,eACF,OAAO;IAGT,qBAAO,gCAAC,QAAQ,QAAQ;QAAC,OAAO;kBAAQ;;AAC1C","sources":["packages/@react-spectrum/s2/src/TabsPicker.tsx"],"sourcesContent":["/*\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 PopoverProps as AriaPopoverProps,\n Select as AriaSelect,\n SelectProps as AriaSelectProps,\n Button,\n ContextValue,\n DEFAULT_SLOT,\n ListBox,\n ListBoxItem,\n ListBoxItemProps,\n ListBoxProps,\n Provider,\n SelectValue\n} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {\n checkmark,\n description,\n icon,\n iconCenterWrapper,\n label,\n menuitem,\n sectionHeader,\n sectionHeading\n} from './Menu';\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronIcon from '../ui-icons/Chevron';\nimport {edgeToText, focusRing, style} from '../style' with {type: 'macro'};\nimport {fieldInput, StyleProps} from './style-utils' with {type: 'macro'};\nimport {\n FieldLabel\n} from './Field';\nimport {FocusableRef, FocusableRefValue, SpectrumLabelableProps} from '@react-types/shared';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, Text, TextContext} from './Content';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Placement} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {pressScale} from './pressScale';\nimport {raw} from '../style/style-macro' with {type: 'macro'};\nimport React, {createContext, forwardRef, ReactNode, useContext, useRef} from 'react';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useFormProps} from './Form';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n\nexport interface PickerStyleProps {\n}\n\nexport interface PickerProps<T extends object> extends\n Omit<AriaSelectProps<T>, 'children' | 'style' | 'className'>,\n PickerStyleProps,\n StyleProps,\n SpectrumLabelableProps,\n Pick<ListBoxProps<T>, 'items'>,\n Pick<AriaPopoverProps, 'shouldFlip'> {\n /** The contents of the collection. */\n children: ReactNode | ((item: T) => ReactNode),\n /**\n * Direction the menu will render relative to the Picker.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top',\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /** Width of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width. */\n menuWidth?: number,\n /** Density of the tabs, affects the height of the picker. */\n density: 'compact' | 'regular'\n}\n\nexport const PickerContext = createContext<ContextValue<Partial<PickerProps<any>>, FocusableRefValue<HTMLButtonElement>>>(null);\n\nconst inputButton = style({\n ...focusRing(),\n ...fieldInput(),\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n position: 'relative',\n font: 'ui',\n display: 'flex',\n textAlign: 'start',\n borderStyle: 'none',\n borderRadius: 'sm',\n alignItems: 'center',\n transition: 'default',\n columnGap: 'text-to-visual',\n paddingX: 0,\n backgroundColor: 'transparent',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n maxWidth: {\n isQuiet: 'max'\n },\n disableTapHighlight: true,\n height: {\n default: 48,\n density: {\n compact: 32\n }\n },\n boxSizing: 'border-box'\n});\n\nexport let menu = style({\n outlineStyle: 'none',\n display: 'grid',\n gridTemplateColumns: [edgeToText(32), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(32)],\n boxSizing: 'border-box',\n maxHeight: '[inherit]',\n overflow: 'auto',\n padding: 8,\n fontFamily: 'sans',\n fontSize: 'control'\n});\n\nconst valueStyles = style({\n flexGrow: 0,\n truncate: true,\n display: 'flex',\n alignItems: 'center',\n height: 'full'\n});\n\nconst iconStyles = style({\n flexShrink: 0,\n rotate: 90,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nlet InsideSelectValueContext = createContext(false);\n\nfunction Picker<T extends object>(props: PickerProps<T>, ref: FocusableRef<HTMLButtonElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, PickerContext);\n let domRef = useFocusableRef(ref);\n props = useFormProps(props);\n let {\n direction = 'bottom',\n align = 'start',\n shouldFlip = true,\n children,\n items,\n placeholder = stringFormatter.format('picker.placeholder'),\n density,\n ...pickerProps\n } = props;\n let isQuiet = true;\n\n const menuOffset: number = 6;\n const size = 'M';\n\n return (\n <AriaSelect\n {...pickerProps}\n placeholder={placeholder}>\n {({isOpen}) => (\n <>\n <FieldLabel isQuiet={isQuiet} />\n <Button\n ref={domRef}\n style={renderProps => pressScale(domRef)(renderProps)}\n // Prevent press scale from sticking while Picker is open.\n // @ts-ignore\n isPressed={false}\n className={renderProps => inputButton({\n ...renderProps,\n size: 'M',\n isOpen,\n isQuiet,\n density\n })}>\n <SelectValue className={valueStyles + ' ' + raw('&> * {display: none;}')}>\n {({defaultChildren}) => {\n return (\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {\n render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}),\n styles: icon\n }\n }\n }],\n [TextContext, {\n slots: {\n // Default slot is useful when converting other collections to PickerItems.\n [DEFAULT_SLOT]: {styles: style({\n display: 'block',\n flexGrow: 1,\n truncate: true\n })}\n }\n }],\n [InsideSelectValueContext, true]\n ]}>\n {defaultChildren}\n </Provider>\n );\n }}\n </SelectValue>\n <ChevronIcon\n size={size}\n className={iconStyles} />\n </Button>\n <PopoverBase\n hideArrow\n offset={menuOffset}\n placement={`${direction} ${align}` as Placement}\n shouldFlip={shouldFlip}\n styles={style({\n marginStart: -12,\n minWidth: 192,\n width: '[calc(var(--trigger-width) + (-2 * self(marginStart)))]'\n })}>\n <Provider\n values={[\n [HeaderContext, {styles: sectionHeader({size})}],\n [HeadingContext, {styles: sectionHeading}],\n [TextContext, {\n slots: {\n description: {styles: description({size})}\n }\n }]\n ]}>\n <ListBox\n items={items}\n className={menu}>\n {children}\n </ListBox>\n </Provider>\n </PopoverBase>\n </>\n )}\n </AriaSelect>\n );\n}\n\n/**\n * Pickers allow users to choose a single option from a collapsible list of options when space is limited.\n */\nlet _Picker = /*#__PURE__*/ (forwardRef as forwardRefType)(Picker);\nexport {_Picker as Picker};\n\nexport interface PickerItemProps extends Omit<ListBoxItemProps, 'children' | 'style' | 'className'>, StyleProps {\n children: ReactNode\n}\n\nexport function PickerItem(props: PickerItemProps) {\n let ref = useRef(null);\n let isLink = props.href != null;\n const size = 'M';\n return (\n <ListBoxItem\n {...props}\n ref={ref}\n textValue={props.textValue || (typeof props.children === 'string' ? props.children as string : undefined)}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n return (\n <DefaultProvider\n context={IconContext}\n value={{slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), styles: icon}\n }}}>\n <DefaultProvider\n context={TextContext}\n value={{\n slots: {\n [DEFAULT_SLOT]: {styles: label({size})}\n }\n }}>\n {!isLink && <CheckmarkIcon size={size} className={checkmark({...renderProps, size})} />}\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n </DefaultProvider>\n </DefaultProvider>\n );\n }}\n </ListBoxItem>\n );\n}\n\n// A Context.Provider that only sets a value if not inside SelectValue.\nfunction DefaultProvider({context, value, children}: {context: React.Context<any>, value: any, children: any}) {\n let inSelectValue = useContext(InsideSelectValueContext);\n if (inSelectValue) {\n return children;\n }\n\n return <context.Provider value={value}>{children}</context.Provider>;\n}\n"],"names":[],"version":3,"file":"TabsPicker.cjs.map"}