@deephaven/components 0.72.1-beta.5 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/Button.d.ts +1 -1
  2. package/dist/Select.d.ts +1 -1
  3. package/dist/spectrum/Heading.d.ts +4 -1
  4. package/dist/spectrum/Heading.d.ts.map +1 -1
  5. package/dist/spectrum/Heading.js +5 -3
  6. package/dist/spectrum/Heading.js.map +1 -1
  7. package/dist/spectrum/ItemContent.d.ts +15 -0
  8. package/dist/spectrum/ItemContent.d.ts.map +1 -0
  9. package/dist/spectrum/{picker/PickerItemContent.js → ItemContent.js} +42 -18
  10. package/dist/spectrum/ItemContent.js.map +1 -0
  11. package/dist/spectrum/ItemTooltip.d.ts +12 -0
  12. package/dist/spectrum/ItemTooltip.d.ts.map +1 -0
  13. package/dist/spectrum/ItemTooltip.js +30 -0
  14. package/dist/spectrum/ItemTooltip.js.map +1 -0
  15. package/dist/spectrum/Text.d.ts +4 -1
  16. package/dist/spectrum/Text.d.ts.map +1 -1
  17. package/dist/spectrum/Text.js +5 -4
  18. package/dist/spectrum/Text.js.map +1 -1
  19. package/dist/spectrum/View.d.ts +4 -1
  20. package/dist/spectrum/View.d.ts.map +1 -1
  21. package/dist/spectrum/View.js +5 -3
  22. package/dist/spectrum/View.js.map +1 -1
  23. package/dist/spectrum/collections.d.ts +1 -1
  24. package/dist/spectrum/collections.d.ts.map +1 -1
  25. package/dist/spectrum/collections.js +1 -1
  26. package/dist/spectrum/collections.js.map +1 -1
  27. package/dist/spectrum/icons.d.ts +2 -0
  28. package/dist/spectrum/icons.d.ts.map +1 -0
  29. package/dist/spectrum/icons.js +3 -0
  30. package/dist/spectrum/icons.js.map +1 -0
  31. package/dist/spectrum/index.d.ts +4 -0
  32. package/dist/spectrum/index.d.ts.map +1 -1
  33. package/dist/spectrum/index.js +4 -0
  34. package/dist/spectrum/index.js.map +1 -1
  35. package/dist/spectrum/listView/ListView.d.ts +28 -0
  36. package/dist/spectrum/listView/ListView.d.ts.map +1 -0
  37. package/dist/spectrum/listView/ListView.js +91 -0
  38. package/dist/spectrum/listView/ListView.js.map +1 -0
  39. package/dist/spectrum/listView/index.d.ts +2 -0
  40. package/dist/spectrum/listView/index.d.ts.map +1 -0
  41. package/dist/spectrum/listView/index.js +2 -0
  42. package/dist/spectrum/listView/index.js.map +1 -0
  43. package/dist/spectrum/picker/Picker.d.ts.map +1 -1
  44. package/dist/spectrum/picker/Picker.js +9 -60
  45. package/dist/spectrum/picker/Picker.js.map +1 -1
  46. package/dist/spectrum/picker/index.d.ts +0 -1
  47. package/dist/spectrum/picker/index.d.ts.map +1 -1
  48. package/dist/spectrum/picker/index.js +0 -1
  49. package/dist/spectrum/picker/index.js.map +1 -1
  50. package/dist/spectrum/utils/index.d.ts +2 -0
  51. package/dist/spectrum/utils/index.d.ts.map +1 -1
  52. package/dist/spectrum/utils/index.js +2 -0
  53. package/dist/spectrum/utils/index.js.map +1 -1
  54. package/dist/spectrum/utils/itemUtils.d.ts +21 -11
  55. package/dist/spectrum/utils/itemUtils.d.ts.map +1 -1
  56. package/dist/spectrum/utils/itemUtils.js +23 -8
  57. package/dist/spectrum/utils/itemUtils.js.map +1 -1
  58. package/dist/spectrum/utils/useRenderNormalizedItem.d.ts +11 -0
  59. package/dist/spectrum/utils/useRenderNormalizedItem.d.ts.map +1 -0
  60. package/dist/spectrum/utils/useRenderNormalizedItem.js +40 -0
  61. package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -0
  62. package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts +43 -0
  63. package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts.map +1 -0
  64. package/dist/spectrum/utils/useStringifiedMultiSelection.js +50 -0
  65. package/dist/spectrum/utils/useStringifiedMultiSelection.js.map +1 -0
  66. package/dist/theme/index.d.ts +1 -0
  67. package/dist/theme/index.d.ts.map +1 -1
  68. package/dist/theme/index.js +1 -0
  69. package/dist/theme/index.js.map +1 -1
  70. package/dist/theme/useSpectrumThemeProvider.d.ts +4 -0
  71. package/dist/theme/useSpectrumThemeProvider.d.ts.map +1 -0
  72. package/dist/theme/useSpectrumThemeProvider.js +4 -0
  73. package/dist/theme/useSpectrumThemeProvider.js.map +1 -0
  74. package/package.json +7 -7
  75. package/dist/spectrum/picker/PickerItemContent.d.ts +0 -11
  76. package/dist/spectrum/picker/PickerItemContent.d.ts.map +0 -1
  77. package/dist/spectrum/picker/PickerItemContent.js.map +0 -1
@@ -6,6 +6,7 @@ export * from './collections';
6
6
  export * from './content';
7
7
  export * from './dateAndTime';
8
8
  export * from './forms';
9
+ export * from './icons';
9
10
  export * from './layout';
10
11
  export * from './navigation';
11
12
  export * from './overlays';
@@ -15,6 +16,7 @@ export * from './status';
15
16
  /**
16
17
  * Custom DH components wrapping React Spectrum components.
17
18
  */
19
+ export * from './listView';
18
20
  export * from './picker';
19
21
  export * from './Heading';
20
22
  export * from './Text';
@@ -22,5 +24,7 @@ export * from './View';
22
24
  /**
23
25
  * Custom DH spectrum utils
24
26
  */
27
+ export * from './ItemContent';
28
+ export * from './ItemTooltip';
25
29
  export * from './utils';
26
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spectrum/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAEvB;;GAEG;AACH,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spectrum/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAEvB;;GAEG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
@@ -6,6 +6,7 @@ export * from "./collections.js";
6
6
  export * from "./content.js";
7
7
  export * from "./dateAndTime.js";
8
8
  export * from "./forms.js";
9
+ export * from "./icons.js";
9
10
  export * from "./layout.js";
10
11
  export * from "./navigation.js";
11
12
  export * from "./overlays.js";
@@ -15,6 +16,7 @@ export * from "./status.js";
15
16
  /**
16
17
  * Custom DH components wrapping React Spectrum components.
17
18
  */
