@deephaven/components 0.72.1-beta.5 → 0.72.1-core-plugins.9
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/css/BaseStyleSheet.css.map +1 -1
- package/dist/BasicModal.js +2 -2
- package/dist/BasicModal.js.map +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +12 -2
- package/dist/Button.js.map +1 -1
- package/dist/Checkbox.js +2 -2
- package/dist/Checkbox.js.map +1 -1
- package/dist/ComboBox.css.map +1 -1
- package/dist/ComponentUtils.d.ts +34 -0
- package/dist/ComponentUtils.d.ts.map +1 -0
- package/dist/ComponentUtils.js +49 -0
- package/dist/ComponentUtils.js.map +1 -0
- package/dist/CustomTimeSelect.css.map +1 -1
- package/dist/DateTimeInput.d.ts +3 -3
- package/dist/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput.js +1 -1
- package/dist/DateTimeInput.js.map +1 -1
- package/dist/DraggableItemList.css.map +1 -1
- package/dist/ErrorView.css +77 -0
- package/dist/ErrorView.css.map +1 -0
- package/dist/ErrorView.d.ts +16 -0
- package/dist/ErrorView.d.ts.map +1 -0
- package/dist/ErrorView.js +73 -0
- package/dist/ErrorView.js.map +1 -0
- package/dist/HierarchicalCheckboxMenu.css.map +1 -1
- package/dist/HierarchicalCheckboxMenu.js +1 -1
- package/dist/HierarchicalCheckboxMenu.js.map +1 -1
- package/dist/LoadingOverlay.css +2 -1
- package/dist/LoadingOverlay.css.map +1 -1
- package/dist/RadioGroup.js +2 -2
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioItem.js +2 -2
- package/dist/RadioItem.js.map +1 -1
- package/dist/SearchInput.css.map +1 -1
- package/dist/SearchableCombobox.d.ts +2 -2
- package/dist/SearchableCombobox.d.ts.map +1 -1
- package/dist/SearchableCombobox.js.map +1 -1
- package/dist/Select.d.ts +1 -1
- package/dist/SocketedButton.d.ts.map +1 -1
- package/dist/SocketedButton.js +12 -2
- package/dist/SocketedButton.js.map +1 -1
- package/dist/{ButtonGroup.d.ts → SplitButtonGroup.d.ts} +5 -5
- package/dist/SplitButtonGroup.d.ts.map +1 -0
- package/dist/{ButtonGroup.js → SplitButtonGroup.js} +6 -6
- package/dist/SplitButtonGroup.js.map +1 -0
- package/dist/TimeSlider.css.map +1 -1
- package/dist/TimeSlider.module.css.map +1 -1
- package/dist/XComponent.d.ts +38 -0
- package/dist/XComponent.d.ts.map +1 -0
- package/dist/XComponent.js +70 -0
- package/dist/XComponent.js.map +1 -0
- package/dist/XComponentMap.d.ts +15 -0
- package/dist/XComponentMap.d.ts.map +1 -0
- package/dist/XComponentMap.js +20 -0
- package/dist/XComponentMap.js.map +1 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/navigation/MenuItem.css.map +1 -1
- package/dist/navigation/NavTab.d.ts.map +1 -1
- package/dist/navigation/NavTab.js +28 -7
- package/dist/navigation/NavTab.js.map +1 -1
- package/dist/navigation/NavTabList.css.map +1 -1
- package/dist/navigation/NavTabList.d.ts +5 -0
- package/dist/navigation/NavTabList.d.ts.map +1 -1
- package/dist/navigation/NavTabList.js.map +1 -1
- package/dist/spectrum/ActionGroup.d.ts +14 -0
- package/dist/spectrum/ActionGroup.d.ts.map +1 -0
- package/dist/spectrum/ActionGroup.js +42 -0
- package/dist/spectrum/ActionGroup.js.map +1 -0
- package/dist/spectrum/ActionMenu.d.ts +15 -0
- package/dist/spectrum/ActionMenu.d.ts.map +1 -0
- package/dist/spectrum/ActionMenu.js +35 -0
- package/dist/spectrum/ActionMenu.js.map +1 -0
- package/dist/spectrum/Heading.d.ts +4 -1
- package/dist/spectrum/Heading.d.ts.map +1 -1
- package/dist/spectrum/Heading.js +5 -3
- package/dist/spectrum/Heading.js.map +1 -1
- package/dist/spectrum/ItemContent.d.ts +15 -0
- package/dist/spectrum/ItemContent.d.ts.map +1 -0
- package/dist/spectrum/{picker/PickerItemContent.js → ItemContent.js} +44 -19
- package/dist/spectrum/ItemContent.js.map +1 -0
- package/dist/spectrum/ItemTooltip.d.ts +12 -0
- package/dist/spectrum/ItemTooltip.d.ts.map +1 -0
- package/dist/spectrum/ItemTooltip.js +30 -0
- package/dist/spectrum/ItemTooltip.js.map +1 -0
- package/dist/spectrum/ListActionGroup.d.ts +19 -0
- package/dist/spectrum/ListActionGroup.d.ts.map +1 -0
- package/dist/spectrum/ListActionGroup.js +9 -0
- package/dist/spectrum/ListActionGroup.js.map +1 -0
- package/dist/spectrum/ListActionMenu.d.ts +19 -0
- package/dist/spectrum/ListActionMenu.d.ts.map +1 -0
- package/dist/spectrum/ListActionMenu.js +9 -0
- package/dist/spectrum/ListActionMenu.js.map +1 -0
- package/dist/spectrum/Text.d.ts +4 -1
- package/dist/spectrum/Text.d.ts.map +1 -1
- package/dist/spectrum/Text.js +5 -4
- package/dist/spectrum/Text.js.map +1 -1
- package/dist/spectrum/View.d.ts +20 -3
- package/dist/spectrum/View.d.ts.map +1 -1
- package/dist/spectrum/View.js +47 -10
- package/dist/spectrum/View.js.map +1 -1
- package/dist/spectrum/buttons.d.ts +1 -1
- package/dist/spectrum/buttons.d.ts.map +1 -1
- package/dist/spectrum/buttons.js +3 -1
- package/dist/spectrum/buttons.js.map +1 -1
- package/dist/spectrum/collections.d.ts +1 -1
- package/dist/spectrum/collections.d.ts.map +1 -1
- package/dist/spectrum/collections.js +12 -1
- package/dist/spectrum/collections.js.map +1 -1
- package/dist/spectrum/comboBox/ComboBox.d.ts +17 -0
- package/dist/spectrum/comboBox/ComboBox.d.ts.map +1 -0
- package/dist/spectrum/comboBox/ComboBox.js +44 -0
- package/dist/spectrum/comboBox/ComboBox.js.map +1 -0
- package/dist/spectrum/comboBox/ComboBoxNormalized.d.ts +15 -0
- package/dist/spectrum/comboBox/ComboBoxNormalized.d.ts.map +1 -0
- package/dist/spectrum/comboBox/ComboBoxNormalized.js +42 -0
- package/dist/spectrum/comboBox/ComboBoxNormalized.js.map +1 -0
- package/dist/spectrum/comboBox/index.d.ts +3 -0
- package/dist/spectrum/comboBox/index.d.ts.map +1 -0
- package/dist/spectrum/comboBox/index.js +3 -0
- package/dist/spectrum/comboBox/index.js.map +1 -0
- package/dist/spectrum/forms.d.ts +2 -1
- package/dist/spectrum/forms.d.ts.map +1 -1
- package/dist/spectrum/forms.js +1 -1
- package/dist/spectrum/forms.js.map +1 -1
- package/dist/spectrum/icons.d.ts +2 -0
- package/dist/spectrum/icons.d.ts.map +1 -0
- package/dist/spectrum/icons.js +3 -0
- package/dist/spectrum/icons.js.map +1 -0
- package/dist/spectrum/index.d.ts +9 -1
- package/dist/spectrum/index.d.ts.map +1 -1
- package/dist/spectrum/index.js +9 -1
- package/dist/spectrum/index.js.map +1 -1
- package/dist/spectrum/listView/ListView.d.ts +14 -0
- package/dist/spectrum/listView/ListView.d.ts.map +1 -0
- package/dist/spectrum/listView/ListView.js +43 -0
- package/dist/spectrum/listView/ListView.js.map +1 -0
- package/dist/spectrum/listView/ListViewNormalized.d.ts +23 -0
- package/dist/spectrum/listView/ListViewNormalized.d.ts.map +1 -0
- package/dist/spectrum/listView/ListViewNormalized.js +82 -0
- package/dist/spectrum/listView/ListViewNormalized.js.map +1 -0
- package/dist/spectrum/listView/ListViewWrapper.css +48 -0
- package/dist/spectrum/listView/ListViewWrapper.css.map +1 -0
- package/dist/spectrum/listView/ListViewWrapper.d.ts +21 -0
- package/dist/spectrum/listView/ListViewWrapper.d.ts.map +1 -0
- package/dist/spectrum/listView/ListViewWrapper.js +71 -0
- package/dist/spectrum/listView/ListViewWrapper.js.map +1 -0
- package/dist/spectrum/listView/index.d.ts +4 -0
- package/dist/spectrum/listView/index.d.ts.map +1 -0
- package/dist/spectrum/listView/index.js +4 -0
- package/dist/spectrum/listView/index.js.map +1 -0
- package/dist/spectrum/picker/Picker.d.ts +17 -31
- package/dist/spectrum/picker/Picker.d.ts.map +1 -1
- package/dist/spectrum/picker/Picker.js +31 -130
- package/dist/spectrum/picker/Picker.js.map +1 -1
- package/dist/spectrum/picker/PickerNormalized.d.ts +10 -0
- package/dist/spectrum/picker/PickerNormalized.d.ts.map +1 -0
- package/dist/spectrum/picker/PickerNormalized.js +37 -0
- package/dist/spectrum/picker/PickerNormalized.js.map +1 -0
- package/dist/spectrum/picker/PickerProps.d.ts +64 -0
- package/dist/spectrum/picker/PickerProps.d.ts.map +1 -0
- package/dist/spectrum/picker/PickerProps.js +2 -0
- package/dist/spectrum/picker/PickerProps.js.map +1 -0
- package/dist/spectrum/picker/index.d.ts +6 -1
- package/dist/spectrum/picker/index.d.ts.map +1 -1
- package/dist/spectrum/picker/index.js +6 -1
- package/dist/spectrum/picker/index.js.map +1 -1
- package/dist/spectrum/picker/useMultiRef.d.ts +9 -0
- package/dist/spectrum/picker/useMultiRef.d.ts.map +1 -0
- package/dist/spectrum/picker/useMultiRef.js +25 -0
- package/dist/spectrum/picker/useMultiRef.js.map +1 -0
- package/dist/spectrum/picker/usePickerItemScale.d.ts +9 -0
- package/dist/spectrum/picker/usePickerItemScale.d.ts.map +1 -0
- package/dist/spectrum/picker/usePickerItemScale.js +17 -0
- package/dist/spectrum/picker/usePickerItemScale.js.map +1 -0
- package/dist/spectrum/picker/usePickerNormalizedProps.d.ts +27 -0
- package/dist/spectrum/picker/usePickerNormalizedProps.d.ts.map +1 -0
- package/dist/spectrum/picker/usePickerNormalizedProps.js +101 -0
- package/dist/spectrum/picker/usePickerNormalizedProps.js.map +1 -0
- package/dist/spectrum/picker/usePickerProps.d.ts +28 -0
- package/dist/spectrum/picker/usePickerProps.d.ts.map +1 -0
- package/dist/spectrum/picker/usePickerProps.js +75 -0
- package/dist/spectrum/picker/usePickerProps.js.map +1 -0
- package/dist/spectrum/picker/usePickerScrollOnOpen.d.ts +22 -0
- package/dist/spectrum/picker/usePickerScrollOnOpen.d.ts.map +1 -0
- package/dist/spectrum/picker/usePickerScrollOnOpen.js +33 -0
- package/dist/spectrum/picker/usePickerScrollOnOpen.js.map +1 -0
- package/dist/spectrum/shared.d.ts +15 -9
- package/dist/spectrum/shared.d.ts.map +1 -1
- package/dist/spectrum/shared.js +16 -1
- package/dist/spectrum/shared.js.map +1 -1
- package/dist/spectrum/utils/index.d.ts +7 -0
- package/dist/spectrum/utils/index.d.ts.map +1 -1
- package/dist/spectrum/utils/index.js +7 -0
- package/dist/spectrum/utils/index.js.map +1 -1
- package/dist/spectrum/utils/itemUtils.d.ts +80 -27
- package/dist/spectrum/utils/itemUtils.d.ts.map +1 -1
- package/dist/spectrum/utils/itemUtils.js +106 -111
- package/dist/spectrum/utils/itemUtils.js.map +1 -1
- package/dist/spectrum/utils/itemWrapperUtils.d.ts +28 -0
- package/dist/spectrum/utils/itemWrapperUtils.d.ts.map +1 -0
- package/dist/spectrum/utils/itemWrapperUtils.js +111 -0
- package/dist/spectrum/utils/itemWrapperUtils.js.map +1 -0
- package/dist/spectrum/utils/propsUtils.d.ts +14 -0
- package/dist/spectrum/utils/propsUtils.d.ts.map +1 -0
- package/dist/spectrum/utils/propsUtils.js +93 -0
- package/dist/spectrum/utils/propsUtils.js.map +1 -0
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.d.ts +19 -0
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.d.ts.map +1 -0
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js +31 -0
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js.map +1 -0
- package/dist/spectrum/utils/useRenderNormalizedItem.d.ts +25 -0
- package/dist/spectrum/utils/useRenderNormalizedItem.d.ts.map +1 -0
- package/dist/spectrum/utils/useRenderNormalizedItem.js +87 -0
- package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -0
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.d.ts +10 -0
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.d.ts.map +1 -0
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js +27 -0
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js.map +1 -0
- package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts +43 -0
- package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts.map +1 -0
- package/dist/spectrum/utils/useStringifiedMultiSelection.js +53 -0
- package/dist/spectrum/utils/useStringifiedMultiSelection.js.map +1 -0
- package/dist/spectrum/utils/useStringifiedSelection.d.ts +33 -0
- package/dist/spectrum/utils/useStringifiedSelection.d.ts.map +1 -0
- package/dist/spectrum/utils/useStringifiedSelection.js +50 -0
- package/dist/spectrum/utils/useStringifiedSelection.js.map +1 -0
- package/dist/theme/SpectrumThemeProvider.js +2 -2
- package/dist/theme/SpectrumThemeProvider.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/theme-spectrum/theme-spectrum-overrides.css +1 -1
- package/dist/theme/theme-spectrum/theme-spectrum-overrides.css.map +1 -1
- package/dist/theme/useSpectrumThemeProvider.d.ts +4 -0
- package/dist/theme/useSpectrumThemeProvider.d.ts.map +1 -0
- package/dist/theme/useSpectrumThemeProvider.js +4 -0
- package/dist/theme/useSpectrumThemeProvider.js.map +1 -0
- package/package.json +11 -10
- package/scss/new_variables.scss +1 -1
- package/scss/util.scss +4 -0
- package/dist/ButtonGroup.d.ts.map +0 -1
- package/dist/ButtonGroup.js.map +0 -1
- package/dist/ButtonOld.d.ts +0 -12
- package/dist/ButtonOld.d.ts.map +0 -1
- package/dist/ButtonOld.js +0 -43
- package/dist/ButtonOld.js.map +0 -1
- package/dist/ComboBox.d.ts +0 -120
- package/dist/ComboBox.d.ts.map +0 -1
- package/dist/ComboBox.js +0 -497
- package/dist/ComboBox.js.map +0 -1
- package/dist/spectrum/picker/PickerItemContent.d.ts +0 -11
- package/dist/spectrum/picker/PickerItemContent.d.ts.map +0 -1
- package/dist/spectrum/picker/PickerItemContent.js.map +0 -1
- package/dist/spectrum/pickers.d.ts +0 -2
- package/dist/spectrum/pickers.d.ts.map +0 -1
- package/dist/spectrum/pickers.js +0 -2
- package/dist/spectrum/pickers.js.map +0 -1
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ItemElement, ItemRenderer, SectionProps as SpectrumSectionProps } from '@react-types/shared';
|
|
3
|
+
export { Item } from '@adobe/react-spectrum';
|
|
4
|
+
export type { ItemProps } from '@react-types/shared';
|
|
5
|
+
export type ItemElementOrPrimitive<T = unknown> = number | string | boolean | ItemElement<T>;
|
|
6
|
+
export type ItemsChildren<T> = ItemElement<T> | ItemElement<T>[] | ItemRenderer<T>;
|
|
7
|
+
export type ItemsOrPrimitiveChildren<T> = ItemElementOrPrimitive<T> | ItemElementOrPrimitive<T>[] | ItemRenderer<T>;
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
3
|
-
* due to the way they are consumed by collection components. They are only used
|
|
4
|
-
* to pass data and don't render anything on their own, so they don't need to be
|
|
5
|
-
* wrapped. If we do ever need to wrap them for whatever reason, the static
|
|
6
|
-
* `getCollectionNode` method will need to be implemented.
|
|
7
|
-
* See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Item.ts#L17
|
|
8
|
-
* https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Section.ts#L18
|
|
9
|
+
* Spectrum SectionProps augmented with support for primitive item children.
|
|
9
10
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
11
|
+
export type SectionProps<T> = Omit<SpectrumSectionProps<T>, 'children'> & {
|
|
12
|
+
children: ItemsOrPrimitiveChildren<T>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Re-export Spectrum Section component with augmented props type.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Section: <T>(props: SectionProps<T>) => JSX.Element;
|
|
12
18
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/spectrum/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/spectrum/shared.ts"],"names":[],"mappings":";AAUA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,YAAY,IAAI,oBAAoB,EACrC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMrD,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,OAAO,IAC1C,MAAM,GACN,MAAM,GACN,OAAO,GACP,WAAW,CAAC,CAAC,CAAC,CAAC;AAEnB,MAAM,MAAM,aAAa,CAAC,CAAC,IACvB,WAAW,CAAC,CAAC,CAAC,GACd,WAAW,CAAC,CAAC,CAAC,EAAE,GAChB,YAAY,CAAC,CAAC,CAAC,CAAC;AAEpB,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAClC,sBAAsB,CAAC,CAAC,CAAC,GACzB,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAC3B,YAAY,CAAC,CAAC,CAAC,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACxE,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,iCAEf,WAAW,CAAC"}
|
package/dist/spectrum/shared.js
CHANGED
|
@@ -7,5 +7,20 @@
|
|
|
7
7
|
* See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Item.ts#L17
|
|
8
8
|
* https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Section.ts#L18
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
import { Section as SpectrumSection } from '@adobe/react-spectrum';
|
|
11
|
+
export { Item } from '@adobe/react-spectrum';
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* We support primitive values as shorthand for `Item` elements in certain
|
|
15
|
+
* components. This type represents this augmentation of the Spectrum types.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Spectrum SectionProps augmented with support for primitive item children.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Re-export Spectrum Section component with augmented props type.
|
|
24
|
+
*/
|
|
25
|
+
export var Section = SpectrumSection;
|
|
11
26
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":["
|
|
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 { ItemProps } 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;;AAG5C;AACA;AACA;AACA;;AAiBA;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,IAAMF,OAAO,GAAGC,eAEP"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export * from './itemUtils';
|
|
2
|
+
export * from './itemWrapperUtils';
|
|
3
|
+
export * from './propsUtils';
|
|
2
4
|
export * from './themeUtils';
|
|
5
|
+
export * from './useOnChangeTrackUncontrolled';
|
|
6
|
+
export * from './useRenderNormalizedItem';
|
|
7
|
+
export * from './useStaticItemInitialScrollPosition';
|
|
8
|
+
export * from './useStringifiedMultiSelection';
|
|
9
|
+
export * from './useStringifiedSelection';
|
|
3
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export * from "./itemUtils.js";
|
|
2
|
+
export * from "./itemWrapperUtils.js";
|
|
3
|
+
export * from "./propsUtils.js";
|
|
2
4
|
export * from "./themeUtils.js";
|
|
5
|
+
export * from "./useOnChangeTrackUncontrolled.js";
|
|
6
|
+
export * from "./useRenderNormalizedItem.js";
|
|
7
|
+
export * from "./useStaticItemInitialScrollPosition.js";
|
|
8
|
+
export * from "./useStringifiedMultiSelection.js";
|
|
9
|
+
export * from "./useStringifiedSelection.js";
|
|
3
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/utils/index.ts"],"sourcesContent":["export * from './itemUtils';\nexport * from './themeUtils';\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,10 +1,13 @@
|
|
|
1
1
|
import { Key, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { SpectrumPickerProps } from '@adobe/react-spectrum';
|
|
3
2
|
import type { ItemRenderer } from '@react-types/shared';
|
|
4
|
-
import { KeyedItem } from '@deephaven/utils';
|
|
5
|
-
import { ItemProps, SectionProps } from '../shared';
|
|
3
|
+
import { KeyedItem, SelectionT } from '@deephaven/utils';
|
|
4
|
+
import { ItemElementOrPrimitive, ItemProps, SectionProps } from '../shared';
|
|
6
5
|
import { PopperOptions } from '../../popper';
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* `Item.textValue` prop needs to be a non-empty string for accessibility
|
|
8
|
+
* purposes. This is not displayed in the UI.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ITEM_EMPTY_STRING_TEXT_VALUE = "Empty";
|
|
8
11
|
/**
|
|
9
12
|
* React Spectrum <Section> supports an `ItemRenderer` function as a child. The
|
|
10
13
|
* DH picker makes use of this internally, but we don't want to support it as
|
|
@@ -13,26 +16,46 @@ export declare const INVALID_ITEM_ERROR_MESSAGE = "Items must be strings, number
|
|
|
13
16
|
type SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {
|
|
14
17
|
children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;
|
|
15
18
|
};
|
|
16
|
-
type ItemElement = ReactElement<ItemProps<
|
|
17
|
-
export type SectionElement = ReactElement<SectionPropsNoItemRenderer<
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
19
|
+
export type ItemElement<T = unknown> = ReactElement<ItemProps<T>>;
|
|
20
|
+
export type SectionElement<T = unknown> = ReactElement<SectionPropsNoItemRenderer<T>>;
|
|
21
|
+
export type ItemOrSection<T = unknown> = ItemElementOrPrimitive<T> | SectionElement<T>;
|
|
22
|
+
export type ItemIconSlot = 'icon' | 'image' | 'illustration';
|
|
20
23
|
/**
|
|
21
24
|
* Augment the Spectrum selection key type to include boolean values.
|
|
22
25
|
* Spectrum collection components already supports this, but the built in types
|
|
23
26
|
* don't reflect it.
|
|
24
27
|
*/
|
|
25
28
|
export type ItemKey = Key | boolean;
|
|
29
|
+
export type ItemSelection = SelectionT<ItemKey>;
|
|
26
30
|
/**
|
|
27
31
|
* Augment the Spectrum selection change handler type to include boolean keys.
|
|
28
32
|
* Spectrum components already supports this, but the built in types don't
|
|
29
33
|
* reflect it.
|
|
30
34
|
*/
|
|
31
35
|
export type ItemSelectionChangeHandler = (key: ItemKey) => void;
|
|
36
|
+
export interface MultipleItemSelectionProps {
|
|
37
|
+
selectedKeys?: 'all' | Iterable<ItemKey>;
|
|
38
|
+
defaultSelectedKeys?: 'all' | Iterable<ItemKey>;
|
|
39
|
+
disabledKeys?: Iterable<ItemKey>;
|
|
40
|
+
/**
|
|
41
|
+
* Handler that is called when the selection change.
|
|
42
|
+
* Note that under the hood, this is just an alias for Spectrum's
|
|
43
|
+
* `onSelectionChange`. We are renaming for better consistency with other
|
|
44
|
+
* components.
|
|
45
|
+
*/
|
|
46
|
+
onChange?: (keys: ItemSelection) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Handler that is called when the selection changes.
|
|
49
|
+
* @deprecated Use `onChange` instead
|
|
50
|
+
*/
|
|
51
|
+
onSelectionChange?: (keys: ItemSelection) => void;
|
|
52
|
+
}
|
|
32
53
|
export interface NormalizedItemData {
|
|
33
54
|
key?: ItemKey;
|
|
34
55
|
content: ReactNode;
|
|
35
|
-
|
|
56
|
+
description?: ReactNode;
|
|
57
|
+
icon?: ReactNode;
|
|
58
|
+
textValue: string | undefined;
|
|
36
59
|
}
|
|
37
60
|
export interface NormalizedSectionData {
|
|
38
61
|
key?: Key;
|
|
@@ -47,9 +70,9 @@ export interface NormalizedSectionData {
|
|
|
47
70
|
* `KeyedItem` interface to be compatible with Windowed data utils
|
|
48
71
|
* (e.g. `useViewportData`).
|
|
49
72
|
*/
|
|
50
|
-
export type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey
|
|
51
|
-
export type NormalizedSection = KeyedItem<NormalizedSectionData, Key
|
|
52
|
-
export type
|
|
73
|
+
export type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey>;
|
|
74
|
+
export type NormalizedSection = KeyedItem<NormalizedSectionData, Key>;
|
|
75
|
+
export type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> = TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;
|
|
53
76
|
export type TooltipOptions = {
|
|
54
77
|
placement: PopperOptions['placement'];
|
|
55
78
|
};
|
|
@@ -62,26 +85,54 @@ export type TooltipOptions = {
|
|
|
62
85
|
* @param item The normalized item or section
|
|
63
86
|
* @returns The `key` of the item or section
|
|
64
87
|
*/
|
|
65
|
-
export declare function getItemKey<TItem extends NormalizedItem | NormalizedSection, TKey extends TItem extends NormalizedItem ? ItemKey
|
|
88
|
+
export declare function getItemKey<TItem extends NormalizedItem | NormalizedSection, TKey extends TItem extends NormalizedItem ? ItemKey : TItem extends NormalizedSection ? Key : undefined>(item: TItem | null | undefined): TKey;
|
|
89
|
+
/**
|
|
90
|
+
* Determine Item `textValue` based on the `textValue` prop or primitive children
|
|
91
|
+
* value.
|
|
92
|
+
* @param item The item to get the text value for
|
|
93
|
+
* @returns The text value of the item
|
|
94
|
+
*/
|
|
95
|
+
export declare function getItemTextValue<T>(item: ItemElement<T>): string | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Get the position of the item with the given selected key in a list of items.
|
|
98
|
+
* @param items The items to search
|
|
99
|
+
* @param itemHeight The height of each item
|
|
100
|
+
* @param selectedKey The key of the selected item
|
|
101
|
+
* @param topOffset The top offset of the list
|
|
102
|
+
* @returns The position of the selected item or the top offset if not found
|
|
103
|
+
*/
|
|
104
|
+
export declare function getPositionOfSelectedItemElement<TKey extends string | number | boolean | undefined>({ items, itemHeight, selectedKey, topOffset, }: {
|
|
105
|
+
items: ItemElement[];
|
|
106
|
+
selectedKey: TKey | null | undefined;
|
|
107
|
+
itemHeight: number;
|
|
108
|
+
topOffset: number;
|
|
109
|
+
}): Promise<number>;
|
|
66
110
|
/**
|
|
67
111
|
* Determine if a node is a Section element.
|
|
68
112
|
* @param node The node to check
|
|
69
113
|
* @returns True if the node is a Section element
|
|
70
114
|
*/
|
|
71
|
-
export declare function isSectionElement<T>(node: ReactNode): node is
|
|
115
|
+
export declare function isSectionElement<T>(node: ReactNode): node is SectionElement<T>;
|
|
72
116
|
/**
|
|
73
117
|
* Determine if a node is an Item element.
|
|
74
118
|
* @param node The node to check
|
|
75
119
|
* @returns True if the node is an Item element
|
|
76
120
|
*/
|
|
77
|
-
export declare function isItemElement<T>(node: ReactNode): node is
|
|
121
|
+
export declare function isItemElement<T>(node: ReactNode): node is ItemElement<T>;
|
|
78
122
|
/**
|
|
79
|
-
* Determine if a node is an
|
|
80
|
-
*
|
|
123
|
+
* Determine if a node is an Item element containing a child `Text` element with
|
|
124
|
+
* a `slot` prop set to `description`.
|
|
81
125
|
* @param node The node to check
|
|
82
|
-
* @returns True if the node is
|
|
126
|
+
* @returns True if the node is an Item element with a description
|
|
83
127
|
*/
|
|
84
|
-
export declare function
|
|
128
|
+
export declare function isItemElementWithDescription<T>(node: ReactNode): node is ReactElement<ItemProps<T>>;
|
|
129
|
+
/**
|
|
130
|
+
* Determine if a node is an array containing normalized items or sections with
|
|
131
|
+
* keys. Note that this only checks the first node in the array.
|
|
132
|
+
* @param node The node to check
|
|
133
|
+
* @returns True if the node is a normalized item or section with keys array
|
|
134
|
+
*/
|
|
135
|
+
export declare function isNormalizedItemsWithKeysList<TItemOrSection extends ItemOrSection>(node: TItemOrSection | TItemOrSection[] | NormalizedItemOrSection<TItemOrSection>[]): node is NormalizedItemOrSection<TItemOrSection>[];
|
|
85
136
|
/**
|
|
86
137
|
* Determine if an object is a normalized section.
|
|
87
138
|
* @param maybeNormalizedSection The object to check
|
|
@@ -95,17 +146,19 @@ export declare function isNormalizedSection(maybeNormalizedSection: NormalizedIt
|
|
|
95
146
|
* @returns True if the node is an item or section
|
|
96
147
|
*/
|
|
97
148
|
export declare function isItemOrSection(node: ReactNode): node is ItemOrSection;
|
|
98
|
-
/**
|
|
99
|
-
* Get normalized items from an item or array of items.
|
|
100
|
-
* @param itemsOrSections An item or array of items
|
|
101
|
-
* @returns An array of normalized items
|
|
102
|
-
*/
|
|
103
|
-
export declare function normalizeItemList(itemsOrSections: ItemOrSection | ItemOrSection[] | NormalizedItem[]): (NormalizedItem | NormalizedSection)[];
|
|
104
149
|
/**
|
|
105
150
|
* Returns a TooltipOptions object or null if options is false or null.
|
|
106
|
-
* @param options
|
|
151
|
+
* @param options Tooltip options
|
|
152
|
+
* @param placement Default placement for the tooltip if `options` is set
|
|
153
|
+
* explicitly to `true`
|
|
107
154
|
* @returns TooltipOptions or null
|
|
108
155
|
*/
|
|
109
|
-
export declare function normalizeTooltipOptions(options?: boolean | TooltipOptions | null): TooltipOptions | null;
|
|
156
|
+
export declare function normalizeTooltipOptions(options?: boolean | TooltipOptions | null, placement?: TooltipOptions['placement']): TooltipOptions | null;
|
|
157
|
+
/**
|
|
158
|
+
* Convert a selection of `ItemKey`s to a selection of strings.
|
|
159
|
+
* @param itemKeys The selection of `ItemKey`s
|
|
160
|
+
* @returns The selection of strings
|
|
161
|
+
*/
|
|
162
|
+
export declare function itemSelectionToStringSet<TKeys extends 'all' | Iterable<ItemKey> | undefined, TResult extends TKeys extends 'all' ? 'all' : TKeys extends Iterable<ItemKey> ? Set<string> : undefined>(itemKeys: TKeys): TResult;
|
|
110
163
|
export {};
|
|
111
164
|
//# sourceMappingURL=itemUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/itemUtils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"itemUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/itemUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAe,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAEL,sBAAsB,EACtB,SAAS,EAET,YAAY,EACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C;;;GAGG;AACH,eAAO,MAAM,4BAA4B,UAAU,CAAC;AAEpD;;;;GAIG;AACH,KAAK,0BAA0B,CAAC,CAAC,IAAI,IAAI,CAAC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KAAK,SAAS,KAAK,GAC/B,KAAK,GACL,KAAK,SAAS,QAAQ,CAAC,OAAO,CAAC,GAC/B,GAAG,CAAC,MAAM,CAAC,GACX,SAAS,EACb,QAAQ,EAAE,KAAK,GAAG,OAAO,CAM1B"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
+
import { isElementOfType } from '@deephaven/react-hooks';
|
|
4
|
+
import { ensureArray } from '@deephaven/utils';
|
|
3
5
|
import { Item, Section } from "../shared.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
import { Text } from "../Text.js";
|
|
7
|
+
import ItemContent from "../ItemContent.js";
|
|
8
|
+
/**
|
|
9
|
+
* `Item.textValue` prop needs to be a non-empty string for accessibility
|
|
10
|
+
* purposes. This is not displayed in the UI.
|
|
11
|
+
*/
|
|
12
|
+
export var ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';
|
|
6
13
|
|
|
7
14
|
/**
|
|
8
15
|
* React Spectrum <Section> supports an `ItemRenderer` function as a child. The
|
|
@@ -10,18 +17,19 @@ export var INVALID_ITEM_ERROR_MESSAGE = 'Items must be strings, numbers, boolean
|
|
|
10
17
|
* an incoming prop.
|
|
11
18
|
*/
|
|
12
19
|
|
|
20
|
+
// Picker uses `icon` slot. ListView can use `image` or `illustration` slots.
|
|
21
|
+
// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/picker/src/Picker.tsx#L194
|
|
22
|
+
// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L266-L267
|
|
13
23
|
/**
|
|
14
24
|
* Augment the Spectrum selection key type to include boolean values.
|
|
15
25
|
* Spectrum collection components already supports this, but the built in types
|
|
16
26
|
* don't reflect it.
|
|
17
27
|
*/
|
|
18
|
-
|
|
19
28
|
/**
|
|
20
29
|
* Augment the Spectrum selection change handler type to include boolean keys.
|
|
21
30
|
* Spectrum components already supports this, but the built in types don't
|
|
22
31
|
* reflect it.
|
|
23
32
|
*/
|
|
24
|
-
|
|
25
33
|
/**
|
|
26
34
|
* Spectrum collection components support a variety of item types, including
|
|
27
35
|
* strings, numbers, booleans, and more complex React elements. This type
|
|
@@ -30,7 +38,6 @@ export var INVALID_ITEM_ERROR_MESSAGE = 'Items must be strings, numbers, boolean
|
|
|
30
38
|
* `KeyedItem` interface to be compatible with Windowed data utils
|
|
31
39
|
* (e.g. `useViewportData`).
|
|
32
40
|
*/
|
|
33
|
-
|
|
34
41
|
/**
|
|
35
42
|
* DH wrappers of Spectrum collection components use a normalized item that
|
|
36
43
|
* includes a `key` prop and an optional `item` prop. This is mostly to support
|
|
@@ -45,13 +52,62 @@ export function getItemKey(item) {
|
|
|
45
52
|
return (_item$item$key = item === null || item === void 0 ? void 0 : (_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.key) !== null && _item$item$key !== void 0 ? _item$item$key : item === null || item === void 0 ? void 0 : item.key;
|
|
46
53
|
}
|
|
47
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Determine Item `textValue` based on the `textValue` prop or primitive children
|
|
57
|
+
* value.
|
|
58
|
+
* @param item The item to get the text value for
|
|
59
|
+
* @returns The text value of the item
|
|
60
|
+
*/
|
|
61
|
+
export function getItemTextValue(item) {
|
|
62
|
+
if (item.props.textValue == null) {
|
|
63
|
+
var itemKeyStr = item.key == null ? undefined : String(item.key);
|
|
64
|
+
return ['string', 'boolean', 'number'].includes(typeof item.props.children) ? String(item.props.children) : itemKeyStr;
|
|
65
|
+
}
|
|
66
|
+
return item.props.textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : item.props.textValue;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get the position of the item with the given selected key in a list of items.
|
|
71
|
+
* @param items The items to search
|
|
72
|
+
* @param itemHeight The height of each item
|
|
73
|
+
* @param selectedKey The key of the selected item
|
|
74
|
+
* @param topOffset The top offset of the list
|
|
75
|
+
* @returns The position of the selected item or the top offset if not found
|
|
76
|
+
*/
|
|
77
|
+
export function getPositionOfSelectedItemElement(_x) {
|
|
78
|
+
return _getPositionOfSelectedItemElement.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
|
|
48
81
|
/**
|
|
49
82
|
* Determine if a node is a Section element.
|
|
50
83
|
* @param node The node to check
|
|
51
84
|
* @returns True if the node is a Section element
|
|
52
85
|
*/
|
|
86
|
+
function _getPositionOfSelectedItemElement() {
|
|
87
|
+
_getPositionOfSelectedItemElement = _asyncToGenerator(function* (_ref) {
|
|
88
|
+
var {
|
|
89
|
+
items,
|
|
90
|
+
itemHeight,
|
|
91
|
+
selectedKey,
|
|
92
|
+
topOffset
|
|
93
|
+
} = _ref;
|
|
94
|
+
var position = topOffset;
|
|
95
|
+
if (selectedKey == null) {
|
|
96
|
+
return position;
|
|
97
|
+
}
|
|
98
|
+
for (var i = 0; i < items.length; i += 1) {
|
|
99
|
+
var item = items[i];
|
|
100
|
+
if (item.key === selectedKey) {
|
|
101
|
+
return position;
|
|
102
|
+
}
|
|
103
|
+
position += itemHeight;
|
|
104
|
+
}
|
|
105
|
+
return topOffset;
|
|
106
|
+
});
|
|
107
|
+
return _getPositionOfSelectedItemElement.apply(this, arguments);
|
|
108
|
+
}
|
|
53
109
|
export function isSectionElement(node) {
|
|
54
|
-
return
|
|
110
|
+
return isElementOfType(node, Section);
|
|
55
111
|
}
|
|
56
112
|
|
|
57
113
|
/**
|
|
@@ -60,14 +116,35 @@ export function isSectionElement(node) {
|
|
|
60
116
|
* @returns True if the node is an Item element
|
|
61
117
|
*/
|
|
62
118
|
export function isItemElement(node) {
|
|
63
|
-
return
|
|
119
|
+
return isElementOfType(node, Item);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Determine if a node is an Item element containing a child `Text` element with
|
|
124
|
+
* a `slot` prop set to `description`.
|
|
125
|
+
* @param node The node to check
|
|
126
|
+
* @returns True if the node is an Item element with a description
|
|
127
|
+
*/
|
|
128
|
+
export function isItemElementWithDescription(node) {
|
|
129
|
+
if (!isItemElement(node)) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// If children are wrapped in `ItemContent`, go down 1 level
|
|
134
|
+
var children = isElementOfType(node.props.children, ItemContent) ? node.props.children.props.children : node.props.children;
|
|
135
|
+
var childrenArray = ensureArray(children);
|
|
136
|
+
var result = childrenArray.some(child => {
|
|
137
|
+
var _child$props;
|
|
138
|
+
return isElementOfType(child, Text) && ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.slot) === 'description';
|
|
139
|
+
});
|
|
140
|
+
return result;
|
|
64
141
|
}
|
|
65
142
|
|
|
66
143
|
/**
|
|
67
|
-
* Determine if a node is an array containing normalized items with
|
|
68
|
-
* Note that this only checks the first node in the array.
|
|
144
|
+
* Determine if a node is an array containing normalized items or sections with
|
|
145
|
+
* keys. Note that this only checks the first node in the array.
|
|
69
146
|
* @param node The node to check
|
|
70
|
-
* @returns True if the node is a normalized item with keys array
|
|
147
|
+
* @returns True if the node is a normalized item or section with keys array
|
|
71
148
|
*/
|
|
72
149
|
export function isNormalizedItemsWithKeysList(node) {
|
|
73
150
|
if (!Array.isArray(node)) {
|
|
@@ -98,117 +175,35 @@ export function isItemOrSection(node) {
|
|
|
98
175
|
return typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || isItemElement(node) || isSectionElement(node);
|
|
99
176
|
}
|
|
100
177
|
|
|
101
|
-
/**
|
|
102
|
-
* Determine the `key` of an item or section.
|
|
103
|
-
* @param itemOrSection The item or section
|
|
104
|
-
* @returns A `ItemKey` for the item or undefined if a key can't be determined
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
function normalizeItemKey(itemOrSection) {
|
|
108
|
-
var _itemOrSection$props$;
|
|
109
|
-
// string, number, or boolean
|
|
110
|
-
if (typeof itemOrSection !== 'object') {
|
|
111
|
-
return itemOrSection;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// If `key` prop is explicitly set
|
|
115
|
-
if (itemOrSection.key != null) {
|
|
116
|
-
return itemOrSection.key;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Section element
|
|
120
|
-
if (isSectionElement(itemOrSection)) {
|
|
121
|
-
return typeof itemOrSection.props.title === 'string' ? itemOrSection.props.title : undefined;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Item element
|
|
125
|
-
return (_itemOrSection$props$ = itemOrSection.props.textValue) !== null && _itemOrSection$props$ !== void 0 ? _itemOrSection$props$ : typeof itemOrSection.props.children === 'string' ? itemOrSection.props.children : undefined;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Get a normalized `textValue` for an item ensuring it is a string.
|
|
130
|
-
* @param item The item
|
|
131
|
-
* @returns A string `textValue` for the item
|
|
132
|
-
*/
|
|
133
|
-
function normalizeTextValue(item) {
|
|
134
|
-
if (typeof item !== 'object') {
|
|
135
|
-
return String(item);
|
|
136
|
-
}
|
|
137
|
-
if (item.props.textValue != null) {
|
|
138
|
-
return item.props.textValue;
|
|
139
|
-
}
|
|
140
|
-
if (typeof item.props.children === 'string') {
|
|
141
|
-
return item.props.children;
|
|
142
|
-
}
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Normalize an item or section to an object form.
|
|
148
|
-
* @param itemOrSection item to normalize
|
|
149
|
-
* @returns NormalizedItem or NormalizedSection object
|
|
150
|
-
*/
|
|
151
|
-
function normalizeItem(itemOrSection) {
|
|
152
|
-
if (!isItemOrSection(itemOrSection)) {
|
|
153
|
-
log.debug(INVALID_ITEM_ERROR_MESSAGE, itemOrSection);
|
|
154
|
-
throw new Error(INVALID_ITEM_ERROR_MESSAGE);
|
|
155
|
-
}
|
|
156
|
-
if (isSectionElement(itemOrSection)) {
|
|
157
|
-
var _key = normalizeItemKey(itemOrSection);
|
|
158
|
-
var {
|
|
159
|
-
title
|
|
160
|
-
} = itemOrSection.props;
|
|
161
|
-
var items = normalizeItemList(itemOrSection.props.children).filter(
|
|
162
|
-
// We don't support nested section elements
|
|
163
|
-
childItem => !isSectionElement(childItem));
|
|
164
|
-
return {
|
|
165
|
-
item: {
|
|
166
|
-
key: _key,
|
|
167
|
-
title,
|
|
168
|
-
items
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
var key = normalizeItemKey(itemOrSection);
|
|
173
|
-
var content = isItemElement(itemOrSection) ? itemOrSection.props.children : itemOrSection;
|
|
174
|
-
var textValue = normalizeTextValue(itemOrSection);
|
|
175
|
-
return {
|
|
176
|
-
item: {
|
|
177
|
-
key,
|
|
178
|
-
content,
|
|
179
|
-
textValue
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Get normalized items from an item or array of items.
|
|
186
|
-
* @param itemsOrSections An item or array of items
|
|
187
|
-
* @returns An array of normalized items
|
|
188
|
-
*/
|
|
189
|
-
export function normalizeItemList(itemsOrSections) {
|
|
190
|
-
// If already normalized, just return as-is
|
|
191
|
-
if (isNormalizedItemsWithKeysList(itemsOrSections)) {
|
|
192
|
-
return itemsOrSections;
|
|
193
|
-
}
|
|
194
|
-
var itemsArray = Array.isArray(itemsOrSections) ? itemsOrSections : [itemsOrSections];
|
|
195
|
-
return itemsArray.map(normalizeItem);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
178
|
/**
|
|
199
179
|
* Returns a TooltipOptions object or null if options is false or null.
|
|
200
|
-
* @param options
|
|
180
|
+
* @param options Tooltip options
|
|
181
|
+
* @param placement Default placement for the tooltip if `options` is set
|
|
182
|
+
* explicitly to `true`
|
|
201
183
|
* @returns TooltipOptions or null
|
|
202
184
|
*/
|
|
203
185
|
export function normalizeTooltipOptions(options) {
|
|
186
|
+
var placement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'right';
|
|
204
187
|
if (options == null || options === false) {
|
|
205
188
|
return null;
|
|
206
189
|
}
|
|
207
190
|
if (options === true) {
|
|
208
191
|
return {
|
|
209
|
-
placement
|
|
192
|
+
placement
|
|
210
193
|
};
|
|
211
194
|
}
|
|
212
195
|
return options;
|
|
213
196
|
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Convert a selection of `ItemKey`s to a selection of strings.
|
|
200
|
+
* @param itemKeys The selection of `ItemKey`s
|
|
201
|
+
* @returns The selection of strings
|
|
202
|
+
*/
|
|
203
|
+
export function itemSelectionToStringSet(itemKeys) {
|
|
204
|
+
if (itemKeys == null || itemKeys === 'all') {
|
|
205
|
+
return itemKeys;
|
|
206
|
+
}
|
|
207
|
+
return new Set([...itemKeys].map(String));
|
|
208
|
+
}
|
|
214
209
|
//# sourceMappingURL=itemUtils.js.map
|