@deephaven/components 1.1.2-grid-render-loop.4 → 1.2.1-3-revert-plotly.1
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/AutoCompleteInput.js.map +1 -1
- package/dist/AutoResizeTextarea.js.map +1 -1
- package/dist/BasicModal.js.map +1 -1
- package/dist/BulkActionBar.js.map +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/CardFlip.js.map +1 -1
- package/dist/Checkbox.js.map +1 -1
- package/dist/Collapse.js.map +1 -1
- package/dist/ComponentUtils.js.map +1 -1
- package/dist/CopyButton.js.map +1 -1
- package/dist/CustomTimeSelect.js.map +1 -1
- package/dist/DateInput.js.map +1 -1
- package/dist/DateInputUtils.js.map +1 -1
- package/dist/DateTimeInput.js.map +1 -1
- package/dist/DateTimeInputUtils.js.map +1 -1
- package/dist/DebouncedSearchInput.js.map +1 -1
- package/dist/DragUtils.js.map +1 -1
- package/dist/DraggableItemList.js.map +1 -1
- package/dist/EditableItemList.js.map +1 -1
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/ErrorView.js.map +1 -1
- package/dist/HierarchicalCheckboxMenu.js.map +1 -1
- package/dist/ItemList.js.map +1 -1
- package/dist/ItemListItem.js.map +1 -1
- package/dist/LoadingOverlay.js.map +1 -1
- package/dist/LoadingSpinner.js.map +1 -1
- package/dist/MaskedInput.js.map +1 -1
- package/dist/MaskedInputUtils.js.map +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioItem.js.map +1 -1
- package/dist/RandomAreaPlotAnimation.js.map +1 -1
- package/dist/SearchInput.js.map +1 -1
- package/dist/SearchableCombobox.js.map +1 -1
- package/dist/Select.d.ts +1 -1
- package/dist/Select.js.map +1 -1
- package/dist/SelectValueList.js.map +1 -1
- package/dist/SocketedButton.js.map +1 -1
- package/dist/SplitButtonGroup.js.map +1 -1
- package/dist/TableViewEmptyState.js.map +1 -1
- package/dist/TextWithTooltip.js.map +1 -1
- package/dist/ThemeExport.js.map +1 -1
- package/dist/TimeInput.js.map +1 -1
- package/dist/TimeSlider.js.map +1 -1
- package/dist/ToastNotification.js.map +1 -1
- package/dist/UIConstants.js.map +1 -1
- package/dist/UISwitch.js.map +1 -1
- package/dist/XComponent.js.map +1 -1
- package/dist/XComponentMap.js.map +1 -1
- package/dist/actions/ConfirmActionButton.js.map +1 -1
- package/dist/actions/IconActionButton.js.map +1 -1
- package/dist/actions/index.js.map +1 -1
- package/dist/context-actions/ContextActionUtils.js.map +1 -1
- package/dist/context-actions/ContextActions.js.map +1 -1
- package/dist/context-actions/ContextMenu.js.map +1 -1
- package/dist/context-actions/ContextMenuItem.js.map +1 -1
- package/dist/context-actions/ContextMenuRoot.js.map +1 -1
- package/dist/context-actions/GlobalContextAction.js.map +1 -1
- package/dist/context-actions/GlobalContextActions.js.map +1 -1
- package/dist/context-actions/index.js.map +1 -1
- package/dist/declaration.d.js.map +1 -1
- package/dist/dialogs/ActionButtonDialogTrigger.js.map +1 -1
- package/dist/dialogs/ConfirmationDialog.js.map +1 -1
- package/dist/dialogs/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/menu-actions/DropdownMenu.js.map +1 -1
- package/dist/menu-actions/Menu.js.map +1 -1
- package/dist/menu-actions/index.js.map +1 -1
- package/dist/modal/DebouncedModal.js.map +1 -1
- package/dist/modal/InfoModal.js.map +1 -1
- package/dist/modal/Modal.js.map +1 -1
- package/dist/modal/ModalBody.js.map +1 -1
- package/dist/modal/ModalFooter.js.map +1 -1
- package/dist/modal/ModalHeader.js.map +1 -1
- package/dist/modal/index.js.map +1 -1
- package/dist/navigation/Menu.js.map +1 -1
- package/dist/navigation/MenuItem.js.map +1 -1
- package/dist/navigation/NavTab.js.map +1 -1
- package/dist/navigation/NavTabList.js.map +1 -1
- package/dist/navigation/Page.js.map +1 -1
- package/dist/navigation/Stack.js.map +1 -1
- package/dist/navigation/index.js.map +1 -1
- package/dist/popper/Popper.js.map +1 -1
- package/dist/popper/Tooltip.js.map +1 -1
- package/dist/popper/index.js.map +1 -1
- package/dist/shortcuts/GlobalShortcuts.js.map +1 -1
- package/dist/shortcuts/NavigationShortcuts.js.map +1 -1
- package/dist/shortcuts/Shortcut.js.map +1 -1
- package/dist/shortcuts/ShortcutRegistry.js.map +1 -1
- package/dist/shortcuts/index.js.map +1 -1
- package/dist/spectrum/ActionGroup.js.map +1 -1
- package/dist/spectrum/ActionMenu.js.map +1 -1
- package/dist/spectrum/CheckboxGroup.js.map +1 -1
- package/dist/spectrum/Heading.js.map +1 -1
- package/dist/spectrum/ItemContent.js.map +1 -1
- package/dist/spectrum/ItemTooltip.js.map +1 -1
- package/dist/spectrum/ListActionGroup.js.map +1 -1
- package/dist/spectrum/ListActionMenu.js.map +1 -1
- package/dist/spectrum/TabPanels.js.map +1 -1
- package/dist/spectrum/Text.js.map +1 -1
- package/dist/spectrum/View.js.map +1 -1
- package/dist/spectrum/buttons.js.map +1 -1
- package/dist/spectrum/collections.js.map +1 -1
- package/dist/spectrum/comboBox/ComboBox.js.map +1 -1
- package/dist/spectrum/comboBox/ComboBoxNormalized.js.map +1 -1
- package/dist/spectrum/comboBox/index.js.map +1 -1
- package/dist/spectrum/content.js.map +1 -1
- package/dist/spectrum/dateAndTime.js.map +1 -1
- package/dist/spectrum/forms.js.map +1 -1
- package/dist/spectrum/icons.js.map +1 -1
- package/dist/spectrum/index.js.map +1 -1
- package/dist/spectrum/layout.js.map +1 -1
- package/dist/spectrum/listView/ListView.js.map +1 -1
- package/dist/spectrum/listView/ListViewNormalized.js.map +1 -1
- package/dist/spectrum/listView/ListViewWrapper.js.map +1 -1
- package/dist/spectrum/listView/index.js.map +1 -1
- package/dist/spectrum/navigation.js.map +1 -1
- package/dist/spectrum/overlays.js.map +1 -1
- package/dist/spectrum/picker/Picker.js.map +1 -1
- package/dist/spectrum/picker/PickerNormalized.js.map +1 -1
- package/dist/spectrum/picker/PickerProps.js.map +1 -1
- package/dist/spectrum/picker/index.js.map +1 -1
- package/dist/spectrum/picker/usePickerItemScale.js.map +1 -1
- package/dist/spectrum/picker/usePickerNormalizedProps.js.map +1 -1
- package/dist/spectrum/picker/usePickerProps.js.map +1 -1
- package/dist/spectrum/picker/usePickerScrollOnOpen.js.map +1 -1
- package/dist/spectrum/shared.js.map +1 -1
- package/dist/spectrum/status.js.map +1 -1
- package/dist/spectrum/utils/index.js.map +1 -1
- package/dist/spectrum/utils/itemUtils.js.map +1 -1
- package/dist/spectrum/utils/itemWrapperUtils.js.map +1 -1
- package/dist/spectrum/utils/propsUtils.js.map +1 -1
- package/dist/spectrum/utils/themeUtils.js.map +1 -1
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js.map +1 -1
- package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -1
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js.map +1 -1
- package/dist/spectrum/utils/useStringifiedMultiSelection.js.map +1 -1
- package/dist/spectrum/utils/useStringifiedSelection.js.map +1 -1
- package/dist/theme/Logo.js.map +1 -1
- package/dist/theme/SpectrumThemeProvider.js.map +1 -1
- package/dist/theme/ThemeModel.js.map +1 -1
- package/dist/theme/ThemePicker.js.map +1 -1
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeUtils.js.map +1 -1
- package/dist/theme/colorUtils.js.map +1 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/theme-dark/index.js.map +1 -1
- package/dist/theme/theme-light/index.js.map +1 -1
- package/dist/theme/theme-spectrum/index.js.map +1 -1
- package/dist/theme/useExternalTheme.js.map +1 -1
- package/dist/theme/useSpectrumThemeProvider.js.map +1 -1
- package/dist/theme/useTheme.js.map +1 -1
- package/dist/transitions/FadeTransition.js.map +1 -1
- package/dist/transitions/SlideTransition.js.map +1 -1
- package/dist/transitions/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","names":["Accordion","Breadcrumbs","Disclosure","DisclosureTitle","DisclosurePanel","Link","TabList","Tabs","DHCTabPanels","TabPanels"],"sources":["../../src/spectrum/navigation.ts"],"sourcesContent":["export {\n Accordion,\n type SpectrumAccordionProps as AccordionProps,\n Breadcrumbs,\n type SpectrumBreadcrumbsProps as BreadcrumbsProps,\n Disclosure,\n type SpectrumDisclosureProps as DisclosureProps,\n DisclosureTitle,\n type SpectrumDisclosureTitleProps as DisclosureTitleProps,\n DisclosurePanel,\n type SpectrumDisclosurePanelProps as DisclosurePanelProps,\n Link,\n type SpectrumLinkProps as LinkProps,\n TabList,\n type SpectrumTabListProps as TabListProps,\n Tabs,\n type SpectrumTabsProps as TabsProps,\n} from '@adobe/react-spectrum';\nexport {\n DHCTabPanels as TabPanels,\n type DHCTabPanelsProps as TabPanelsProps,\n} from './TabPanels';\n"],"mappings":"AAAA,SACEA,SAAS,EAETC,WAAW,EAEXC,UAAU,EAEVC,eAAe,EAEfC,eAAe,EAEfC,IAAI,EAEJC,OAAO,EAEPC,IAAI,QAEC,uBAAuB;AAAC,SAE7BC,YAAY,IAAIC,SAAS"
|
|
1
|
+
{"version":3,"file":"navigation.js","names":["Accordion","Breadcrumbs","Disclosure","DisclosureTitle","DisclosurePanel","Link","TabList","Tabs","DHCTabPanels","TabPanels"],"sources":["../../src/spectrum/navigation.ts"],"sourcesContent":["export {\n Accordion,\n type SpectrumAccordionProps as AccordionProps,\n Breadcrumbs,\n type SpectrumBreadcrumbsProps as BreadcrumbsProps,\n Disclosure,\n type SpectrumDisclosureProps as DisclosureProps,\n DisclosureTitle,\n type SpectrumDisclosureTitleProps as DisclosureTitleProps,\n DisclosurePanel,\n type SpectrumDisclosurePanelProps as DisclosurePanelProps,\n Link,\n type SpectrumLinkProps as LinkProps,\n TabList,\n type SpectrumTabListProps as TabListProps,\n Tabs,\n type SpectrumTabsProps as TabsProps,\n} from '@adobe/react-spectrum';\nexport {\n DHCTabPanels as TabPanels,\n type DHCTabPanelsProps as TabPanelsProps,\n} from './TabPanels';\n"],"mappings":"AAAA,SACEA,SAAS,EAETC,WAAW,EAEXC,UAAU,EAEVC,eAAe,EAEfC,eAAe,EAEfC,IAAI,EAEJC,OAAO,EAEPC,IAAI,QAEC,uBAAuB;AAAC,SAE7BC,YAAY,IAAIC,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlays.js","names":["AlertDialog","ContextualHelp","Dialog","DialogContainer","DialogTrigger"],"sources":["../../src/spectrum/overlays.ts"],"sourcesContent":["export {\n AlertDialog,\n type SpectrumAlertDialogProps as AlertDialogProps,\n ContextualHelp,\n type SpectrumContextualHelpProps as ContextualHelpProps,\n Dialog,\n type SpectrumDialogProps as DialogProps,\n DialogContainer,\n type SpectrumDialogContainerProps as DialogContainerProps,\n DialogTrigger,\n type SpectrumDialogTriggerProps as DialogTriggerProps,\n} from '@adobe/react-spectrum';\n"],"mappings":"AAAA,SACEA,WAAW,EAEXC,cAAc,EAEdC,MAAM,EAENC,eAAe,EAEfC,aAAa,QAER,uBAAuB"
|
|
1
|
+
{"version":3,"file":"overlays.js","names":["AlertDialog","ContextualHelp","Dialog","DialogContainer","DialogTrigger"],"sources":["../../src/spectrum/overlays.ts"],"sourcesContent":["export {\n AlertDialog,\n type SpectrumAlertDialogProps as AlertDialogProps,\n ContextualHelp,\n type SpectrumContextualHelpProps as ContextualHelpProps,\n Dialog,\n type SpectrumDialogProps as DialogProps,\n DialogContainer,\n type SpectrumDialogContainerProps as DialogContainerProps,\n DialogTrigger,\n type SpectrumDialogTriggerProps as DialogTriggerProps,\n} from '@adobe/react-spectrum';\n"],"mappings":"AAAA,SACEA,WAAW,EAEXC,cAAc,EAEdC,MAAM,EAENC,eAAe,EAEfC,aAAa,QAER,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.js","names":["Picker","SpectrumPicker","cl","React","useMergeRef","usePickerProps","jsx","_jsx","forwardRef","_ref","ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerProps","defaultSelectedKey","disabledKeys","selectedKey","scrollRef","pickerProps","_excluded2","pickerRef","_objectSpread","displayName"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import {\n Picker as SpectrumPicker,\n type SpectrumPickerProps,\n} from '@adobe/react-spectrum';\nimport type { DOMRef } from '@react-types/shared';\nimport cl from 'classnames';\nimport React from 'react';\nimport { useMergeRef } from '@deephaven/react-hooks';\nimport type { NormalizedItem } from '../utils';\nimport type { PickerProps } from './PickerProps';\nimport { usePickerProps } from './usePickerProps';\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `children` prop. Each item can be a string,\tnumber, boolean,\n * or a Spectrum <Item> element. The remaining props are just\tpass through props\n * for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport const Picker = React.forwardRef(function Picker(\n { UNSAFE_className, ...props }: PickerProps,\n ref: DOMRef<HTMLDivElement>\n): JSX.Element {\n const {\n defaultSelectedKey,\n disabledKeys,\n selectedKey,\n ref: scrollRef,\n ...pickerProps\n } = usePickerProps(props);\n const pickerRef = useMergeRef(ref, scrollRef);\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n ref={pickerRef}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n // Type assertions are necessary here since Spectrum types don't account\n // for number and boolean key values even though they are valid runtime\n // values.\n defaultSelectedKey={\n defaultSelectedKey as SpectrumPickerProps<NormalizedItem>['defaultSelectedKey']\n }\n disabledKeys={\n disabledKeys as SpectrumPickerProps<NormalizedItem>['disabledKeys']\n }\n selectedKey={\n selectedKey as SpectrumPickerProps<NormalizedItem>['selectedKey']\n }\n />\n );\n});\nPicker.displayName = 'Picker';\n\nexport default Picker;\n"],"mappings":";;;;;;;;;AAAA,SACEA,MAAM,IAAIC,cAAc,QAEnB,uBAAuB;AAE9B,OAAOC,EAAE,MAAM,YAAY;AAC3B,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,wBAAwB;AAAC,SAG5CC,cAAc;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,OAAO,IAAMP,MAAM,gBAAGG,KAAK,CAACK,UAAU,CAAC,SAASR,MAAMA,CAAAS,IAAA,EAEpDC,GAA2B,EACd;EAAA,IAFb;MAAEC;IAAwC,CAAC,GAAAF,IAAA;IAApBG,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAG5B,IAAAC,eAAA,GAMIV,cAAc,CAACO,KAAK,CAAC;IANnB;MACJI,kBAAkB;MAClBC,YAAY;MACZC,WAAW;MACXR,GAAG,EAAES;IAEP,CAAC,GAAAJ,eAAA;IADIK,WAAW,GAAAP,wBAAA,CAAAE,eAAA,EAAAM,UAAA;EAEhB,IAAMC,SAAS,GAAGlB,WAAW,CAACM,GAAG,EAAES,SAAS,CAAC;EAC7C,oBACEZ,IAAA,CAACN;EACC;EAAA,EAAAsB,aAAA,CAAAA,aAAA,KACIH,WAAW;IACfV,GAAG,EAAEY,SAAU;IACfX,gBAAgB,EAAET,EAAE,CAAC,WAAW,EAAES,gBAAgB;IAClD;IACA;IACA;IAAA;IACAK,kBAAkB,EAChBA,kBACD;IACDC,YAAY,EACVA,YACD;IACDC,WAAW,EACTA;EACD,EACF,CAAC;AAEN,CAAC,CAAC;AACFlB,MAAM,CAACwB,WAAW,GAAG,QAAQ;AAE7B,eAAexB,MAAM"
|
|
1
|
+
{"version":3,"file":"Picker.js","names":["Picker","SpectrumPicker","cl","React","useMergeRef","usePickerProps","jsx","_jsx","forwardRef","_ref","ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerProps","defaultSelectedKey","disabledKeys","selectedKey","scrollRef","pickerProps","_excluded2","pickerRef","_objectSpread","displayName"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import {\n Picker as SpectrumPicker,\n type SpectrumPickerProps,\n} from '@adobe/react-spectrum';\nimport type { DOMRef } from '@react-types/shared';\nimport cl from 'classnames';\nimport React from 'react';\nimport { useMergeRef } from '@deephaven/react-hooks';\nimport type { NormalizedItem } from '../utils';\nimport type { PickerProps } from './PickerProps';\nimport { usePickerProps } from './usePickerProps';\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `children` prop. Each item can be a string,\tnumber, boolean,\n * or a Spectrum <Item> element. The remaining props are just\tpass through props\n * for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport const Picker = React.forwardRef(function Picker(\n { UNSAFE_className, ...props }: PickerProps,\n ref: DOMRef<HTMLDivElement>\n): JSX.Element {\n const {\n defaultSelectedKey,\n disabledKeys,\n selectedKey,\n ref: scrollRef,\n ...pickerProps\n } = usePickerProps(props);\n const pickerRef = useMergeRef(ref, scrollRef);\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n ref={pickerRef}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n // Type assertions are necessary here since Spectrum types don't account\n // for number and boolean key values even though they are valid runtime\n // values.\n defaultSelectedKey={\n defaultSelectedKey as SpectrumPickerProps<NormalizedItem>['defaultSelectedKey']\n }\n disabledKeys={\n disabledKeys as SpectrumPickerProps<NormalizedItem>['disabledKeys']\n }\n selectedKey={\n selectedKey as SpectrumPickerProps<NormalizedItem>['selectedKey']\n }\n />\n );\n});\nPicker.displayName = 'Picker';\n\nexport default Picker;\n"],"mappings":";;;;;;;;;AAAA,SACEA,MAAM,IAAIC,cAAc,QAEnB,uBAAuB;AAE9B,OAAOC,EAAE,MAAM,YAAY;AAC3B,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,wBAAwB;AAAC,SAG5CC,cAAc;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,OAAO,IAAMP,MAAM,gBAAGG,KAAK,CAACK,UAAU,CAAC,SAASR,MAAMA,CAAAS,IAAA,EAEpDC,GAA2B,EACd;EAAA,IAFb;MAAEC;IAAwC,CAAC,GAAAF,IAAA;IAApBG,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAG5B,IAAAC,eAAA,GAMIV,cAAc,CAACO,KAAK,CAAC;IANnB;MACJI,kBAAkB;MAClBC,YAAY;MACZC,WAAW;MACXR,GAAG,EAAES;IAEP,CAAC,GAAAJ,eAAA;IADIK,WAAW,GAAAP,wBAAA,CAAAE,eAAA,EAAAM,UAAA;EAEhB,IAAMC,SAAS,GAAGlB,WAAW,CAACM,GAAG,EAAES,SAAS,CAAC;EAC7C,oBACEZ,IAAA,CAACN;EACC;EAAA,EAAAsB,aAAA,CAAAA,aAAA,KACIH,WAAW;IACfV,GAAG,EAAEY,SAAU;IACfX,gBAAgB,EAAET,EAAE,CAAC,WAAW,EAAES,gBAAgB;IAClD;IACA;IACA;IAAA;IACAK,kBAAkB,EAChBA,kBACD;IACDC,YAAY,EACVA,YACD;IACDC,WAAW,EACTA;EACD,EACF,CAAC;AAEN,CAAC,CAAC;AACFlB,MAAM,CAACwB,WAAW,GAAG,QAAQ;AAE7B,eAAexB,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerNormalized.js","names":["Picker","SpectrumPicker","cl","usePickerNormalizedProps","createElement","_createElement","PickerNormalized","_ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerNormalizedP","forceRerenderKey","pickerProps","_excluded2","_objectSpread","key"],"sources":["../../../src/spectrum/picker/PickerNormalized.tsx"],"sourcesContent":["import { Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport cl from 'classnames';\nimport type { PickerNormalizedProps } from './PickerProps';\n\nimport usePickerNormalizedProps from './usePickerNormalizedProps';\n\n/**\n * Picker that takes an array of `NormalizedItem` or `NormalizedSection` items\n * as children and uses a render item function to render the items. This is\n * necessary to support windowed data.\n */\nexport function PickerNormalized({\n UNSAFE_className,\n ...props\n}: PickerNormalizedProps): JSX.Element {\n const { forceRerenderKey, ...pickerProps } = usePickerNormalizedProps<\n PickerNormalizedProps,\n HTMLDivElement\n >(props);\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n key={forceRerenderKey}\n UNSAFE_className={cl(\n 'dh-picker',\n 'dh-picker-normalized',\n UNSAFE_className\n )}\n />\n );\n}\n\nexport default PickerNormalized;\n"],"mappings":";;;;;;;;;AAAA,SAASA,MAAM,IAAIC,cAAc,QAAQ,uBAAuB;AAChE,OAAOC,EAAE,MAAM,YAAY;AAAC,OAGrBC,wBAAwB;AAE/B;AACA;AACA;AACA;AACA;AAJA,SAAAC,aAAA,IAAAC,cAAA;AAKA,OAAO,SAASC,gBAAgBA,CAAAC,IAAA,EAGO;EAAA,IAHN;MAC/BC;IAEqB,CAAC,GAAAD,IAAA;IADnBE,KAAK,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAER,IAAAC,qBAAA,GAA6CT,wBAAwB,CAGnEM,KAAK,CAAC;IAHF;MAAEI;IAAiC,CAAC,GAAAD,qBAAA;IAAbE,WAAW,GAAAJ,wBAAA,CAAAE,qBAAA,EAAAG,UAAA;EAKxC,oBACEV,cAAA,CAACJ;EACC;EAAA,EAAAe,aAAA,CAAAA,aAAA,KACIF,WAAW;IACfG,GAAG,EAAEJ,gBAAiB;IACtBL,gBAAgB,EAAEN,EAAE,CAClB,WAAW,EACX,sBAAsB,EACtBM,gBACF;EAAE,EACH,CAAC;AAEN;AAEA,eAAeF,gBAAgB"
|
|
1
|
+
{"version":3,"file":"PickerNormalized.js","names":["Picker","SpectrumPicker","cl","usePickerNormalizedProps","createElement","_createElement","PickerNormalized","_ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerNormalizedP","forceRerenderKey","pickerProps","_excluded2","_objectSpread","key"],"sources":["../../../src/spectrum/picker/PickerNormalized.tsx"],"sourcesContent":["import { Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport cl from 'classnames';\nimport type { PickerNormalizedProps } from './PickerProps';\n\nimport usePickerNormalizedProps from './usePickerNormalizedProps';\n\n/**\n * Picker that takes an array of `NormalizedItem` or `NormalizedSection` items\n * as children and uses a render item function to render the items. This is\n * necessary to support windowed data.\n */\nexport function PickerNormalized({\n UNSAFE_className,\n ...props\n}: PickerNormalizedProps): JSX.Element {\n const { forceRerenderKey, ...pickerProps } = usePickerNormalizedProps<\n PickerNormalizedProps,\n HTMLDivElement\n >(props);\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n key={forceRerenderKey}\n UNSAFE_className={cl(\n 'dh-picker',\n 'dh-picker-normalized',\n UNSAFE_className\n )}\n />\n );\n}\n\nexport default PickerNormalized;\n"],"mappings":";;;;;;;;;AAAA,SAASA,MAAM,IAAIC,cAAc,QAAQ,uBAAuB;AAChE,OAAOC,EAAE,MAAM,YAAY;AAAC,OAGrBC,wBAAwB;AAE/B;AACA;AACA;AACA;AACA;AAJA,SAAAC,aAAA,IAAAC,cAAA;AAKA,OAAO,SAASC,gBAAgBA,CAAAC,IAAA,EAGO;EAAA,IAHN;MAC/BC;IAEqB,CAAC,GAAAD,IAAA;IADnBE,KAAK,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAER,IAAAC,qBAAA,GAA6CT,wBAAwB,CAGnEM,KAAK,CAAC;IAHF;MAAEI;IAAiC,CAAC,GAAAD,qBAAA;IAAbE,WAAW,GAAAJ,wBAAA,CAAAE,qBAAA,EAAAG,UAAA;EAKxC,oBACEV,cAAA,CAACJ;EACC;EAAA,EAAAe,aAAA,CAAAA,aAAA,KACIF,WAAW;IACfG,GAAG,EAAEJ,gBAAiB;IACtBL,gBAAgB,EAAEN,EAAE,CAClB,WAAW,EACX,sBAAsB,EACtBM,gBACF;EAAE,EACH,CAAC;AAEN;AAEA,eAAeF,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerProps.js","names":[],"sources":["../../../src/spectrum/picker/PickerProps.ts"],"sourcesContent":["import type { SpectrumPickerProps } from '@adobe/react-spectrum';\nimport type {\n ItemKey,\n ItemOrSection,\n NormalizedItem,\n NormalizedSection,\n TooltipOptions,\n} from '../utils';\n\n/**\n * Extend Spectrum Picker props (also other components that adhere to the same\n * apis such as ComboBox).\n * - `children` is extended to include primitive types and to exclude render function\n * - `items` and `defaultItems` are excluded since we are not currently supporting\n * render functions as `children`\n * - selection key types are extended to include number + boolean primitive types\n * - remaining props from the original type are passed through\n */\nexport type PickerPropsT<TProps> = Omit<\n TProps,\n // These props are all re-defined below\n | 'children'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'disabledKeys'\n // Excluding `defaultItems` and `items` since we are not currently supporting\n // a render function as `children`. This simplifies the API for determining\n // initial scroll position and wrapping items with tooltips.\n | 'defaultItems'\n | 'items'\n> & {\n children: ItemOrSection | ItemOrSection[];\n\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n\n /** The currently selected key in the collection (controlled). */\n selectedKey?: ItemKey | null;\n\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: ItemKey;\n\n /**\n * The item keys that are disabled. These items cannot be selected, focused,\n * or otherwise interacted with.\n */\n disabledKeys?: Iterable<ItemKey>;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (key: ItemKey | null) => void;\n\n /**\n * Method that is called when the open state of the menu changes.\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /** Handler that is called when the picker is scrolled. */\n onScroll?: (event: Event) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (key: ItemKey | null) => void;\n};\n\n/**\n * Extend Picker props for usage with normalized items list instead of React\n * `children` elements.\n */\nexport type PickerNormalizedPropsT<TProps> = Omit<\n PickerPropsT<TProps>,\n 'children'\n> & {\n /**\n * Normalized format for items and sections instead React elements.\n */\n normalizedItems: (NormalizedItem | NormalizedSection)[];\n\n /**\n * Whether to show icons in items.\n */\n showItemIcons: boolean;\n\n /**\n * Get the initial scroll position to use when picker is opened.\n */\n getInitialScrollPosition?: () => Promise<number | null | undefined>;\n};\n\nexport type PickerProps = PickerPropsT<SpectrumPickerProps<NormalizedItem>>;\nexport type PickerNormalizedProps = PickerNormalizedPropsT<PickerProps>;\n"],"mappings":""
|
|
1
|
+
{"version":3,"file":"PickerProps.js","names":[],"sources":["../../../src/spectrum/picker/PickerProps.ts"],"sourcesContent":["import type { SpectrumPickerProps } from '@adobe/react-spectrum';\nimport type {\n ItemKey,\n ItemOrSection,\n NormalizedItem,\n NormalizedSection,\n TooltipOptions,\n} from '../utils';\n\n/**\n * Extend Spectrum Picker props (also other components that adhere to the same\n * apis such as ComboBox).\n * - `children` is extended to include primitive types and to exclude render function\n * - `items` and `defaultItems` are excluded since we are not currently supporting\n * render functions as `children`\n * - selection key types are extended to include number + boolean primitive types\n * - remaining props from the original type are passed through\n */\nexport type PickerPropsT<TProps> = Omit<\n TProps,\n // These props are all re-defined below\n | 'children'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'disabledKeys'\n // Excluding `defaultItems` and `items` since we are not currently supporting\n // a render function as `children`. This simplifies the API for determining\n // initial scroll position and wrapping items with tooltips.\n | 'defaultItems'\n | 'items'\n> & {\n children: ItemOrSection | ItemOrSection[];\n\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n\n /** The currently selected key in the collection (controlled). */\n selectedKey?: ItemKey | null;\n\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: ItemKey;\n\n /**\n * The item keys that are disabled. These items cannot be selected, focused,\n * or otherwise interacted with.\n */\n disabledKeys?: Iterable<ItemKey>;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (key: ItemKey | null) => void;\n\n /**\n * Method that is called when the open state of the menu changes.\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /** Handler that is called when the picker is scrolled. */\n onScroll?: (event: Event) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (key: ItemKey | null) => void;\n};\n\n/**\n * Extend Picker props for usage with normalized items list instead of React\n * `children` elements.\n */\nexport type PickerNormalizedPropsT<TProps> = Omit<\n PickerPropsT<TProps>,\n 'children'\n> & {\n /**\n * Normalized format for items and sections instead React elements.\n */\n normalizedItems: (NormalizedItem | NormalizedSection)[];\n\n /**\n * Whether to show icons in items.\n */\n showItemIcons: boolean;\n\n /**\n * Get the initial scroll position to use when picker is opened.\n */\n getInitialScrollPosition?: () => Promise<number | null | undefined>;\n};\n\nexport type PickerProps = PickerPropsT<SpectrumPickerProps<NormalizedItem>>;\nexport type PickerNormalizedProps = PickerNormalizedPropsT<PickerProps>;\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/picker/index.ts"],"sourcesContent":["export * from './Picker';\nexport * from './PickerNormalized';\nexport * from './PickerProps';\nexport * from './usePickerItemScale';\nexport * from './usePickerNormalizedProps';\nexport * from './usePickerProps';\nexport * from './usePickerScrollOnOpen';\n"],"mappings":""
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/picker/index.ts"],"sourcesContent":["export * from './Picker';\nexport * from './PickerNormalized';\nexport * from './PickerProps';\nexport * from './usePickerItemScale';\nexport * from './usePickerNormalizedProps';\nexport * from './usePickerProps';\nexport * from './usePickerScrollOnOpen';\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePickerItemScale.js","names":["useSpectrumThemeProvider","PICKER_ITEM_HEIGHTS","usePickerItemScale","scale","itemHeight"],"sources":["../../../src/spectrum/picker/usePickerItemScale.ts"],"sourcesContent":["import { useSpectrumThemeProvider } from '../../theme';\nimport { PICKER_ITEM_HEIGHTS } from '../../UIConstants';\n\n/**\n * Get Picker Item height for current scale.\n * @returns Picker Item height\n */\nexport function usePickerItemScale(): { itemHeight: number } {\n const { scale } = useSpectrumThemeProvider();\n const itemHeight = PICKER_ITEM_HEIGHTS[scale];\n\n return { itemHeight };\n}\n\nexport default usePickerItemScale;\n"],"mappings":"SAASA,wBAAwB;AAAA,SACxBC,mBAAmB;AAE5B;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAA2B;EAC3D,IAAM;IAAEC;EAAM,CAAC,GAAGH,wBAAwB,CAAC,CAAC;EAC5C,IAAMI,UAAU,GAAGH,mBAAmB,CAACE,KAAK,CAAC;EAE7C,OAAO;IAAEC;EAAW,CAAC;AACvB;AAEA,eAAeF,kBAAkB"
|
|
1
|
+
{"version":3,"file":"usePickerItemScale.js","names":["useSpectrumThemeProvider","PICKER_ITEM_HEIGHTS","usePickerItemScale","scale","itemHeight"],"sources":["../../../src/spectrum/picker/usePickerItemScale.ts"],"sourcesContent":["import { useSpectrumThemeProvider } from '../../theme';\nimport { PICKER_ITEM_HEIGHTS } from '../../UIConstants';\n\n/**\n * Get Picker Item height for current scale.\n * @returns Picker Item height\n */\nexport function usePickerItemScale(): { itemHeight: number } {\n const { scale } = useSpectrumThemeProvider();\n const itemHeight = PICKER_ITEM_HEIGHTS[scale];\n\n return { itemHeight };\n}\n\nexport default usePickerItemScale;\n"],"mappings":"SAASA,wBAAwB;AAAA,SACxBC,mBAAmB;AAE5B;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAA2B;EAC3D,IAAM;IAAEC;EAAM,CAAC,GAAGH,wBAAwB,CAAC,CAAC;EAC5C,IAAMI,UAAU,GAAGH,mBAAmB,CAACE,KAAK,CAAC;EAE7C,OAAO;IAAEC;EAAW,CAAC;AACvB;AAEA,eAAeF,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePickerNormalizedProps.js","names":["useCallback","useMemo","EMPTY_FUNCTION","getItemKey","isNormalizedSection","normalizeTooltipOptions","useRenderNormalizedItem","useStringifiedSelection","usePickerScrollOnOpen","Section","jsx","_jsx","usePickerNormalizedProps","_ref","defaultSelectedKey","disabledKeys","getInitialScrollPosition","normalizedItems","onChange","onOpenChange","onScroll","onSelectionChange","selectedKey","showItemIcons","tooltip","props","_objectWithoutProperties","_excluded","tooltipOptions","renderNormalizedItem","itemIconSlot","showItemDescriptions","forceRerenderKey","concat","placement","ref","onOpenChangeInternal","selectedStringKey","defaultSelectedStringKey","disabledStringKeys","onStringSelectionChange","children","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title","item","items","_objectSpread"],"sources":["../../../src/spectrum/picker/usePickerNormalizedProps.tsx"],"sourcesContent":["import { type Key, useCallback, useMemo } from 'react';\nimport { EMPTY_FUNCTION } from '@deephaven/utils';\nimport type { DOMRef } from '@react-types/shared';\nimport {\n getItemKey,\n isNormalizedSection,\n type NormalizedItem,\n type NormalizedSection,\n normalizeTooltipOptions,\n useRenderNormalizedItem,\n useStringifiedSelection,\n} from '../utils';\nimport { type PickerNormalizedPropsT } from './PickerProps';\nimport { usePickerScrollOnOpen } from './usePickerScrollOnOpen';\nimport { Section } from '../shared';\n\n/** Props that are derived by `usePickerNormalizedProps` */\nexport type UsePickerNormalizedDerivedProps<THtml extends HTMLElement> = {\n children: (itemOrSection: NormalizedItem | NormalizedSection) => JSX.Element;\n forceRerenderKey: Key;\n items: (NormalizedItem | NormalizedSection)[];\n defaultSelectedKey?: Key;\n disabledKeys?: Iterable<Key>;\n ref: DOMRef<THtml>;\n selectedKey?: Key | null;\n onSelectionChange: (key: Key | null) => void;\n onOpenChange: (isOpen: boolean) => void;\n};\n\n/**\n * Props that are passed through untouched. (should exclude all of the\n * destructured props passed into `usePickerNormalizedProps` that are not in the\n * spread ...props)\n */\nexport type UsePickerNormalizedPassthroughProps<TProps> = Omit<\n PickerNormalizedPropsT<TProps>,\n | 'defaultSelectedKey'\n | 'disabledKeys'\n | 'getInitialScrollPosition'\n | 'normalizedItems'\n | 'onChange'\n | 'onOpenChange'\n | 'onScroll'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'showItemIcons'\n | 'tooltip'\n>;\n\n/** Props returned from `usePickerNormalizedProps` hook. */\nexport type UsePickerNormalizedProps<\n TProps,\n THtml extends HTMLElement,\n> = UsePickerNormalizedDerivedProps<THtml> &\n UsePickerNormalizedPassthroughProps<TProps>;\n\nexport function usePickerNormalizedProps<\n TProps,\n THtml extends HTMLElement = HTMLElement,\n>({\n defaultSelectedKey,\n disabledKeys,\n getInitialScrollPosition,\n normalizedItems,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n selectedKey,\n showItemIcons,\n tooltip = true,\n ...props\n}: PickerNormalizedPropsT<TProps>): UsePickerNormalizedProps<TProps, THtml> {\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem({\n itemIconSlot: 'icon',\n // Descriptions introduce variable item heights which throws off calculation\n // of initial scroll position and setting viewport on windowed data. For now\n // not going to implement description support in Picker.\n // https://github.com/deephaven/web-client-ui/issues/1958\n showItemDescriptions: false,\n showItemIcons,\n tooltipOptions,\n });\n\n // Spectrum doesn't re-render if only the `renderNormalizedItems` function\n // changes, so we create a key from its dependencies that can be used to force\n // re-render.\n const forceRerenderKey = `${showItemIcons}-${tooltipOptions?.placement}`;\n\n const { ref, onOpenChange: onOpenChangeInternal } =\n usePickerScrollOnOpen<THtml>({\n getInitialScrollPosition,\n onScroll,\n onOpenChange,\n });\n\n // Spectrum Picker treats keys as strings if the `key` prop is explicitly\n // set on `Item` elements. Since we do this in `renderItem`, we need to\n // map original key types to and from strings so that selection works.\n const {\n selectedStringKey,\n defaultSelectedStringKey,\n disabledStringKeys,\n onStringSelectionChange,\n } = useStringifiedSelection({\n normalizedItems,\n selectedKey,\n defaultSelectedKey,\n disabledKeys,\n onChange: onChange ?? onSelectionChange,\n });\n\n const children = useCallback(\n (itemOrSection: NormalizedItem | NormalizedSection) => {\n if (isNormalizedSection(itemOrSection)) {\n return (\n <Section\n key={getItemKey(itemOrSection)}\n title={itemOrSection.item?.title}\n items={itemOrSection.item?.items}\n >\n {renderNormalizedItem}\n </Section>\n );\n }\n\n return renderNormalizedItem(itemOrSection);\n },\n [renderNormalizedItem]\n );\n\n return {\n ...props,\n children,\n forceRerenderKey,\n ref,\n items: normalizedItems,\n selectedKey: selectedStringKey,\n defaultSelectedKey: defaultSelectedStringKey,\n disabledKeys: disabledStringKeys,\n onSelectionChange: onStringSelectionChange,\n onOpenChange: onOpenChangeInternal,\n };\n}\n\nexport default usePickerNormalizedProps;\n"],"mappings":";;;;;;;;AAAA,SAAmBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACtD,SAASC,cAAc,QAAQ,kBAAkB;AAAC,SAGhDC,UAAU,EACVC,mBAAmB,EAGnBC,uBAAuB,EACvBC,uBAAuB,EACvBC,uBAAuB;AAAA,SAGhBC,qBAAqB;AAAA,SACrBC,OAAO;AAEhB;AAaA;AACA;AACA;AACA;AACA;AAgBA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAOA,OAAO,SAASC,wBAAwBA,CAAAC,IAAA,EAgBoC;EAAA,IAb1E;MACAC,kBAAkB;MAClBC,YAAY;MACZC,wBAAwB;MACxBC,eAAe;MACfC,QAAQ;MACRC,YAAY;MACZC,QAAQ,GAAGlB,cAAc;MACzBmB,iBAAiB;MACjBC,WAAW;MACXC,aAAa;MACbC,OAAO,GAAG;IAEoB,CAAC,GAAAX,IAAA;IAD5BY,KAAK,GAAAC,wBAAA,CAAAb,IAAA,EAAAc,SAAA;EAER,IAAMC,cAAc,GAAG3B,OAAO,CAC5B,MA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AC5C,CAAC,EACD,CAACb,oBAAoB,CACvB,CAAC;EAED,OAAAmB,aAAA,CAAAA,aAAA,KACKvB,KAAK;IACRgB,QAAQ;IACRT,gBAAgB;IAChBG,GAAG;IACHY,KAAK,EAAE9B,eAAe;IACtBK,WAAW,EAAEe,iBAAiB;IAC9BvB,kBAAkB,EAAEwB,wBAAwB;IAC5CvB,YAAY,EAAEwB,kBAAkB;IAChClB,iBAAiB,EAAEmB,uBAAuB;IAC1CrB,YAAY,EAAEiB;EAAoB;AAEtC;AAEA,eAAexB,wBAAwB"
|
|
1
|
+
{"version":3,"file":"usePickerNormalizedProps.js","names":["useCallback","useMemo","EMPTY_FUNCTION","getItemKey","isNormalizedSection","normalizeTooltipOptions","useRenderNormalizedItem","useStringifiedSelection","usePickerScrollOnOpen","Section","jsx","_jsx","usePickerNormalizedProps","_ref","defaultSelectedKey","disabledKeys","getInitialScrollPosition","normalizedItems","onChange","onOpenChange","onScroll","onSelectionChange","selectedKey","showItemIcons","tooltip","props","_objectWithoutProperties","_excluded","tooltipOptions","renderNormalizedItem","itemIconSlot","showItemDescriptions","forceRerenderKey","concat","placement","ref","onOpenChangeInternal","selectedStringKey","defaultSelectedStringKey","disabledStringKeys","onStringSelectionChange","children","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title","item","items","_objectSpread"],"sources":["../../../src/spectrum/picker/usePickerNormalizedProps.tsx"],"sourcesContent":["import { type Key, useCallback, useMemo } from 'react';\nimport { EMPTY_FUNCTION } from '@deephaven/utils';\nimport type { DOMRef } from '@react-types/shared';\nimport {\n getItemKey,\n isNormalizedSection,\n type NormalizedItem,\n type NormalizedSection,\n normalizeTooltipOptions,\n useRenderNormalizedItem,\n useStringifiedSelection,\n} from '../utils';\nimport { type PickerNormalizedPropsT } from './PickerProps';\nimport { usePickerScrollOnOpen } from './usePickerScrollOnOpen';\nimport { Section } from '../shared';\n\n/** Props that are derived by `usePickerNormalizedProps` */\nexport type UsePickerNormalizedDerivedProps<THtml extends HTMLElement> = {\n children: (itemOrSection: NormalizedItem | NormalizedSection) => JSX.Element;\n forceRerenderKey: Key;\n items: (NormalizedItem | NormalizedSection)[];\n defaultSelectedKey?: Key;\n disabledKeys?: Iterable<Key>;\n ref: DOMRef<THtml>;\n selectedKey?: Key | null;\n onSelectionChange: (key: Key | null) => void;\n onOpenChange: (isOpen: boolean) => void;\n};\n\n/**\n * Props that are passed through untouched. (should exclude all of the\n * destructured props passed into `usePickerNormalizedProps` that are not in the\n * spread ...props)\n */\nexport type UsePickerNormalizedPassthroughProps<TProps> = Omit<\n PickerNormalizedPropsT<TProps>,\n | 'defaultSelectedKey'\n | 'disabledKeys'\n | 'getInitialScrollPosition'\n | 'normalizedItems'\n | 'onChange'\n | 'onOpenChange'\n | 'onScroll'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'showItemIcons'\n | 'tooltip'\n>;\n\n/** Props returned from `usePickerNormalizedProps` hook. */\nexport type UsePickerNormalizedProps<\n TProps,\n THtml extends HTMLElement,\n> = UsePickerNormalizedDerivedProps<THtml> &\n UsePickerNormalizedPassthroughProps<TProps>;\n\nexport function usePickerNormalizedProps<\n TProps,\n THtml extends HTMLElement = HTMLElement,\n>({\n defaultSelectedKey,\n disabledKeys,\n getInitialScrollPosition,\n normalizedItems,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n selectedKey,\n showItemIcons,\n tooltip = true,\n ...props\n}: PickerNormalizedPropsT<TProps>): UsePickerNormalizedProps<TProps, THtml> {\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem({\n itemIconSlot: 'icon',\n // Descriptions introduce variable item heights which throws off calculation\n // of initial scroll position and setting viewport on windowed data. For now\n // not going to implement description support in Picker.\n // https://github.com/deephaven/web-client-ui/issues/1958\n showItemDescriptions: false,\n showItemIcons,\n tooltipOptions,\n });\n\n // Spectrum doesn't re-render if only the `renderNormalizedItems` function\n // changes, so we create a key from its dependencies that can be used to force\n // re-render.\n const forceRerenderKey = `${showItemIcons}-${tooltipOptions?.placement}`;\n\n const { ref, onOpenChange: onOpenChangeInternal } =\n usePickerScrollOnOpen<THtml>({\n getInitialScrollPosition,\n onScroll,\n onOpenChange,\n });\n\n // Spectrum Picker treats keys as strings if the `key` prop is explicitly\n // set on `Item` elements. Since we do this in `renderItem`, we need to\n // map original key types to and from strings so that selection works.\n const {\n selectedStringKey,\n defaultSelectedStringKey,\n disabledStringKeys,\n onStringSelectionChange,\n } = useStringifiedSelection({\n normalizedItems,\n selectedKey,\n defaultSelectedKey,\n disabledKeys,\n onChange: onChange ?? onSelectionChange,\n });\n\n const children = useCallback(\n (itemOrSection: NormalizedItem | NormalizedSection) => {\n if (isNormalizedSection(itemOrSection)) {\n return (\n <Section\n key={getItemKey(itemOrSection)}\n title={itemOrSection.item?.title}\n items={itemOrSection.item?.items}\n >\n {renderNormalizedItem}\n </Section>\n );\n }\n\n return renderNormalizedItem(itemOrSection);\n },\n [renderNormalizedItem]\n );\n\n return {\n ...props,\n children,\n forceRerenderKey,\n ref,\n items: normalizedItems,\n selectedKey: selectedStringKey,\n defaultSelectedKey: defaultSelectedStringKey,\n disabledKeys: disabledStringKeys,\n onSelectionChange: onStringSelectionChange,\n onOpenChange: onOpenChangeInternal,\n };\n}\n\nexport default usePickerNormalizedProps;\n"],"mappings":";;;;;;;;AAAA,SAAmBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACtD,SAASC,cAAc,QAAQ,kBAAkB;AAAC,SAGhDC,UAAU,EACVC,mBAAmB,EAGnBC,uBAAuB,EACvBC,uBAAuB,EACvBC,uBAAuB;AAAA,SAGhBC,qBAAqB;AAAA,SACrBC,OAAO;AAEhB;AAaA;AACA;AACA;AACA;AACA;AAgBA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAOA,OAAO,SAASC,wBAAwBA,CAAAC,IAAA,EAgBoC;EAAA,IAb1E;MACAC,kBAAkB;MAClBC,YAA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AI,cAAAH,mBAAA,uBAAlBA,mBAAA,CAAoBE,KAAM;QACjCE,KAAK,GAAAH,oBAAA,GAAEF,aAAa,CAACI,IAAI,cAAAF,oBAAA,uBAAlBA,oBAAA,CAAoBG,KAAM;QAAAN,QAAA,EAEhCZ;MAAoB,GAJhB1B,UAAU,CAACuC,aAAa,CAKtB,CAAC;IAEd;IAEA,OAAOb,oBAAoB,CAACa,aAAa,CAAC;EAC5C,CAAC,EACD,CAACb,oBAAoB,CACvB,CAAC;EAED,OAAAmB,aAAA,CAAAA,aAAA,KACKvB,KAAK;IACRgB,QAAQ;IACRT,gBAAgB;IAChBG,GAAG;IACHY,KAAK,EAAE9B,eAAe;IACtBK,WAAW,EAAEe,iBAAiB;IAC9BvB,kBAAkB,EAAEwB,wBAAwB;IAC5CvB,YAAY,EAAEwB,kBAAkB;IAChClB,iBAAiB,EAAEmB,uBAAuB;IAC1CrB,YAAY,EAAEiB;EAAoB;AAEtC;AAEA,eAAexB,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePickerProps.js","names":["EMPTY_FUNCTION","ensureArray","useMemo","PICKER_TOP_OFFSET","normalizeTooltipOptions","wrapItemChildren","useOnChangeTrackUncontrolled","useStaticItemInitialScrollPosition","usePickerItemScale","usePickerScrollOnOpen","usePickerProps","_ref","children","defaultSelectedKey","selectedKey","tooltip","onChange","onChangeHandler","onOpenChange","onOpenChangeHandler","onScroll","onSelectionChange","onSelectionChangeHandler","props","_objectWithoutProperties","_excluded","itemHeight","tooltipOptions","items","selectedKeyMaybeUncontrolled","onChangeMaybeUncontrolled","getInitialScrollPosition","topOffset","ref","_objectSpread"],"sources":["../../../src/spectrum/picker/usePickerProps.ts"],"sourcesContent":["import { EMPTY_FUNCTION, ensureArray } from '@deephaven/utils';\nimport { type DOMRef } from '@react-types/shared';\nimport { useMemo } from 'react';\nimport { PICKER_TOP_OFFSET } from '../../UIConstants';\nimport {\n normalizeTooltipOptions,\n wrapItemChildren,\n useOnChangeTrackUncontrolled,\n useStaticItemInitialScrollPosition,\n type ItemKey,\n type SectionElement,\n type ItemElement,\n} from '../utils';\nimport type { PickerPropsT } from './PickerProps';\nimport usePickerItemScale from './usePickerItemScale';\nimport usePickerScrollOnOpen from './usePickerScrollOnOpen';\n\n/** Props that are derived by `usePickerProps`. */\nexport type UsePickerDerivedProps<THtml extends HTMLElement> = {\n children: (SectionElement<unknown> | ItemElement<unknown>)[];\n defaultSelectedKey?: ItemKey | undefined;\n ref: DOMRef<THtml>;\n selectedKey?: ItemKey | null | undefined;\n onOpenChange: (isOpen: boolean) => void;\n onSelectionChange: ((key: ItemKey | null) => void) | undefined;\n};\n\n/** \n * Props that are passed through untouched. (should exclude all of the\n * destructured props passed into `usePickerProps` that are not in the spread\n * ...props)\n) */\nexport type UsePickerPassthroughProps<TProps> = Omit<\n PickerPropsT<TProps>,\n | 'children'\n | 'defaultSelectedKey'\n | 'selectedKey'\n | 'tooltip'\n | 'onChange'\n | 'onOpenChange'\n | 'onScroll'\n | 'onSelectionChange'\n>;\n\n/** Props returned from `usePickerProps` hook. */\nexport type UsePickerProps<\n TProps,\n THtml extends HTMLElement,\n> = UsePickerDerivedProps<THtml> & UsePickerPassthroughProps<TProps>;\n\n/**\n * Derive props for Picker components (e.g. Picker and ComboBox). Specifically\n * handles wrapping children items and initial scroll position when the picker\n * is opened.\n */\nexport function usePickerProps<\n TProps,\n THtml extends HTMLElement = HTMLElement,\n>({\n children,\n defaultSelectedKey,\n selectedKey,\n tooltip = true,\n onChange: onChangeHandler,\n onOpenChange: onOpenChangeHandler,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange: onSelectionChangeHandler,\n ...props\n}: PickerPropsT<TProps>): UsePickerProps<TProps, THtml> {\n const { itemHeight } = usePickerItemScale();\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const items = useMemo(\n () => ensureArray(wrapItemChildren(children, tooltipOptions)),\n [children, tooltipOptions]\n );\n\n const { selectedKeyMaybeUncontrolled, onChangeMaybeUncontrolled } =\n useOnChangeTrackUncontrolled({\n defaultSelectedKey,\n selectedKey,\n onChange: onChangeHandler ?? onSelectionChangeHandler,\n });\n\n const getInitialScrollPosition = useStaticItemInitialScrollPosition({\n itemHeight,\n items,\n selectedKey: selectedKeyMaybeUncontrolled,\n topOffset: PICKER_TOP_OFFSET,\n });\n\n const { ref, onOpenChange } = usePickerScrollOnOpen<THtml>({\n getInitialScrollPosition,\n onScroll,\n onOpenChange: onOpenChangeHandler,\n });\n\n return {\n ...props,\n defaultSelectedKey,\n ref,\n selectedKey,\n children: items,\n onOpenChange,\n onSelectionChange: onChangeMaybeUncontrolled,\n };\n}\n\nexport default usePickerProps;\n"],"mappings":";;;;;;;;AAAA,SAASA,cAAc,EAAEC,WAAW,QAAQ,kBAAkB;AAE9D,SAASC,OAAO,QAAQ,OAAO;AAAC,SACvBC,iBAAiB;AAAA,SAExBC,uBAAuB,EACvBC,gBAAgB,EAChBC,4BAA4B,EAC5BC,kCAAkC;AAAA,OAM7BC,kBAAkB;AAAA,OAClBC,qBAAqB;AAE5B;AAUA;AACA;AACA;AACA;AACA;AAaA;AAMA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAAC,IAAA,EAa0B;EAAA,IAVtD;MACAC,QAAQ;MACRC,kBAAkB;MAClBC,WAAW;MACXC,OAAO,GAAG,IAAI;MACdC,QAAQ,EAAEC,eAAe;MACzBC,YAAY,EAAEC,mBAAmB;MACjCC,QAAQ,GAAGpB,cAAc;MACzBqB,iBAAiB,EAAEC;IAEC,CAAC,GAAAX,IAAA;IADlBY,KAAK,GAAAC,wBAAA,CAAAb,IAAA,EAAAc,SAAA;EAER,IAAM;IAAEC;EAAW,CAAC,GAAGlB,kBAAkB,CAAC,CAAC;EAE3C,IAAMmB,cAAc,GAAGzB,OAAO,CAC5B,MAAME,uBAAuB,CAACW,OAAO,CAAC,EACtC,CAACA,OAAO,CACV,CAAC;EAED,IAAMa,KAAK,GAAG1B,OAAO,CACnB,MAAMD,WAAW,CAACI,gBAAgB,CAACO,QAAQ,EAAEe,cAAc,CAAC,CAAC,EAC7D,CAACf,QAAQ,EAAEe,cAAc,CAC3B,CAAC;EAED,IAAM;IAAEE,4BAA4B;IAAEC;EAA0B,CAAC,GAC/DxB,4BAA4B,CAAC;IAC3BO,kBAAkB;IAClBC,WAAW;IACXE,QAAQ,EAAEC,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAIK;EAC/B,CAAC,CAAC;EAEJ,IAAMS,wBAAwB,GAAGxB,kCAAkC,CAAC;IAClEmB,UAAU;IACVE,KAAK;IACLd,WAAW,EAAEe,4BAA4B;IACzCG,SAAS,EAAE7B;EACb,CAAC,CAAC;EAEF,IAAM;IAAE8B,GAAG;IAAEf;EAAa,CAAC,GAAGT,qBAAqB,CAAQ;IACzDsB,wBAAwB;IACxBX,QAAQ;IACRF,YAAY,EAAEC;EAChB,CAAC,CAAC;EAEF,OAAAe,aAAA,CAAAA,aAAA,KACKX,KAAK;IACRV,kBAAkB;IAClBoB,GAAG;IACHnB,WAAW;IACXF,QAAQ,EAAEgB,KAAK;IACfV,YAAY;IACZG,iBAAiB,EAAES;EAAyB;AAEhD;AAEA,eAAepB,cAAc"
|
|
1
|
+
{"version":3,"file":"usePickerProps.js","names":["EMPTY_FUNCTION","ensureArray","useMemo","PICKER_TOP_OFFSET","normalizeTooltipOptions","wrapItemChildren","useOnChangeTrackUncontrolled","useStaticItemInitialScrollPosition","usePickerItemScale","usePickerScrollOnOpen","usePickerProps","_ref","children","defaultSelectedKey","selectedKey","tooltip","onChange","onChangeHandler","onOpenChange","onOpenChangeHandler","onScroll","onSelectionChange","onSelectionChangeHandler","props","_objectWithoutProperties","_excluded","itemHeight","tooltipOptions","items","selectedKeyMaybeUncontrolled","onChangeMaybeUncontrolled","getInitialScrollPosition","topOffset","ref","_objectSpread"],"sources":["../../../src/spectrum/picker/usePickerProps.ts"],"sourcesContent":["import { EMPTY_FUNCTION, ensureArray } from '@deephaven/utils';\nimport { type DOMRef } from '@react-types/shared';\nimport { useMemo } from 'react';\nimport { PICKER_TOP_OFFSET } from '../../UIConstants';\nimport {\n normalizeTooltipOptions,\n wrapItemChildren,\n useOnChangeTrackUncontrolled,\n useStaticItemInitialScrollPosition,\n type ItemKey,\n type SectionElement,\n type ItemElement,\n} from '../utils';\nimport type { PickerPropsT } from './PickerProps';\nimport usePickerItemScale from './usePickerItemScale';\nimport usePickerScrollOnOpen from './usePickerScrollOnOpen';\n\n/** Props that are derived by `usePickerProps`. */\nexport type UsePickerDerivedProps<THtml extends HTMLElement> = {\n children: (SectionElement<unknown> | ItemElement<unknown>)[];\n defaultSelectedKey?: ItemKey | undefined;\n ref: DOMRef<THtml>;\n selectedKey?: ItemKey | null | undefined;\n onOpenChange: (isOpen: boolean) => void;\n onSelectionChange: ((key: ItemKey | null) => void) | undefined;\n};\n\n/** \n * Props that are passed through untouched. (should exclude all of the\n * destructured props passed into `usePickerProps` that are not in the spread\n * ...props)\n) */\nexport type UsePickerPassthroughProps<TProps> = Omit<\n PickerPropsT<TProps>,\n | 'children'\n | 'defaultSelectedKey'\n | 'selectedKey'\n | 'tooltip'\n | 'onChange'\n | 'onOpenChange'\n | 'onScroll'\n | 'onSelectionChange'\n>;\n\n/** Props returned from `usePickerProps` hook. */\nexport type UsePickerProps<\n TProps,\n THtml extends HTMLElement,\n> = UsePickerDerivedProps<THtml> & UsePickerPassthroughProps<TProps>;\n\n/**\n * Derive props for Picker components (e.g. Picker and ComboBox). Specifically\n * handles wrapping children items and initial scroll position when the picker\n * is opened.\n */\nexport function usePickerProps<\n TProps,\n THtml extends HTMLElement = HTMLElement,\n>({\n children,\n defaultSelectedKey,\n selectedKey,\n tooltip = true,\n onChange: onChangeHandler,\n onOpenChange: onOpenChangeHandler,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange: onSelectionChangeHandler,\n ...props\n}: PickerPropsT<TProps>): UsePickerProps<TProps, THtml> {\n const { itemHeight } = usePickerItemScale();\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const items = useMemo(\n () => ensureArray(wrapItemChildren(children, tooltipOptions)),\n [children, tooltipOptions]\n );\n\n const { selectedKeyMaybeUncontrolled, onChangeMaybeUncontrolled } =\n useOnChangeTrackUncontrolled({\n defaultSelectedKey,\n selectedKey,\n onChange: onChangeHandler ?? onSelectionChangeHandler,\n });\n\n const getInitialScrollPosition = useStaticItemInitialScrollPosition({\n itemHeight,\n items,\n selectedKey: selectedKeyMaybeUncontrolled,\n topOffset: PICKER_TOP_OFFSET,\n });\n\n const { ref, onOpenChange } = usePickerScrollOnOpen<THtml>({\n getInitialScrollPosition,\n onScroll,\n onOpenChange: onOpenChangeHandler,\n });\n\n return {\n ...props,\n defaultSelectedKey,\n ref,\n selectedKey,\n children: items,\n onOpenChange,\n onSelectionChange: onChangeMaybeUncontrolled,\n };\n}\n\nexport default usePickerProps;\n"],"mappings":";;;;;;;;AAAA,SAASA,cAAc,EAAEC,WAAW,QAAQ,kBAAkB;AAE9D,SAASC,OAAO,QAAQ,OAAO;AAAC,SACvBC,iBAAiB;AAAA,SAExBC,uBAAuB,EACvBC,gBAAgB,EAChBC,4BAA4B,EAC5BC,kCAAkC;AAAA,OAM7BC,kBAAkB;AAAA,OAClBC,qBAAqB;AAE5B;AAUA;AACA;AACA;AACA;AACA;AAaA;AAMA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAAC,IAAA,EAa0B;EAAA,IAVtD;MACAC,QAAQ;MACRC,kBAAkB;MAClBC,WAAW;MACXC,OAAO,GAAG,IAAI;MACdC,QAAQ,EAAEC,eAAe;MACzBC,YAAY,EAAEC,mBAAmB;MACjCC,QAAQ,GAAGpB,cAAc;MACzBqB,iBAAiB,EAAEC;IAEC,CAAC,GAAAX,IAAA;IADlBY,KAAK,GAAAC,wBAAA,CAAAb,IAAA,EAAAc,SAAA;EAER,IAAM;IAAEC;EAAW,CAAC,GAAGlB,kBAAkB,CAAC,CAAC;EAE3C,IAAMmB,cAAc,GAAGzB,OAAO,CAC5B,MAAME,uBAAuB,CAACW,OAAO,CAAC,EACtC,CAACA,OAAO,CACV,CAAC;EAED,IAAMa,KAAK,GAAG1B,OAAO,CACnB,MAAMD,WAAW,CAACI,gBAAgB,CAACO,QAAQ,EAAEe,cAAc,CAAC,CAAC,EAC7D,CAACf,QAAQ,EAAEe,cAAc,CAC3B,CAAC;EAED,IAAM;IAAEE,4BAA4B;IAAEC;EAA0B,CAAC,GAC/DxB,4BAA4B,CAAC;IAC3BO,kBAAkB;IAClBC,WAAW;IACXE,QAAQ,EAAEC,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAIK;EAC/B,CAAC,CAAC;EAEJ,IAAMS,wBAAwB,GAAGxB,kCAAkC,CAAC;IAClEmB,UAAU;IACVE,KAAK;IACLd,WAAW,EAAEe,4BAA4B;IACzCG,SAAS,EAAE7B;EACb,CAAC,CAAC;EAEF,IAAM;IAAE8B,GAAG;IAAEf;EAAa,CAAC,GAAGT,qBAAqB,CAAQ;IACzDsB,wBAAwB;IACxBX,QAAQ;IACRF,YAAY,EAAEC;EAChB,CAAC,CAAC;EAEF,OAAAe,aAAA,CAAAA,aAAA,KACKX,KAAK;IACRV,kBAAkB;IAClBoB,GAAG;IACHnB,WAAW;IACXF,QAAQ,EAAEgB,KAAK;IACfV,YAAY;IACZG,iBAAiB,EAAES;EAAyB;AAEhD;AAEA,eAAepB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePickerScrollOnOpen.js","names":["useCallback","findSpectrumPickerScrollArea","usePopoverOnScrollRef","usePickerScrollOnOpen","_ref","getInitialScrollPosition","onScroll","onOpenChange","ref","popoverOnOpenChange","onOpenChangeInternal","isOpen","menuTrigger"],"sources":["../../../src/spectrum/picker/usePickerScrollOnOpen.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport type { DOMRef } from '@react-types/shared';\nimport {\n findSpectrumPickerScrollArea,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport type { MenuTriggerAction } from '../comboBox';\n\nexport interface UsePickerScrollOnOpenOptions {\n getInitialScrollPosition?: () => Promise<number | null | undefined>;\n onScroll: (event: Event) => void;\n onOpenChange?: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;\n}\n\nexport interface UsePickerScrollOnOpenResult<THtml extends HTMLElement> {\n ref: DOMRef<THtml>;\n onOpenChange: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;\n}\n\n/**\n * Handle scroll event registration and scrolling to initial scroll position\n * whenever a Picker popover is opened.\n * @param getInitialScrollPosition Function to get the initial scroll position.\n * @param onScroll Callback for scroll events.\n * @param onOpenChange Callback for open change events.\n * @return A ref to attach to the Picker and a callback to handle open change\n * events for the Picker.\n */\nexport function usePickerScrollOnOpen<THtml extends HTMLElement = HTMLElement>({\n getInitialScrollPosition,\n onScroll,\n onOpenChange,\n}: UsePickerScrollOnOpenOptions): UsePickerScrollOnOpenResult<THtml> {\n const { ref, onOpenChange: popoverOnOpenChange } = usePopoverOnScrollRef(\n findSpectrumPickerScrollArea<THtml>,\n onScroll,\n getInitialScrollPosition\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean, menuTrigger?: MenuTriggerAction): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen, menuTrigger);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n return {\n ref,\n onOpenChange: onOpenChangeInternal,\n };\n}\n\nexport default usePickerScrollOnOpen;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AAEnC,SACEC,4BAA4B,EAC5BC,qBAAqB,QAChB,wBAAwB;AAc/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAIgC;EAAA,IAJU;IAC7EC,wBAAwB;IACxBC,QAAQ;IACRC;EAC4B,CAAC,GAAAH,IAAA;EAC7B,IAAM;IAAEI,GAAG;IAAED,YAAY,EAAEE;EAAoB,CAAC,GAAGP,qBAAqB,CACtED,4BAA4B,EAC5BK,QAAQ,EACRD,wBACF,CAAC;EAED,IAAMK,oBAAoB,GAAGV,WAAW,CACtC,CAACW,MAAe,EAAEC,WAA+B,KAAW;IAC1D;IACAH,mBAAmB,CAACE,MAAM,CAAC;IAE3BJ,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAGI,MAAM,EAAEC,WAAW,CAAC;EACrC,CAAC,EACD,CAACL,YAAY,EAAEE,mBAAmB,CACpC,CAAC;EAED,OAAO;IACLD,GAAG;IACHD,YAAY,EAAEG;EAChB,CAAC;AACH;AAEA,eAAeP,qBAAqB"
|
|
1
|
+
{"version":3,"file":"usePickerScrollOnOpen.js","names":["useCallback","findSpectrumPickerScrollArea","usePopoverOnScrollRef","usePickerScrollOnOpen","_ref","getInitialScrollPosition","onScroll","onOpenChange","ref","popoverOnOpenChange","onOpenChangeInternal","isOpen","menuTrigger"],"sources":["../../../src/spectrum/picker/usePickerScrollOnOpen.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport type { DOMRef } from '@react-types/shared';\nimport {\n findSpectrumPickerScrollArea,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport type { MenuTriggerAction } from '../comboBox';\n\nexport interface UsePickerScrollOnOpenOptions {\n getInitialScrollPosition?: () => Promise<number | null | undefined>;\n onScroll: (event: Event) => void;\n onOpenChange?: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;\n}\n\nexport interface UsePickerScrollOnOpenResult<THtml extends HTMLElement> {\n ref: DOMRef<THtml>;\n onOpenChange: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;\n}\n\n/**\n * Handle scroll event registration and scrolling to initial scroll position\n * whenever a Picker popover is opened.\n * @param getInitialScrollPosition Function to get the initial scroll position.\n * @param onScroll Callback for scroll events.\n * @param onOpenChange Callback for open change events.\n * @return A ref to attach to the Picker and a callback to handle open change\n * events for the Picker.\n */\nexport function usePickerScrollOnOpen<THtml extends HTMLElement = HTMLElement>({\n getInitialScrollPosition,\n onScroll,\n onOpenChange,\n}: UsePickerScrollOnOpenOptions): UsePickerScrollOnOpenResult<THtml> {\n const { ref, onOpenChange: popoverOnOpenChange } = usePopoverOnScrollRef(\n findSpectrumPickerScrollArea<THtml>,\n onScroll,\n getInitialScrollPosition\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean, menuTrigger?: MenuTriggerAction): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen, menuTrigger);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n return {\n ref,\n onOpenChange: onOpenChangeInternal,\n };\n}\n\nexport default usePickerScrollOnOpen;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AAEnC,SACEC,4BAA4B,EAC5BC,qBAAqB,QAChB,wBAAwB;AAc/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAIgC;EAAA,IAJU;IAC7EC,wBAAwB;IACxBC,QAAQ;IACRC;EAC4B,CAAC,GAAAH,IAAA;EAC7B,IAAM;IAAEI,GAAG;IAAED,YAAY,EAAEE;EAAoB,CAAC,GAAGP,qBAAqB,CACtED,4BAA4B,EAC5BK,QAAQ,EACRD,wBACF,CAAC;EAED,IAAMK,oBAAoB,GAAGV,WAAW,CACtC,CAACW,MAAe,EAAEC,WAA+B,KAAW;IAC1D;IACAH,mBAAmB,CAACE,MAAM,CAAC;IAE3BJ,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAGI,MAAM,EAAEC,WAAW,CAAC;EACrC,CAAC,EACD,CAACL,YAAY,EAAEE,mBAAmB,CACpC,CAAC;EAED,OAAO;IACLD,GAAG;IACHD,YAAY,EAAEG;EAChB,CAAC;AACH;AAEA,eAAeP,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":["Section","SpectrumSection","Item"],"sources":["../../src/spectrum/shared.ts"],"sourcesContent":["/**\n * Wrapping Spectrum `Item` and `Section` components will break functionality\n * due to the way they are consumed by collection components. They are only used\n * to pass data and don't render anything on their own, so they don't need to be\n * wrapped. If we do ever need to wrap them for whatever reason, the static\n * `getCollectionNode` method will need to be implemented.\n * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Item.ts#L17\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Section.ts#L18\n */\nimport { Section as SpectrumSection } from '@adobe/react-spectrum';\nimport type {\n ItemElement,\n ItemRenderer,\n SectionProps as SpectrumSectionProps,\n} from '@react-types/shared';\n\nexport { Item } from '@adobe/react-spectrum';\nexport type {\n ItemProps,\n Orientation,\n PressEvent,\n SelectionMode,\n} from '@react-types/shared';\n\n/*\n * We support primitive values as shorthand for `Item` elements in certain\n * components. This type represents this augmentation of the Spectrum types.\n */\nexport type ItemElementOrPrimitive<T = unknown> =\n | number\n | string\n | boolean\n | ItemElement<T>;\n\nexport type ItemsChildren<T> =\n | ItemElement<T>\n | ItemElement<T>[]\n | ItemRenderer<T>;\n\nexport type ItemsOrPrimitiveChildren<T> =\n | ItemElementOrPrimitive<T>\n | ItemElementOrPrimitive<T>[]\n | ItemRenderer<T>;\n\n/**\n * Spectrum SectionProps augmented with support for primitive item children.\n */\nexport type SectionProps<T> = Omit<SpectrumSectionProps<T>, 'children'> & {\n children: ItemsOrPrimitiveChildren<T>;\n};\n\n/**\n * Re-export Spectrum Section component with augmented props type.\n */\nexport const Section = SpectrumSection as <T>(\n props: SectionProps<T>\n) => JSX.Element;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,eAAe,QAAQ,uBAAuB;AAOlE,SAASC,IAAI,QAAQ,uBAAuB;;AAQ5C;AACA;AACA;AACA;;AAiBA;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,IAAMF,OAAO,GAAGC,eAEP"
|
|
1
|
+
{"version":3,"file":"shared.js","names":["Section","SpectrumSection","Item"],"sources":["../../src/spectrum/shared.ts"],"sourcesContent":["/**\n * Wrapping Spectrum `Item` and `Section` components will break functionality\n * due to the way they are consumed by collection components. They are only used\n * to pass data and don't render anything on their own, so they don't need to be\n * wrapped. If we do ever need to wrap them for whatever reason, the static\n * `getCollectionNode` method will need to be implemented.\n * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Item.ts#L17\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Section.ts#L18\n */\nimport { Section as SpectrumSection } from '@adobe/react-spectrum';\nimport type {\n ItemElement,\n ItemRenderer,\n SectionProps as SpectrumSectionProps,\n} from '@react-types/shared';\n\nexport { Item } from '@adobe/react-spectrum';\nexport type {\n ItemProps,\n Orientation,\n PressEvent,\n SelectionMode,\n} from '@react-types/shared';\n\n/*\n * We support primitive values as shorthand for `Item` elements in certain\n * components. This type represents this augmentation of the Spectrum types.\n */\nexport type ItemElementOrPrimitive<T = unknown> =\n | number\n | string\n | boolean\n | ItemElement<T>;\n\nexport type ItemsChildren<T> =\n | ItemElement<T>\n | ItemElement<T>[]\n | ItemRenderer<T>;\n\nexport type ItemsOrPrimitiveChildren<T> =\n | ItemElementOrPrimitive<T>\n | ItemElementOrPrimitive<T>[]\n | ItemRenderer<T>;\n\n/**\n * Spectrum SectionProps augmented with support for primitive item children.\n */\nexport type SectionProps<T> = Omit<SpectrumSectionProps<T>, 'children'> & {\n children: ItemsOrPrimitiveChildren<T>;\n};\n\n/**\n * Re-export Spectrum Section component with augmented props type.\n */\nexport const Section = SpectrumSection as <T>(\n props: SectionProps<T>\n) => JSX.Element;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,eAAe,QAAQ,uBAAuB;AAOlE,SAASC,IAAI,QAAQ,uBAAuB;;AAQ5C;AACA;AACA;AACA;;AAiBA;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,IAAMF,OAAO,GAAGC,eAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","names":["Badge","InlineAlert","LabeledValue","Meter","ProgressBar","ProgressCircle","StatusLight","ToastContainer","ToastQueue"],"sources":["../../src/spectrum/status.ts"],"sourcesContent":["export {\n Badge,\n type SpectrumBadgeProps as BadgeProps,\n InlineAlert,\n type SpectrumInlineAlertProps as InlineAlertProps,\n LabeledValue,\n type SpectrumLabeledValueProps as LabeledValueProps,\n Meter,\n type SpectrumMeterProps as MeterProps,\n ProgressBar,\n type SpectrumProgressBarProps as ProgressBarProps,\n ProgressCircle,\n type SpectrumProgressCircleProps as ProgressCircleProps,\n StatusLight,\n type SpectrumStatusLightProps as StatusLightProps,\n} from '@adobe/react-spectrum';\n\nexport {\n ToastContainer,\n type SpectrumToastContainerProps as ToastContainerProps,\n ToastQueue,\n type SpectrumToastOptions as ToastOptions,\n} from '@react-spectrum/toast';\n"],"mappings":"AAAA,SACEA,KAAK,EAELC,WAAW,EAEXC,YAAY,EAEZC,KAAK,EAELC,WAAW,EAEXC,cAAc,EAEdC,WAAW,QAEN,uBAAuB;AAE9B,SACEC,cAAc,EAEdC,UAAU,QAEL,uBAAuB"
|
|
1
|
+
{"version":3,"file":"status.js","names":["Badge","InlineAlert","LabeledValue","Meter","ProgressBar","ProgressCircle","StatusLight","ToastContainer","ToastQueue"],"sources":["../../src/spectrum/status.ts"],"sourcesContent":["export {\n Badge,\n type SpectrumBadgeProps as BadgeProps,\n InlineAlert,\n type SpectrumInlineAlertProps as InlineAlertProps,\n LabeledValue,\n type SpectrumLabeledValueProps as LabeledValueProps,\n Meter,\n type SpectrumMeterProps as MeterProps,\n ProgressBar,\n type SpectrumProgressBarProps as ProgressBarProps,\n ProgressCircle,\n type SpectrumProgressCircleProps as ProgressCircleProps,\n StatusLight,\n type SpectrumStatusLightProps as StatusLightProps,\n} from '@adobe/react-spectrum';\n\nexport {\n ToastContainer,\n type SpectrumToastContainerProps as ToastContainerProps,\n ToastQueue,\n type SpectrumToastOptions as ToastOptions,\n} from '@react-spectrum/toast';\n"],"mappings":"AAAA,SACEA,KAAK,EAELC,WAAW,EAEXC,YAAY,EAEZC,KAAK,EAELC,WAAW,EAEXC,cAAc,EAEdC,WAAW,QAEN,uBAAuB;AAE9B,SACEC,cAAc,EAEdC,UAAU,QAEL,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/utils/index.ts"],"sourcesContent":["export * from './itemUtils';\nexport * from './itemWrapperUtils';\nexport * from './propsUtils';\nexport * from './themeUtils';\nexport * from './useOnChangeTrackUncontrolled';\nexport * from './useRenderNormalizedItem';\nexport * from './useStaticItemInitialScrollPosition';\nexport * from './useStringifiedMultiSelection';\nexport * from './useStringifiedSelection';\n"],"mappings":""
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/utils/index.ts"],"sourcesContent":["export * from './itemUtils';\nexport * from './itemWrapperUtils';\nexport * from './propsUtils';\nexport * from './themeUtils';\nexport * from './useOnChangeTrackUncontrolled';\nexport * from './useRenderNormalizedItem';\nexport * from './useStaticItemInitialScrollPosition';\nexport * from './useStringifiedMultiSelection';\nexport * from './useStringifiedSelection';\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemUtils.js","names":["isElementOfType","ensureArray","Item","Section","Text","ItemContent","ITEM_EMPTY_STRING_TEXT_VALUE","getItemKey","item","_item$item$key","_item$item","key","getItemTextValue","props","textValue","itemKeyStr","undefined","String","includes","children","getPositionOfSelectedItemElement","_x","_getPositionOfSelectedItemElement","apply","arguments","_asyncToGenerator","_ref","items","itemHeight","selectedKey","topOffset","position","i","length","isSectionElement","node","isItemElement","isItemElementWithDescription","childrenArray","result","some","child","_child$props","slot","isNormalizedItemsWithKeysList","Array","isArray","isItemOrSection","isNormalizedSection","maybeNormalizedSection","normalizeTooltipOptions","options","placement","itemSelectionToStringSet","itemKeys","Set","map"],"sources":["../../../src/spectrum/utils/itemUtils.ts"],"sourcesContent":["import { type Key, type ReactElement, type ReactNode } from 'react';\nimport type { ItemRenderer } from '@react-types/shared';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, type KeyedItem, type SelectionT } from '@deephaven/utils';\nimport {\n Item,\n type ItemElementOrPrimitive,\n type ItemProps,\n Section,\n type SectionProps,\n} from '../shared';\nimport { type PopperOptions } from '../../popper';\nimport { Text } from '../Text';\nimport ItemContent from '../ItemContent';\n\n/**\n * `Item.textValue` prop needs to be a non-empty string for accessibility\n * purposes. This is not displayed in the UI.\n */\nexport const ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';\n\n/**\n * React Spectrum <Section> supports an `ItemRenderer` function as a child. The\n * DH picker makes use of this internally, but we don't want to support it as\n * an incoming prop.\n */\ntype SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {\n children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;\n};\n\nexport type ItemElement<T = unknown> = ReactElement<ItemProps<T>>;\nexport type SectionElement<T = unknown> = ReactElement<\n SectionPropsNoItemRenderer<T>\n>;\n\nexport type ItemOrSection<T = unknown> =\n | ItemElementOrPrimitive<T>\n | SectionElement<T>;\n\n// Picker uses `icon` slot. ListView can use `image` or `illustration` slots.\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/picker/src/Picker.tsx#L194\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L266-L267\nexport type ItemIconSlot = 'icon' | 'image' | 'illustration';\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * Spectrum collection components already supports this, but the built in types\n * don't reflect it.\n */\nexport type ItemKey = Key | boolean;\n\nexport type ItemSelection = SelectionT<ItemKey>;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * Spectrum components already supports this, but the built in types don't\n * reflect it.\n */\nexport type ItemSelectionChangeHandler = (key: ItemKey) => void;\n\nexport interface MultipleItemSelectionProps {\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (keys: ItemSelection) => void;\n}\n\nexport interface NormalizedItemData {\n key?: ItemKey;\n content: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n textValue: string | undefined;\n}\n\nexport interface NormalizedSectionData {\n key?: Key;\n title?: ReactNode;\n items: NormalizedItem[];\n}\n\n/**\n * Spectrum collection components support a variety of item types, including\n * strings, numbers, booleans, and more complex React elements. This type\n * represents a normalized form to make rendering items simpler and keep the\n * logic of transformation in separate util methods. It also adheres to the\n * `KeyedItem` interface to be compatible with Windowed data utils\n * (e.g. `useViewportData`).\n */\nexport type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey>;\n\nexport type NormalizedSection = KeyedItem<NormalizedSectionData, Key>;\n\nexport type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> =\n TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * DH wrappers of Spectrum collection components use a normalized item that\n * includes a `key` prop and an optional `item` prop. This is mostly to support\n * Windowed data where items are created before their data has been loaded (data\n * gets set in the `item` prop). If data has loaded, return its `key`. If not,\n * return the top-level `key` on the normalized item.\n * @param item The normalized item or section\n * @returns The `key` of the item or section\n */\nexport function getItemKey<\n TItem extends NormalizedItem | NormalizedSection,\n TKey extends TItem extends NormalizedItem\n ? ItemKey\n : TItem extends NormalizedSection\n ? Key\n : undefined,\n>(item: TItem | null | undefined): TKey {\n return (item?.item?.key ?? item?.key) as TKey;\n}\n\n/**\n * Determine Item `textValue` based on the `textValue` prop or primitive children\n * value.\n * @param item The item to get the text value for\n * @returns The text value of the item\n */\nexport function getItemTextValue<T>(item: ItemElement<T>): string | undefined {\n if (item.props.textValue == null) {\n const itemKeyStr = item.key == null ? undefined : String(item.key);\n return ['string', 'boolean', 'number'].includes(typeof item.props.children)\n ? String(item.props.children)\n : itemKeyStr;\n }\n\n return item.props.textValue === ''\n ? ITEM_EMPTY_STRING_TEXT_VALUE\n : item.props.textValue;\n}\n\n/**\n * Get the position of the item with the given selected key in a list of items.\n * @param items The items to search\n * @param itemHeight The height of each item\n * @param selectedKey The key of the selected item\n * @param topOffset The top offset of the list\n * @returns The position of the selected item or the top offset if not found\n */\nexport async function getPositionOfSelectedItemElement<\n TKey extends string | number | boolean | undefined,\n>({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n}: {\n items: ItemElement[];\n selectedKey: TKey | null | undefined;\n itemHeight: number;\n topOffset: number;\n}): Promise<number> {\n let position = topOffset;\n\n if (selectedKey == null) {\n return position;\n }\n\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (item.key === selectedKey) {\n return position;\n }\n\n position += itemHeight;\n }\n\n return topOffset;\n}\n\n/**\n * Determine if a node is a Section element.\n * @param node The node to check\n * @returns True if the node is a Section element\n */\nexport function isSectionElement<T>(\n node: ReactNode\n): node is SectionElement<T> {\n return isElementOfType(node, Section);\n}\n\n/**\n * Determine if a node is an Item element.\n * @param node The node to check\n * @returns True if the node is an Item element\n */\nexport function isItemElement<T>(node: ReactNode): node is ItemElement<T> {\n return isElementOfType(node, Item);\n}\n\n/**\n * Determine if a node is an Item element containing a child `Text` element with\n * a `slot` prop set to `description`.\n * @param node The node to check\n * @returns True if the node is an Item element with a description\n */\nexport function isItemElementWithDescription<T>(\n node: ReactNode\n): node is ReactElement<ItemProps<T>> {\n if (!isItemElement(node)) {\n return false;\n }\n\n // If children are wrapped in `ItemContent`, go down 1 level\n const children = isElementOfType(node.props.children, ItemContent)\n ? node.props.children.props.children\n : node.props.children;\n\n const childrenArray = ensureArray(children);\n\n const result = childrenArray.some(\n child => isElementOfType(child, Text) && child.props?.slot === 'description'\n );\n\n return result;\n}\n\n/**\n * Determine if a node is an array containing normalized items or sections with\n * keys. Note that this only checks the first node in the array.\n * @param node The node to check\n * @returns True if the node is a normalized item or section with keys array\n */\nexport function isNormalizedItemsWithKeysList<\n TItemOrSection extends ItemOrSection,\n>(\n node:\n | TItemOrSection\n | TItemOrSection[]\n | NormalizedItemOrSection<TItemOrSection>[]\n): node is NormalizedItemOrSection<TItemOrSection>[] {\n if (!Array.isArray(node)) {\n return false;\n }\n\n if (node.length === 0) {\n return true;\n }\n\n return (\n !isItemOrSection(node[0]) &&\n node[0] != null &&\n typeof node[0] === 'object' &&\n 'key' in node[0]\n );\n}\n\n/**\n * Determine if an object is a normalized section.\n * @param maybeNormalizedSection The object to check\n * @returns True if the object is a normalized section\n */\nexport function isNormalizedSection(\n maybeNormalizedSection: NormalizedItem | NormalizedSection\n): maybeNormalizedSection is NormalizedSection {\n return (\n maybeNormalizedSection.item != null &&\n 'items' in maybeNormalizedSection.item\n );\n}\n\n/**\n * Determine if a node is an item or section. Valid types include strings,\n * numbers, booleans, Item elements, and Section elements.\n * @param node The node to check\n * @returns True if the node is an item or section\n */\nexport function isItemOrSection(node: ReactNode): node is ItemOrSection {\n return (\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean' ||\n isItemElement(node) ||\n isSectionElement(node)\n );\n}\n\n/**\n * Returns a TooltipOptions object or null if options is false or null.\n * @param options Tooltip options\n * @param placement Default placement for the tooltip if `options` is set\n * explicitly to `true`\n * @returns TooltipOptions or null\n */\nexport function normalizeTooltipOptions(\n options?: boolean | TooltipOptions | null,\n placement: TooltipOptions['placement'] = 'right'\n): TooltipOptions | null {\n if (options == null || options === false) {\n return null;\n }\n\n if (options === true) {\n return { placement };\n }\n\n return options;\n}\n\n/**\n * Convert a selection of `ItemKey`s to a selection of strings.\n * @param itemKeys The selection of `ItemKey`s\n * @returns The selection of strings\n */\nexport function itemSelectionToStringSet<\n TKeys extends 'all' | Iterable<ItemKey> | undefined,\n TResult extends TKeys extends 'all'\n ? 'all'\n : TKeys extends Iterable<ItemKey>\n ? Set<string>\n : undefined,\n>(itemKeys: TKeys): TResult {\n if (itemKeys == null || itemKeys === 'all') {\n return itemKeys as undefined | 'all' as TResult;\n }\n\n return new Set([...itemKeys].map(String)) as TResult;\n}\n"],"mappings":";;AAEA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,QAAyC,kBAAkB;AAAC,SAE9EC,IAAI,EAGJC,OAAO;AAAA,SAIAC,IAAI;AAAA,OACNC,WAAW;AAElB;AACA;AACA;AACA;AACA,OAAO,IAAMC,4BAA4B,GAAG,OAAO;;AAEnD;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAOxBC,IAA8B,EAAQ;EAAA,IAAAC,cAAA,EAAAC,UAAA;EACtC,QAAAD,cAAA,GAAQD,IAAI,aAAJA,IAAI,wBAAAE,UAAA,GAAJF,IAAI,CAAEA,IAAI,cAAAE,UAAA,uBAAVA,UAAA,CAAYC,GAAG,cAAAF,cAAA,cAAAA,cAAA,GAAID,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,GAAG;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAIJ,IAAoB,EAAsB;EAC5E,IAAIA,IAAI,CAACK,KAAK,CAACC,SAAS,IAAI,IAAI,EAAE;IAChC,IAAMC,UAAU,GAAGP,IAAI,CAACG,GAAG,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AAK,QAAQ,IAC3B,KAAK,IAAIA,IAAI,CAAC,CAAC,CAAC;AAEpB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASa,mBAAmBA,CACjCC,sBAA0D,EACb;EAC7C,OACEA,sBAAsB,CAACzC,IAAI,IAAI,IAAI,IACnC,OAAO,IAAIyC,sBAAsB,CAACzC,IAAI;AAE1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASuC,eAAeA,CAACZ,IAAe,EAAyB;EACtE,OACE,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,SAAS,IACzBC,aAAa,CAACD,IAAI,CAAC,IACnBD,gBAAgB,CAACC,IAAI,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASe,uBAAuBA,CACrCC,OAAyC,EAElB;EAAA,IADvBC,SAAsC,GAAA5B,SAAA,CAAAS,MAAA,QAAAT,SAAA,QAAAR,SAAA,GAAAQ,SAAA,MAAG,OAAO;EAEhD,IAAI2B,OAAO,IAAI,IAAI,IAAIA,OAAO,KAAK,KAAK,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,IAAIA,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO;MAAEC;IAAU,CAAC;EACtB;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,wBAAwBA,CAOtCC,QAAe,EAAW;EAC1B,IAAIA,QAAQ,IAAI,IAAI,IAAIA,QAAQ,KAAK,KAAK,EAAE;IAC1C,OAAOA,QAAQ;EACjB;EAEA,OAAO,IAAIC,GAAG,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAACE,GAAG,CAACvC,MAAM,CAAC,CAAC;AAC3C","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"itemUtils.js","names":["isElementOfType","ensureArray","Item","Section","Text","ItemContent","ITEM_EMPTY_STRING_TEXT_VALUE","getItemKey","item","_item$item$key","_item$item","key","getItemTextValue","props","textValue","itemKeyStr","undefined","String","includes","children","getPositionOfSelectedItemElement","_x","_getPositionOfSelectedItemElement","apply","arguments","_asyncToGenerator","_ref","items","itemHeight","selectedKey","topOffset","position","i","length","isSectionElement","node","isItemElement","isItemElementWithDescription","childrenArray","result","some","child","_child$props","slot","isNormalizedItemsWithKeysList","Array","isArray","isItemOrSection","isNormalizedSection","maybeNormalizedSection","normalizeTooltipOptions","options","placement","itemSelectionToStringSet","itemKeys","Set","map"],"sources":["../../../src/spectrum/utils/itemUtils.ts"],"sourcesContent":["import { type Key, type ReactElement, type ReactNode } from 'react';\nimport type { ItemRenderer } from '@react-types/shared';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, type KeyedItem, type SelectionT } from '@deephaven/utils';\nimport {\n Item,\n type ItemElementOrPrimitive,\n type ItemProps,\n Section,\n type SectionProps,\n} from '../shared';\nimport { type PopperOptions } from '../../popper';\nimport { Text } from '../Text';\nimport ItemContent from '../ItemContent';\n\n/**\n * `Item.textValue` prop needs to be a non-empty string for accessibility\n * purposes. This is not displayed in the UI.\n */\nexport const ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';\n\n/**\n * React Spectrum <Section> supports an `ItemRenderer` function as a child. The\n * DH picker makes use of this internally, but we don't want to support it as\n * an incoming prop.\n */\ntype SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {\n children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;\n};\n\nexport type ItemElement<T = unknown> = ReactElement<ItemProps<T>>;\nexport type SectionElement<T = unknown> = ReactElement<\n SectionPropsNoItemRenderer<T>\n>;\n\nexport type ItemOrSection<T = unknown> =\n | ItemElementOrPrimitive<T>\n | SectionElement<T>;\n\n// Picker uses `icon` slot. ListView can use `image` or `illustration` slots.\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/picker/src/Picker.tsx#L194\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L266-L267\nexport type ItemIconSlot = 'icon' | 'image' | 'illustration';\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * Spectrum collection components already supports this, but the built in types\n * don't reflect it.\n */\nexport type ItemKey = Key | boolean;\n\nexport type ItemSelection = SelectionT<ItemKey>;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * Spectrum components already supports this, but the built in types don't\n * reflect it.\n */\nexport type ItemSelectionChangeHandler = (key: ItemKey) => void;\n\nexport interface MultipleItemSelectionProps {\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (keys: ItemSelection) => void;\n}\n\nexport interface NormalizedItemData {\n key?: ItemKey;\n content: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n textValue: string | undefined;\n}\n\nexport interface NormalizedSectionData {\n key?: Key;\n title?: ReactNode;\n items: NormalizedItem[];\n}\n\n/**\n * Spectrum collection components support a variety of item types, including\n * strings, numbers, booleans, and more complex React elements. This type\n * represents a normalized form to make rendering items simpler and keep the\n * logic of transformation in separate util methods. It also adheres to the\n * `KeyedItem` interface to be compatible with Windowed data utils\n * (e.g. `useViewportData`).\n */\nexport type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey>;\n\nexport type NormalizedSection = KeyedItem<NormalizedSectionData, Key>;\n\nexport type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> =\n TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * DH wrappers of Spectrum collection components use a normalized item that\n * includes a `key` prop and an optional `item` prop. This is mostly to support\n * Windowed data where items are created before their data has been loaded (data\n * gets set in the `item` prop). If data has loaded, return its `key`. If not,\n * return the top-level `key` on the normalized item.\n * @param item The normalized item or section\n * @returns The `key` of the item or section\n */\nexport function getItemKey<\n TItem extends NormalizedItem | NormalizedSection,\n TKey extends TItem extends NormalizedItem\n ? ItemKey\n : TItem extends NormalizedSection\n ? Key\n : undefined,\n>(item: TItem | null | undefined): TKey {\n return (item?.item?.key ?? item?.key) as TKey;\n}\n\n/**\n * Determine Item `textValue` based on the `textValue` prop or primitive children\n * value.\n * @param item The item to get the text value for\n * @returns The text value of the item\n */\nexport function getItemTextValue<T>(item: ItemElement<T>): string | undefined {\n if (item.props.textValue == null) {\n const itemKeyStr = item.key == null ? undefined : String(item.key);\n return ['string', 'boolean', 'number'].includes(typeof item.props.children)\n ? String(item.props.children)\n : itemKeyStr;\n }\n\n return item.props.textValue === ''\n ? ITEM_EMPTY_STRING_TEXT_VALUE\n : item.props.textValue;\n}\n\n/**\n * Get the position of the item with the given selected key in a list of items.\n * @param items The items to search\n * @param itemHeight The height of each item\n * @param selectedKey The key of the selected item\n * @param topOffset The top offset of the list\n * @returns The position of the selected item or the top offset if not found\n */\nexport async function getPositionOfSelectedItemElement<\n TKey extends string | number | boolean | undefined,\n>({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n}: {\n items: ItemElement[];\n selectedKey: TKey | null | undefined;\n itemHeight: number;\n topOffset: number;\n}): Promise<number> {\n let position = topOffset;\n\n if (selectedKey == null) {\n return position;\n }\n\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (item.key === selectedKey) {\n return position;\n }\n\n position += itemHeight;\n }\n\n return topOffset;\n}\n\n/**\n * Determine if a node is a Section element.\n * @param node The node to check\n * @returns True if the node is a Section element\n */\nexport function isSectionElement<T>(\n node: ReactNode\n): node is SectionElement<T> {\n return isElementOfType(node, Section);\n}\n\n/**\n * Determine if a node is an Item element.\n * @param node The node to check\n * @returns True if the node is an Item element\n */\nexport function isItemElement<T>(node: ReactNode): node is ItemElement<T> {\n return isElementOfType(node, Item);\n}\n\n/**\n * Determine if a node is an Item element containing a child `Text` element with\n * a `slot` prop set to `description`.\n * @param node The node to check\n * @returns True if the node is an Item element with a description\n */\nexport function isItemElementWithDescription<T>(\n node: ReactNode\n): node is ReactElement<ItemProps<T>> {\n if (!isItemElement(node)) {\n return false;\n }\n\n // If children are wrapped in `ItemContent`, go down 1 level\n const children = isElementOfType(node.props.children, ItemContent)\n ? node.props.children.props.children\n : node.props.children;\n\n const childrenArray = ensureArray(children);\n\n const result = childrenArray.some(\n child => isElementOfType(child, Text) && child.props?.slot === 'description'\n );\n\n return result;\n}\n\n/**\n * Determine if a node is an array containing normalized items or sections with\n * keys. Note that this only checks the first node in the array.\n * @param node The node to check\n * @returns True if the node is a normalized item or section with keys array\n */\nexport function isNormalizedItemsWithKeysList<\n TItemOrSection extends ItemOrSection,\n>(\n node:\n | TItemOrSection\n | TItemOrSection[]\n | NormalizedItemOrSection<TItemOrSection>[]\n): node is NormalizedItemOrSection<TItemOrSection>[] {\n if (!Array.isArray(node)) {\n return false;\n }\n\n if (node.length === 0) {\n return true;\n }\n\n return (\n !isItemOrSection(node[0]) &&\n node[0] != null &&\n typeof node[0] === 'object' &&\n 'key' in node[0]\n );\n}\n\n/**\n * Determine if an object is a normalized section.\n * @param maybeNormalizedSection The object to check\n * @returns True if the object is a normalized section\n */\nexport function isNormalizedSection(\n maybeNormalizedSection: NormalizedItem | NormalizedSection\n): maybeNormalizedSection is NormalizedSection {\n return (\n maybeNormalizedSection.item != null &&\n 'items' in maybeNormalizedSection.item\n );\n}\n\n/**\n * Determine if a node is an item or section. Valid types include strings,\n * numbers, booleans, Item elements, and Section elements.\n * @param node The node to check\n * @returns True if the node is an item or section\n */\nexport function isItemOrSection(node: ReactNode): node is ItemOrSection {\n return (\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean' ||\n isItemElement(node) ||\n isSectionElement(node)\n );\n}\n\n/**\n * Returns a TooltipOptions object or null if options is false or null.\n * @param options Tooltip options\n * @param placement Default placement for the tooltip if `options` is set\n * explicitly to `true`\n * @returns TooltipOptions or null\n */\nexport function normalizeTooltipOptions(\n options?: boolean | TooltipOptions | null,\n placement: TooltipOptions['placement'] = 'right'\n): TooltipOptions | null {\n if (options == null || options === false) {\n return null;\n }\n\n if (options === true) {\n return { placement };\n }\n\n return options;\n}\n\n/**\n * Convert a selection of `ItemKey`s to a selection of strings.\n * @param itemKeys The selection of `ItemKey`s\n * @returns The selection of strings\n */\nexport function itemSelectionToStringSet<\n TKeys extends 'all' | Iterable<ItemKey> | undefined,\n TResult extends TKeys extends 'all'\n ? 'all'\n : TKeys extends Iterable<ItemKey>\n ? Set<string>\n : undefined,\n>(itemKeys: TKeys): TResult {\n if (itemKeys == null || itemKeys === 'all') {\n return itemKeys as undefined | 'all' as TResult;\n }\n\n return new Set([...itemKeys].map(String)) as TResult;\n}\n"],"mappings":";;AAEA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,QAAyC,kBAAkB;AAAC,SAE9EC,IAAI,EAGJC,OAAO;AAAA,SAIAC,IAAI;AAAA,OACNC,WAAW;AAElB;AACA;AACA;AACA;AACA,OAAO,IAAMC,4BAA4B,GAAG,OAAO;;AAEnD;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAOxBC,IAA8B,EAAQ;EAAA,IAAAC,cAAA,EAAAC,UAAA;EACtC,QAAAD,cAAA,GAAQD,IAAI,aAAJA,IAAI,wBAAAE,UAAA,GAAJF,IAAI,CAAEA,IAAI,cAAAE,UAAA,uBAAVA,UAAA,CAAYC,GAAG,cAAAF,cAAA,cAAAA,cAAA,GAAID,IAAI,aAA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,OAAOA,QAAQ;EACjB;EAEA,OAAO,IAAIC,GAAG,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAACE,GAAG,CAACvC,MAAM,CAAC,CAAC;AAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemWrapperUtils.js","names":["cloneElement","Item","FontAwesomeIcon","dh","dhIcons","isElementOfType","ensureArray","NON_BREAKING_SPACE","getItemTextValue","isItemElement","isSectionElement","ITEM_EMPTY_STRING_TEXT_VALUE","ItemContent","Icon","Text","jsx","_jsx","wrapIcon","maybeIconKey","slot","_maybeIconKey","_dhIcons$maybeIconKey","children","icon","vsBlank","wrapItemChildren","itemsOrSections","tooltipOptions","itemsOrSectionsArray","result","map","item","_item$key","props","key","textValue","_objectSpread","_item$key2","title","undefined","text","String","Array","isArray","wrapPrimitiveWithText","content","_content","includes"],"sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"sourcesContent":["import { cloneElement, type ReactNode } from 'react';\nimport { Item } from '@adobe/react-spectrum';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { dh as dhIcons } from '@deephaven/icons';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, NON_BREAKING_SPACE } from '@deephaven/utils';\nimport {\n getItemTextValue,\n isItemElement,\n isSectionElement,\n type ItemElement,\n type ItemIconSlot,\n type ItemOrSection,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n type SectionElement,\n type TooltipOptions,\n} from './itemUtils';\nimport { ItemContent } from '../ItemContent';\nimport { Icon } from '../icons';\nimport { Text } from '../Text';\n\n/**\n * If the given content is a string, wrap it in an Icon component. Otherwise,\n * return the original content. If the key is not found in the dhIcons object,\n * the vsBlank icon will be used.\n * @param maybeIconKey The content to wrap\n * @param slot The slot to use for the Icon component\n * @returns The wrapped content or original content if not a string\n */\nexport function wrapIcon(\n maybeIconKey: ReactNode,\n slot: ItemIconSlot\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n maybeIconKey = maybeIconKey ?? '';\n\n if (typeof maybeIconKey !== 'string') {\n return maybeIconKey;\n }\n\n return (\n <Icon slot={slot}>\n <FontAwesomeIcon icon={dhIcons[maybeIconKey] ?? dhIcons.vsBlank} />\n </Icon>\n );\n}\n\n/**\n * Ensure all primitive children are wrapped in `Item` elements and that all\n * `Item` element content is wrapped in `ItemContent` elements to handle text\n * overflow consistently and to support tooltips.\n * @param itemsOrSections The items or sections to wrap\n * @param tooltipOptions The tooltip options to use when wrapping items\n * @returns The wrapped items or sections\n */\nexport function wrapItemChildren<T>(\n itemsOrSections: ItemOrSection<T> | ItemOrSection<T>[],\n tooltipOptions: TooltipOptions | null\n): ItemElement<T> | SectionElement<T> | (ItemElement<T> | SectionElement<T>)[] {\n const itemsOrSectionsArray = ensureArray(itemsOrSections);\n\n const result = itemsOrSectionsArray.map(item => {\n if (isItemElement(item)) {\n // Item content is already wrapped\n if (isElementOfType(item.props.children, ItemContent)) {\n return item;\n }\n\n const key = item.key ?? item.props.textValue;\n const textValue = getItemTextValue(item);\n\n // Wrap in `ItemContent` so we can support tooltips and handle text\n // overflow\n return cloneElement(item, {\n ...item.props,\n key,\n textValue,\n children: (\n <ItemContent tooltipOptions={tooltipOptions}>\n {item.props.children}\n </ItemContent>\n ),\n });\n }\n\n if (isSectionElement(item)) {\n return cloneElement(item, {\n ...item.props,\n key:\n item.key ??\n (typeof item.props.title === 'string' ? item.props.title : undefined),\n children: wrapItemChildren<T>(item.props.children, tooltipOptions),\n });\n }\n\n const text = String(item);\n const textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;\n\n return (\n <Item key={text} textValue={textValue}>\n <ItemContent tooltipOptions={tooltipOptions}>{text}</ItemContent>\n </Item>\n );\n });\n\n // Keep consistent with original data structure as array or single node\n return Array.isArray(itemsOrSections) ? result : result[0];\n}\n\n/**\n * If the given content is a primitive type, wrap it in a Text component.\n * @param content The content to wrap\n * @param slot The slot to use for the Text component\n * @returns The wrapped content or original content if not a primitive type\n */\nexport function wrapPrimitiveWithText(\n content?: ReactNode,\n slot?: string\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n content = content ?? '';\n\n if (['string', 'boolean', 'number'].includes(typeof content)) {\n return (\n <Text slot={slot}>\n {/* Non-breaking space is needed to avoid the Text element's height \n collapsing when content is empty */}\n {content === '' ? NON_BREAKING_SPACE : String(content)}\n </Text>\n );\n }\n\n return content;\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,QAAwB,OAAO;AACpD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,EAAE,IAAIC,OAAO,QAAQ,kBAAkB;AAChD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,kBAAkB;AAAC,SAEjEC,gBAAgB,EAChBC,aAAa,EACbC,gBAAgB,EAIhBC,4BAA4B;AAAA,SAIrBC,WAAW;AAAA,SACXC,IAAI;AAAA,SACJC,IAAI;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,OAAO,SAASC,QAAQA,CACtBC,YAAuB,EACvBC,IAAkB,EACP;EAAA,IAAAC,aAAA,EAAAC,qBAAA;EACX;EACAH,YAAY,IAAAE,aAAA,GAAGF,YAAY,cAAAE,aAAA,cAAAA,aAAA,GAAI,EAAE;EAEjC,IAAI,OAAOF,YAAY,KAAK,QAAQ,EAAE;IACpC,OAAOA,YAAY;EACrB;EAEA,oBACEF,IAAA,CAACH,IAAI;IAACM,IAAI,EAAEA,IAAK;IAAAG,QAAA,eACfN,IAAA,CAACd,eAAe;MAACqB,IAAI,GAAAF,qBAAA,GAAEjB,OAAO,CAACc,YAAY,CAAC,cAAAG,qBAAA,cAAAA,qBAAA,GAAIjB,OAAO,CAACoB;IAAQ,CAAE;EAAC,CAC/D,CAAC;AAEX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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c;MAAC,EACnE,CAAC;IACJ;IAEA,IAAMa,IAAI,GAAGC,MAAM,CAACV,IAAI,CAAC;IACzB,IAAMI,SAAS,GAAGK,IAAI,KAAK,EAAE,GAAG7B,4BAA4B,GAAG6B,IAAI;IAEnE,oBACExB,IAAA,CAACf,IAAI;MAAYkC,SAAS,EAAEA,SAAU;MAAAb,QAAA,eACpCN,IAAA,CAACJ,WAAW;QAACe,cAAc,EAAEA,cAAe;QAAAL,QAAA,EAAEkB;MAAI,CAAc;IAAC,GADxDA,IAEL,CAAC;EAEX,CAAC,CAAC;;EAEF;EACA,OAAOE,KAAK,CAACC,OAAO,CAACjB,eAAe,CAAC,GAAGG,MAAM,GAAGA,MAAM,CAAC,CAAC,CAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASe,qBAAqBA,CACnCC,OAAmB,EACnB1B,IAAa,EACF;EAAA,IAAA2B,QAAA;EACX;EACAD,OAAO,IAAAC,QAAA,GAAGD,OAAO,cAAAC,QAAA,cAAAA,QAAA,GAAI,EAAE;EAEvB,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAAC,OAAOF,OAAO,CAAC,EAAE;IAC5D,oBACE7B,IAAA,CAACF,IAAI;MAACK,IAAI,EAAEA,IAAK;MAAAG,QAAA,EAGduB,OAAO,KAAK,EAAE,GAAGtC,kBAAkB,GAAGkC,MAAM,CAACI,OAAO;IAAC,CAClD,CAAC;EAEX;EAEA,OAAOA,OAAO;AAChB"
|
|
1
|
+
{"version":3,"file":"itemWrapperUtils.js","names":["cloneElement","Item","FontAwesomeIcon","dh","dhIcons","isElementOfType","ensureArray","NON_BREAKING_SPACE","getItemTextValue","isItemElement","isSectionElement","ITEM_EMPTY_STRING_TEXT_VALUE","ItemContent","Icon","Text","jsx","_jsx","wrapIcon","maybeIconKey","slot","_maybeIconKey","_dhIcons$maybeIconKey","children","icon","vsBlank","wrapItemChildren","itemsOrSections","tooltipOptions","itemsOrSectionsArray","result","map","item","_item$key","props","key","textValue","_objectSpread","_item$key2","title","undefined","text","String","Array","isArray","wrapPrimitiveWithText","content","_content","includes"],"sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"sourcesContent":["import { cloneElement, type ReactNode } from 'react';\nimport { Item } from '@adobe/react-spectrum';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { dh as dhIcons } from '@deephaven/icons';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, NON_BREAKING_SPACE } from '@deephaven/utils';\nimport {\n getItemTextValue,\n isItemElement,\n isSectionElement,\n type ItemElement,\n type ItemIconSlot,\n type ItemOrSection,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n type SectionElement,\n type TooltipOptions,\n} from './itemUtils';\nimport { ItemContent } from '../ItemContent';\nimport { Icon } from '../icons';\nimport { Text } from '../Text';\n\n/**\n * If the given content is a string, wrap it in an Icon component. Otherwise,\n * return the original content. If the key is not found in the dhIcons object,\n * the vsBlank icon will be used.\n * @param maybeIconKey The content to wrap\n * @param slot The slot to use for the Icon component\n * @returns The wrapped content or original content if not a string\n */\nexport function wrapIcon(\n maybeIconKey: ReactNode,\n slot: ItemIconSlot\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n maybeIconKey = maybeIconKey ?? '';\n\n if (typeof maybeIconKey !== 'string') {\n return maybeIconKey;\n }\n\n return (\n <Icon slot={slot}>\n <FontAwesomeIcon icon={dhIcons[maybeIconKey] ?? dhIcons.vsBlank} />\n </Icon>\n );\n}\n\n/**\n * Ensure all primitive children are wrapped in `Item` elements and that all\n * `Item` element content is wrapped in `ItemContent` elements to handle text\n * overflow consistently and to support tooltips.\n * @param itemsOrSections The items or sections to wrap\n * @param tooltipOptions The tooltip options to use when wrapping items\n * @returns The wrapped items or sections\n */\nexport function wrapItemChildren<T>(\n itemsOrSections: ItemOrSection<T> | ItemOrSection<T>[],\n tooltipOptions: TooltipOptions | null\n): ItemElement<T> | SectionElement<T> | (ItemElement<T> | SectionElement<T>)[] {\n const itemsOrSectionsArray = ensureArray(itemsOrSections);\n\n const result = itemsOrSectionsArray.map(item => {\n if (isItemElement(item)) {\n // Item content is already wrapped\n if (isElementOfType(item.props.children, ItemContent)) {\n return item;\n }\n\n const key = item.key ?? item.props.textValue;\n const textValue = getItemTextValue(item);\n\n // Wrap in `ItemContent` so we can support tooltips and handle text\n // overflow\n return cloneElement(item, {\n ...item.props,\n key,\n textValue,\n children: (\n <ItemContent tooltipOptions={tooltipOptions}>\n {item.props.children}\n </ItemContent>\n ),\n });\n }\n\n if (isSectionElement(item)) {\n return cloneElement(item, {\n ...item.props,\n key:\n item.key ??\n (typeof item.props.title === 'string' ? item.props.title : undefined),\n children: wrapItemChildren<T>(item.props.children, tooltipOptions),\n });\n }\n\n const text = String(item);\n const textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;\n\n return (\n <Item key={text} textValue={textValue}>\n <ItemContent tooltipOptions={tooltipOptions}>{text}</ItemContent>\n </Item>\n );\n });\n\n // Keep consistent with original data structure as array or single node\n return Array.isArray(itemsOrSections) ? result : result[0];\n}\n\n/**\n * If the given content is a primitive type, wrap it in a Text component.\n * @param content The content to wrap\n * @param slot The slot to use for the Text component\n * @returns The wrapped content or original content if not a primitive type\n */\nexport function wrapPrimitiveWithText(\n content?: ReactNode,\n slot?: string\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n content = content ?? '';\n\n if (['string', 'boolean', 'number'].includes(typeof content)) {\n return (\n <Text slot={slot}>\n {/* Non-breaking space is needed to avoid the Text element's height \n collapsing when content is empty */}\n {content === '' ? NON_BREAKING_SPACE : String(content)}\n </Text>\n );\n }\n\n return content;\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,QAAwB,OAAO;AACpD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,EAAE,IAAIC,OAAO,QAAQ,kBAAkB;AAChD,SAASC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A,MAAM,CAAC,CAAC,CAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASe,qBAAqBA,CACnCC,OAAmB,EACnB1B,IAAa,EACF;EAAA,IAAA2B,QAAA;EACX;EACAD,OAAO,IAAAC,QAAA,GAAGD,OAAO,cAAAC,QAAA,cAAAA,QAAA,GAAI,EAAE;EAEvB,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAAC,OAAOF,OAAO,CAAC,EAAE;IAC5D,oBACE7B,IAAA,CAACF,IAAI;MAACK,IAAI,EAAEA,IAAK;MAAAG,QAAA,EAGduB,OAAO,KAAK,EAAE,GAAGtC,kBAAkB,GAAGkC,MAAM,CAACI,OAAO;IAAC,CAClD,CAAC;EAEX;EAEA,OAAOA,OAAO;AAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propsUtils.js","names":["separateSpectrumProps","props","ariaLabel","ariaLabelledby","ariaDescribedby","ariaHidden","marginX","marginY","width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","justifySelf","alignSelf","order","gridArea","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","position","zIndex","top","bottom","start","end","left","right","isHidden","componentProps","_objectWithoutProperties","_excluded","ariaLabelProps","styleProps"],"sources":["../../../src/spectrum/utils/propsUtils.ts"],"sourcesContent":["import type { AriaLabelingProps, StyleProps } from '@react-types/shared';\n\n/**\n * Separate props for Spectrum components into AriaLabelingProps, StyleProps, and\n * any remaining props.\n * @param props The props to separate\n * @returns The separated props\n */\nexport function separateSpectrumProps<T extends AriaLabelingProps & StyleProps>(\n props: T\n): {\n ariaLabelProps: AriaLabelingProps;\n styleProps: StyleProps;\n componentProps: Omit<T, keyof (AriaLabelingProps & StyleProps)>;\n} {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n ...componentProps\n } = props;\n\n return {\n ariaLabelProps: {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n },\n styleProps: {\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n },\n componentProps: componentProps as Omit<\n T,\n keyof (AriaLabelingProps & StyleProps)\n >,\n };\n}\n\nexport default separateSpectrumProps;\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAqBA,CACnCC,KAAQ,EAKR;EACA,IAAM;MACJ,YAAY,EAAEC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC,eAAe;MACnC,cAAc,EAAEC,UAAU;MAE1BC,OAAO;MACPC,OAAO;MACPC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC,SAAS;MACTC,QAAQ;MACRC,SAAS;MACTC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,UAAU;MACVC,OAAO;MACPC,eAAe;MACfC,aAAa;MACbC,YAAY;MACZC,UAAU;MACVC,QAAQ;MACRC,MAAM;MACNC,GAAG;MACHC,MAAM;MACNC,KAAK;MACLC,GAAG;MACHC,IAAI;MACJC,KAAK;MACLC;IAEF,CAAC,GAAGnC,KAAK;IADJoC,cAAc,GAAAC,wBAAA,CACfrC,KAAK,EAAAsC,SAAA;EAET,OAAO;IACLC,cAAc,EAAE;MACd,YAAY,EAAEtC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC,eAAe;MACnC,cAAc,EAAEC;IAClB,CAAC;IACDoC,UAAU,EAAE;MACVnC,OAAO;MACPC,OAAO;MACPC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC,SAAS;MACTC,QAAQ;MACRC,SAAS;MACTC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,UAAU;MACVC,OAAO;MACPC,eAAe;MACfC,aAAa;MACbC,YAAY;MACZC,UAAU;MACVC,QAAQ;MACRC,MAAM;MACNC,GAAG;MACHC,MAAM;MACNC,KAAK;MACLC,GAAG;MACHC,IAAI;MACJC,KAAK;MACLC;IACF,CAAC;IACDC,cAAc,EAAEA;EAIlB,CAAC;AACH;AAEA,eAAerC,qBAAqB"
|
|
1
|
+
{"version":3,"file":"propsUtils.js","names":["separateSpectrumProps","props","ariaLabel","ariaLabelledby","ariaDescribedby","ariaHidden","marginX","marginY","width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","justifySelf","alignSelf","order","gridArea","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","position","zIndex","top","bottom","start","end","left","right","isHidden","componentProps","_objectWithoutProperties","_excluded","ariaLabelProps","styleProps"],"sources":["../../../src/spectrum/utils/propsUtils.ts"],"sourcesContent":["import type { AriaLabelingProps, StyleProps } from '@react-types/shared';\n\n/**\n * Separate props for Spectrum components into AriaLabelingProps, StyleProps, and\n * any remaining props.\n * @param props The props to separate\n * @returns The separated props\n */\nexport function separateSpectrumProps<T extends AriaLabelingProps & StyleProps>(\n props: T\n): {\n ariaLabelProps: AriaLabelingProps;\n styleProps: StyleProps;\n componentProps: Omit<T, keyof (AriaLabelingProps & StyleProps)>;\n} {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n ...componentProps\n } = props;\n\n return {\n ariaLabelProps: {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n },\n styleProps: {\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n },\n componentProps: componentProps as Omit<\n T,\n keyof (AriaLabelingProps & StyleProps)\n >,\n };\n}\n\nexport default separateSpectrumProps;\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAqBA,CACnCC,KAAQ,EAKR;EACA,IAAM;MACJ,YAAY,EAAEC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC,eAAe;MACnC,cAAc,EAAEC,UAAU;MAE1BC,OAAO;MACPC,OAAO;MACPC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC,SAAS;MACTC,QAAQ;MACRC,SAAS;MACTC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,UAAU;MACVC,OAAO;MACPC,eAAe;MACfC,aAAa;MACbC,YAAY;MACZC,UAAU;MACVC,QAAQ;MACRC,MAAM;MACNC,GAAG;MACHC,MAAM;MACNC,KAAK;MACLC,GAAG;MACHC,IAAI;MACJC,KAAK;MACLC;IAEF,CAAC,GAAGnC,KAAK;IADJoC,cAAc,GAAAC,wBAAA,CACfrC,KAAK,EAAAsC,SAAA;EAET,OAAO;IACLC,cAAc,EAAE;MACd,YAAY,EAAEtC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC,eAAe;MACnC,cAAc,EAAEC;IAClB,CAAC;IACDoC,UAAU,EAAE;MACVnC,OAAO;MACPC,OAAO;MACPC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC,SAAS;MACTC,QAAQ;MACRC,SAAS;MACTC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,UAAU;MACVC,OAAO;MACPC,eAAe;MACfC,aAAa;MACbC,YAAY;MACZC,UAAU;MACVC,QAAQ;MACRC,MAAM;MACNC,GAAG;MACHC,MAAM;MACNC,KAAK;MACLC,GAAG;MACHC,IAAI;MACJC,KAAK;MACLC;IACF,CAAC;IACDC,cAAc,EAAEA;EAIlB,CAAC;AACH;AAEA,eAAerC,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeUtils.js","names":["theme","themeSpectrumClassesCommon","useStyleProps","baseStyleProps","viewStyleProps","global","light","dark","medium","large","themeDHDefault","_objectSpread"],"sources":["../../../src/spectrum/utils/themeUtils.ts"],"sourcesContent":["import { theme } from '@react-spectrum/theme-default';\nimport { themeSpectrumClassesCommon } from '../../theme/theme-spectrum';\n\nexport {\n useStyleProps,\n baseStyleProps,\n viewStyleProps,\n} from '@react-spectrum/utils';\n\nconst { global, light, dark, medium, large } = theme;\n\n/**\n * Extend light + dark theme variables with DH defaults.\n *\n * A theme is just a mapped collection of css class names that are generated\n * from a collection of css modules.\n *\n * e.g.\n * {\n * global: {\n * spectrum: 'spectrum_9e130c',\n * 'spectrum--medium': 'spectrum--medium_9e130c',\n * 'spectrum--large': 'spectrum--large_9e130c',\n * 'spectrum--darkest': 'spectrum--darkest_9e130c',\n * 'spectrum--dark': 'spectrum--dark_9e130c',\n * 'spectrum--light': 'spectrum--light_9e130c',\n * 'spectrum--lightest': 'spectrum--lightest_9e130c',\n * },\n * light: {\n * 'spectrum--light': 'spectrum--light_a40724',\n * 'dh-spectrum-theme--light': '_dh-spectrum-theme--light_1hblg_22',\n * },\n * dark: {\n * 'spectrum--darkest': 'spectrum--darkest_256eeb',\n * 'dh-spectrum-theme--dark': '_dh-spectrum-theme--dark_f7kge_22',\n * },\n * medium: {\n * 'spectrum--medium': 'spectrum--medium_4b172c',\n * },\n * large: {\n * 'spectrum--large': 'spectrum--large_c40598',\n * },\n * }\n */\n/* eslint-disable import/prefer-default-export */\nexport const themeDHDefault = {\n global,\n light: {\n ...light,\n ...themeSpectrumClassesCommon,\n },\n dark: {\n ...dark,\n ...themeSpectrumClassesCommon,\n },\n // scales\n medium,\n large,\n};\n"],"mappings":";;;;;AAAA,SAASA,KAAK,QAAQ,+BAA+B;AAAC,SAC7CC,0BAA0B;AAEnC,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,QACT,uBAAuB;AAE9B,IAAM;EAAEC,MAAM;EAAEC,KAAK;EAAEC,IAAI;EAAEC,MAAM;EAAEC;AAAM,CAAC,GAAGT,KAAK;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMU,cAAc,GAAG;EAC5BL,MAAM;EACNC,KAAK,EAAAK,aAAA,CAAAA,aAAA,KACAL,KAAK,GACLL,0BAA0B,CAC9B;EACDM,IAAI,EAAAI,aAAA,CAAAA,aAAA,KACCJ,IAAI,GACJN,0BAA0B,CAC9B;EACD;EACAO,MAAM;EACNC;AACF,CAAC"
|
|
1
|
+
{"version":3,"file":"themeUtils.js","names":["theme","themeSpectrumClassesCommon","useStyleProps","baseStyleProps","viewStyleProps","global","light","dark","medium","large","themeDHDefault","_objectSpread"],"sources":["../../../src/spectrum/utils/themeUtils.ts"],"sourcesContent":["import { theme } from '@react-spectrum/theme-default';\nimport { themeSpectrumClassesCommon } from '../../theme/theme-spectrum';\n\nexport {\n useStyleProps,\n baseStyleProps,\n viewStyleProps,\n} from '@react-spectrum/utils';\n\nconst { global, light, dark, medium, large } = theme;\n\n/**\n * Extend light + dark theme variables with DH defaults.\n *\n * A theme is just a mapped collection of css class names that are generated\n * from a collection of css modules.\n *\n * e.g.\n * {\n * global: {\n * spectrum: 'spectrum_9e130c',\n * 'spectrum--medium': 'spectrum--medium_9e130c',\n * 'spectrum--large': 'spectrum--large_9e130c',\n * 'spectrum--darkest': 'spectrum--darkest_9e130c',\n * 'spectrum--dark': 'spectrum--dark_9e130c',\n * 'spectrum--light': 'spectrum--light_9e130c',\n * 'spectrum--lightest': 'spectrum--lightest_9e130c',\n * },\n * light: {\n * 'spectrum--light': 'spectrum--light_a40724',\n * 'dh-spectrum-theme--light': '_dh-spectrum-theme--light_1hblg_22',\n * },\n * dark: {\n * 'spectrum--darkest': 'spectrum--darkest_256eeb',\n * 'dh-spectrum-theme--dark': '_dh-spectrum-theme--dark_f7kge_22',\n * },\n * medium: {\n * 'spectrum--medium': 'spectrum--medium_4b172c',\n * },\n * large: {\n * 'spectrum--large': 'spectrum--large_c40598',\n * },\n * }\n */\n/* eslint-disable import/prefer-default-export */\nexport const themeDHDefault = {\n global,\n light: {\n ...light,\n ...themeSpectrumClassesCommon,\n },\n dark: {\n ...dark,\n ...themeSpectrumClassesCommon,\n },\n // scales\n medium,\n large,\n};\n"],"mappings":";;;;;AAAA,SAASA,KAAK,QAAQ,+BAA+B;AAAC,SAC7CC,0BAA0B;AAEnC,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,QACT,uBAAuB;AAE9B,IAAM;EAAEC,MAAM;EAAEC,KAAK;EAAEC,IAAI;EAAEC,MAAM;EAAEC;AAAM,CAAC,GAAGT,KAAK;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMU,cAAc,GAAG;EAC5BL,MAAM;EACNC,KAAK,EAAAK,aAAA,CAAAA,aAAA,KACAL,KAAK,GACLL,0BAA0B,CAC9B;EACDM,IAAI,EAAAI,aAAA,CAAAA,aAAA,KACCJ,IAAI,GACJN,0BAA0B,CAC9B;EACD;EACAO,MAAM;EACNC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOnChangeTrackUncontrolled.js","names":["useCallback","useState","useOnChangeTrackUncontrolled","_ref","defaultSelectedKey","selectedKey","onChange","onChangeHandler","isUncontrolled","undefined","uncontrolledSelectedKey","setUncontrolledSelectedKey","onChangeMaybeUncontrolled","key","selectedKeyMaybeUncontrolled"],"sources":["../../../src/spectrum/utils/useOnChangeTrackUncontrolled.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { type ItemKey } from './itemUtils';\n\nexport interface UseOnChangeTrackUncontrolledOptions {\n defaultSelectedKey?: ItemKey;\n selectedKey?: ItemKey | null;\n onChange?: (key: ItemKey | null) => void;\n}\n\nexport interface UseOnChangeTrackUncontrolledResult {\n selectedKeyMaybeUncontrolled?: ItemKey | null;\n onChangeMaybeUncontrolled: (key: ItemKey | null) => void;\n}\n\n/**\n * Returns a selectedKey and onChange handler that can manage selection state\n * for both controlled and uncontrolled components. Useful for cases where a\n * component needs to always track its selection state regardless of its\n * controlled / uncontrolled status.\n */\nexport function useOnChangeTrackUncontrolled({\n defaultSelectedKey,\n selectedKey,\n onChange: onChangeHandler,\n}: UseOnChangeTrackUncontrolledOptions): UseOnChangeTrackUncontrolledResult {\n // `null` is a valid value for `selectedKey` in controlled mode, so we check\n // for explicit `undefined` to identify uncontrolled mode.\n const isUncontrolled = selectedKey === undefined;\n const [uncontrolledSelectedKey, setUncontrolledSelectedKey] = useState<\n ItemKey | null | undefined\n >(defaultSelectedKey);\n\n const onChangeMaybeUncontrolled = useCallback(\n (key: ItemKey | null): void => {\n // If our component is uncontrolled, track the selected key internally\n if (isUncontrolled) {\n setUncontrolledSelectedKey(key);\n }\n\n onChangeHandler?.(key);\n },\n [isUncontrolled, onChangeHandler]\n );\n\n return {\n selectedKeyMaybeUncontrolled: isUncontrolled\n ? uncontrolledSelectedKey\n : selectedKey,\n onChangeMaybeUncontrolled,\n };\n}\n\nexport default useOnChangeTrackUncontrolled;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAc7C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAAC,IAAA,EAIgC;EAAA,IAJ/B;IAC3CC,kBAAkB;IAClBC,WAAW;IACXC,QAAQ,EAAEC;EACyB,CAAC,GAAAJ,IAAA;EACpC;EACA;EACA,IAAMK,cAAc,GAAGH,WAAW,KAAKI,SAAS;EAChD,IAAM,CAACC,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGV,QAAQ,CAEpEG,kBAAkB,CAAC;EAErB,IAAMQ,yBAAyB,GAAGZ,WAAW,CAC1Ca,GAAmB,IAAW;IAC7B;IACA,IAAIL,cAAc,EAAE;MAClBG,0BAA0B,CAACE,GAAG,CAAC;IACjC;IAEAN,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAGM,GAAG,CAAC;EACxB,CAAC,EACD,CAACL,cAAc,EAAED,eAAe,CAClC,CAAC;EAED,OAAO;IACLO,4BAA4B,EAAEN,cAAc,GACxCE,uBAAuB,GACvBL,WAAW;IACfO;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B"
|
|
1
|
+
{"version":3,"file":"useOnChangeTrackUncontrolled.js","names":["useCallback","useState","useOnChangeTrackUncontrolled","_ref","defaultSelectedKey","selectedKey","onChange","onChangeHandler","isUncontrolled","undefined","uncontrolledSelectedKey","setUncontrolledSelectedKey","onChangeMaybeUncontrolled","key","selectedKeyMaybeUncontrolled"],"sources":["../../../src/spectrum/utils/useOnChangeTrackUncontrolled.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { type ItemKey } from './itemUtils';\n\nexport interface UseOnChangeTrackUncontrolledOptions {\n defaultSelectedKey?: ItemKey;\n selectedKey?: ItemKey | null;\n onChange?: (key: ItemKey | null) => void;\n}\n\nexport interface UseOnChangeTrackUncontrolledResult {\n selectedKeyMaybeUncontrolled?: ItemKey | null;\n onChangeMaybeUncontrolled: (key: ItemKey | null) => void;\n}\n\n/**\n * Returns a selectedKey and onChange handler that can manage selection state\n * for both controlled and uncontrolled components. Useful for cases where a\n * component needs to always track its selection state regardless of its\n * controlled / uncontrolled status.\n */\nexport function useOnChangeTrackUncontrolled({\n defaultSelectedKey,\n selectedKey,\n onChange: onChangeHandler,\n}: UseOnChangeTrackUncontrolledOptions): UseOnChangeTrackUncontrolledResult {\n // `null` is a valid value for `selectedKey` in controlled mode, so we check\n // for explicit `undefined` to identify uncontrolled mode.\n const isUncontrolled = selectedKey === undefined;\n const [uncontrolledSelectedKey, setUncontrolledSelectedKey] = useState<\n ItemKey | null | undefined\n >(defaultSelectedKey);\n\n const onChangeMaybeUncontrolled = useCallback(\n (key: ItemKey | null): void => {\n // If our component is uncontrolled, track the selected key internally\n if (isUncontrolled) {\n setUncontrolledSelectedKey(key);\n }\n\n onChangeHandler?.(key);\n },\n [isUncontrolled, onChangeHandler]\n );\n\n return {\n selectedKeyMaybeUncontrolled: isUncontrolled\n ? uncontrolledSelectedKey\n : selectedKey,\n onChangeMaybeUncontrolled,\n };\n}\n\nexport default useOnChangeTrackUncontrolled;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAc7C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAAC,IAAA,EAIgC;EAAA,IAJ/B;IAC3CC,kBAAkB;IAClBC,WAAW;IACXC,QAAQ,EAAEC;EACyB,CAAC,GAAAJ,IAAA;EACpC;EACA;EACA,IAAMK,cAAc,GAAGH,WAAW,KAAKI,SAAS;EAChD,IAAM,CAACC,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGV,QAAQ,CAEpEG,kBAAkB,CAAC;EAErB,IAAMQ,yBAAyB,GAAGZ,WAAW,CAC1Ca,GAAmB,IAAW;IAC7B;IACA,IAAIL,cAAc,EAAE;MAClBG,0BAA0B,CAACE,GAAG,CAAC;IACjC;IAEAN,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAGM,GAAG,CAAC;EACxB,CAAC,EACD,CAACL,cAAc,EAAED,eAAe,CAClC,CAAC;EAED,OAAO;IACLO,4BAA4B,EAAEN,cAAc,GACxCE,uBAAuB,GACvBL,WAAW;IACfO;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRenderNormalizedItem.js","names":["isElementOfType","useCallback","ActionGroup","ActionMenu","ItemContent","ListActionGroup","ListActionMenu","Item","getItemKey","ITEM_EMPTY_STRING_TEXT_VALUE","wrapIcon","wrapPrimitiveWithText","jsx","_jsx","jsxs","_jsxs","useRenderNormalizedItem","_ref","itemIconSlot","showItemDescriptions","showItemIcons","tooltipOptions","actions","normalizedItem","_normalizedItem$item","_normalizedItem$item$","_normalizedItem$item2","_normalizedItem$item3","_normalizedItem$item4","itemKey","content","item","textValue","undefined","String","description","icon","action","_objectSpread","props","onAction","key","onChange","keys","_actions$props$onChan","_actions$props","call","onOpenChange","isOpen","_actions$props$onOpen","_actions$props2","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { isElementOfType } from '@deephaven/react-hooks';\nimport { type Key, type ReactElement, useCallback } from 'react';\nimport ActionGroup from '../ActionGroup';\nimport ActionMenu from '../ActionMenu';\nimport { ItemContent } from '../ItemContent';\nimport { ListActionGroup, type ListActionGroupProps } from '../ListActionGroup';\nimport { ListActionMenu, type ListActionMenuProps } from '../ListActionMenu';\nimport { Item } from '../shared';\nimport {\n getItemKey,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n type ItemIconSlot,\n type NormalizedItem,\n type TooltipOptions,\n} from './itemUtils';\nimport { wrapIcon, wrapPrimitiveWithText } from './itemWrapperUtils';\n\nexport type ListActions<T> =\n | ReactElement<ListActionGroupProps<T>>\n | ReactElement<ListActionMenuProps<T>>;\n\nexport interface UseRenderNormalizedItemOptions {\n itemIconSlot: ItemIconSlot;\n showItemDescriptions: boolean;\n showItemIcons: boolean;\n tooltipOptions: TooltipOptions | null;\n actions?: ListActions<unknown>;\n}\n\n/**\n * Returns a render function that can be used to render a normalized item in\n * collection components.\n * @param itemIconSlot Slot to use for item icons\n * @param showItemDescriptions Whether to show item descriptions\n * @param showItemIcons Whether to show item icons\n * @param tooltipOptions Tooltip options to use when rendering the item\n * @param actions Optional actions to render with the item\n * @returns Render function for normalized items\n */\nexport function useRenderNormalizedItem({\n itemIconSlot,\n showItemDescriptions,\n showItemIcons,\n tooltipOptions,\n actions,\n}: UseRenderNormalizedItemOptions): (\n normalizedItem: NormalizedItem\n) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const itemKey = getItemKey(normalizedItem);\n const content = wrapPrimitiveWithText(normalizedItem.item?.content);\n const textValue =\n normalizedItem.item?.textValue ??\n (itemKey == null ? undefined : String(itemKey));\n\n const description = showItemDescriptions\n ? wrapPrimitiveWithText(normalizedItem.item?.description, 'description')\n : null;\n\n const icon = showItemIcons\n ? wrapIcon(normalizedItem.item?.icon, itemIconSlot)\n : null;\n\n let action = null;\n\n if (isElementOfType(actions, ListActionGroup)) {\n action = (\n <ActionGroup\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onChange={keys => actions.props.onChange?.(keys, itemKey)}\n />\n );\n } else if (isElementOfType(actions, ListActionMenu)) {\n action = (\n <ActionMenu\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onOpenChange={isOpen =>\n actions.props.onOpenChange?.(isOpen, itemKey)\n }\n />\n );\n }\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other components that use this hook.\n key={itemKey as Key}\n // The `textValue` prop gets used to provide the content of `<option>`\n // elements that back the Spectrum Picker. These are not visible in the UI,\n // but are used for accessibility purposes, so we set to an arbitrary\n // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.\n textValue={\n textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue\n }\n >\n <ItemContent tooltipOptions={tooltipOptions}>\n {icon}\n {content}\n {description}\n {action}\n </ItemContent>\n </Item>\n );\n },\n [actions, itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]\n );\n}\n\nexport default useRenderNormalizedItem;\n"],"mappings":";;;;;AAAA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAAsCC,WAAW,QAAQ,OAAO;AAAC,OAC1DC,WAAW;AAAA,OACXC,UAAU;AAAA,SACRC,WAAW;AAA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AAGuB,SACnD;MAAAmB,QAAA,eAEDpC,KAAA,CAACX,WAAW;QAACiB,cAAc,EAAEA,cAAe;QAAA8B,QAAA,GACzCf,IAAI,EACJN,OAAO,EACPK,WAAW,EACXE,MAAM;MAAA,CACI;IAAC,GAdTR,OAeD,CAAC;EAEX,CAAC,EACD,CAACP,OAAO,EAAEJ,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,cAAc,CAC7E,CAAC;AACH;AAEA,eAAeL,uBAAuB"
|
|
1
|
+
{"version":3,"file":"useRenderNormalizedItem.js","names":["isElementOfType","useCallback","ActionGroup","ActionMenu","ItemContent","ListActionGroup","ListActionMenu","Item","getItemKey","ITEM_EMPTY_STRING_TEXT_VALUE","wrapIcon","wrapPrimitiveWithText","jsx","_jsx","jsxs","_jsxs","useRenderNormalizedItem","_ref","itemIconSlot","showItemDescriptions","showItemIcons","tooltipOptions","actions","normalizedItem","_normalizedItem$item","_normalizedItem$item$","_normalizedItem$item2","_normalizedItem$item3","_normalizedItem$item4","itemKey","content","item","textValue","undefined","String","description","icon","action","_objectSpread","props","onAction","key","onChange","keys","_actions$props$onChan","_actions$props","call","onOpenChange","isOpen","_actions$props$onOpen","_actions$props2","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { isElementOfType } from '@deephaven/react-hooks';\nimport { type Key, type ReactElement, useCallback } from 'react';\nimport ActionGroup from '../ActionGroup';\nimport ActionMenu from '../ActionMenu';\nimport { ItemContent } from '../ItemContent';\nimport { ListActionGroup, type ListActionGroupProps } from '../ListActionGroup';\nimport { ListActionMenu, type ListActionMenuProps } from '../ListActionMenu';\nimport { Item } from '../shared';\nimport {\n getItemKey,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n type ItemIconSlot,\n type NormalizedItem,\n type TooltipOptions,\n} from './itemUtils';\nimport { wrapIcon, wrapPrimitiveWithText } from './itemWrapperUtils';\n\nexport type ListActions<T> =\n | ReactElement<ListActionGroupProps<T>>\n | ReactElement<ListActionMenuProps<T>>;\n\nexport interface UseRenderNormalizedItemOptions {\n itemIconSlot: ItemIconSlot;\n showItemDescriptions: boolean;\n showItemIcons: boolean;\n tooltipOptions: TooltipOptions | null;\n actions?: ListActions<unknown>;\n}\n\n/**\n * Returns a render function that can be used to render a normalized item in\n * collection components.\n * @param itemIconSlot Slot to use for item icons\n * @param showItemDescriptions Whether to show item descriptions\n * @param showItemIcons Whether to show item icons\n * @param tooltipOptions Tooltip options to use when rendering the item\n * @param actions Optional actions to render with the item\n * @returns Render function for normalized items\n */\nexport function useRenderNormalizedItem({\n itemIconSlot,\n showItemDescriptions,\n showItemIcons,\n tooltipOptions,\n actions,\n}: UseRenderNormalizedItemOptions): (\n normalizedItem: NormalizedItem\n) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const itemKey = getItemKey(normalizedItem);\n const content = wrapPrimitiveWithText(normalizedItem.item?.content);\n const textValue =\n normalizedItem.item?.textValue ??\n (itemKey == null ? undefined : String(itemKey));\n\n const description = showItemDescriptions\n ? wrapPrimitiveWithText(normalizedItem.item?.description, 'description')\n : null;\n\n const icon = showItemIcons\n ? wrapIcon(normalizedItem.item?.icon, itemIconSlot)\n : null;\n\n let action = null;\n\n if (isElementOfType(actions, ListActionGroup)) {\n action = (\n <ActionGroup\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onChange={keys => actions.props.onChange?.(keys, itemKey)}\n />\n );\n } else if (isElementOfType(actions, ListActionMenu)) {\n action = (\n <ActionMenu\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onOpenChange={isOpen =>\n actions.props.onOpenChange?.(isOpen, itemKey)\n }\n />\n );\n }\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other components that use this hook.\n key={itemKey as Key}\n // The `textValue` prop gets used to provide the content of `<option>`\n // elements that back the Spectrum Picker. These are not visible in the UI,\n // but are used for accessibility purposes, so we set to an arbitrary\n // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.\n textValue={\n textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue\n }\n >\n <ItemContent tooltipOptions={tooltipOptions}>\n {icon}\n {content}\n {description}\n {action}\n </ItemContent>\n </Item>\n );\n },\n [actions, itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]\n );\n}\n\nexport default useRenderNormalizedItem;\n"],"mappings":";;;;;AAAA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAAsCC,WAAW,QAAQ,OAAO;AAAC,OAC1DC,WAAW;AAAA,OACXC,UAAU;AAAA,SACRC,WAAW;AAAA,SACXC,eAAe;AAAA,SACfC,cAAc;AAAA,SACdC,IAAI;AAAA,SAEXC,UAAU,EACVC,4BAA4B;AAAA,SAKrBC,QAAQ,EAAEC,qBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAcxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAAC,IAAA,EAQtB;EAAA,IARuB;IACtCC,YAAY;IACZC,oBAAoB;IACpBC,aAAa;IACbC,cAAc;IACdC;EAC8B,CAAC,GAAAL,IAAA;EAG/B,OAAOhB,WAAW,CACfsB,cAA8B,IAAK;IAAA,IAAAC,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IAClC,IAAMC,OAAO,GAAGrB,UAAU,CAACe,cAAc,CAAC;IAC1C,IAAMO,OAAO,GAAGnB,qBAAqB,EAAAa,oBAAA,GAACD,cAAc,CAACQ,IAAI,cA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+B,MAAM,gBACJxB,IAAA,CAACV;MACC;MAAA,EAAAmC,aAAA,CAAAA,aAAA,KACIhB,OAAO,CAACiB,KAAK;QACjBC,QAAQ,EAAEC,GAAG,IAAInB,OAAO,CAACiB,KAAK,CAACC,QAAQ,CAACC,GAAG,EAAEZ,OAAO,CAAE;QACtDkB,YAAY,EAAEC,MAAM;UAAA,IAAAC,qBAAA,EAAAC,eAAA;UAAA,QAAAD,qBAAA,GAClB,CAAAC,eAAA,GAAA5B,OAAO,CAACiB,KAAK,EAACQ,YAAY,cAAAE,qBAAA,uBAA1BA,qBAAA,CAAAH,IAAA,CAAAI,eAAA,EAA6BF,MAAM,EAAEnB,OAAO,CAAC;QAAA;MAC9C,EACF,CACF;IACH;IAEA,oBACEhB,IAAA,CAACN;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;MAEA;MACA;MACA;MACA;MACAyB,SAAS,EACPA,SAAS,KAAK,EAAE,GAAGvB,4BAA4B,GAAGuB,SACnD;MAAAmB,QAAA,eAEDpC,KAAA,CAACX,WAAW;QAACiB,cAAc,EAAEA,cAAe;QAAA8B,QAAA,GACzCf,IAAI,EACJN,OAAO,EACPK,WAAW,EACXE,MAAM;MAAA,CACI;IAAC,GAdTR,OAeD,CAAC;EAEX,CAAC,EACD,CAACP,OAAO,EAAEJ,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,cAAc,CAC7E,CAAC;AACH;AAEA,eAAeL,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStaticItemInitialScrollPosition.js","names":["useCallback","useMemo","getPositionOfSelectedItemElement","isItemElementWithDescription","isSectionElement","useStaticItemInitialScrollPosition","_ref","itemHeight","selectedKey","topOffset","items","disableScrollOnOpen","some","item","getInitialScrollPosition","_asyncToGenerator"],"sources":["../../../src/spectrum/utils/useStaticItemInitialScrollPosition.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport {\n getPositionOfSelectedItemElement,\n isItemElementWithDescription,\n isSectionElement,\n type ItemElement,\n type ItemKey,\n type SectionElement,\n} from './itemUtils';\n\nexport interface UseStaticItemInitialScrollPositionOptions {\n itemHeight: number;\n items: (ItemElement<unknown> | SectionElement<unknown>)[];\n selectedKey?: ItemKey | null;\n topOffset: number;\n}\n\nexport function useStaticItemInitialScrollPosition({\n itemHeight,\n selectedKey,\n topOffset,\n items,\n}: UseStaticItemInitialScrollPositionOptions): () => Promise<number | null> {\n // Item descriptions and Section elements introduce variable item heights.\n // This throws off scroll position calculations, so we disable auto scrolling\n // if either of these are found.\n const disableScrollOnOpen = useMemo(\n () =>\n items.some(\n item => isSectionElement(item) || isItemElementWithDescription(item)\n ),\n [items]\n );\n\n const getInitialScrollPosition = useCallback(\n async () =>\n disableScrollOnOpen\n ? topOffset\n : getPositionOfSelectedItemElement({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n }),\n [disableScrollOnOpen, itemHeight, items, selectedKey, topOffset]\n );\n\n return getInitialScrollPosition;\n}\n\nexport default useStaticItemInitialScrollPosition;\n"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAE3CC,gCAAgC,EAChCC,4BAA4B,EAC5BC,gBAAgB;AAalB,OAAO,SAASC,kCAAkCA,CAAAC,IAAA,EAK0B;EAAA,IALzB;IACjDC,UAAU;IACVC,WAAW;IACXC,SAAS;IACTC;EACyC,CAAC,GAAAJ,IAAA;EAC1C;EACA;EACA;EACA,IAAMK,mBAAmB,GAAGV,OAAO,CACjC,MACES,KAAK,CAACE,IAAI,CACRC,IAAI,IAAIT,gBAAgB,CAACS,IAAI,CAAC,IAAIV,4BAA4B,CAACU,IAAI,CACrE,CAAC,EACH,CAACH,KAAK,CACR,CAAC;EAED,IAAMI,wBAAwB,GAAGd,WAAW,eAAAe,iBAAA,CAC1C;IAAA,OACEJ,mBAAmB,GACfF,SAAS,GACTP,gCAAgC,CAAC;MAC/BQ,KAAK;MACLH,UAAU;MACVC,WAAW;MACXC;IACF,CAAC,CAAC;EAAA,IACR,CAACE,mBAAmB,EAAEJ,UAAU,EAAEG,KAAK,EAAEF,WAAW,EAAEC,SAAS,CACjE,CAAC;EAED,OAAOK,wBAAwB;AACjC;AAEA,eAAeT,kCAAkC"
|
|
1
|
+
{"version":3,"file":"useStaticItemInitialScrollPosition.js","names":["useCallback","useMemo","getPositionOfSelectedItemElement","isItemElementWithDescription","isSectionElement","useStaticItemInitialScrollPosition","_ref","itemHeight","selectedKey","topOffset","items","disableScrollOnOpen","some","item","getInitialScrollPosition","_asyncToGenerator"],"sources":["../../../src/spectrum/utils/useStaticItemInitialScrollPosition.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport {\n getPositionOfSelectedItemElement,\n isItemElementWithDescription,\n isSectionElement,\n type ItemElement,\n type ItemKey,\n type SectionElement,\n} from './itemUtils';\n\nexport interface UseStaticItemInitialScrollPositionOptions {\n itemHeight: number;\n items: (ItemElement<unknown> | SectionElement<unknown>)[];\n selectedKey?: ItemKey | null;\n topOffset: number;\n}\n\nexport function useStaticItemInitialScrollPosition({\n itemHeight,\n selectedKey,\n topOffset,\n items,\n}: UseStaticItemInitialScrollPositionOptions): () => Promise<number | null> {\n // Item descriptions and Section elements introduce variable item heights.\n // This throws off scroll position calculations, so we disable auto scrolling\n // if either of these are found.\n const disableScrollOnOpen = useMemo(\n () =>\n items.some(\n item => isSectionElement(item) || isItemElementWithDescription(item)\n ),\n [items]\n );\n\n const getInitialScrollPosition = useCallback(\n async () =>\n disableScrollOnOpen\n ? topOffset\n : getPositionOfSelectedItemElement({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n }),\n [disableScrollOnOpen, itemHeight, items, selectedKey, topOffset]\n );\n\n return getInitialScrollPosition;\n}\n\nexport default useStaticItemInitialScrollPosition;\n"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAE3CC,gCAAgC,EAChCC,4BAA4B,EAC5BC,gBAAgB;AAalB,OAAO,SAASC,kCAAkCA,CAAAC,IAAA,EAK0B;EAAA,IALzB;IACjDC,UAAU;IACVC,WAAW;IACXC,SAAS;IACTC;EACyC,CAAC,GAAAJ,IAAA;EAC1C;EACA;EACA;EACA,IAAMK,mBAAmB,GAAGV,OAAO,CACjC,MACES,KAAK,CAACE,IAAI,CACRC,IAAI,IAAIT,gBAAgB,CAACS,IAAI,CAAC,IAAIV,4BAA4B,CAACU,IAAI,CACrE,CAAC,EACH,CAACH,KAAK,CACR,CAAC;EAED,IAAMI,wBAAwB,GAAGd,WAAW,eAAAe,iBAAA,CAC1C;IAAA,OACEJ,mBAAmB,GACfF,SAAS,GACTP,gCAAgC,CAAC;MAC/BQ,KAAK;MACLH,UAAU;MACVC,WAAW;MACXC;IACF,CAAC,CAAC;EAAA,IACR,CAACE,mBAAmB,EAAEJ,UAAU,EAAEG,KAAK,EAAEF,WAAW,EAAEC,SAAS,CACjE,CAAC;EAED,OAAOK,wBAAwB;AACjC;AAEA,eAAeT,kCAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStringifiedMultiSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedMultiSelection","_ref","normalizedItems","defaultSelectedKeys","disabledKeys","selectedKeys","onChange","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","keys","actualKeys","Set","forEach","item","has","String","add"],"sources":["../../../src/spectrum/utils/useStringifiedMultiSelection.ts"],"sourcesContent":["import { type Key, useCallback, useMemo } from 'react';\nimport {\n getItemKey,\n type ItemKey,\n type ItemSelection,\n itemSelectionToStringSet,\n type NormalizedItem,\n} from './itemUtils';\n\nexport interface UseStringifiedMultiSelectionOptions {\n normalizedItems: NormalizedItem[];\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n}\n\nexport interface UseStringifiedMultiSelectionResult {\n /** Stringified selection keys */\n selectedStringKeys?: 'all' | Set<Key>;\n /** Stringified default selection keys */\n defaultSelectedStringKeys?: 'all' | Set<Key>;\n /** Stringified disabled keys */\n disabledStringKeys?: 'all' | Set<Key>;\n /** Handler that is called when the string key selections change */\n onStringSelectionChange: (keys: 'all' | Set<Key>) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKeys The currently selected keys in the collection.\n * @param defaultSelectedKeys The initial selected keys in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedMultiSelectionResult with stringified key sets and\n * string key selection change handler.\n */\nexport function useStringifiedMultiSelection({\n normalizedItems,\n defaultSelectedKeys,\n disabledKeys,\n selectedKeys,\n onChange,\n}: UseStringifiedMultiSelectionOptions): UseStringifiedMultiSelectionResult {\n const selectedStringKeys = useMemo(\n () => itemSelectionToStringSet(selectedKeys),\n [selectedKeys]\n );\n\n const defaultSelectedStringKeys = useMemo(\n () => itemSelectionToStringSet(defaultSelectedKeys),\n [defaultSelectedKeys]\n );\n\n const disabledStringKeys = useMemo(\n () => itemSelectionToStringSet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (keys: 'all' | Set<Key>) => {\n if (onChange == null) {\n return;\n }\n\n if (keys === 'all') {\n onChange('all');\n return;\n }\n\n const actualKeys = new Set<ItemKey>();\n\n normalizedItems.forEach(item => {\n if (keys.has(String(getItemKey(item)))) {\n actualKeys.add(getItemKey(item));\n }\n });\n\n onChange(actualKeys);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKeys,\n defaultSelectedStringKeys,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedMultiSelection;\n"],"mappings":"AAAA,SAAmBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAErDC,UAAU,EAGVC,wBAAwB;AA6B1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAAC,IAAA,EAMgC;EAAA,IAN/B;IAC3CC,eAAe;IACfC,mBAAmB;IACnBC,YAAY;IACZC,YAAY;IACZC;EACmC,CAAC,GAAAL,IAAA;EACpC,IAAMM,kBAAkB,GAAGV,OAAO,CAChC,MAAME,wBAAwB,CAACM,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMG,yBAAyB,GAAGX,OAAO,CACvC,MAAME,wBAAwB,CAACI,mBAAmB,CAAC,EACnD,CAACA,mBAAmB,CACtB,CAAC;EAED,IAAMM,kBAAkB,GAAGZ,OAAO,CAChC,MAAME,wBAAwB,CAACK,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMM,uBAAuB,GAAGd,WAAW,CACxCe,IAAsB,IAAK;IAC1B,IAAIL,QAAQ,IAAI,IAAI,EAAE;MACpB;IACF;IAEA,IAAIK,IAAI,KAAK,KAAK,EAAE;MAClBL,QAAQ,CAAC,KAAK,CAAC;MACf;IACF;IAEA,IAAMM,UAAU,GAAG,IAAIC,GAAG,CAAU,CAAC;IAErCX,eAAe,CAACY,OAAO,CAACC,IAAI,IAAI;MAC9B,IAAIJ,IAAI,CAACK,GAAG,CAACC,MAAM,CAACnB,UAAU,CAACiB,IAAI,CAAC,CAAC,CAAC,EAAE;QACtCH,UAAU,CAACM,GAAG,CAACpB,UAAU,CAACiB,IAAI,CAAC,CAAC;MAClC;IACF,CAAC,CAAC;IAEFT,QAAQ,CAACM,UAAU,CAAC;EACtB,CAAC,EACD,CAACV,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,kBAAkB;IAClBC,yBAAyB;IACzBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B"
|
|
1
|
+
{"version":3,"file":"useStringifiedMultiSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedMultiSelection","_ref","normalizedItems","defaultSelectedKeys","disabledKeys","selectedKeys","onChange","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","keys","actualKeys","Set","forEach","item","has","String","add"],"sources":["../../../src/spectrum/utils/useStringifiedMultiSelection.ts"],"sourcesContent":["import { type Key, useCallback, useMemo } from 'react';\nimport {\n getItemKey,\n type ItemKey,\n type ItemSelection,\n itemSelectionToStringSet,\n type NormalizedItem,\n} from './itemUtils';\n\nexport interface UseStringifiedMultiSelectionOptions {\n normalizedItems: NormalizedItem[];\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n}\n\nexport interface UseStringifiedMultiSelectionResult {\n /** Stringified selection keys */\n selectedStringKeys?: 'all' | Set<Key>;\n /** Stringified default selection keys */\n defaultSelectedStringKeys?: 'all' | Set<Key>;\n /** Stringified disabled keys */\n disabledStringKeys?: 'all' | Set<Key>;\n /** Handler that is called when the string key selections change */\n onStringSelectionChange: (keys: 'all' | Set<Key>) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKeys The currently selected keys in the collection.\n * @param defaultSelectedKeys The initial selected keys in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedMultiSelectionResult with stringified key sets and\n * string key selection change handler.\n */\nexport function useStringifiedMultiSelection({\n normalizedItems,\n defaultSelectedKeys,\n disabledKeys,\n selectedKeys,\n onChange,\n}: UseStringifiedMultiSelectionOptions): UseStringifiedMultiSelectionResult {\n const selectedStringKeys = useMemo(\n () => itemSelectionToStringSet(selectedKeys),\n [selectedKeys]\n );\n\n const defaultSelectedStringKeys = useMemo(\n () => itemSelectionToStringSet(defaultSelectedKeys),\n [defaultSelectedKeys]\n );\n\n const disabledStringKeys = useMemo(\n () => itemSelectionToStringSet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (keys: 'all' | Set<Key>) => {\n if (onChange == null) {\n return;\n }\n\n if (keys === 'all') {\n onChange('all');\n return;\n }\n\n const actualKeys = new Set<ItemKey>();\n\n normalizedItems.forEach(item => {\n if (keys.has(String(getItemKey(item)))) {\n actualKeys.add(getItemKey(item));\n }\n });\n\n onChange(actualKeys);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKeys,\n defaultSelectedStringKeys,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedMultiSelection;\n"],"mappings":"AAAA,SAAmBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAErDC,UAAU,EAGVC,wBAAwB;AA6B1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAAC,IAAA,EAMgC;EAAA,IAN/B;IAC3CC,eAAe;IACfC,mBAAmB;IACnBC,YAAY;IACZC,YAAY;IACZC;EACmC,CAAC,GAAAL,IAAA;EACpC,IAAMM,kBAAkB,GAAGV,OAAO,CAChC,MAAME,wBAAwB,CAACM,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMG,yBAAyB,GAAGX,OAAO,CACvC,MAAME,wBAAwB,CAACI,mBAAmB,CAAC,EACnD,CAACA,mBAAmB,CACtB,CAAC;EAED,IAAMM,kBAAkB,GAAGZ,OAAO,CAChC,MAAME,wBAAwB,CAACK,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMM,uBAAuB,GAAGd,WAAW,CACxCe,IAAsB,IAAK;IAC1B,IAAIL,QAAQ,IAAI,IAAI,EAAE;MACpB;IACF;IAEA,IAAIK,IAAI,KAAK,KAAK,EAAE;MAClBL,QAAQ,CAAC,KAAK,CAAC;MACf;IACF;IAEA,IAAMM,UAAU,GAAG,IAAIC,GAAG,CAAU,CAAC;IAErCX,eAAe,CAACY,OAAO,CAACC,IAAI,IAAI;MAC9B,IAAIJ,IAAI,CAACK,GAAG,CAACC,MAAM,CAACnB,UAAU,CAACiB,IAAI,CAAC,CAAC,CAAC,EAAE;QACtCH,UAAU,CAACM,GAAG,CAACpB,UAAU,CAACiB,IAAI,CAAC,CAAC;MAClC;IACF,CAAC,CAAC;IAEFT,QAAQ,CAACM,UAAU,CAAC;EACtB,CAAC,EACD,CAACV,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,kBAAkB;IAClBC,yBAAyB;IACzBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStringifiedSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedSelection","_ref","normalizedItems","defaultSelectedKey","selectedKey","disabledKeys","onChange","selectedStringKey","String","defaultSelectedStringKey","disabledStringKeys","onStringSelectionChange","key","_getItemKey","selectedItem","find","item","actualKey"],"sources":["../../../src/spectrum/utils/useStringifiedSelection.ts"],"sourcesContent":["import { type Key, useCallback, useMemo } from 'react';\nimport {\n getItemKey,\n type ItemKey,\n itemSelectionToStringSet,\n type NormalizedItem,\n type NormalizedSection,\n} from './itemUtils';\n\nexport interface UseStringifiedSelectionOptions {\n normalizedItems: (NormalizedItem | NormalizedSection)[];\n selectedKey: ItemKey | null | undefined;\n defaultSelectedKey: ItemKey | undefined;\n disabledKeys: Iterable<ItemKey> | undefined;\n onChange: ((key: ItemKey | null) => void) | undefined;\n}\n\nexport interface UseStringifiedSelectionResult {\n defaultSelectedStringKey?: Key;\n selectedStringKey?: Key | null;\n disabledStringKeys?: Set<Key>;\n onStringSelectionChange: (key: Key | null) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKey The currently selected key in the collection.\n * @param defaultSelectedKey The initial selected key in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedSelectionResult with stringified key sets and string\n * key selection change handler.\n */\nexport function useStringifiedSelection({\n normalizedItems,\n defaultSelectedKey,\n selectedKey,\n disabledKeys,\n onChange,\n}: UseStringifiedSelectionOptions): UseStringifiedSelectionResult {\n const selectedStringKey = useMemo(\n () => (selectedKey == null ? selectedKey : String(selectedKey)),\n [selectedKey]\n );\n\n const defaultSelectedStringKey = useMemo(\n () =>\n defaultSelectedKey == null\n ? defaultSelectedKey\n : String(defaultSelectedKey),\n [defaultSelectedKey]\n );\n\n const disabledStringKeys = useMemo(\n () => itemSelectionToStringSet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (key: Key | null): void => {\n if (onChange == null) {\n return;\n }\n\n // The `key` arg will always be a string due to us setting the `Item` key\n // prop in `renderItem`. We need to find the matching item to determine\n // the actual key.\n const selectedItem = normalizedItems.find(\n item => String(getItemKey(item)) === key\n );\n\n const actualKey = getItemKey(selectedItem) ?? key;\n\n onChange(actualKey);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKey,\n defaultSelectedStringKey,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedSelection;\n"],"mappings":"AAAA,SAAmBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAErDC,UAAU,EAEVC,wBAAwB;AAoB1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAAC,IAAA,EAM2B;EAAA,IAN1B;IACtCC,eAAe;IACfC,kBAAkB;IAClBC,WAAW;IACXC,YAAY;IACZC;EAC8B,CAAC,GAAAL,IAAA;EAC/B,IAAMM,iBAAiB,GAAGV,OAAO,CAC/B,MAAOO,WAAW,IAAI,IAAI,GAAGA,WAAW,GAAGI,MAAM,CAACJ,WAAW,CAAE,EAC/D,CAACA,WAAW,CACd,CAAC;EAED,IAAMK,wBAAwB,GAAGZ,OAAO,CACtC,MACEM,kBAAkB,IAAI,IAAI,GACtBA,kBAAkB,GAClBK,MAAM,CAACL,kBAAkB,CAAC,EAChC,CAACA,kBAAkB,CACrB,CAAC;EAED,IAAMO,kBAAkB,GAAGb,OAAO,CAChC,MAAME,wBAAwB,CAACM,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMM,uBAAuB,GAAGf,WAAW,CACxCgB,GAAe,IAAW;IAAA,IAAAC,WAAA;IACzB,IAAIP,QAAQ,IAAI,IAAI,EAAE;MACpB;IACF;;IAEA;IACA;IACA;IACA,IAAMQ,YAAY,GAAGZ,eAAe,CAACa,IAAI,CACvCC,IAAI,IAAIR,MAAM,CAACV,UAAU,CAACkB,IAAI,CAAC,CAAC,KAAKJ,GACvC,CAAC;IAED,IAAMK,SAAS,IAAAJ,WAAA,GAAGf,UAAU,CAACgB,YAAY,CAAC,cAAAD,WAAA,cAAAA,WAAA,GAAID,GAAG;IAEjDN,QAAQ,CAACW,SAAS,CAAC;EACrB,CAAC,EACD,CAACf,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,iBAAiB;IACjBE,wBAAwB;IACxBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeX,uBAAuB"
|
|
1
|
+
{"version":3,"file":"useStringifiedSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedSelection","_ref","normalizedItems","defaultSelectedKey","selectedKey","disabledKeys","onChange","selectedStringKey","String","defaultSelectedStringKey","disabledStringKeys","onStringSelectionChange","key","_getItemKey","selectedItem","find","item","actualKey"],"sources":["../../../src/spectrum/utils/useStringifiedSelection.ts"],"sourcesContent":["import { type Key, useCallback, useMemo } from 'react';\nimport {\n getItemKey,\n type ItemKey,\n itemSelectionToStringSet,\n type NormalizedItem,\n type NormalizedSection,\n} from './itemUtils';\n\nexport interface UseStringifiedSelectionOptions {\n normalizedItems: (NormalizedItem | NormalizedSection)[];\n selectedKey: ItemKey | null | undefined;\n defaultSelectedKey: ItemKey | undefined;\n disabledKeys: Iterable<ItemKey> | undefined;\n onChange: ((key: ItemKey | null) => void) | undefined;\n}\n\nexport interface UseStringifiedSelectionResult {\n defaultSelectedStringKey?: Key;\n selectedStringKey?: Key | null;\n disabledStringKeys?: Set<Key>;\n onStringSelectionChange: (key: Key | null) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKey The currently selected key in the collection.\n * @param defaultSelectedKey The initial selected key in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedSelectionResult with stringified key sets and string\n * key selection change handler.\n */\nexport function useStringifiedSelection({\n normalizedItems,\n defaultSelectedKey,\n selectedKey,\n disabledKeys,\n onChange,\n}: UseStringifiedSelectionOptions): UseStringifiedSelectionResult {\n const selectedStringKey = useMemo(\n () => (selectedKey == null ? selectedKey : String(selectedKey)),\n [selectedKey]\n );\n\n const defaultSelectedStringKey = useMemo(\n () =>\n defaultSelectedKey == null\n ? defaultSelectedKey\n : String(defaultSelectedKey),\n [defaultSelectedKey]\n );\n\n const disabledStringKeys = useMemo(\n () => itemSelectionToStringSet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (key: Key | null): void => {\n if (onChange == null) {\n return;\n }\n\n // The `key` arg will always be a string due to us setting the `Item` key\n // prop in `renderItem`. We need to find the matching item to determine\n // the actual key.\n const selectedItem = normalizedItems.find(\n item => String(getItemKey(item)) === key\n );\n\n const actualKey = getItemKey(selectedItem) ?? key;\n\n onChange(actualKey);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKey,\n defaultSelectedStringKey,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedSelection;\n"],"mappings":"AAAA,SAAmBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAErDC,UAAU,EAEVC,wBAAwB;AAoB1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAAC,IAAA,EAM2B;EAAA,IAN1B;IACtCC,eAAe;IACfC,kBAAkB;IAClBC,WAAW;IACXC,YAAY;IACZC;EAC8B,CAAC,GAAAL,IAAA;EAC/B,IAAMM,iBAAiB,GAAGV,OAAO,CAC/B,MAAOO,WAAW,IAAI,IAAI,GAAGA,WAAW,GAAGI,MAAM,CAACJ,WAAW,CAAE,EAC/D,CAACA,WAAW,CACd,CAAC;EAED,IAAMK,wBAAwB,GAAGZ,OAAO,CACtC,MACEM,kBAAkB,IAAI,IAAI,GACtBA,kBAAkB,GAClBK,MAAM,CAACL,kBAAkB,CAAC,EAChC,CAACA,kBAAkB,CACrB,CAAC;EAED,IAAMO,kBAAkB,GAAGb,OAAO,CAChC,MAAME,wBAAwB,CAACM,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMM,uBAAuB,GAAGf,WAAW,CACxCgB,GAAe,IAAW;IAAA,IAAAC,WAAA;IACzB,IAAIP,QAAQ,IAAI,IAAI,EAAE;MACpB;IACF;;IAEA;IACA;IACA;IACA,IAAMQ,YAAY,GAAGZ,eAAe,CAACa,IAAI,CACvCC,IAAI,IAAIR,MAAM,CAACV,UAAU,CAACkB,IAAI,CAAC,CAAC,KAAKJ,GACvC,CAAC;IAED,IAAMK,SAAS,IAAAJ,WAAA,GAAGf,UAAU,CAACgB,YAAY,CAAC,cAAAD,WAAA,cAAAA,WAAA,GAAID,GAAG;IAEjDN,QAAQ,CAACW,SAAS,CAAC;EACrB,CAAC,EACD,CAACf,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,iBAAiB;IACjBE,wBAAwB;IACxBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeX,uBAAuB"}
|
package/dist/theme/Logo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logo.js","names":["classNames","jsx","_jsx","Logo","_ref","className","style"],"sources":["../../src/theme/Logo.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport './Logo.css';\n\ninterface LogoProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function Logo({ className, style }: LogoProps): JSX.Element {\n return <div className={classNames('dh-logo', className)} style={style} />;\n}\n\nexport default Logo;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAAC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAQpC,OAAO,SAASC,IAAIA,CAAAC,IAAA,EAA+C;EAAA,IAA9C;IAAEC,SAAS;IAAEC;EAAiB,CAAC,GAAAF,IAAA;EAClD,oBAAOF,IAAA;IAAKG,SAAS,EAAEL,UAAU,CAAC,SAAS,EAAEK,SAAS,CAAE;IAACC,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC3E;AAEA,eAAeH,IAAI"
|
|
1
|
+
{"version":3,"file":"Logo.js","names":["classNames","jsx","_jsx","Logo","_ref","className","style"],"sources":["../../src/theme/Logo.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport './Logo.css';\n\ninterface LogoProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function Logo({ className, style }: LogoProps): JSX.Element {\n return <div className={classNames('dh-logo', className)} style={style} />;\n}\n\nexport default Logo;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAAC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAQpC,OAAO,SAASC,IAAIA,CAAAC,IAAA,EAA+C;EAAA,IAA9C;IAAEC,SAAS;IAAEC;EAAiB,CAAC,GAAAF,IAAA;EAClD,oBAAOF,IAAA;IAAKG,SAAS,EAAEL,UAAU,CAAC,SAAS,EAAEK,SAAS,CAAE;IAACC,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC3E;AAEA,eAAeH,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpectrumThemeProvider.js","names":["useState","Provider","nanoid","themeDHDefault","jsx","_jsx","SpectrumThemeProvider","_ref","children","isPortal","theme","colorScheme","zIndex","position","id","UNSAFE_className"],"sources":["../../src/theme/SpectrumThemeProvider.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\nimport { Provider } from '@adobe/react-spectrum';\nimport type { Theme } from '@react-types/provider';\nimport { nanoid } from 'nanoid';\nimport { themeDHDefault } from '../spectrum/utils';\n\nexport interface SpectrumThemeProviderProps {\n children: ReactNode;\n isPortal?: boolean;\n theme?: Theme;\n colorScheme?: 'light' | 'dark';\n zIndex?: number;\n position?: 'static' | 'absolute' | 'fixed' | 'relative' | 'sticky';\n}\n\n/**\n * Wrapper around React Spectrum's theme Provider that provides DH mappings of\n * Spectrum's theme variables to DH's theme variables. Also exposes an optional\n * `isPortal` prop that if provided, adds a unique `data-unique-id` attribute to\n * the Provider. This is needed to force the Provider to render the theme wrapper\n * inside of portals.\n */\nexport function SpectrumThemeProvider({\n children,\n isPortal = false,\n theme = themeDHDefault,\n colorScheme,\n zIndex,\n position,\n}: SpectrumThemeProviderProps): JSX.Element {\n // a unique ID is used per provider to force it to render the theme wrapper element inside portals\n // based on https://github.com/adobe/react-spectrum/issues/1697#issuecomment-999827266\n // won't be needed if https://github.com/adobe/react-spectrum/pull/2669 is merged\n const [id] = useState(isPortal ? nanoid() : null);\n\n return (\n <Provider\n UNSAFE_className=\"spectrum-theme-provider\"\n theme={theme}\n colorScheme={colorScheme}\n zIndex={zIndex}\n position={position}\n data-unique-id={id}\n >\n {children}\n </Provider>\n );\n}\n"],"mappings":"AAAA,SAAyBA,QAAQ,QAAQ,OAAO;AAChD,SAASC,QAAQ,QAAQ,uBAAuB;AAEhD,SAASC,MAAM,QAAQ,QAAQ;AAAC,SACvBC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAWvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAOO;EAAA,IAPN;IACpCC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IAChBC,KAAK,GAAGP,cAAc;IACtBQ,WAAW;IACXC,MAAM;IACNC;EAC0B,CAAC,GAAAN,IAAA;EAC3B;EACA;EACA;EACA,IAAM,CAACO,EAAE,CAAC,GAAGd,QAAQ,CAACS,QAAQ,GAAGP,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;EAEjD,oBACEG,IAAA,CAACJ,QAAQ;IACPc,gBAAgB,EAAC,yBAAyB;IAC1CL,KAAK,EAAEA,KAAM;IACbC,WAAW,EAAEA,WAAY;IACzBC,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnB,kBAAgBC,EAAG;IAAAN,QAAA,EAElBA;EAAQ,CACD,CAAC;AAEf"
|
|
1
|
+
{"version":3,"file":"SpectrumThemeProvider.js","names":["useState","Provider","nanoid","themeDHDefault","jsx","_jsx","SpectrumThemeProvider","_ref","children","isPortal","theme","colorScheme","zIndex","position","id","UNSAFE_className"],"sources":["../../src/theme/SpectrumThemeProvider.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\nimport { Provider } from '@adobe/react-spectrum';\nimport type { Theme } from '@react-types/provider';\nimport { nanoid } from 'nanoid';\nimport { themeDHDefault } from '../spectrum/utils';\n\nexport interface SpectrumThemeProviderProps {\n children: ReactNode;\n isPortal?: boolean;\n theme?: Theme;\n colorScheme?: 'light' | 'dark';\n zIndex?: number;\n position?: 'static' | 'absolute' | 'fixed' | 'relative' | 'sticky';\n}\n\n/**\n * Wrapper around React Spectrum's theme Provider that provides DH mappings of\n * Spectrum's theme variables to DH's theme variables. Also exposes an optional\n * `isPortal` prop that if provided, adds a unique `data-unique-id` attribute to\n * the Provider. This is needed to force the Provider to render the theme wrapper\n * inside of portals.\n */\nexport function SpectrumThemeProvider({\n children,\n isPortal = false,\n theme = themeDHDefault,\n colorScheme,\n zIndex,\n position,\n}: SpectrumThemeProviderProps): JSX.Element {\n // a unique ID is used per provider to force it to render the theme wrapper element inside portals\n // based on https://github.com/adobe/react-spectrum/issues/1697#issuecomment-999827266\n // won't be needed if https://github.com/adobe/react-spectrum/pull/2669 is merged\n const [id] = useState(isPortal ? nanoid() : null);\n\n return (\n <Provider\n UNSAFE_className=\"spectrum-theme-provider\"\n theme={theme}\n colorScheme={colorScheme}\n zIndex={zIndex}\n position={position}\n data-unique-id={id}\n >\n {children}\n </Provider>\n );\n}\n"],"mappings":"AAAA,SAAyBA,QAAQ,QAAQ,OAAO;AAChD,SAASC,QAAQ,QAAQ,uBAAuB;AAEhD,SAASC,MAAM,QAAQ,QAAQ;AAAC,SACvBC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAWvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAOO;EAAA,IAPN;IACpCC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IAChBC,KAAK,GAAGP,cAAc;IACtBQ,WAAW;IACXC,MAAM;IACNC;EAC0B,CAAC,GAAAN,IAAA;EAC3B;EACA;EACA;EACA,IAAM,CAACO,EAAE,CAAC,GAAGd,QAAQ,CAACS,QAAQ,GAAGP,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;EAEjD,oBACEG,IAAA,CAACJ,QAAQ;IACPc,gBAAgB,EAAC,yBAAyB;IAC1CL,KAAK,EAAEA,KAAM;IACbC,WAAW,EAAEA,WAAY;IACzBC,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnB,kBAAgBC,EAAG;IAAAN,QAAA,EAElBA;EAAQ,CACD,CAAC;AAEf"}
|