19
+ export * from "./listView/index.js";
18
20
  export * from "./picker/index.js";
19
21
  export * from "./Heading.js";
20
22
  export * from "./Text.js";
@@ -22,5 +24,7 @@ export * from "./View.js";
22
24
  /**
23
25
  * Custom DH spectrum utils
24
26
  */
27
+ export * from "./ItemContent.js";
28
+ export * from "./ItemTooltip.js";
25
29
  export * from "./utils/index.js";
26
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/spectrum/index.ts"],"sourcesContent":["/**\n * Re-exporting React Spectrum components + props.\n */\nexport * from './buttons';\nexport * from './collections';\nexport * from './content';\nexport * from './dateAndTime';\nexport * from './forms';\nexport * from './layout';\nexport * from './navigation';\nexport * from './overlays';\nexport * from './pickers';\nexport * from './shared';\nexport * from './status';\n\n/**\n * Custom DH components wrapping React Spectrum components.\n */\nexport * from './picker';\nexport * from './Heading';\nexport * from './Text';\nexport * from './View';\n\n/**\n * Custom DH spectrum utils\n */\nexport * from './utils';\n"],"mappings":"AAAA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAQA;AACA;AACA;AAFA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/spectrum/index.ts"],"sourcesContent":["/**\n * Re-exporting React Spectrum components + props.\n */\nexport * from './buttons';\nexport * from './collections';\nexport * from './content';\nexport * from './dateAndTime';\nexport * from './forms';\nexport * from './icons';\nexport * from './layout';\nexport * from './navigation';\nexport * from './overlays';\nexport * from './pickers';\nexport * from './shared';\nexport * from './status';\n\n/**\n * Custom DH components wrapping React Spectrum components.\n */\nexport * from './listView';\nexport * from './picker';\nexport * from './Heading';\nexport * from './Text';\nexport * from './View';\n\n/**\n * Custom DH spectrum utils\n */\nexport * from './ItemContent';\nexport * from './ItemTooltip';\nexport * from './utils';\n"],"mappings":"AAAA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAAA;AASA;AACA;AACA;AAFA;AAAA;AAAA"}
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import { SpectrumListViewProps } from '@adobe/react-spectrum';
3
+ import { ItemElementOrPrimitive, ItemKey, ItemSelection, NormalizedItem, TooltipOptions } from '../utils';
4
+ export type ListViewProps = {
5
+ children: ItemElementOrPrimitive | ItemElementOrPrimitive[] | NormalizedItem[];
6
+ /** Can be set to true or a TooltipOptions to enable item tooltips */
7
+ tooltip?: boolean | TooltipOptions;
8
+ selectedKeys?: 'all' | Iterable<ItemKey>;
9
+ defaultSelectedKeys?: 'all' | Iterable<ItemKey>;
10
+ disabledKeys?: Iterable<ItemKey>;
11
+ /**
12
+ * Handler that is called when the selection change.
13
+ * Note that under the hood, this is just an alias for Spectrum's
14
+ * `onSelectionChange`. We are renaming for better consistency with other
15
+ * components.
16
+ */
17
+ onChange?: (keys: ItemSelection) => void;
18
+ /** Handler that is called when the picker is scrolled. */
19
+ onScroll?: (event: Event) => void;
20
+ /**
21
+ * Handler that is called when the selection changes.
22
+ * @deprecated Use `onChange` instead
23
+ */
24
+ onSelectionChange?: (keys: ItemSelection) => void;
25
+ } & Omit<SpectrumListViewProps<NormalizedItem>, 'children' | 'items' | 'selectedKeys' | 'defaultSelectedKeys' | 'disabledKeys' | 'onSelectionChange'>;
26
+ export declare function ListView({ children, tooltip, selectedKeys, defaultSelectedKeys, disabledKeys, UNSAFE_className, onChange, onScroll, onSelectionChange, ...spectrumListViewProps }: ListViewProps): JSX.Element | null;
27
+ export default ListView;
28
+ //# sourceMappingURL=ListView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../../../src/spectrum/listView/ListView.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,EACL,sBAAsB,EACtB,OAAO,EACP,aAAa,EACb,cAAc,EAGd,cAAc,EAGf,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EACJ,sBAAsB,GACtB,sBAAsB,EAAE,GACxB,cAAc,EAAE,CAAC;IACrB,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACnC,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzC,mBAAmB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAEzC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CACnD,GAAG,IAAI,CACN,qBAAqB,CAAC,cAAc,CAAC,EACnC,UAAU,GACV,OAAO,GACP,cAAc,GACd,qBAAqB,GACrB,cAAc,GACd,mBAAmB,CACtB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,OAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,QAAyB,EACzB,iBAAiB,EACjB,GAAG,qBAAqB,EACzB,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAwEpC;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,91 @@
1
+ var _excluded = ["children", "tooltip", "selectedKeys", "defaultSelectedKeys", "disabledKeys", "UNSAFE_className", "onChange", "onScroll", "onSelectionChange"];
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
+ import { useMemo } from 'react';
10
+ import cl from 'classnames';
11
+ import { ListView as SpectrumListView } from '@adobe/react-spectrum';
12
+ import { EMPTY_FUNCTION } from '@deephaven/utils';
13
+ import { extractSpectrumHTMLElement, useContentRect, useOnScrollRef } from '@deephaven/react-hooks';
14
+ import { Flex } from "../layout.js";
15
+ import { normalizeItemList, normalizeTooltipOptions, useRenderNormalizedItem, useStringifiedMultiSelection } from "../utils/index.js";
16
+ import { Fragment as _Fragment } from "react/jsx-runtime";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ export function ListView(_ref) {
19
+ var _spectrumListViewProp;
20
+ var {
21
+ children,
22
+ tooltip = true,
23
+ selectedKeys,
24
+ defaultSelectedKeys,
25
+ disabledKeys,
26
+ UNSAFE_className,
27
+ onChange,
28
+ onScroll = EMPTY_FUNCTION,
29
+ onSelectionChange
30
+ } = _ref,
31
+ spectrumListViewProps = _objectWithoutProperties(_ref, _excluded);
32
+ var normalizedItems = useMemo(() => normalizeItemList(children), [children]);
33
+ var tooltipOptions = useMemo(() => normalizeTooltipOptions(tooltip, 'bottom'), [tooltip]);
34
+ var renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);
35
+ var {
36
+ selectedStringKeys,
37
+ defaultSelectedStringKeys,
38
+ disabledStringKeys,
39
+ onStringSelectionChange
40
+ } = useStringifiedMultiSelection({
41
+ normalizedItems,
42
+ selectedKeys,
43
+ defaultSelectedKeys,
44
+ disabledKeys,
45
+ onChange: onChange !== null && onChange !== void 0 ? onChange : onSelectionChange
46
+ });
47
+ var scrollRef = useOnScrollRef(onScroll, extractSpectrumHTMLElement);
48
+
49
+ // Spectrum ListView crashes when it has zero height. Track the contentRect
50
+ // of the parent container and only render the ListView when it has a non-zero
51
+ // height. See https://github.com/adobe/react-spectrum/issues/6213
52
+ var {
53
+ ref: contentRectRef,
54
+ contentRect
55
+ } = useContentRect(extractSpectrumHTMLElement);
56
+ return /*#__PURE__*/_jsx(Flex, {
57
+ ref: contentRectRef,
58
+ direction: "column",
59
+ flex: (_spectrumListViewProp = spectrumListViewProps.flex) !== null && _spectrumListViewProp !== void 0 ? _spectrumListViewProp : 1,
60
+ minHeight: 0,
61
+ UNSAFE_className: cl('dh-list-view', UNSAFE_className),
62
+ children: contentRect.height === 0 ?
63
+ /*#__PURE__*/
64
+ // Use &nbsp; to ensure content has a non-zero height. This ensures the
65
+ // container will also have a non-zero height unless its height is
66
+ // explicitly set to zero. Example use case:
67
+ // 1. Tab containing ListView is visible. Container height is non-zero.
68
+ // ListView is rendered.
69
+ // 2. Tab is hidden. Container height is explicitly constrained to zero.
70
+ // ListView is not rendered.
71
+ // 3. Tab is shown again. Height constraint is removed. Resize observer
72
+ // fires and shows non-zero height due to the &nbsp; (without this,
73
+ // the height would remain zero forever since ListView hasn't rendered yet)
74
+ // 4. ListView is rendered again.
75
+ _jsx(_Fragment, {
76
+ children: "\xA0"
77
+ }) : /*#__PURE__*/_jsx(SpectrumListView
78
+ // eslint-disable-next-line react/jsx-props-no-spreading
79
+ , _objectSpread(_objectSpread({}, spectrumListViewProps), {}, {
80
+ ref: scrollRef,
81
+ items: normalizedItems,
82
+ selectedKeys: selectedStringKeys,
83
+ defaultSelectedKeys: defaultSelectedStringKeys,
84
+ disabledKeys: disabledStringKeys,
85
+ onSelectionChange: onStringSelectionChange,
86
+ children: renderNormalizedItem
87
+ }))
88
+ });
89
+ }
90
+ export default ListView;
91
+ //# sourceMappingURL=ListView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListView.js","names":["useMemo","cl","ListView","SpectrumListView","EMPTY_FUNCTION","extractSpectrumHTMLElement","useContentRect","useOnScrollRef","Flex","normalizeItemList","normalizeTooltipOptions","useRenderNormalizedItem","useStringifiedMultiSelection","Fragment","_Fragment","jsx","_jsx","_ref","_spectrumListViewProp","children","tooltip","selectedKeys","defaultSelectedKeys","disabledKeys","UNSAFE_className","onChange","onScroll","onSelectionChange","spectrumListViewProps","_objectWithoutProperties","_excluded","normalizedItems","tooltipOptions","renderNormalizedItem","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","scrollRef","ref","contentRectRef","contentRect","direction","flex","minHeight","height","_objectSpread","items"],"sources":["../../../src/spectrum/listView/ListView.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport cl from 'classnames';\nimport {\n ListView as SpectrumListView,\n SpectrumListViewProps,\n} from '@adobe/react-spectrum';\nimport { EMPTY_FUNCTION } from '@deephaven/utils';\nimport {\n extractSpectrumHTMLElement,\n useContentRect,\n useOnScrollRef,\n} from '@deephaven/react-hooks';\nimport { Flex } from '../layout';\nimport {\n ItemElementOrPrimitive,\n ItemKey,\n ItemSelection,\n NormalizedItem,\n normalizeItemList,\n normalizeTooltipOptions,\n TooltipOptions,\n useRenderNormalizedItem,\n useStringifiedMultiSelection,\n} from '../utils';\n\nexport type ListViewProps = {\n children:\n | ItemElementOrPrimitive\n | ItemElementOrPrimitive[]\n | NormalizedItem[];\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\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 /** 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?: (keys: ItemSelection) => void;\n} & Omit<\n SpectrumListViewProps<NormalizedItem>,\n | 'children'\n | 'items'\n | 'selectedKeys'\n | 'defaultSelectedKeys'\n | 'disabledKeys'\n | 'onSelectionChange'\n>;\n\nexport function ListView({\n children,\n tooltip = true,\n selectedKeys,\n defaultSelectedKeys,\n disabledKeys,\n UNSAFE_className,\n onChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n ...spectrumListViewProps\n}: ListViewProps): JSX.Element | null {\n const normalizedItems = useMemo(\n () => normalizeItemList(children),\n [children]\n );\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip, 'bottom'),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);\n\n const {\n selectedStringKeys,\n defaultSelectedStringKeys,\n disabledStringKeys,\n onStringSelectionChange,\n } = useStringifiedMultiSelection({\n normalizedItems,\n selectedKeys,\n defaultSelectedKeys,\n disabledKeys,\n onChange: onChange ?? onSelectionChange,\n });\n\n const scrollRef = useOnScrollRef(onScroll, extractSpectrumHTMLElement);\n\n // Spectrum ListView crashes when it has zero height. Track the contentRect\n // of the parent container and only render the ListView when it has a non-zero\n // height. See https://github.com/adobe/react-spectrum/issues/6213\n const { ref: contentRectRef, contentRect } = useContentRect(\n extractSpectrumHTMLElement\n );\n\n return (\n <Flex\n ref={contentRectRef}\n direction=\"column\"\n flex={spectrumListViewProps.flex ?? 1}\n minHeight={0}\n UNSAFE_className={cl('dh-list-view', UNSAFE_className)}\n >\n {contentRect.height === 0 ? (\n // Use &nbsp; to ensure content has a non-zero height. This ensures the\n // container will also have a non-zero height unless its height is\n // explicitly set to zero. Example use case:\n // 1. Tab containing ListView is visible. Container height is non-zero.\n // ListView is rendered.\n // 2. Tab is hidden. Container height is explicitly constrained to zero.\n // ListView is not rendered.\n // 3. Tab is shown again. Height constraint is removed. Resize observer\n // fires and shows non-zero height due to the &nbsp; (without this,\n // the height would remain zero forever since ListView hasn't rendered yet)\n // 4. ListView is rendered again.\n <>&nbsp;</>\n ) : (\n <SpectrumListView\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumListViewProps}\n ref={scrollRef}\n items={normalizedItems}\n selectedKeys={selectedStringKeys}\n defaultSelectedKeys={defaultSelectedStringKeys}\n disabledKeys={disabledStringKeys}\n onSelectionChange={onStringSelectionChange}\n >\n {renderNormalizedItem}\n </SpectrumListView>\n )}\n </Flex>\n );\n}\n\nexport default ListView;\n"],"mappings":";;;;;;;;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,OAAOC,EAAE,MAAM,YAAY;AAC3B,SACEC,QAAQ,IAAIC,gBAAgB,QAEvB,uBAAuB;AAC9B,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SACEC,0BAA0B,EAC1BC,cAAc,EACdC,cAAc,QACT,wBAAwB;AAAC,SACvBC,IAAI;AAAA,SAMXC,iBAAiB,EACjBC,uBAAuB,EAEvBC,uBAAuB,EACvBC,4BAA4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,GAAI,CAAE;IACtC0B,SAAS,EAAE,CAAE;IACbpB,gBAAgB,EAAEvB,EAAE,CAAC,cAAc,EAAEuB,gBAAgB,CAAE;IAAAL,QAAA,EAEtDsB,WAAW,CAACI,MAAM,KAAK,CAAC;IAAA;IACvB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA7B,IAAA,CAAAF,SAAA;MAAAK,QAAA,EAAE;IAAM,CAAE,CAAC,gBAEXH,IAAA,CAACb;IACC;IAAA,EAAA2C,aAAA,CAAAA,aAAA,KACIlB,qBAAqB;MACzBW,GAAG,EAAED,SAAU;MACfS,KAAK,EAAEhB,eAAgB;MACvBV,YAAY,EAAEa,kBAAmB;MACjCZ,mBAAmB,EAAEa,yBAA0B;MAC/CZ,YAAY,EAAEa,kBAAmB;MACjCT,iBAAiB,EAAEU,uBAAwB;MAAAlB,QAAA,EAE1Cc;IAAoB,EACL;EACnB,CACG,CAAC;AAEX;AAEA,eAAe/B,QAAQ"}
@@ -0,0 +1,2 @@
1
+ export * from './ListView';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/listView/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./ListView.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/listView/index.ts"],"sourcesContent":["export * from './ListView';\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAEL,6BAA6B,EAG7B,cAAc,EACd,aAAa,EACb,cAAc,EACd,OAAO,EAER,MAAM,oBAAoB,CAAC;AAK5B,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,aAAa,GAAG,aAA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AAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACnC,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2EAA2E;IAC3E,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAElC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,GAKK,IAAI,CACR,6BAA6B,EAC3B,UAAU,GACV,OAAO,GACP,mBAAmB,GACnB,aAAa,GACb,oBAAoB,CACvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAc,EACd,kBAAkB,EAClB,WAAW,EACX,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,QAAyB,EACzB,iBAAiB,EAEjB,gBAAgB,EAChB,GAAG,mBAAmB,EACvB,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAqG3B;AAED,eAAe,MAAM,CAAC"}
@@ -7,36 +7,14 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
7
7
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
8
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
9
  import { useCallback, useMemo } from 'react';
