@deephaven/components 0.77.1-beta.0 → 0.77.1-beta.11

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 (85) hide show
  1. package/css/BaseStyleSheet.css.map +1 -1
  2. package/dist/BasicModal.js +2 -2
  3. package/dist/BasicModal.js.map +1 -1
  4. package/dist/ComboBox.css.map +1 -1
  5. package/dist/CustomTimeSelect.css.map +1 -1
  6. package/dist/DraggableItemList.css.map +1 -1
  7. package/dist/ErrorView.css +1 -1
  8. package/dist/ErrorView.css.map +1 -1
  9. package/dist/HierarchicalCheckboxMenu.css.map +1 -1
  10. package/dist/LoadingOverlay.css +2 -1
  11. package/dist/LoadingOverlay.css.map +1 -1
  12. package/dist/SearchInput.css.map +1 -1
  13. package/dist/{ButtonGroup.d.ts → SplitButtonGroup.d.ts} +5 -5
  14. package/dist/SplitButtonGroup.d.ts.map +1 -0
  15. package/dist/{ButtonGroup.js → SplitButtonGroup.js} +6 -6
  16. package/dist/SplitButtonGroup.js.map +1 -0
  17. package/dist/TimeSlider.css.map +1 -1
  18. package/dist/TimeSlider.module.css.map +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/navigation/MenuItem.css.map +1 -1
  24. package/dist/navigation/NavTab.d.ts.map +1 -1
  25. package/dist/navigation/NavTab.js +18 -5
  26. package/dist/navigation/NavTab.js.map +1 -1
  27. package/dist/navigation/NavTabList.css.map +1 -1
  28. package/dist/spectrum/ActionGroup.d.ts +14 -0
  29. package/dist/spectrum/ActionGroup.d.ts.map +1 -0
  30. package/dist/spectrum/ActionGroup.js +42 -0
  31. package/dist/spectrum/ActionGroup.js.map +1 -0
  32. package/dist/spectrum/ActionMenu.d.ts +15 -0
  33. package/dist/spectrum/ActionMenu.d.ts.map +1 -0
  34. package/dist/spectrum/ActionMenu.js +35 -0
  35. package/dist/spectrum/ActionMenu.js.map +1 -0
  36. package/dist/spectrum/ListActionGroup.d.ts +19 -0
  37. package/dist/spectrum/ListActionGroup.d.ts.map +1 -0
  38. package/dist/spectrum/ListActionGroup.js +9 -0
  39. package/dist/spectrum/ListActionGroup.js.map +1 -0
  40. package/dist/spectrum/ListActionMenu.d.ts +19 -0
  41. package/dist/spectrum/ListActionMenu.d.ts.map +1 -0
  42. package/dist/spectrum/ListActionMenu.js +9 -0
  43. package/dist/spectrum/ListActionMenu.js.map +1 -0
  44. package/dist/spectrum/buttons.d.ts +1 -1
  45. package/dist/spectrum/buttons.d.ts.map +1 -1
  46. package/dist/spectrum/buttons.js +5 -1
  47. package/dist/spectrum/buttons.js.map +1 -1
  48. package/dist/spectrum/collections.d.ts +1 -1
  49. package/dist/spectrum/collections.d.ts.map +1 -1
  50. package/dist/spectrum/collections.js +5 -1
  51. package/dist/spectrum/collections.js.map +1 -1
  52. package/dist/spectrum/forms.d.ts.map +1 -1
  53. package/dist/spectrum/forms.js +6 -1
  54. package/dist/spectrum/forms.js.map +1 -1
  55. package/dist/spectrum/index.d.ts +4 -0
  56. package/dist/spectrum/index.d.ts.map +1 -1
  57. package/dist/spectrum/index.js +4 -0
  58. package/dist/spectrum/index.js.map +1 -1
  59. package/dist/spectrum/listView/ListView.d.ts +2 -17
  60. package/dist/spectrum/listView/ListView.d.ts.map +1 -1
  61. package/dist/spectrum/listView/ListView.js.map +1 -1
  62. package/dist/spectrum/listView/ListViewNormalized.d.ts +3 -2
  63. package/dist/spectrum/listView/ListViewNormalized.d.ts.map +1 -1
  64. package/dist/spectrum/listView/ListViewNormalized.js +4 -2
  65. package/dist/spectrum/listView/ListViewNormalized.js.map +1 -1
  66. package/dist/spectrum/listView/ListViewWrapper.css +12 -3
  67. package/dist/spectrum/listView/ListViewWrapper.css.map +1 -1
  68. package/dist/spectrum/shared.d.ts +3 -1
  69. package/dist/spectrum/shared.d.ts.map +1 -1
  70. package/dist/spectrum/shared.js.map +1 -1
  71. package/dist/spectrum/utils/itemUtils.d.ts +20 -3
  72. package/dist/spectrum/utils/itemUtils.d.ts.map +1 -1
  73. package/dist/spectrum/utils/itemUtils.js.map +1 -1
  74. package/dist/spectrum/utils/itemWrapperUtils.d.ts +1 -1
  75. package/dist/spectrum/utils/itemWrapperUtils.d.ts.map +1 -1
  76. package/dist/spectrum/utils/itemWrapperUtils.js.map +1 -1
  77. package/dist/spectrum/utils/useRenderNormalizedItem.d.ts +7 -2
  78. package/dist/spectrum/utils/useRenderNormalizedItem.d.ts.map +1 -1
  79. package/dist/spectrum/utils/useRenderNormalizedItem.js +40 -6
  80. package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -1
  81. package/package.json +7 -7
  82. package/scss/new_variables.scss +1 -1
  83. package/scss/util.scss +4 -0
  84. package/dist/ButtonGroup.d.ts.map +0 -1
  85. package/dist/ButtonGroup.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ListViewNormalized.js","names":["useMemo","cl","normalizeTooltipOptions","useRenderNormalizedItem","useStringifiedMultiSelection","ListViewWrapper","createElement","_createElement","ListViewNormalized","_ref","normalizedItems","tooltip","selectedKeys","defaultSelectedKeys","disabledKeys","showItemIcons","UNSAFE_className","onChange","onSelectionChange","props","_objectWithoutProperties","_excluded","tooltipOptions","renderNormalizedItem","itemIconSlot","showItemDescriptions","forceRerenderKey","concat","placement","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","_objectSpread","key","items"],"sources":["../../../src/spectrum/listView/ListViewNormalized.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport cl from 'classnames';\nimport {\n NormalizedItem,\n normalizeTooltipOptions,\n useRenderNormalizedItem,\n useStringifiedMultiSelection,\n} from '../utils';\nimport type { ListViewProps } from './ListView';\nimport { ListViewWrapper } from './ListViewWrapper';\n\nexport interface ListViewNormalizedProps\n extends Omit<ListViewProps, 'children'> {\n normalizedItems: NormalizedItem[];\n showItemIcons: boolean;\n}\n\n/**\n * ListView supporting normalized item data. This component mostly exists to\n * decouple some of the logic needed to support table data. Specifically it\n * handles item rendering configurations as well as converting selection keys\n * to / from strings. This makes it easier to test logic in isolation without\n * a dependency on JS apis (e.g. in the Styleguide).\n *\n * Note that This component will usually not be used directly. Instead, it is\n * recommended to use\n * - `@deephaven/components`'s `ListView` for non-table data sources\n * - `@deephaven/jsapi-components`'s `ListView` for table data sources\n */\nexport function ListViewNormalized({\n normalizedItems,\n tooltip = true,\n selectedKeys,\n defaultSelectedKeys,\n disabledKeys,\n showItemIcons,\n UNSAFE_className,\n onChange,\n onSelectionChange,\n ...props\n}: ListViewNormalizedProps): JSX.Element {\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip, 'bottom'),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem({\n itemIconSlot: 'illustration',\n // Descriptions introduce variable item heights which throws off setting\n // viewport on windowed data. For now not going to implement description\n // support in Picker.\n // https://github.com/deephaven/web-client-ui/issues/1958\n showItemDescriptions: false,\n showItemIcons,\n tooltipOptions,\n });\n\n // Spectrum doesn't re-render if only the `renderNormalizedItems` function\n // changes, so we create a key from its dependencies that can be used to force\n // re-render.\n const forceRerenderKey = `${showItemIcons}-${tooltipOptions?.placement}`;\n\n const {\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 return (\n <ListViewWrapper\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n UNSAFE_className={cl('dh-list-view-normalized', UNSAFE_className)}\n key={forceRerenderKey}\n items={normalizedItems}\n selectedKeys={selectedStringKeys}\n defaultSelectedKeys={defaultSelectedStringKeys}\n disabledKeys={disabledStringKeys}\n onSelectionChange={onStringSelectionChange}\n >\n {renderNormalizedItem}\n </ListViewWrapper>\n );\n}\n\nexport default ListViewNormalized;\n"],"mappings":";;;;;;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EAAE,CAAC,yBAAyB,EAAEe,gBAAgB,CAAE;IAClEkB,GAAG,EAAER,gBAAiB;IACtBS,KAAK,EAAEzB,eAAgB;IACvBE,YAAY,EAAEiB,kBAAmB;IACjChB,mBAAmB,EAAEiB,yBAA0B;IAC/ChB,YAAY,EAAEiB,kBAAmB;IACjCb,iBAAiB,EAAEc;EAAwB,IAE1CT,oBACc,CAAC;AAEtB;AAEA,eAAef,kBAAkB"}
1
+ {"version":3,"file":"ListViewNormalized.js","names":["useMemo","cl","normalizeTooltipOptions","useRenderNormalizedItem","useStringifiedMultiSelection","ListViewWrapper","createElement","_createElement","ListViewNormalized","_ref","normalizedItems","tooltip","selectedKeys","defaultSelectedKeys","disabledKeys","showItemIcons","actions","UNSAFE_className","onChange","onSelectionChange","props","_objectWithoutProperties","_excluded","tooltipOptions","renderNormalizedItem","itemIconSlot","showItemDescriptions","forceRerenderKey","concat","placement","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","_objectSpread","key","items"],"sources":["../../../src/spectrum/listView/ListViewNormalized.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport cl from 'classnames';\nimport {\n ListActions,\n NormalizedItem,\n normalizeTooltipOptions,\n useRenderNormalizedItem,\n useStringifiedMultiSelection,\n} from '../utils';\nimport type { ListViewProps } from './ListView';\nimport { ListViewWrapper } from './ListViewWrapper';\n\nexport interface ListViewNormalizedProps\n extends Omit<ListViewProps, 'children'> {\n normalizedItems: NormalizedItem[];\n showItemIcons: boolean;\n actions?: ListActions<unknown>;\n}\n\n/**\n * ListView supporting normalized item data. This component mostly exists to\n * decouple some of the logic needed to support table data. Specifically it\n * handles item rendering configurations as well as converting selection keys\n * to / from strings. This makes it easier to test logic in isolation without\n * a dependency on JS apis (e.g. in the Styleguide).\n *\n * Note that This component will usually not be used directly. Instead, it is\n * recommended to use\n * - `@deephaven/components`'s `ListView` for non-table data sources\n * - `@deephaven/jsapi-components`'s `ListView` for table data sources\n */\nexport function ListViewNormalized({\n normalizedItems,\n tooltip = true,\n selectedKeys,\n defaultSelectedKeys,\n disabledKeys,\n showItemIcons,\n actions,\n UNSAFE_className,\n onChange,\n onSelectionChange,\n ...props\n}: ListViewNormalizedProps): JSX.Element {\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip, 'bottom'),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem({\n itemIconSlot: 'illustration',\n // Descriptions introduce variable item heights which throws off setting\n // viewport on windowed data. For now not going to implement description\n // support in Picker.\n // https://github.com/deephaven/web-client-ui/issues/1958\n showItemDescriptions: false,\n showItemIcons,\n tooltipOptions,\n actions,\n });\n\n // Spectrum doesn't re-render if only the `renderNormalizedItems` function\n // changes, so we create a key from its dependencies that can be used to force\n // re-render.\n const forceRerenderKey = `${showItemIcons}-${tooltipOptions?.placement}`;\n\n const {\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 return (\n <ListViewWrapper\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n UNSAFE_className={cl('dh-list-view-normalized', UNSAFE_className)}\n key={forceRerenderKey}\n items={normalizedItems}\n selectedKeys={selectedStringKeys}\n defaultSelectedKeys={defaultSelectedStringKeys}\n disabledKeys={disabledStringKeys}\n onSelectionChange={onStringSelectionChange}\n >\n {renderNormalizedItem}\n </ListViewWrapper>\n );\n}\n\nexport default ListViewNormalized;\n"],"mappings":";;;;;;;;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,OAAOC,EAAE,MAAM,YAAY;AAAC,SAI1BC,uBAAuB,EACvBC,uBAAuB,EACvBC,4BAA4B;AAAA,SAGrBC,eAAe;AAAA,SAAAC,aAAA,IAAAC,cAAA;AASxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAA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AAEc;EAAwB,IAE1CT,oBACc,CAAC;AAEtB;AAEA,eAAehB,kBAAkB"}
@@ -21,19 +21,28 @@
21
21
  --dh-list-view-item-icon-spacious: 30px;
22
22
  }
23
23
 
24
- .dh-list-view-wrapper-density-compact svg[class*=react-spectrum-ListViewItem-thumbnail] {
24
+ .dh-list-view-wrapper-density-compact svg[class*=spectrum-Icon] {
25
25
  height: var(--dh-list-view-item-icon-compact);
26
26
  width: var(--dh-list-view-item-icon-compact);
27
27
  }
28
+ .dh-list-view-wrapper-density-compact button {
29
+ height: var(--dh-list-view-item-icon-compact);
30
+ }
28
31
 
29
- .dh-list-view-wrapper-density-regular svg[class*=react-spectrum-ListViewItem-thumbnail] {
32
+ .dh-list-view-wrapper-density-regular svg[class*=spectrum-Icon] {
30
33
  height: var(--dh-list-view-item-icon-regular);
31
34
  width: var(--dh-list-view-item-icon-regular);
32
35
  }
36
+ .dh-list-view-wrapper-density-regular button {
37
+ height: var(--dh-list-view-item-icon-regular);
38
+ }
33
39
 
34
- .dh-list-view-wrapper-density-spacious svg[class*=react-spectrum-ListViewItem-thumbnail] {
40
+ .dh-list-view-wrapper-density-spacious svg[class*=spectrum-Icon] {
35
41
  height: var(--dh-list-view-item-icon-spacious);
36
42
  width: var(--dh-list-view-item-icon-spacious);
37
43
  }
44
+ .dh-list-view-wrapper-density-spacious button {
45
+ height: var(--dh-list-view-item-icon-spacious);
46
+ }
38
47
 
39
48
  /*# sourceMappingURL=ListViewWrapper.css.map */
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../../../src/spectrum/listView/ListViewWrapper.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EAGA;EACA;EACA;;AAEA;EAGE;EACA;EACA;;AACA;EAEE;;;AAKN;EACE;EACA;EACA;;;AAIA;EACE;EACA;;;AAKF;EACE;EACA;;;AAKF;EACE;EACA","file":"ListViewWrapper.css","sourcesContent":[".dh-list-view-wrapper {\n --dh-list-view-item-icon-compact: 16px;\n --dh-list-view-item-icon-regular: 18px;\n --dh-list-view-item-icon-spacious: 24px;\n\n // set the wrapper to grow to the size of the parent container\n height: 100%;\n width: 100%;\n position: relative;\n\n > div {\n // absolute position the list view to fill the wrapper\n // so that it will grow and shrink with the wrapper\n position: absolute;\n height: 100%;\n width: 100%;\n > div > div {\n // disable the transition on the list view items\n transition: none !important;\n }\n }\n}\n\n.dh-list-view-wrapper-scale-large {\n --dh-list-view-item-icon-compact: 20px;\n --dh-list-view-item-icon-regular: 24px;\n --dh-list-view-item-icon-spacious: 30px;\n}\n\n.dh-list-view-wrapper-density-compact {\n svg[class*='react-spectrum-ListViewItem-thumbnail'] {\n height: var(--dh-list-view-item-icon-compact);\n width: var(--dh-list-view-item-icon-compact);\n }\n}\n\n.dh-list-view-wrapper-density-regular {\n svg[class*='react-spectrum-ListViewItem-thumbnail'] {\n height: var(--dh-list-view-item-icon-regular);\n width: var(--dh-list-view-item-icon-regular);\n }\n}\n\n.dh-list-view-wrapper-density-spacious {\n svg[class*='react-spectrum-ListViewItem-thumbnail'] {\n height: var(--dh-list-view-item-icon-spacious);\n width: var(--dh-list-view-item-icon-spacious);\n }\n}\n"]}
1
+ {"version":3,"sourceRoot":"","sources":["../../../src/spectrum/listView/ListViewWrapper.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EAGA;EACA;EACA;;AAEA;EAGE;EACA;EACA;;AACA;EAEE;;;AAKN;EACE;EACA;EACA;;;AAKA;EACE;EACA;;AAGF;EACE;;;AAMF;EACE;EACA;;AAGF;EACE;;;AAMF;EACE;EACA;;AAGF;EACE","file":"ListViewWrapper.css","sourcesContent":[".dh-list-view-wrapper {\n --dh-list-view-item-icon-compact: 16px;\n --dh-list-view-item-icon-regular: 18px;\n --dh-list-view-item-icon-spacious: 24px;\n\n // set the wrapper to grow to the size of the parent container\n height: 100%;\n width: 100%;\n position: relative;\n\n > div {\n // absolute position the list view to fill the wrapper\n // so that it will grow and shrink with the wrapper\n position: absolute;\n height: 100%;\n width: 100%;\n > div > div {\n // disable the transition on the list view items\n transition: none !important;\n }\n }\n}\n\n.dh-list-view-wrapper-scale-large {\n --dh-list-view-item-icon-compact: 20px;\n --dh-list-view-item-icon-regular: 24px;\n --dh-list-view-item-icon-spacious: 30px;\n}\n\n.dh-list-view-wrapper-density-compact {\n // Ensure icons don't change the item height\n svg[class*='spectrum-Icon'] {\n height: var(--dh-list-view-item-icon-compact);\n width: var(--dh-list-view-item-icon-compact);\n }\n // Ensure action buttons don't change the item height\n button {\n height: var(--dh-list-view-item-icon-compact);\n }\n}\n\n.dh-list-view-wrapper-density-regular {\n // Ensure icons don't change the item height\n svg[class*='spectrum-Icon'] {\n height: var(--dh-list-view-item-icon-regular);\n width: var(--dh-list-view-item-icon-regular);\n }\n // Ensure action buttons don't change the item height\n button {\n height: var(--dh-list-view-item-icon-regular);\n }\n}\n\n.dh-list-view-wrapper-density-spacious {\n // Ensure icons don't change the item height\n svg[class*='spectrum-Icon'] {\n height: var(--dh-list-view-item-icon-spacious);\n width: var(--dh-list-view-item-icon-spacious);\n }\n // Ensure action buttons don't change the item height\n button {\n height: var(--dh-list-view-item-icon-spacious);\n }\n}\n"]}
@@ -3,11 +3,13 @@ import type { ItemElement, ItemRenderer, SectionProps as SpectrumSectionProps }
3
3
  export { Item } from '@adobe/react-spectrum';
4
4
  export type { ItemProps } from '@react-types/shared';
5
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>;
6
8
  /**
7
9
  * Spectrum SectionProps augmented with support for primitive item children.
8
10
  */
9
11
  export type SectionProps<T> = Omit<SpectrumSectionProps<T>, 'children'> & {
10
- children: ItemElementOrPrimitive<T> | ItemElementOrPrimitive<T>[] | ItemRenderer<T>;
12
+ children: ItemsOrPrimitiveChildren<T>;
11
13
  };
12
14
  /**
13
15
  * Re-export Spectrum Section component with augmented props type.
@@ -1 +1 @@
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;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACxE,QAAQ,EACJ,sBAAsB,CAAC,CAAC,CAAC,GACzB,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAC3B,YAAY,CAAC,CAAC,CAAC,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,iCAEf,WAAW,CAAC"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","names":["Section","SpectrumSection","Item"],"sources":["../../src/spectrum/shared.ts"],"sourcesContent":["/**\n * Wrapping Spectrum `Item` and `Section` components will break functionality\n * due to the way they are consumed by collection components. They are only used\n * to pass data and don't render anything on their own, so they don't need to be\n * wrapped. If we do ever need to wrap them for whatever reason, the static\n * `getCollectionNode` method will need to be implemented.\n * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Item.ts#L17\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Section.ts#L18\n */\nimport { Section as SpectrumSection } from '@adobe/react-spectrum';\nimport type {\n ItemElement,\n ItemRenderer,\n SectionProps as SpectrumSectionProps,\n} from '@react-types/shared';\n\nexport { Item } from '@adobe/react-spectrum';\nexport type { 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\n/**\n * Spectrum SectionProps augmented with support for primitive item children.\n */\nexport type SectionProps<T> = Omit<SpectrumSectionProps<T>, 'children'> & {\n children:\n | ItemElementOrPrimitive<T>\n | ItemElementOrPrimitive<T>[]\n | ItemRenderer<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;;AAOA;AACA;AACA;;AAQA;AACA;AACA;AACA,OAAO,IAAMF,OAAO,GAAGC,eAEP"}
1
+ {"version":3,"file":"shared.js","names":["Section","SpectrumSection","Item"],"sources":["../../src/spectrum/shared.ts"],"sourcesContent":["/**\n * Wrapping Spectrum `Item` and `Section` components will break functionality\n * due to the way they are consumed by collection components. They are only used\n * to pass data and don't render anything on their own, so they don't need to be\n * wrapped. If we do ever need to wrap them for whatever reason, the static\n * `getCollectionNode` method will need to be implemented.\n * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Item.ts#L17\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/collections/src/Section.ts#L18\n */\nimport { Section as SpectrumSection } from '@adobe/react-spectrum';\nimport type {\n ItemElement,\n ItemRenderer,\n SectionProps as SpectrumSectionProps,\n} from '@react-types/shared';\n\nexport { Item } from '@adobe/react-spectrum';\nexport type { 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"}
@@ -34,6 +34,23 @@ export type ItemSelection = SelectionT<ItemKey>;
34
34
  * reflect it.
35
35
  */
36
36
  export type ItemSelectionChangeHandler = (key: ItemKey) => void;
37
+ export interface MultipleItemSelectionProps {
38
+ selectedKeys?: 'all' | Iterable<ItemKey>;
39
+ defaultSelectedKeys?: 'all' | Iterable<ItemKey>;
40
+ disabledKeys?: Iterable<ItemKey>;
41
+ /**
42
+ * Handler that is called when the selection change.
43
+ * Note that under the hood, this is just an alias for Spectrum's
44
+ * `onSelectionChange`. We are renaming for better consistency with other
45
+ * components.
46
+ */
47
+ onChange?: (keys: ItemSelection) => void;
48
+ /**
49
+ * Handler that is called when the selection changes.
50
+ * @deprecated Use `onChange` instead
51
+ */
52
+ onSelectionChange?: (keys: ItemSelection) => void;
53
+ }
37
54
  export interface NormalizedItemData {
38
55
  key?: ItemKey;
39
56
  content: ReactNode;
@@ -54,8 +71,8 @@ export interface NormalizedSectionData {
54
71
  * `KeyedItem` interface to be compatible with Windowed data utils
55
72
  * (e.g. `useViewportData`).
56
73
  */
57
- export type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey | undefined>;
58
- export type NormalizedSection = KeyedItem<NormalizedSectionData, Key | undefined>;
74
+ export type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey>;
75
+ export type NormalizedSection = KeyedItem<NormalizedSectionData, Key>;
59
76
  export type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> = TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;
60
77
  export type NormalizedSpectrumPickerProps = SpectrumPickerProps<NormalizedItem>;
61
78
  export type TooltipOptions = {
@@ -70,7 +87,7 @@ export type TooltipOptions = {
70
87
  * @param item The normalized item or section
71
88
  * @returns The `key` of the item or section
72
89
  */
73
- export declare function getItemKey<TItem extends NormalizedItem | NormalizedSection, TKey extends TItem extends NormalizedItem ? ItemKey | undefined : TItem extends NormalizedSection ? Key | undefined : undefined>(item: TItem | null | undefined): TKey;
90
+ export declare function getItemKey<TItem extends NormalizedItem | NormalizedSection, TKey extends TItem extends NormalizedItem ? ItemKey : TItem extends NormalizedSection ? Key : undefined>(item: TItem | null | undefined): TKey;
74
91
  /**
75
92
  * Get the position of the item with the given selected key in a list of items.
76
93
  * @param items The items to search
@@ -1 +1 @@
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,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,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,YAAY,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,YAAY,C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AAG,IAAI,CAUvB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,SAAS,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,EACnD,OAAO,SAAS,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 +1 @@
1
- {"version":3,"file":"itemUtils.js","names":["isElementOfType","ensureArray","Item","Section","Text","ItemContent","ITEM_EMPTY_STRING_TEXT_VALUE","getItemKey","item","_item$item$key","_item$item","key","getPositionOfSelectedItemElement","_x","_getPositionOfSelectedItemElement","apply","arguments","_asyncToGenerator","_ref","items","itemHeight","selectedKey","topOffset","position","i","length","isSectionElement","node","isItemElement","isItemElementWithDescription","children","props","childrenArray","result","some","child","_child$props","slot","isNormalizedItemsWithKeysList","Array","isArray","isItemOrSection","isNormalizedSection","maybeNormalizedSection","normalizeTooltipOptions","options","placement","undefined","itemSelectionToStringSet","itemKeys","Set","map","String"],"sources":["../../../src/spectrum/utils/itemUtils.ts"],"sourcesContent":["import { Key, ReactElement, ReactNode } from 'react';\nimport { SpectrumPickerProps } from '@adobe/react-spectrum';\nimport type { ItemRenderer } from '@react-types/shared';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, KeyedItem, SelectionT } from '@deephaven/utils';\nimport {\n Item,\n ItemElementOrPrimitive,\n ItemProps,\n Section,\n SectionProps,\n} from '../shared';\nimport { PopperOptions } from '../../popper';\nimport { Text } from '../Text';\nimport ItemContent from '../ItemContent';\n\n/**\n * `Item.textValue` prop needs to be a non-empty string for accessibility\n * purposes. This is not displayed in the UI.\n */\nexport const ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';\n\n/**\n * React Spectrum <Section> supports an `ItemRenderer` function as a child. The\n * DH picker makes use of this internally, but we don't want to support it as\n * an incoming prop.\n */\ntype SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {\n children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;\n};\n\nexport type ItemElement<T = unknown> = ReactElement<ItemProps<T>>;\nexport type SectionElement<T = unknown> = ReactElement<\n SectionPropsNoItemRenderer<T>\n>;\n\nexport type ItemOrSection<T = unknown> =\n | ItemElementOrPrimitive<T>\n | SectionElement<T>;\n\n// Picker uses `icon` slot. ListView can use `image` or `illustration` slots.\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/picker/src/Picker.tsx#L194\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L266-L267\nexport type ItemIconSlot = 'icon' | 'image' | 'illustration';\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * Spectrum collection components already supports this, but the built in types\n * don't reflect it.\n */\nexport type ItemKey = Key | boolean;\n\nexport type ItemSelection = SelectionT<ItemKey>;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * Spectrum components already supports this, but the built in types don't\n * reflect it.\n */\nexport type ItemSelectionChangeHandler = (key: ItemKey) => void;\n\nexport interface NormalizedItemData {\n key?: ItemKey;\n content: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n textValue: string | undefined;\n}\n\nexport interface NormalizedSectionData {\n key?: Key;\n title?: ReactNode;\n items: NormalizedItem[];\n}\n\n/**\n * Spectrum collection components support a variety of item types, including\n * strings, numbers, booleans, and more complex React elements. This type\n * represents a normalized form to make rendering items simpler and keep the\n * logic of transformation in separate util methods. It also adheres to the\n * `KeyedItem` interface to be compatible with Windowed data utils\n * (e.g. `useViewportData`).\n */\nexport type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey | undefined>;\n\nexport type NormalizedSection = KeyedItem<\n NormalizedSectionData,\n Key | undefined\n>;\n\nexport type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> =\n TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;\n\nexport type NormalizedSpectrumPickerProps = SpectrumPickerProps<NormalizedItem>;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * DH wrappers of Spectrum collection components use a normalized item that\n * includes a `key` prop and an optional `item` prop. This is mostly to support\n * Windowed data where items are created before their data has been loaded (data\n * gets set in the `item` prop). If data has loaded, return its `key`. If not,\n * return the top-level `key` on the normalized item.\n * @param item The normalized item or section\n * @returns The `key` of the item or section\n */\nexport function getItemKey<\n TItem extends NormalizedItem | NormalizedSection,\n TKey extends TItem extends NormalizedItem\n ? ItemKey | undefined\n : TItem extends NormalizedSection\n ? Key | undefined\n : undefined,\n>(item: TItem | null | undefined): TKey {\n return (item?.item?.key ?? item?.key) as TKey;\n}\n\n/**\n * Get the position of the item with the given selected key in a list of items.\n * @param items The items to search\n * @param itemHeight The height of each item\n * @param selectedKey The key of the selected item\n * @param topOffset The top offset of the list\n * @returns The position of the selected item or the top offset if not found\n */\nexport async function getPositionOfSelectedItemElement<\n TKey extends string | number | boolean | undefined,\n>({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n}: {\n items: ItemElement[];\n selectedKey: TKey | null | undefined;\n itemHeight: number;\n topOffset: number;\n}): Promise<number> {\n let position = topOffset;\n\n if (selectedKey == null) {\n return position;\n }\n\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (item.key === selectedKey) {\n return position;\n }\n\n position += itemHeight;\n }\n\n return topOffset;\n}\n\n/**\n * Determine if a node is a Section element.\n * @param node The node to check\n * @returns True if the node is a Section element\n */\nexport function isSectionElement<T>(\n node: ReactNode\n): node is SectionElement<T> {\n return isElementOfType(node, Section);\n}\n\n/**\n * Determine if a node is an Item element.\n * @param node The node to check\n * @returns True if the node is an Item element\n */\nexport function isItemElement<T>(node: ReactNode): node is ItemElement<T> {\n return isElementOfType(node, Item);\n}\n\n/**\n * Determine if a node is an Item element containing a child `Text` element with\n * a `slot` prop set to `description`.\n * @param node The node to check\n * @returns True if the node is an Item element with a description\n */\nexport function isItemElementWithDescription<T>(\n node: ReactNode\n): node is ReactElement<ItemProps<T>> {\n if (!isItemElement(node)) {\n return false;\n }\n\n // If children are wrapped in `ItemContent`, go down 1 level\n const children = isElementOfType(node.props.children, ItemContent)\n ? node.props.children.props.children\n : node.props.children;\n\n const childrenArray = ensureArray(children);\n\n const result = childrenArray.some(\n child => isElementOfType(child, Text) && child.props?.slot === 'description'\n );\n\n return result;\n}\n\n/**\n * Determine if a node is an array containing normalized items or sections with\n * keys. Note that this only checks the first node in the array.\n * @param node The node to check\n * @returns True if the node is a normalized item or section with keys array\n */\nexport function isNormalizedItemsWithKeysList<\n TItemOrSection extends ItemOrSection,\n>(\n node:\n | TItemOrSection\n | TItemOrSection[]\n | NormalizedItemOrSection<TItemOrSection>[]\n): node is NormalizedItemOrSection<TItemOrSection>[] {\n if (!Array.isArray(node)) {\n return false;\n }\n\n if (node.length === 0) {\n return true;\n }\n\n return !isItemOrSection(node[0]) && 'key' in node[0];\n}\n\n/**\n * Determine if an object is a normalized section.\n * @param maybeNormalizedSection The object to check\n * @returns True if the object is a normalized section\n */\nexport function isNormalizedSection(\n maybeNormalizedSection: NormalizedItem | NormalizedSection\n): maybeNormalizedSection is NormalizedSection {\n return (\n maybeNormalizedSection.item != null &&\n 'items' in maybeNormalizedSection.item\n );\n}\n\n/**\n * Determine if a node is an item or section. Valid types include strings,\n * numbers, booleans, Item elements, and Section elements.\n * @param node The node to check\n * @returns True if the node is an item or section\n */\nexport function isItemOrSection(node: ReactNode): node is ItemOrSection {\n return (\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean' ||\n isItemElement(node) ||\n isSectionElement(node)\n );\n}\n\n/**\n * Returns a TooltipOptions object or null if options is false or null.\n * @param options Tooltip options\n * @param placement Default placement for the tooltip if `options` is set\n * explicitly to `true`\n * @returns TooltipOptions or null\n */\nexport function normalizeTooltipOptions(\n options?: boolean | TooltipOptions | null,\n placement: TooltipOptions['placement'] = 'right'\n): TooltipOptions | null {\n if (options == null || options === false) {\n return null;\n }\n\n if (options === true) {\n return { placement };\n }\n\n return options;\n}\n\n/**\n * Convert a selection of `ItemKey`s to a selection of strings.\n * @param itemKeys The selection of `ItemKey`s\n * @returns The selection of strings\n */\nexport function itemSelectionToStringSet<\n TKeys extends 'all' | Iterable<ItemKey> | undefined,\n TResult extends TKeys extends 'all'\n ? 'all'\n : TKeys extends Iterable<ItemKey>\n ? Set<string>\n : undefined,\n>(itemKeys: TKeys): TResult {\n if (itemKeys == null || itemKeys === 'all') {\n return itemKeys as undefined | 'all' as TResult;\n }\n\n return new Set([...itemKeys].map(String)) as TResult;\n}\n"],"mappings":";;AAGA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,QAA+B,kBAAkB;AAAC,SAEpEC,IAAI,EAGJC,OAAO;AAAA,SAIAC,IAAI;AAAA,OACNC,WAAW;AAElB;AACA;AACA;AACA;AACA,OAAO,IAAMC,4BAA4B,GAAG,OAAO;;AAEnD;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAOxBC,IAA8B,EAAQ;EAAA,IAAAC,cAAA,EAAAC,UAAA;EACtC,QAAAD,cAAA,GAAQD,IAAI,aAAJA,IAAI,wBAAAE,UAAA,GAAJF,IAAI,CAAEA,IAAI,cAAAE,UAAA,uBAAVA,UAAA,CAAYC,GAAG,cAAAF,cAAA,cAAAA,cAAA,GAAID,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,GAAG;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAsBC,gCAAgCA,CAAAC,EAAA;EAAA,OAAAC,iCAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;;AA+BtD;AACA;AACA;AACA;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GAAA/B,SAAA,MAAG,OAAO;EAEhD,IAAI6B,OAAO,IAAI,IAAI,IAAIA,OAAO,KAAK,KAAK,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,IAAIA,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO;MAAEC;IAAU,CAAC;EACtB;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,wBAAwBA,CAOtCC,QAAe,EAAW;EAC1B,IAAIA,QAAQ,IAAI,IAAI,IAAIA,QAAQ,KAAK,KAAK,EAAE;IAC1C,OAAOA,QAAQ;EACjB;EAEA,OAAO,IAAIC,GAAG,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAACE,GAAG,CAACC,MAAM,CAAC,CAAC;AAC3C"}
1
+ {"version":3,"file":"itemUtils.js","names":["isElementOfType","ensureArray","Item","Section","Text","ItemContent","ITEM_EMPTY_STRING_TEXT_VALUE","getItemKey","item","_item$item$key","_item$item","key","getPositionOfSelectedItemElement","_x","_getPositionOfSelectedItemElement","apply","arguments","_asyncToGenerator","_ref","items","itemHeight","selectedKey","topOffset","position","i","length","isSectionElement","node","isItemElement","isItemElementWithDescription","children","props","childrenArray","result","some","child","_child$props","slot","isNormalizedItemsWithKeysList","Array","isArray","isItemOrSection","isNormalizedSection","maybeNormalizedSection","normalizeTooltipOptions","options","placement","undefined","itemSelectionToStringSet","itemKeys","Set","map","String"],"sources":["../../../src/spectrum/utils/itemUtils.ts"],"sourcesContent":["import { Key, ReactElement, ReactNode } from 'react';\nimport { SpectrumPickerProps } from '@adobe/react-spectrum';\nimport type { ItemRenderer } from '@react-types/shared';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, KeyedItem, SelectionT } from '@deephaven/utils';\nimport {\n Item,\n ItemElementOrPrimitive,\n ItemProps,\n Section,\n SectionProps,\n} from '../shared';\nimport { PopperOptions } from '../../popper';\nimport { Text } from '../Text';\nimport ItemContent from '../ItemContent';\n\n/**\n * `Item.textValue` prop needs to be a non-empty string for accessibility\n * purposes. This is not displayed in the UI.\n */\nexport const ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';\n\n/**\n * React Spectrum <Section> supports an `ItemRenderer` function as a child. The\n * DH picker makes use of this internally, but we don't want to support it as\n * an incoming prop.\n */\ntype SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {\n children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;\n};\n\nexport type ItemElement<T = unknown> = ReactElement<ItemProps<T>>;\nexport type SectionElement<T = unknown> = ReactElement<\n SectionPropsNoItemRenderer<T>\n>;\n\nexport type ItemOrSection<T = unknown> =\n | ItemElementOrPrimitive<T>\n | SectionElement<T>;\n\n// Picker uses `icon` slot. ListView can use `image` or `illustration` slots.\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/picker/src/Picker.tsx#L194\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L266-L267\nexport type ItemIconSlot = 'icon' | 'image' | 'illustration';\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * Spectrum collection components already supports this, but the built in types\n * don't reflect it.\n */\nexport type ItemKey = Key | boolean;\n\nexport type ItemSelection = SelectionT<ItemKey>;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * Spectrum components already supports this, but the built in types don't\n * reflect it.\n */\nexport type ItemSelectionChangeHandler = (key: ItemKey) => void;\n\nexport interface MultipleItemSelectionProps {\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (keys: ItemSelection) => void;\n}\n\nexport interface NormalizedItemData {\n key?: ItemKey;\n content: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n textValue: string | undefined;\n}\n\nexport interface NormalizedSectionData {\n key?: Key;\n title?: ReactNode;\n items: NormalizedItem[];\n}\n\n/**\n * Spectrum collection components support a variety of item types, including\n * strings, numbers, booleans, and more complex React elements. This type\n * represents a normalized form to make rendering items simpler and keep the\n * logic of transformation in separate util methods. It also adheres to the\n * `KeyedItem` interface to be compatible with Windowed data utils\n * (e.g. `useViewportData`).\n */\nexport type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey>;\n\nexport type NormalizedSection = KeyedItem<NormalizedSectionData, Key>;\n\nexport type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> =\n TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;\n\nexport type NormalizedSpectrumPickerProps = SpectrumPickerProps<NormalizedItem>;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * DH wrappers of Spectrum collection components use a normalized item that\n * includes a `key` prop and an optional `item` prop. This is mostly to support\n * Windowed data where items are created before their data has been loaded (data\n * gets set in the `item` prop). If data has loaded, return its `key`. If not,\n * return the top-level `key` on the normalized item.\n * @param item The normalized item or section\n * @returns The `key` of the item or section\n */\nexport function getItemKey<\n TItem extends NormalizedItem | NormalizedSection,\n TKey extends TItem extends NormalizedItem\n ? ItemKey\n : TItem extends NormalizedSection\n ? Key\n : undefined,\n>(item: TItem | null | undefined): TKey {\n return (item?.item?.key ?? item?.key) as TKey;\n}\n\n/**\n * Get the position of the item with the given selected key in a list of items.\n * @param items The items to search\n * @param itemHeight The height of each item\n * @param selectedKey The key of the selected item\n * @param topOffset The top offset of the list\n * @returns The position of the selected item or the top offset if not found\n */\nexport async function getPositionOfSelectedItemElement<\n TKey extends string | number | boolean | undefined,\n>({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n}: {\n items: ItemElement[];\n selectedKey: TKey | null | undefined;\n itemHeight: number;\n topOffset: number;\n}): Promise<number> {\n let position = topOffset;\n\n if (selectedKey == null) {\n return position;\n }\n\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (item.key === selectedKey) {\n return position;\n }\n\n position += itemHeight;\n }\n\n return topOffset;\n}\n\n/**\n * Determine if a node is a Section element.\n * @param node The node to check\n * @returns True if the node is a Section element\n */\nexport function isSectionElement<T>(\n node: ReactNode\n): node is SectionElement<T> {\n return isElementOfType(node, Section);\n}\n\n/**\n * Determine if a node is an Item element.\n * @param node The node to check\n * @returns True if the node is an Item element\n */\nexport function isItemElement<T>(node: ReactNode): node is ItemElement<T> {\n return isElementOfType(node, Item);\n}\n\n/**\n * Determine if a node is an Item element containing a child `Text` element with\n * a `slot` prop set to `description`.\n * @param node The node to check\n * @returns True if the node is an Item element with a description\n */\nexport function isItemElementWithDescription<T>(\n node: ReactNode\n): node is ReactElement<ItemProps<T>> {\n if (!isItemElement(node)) {\n return false;\n }\n\n // If children are wrapped in `ItemContent`, go down 1 level\n const children = isElementOfType(node.props.children, ItemContent)\n ? node.props.children.props.children\n : node.props.children;\n\n const childrenArray = ensureArray(children);\n\n const result = childrenArray.some(\n child => isElementOfType(child, Text) && child.props?.slot === 'description'\n );\n\n return result;\n}\n\n/**\n * Determine if a node is an array containing normalized items or sections with\n * keys. Note that this only checks the first node in the array.\n * @param node The node to check\n * @returns True if the node is a normalized item or section with keys array\n */\nexport function isNormalizedItemsWithKeysList<\n TItemOrSection extends ItemOrSection,\n>(\n node:\n | TItemOrSection\n | TItemOrSection[]\n | NormalizedItemOrSection<TItemOrSection>[]\n): node is NormalizedItemOrSection<TItemOrSection>[] {\n if (!Array.isArray(node)) {\n return false;\n }\n\n if (node.length === 0) {\n return true;\n }\n\n return !isItemOrSection(node[0]) && 'key' in node[0];\n}\n\n/**\n * Determine if an object is a normalized section.\n * @param maybeNormalizedSection The object to check\n * @returns True if the object is a normalized section\n */\nexport function isNormalizedSection(\n maybeNormalizedSection: NormalizedItem | NormalizedSection\n): maybeNormalizedSection is NormalizedSection {\n return (\n maybeNormalizedSection.item != null &&\n 'items' in maybeNormalizedSection.item\n );\n}\n\n/**\n * Determine if a node is an item or section. Valid types include strings,\n * numbers, booleans, Item elements, and Section elements.\n * @param node The node to check\n * @returns True if the node is an item or section\n */\nexport function isItemOrSection(node: ReactNode): node is ItemOrSection {\n return (\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean' ||\n isItemElement(node) ||\n isSectionElement(node)\n );\n}\n\n/**\n * Returns a TooltipOptions object or null if options is false or null.\n * @param options Tooltip options\n * @param placement Default placement for the tooltip if `options` is set\n * explicitly to `true`\n * @returns TooltipOptions or null\n */\nexport function normalizeTooltipOptions(\n options?: boolean | TooltipOptions | null,\n placement: TooltipOptions['placement'] = 'right'\n): TooltipOptions | null {\n if (options == null || options === false) {\n return null;\n }\n\n if (options === true) {\n return { placement };\n }\n\n return options;\n}\n\n/**\n * Convert a selection of `ItemKey`s to a selection of strings.\n * @param itemKeys The selection of `ItemKey`s\n * @returns The selection of strings\n */\nexport function itemSelectionToStringSet<\n TKeys extends 'all' | Iterable<ItemKey> | undefined,\n TResult extends TKeys extends 'all'\n ? 'all'\n : TKeys extends Iterable<ItemKey>\n ? Set<string>\n : undefined,\n>(itemKeys: TKeys): TResult {\n if (itemKeys == null || itemKeys === 'all') {\n return itemKeys as undefined | 'all' as TResult;\n }\n\n return new Set([...itemKeys].map(String)) as TResult;\n}\n"],"mappings":";;AAGA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,QAA+B,kBAAkB;AAAC,SAEpEC,IAAI,EAGJC,OAAO;AAAA,SAIAC,IAAI;AAAA,OACNC,WAAW;AAElB;AACA;AACA;AACA;AACA,OAAO,IAAMC,4BAA4B,GAAG,OAAO;;AAEnD;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AAC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IAAI,IAAI,IACnC,OAAO,IAAImC,sBAAsB,CAACnC,IAAI;AAE1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASiC,eAAeA,CAACd,IAAe,EAAyB;EACtE,OACE,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,SAAS,IACzBC,aAAa,CAACD,IAAI,CAAC,IACnBD,gBAAgB,CAACC,IAAI,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASiB,uBAAuBA,CACrCC,OAAyC,EAElB;EAAA,IADvBC,SAAsC,GAAA9B,SAAA,CAAAS,MAAA,QAAAT,SAAA,QAAA+B,SAAA,GAAA/B,SAAA,MAAG,OAAO;EAEhD,IAAI6B,OAAO,IAAI,IAAI,IAAIA,OAAO,KAAK,KAAK,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,IAAIA,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO;MAAEC;IAAU,CAAC;EACtB;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,wBAAwBA,CAOtCC,QAAe,EAAW;EAC1B,IAAIA,QAAQ,IAAI,IAAI,IAAIA,QAAQ,KAAK,KAAK,EAAE;IAC1C,OAAOA,QAAQ;EACjB;EAEA,OAAO,IAAIC,GAAG,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAACE,GAAG,CAACC,MAAM,CAAC,CAAC;AAC3C"}
@@ -17,7 +17,7 @@ export declare function wrapIcon(maybeIconKey: ReactNode, slot: ItemIconSlot): R
17
17
  * @param tooltipOptions The tooltip options to use when wrapping items
18
18
  * @returns The wrapped items or sections
19
19
  */
20
- export declare function wrapItemChildren(itemsOrSections: ItemOrSection | ItemOrSection[], tooltipOptions: TooltipOptions | null): ItemElement | SectionElement | (ItemElement | SectionElement)[];
20
+ export declare function wrapItemChildren<T>(itemsOrSections: ItemOrSection<T> | ItemOrSection<T>[], tooltipOptions: TooltipOptions | null): ItemElement<T> | SectionElement<T> | (ItemElement<T> | SectionElement<T>)[];
21
21
  /**
22
22
  * If the given content is a primitive type, wrap it in a Text component.
23
23
  * @param content The content to wrap
@@ -1 +1 @@
1
- {"version":3,"file":"itemWrapperUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,SAAS,EAAE,MAAM,OAAO,CAAC;AAM9D,OAAO,EAGL,WAAW,EACX,YAAY,EACZ,aAAa,EAEb,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAMrB;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,YAAY,EAAE,SAAS,EACvB,IAAI,EAAE,YAAY,GACjB,SAAS,CAaX;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,eAAe,EAAE,aAAa,GAAG,aAAa,EAAE,EAChD,cAAc,EAAE,cAAc,GAAG,IAAI,GACpC,WAAW,GAAG,cAAc,GAAG,CAAC,WAAW,GAAG,cAAc,CAAC,EAAE,CAuDjE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,SAAS,EACnB,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,CAeX"}
1
+ {"version":3,"file":"itemWrapperUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAMhD,OAAO,EAGL,WAAW,EACX,YAAY,EACZ,aAAa,EAEb,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAKrB;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,YAAY,EAAE,SAAS,EACvB,IAAI,EAAE,YAAY,GACjB,SAAS,CAaX;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,eAAe,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,EACtD,cAAc,EAAE,cAAc,GAAG,IAAI,GACpC,WAAW,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAoD7E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,SAAS,EACnB,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,CAeX"}
@@ -1 +1 @@
1
- {"version":3,"file":"itemWrapperUtils.js","names":["cloneElement","Item","FontAwesomeIcon","dh","dhIcons","isElementOfType","ensureArray","NON_BREAKING_SPACE","isItemElement","isSectionElement","ITEM_EMPTY_STRING_TEXT_VALUE","ItemContent","Icon","Text","jsx","_jsx","wrapIcon","maybeIconKey","slot","_maybeIconKey","_dhIcons$maybeIconKey","children","icon","vsBlank","wrapItemChildren","itemsOrSections","tooltipOptions","itemsOrSectionsArray","result","map","item","_item$key","props","key","textValue","_objectSpread","_item$key2","title","undefined","text","String","Array","isArray","wrapPrimitiveWithText","content","_content","includes"],"sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"sourcesContent":["import { cloneElement, ReactElement, ReactNode } from 'react';\nimport { Item } from '@adobe/react-spectrum';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { dh as dhIcons } from '@deephaven/icons';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, NON_BREAKING_SPACE } from '@deephaven/utils';\nimport {\n isItemElement,\n isSectionElement,\n ItemElement,\n ItemIconSlot,\n ItemOrSection,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n SectionElement,\n TooltipOptions,\n} from './itemUtils';\nimport { ItemProps } from '../shared';\nimport { ItemContent } from '../ItemContent';\nimport { Icon } from '../icons';\nimport { Text } from '../Text';\n\n/**\n * If the given content is a string, wrap it in an Icon component. Otherwise,\n * return the original content. If the key is not found in the dhIcons object,\n * the vsBlank icon will be used.\n * @param maybeIconKey The content to wrap\n * @param slot The slot to use for the Icon component\n * @returns The wrapped content or original content if not a string\n */\nexport function wrapIcon(\n maybeIconKey: ReactNode,\n slot: ItemIconSlot\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n maybeIconKey = maybeIconKey ?? '';\n\n if (typeof maybeIconKey !== 'string') {\n return maybeIconKey;\n }\n\n return (\n <Icon slot={slot}>\n <FontAwesomeIcon icon={dhIcons[maybeIconKey] ?? dhIcons.vsBlank} />\n </Icon>\n );\n}\n\n/**\n * Ensure all primitive children are wrapped in `Item` elements and that all\n * `Item` element content is wrapped in `ItemContent` elements to handle text\n * overflow consistently and to support tooltips.\n * @param itemsOrSections The items or sections to wrap\n * @param tooltipOptions The tooltip options to use when wrapping items\n * @returns The wrapped items or sections\n */\nexport function wrapItemChildren(\n itemsOrSections: ItemOrSection | ItemOrSection[],\n tooltipOptions: TooltipOptions | null\n): ItemElement | SectionElement | (ItemElement | SectionElement)[] {\n const itemsOrSectionsArray = ensureArray(itemsOrSections);\n\n const result = itemsOrSectionsArray.map(item => {\n if (isItemElement(item)) {\n // Item content is already wrapped\n if (isElementOfType(item.props.children, ItemContent)) {\n return item;\n }\n\n const key = item.key ?? item.props.textValue;\n const textValue =\n item.props.textValue === ''\n ? ITEM_EMPTY_STRING_TEXT_VALUE\n : item.props.textValue;\n\n // Wrap in `ItemContent` so we can support tooltips and handle text\n // overflow\n return cloneElement(item, {\n ...item.props,\n key,\n textValue,\n children: (\n <ItemContent tooltipOptions={tooltipOptions}>\n {item.props.children}\n </ItemContent>\n ),\n });\n }\n\n if (isSectionElement(item)) {\n return cloneElement(item, {\n ...item.props,\n key:\n item.key ??\n (typeof item.props.title === 'string' ? item.props.title : undefined),\n children: wrapItemChildren(\n item.props.children,\n tooltipOptions\n ) as ReactElement<ItemProps<unknown>>[],\n });\n }\n\n const text = String(item);\n const textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;\n\n return (\n <Item key={text} textValue={textValue}>\n <ItemContent tooltipOptions={tooltipOptions}>{text}</ItemContent>\n </Item>\n );\n });\n\n // Keep consistent with original data structure as array or single node\n return Array.isArray(itemsOrSections) ? result : result[0];\n}\n\n/**\n * If the given content is a primitive type, wrap it in a Text component.\n * @param content The content to wrap\n * @param slot The slot to use for the Text component\n * @returns The wrapped content or original content if not a primitive type\n */\nexport function wrapPrimitiveWithText(\n content?: ReactNode,\n slot?: string\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n content = content ?? '';\n\n if (['string', 'boolean', 'number'].includes(typeof content)) {\n return (\n <Text slot={slot}>\n {/* Non-breaking space is needed to avoid the Text element's height \n collapsing when content is empty */}\n {content === '' ? NON_BREAKING_SPACE : String(content)}\n </Text>\n );\n }\n\n return content;\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,QAAiC,OAAO;AAC7D,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,EAAE,IAAIC,OAAO,QAAQ,kBAAkB;AAChD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,kBAAkB;AAAC,SAEjEC,aAAa,EACbC,gBAAgB,EAIhBC,4BAA4B;AAAA,SAKrBC,WAAW;AAAA,SACXC,IAAI;AAAA,SACJC,IAAI;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,OAAO,SAASC,QAAQA,CACtBC,YAAuB,EACvBC,IAAkB,EACP;EAAA,IAAAC,aAAA,EAAAC,qBAAA;EACX;EACAH,YAAY,IAAAE,aAAA,GAAGF,YAAY,cAAAE,aAAA,cAAAA,aAAA,GAAI,EAAE;EAEjC,IAAI,OAAOF,YAAY,KAAK,QAAQ,EAAE;IACpC,OAAOA,YAAY;EACrB;EAEA,oBACEF,IAAA,C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OAAO;IAAC,CAClD,CAAC;EAEX;EAEA,OAAOA,OAAO;AAChB"}
1
+ {"version":3,"file":"itemWrapperUtils.js","names":["cloneElement","Item","FontAwesomeIcon","dh","dhIcons","isElementOfType","ensureArray","NON_BREAKING_SPACE","isItemElement","isSectionElement","ITEM_EMPTY_STRING_TEXT_VALUE","ItemContent","Icon","Text","jsx","_jsx","wrapIcon","maybeIconKey","slot","_maybeIconKey","_dhIcons$maybeIconKey","children","icon","vsBlank","wrapItemChildren","itemsOrSections","tooltipOptions","itemsOrSectionsArray","result","map","item","_item$key","props","key","textValue","_objectSpread","_item$key2","title","undefined","text","String","Array","isArray","wrapPrimitiveWithText","content","_content","includes"],"sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"sourcesContent":["import { cloneElement, ReactNode } from 'react';\nimport { Item } from '@adobe/react-spectrum';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { dh as dhIcons } from '@deephaven/icons';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, NON_BREAKING_SPACE } from '@deephaven/utils';\nimport {\n isItemElement,\n isSectionElement,\n ItemElement,\n ItemIconSlot,\n ItemOrSection,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n SectionElement,\n TooltipOptions,\n} from './itemUtils';\nimport { ItemContent } from '../ItemContent';\nimport { Icon } from '../icons';\nimport { Text } from '../Text';\n\n/**\n * If the given content is a string, wrap it in an Icon component. Otherwise,\n * return the original content. If the key is not found in the dhIcons object,\n * the vsBlank icon will be used.\n * @param maybeIconKey The content to wrap\n * @param slot The slot to use for the Icon component\n * @returns The wrapped content or original content if not a string\n */\nexport function wrapIcon(\n maybeIconKey: ReactNode,\n slot: ItemIconSlot\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n maybeIconKey = maybeIconKey ?? '';\n\n if (typeof maybeIconKey !== 'string') {\n return maybeIconKey;\n }\n\n return (\n <Icon slot={slot}>\n <FontAwesomeIcon icon={dhIcons[maybeIconKey] ?? dhIcons.vsBlank} />\n </Icon>\n );\n}\n\n/**\n * Ensure all primitive children are wrapped in `Item` elements and that all\n * `Item` element content is wrapped in `ItemContent` elements to handle text\n * overflow consistently and to support tooltips.\n * @param itemsOrSections The items or sections to wrap\n * @param tooltipOptions The tooltip options to use when wrapping items\n * @returns The wrapped items or sections\n */\nexport function wrapItemChildren<T>(\n itemsOrSections: ItemOrSection<T> | ItemOrSection<T>[],\n tooltipOptions: TooltipOptions | null\n): ItemElement<T> | SectionElement<T> | (ItemElement<T> | SectionElement<T>)[] {\n const itemsOrSectionsArray = ensureArray(itemsOrSections);\n\n const result = itemsOrSectionsArray.map(item => {\n if (isItemElement(item)) {\n // Item content is already wrapped\n if (isElementOfType(item.props.children, ItemContent)) {\n return item;\n }\n\n const key = item.key ?? item.props.textValue;\n const textValue =\n item.props.textValue === ''\n ? ITEM_EMPTY_STRING_TEXT_VALUE\n : item.props.textValue;\n\n // Wrap in `ItemContent` so we can support tooltips and handle text\n // overflow\n return cloneElement(item, {\n ...item.props,\n key,\n textValue,\n children: (\n <ItemContent tooltipOptions={tooltipOptions}>\n {item.props.children}\n </ItemContent>\n ),\n });\n }\n\n if (isSectionElement(item)) {\n return cloneElement(item, {\n ...item.props,\n key:\n item.key ??\n (typeof item.props.title === 'string' ? item.props.title : undefined),\n children: wrapItemChildren<T>(item.props.children, tooltipOptions),\n });\n }\n\n const text = String(item);\n const textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;\n\n return (\n <Item key={text} textValue={textValue}>\n <ItemContent tooltipOptions={tooltipOptions}>{text}</ItemContent>\n </Item>\n );\n });\n\n // Keep consistent with original data structure as array or single node\n return Array.isArray(itemsOrSections) ? result : result[0];\n}\n\n/**\n * If the given content is a primitive type, wrap it in a Text component.\n * @param content The content to wrap\n * @param slot The slot to use for the Text component\n * @returns The wrapped content or original content if not a primitive type\n */\nexport function wrapPrimitiveWithText(\n content?: ReactNode,\n slot?: string\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n content = content ?? '';\n\n if (['string', 'boolean', 'number'].includes(typeof content)) {\n return (\n <Text slot={slot}>\n {/* Non-breaking space is needed to avoid the Text element's height \n collapsing when content is empty */}\n {content === '' ? NON_BREAKING_SPACE : String(content)}\n </Text>\n );\n }\n\n return content;\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,QAAmB,OAAO;AAC/C,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,EAAE,IAAIC,OAAO,QAAQ,kBAAkB;AAChD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,kBAAkB;AAAC,SAEjEC,aAAa,EACbC,gBAAgB,EAIhBC,4BAA4B;AAAA,SAIrBC,WAAW;AAAA,SACXC,IAAI;AAAA,SACJC,IAAI;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,OAAO,SAASC,QAAQA,CACtBC,YAAuB,EACvBC,IAAkB,EACP;EAAA,IAAAC,aAAA,EAAAC,qBAAA;EACX;EACAH,YAAY,IAAAE,aAAA,GAAGF,YAAY,cAAAE,aAAA,cAAAA,aAAA,GAAI,EAAE;EAEjC,IAAI,OAAOF,YAAY,KAAK,QAAQ,EAAE;IACpC,OAAOA,YAAY;EACrB;EAEA,oBACEF,IAAA,CAACH,IAAI;IAACM,IAAI,EAAEA,IAAK;IAAAG,QAAA,eACfN,IAAA,CAACb,eAAe;MAACoB,IAAI,GAAAF,qBAAA,GAAEhB,OAAO,CAACa,YAAY,CAAC,cAAAG,qBAAA,cAAAA,qBAAA,GAAIhB,OAAO,CAACmB;IAAQ,CAAE;EAAC,CAC/D,CAAC;AAEX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,eAAsD,EACtDC,cAAqC,EACwC;EAC7E,IAAMC,oBAAoB,GAAGrB,WA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ACJ;IAEA,IAAMa,IAAI,GAAGC,MAAM,CAACV,IAAI,CAAC;IACzB,IAAMI,SAAS,GAAGK,IAAI,KAAK,EAAE,GAAG7B,4BAA4B,GAAG6B,IAAI;IAEnE,oBACExB,IAAA,CAACd,IAAI;MAAYiC,SAAS,EAAEA,SAAU;MAAAb,QAAA,eACpCN,IAAA,CAACJ,WAAW;QAACe,cAAc,EAAEA,cAAe;QAAAL,QAAA,EAAEkB;MAAI,CAAc;IAAC,GADxDA,IAEL,CAAC;EAEX,CAAC,CAAC;;EAEF;EACA,OAAOE,KAAK,CAACC,OAAO,CAACjB,eAAe,CAAC,GAAGG,MAAM,GAAGA,MAAM,CAAC,CAAC,CAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASe,qBAAqBA,CACnCC,OAAmB,EACnB1B,IAAa,EACF;EAAA,IAAA2B,QAAA;EACX;EACAD,OAAO,IAAAC,QAAA,GAAGD,OAAO,cAAAC,QAAA,cAAAA,QAAA,GAAI,EAAE;EAEvB,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAAC,OAAOF,OAAO,CAAC,EAAE;IAC5D,oBACE7B,IAAA,CAACF,IAAI;MAACK,IAAI,EAAEA,IAAK;MAAAG,QAAA,EAGduB,OAAO,KAAK,EAAE,GAAGrC,kBAAkB,GAAGiC,MAAM,CAACI,OAAO;IAAC,CAClD,CAAC;EAEX;EAEA,OAAOA,OAAO;AAChB"}
@@ -1,10 +1,14 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
+ import { ListActionGroupProps } from '../ListActionGroup';
3
+ import { ListActionMenuProps } from '../ListActionMenu';
2
4
  import { ItemIconSlot, NormalizedItem, TooltipOptions } from './itemUtils';
5
+ export type ListActions<T> = ReactElement<ListActionGroupProps<T>> | ReactElement<ListActionMenuProps<T>>;
3
6
  export interface UseRenderNormalizedItemOptions {
4
7
  itemIconSlot: ItemIconSlot;
5
8
  showItemDescriptions: boolean;
6
9
  showItemIcons: boolean;
7
10
  tooltipOptions: TooltipOptions | null;
11
+ actions?: ListActions<unknown>;
8
12
  }
9
13
  /**
10
14
  * Returns a render function that can be used to render a normalized item in
@@ -13,8 +17,9 @@ export interface UseRenderNormalizedItemOptions {
13
17
  * @param showItemDescriptions Whether to show item descriptions
14
18
  * @param showItemIcons Whether to show item icons
15
19
  * @param tooltipOptions Tooltip options to use when rendering the item
20
+ * @param actions Optional actions to render with the item
16
21
  * @returns Render function for normalized items
17
22
  */
18
- export declare function useRenderNormalizedItem({ itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions, }: UseRenderNormalizedItemOptions): (normalizedItem: NormalizedItem) => JSX.Element;
23
+ export declare function useRenderNormalizedItem({ itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions, actions, }: UseRenderNormalizedItemOptions): (normalizedItem: NormalizedItem) => JSX.Element;
19
24
  export default useRenderNormalizedItem;
20
25
  //# sourceMappingURL=useRenderNormalizedItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderNormalizedItem.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"names":[],"mappings":";AAGA,OAAO,EAEL,YAAY,EAEZ,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,cAAc,GACf,EAAE,8BAA8B,GAAG,CAClC,cAAc,EAAE,cAAc,KAC3B,GAAG,CAAC,OAAO,CA2Cf;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"useRenderNormalizedItem.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,YAAY,EAAe,MAAM,OAAO,CAAC;AAIvD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAkB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAEL,YAAY,EAEZ,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,WAAW,CAAC,CAAC,IACrB,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,GACrC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzC,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,OAAO,GACR,EAAE,8BAA8B,GAAG,CAClC,cAAc,EAAE,cAAc,KAC3B,GAAG,CAAC,OAAO,CAoEf;AAED,eAAe,uBAAuB,CAAC"}
@@ -1,10 +1,20 @@
1
+ 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; }
2
+ 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; }
3
+ 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; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
+ 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); }
6
+ import { isElementOfType } from '@deephaven/react-hooks';
1
7
  import { useCallback } from 'react';
8
+ import ActionGroup from "../ActionGroup.js";
9
+ import ActionMenu from "../ActionMenu.js";
2
10
  import { ItemContent } from "../ItemContent.js";
11
+ import { ListActionGroup } from "../ListActionGroup.js";
12
+ import { ListActionMenu } from "../ListActionMenu.js";
3
13
  import { Item } from "../shared.js";
4
14
  import { getItemKey, ITEM_EMPTY_STRING_TEXT_VALUE } from "./itemUtils.js";
5
15
  import { wrapIcon, wrapPrimitiveWithText } from "./itemWrapperUtils.js";
6
- import { jsxs as _jsxs } from "react/jsx-runtime";
7
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
18
  /**
9
19
  * Returns a render function that can be used to render a normalized item in
10
20
  * collection components.
@@ -12,6 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
12
22
  * @param showItemDescriptions Whether to show item descriptions
13
23
  * @param showItemIcons Whether to show item icons
14
24
  * @param tooltipOptions Tooltip options to use when rendering the item
25
+ * @param actions Optional actions to render with the item
15
26
  * @returns Render function for normalized items
16
27
  */
17
28
  export function useRenderNormalizedItem(_ref) {
@@ -19,15 +30,38 @@ export function useRenderNormalizedItem(_ref) {
19
30
  itemIconSlot,
20
31
  showItemDescriptions,
21
32
  showItemIcons,
22
- tooltipOptions
33
+ tooltipOptions,
34
+ actions
23
35
  } = _ref;
24
36
  return useCallback(normalizedItem => {
25
37
  var _normalizedItem$item, _normalizedItem$item$, _normalizedItem$item2, _normalizedItem$item3, _normalizedItem$item4;
26
- var key = getItemKey(normalizedItem);
38
+ var itemKey = getItemKey(normalizedItem);
27
39
  var content = wrapPrimitiveWithText((_normalizedItem$item = normalizedItem.item) === null || _normalizedItem$item === void 0 ? void 0 : _normalizedItem$item.content);
28
40
  var textValue = (_normalizedItem$item$ = (_normalizedItem$item2 = normalizedItem.item) === null || _normalizedItem$item2 === void 0 ? void 0 : _normalizedItem$item2.textValue) !== null && _normalizedItem$item$ !== void 0 ? _normalizedItem$item$ : '';
29
41
  var description = showItemDescriptions ? wrapPrimitiveWithText((_normalizedItem$item3 = normalizedItem.item) === null || _normalizedItem$item3 === void 0 ? void 0 : _normalizedItem$item3.description, 'description') : null;
30
42
  var icon = showItemIcons ? wrapIcon((_normalizedItem$item4 = normalizedItem.item) === null || _normalizedItem$item4 === void 0 ? void 0 : _normalizedItem$item4.icon, itemIconSlot) : null;
43
+ var action = null;
44
+ if (isElementOfType(actions, ListActionGroup)) {
45
+ action = /*#__PURE__*/_jsx(ActionGroup
46
+ // eslint-disable-next-line react/jsx-props-no-spreading
47
+ , _objectSpread(_objectSpread({}, actions.props), {}, {
48
+ onAction: key => actions.props.onAction(key, itemKey),
49
+ onChange: keys => {
50
+ var _actions$props$onChan, _actions$props;
51
+ return (_actions$props$onChan = (_actions$props = actions.props).onChange) === null || _actions$props$onChan === void 0 ? void 0 : _actions$props$onChan.call(_actions$props, keys, itemKey);
52
+ }
53
+ }));
54
+ } else if (isElementOfType(actions, ListActionMenu)) {
55
+ action = /*#__PURE__*/_jsx(ActionMenu
56
+ // eslint-disable-next-line react/jsx-props-no-spreading
57
+ , _objectSpread(_objectSpread({}, actions.props), {}, {
58
+ onAction: key => actions.props.onAction(key, itemKey),
59
+ onOpenChange: isOpen => {
60
+ var _actions$props$onOpen, _actions$props2;
61
+ return (_actions$props$onOpen = (_actions$props2 = actions.props).onOpenChange) === null || _actions$props$onOpen === void 0 ? void 0 : _actions$props$onOpen.call(_actions$props2, isOpen, itemKey);
62
+ }
63
+ }));
64
+ }
31
65
  return /*#__PURE__*/_jsx(Item
32
66
  // Note that setting the `key` prop explicitly on `Item` elements
33
67
  // causes the picker to expect `selectedKey` and `defaultSelectedKey`
@@ -44,10 +78,10 @@ export function useRenderNormalizedItem(_ref) {
44
78
  textValue: textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue,
45
79
  children: /*#__PURE__*/_jsxs(ItemContent, {
46
80
  tooltipOptions: tooltipOptions,
47
- children: [icon, content, description]
81
+ children: [icon, content, description, action]
48
82
  })
49
- }, key);
50
- }, [itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]);
83
+ }, itemKey);
84
+ }, [actions, itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]);
51
85
  }
52
86
  export default useRenderNormalizedItem;
53
87
  //# sourceMappingURL=useRenderNormalizedItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderNormalizedItem.js","names":["useCallback","ItemContent","Item","getItemKey","ITEM_EMPTY_STRING_TEXT_VALUE","wrapIcon","wrapPrimitiveWithText","jsxs","_jsxs","jsx","_jsx","useRenderNormalizedItem","_ref","itemIconSlot","showItemDescriptions","showItemIcons","tooltipOptions","normalizedItem","_normalizedItem$item","_normalizedItem$item$","_normalizedItem$item2","_normalizedItem$item3","_normalizedItem$item4","key","content","item","textValue","description","icon","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { Key, useCallback } from 'react';\nimport { ItemContent } from '../ItemContent';\nimport { Item } from '../shared';\nimport {\n getItemKey,\n ItemIconSlot,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n NormalizedItem,\n TooltipOptions,\n} from './itemUtils';\nimport { wrapIcon, wrapPrimitiveWithText } from './itemWrapperUtils';\n\nexport interface UseRenderNormalizedItemOptions {\n itemIconSlot: ItemIconSlot;\n showItemDescriptions: boolean;\n showItemIcons: boolean;\n tooltipOptions: TooltipOptions | null;\n}\n\n/**\n * Returns a render function that can be used to render a normalized item in\n * collection components.\n * @param itemIconSlot Slot to use for item icons\n * @param showItemDescriptions Whether to show item descriptions\n * @param showItemIcons Whether to show item icons\n * @param tooltipOptions Tooltip options to use when rendering the item\n * @returns Render function for normalized items\n */\nexport function useRenderNormalizedItem({\n itemIconSlot,\n showItemDescriptions,\n showItemIcons,\n tooltipOptions,\n}: UseRenderNormalizedItemOptions): (\n normalizedItem: NormalizedItem\n) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const key = getItemKey(normalizedItem);\n const content = wrapPrimitiveWithText(normalizedItem.item?.content);\n const textValue = normalizedItem.item?.textValue ?? '';\n\n const description = showItemDescriptions\n ? wrapPrimitiveWithText(normalizedItem.item?.description, 'description')\n : null;\n\n const icon = showItemIcons\n ? wrapIcon(normalizedItem.item?.icon, itemIconSlot)\n : null;\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other components that use this hook.\n key={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 // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.\n textValue={\n textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue\n }\n >\n <ItemContent tooltipOptions={tooltipOptions}>\n {icon}\n {content}\n {description}\n </ItemContent>\n </Item>\n );\n },\n [itemIconSlot, showItemDescriptions, show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,IAAI;IAER,oBACEH,IAAA,CAACR;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;MAEA;MACA;MACA;MACA;MACAwB,SAAS,EACPA,SAAS,KAAK,EAAE,GAAGtB,4BAA4B,GAAGsB,SACnD;MAAAG,QAAA,eAEDrB,KAAA,CAACP,WAAW;QAACe,cAAc,EAAEA,cAAe;QAAAa,QAAA,GACzCD,IAAI,EACJJ,OAAO,EACPG,WAAW;MAAA,CACD;IAAC,GAbTJ,GAcD,CAAC;EAEX,CAAC,EACD,CAACV,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,cAAc,CACpE,CAAC;AACH;AAEA,eAAeL,uBAAuB"}
1
+ {"version":3,"file":"useRenderNormalizedItem.js","names":["isElementOfType","useCallback","ActionGroup","ActionMenu","ItemContent","ListActionGroup","ListActionMenu","Item","getItemKey","ITEM_EMPTY_STRING_TEXT_VALUE","wrapIcon","wrapPrimitiveWithText","jsx","_jsx","jsxs","_jsxs","useRenderNormalizedItem","_ref","itemIconSlot","showItemDescriptions","showItemIcons","tooltipOptions","actions","normalizedItem","_normalizedItem$item","_normalizedItem$item$","_normalizedItem$item2","_normalizedItem$item3","_normalizedItem$item4","itemKey","content","item","textValue","description","icon","action","_objectSpread","props","onAction","key","onChange","keys","_actions$props$onChan","_actions$props","call","onOpenChange","isOpen","_actions$props$onOpen","_actions$props2","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { isElementOfType } from '@deephaven/react-hooks';\nimport { Key, ReactElement, useCallback } from 'react';\nimport ActionGroup from '../ActionGroup';\nimport ActionMenu from '../ActionMenu';\nimport { ItemContent } from '../ItemContent';\nimport { ListActionGroup, ListActionGroupProps } from '../ListActionGroup';\nimport { ListActionMenu, ListActionMenuProps } from '../ListActionMenu';\nimport { Item } from '../shared';\nimport {\n getItemKey,\n ItemIconSlot,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n NormalizedItem,\n TooltipOptions,\n} from './itemUtils';\nimport { wrapIcon, wrapPrimitiveWithText } from './itemWrapperUtils';\n\nexport type ListActions<T> =\n | ReactElement<ListActionGroupProps<T>>\n | ReactElement<ListActionMenuProps<T>>;\n\nexport interface UseRenderNormalizedItemOptions {\n itemIconSlot: ItemIconSlot;\n showItemDescriptions: boolean;\n showItemIcons: boolean;\n tooltipOptions: TooltipOptions | null;\n actions?: ListActions<unknown>;\n}\n\n/**\n * Returns a render function that can be used to render a normalized item in\n * collection components.\n * @param itemIconSlot Slot to use for item icons\n * @param showItemDescriptions Whether to show item descriptions\n * @param showItemIcons Whether to show item icons\n * @param tooltipOptions Tooltip options to use when rendering the item\n * @param actions Optional actions to render with the item\n * @returns Render function for normalized items\n */\nexport function useRenderNormalizedItem({\n itemIconSlot,\n showItemDescriptions,\n showItemIcons,\n tooltipOptions,\n actions,\n}: UseRenderNormalizedItemOptions): (\n normalizedItem: NormalizedItem\n) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const itemKey = getItemKey(normalizedItem);\n const content = wrapPrimitiveWithText(normalizedItem.item?.content);\n const textValue = normalizedItem.item?.textValue ?? '';\n\n const description = showItemDescriptions\n ? wrapPrimitiveWithText(normalizedItem.item?.description, 'description')\n : null;\n\n const icon = showItemIcons\n ? wrapIcon(normalizedItem.item?.icon, itemIconSlot)\n : null;\n\n let action = null;\n\n if (isElementOfType(actions, ListActionGroup)) {\n action = (\n <ActionGroup\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onChange={keys => actions.props.onChange?.(keys, itemKey)}\n />\n );\n } else if (isElementOfType(actions, ListActionMenu)) {\n action = (\n <ActionMenu\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onOpenChange={isOpen =>\n actions.props.onOpenChange?.(isOpen, itemKey)\n }\n />\n );\n }\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other components that use this hook.\n key={itemKey as Key}\n // The `textValue` prop gets used to provide the content of `<option>`\n // elements that back the Spectrum Picker. These are not visible in the UI,\n // but are used for accessibility purposes, so we set to an arbitrary\n // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.\n textValue={\n textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue\n }\n >\n <ItemContent tooltipOptions={tooltipOptions}>\n {icon}\n {content}\n {description}\n {action}\n </ItemContent>\n </Item>\n );\n },\n [actions, itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]\n );\n}\n\nexport default useRenderNormalizedItem;\n"],"mappings":";;;;;AAAA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAA4BC,WAAW,QAAQ,OAAO;AAAC,OAChDC,WAAW;AAAA,OACXC,UAAU;AAAA,SACRC,WAAW;AAAA,SACXC,eAAe;AAAA,SACfC,cAAc;AAAA,SACdC,IAAI;AAAA,SAEXC,UAAU,EAEVC,4BAA4B;AAAA,SAIrBC,QAAQ,EAAEC,qBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAcxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAAC,IAAA,EAQtB;EAAA,IARuB;IACtCC,YAAY;IACZC,oBAAoB;IACpBC,aAAa;IACbC,cAAc;IACdC;EAC8B,CAAC,GAAAL,IAAA;EAG/B,OAAOhB,WAAW,CACfsB,cAA8B,IAAK;IAAA,IAAAC,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IAClC,IAAMC,OAAO,GAAGrB,UAAU,CAACe,cAAc,CAAC;IAC1C,I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MACnD6B,MAAM,gBACJtB,IAAA,CAACV;MACC;MAAA,EAAAiC,aAAA,CAAAA,aAAA,KACId,OAAO,CAACe,KAAK;QACjBC,QAAQ,EAAEC,GAAG,IAAIjB,OAAO,CAACe,KAAK,CAACC,QAAQ,CAACC,GAAG,EAAEV,OAAO,CAAE;QACtDgB,YAAY,EAAEC,MAAM;UAAA,IAAAC,qBAAA,EAAAC,eAAA;UAAA,QAAAD,qBAAA,GAClB,CAAAC,eAAA,GAAA1B,OAAO,CAACe,KAAK,EAACQ,YAAY,cAAAE,qBAAA,uBAA1BA,qBAAA,CAAAH,IAAA,CAAAI,eAAA,EAA6BF,MAAM,EAAEjB,OAAO,CAAC;QAAA;MAC9C,EACF,CACF;IACH;IAEA,oBACEhB,IAAA,CAACN;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;MAEA;MACA;MACA;MACA;MACAyB,SAAS,EACPA,SAAS,KAAK,EAAE,GAAGvB,4BAA4B,GAAGuB,SACnD;MAAAiB,QAAA,eAEDlC,KAAA,CAACX,WAAW;QAACiB,cAAc,EAAEA,cAAe;QAAA4B,QAAA,GACzCf,IAAI,EACJJ,OAAO,EACPG,WAAW,EACXE,MAAM;MAAA,CACI;IAAC,GAdTN,OAeD,CAAC;EAEX,CAAC,EACD,CAACP,OAAO,EAAEJ,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,cAAc,CAC7E,CAAC;AACH;AAEA,eAAeL,uBAAuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/components",
3
- "version": "0.77.1-beta.0+bb236712",
3
+ "version": "0.77.1-beta.11+6cf12401",
4
4
  "description": "Deephaven React component library",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@adobe/react-spectrum": "3.33.1",
28
- "@deephaven/icons": "^0.77.1-beta.0+bb236712",
29
- "@deephaven/log": "^0.77.1-beta.0+bb236712",
30
- "@deephaven/react-hooks": "^0.77.1-beta.0+bb236712",
31
- "@deephaven/utils": "^0.77.1-beta.0+bb236712",
28
+ "@deephaven/icons": "^0.77.1-beta.11+6cf12401",
29
+ "@deephaven/log": "^0.77.1-beta.11+6cf12401",
30
+ "@deephaven/react-hooks": "^0.77.1-beta.11+6cf12401",
31
+ "@deephaven/utils": "^0.77.1-beta.11+6cf12401",
32
32
  "@fortawesome/fontawesome-svg-core": "^6.2.1",
33
33
  "@fortawesome/react-fontawesome": "^0.2.0",
34
34
  "@react-spectrum/theme-default": "^3.5.1",
@@ -55,7 +55,7 @@
55
55
  "react-dom": ">=16.8.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@deephaven/mocks": "^0.77.1-beta.0+bb236712"
58
+ "@deephaven/mocks": "^0.77.1-beta.11+6cf12401"
59
59
  },
60
60
  "files": [
61
61
  "dist",
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "bb2367122ac540ccb3943e3a2a01533da3c86ed9"
72
+ "gitHead": "6cf124012a19b122b3a96f620886b970c12b6d29"
73
73
  }
@@ -54,4 +54,4 @@ $ant-thickness: 1px;
54
54
  $focus-bg-transparency: 12%;
55
55
  $hover-bg-transparency: 14%;
56
56
  $active-bg-transparency: 28%;
57
- $exception-transparency: 13%;
57
+ $exception-transparency: 28%;
package/scss/util.scss CHANGED
@@ -71,6 +71,10 @@
71
71
  @return color-mix-opacity('negative', $i);
72
72
  }
73
73
 
74
+ @function negative-down-bg-opacity($i: 100) {
75
+ @return color-mix-opacity('negative-down-bg', $i);
76
+ }
77
+
74
78
  @function black-opacity($i: 100) {
75
79
  @return color-mix-opacity('black', $i);
76
80
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../src/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAazD;kBAbQ,WAAW;;;;;;;;;;;;;;AA8BpB,eAAe,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ButtonGroup.js","names":["React","classNames","PropTypes","jsx","_jsx","ButtonGroup","props","children","className","style","dataTestId","role","displayName","propTypes","node","isRequired","string","object","defaultProps","undefined"],"sources":["../src/ButtonGroup.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\ninterface ButtonGroupProps {\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n 'data-testid'?: string;\n}\n\nfunction ButtonGroup(props: ButtonGroupProps): JSX.Element {\n const { children, className, style, 'data-testid': dataTestId } = props;\n\n return (\n <div\n className={classNames('btn-group', className)}\n style={style}\n role=\"group\"\n data-testid={dataTestId}\n >\n {children}\n </div>\n );\n}\n\nButtonGroup.displayName = 'ButtonGroup';\n\nButtonGroup.propTypes = {\n children: PropTypes.node.isRequired,\n className: PropTypes.string,\n style: PropTypes.object,\n 'data-testid': PropTypes.string,\n};\n\nButtonGroup.defaultProps = {\n className: null,\n style: {},\n 'data-testid': undefined,\n};\n\nexport default ButtonGroup;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASnC,SAASC,WAAWA,CAACC,KAAuB,EAAe;EACzD,IAAM;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,KAAK;IAAE,aAAa,EAAEC;EAAW,CAAC,GAAGJ,KAAK;EAEvE,oBACEF,IAAA;IACEI,SAAS,EAAEP,UAAU,CAAC,WAAW,EAAEO,SAAS,CAAE;IAC9CC,KAAK,EAAEA,KAAM;IACbE,IAAI,EAAC,OAAO;IACZ,eAAaD,UAAW;IAAAH,QAAA,EAEvBA;EAAQ,CACN,CAAC;AAEV;AAEAF,WAAW,CAACO,WAAW,GAAG,aAAa;AAEvCP,WAAW,CAACQ,SAAS,GAAG;EACtBN,QAAQ,EAAEL,SAAS,CAACY,IAAI,CAACC,UAAU;EACnCP,SAAS,EAAEN,SAAS,CAACc,MAAM;EAC3BP,KAAK,EAAEP,SAAS,CAACe,MAAM;EACvB,aAAa,EAAEf,SAAS,CAACc;AAC3B,CAAC;AAEDX,WAAW,CAACa,YAAY,GAAG;EACzBV,SAAS,EAAE,IAAI;EACfC,KAAK,EAAE,CAAC,CAAC;EACT,aAAa,EAAEU;AACjB,CAAC;AAED,eAAed,WAAW"}