10
- import { Flex, Picker as SpectrumPicker } from '@adobe/react-spectrum';
11
- import { getPositionOfSelectedItem, findSpectrumPickerScrollArea, isElementOfType, usePopoverOnScrollRef } from '@deephaven/react-hooks';
10
+ import { Picker as SpectrumPicker } from '@adobe/react-spectrum';
11
+ import { getPositionOfSelectedItem, findSpectrumPickerScrollArea, usePopoverOnScrollRef } from '@deephaven/react-hooks';
12
12
  import { EMPTY_FUNCTION, PICKER_ITEM_HEIGHT, PICKER_TOP_OFFSET } from '@deephaven/utils';
13
13
  import cl from 'classnames';
14
- import { Tooltip } from "../../popper/index.js";
15
14
  import { isNormalizedSection, normalizeItemList, normalizeTooltipOptions, getItemKey } from "../utils/itemUtils.js";
16
- import { PickerItemContent } from "./PickerItemContent.js";
17
- import { Item, Section } from "../shared.js";
18
- import { Text } from "../Text.js";
15
+ import { Section } from "../shared.js";
16
+ import { useRenderNormalizedItem } from "../utils/index.js";
19
17
  import { jsx as _jsx } from "react/jsx-runtime";
20
- import { Fragment as _Fragment } from "react/jsx-runtime";
21
- import { jsxs as _jsxs } from "react/jsx-runtime";
22
- /**
23
- * Create tooltip content optionally wrapping with a Flex column for array
24
- * content. This is needed for Items containing description `Text` elements.
25
- */
26
- function createTooltipContent(content) {
27
- if (typeof content === 'boolean') {
28
- return String(content);
29
- }
30
- if (Array.isArray(content)) {
31
- return /*#__PURE__*/_jsx(Flex, {
32
- direction: "column",
33
- alignItems: "start",
34
- children: content.filter(node => isElementOfType(node, Text))
35
- });
36
- }
37
- return content;
38
- }
39
-
40
18
  /**
41
19
  * Picker component for selecting items from a list of items. Items can be
42
20
  * provided via the `items` prop or as children. Each item can be a string,
@@ -61,35 +39,7 @@ export function Picker(_ref) {
61
39
  spectrumPickerProps = _objectWithoutProperties(_ref, _excluded);
62
40
  var normalizedItems = useMemo(() => normalizeItemList(children), [children]);
63
41
  var tooltipOptions = useMemo(() => normalizeTooltipOptions(tooltip), [tooltip]);
64
- var renderItem = useCallback(normalizedItem => {
65
- var _normalizedItem$item$, _normalizedItem$item, _normalizedItem$item$2, _normalizedItem$item2;
66
- var key = getItemKey(normalizedItem);
67
- var content = (_normalizedItem$item$ = (_normalizedItem$item = normalizedItem.item) === null || _normalizedItem$item === void 0 ? void 0 : _normalizedItem$item.content) !== null && _normalizedItem$item$ !== void 0 ? _normalizedItem$item$ : '';
68
- var textValue = (_normalizedItem$item$2 = (_normalizedItem$item2 = normalizedItem.item) === null || _normalizedItem$item2 === void 0 ? void 0 : _normalizedItem$item2.textValue) !== null && _normalizedItem$item$2 !== void 0 ? _normalizedItem$item$2 : '';
69
- return /*#__PURE__*/_jsx(Item
70
- // Note that setting the `key` prop explicitly on `Item` elements
71
- // causes the picker to expect `selectedKey` and `defaultSelectedKey`
72
- // to be strings. It also passes the stringified value of the key to
73
- // `onSelectionChange` handlers` regardless of the actual type of the
74
- // key. We can't really get around setting in order to support Windowed
75
- // data, so we'll need to do some manual conversion of keys to strings
76
- // in other places of this component.
77
- , {
78
- // The `textValue` prop gets used to provide the content of `<option>`
79
- // elements that back the Spectrum Picker. These are not visible in the UI,
80
- // but are used for accessibility purposes, so we set to an arbitrary
81
- // 'Empty' value so that they are not empty strings.
82
- textValue: textValue === '' ? 'Empty' : textValue,
83
- children: /*#__PURE__*/_jsxs(_Fragment, {
84
- children: [/*#__PURE__*/_jsx(PickerItemContent, {
85
- children: content
86
- }), tooltipOptions == null || content === '' ? null : /*#__PURE__*/_jsx(Tooltip, {
87
- options: tooltipOptions,
88
- children: createTooltipContent(content)
89
- })]
90
- })
91
- }, key);
92
- }, [tooltipOptions]);
42
+ var renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);
93
43
  var getInitialScrollPositionInternal = useCallback(() => getInitialScrollPosition == null ? getPositionOfSelectedItem({
94
44
  keyedItems: normalizedItems,
95
45
  // TODO: #1890 & deephaven-plugins#371 add support for sections and
@@ -119,7 +69,6 @@ export function Picker(_ref) {
119
69
  return /*#__PURE__*/_jsx(SpectrumPicker
120
70
  // eslint-disable-next-line react/jsx-props-no-spreading
121
71
  , _objectSpread(_objectSpread({}, spectrumPickerProps), {}, {
122
- // The `ref` prop type defined by React Spectrum is incorrect here
123
72
  ref: scrollRef,
124
73
  onOpenChange: onOpenChangeInternal,
125
74
  UNSAFE_className: cl('dh-picker', UNSAFE_className),
@@ -129,8 +78,8 @@ export function Picker(_ref) {
129
78
  // ensure that `selectedKey` and `defaultSelectedKey` are strings in order
130
79
  // for selection to work.
131
80
  ,
132
- selectedKey: selectedKey === null || selectedKey === void 0 ? void 0 : selectedKey.toString(),
133
- defaultSelectedKey: defaultSelectedKey === null || defaultSelectedKey === void 0 ? void 0 : defaultSelectedKey.toString()
81
+ selectedKey: selectedKey == null ? selectedKey : selectedKey.toString(),
82
+ defaultSelectedKey: defaultSelectedKey == null ? defaultSelectedKey : defaultSelectedKey.toString()
134
83
  // `onChange` is just an alias for `onSelectionChange`
135
84
  ,
136
85
  onSelectionChange: onSelectionChangeInternal,
@@ -140,10 +89,10 @@ export function Picker(_ref) {
140
89
  return /*#__PURE__*/_jsx(Section, {
141
90
  title: (_itemOrSection$item = itemOrSection.item) === null || _itemOrSection$item === void 0 ? void 0 : _itemOrSection$item.title,
142
91
  items: (_itemOrSection$item2 = itemOrSection.item) === null || _itemOrSection$item2 === void 0 ? void 0 : _itemOrSection$item2.items,
143
- children: renderItem
92
+ children: renderNormalizedItem
144
93
  }, getItemKey(itemOrSection));
145
94
  }
146
- return renderItem(itemOrSection);
95
+ return renderNormalizedItem(itemOrSection);
147
96
  }
148
97
  }));
149
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.js","names":["useCallback","useMemo","Flex","Picker","SpectrumPicker","getPositionOfSelectedItem","findSpectrumPickerScrollArea","isElementOfType","usePopoverOnScrollRef","EMPTY_FUNCTION","PICKER_ITEM_HEIGHT","PICKER_TOP_OFFSET","cl","Tooltip","isNormalizedSection","normalizeItemList","normalizeTooltipOptions","getItemKey","PickerItemContent","Item","Section","Text","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","createTooltipContent","content","String","Array","isArray","direction","alignItems","children","filter","node","_ref","tooltip","defaultSelectedKey","selectedKey","getInitialScrollPosition","onChange","onOpenChange","onScroll","onSelectionChange","UNSAFE_className","spectrumPickerProps","_objectWithoutProperties","_excluded","normalizedItems","tooltipOptions","renderItem","normalizedItem","_normalizedItem$item$","_normalizedItem$item","_normalizedItem$item$2","_normalizedItem$item2","key","item","textValue","options","getInitialScrollPositionInternal","keyedItems","itemHeight","topOffset","ref","scrollRef","popoverOnOpenChange","onOpenChangeInternal","isOpen","onSelectionChangeInternal","_getItemKey","_ref2","selectedItem","find","actualKey","_objectSpread","items","toString","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import { Key, ReactNode, useCallback, useMemo } from 'react';\nimport { DOMRef } from '@react-types/shared';\nimport { Flex, Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport {\n getPositionOfSelectedItem,\n findSpectrumPickerScrollArea,\n isElementOfType,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport {\n EMPTY_FUNCTION,\n PICKER_ITEM_HEIGHT,\n PICKER_TOP_OFFSET,\n} from '@deephaven/utils';\nimport cl from 'classnames';\nimport { Tooltip } from '../../popper';\nimport {\n isNormalizedSection,\n NormalizedSpectrumPickerProps,\n normalizeItemList,\n normalizeTooltipOptions,\n NormalizedItem,\n ItemOrSection,\n TooltipOptions,\n ItemKey,\n getItemKey,\n} from '../utils/itemUtils';\nimport { PickerItemContent } from './PickerItemContent';\nimport { Item, Section } from '../shared';\nimport { Text } from '../Text';\n\nexport type PickerProps = {\n children: ItemOrSection | ItemOrSection[] | NormalizedItem[];\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n /** The currently selected key in the collection (controlled). */\n selectedKey?: ItemKey | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: ItemKey;\n /** Function to retrieve initial scroll position when opening the picker */\n getInitialScrollPosition?: () => Promise<number | null>;\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) => 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) => void;\n} /*\n * Support remaining SpectrumPickerProps.\n * Note that `selectedKey`, `defaultSelectedKey`, and `onSelectionChange` are\n * re-defined above to account for boolean types which aren't included in the\n * React `Key` type, but are actually supported by the Spectrum Picker component.\n */ & Omit<\n NormalizedSpectrumPickerProps,\n | 'children'\n | 'items'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n>;\n\n/**\n * Create tooltip content optionally wrapping with a Flex column for array\n * content. This is needed for Items containing description `Text` elements.\n */\nfunction createTooltipContent(content: ReactNode) {\n if (typeof content === 'boolean') {\n return String(content);\n }\n\n if (Array.isArray(content)) {\n return (\n <Flex direction=\"column\" alignItems=\"start\">\n {content.filter(node => isElementOfType(node, Text))}\n </Flex>\n );\n }\n\n return content;\n}\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `items` prop or as children. Each item can be a string,\n * number, boolean, or a Spectrum <Item> element. The remaining props are just\n * pass through props for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport function Picker({\n children,\n tooltip = true,\n defaultSelectedKey,\n selectedKey,\n getInitialScrollPosition,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n // eslint-disable-next-line camelcase\n UNSAFE_className,\n ...spectrumPickerProps\n}: PickerProps): JSX.Element {\n const normalizedItems = useMemo(\n () => normalizeItemList(children),\n [children]\n );\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const renderItem = useCallback(\n (normalizedItem: NormalizedItem) => {\n const key = getItemKey(normalizedItem);\n const content = normalizedItem.item?.content ?? '';\n const textValue = normalizedItem.item?.textValue ?? '';\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 places of this component.\n key={key 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 // 'Empty' value so that they are not empty strings.\n textValue={textValue === '' ? 'Empty' : textValue}\n >\n <>\n <PickerItemContent>{content}</PickerItemContent>\n {tooltipOptions == null || content === '' ? null : (\n <Tooltip options={tooltipOptions}>\n {createTooltipContent(content)}\n </Tooltip>\n )}\n </>\n </Item>\n );\n },\n [tooltipOptions]\n );\n\n const getInitialScrollPositionInternal = useCallback(\n () =>\n getInitialScrollPosition == null\n ? getPositionOfSelectedItem({\n keyedItems: normalizedItems,\n // TODO: #1890 & deephaven-plugins#371 add support for sections and\n // items with descriptions since they impact the height calculations\n itemHeight: PICKER_ITEM_HEIGHT,\n selectedKey,\n topOffset: PICKER_TOP_OFFSET,\n })\n : getInitialScrollPosition(),\n [getInitialScrollPosition, normalizedItems, selectedKey]\n );\n\n const { ref: scrollRef, onOpenChange: popoverOnOpenChange } =\n usePopoverOnScrollRef(\n findSpectrumPickerScrollArea,\n onScroll,\n getInitialScrollPositionInternal\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n const onSelectionChangeInternal = useCallback(\n (key: ItemKey): void => {\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 ?? onSelectionChange)?.(actualKey);\n },\n [normalizedItems, onChange, onSelectionChange]\n );\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumPickerProps}\n // The `ref` prop type defined by React Spectrum is incorrect here\n ref={scrollRef as unknown as DOMRef<HTMLDivElement>}\n onOpenChange={onOpenChangeInternal}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n items={normalizedItems}\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 // ensure that `selectedKey` and `defaultSelectedKey` are strings in order\n // for selection to work.\n selectedKey={selectedKey?.toString()}\n defaultSelectedKey={defaultSelectedKey?.toString()}\n // `onChange` is just an alias for `onSelectionChange`\n onSelectionChange={\n onSelectionChangeInternal as NormalizedSpectrumPickerProps['onSelectionChange']\n }\n >\n {itemOrSection => {\n if (isNormalizedSection(itemOrSection)) {\n return (\n <Section\n key={getItemKey(itemOrSection)}\n title={itemOrSection.item?.title}\n items={itemOrSection.item?.items}\n >\n {renderItem}\n </Section>\n );\n }\n\n return renderItem(itemOrSection);\n }}\n </SpectrumPicker>\n );\n}\n\nexport default Picker;\n"],"mappings":";;;;;;;;AAAA,SAAyBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAE5D,SAASC,IAAI,EAAEC,MAAM,IAAIC,cAAc,QAAQ,uBAAuB;AACtE,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,eAAe,EACfC,qBAAqB,QAChB,wBAAwB;AAC/B,SACEC,cAAc,EACdC,kBAAkB,EAClBC,i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CvB,gBAAgB,EAAEnC,EAAE,CAAC,WAAW,EAAEmC,gBAAgB,CAAE;IACpDgC,KAAK,EAAE5B;IACP;IACA;IACA;IACA;IAAA;IACAV,WAAW,EAAEA,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEuC,QAAQ,CAAC,CAAE;IACrCxC,kBAAkB,EAAEA,kBAAkB,aAAlBA,kBAAkB,uBAAlBA,kBAAkB,CAAEwC,QAAQ,CAAC;IACjD;IAAA;IACAlC,iBAAiB,EACf0B,yBACD;IAAArC,QAAA,EAEA8C,aAAa,IAAI;MAChB,IAAInE,mBAAmB,CAACmE,aAAa,CAAC,EAAE;QAAA,IAAAC,mBAAA,EAAAC,oBAAA;QACtC,oBACE5D,IAAA,CAACH,OAAO;UAENgE,KAAK,GAAAF,mBAAA,GAAED,aAAa,CAACrB,IAAI,cAAAsB,mBAAA,uBAAlBA,mBAAA,CAAoBE,KAAM;UACjCL,KAAK,GAAAI,oBAAA,GAAEF,aAAa,CAACrB,IAAI,cAAAuB,oBAAA,uBAAlBA,oBAAA,CAAoBJ,KAAM;UAAA5C,QAAA,EAEhCkB;QAAU,GAJNpC,UAAU,CAACgE,aAAa,CAKtB,CAAC;MAEd;MAEA,OAAO5B,UAAU,CAAC4B,aAAa,CAAC;IAClC;EAAC,EACa,CAAC;AAErB;AAEA,eAAe9E,MAAM"}
1
+ {"version":3,"file":"Picker.js","names":["useCallback","useMemo","Picker","SpectrumPicker","getPositionOfSelectedItem","findSpectrumPickerScrollArea","usePopoverOnScrollRef","EMPTY_FUNCTION","PICKER_ITEM_HEIGHT","PICKER_TOP_OFFSET","cl","isNormalizedSection","normalizeItemList","normalizeTooltipOptions","getItemKey","Section","useRenderNormalizedItem","jsx","_jsx","_ref","children","tooltip","defaultSelectedKey","selectedKey","getInitialScrollPosition","onChange","onOpenChange","onScroll","onSelectionChange","UNSAFE_className","spectrumPickerProps","_objectWithoutProperties","_excluded","normalizedItems","tooltipOptions","renderNormalizedItem","getInitialScrollPositionInternal","keyedItems","itemHeight","topOffset","ref","scrollRef","popoverOnOpenChange","onOpenChangeInternal","isOpen","onSelectionChangeInternal","key","_getItemKey","_ref2","selectedItem","find","item","String","actualKey","_objectSpread","items","toString","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { DOMRef } from '@react-types/shared';\nimport { Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport {\n getPositionOfSelectedItem,\n findSpectrumPickerScrollArea,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport {\n EMPTY_FUNCTION,\n PICKER_ITEM_HEIGHT,\n PICKER_TOP_OFFSET,\n} from '@deephaven/utils';\nimport cl from 'classnames';\nimport {\n isNormalizedSection,\n NormalizedSpectrumPickerProps,\n normalizeItemList,\n normalizeTooltipOptions,\n NormalizedItem,\n ItemOrSection,\n TooltipOptions,\n ItemKey,\n getItemKey,\n} from '../utils/itemUtils';\nimport { Section } from '../shared';\nimport { useRenderNormalizedItem } from '../utils';\n\nexport type PickerProps = {\n children: ItemOrSection | ItemOrSection[] | NormalizedItem[];\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n /** The currently selected key in the collection (controlled). */\n selectedKey?: ItemKey | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: ItemKey;\n /** Function to retrieve initial scroll position when opening the picker */\n getInitialScrollPosition?: () => Promise<number | null>;\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) => 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) => void;\n} /*\n * Support remaining SpectrumPickerProps.\n * Note that `selectedKey`, `defaultSelectedKey`, and `onSelectionChange` are\n * re-defined above to account for boolean types which aren't included in the\n * React `Key` type, but are actually supported by the Spectrum Picker component.\n */ & Omit<\n NormalizedSpectrumPickerProps,\n | 'children'\n | 'items'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n>;\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `items` prop or as children. Each item can be a string,\n * number, boolean, or a Spectrum <Item> element. The remaining props are just\n * pass through props for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport function Picker({\n children,\n tooltip = true,\n defaultSelectedKey,\n selectedKey,\n getInitialScrollPosition,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n // eslint-disable-next-line camelcase\n UNSAFE_className,\n ...spectrumPickerProps\n}: PickerProps): JSX.Element {\n const normalizedItems = useMemo(\n () => normalizeItemList(children),\n [children]\n );\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);\n\n const getInitialScrollPositionInternal = useCallback(\n () =>\n getInitialScrollPosition == null\n ? getPositionOfSelectedItem({\n keyedItems: normalizedItems,\n // TODO: #1890 & deephaven-plugins#371 add support for sections and\n // items with descriptions since they impact the height calculations\n itemHeight: PICKER_ITEM_HEIGHT,\n selectedKey,\n topOffset: PICKER_TOP_OFFSET,\n })\n : getInitialScrollPosition(),\n [getInitialScrollPosition, normalizedItems, selectedKey]\n );\n\n const { ref: scrollRef, onOpenChange: popoverOnOpenChange } =\n usePopoverOnScrollRef(\n findSpectrumPickerScrollArea,\n onScroll,\n getInitialScrollPositionInternal\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n const onSelectionChangeInternal = useCallback(\n (key: ItemKey): void => {\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 ?? onSelectionChange)?.(actualKey);\n },\n [normalizedItems, onChange, onSelectionChange]\n );\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumPickerProps}\n ref={scrollRef as unknown as DOMRef<HTMLDivElement>}\n onOpenChange={onOpenChangeInternal}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n items={normalizedItems}\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 // ensure that `selectedKey` and `defaultSelectedKey` are strings in order\n // for selection to work.\n selectedKey={selectedKey == null ? selectedKey : selectedKey.toString()}\n defaultSelectedKey={\n defaultSelectedKey == null\n ? defaultSelectedKey\n : defaultSelectedKey.toString()\n }\n // `onChange` is just an alias for `onSelectionChange`\n onSelectionChange={\n onSelectionChangeInternal as NormalizedSpectrumPickerProps['onSelectionChange']\n }\n >\n {itemOrSection => {\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 </SpectrumPicker>\n );\n}\n\nexport default Picker;\n"],"mappings":";;;;;;;;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAE5C,SAASC,MAAM,IAAIC,cAAc,QAAQ,uBAAuB;AAChE,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,qBAAqB,QAChB,wBAAwB;AAC/B,SACEC,cAAc,EACdC,kBAAkB,EAClBC,iBAAiB,QACZ,kBAAkB;AACzB,OAAOC,EAAE,MAAM,YAAY;AAAC,SAE1BC,mBAAmB,EAEnBC,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,CAAC,EAAE;QAAA,IAAAC,mBAAA,EAAAC,oBAAA;QACtC,oBACEzC,IAAA,CAACH,OAAO;UAEN6C,KAAK,GAAAF,mBAAA,GAAED,aAAa,CAACN,IAAI,cAAAO,mBAAA,uBAAlBA,mBAAA,CAAoBE,KAAM;UACjCL,KAAK,GAAAI,oBAAA,GAAEF,aAAa,CAACN,IAAI,cAAAQ,oBAAA,uBAAlBA,oBAAA,CAAoBJ,KAAM;UAAAnC,QAAA,EAEhCe;QAAoB,GAJhBrB,UAAU,CAAC2C,aAAa,CAKtB,CAAC;MAEd;MAEA,OAAOtB,oBAAoB,CAACsB,aAAa,CAAC;IAC5C;EAAC,EACa,CAAC;AAErB;AAEA,eAAevD,MAAM"}
@@ -1,3 +1,2 @@
1
1
  export * from './Picker';
2
- export * from './PickerItemContent';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export * from "./Picker.js";
2
- export * from "./PickerItemContent.js";
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/picker/index.ts"],"sourcesContent":["export * from './Picker';\nexport * from './PickerItemContent';\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/picker/index.ts"],"sourcesContent":["export * from './Picker';\n"],"mappings":""}
@@ -1,3 +1,5 @@
1
1
  export * from './itemUtils';
2
2
  export * from './themeUtils';
3
+ export * from './useRenderNormalizedItem';
4
+ export * from './useStringifiedMultiSelection';
3
5
  //# 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,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export * from "./itemUtils.js";
2
2
  export * from "./themeUtils.js";
3
+ export * from "./useRenderNormalizedItem.js";
4
+ export * from "./useStringifiedMultiSelection.js";
3
5
  //# 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 './themeUtils';\nexport * from './useRenderNormalizedItem';\nexport * from './useStringifiedMultiSelection';\n"],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import { Key, ReactElement, ReactNode } from 'react';
2
2
  import { SpectrumPickerProps } from '@adobe/react-spectrum';
3
3
  import type { ItemRenderer } from '@react-types/shared';
4
- import { KeyedItem } from '@deephaven/utils';
4
+ import { KeyedItem, SelectionT } from '@deephaven/utils';
5
5
  import { ItemProps, SectionProps } from '../shared';
6
6
  import { PopperOptions } from '../../popper';
7
7
  export declare const INVALID_ITEM_ERROR_MESSAGE = "Items must be strings, numbers, booleans, <Item> or <Section> elements:";
@@ -23,6 +23,7 @@ export type ItemOrSection = ItemElementOrPrimitive | SectionElement;
23
23
  * don't reflect it.
24
24
  */
25
25
  export type ItemKey = Key | boolean;
26
+ export type ItemSelection = SelectionT<ItemKey>;
26
27
  /**
27
28
  * Augment the Spectrum selection change handler type to include boolean keys.
28
29
  * Spectrum components already supports this, but the built in types don't
@@ -49,6 +50,7 @@ export interface NormalizedSectionData {
49
50
  */
50
51
  export type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey | undefined>;
51
52
  export type NormalizedSection = KeyedItem<NormalizedSectionData, Key | undefined>;
53
+ export type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> = TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;
52
54
  export type NormalizedSpectrumPickerProps = SpectrumPickerProps<NormalizedItem>;
53
55
  export type TooltipOptions = {
54
56
  placement: PopperOptions['placement'];
@@ -76,12 +78,12 @@ export declare function isSectionElement<T>(node: ReactNode): node is ReactEleme
76
78
  */
77
79
  export declare function isItemElement<T>(node: ReactNode): node is ReactElement<ItemProps<T>>;
78
80
  /**
79
- * Determine if a node is an array containing normalized items with keys.
80
- * Note that this only checks the first node in the array.
81
+ * Determine if a node is an array containing normalized items or sections with
82
+ * keys. Note that this only checks the first node in the array.
81
83
  * @param node The node to check
82
- * @returns True if the node is a normalized item with keys array
84
+ * @returns True if the node is a normalized item or section with keys array
83
85
  */
84
- export declare function isNormalizedItemsWithKeysList(node: ItemOrSection | ItemOrSection[] | (NormalizedItem | NormalizedSection)[]): node is (NormalizedItem | NormalizedSection)[];
86
+ export declare function isNormalizedItemsWithKeysList<TItemOrSection extends ItemOrSection>(node: TItemOrSection | TItemOrSection[] | NormalizedItemOrSection<TItemOrSection>[]): node is NormalizedItemOrSection<TItemOrSection>[];
85
87
  /**
86
88
  * Determine if an object is a normalized section.
87
89
  * @param maybeNormalizedSection The object to check
@@ -96,16 +98,24 @@ export declare function isNormalizedSection(maybeNormalizedSection: NormalizedIt
96
98
  */
97
99
  export declare function isItemOrSection(node: ReactNode): node is ItemOrSection;
98
100
  /**
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
101
+ * Normalize an item or section or a list of items or sections.
102
+ * @param itemsOrSections An item or section or array of items or sections
103
+ * @returns An array of normalized items or sections
102
104
  */
103
- export declare function normalizeItemList(itemsOrSections: ItemOrSection | ItemOrSection[] | NormalizedItem[]): (NormalizedItem | NormalizedSection)[];
105
+ export declare function normalizeItemList<TItemOrSection extends ItemOrSection>(itemsOrSections: TItemOrSection | TItemOrSection[] | NormalizedItem[]): NormalizedItemOrSection<TItemOrSection>[];
104
106
  /**
105
107
  * Returns a TooltipOptions object or null if options is false or null.
106
- * @param options
108
+ * @param options Tooltip options
109
+ * @param placement Default placement for the tooltip if `options` is set
110
+ * explicitly to `true`
107
111
  * @returns TooltipOptions or null
108
112
  */
109
- export declare function normalizeTooltipOptions(options?: boolean | TooltipOptions | null): TooltipOptions | null;
113
+ export declare function normalizeTooltipOptions(options?: boolean | TooltipOptions | null, placement?: TooltipOptions['placement']): TooltipOptions | null;
114
+ /**
115
+ * Convert a selection of `ItemKey`s to a selection of strings.
116
+ * @param itemKeys The selection of `ItemKey`s
117
+ * @returns The selection of strings
118
+ */
119
+ export declare function itemSelectionToStringSet(itemKeys?: 'all' | Iterable<ItemKey>): undefined | 'all' | Set<string>;
110
120
  export {};
111
121
  //# 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,EAAkB,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAQ,SAAS,EAAW,YAAY,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,eAAO,MAAM,0BAA0B,4EACoC,CAAC;AAE5E;;;;G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,CAAC,CAAC,EAC7B,IAAI,EAAE,SAAS,GACd,IAAI,IAAI,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAEpC;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,cAAc,SAAS,aAAa,EAEpC,IAAI,EACA,cAAc,GACd,cAAc,EAAE,GAChB,uBAAuB,CAAC,cAAc,CAAC,EAAE,GAC5C,IAAI,IAAI,uBAAuB,CAAC,cAAc,CAAC,EAAE,CAUnD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,sBAAsB,EAAE,cAAc,GAAG,iBAAiB,GACzD,sBAAsB,IAAI,iBAAiB,CAK7C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI,aAAa,CAQtE;AAiGD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,SAAS,aAAa,EACpE,eAAe,EAAE,cAAc,GAAG,cAAc,EAAE,GAAG,cAAc,EAAE,GACpE,uBAAuB,CAAC,cAAc,CAAC,EAAE,CAW3C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,EACzC,SAAS,GAAE,cAAc,CAAC,WAAW,CAAW,GAC/C,cAAc,GAAG,IAAI,CAUvB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GACnC,SAAS,GAAG,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAMjC"}
@@ -64,10 +64,10 @@ export function isItemElement(node) {
64
64
  }
65
65
 
66
66
  /**
67
- * Determine if a node is an array containing normalized items with keys.
68
- * Note that this only checks the first node in the array.
67
+ * Determine if a node is an array containing normalized items or sections with
68
+ * keys. Note that this only checks the first node in the array.
69
69
  * @param node The node to check
70
- * @returns True if the node is a normalized item with keys array
70
+ * @returns True if the node is a normalized item or section with keys array
71
71
  */
72
72
  export function isNormalizedItemsWithKeysList(node) {
73
73
  if (!Array.isArray(node)) {
@@ -182,9 +182,9 @@ function normalizeItem(itemOrSection) {
182
182
  }
183
183
 
184
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
185
+ * Normalize an item or section or a list of items or sections.
186
+ * @param itemsOrSections An item or section or array of items or sections
187
+ * @returns An array of normalized items or sections
188
188
  */
189
189
  export function normalizeItemList(itemsOrSections) {
190
190
  // If already normalized, just return as-is
@@ -197,18 +197,33 @@ export function normalizeItemList(itemsOrSections) {
197
197
 
198
198
  /**
199
199
  * Returns a TooltipOptions object or null if options is false or null.
200
- * @param options
200
+ * @param options Tooltip options
201
+ * @param placement Default placement for the tooltip if `options` is set
202
+ * explicitly to `true`
201
203
  * @returns TooltipOptions or null
202
204
  */
203
205
  export function normalizeTooltipOptions(options) {
206
+ var placement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'right';
204
207
  if (options == null || options === false) {
205
208
  return null;
206
209
  }
207
210
  if (options === true) {
208
211
  return {
209
- placement: 'right'
212
+ placement
210
213
  };
211
214
  }
212
215
  return options;
213
216
  }
217
+
218
+ /**
219
+ * Convert a selection of `ItemKey`s to a selection of strings.
220
+ * @param itemKeys The selection of `ItemKey`s
221
+ * @returns The selection of strings
222
+ */
223
+ export function itemSelectionToStringSet(itemKeys) {
224
+ if (itemKeys == null || itemKeys === 'all') {
225
+ return itemKeys;
226
+ }
227
+ return new Set([...itemKeys].map(String));
228
+ }
214
229
  //# sourceMappingURL=itemUtils.js.map