@deephaven/components 1.7.2-beta.1 → 1.7.2-react-18-alpha.3

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 (278) hide show
  1. package/dist/AutoCompleteInput.d.ts +0 -17
  2. package/dist/AutoCompleteInput.d.ts.map +1 -1
  3. package/dist/AutoCompleteInput.js +12 -31
  4. package/dist/AutoCompleteInput.js.map +1 -1
  5. package/dist/AutoResizeTextarea.d.ts +0 -23
  6. package/dist/AutoResizeTextarea.d.ts.map +1 -1
  7. package/dist/AutoResizeTextarea.js +0 -21
  8. package/dist/AutoResizeTextarea.js.map +1 -1
  9. package/dist/BasicModal.d.ts +0 -27
  10. package/dist/BasicModal.d.ts.map +1 -1
  11. package/dist/BasicModal.js +2 -28
  12. package/dist/BasicModal.js.map +1 -1
  13. package/dist/BulkActionBar.js.map +1 -1
  14. package/dist/Button.d.ts +1 -1
  15. package/dist/Button.d.ts.map +1 -1
  16. package/dist/Button.js +2 -79
  17. package/dist/Button.js.map +1 -1
  18. package/dist/CardFlip.d.ts.map +1 -1
  19. package/dist/CardFlip.js +1 -2
  20. package/dist/CardFlip.js.map +1 -1
  21. package/dist/Checkbox.d.ts.map +1 -1
  22. package/dist/Checkbox.js +3 -45
  23. package/dist/Checkbox.js.map +1 -1
  24. package/dist/Collapse.d.ts +0 -8
  25. package/dist/Collapse.d.ts.map +1 -1
  26. package/dist/Collapse.js +0 -8
  27. package/dist/Collapse.js.map +1 -1
  28. package/dist/ComponentUtils.js.map +1 -1
  29. package/dist/CopyButton.js.map +1 -1
  30. package/dist/CustomTimeSelect.js +14 -15
  31. package/dist/CustomTimeSelect.js.map +1 -1
  32. package/dist/DateInput.js.map +1 -1
  33. package/dist/DateInputUtils.js.map +1 -1
  34. package/dist/DateTimeInput.d.ts.map +1 -1
  35. package/dist/DateTimeInput.js +0 -8
  36. package/dist/DateTimeInput.js.map +1 -1
  37. package/dist/DateTimeInputUtils.js.map +1 -1
  38. package/dist/DebouncedSearchInput.js +1 -1
  39. package/dist/DebouncedSearchInput.js.map +1 -1
  40. package/dist/DragUtils.js.map +1 -1
  41. package/dist/DraggableItemList.d.ts +2 -2
  42. package/dist/DraggableItemList.d.ts.map +1 -1
  43. package/dist/DraggableItemList.js +8 -7
  44. package/dist/DraggableItemList.js.map +1 -1
  45. package/dist/EditableItemList.js +1 -2
  46. package/dist/EditableItemList.js.map +1 -1
  47. package/dist/ErrorBoundary.js +1 -1
  48. package/dist/ErrorBoundary.js.map +1 -1
  49. package/dist/ErrorView.js +1 -2
  50. package/dist/ErrorView.js.map +1 -1
  51. package/dist/HierarchicalCheckboxMenu.d.ts +1 -1
  52. package/dist/HierarchicalCheckboxMenu.d.ts.map +1 -1
  53. package/dist/HierarchicalCheckboxMenu.js +1 -2
  54. package/dist/HierarchicalCheckboxMenu.js.map +1 -1
  55. package/dist/ItemList.d.ts +1 -1
  56. package/dist/ItemList.d.ts.map +1 -1
  57. package/dist/ItemList.js +14 -14
  58. package/dist/ItemList.js.map +1 -1
  59. package/dist/ItemListItem.js.map +1 -1
  60. package/dist/LoadingOverlay.js +1 -2
  61. package/dist/LoadingOverlay.js.map +1 -1
  62. package/dist/LoadingSpinner.js.map +1 -1
  63. package/dist/MaskedInput.d.ts.map +1 -1
  64. package/dist/MaskedInput.js +11 -31
  65. package/dist/MaskedInput.js.map +1 -1
  66. package/dist/MaskedInputUtils.js.map +1 -1
  67. package/dist/Option.js.map +1 -1
  68. package/dist/RadioGroup.js +1 -2
  69. package/dist/RadioGroup.js.map +1 -1
  70. package/dist/RadioItem.d.ts.map +1 -1
  71. package/dist/RadioItem.js +1 -13
  72. package/dist/RadioItem.js.map +1 -1
  73. package/dist/RandomAreaPlotAnimation.d.ts +1 -1
  74. package/dist/RandomAreaPlotAnimation.d.ts.map +1 -1
  75. package/dist/RandomAreaPlotAnimation.js +5 -8
  76. package/dist/RandomAreaPlotAnimation.js.map +1 -1
  77. package/dist/SearchInput.js +3 -5
  78. package/dist/SearchInput.js.map +1 -1
  79. package/dist/SearchableCombobox.js.map +1 -1
  80. package/dist/Select.d.ts +1 -1
  81. package/dist/Select.d.ts.map +1 -1
  82. package/dist/Select.js.map +1 -1
  83. package/dist/SelectValueList.js +9 -9
  84. package/dist/SelectValueList.js.map +1 -1
  85. package/dist/SocketedButton.d.ts +4 -4
  86. package/dist/SocketedButton.d.ts.map +1 -1
  87. package/dist/SocketedButton.js +5 -20
  88. package/dist/SocketedButton.js.map +1 -1
  89. package/dist/SplitButtonGroup.d.ts +2 -18
  90. package/dist/SplitButtonGroup.d.ts.map +1 -1
  91. package/dist/SplitButtonGroup.js +0 -13
  92. package/dist/SplitButtonGroup.js.map +1 -1
  93. package/dist/TableViewEmptyState.js +1 -2
  94. package/dist/TableViewEmptyState.js.map +1 -1
  95. package/dist/TextWithTooltip.js +1 -3
  96. package/dist/TextWithTooltip.js.map +1 -1
  97. package/dist/ThemeExport.js.map +1 -1
  98. package/dist/TimeInput.d.ts.map +1 -1
  99. package/dist/TimeInput.js +7 -17
  100. package/dist/TimeInput.js.map +1 -1
  101. package/dist/TimeSlider.js +3 -6
  102. package/dist/TimeSlider.js.map +1 -1
  103. package/dist/ToastNotification.d.ts +1 -2
  104. package/dist/ToastNotification.d.ts.map +1 -1
  105. package/dist/ToastNotification.js +1 -2
  106. package/dist/ToastNotification.js.map +1 -1
  107. package/dist/UIConstants.js.map +1 -1
  108. package/dist/UISwitch.d.ts.map +1 -1
  109. package/dist/UISwitch.js +18 -14
  110. package/dist/UISwitch.js.map +1 -1
  111. package/dist/XComponent.d.ts +1 -1
  112. package/dist/XComponent.d.ts.map +1 -1
  113. package/dist/XComponent.js.map +1 -1
  114. package/dist/XComponentMap.d.ts +2 -2
  115. package/dist/XComponentMap.d.ts.map +1 -1
  116. package/dist/XComponentMap.js.map +1 -1
  117. package/dist/actions/ConfirmActionButton.js.map +1 -1
  118. package/dist/actions/IconActionButton.js +1 -2
  119. package/dist/actions/IconActionButton.js.map +1 -1
  120. package/dist/actions/index.js.map +1 -1
  121. package/dist/context-actions/ContextActionUtils.js.map +1 -1
  122. package/dist/context-actions/ContextActions.d.ts +1 -2
  123. package/dist/context-actions/ContextActions.d.ts.map +1 -1
  124. package/dist/context-actions/ContextActions.js +22 -22
  125. package/dist/context-actions/ContextActions.js.map +1 -1
  126. package/dist/context-actions/ContextMenu.js +5 -7
  127. package/dist/context-actions/ContextMenu.js.map +1 -1
  128. package/dist/context-actions/ContextMenuItem.d.ts.map +1 -1
  129. package/dist/context-actions/ContextMenuItem.js +21 -43
  130. package/dist/context-actions/ContextMenuItem.js.map +1 -1
  131. package/dist/context-actions/ContextMenuRoot.js +1 -1
  132. package/dist/context-actions/ContextMenuRoot.js.map +1 -1
  133. package/dist/context-actions/GlobalContextAction.js +1 -1
  134. package/dist/context-actions/GlobalContextAction.js.map +1 -1
  135. package/dist/context-actions/GlobalContextActions.js.map +1 -1
  136. package/dist/context-actions/index.js.map +1 -1
  137. package/dist/declaration.d.js.map +1 -1
  138. package/dist/dialogs/ActionButtonDialogTrigger.js +1 -2
  139. package/dist/dialogs/ActionButtonDialogTrigger.js.map +1 -1
  140. package/dist/dialogs/ConfirmationDialog.js +1 -2
  141. package/dist/dialogs/ConfirmationDialog.js.map +1 -1
  142. package/dist/dialogs/index.js.map +1 -1
  143. package/dist/index.js.map +1 -1
  144. package/dist/menu-actions/DropdownMenu.js +2 -2
  145. package/dist/menu-actions/DropdownMenu.js.map +1 -1
  146. package/dist/menu-actions/Menu.js +4 -6
  147. package/dist/menu-actions/Menu.js.map +1 -1
  148. package/dist/menu-actions/index.js.map +1 -1
  149. package/dist/modal/DebouncedModal.js +1 -3
  150. package/dist/modal/DebouncedModal.js.map +1 -1
  151. package/dist/modal/InfoModal.js +1 -2
  152. package/dist/modal/InfoModal.js.map +1 -1
  153. package/dist/modal/Modal.js +2 -3
  154. package/dist/modal/Modal.js.map +1 -1
  155. package/dist/modal/ModalBody.js.map +1 -1
  156. package/dist/modal/ModalFooter.js.map +1 -1
  157. package/dist/modal/ModalHeader.js +1 -2
  158. package/dist/modal/ModalHeader.js.map +1 -1
  159. package/dist/modal/index.js.map +1 -1
  160. package/dist/navigation/DashboardList.js +3 -4
  161. package/dist/navigation/DashboardList.js.map +1 -1
  162. package/dist/navigation/Menu.js.map +1 -1
  163. package/dist/navigation/MenuItem.js +1 -2
  164. package/dist/navigation/MenuItem.js.map +1 -1
  165. package/dist/navigation/NavTab.d.ts +1 -1
  166. package/dist/navigation/NavTab.d.ts.map +1 -1
  167. package/dist/navigation/NavTab.js +4 -5
  168. package/dist/navigation/NavTab.js.map +1 -1
  169. package/dist/navigation/NavTabList.js +4 -5
  170. package/dist/navigation/NavTabList.js.map +1 -1
  171. package/dist/navigation/Page.js +1 -2
  172. package/dist/navigation/Page.js.map +1 -1
  173. package/dist/navigation/Stack.js +1 -3
  174. package/dist/navigation/Stack.js.map +1 -1
  175. package/dist/navigation/index.js.map +1 -1
  176. package/dist/popper/Popper.d.ts +1 -14
  177. package/dist/popper/Popper.d.ts.map +1 -1
  178. package/dist/popper/Popper.js +18 -29
  179. package/dist/popper/Popper.js.map +1 -1
  180. package/dist/popper/Tooltip.d.ts.map +1 -1
  181. package/dist/popper/Tooltip.js +18 -12
  182. package/dist/popper/Tooltip.js.map +1 -1
  183. package/dist/popper/index.js.map +1 -1
  184. package/dist/shortcuts/GlobalShortcuts.js.map +1 -1
  185. package/dist/shortcuts/NavigationShortcuts.js.map +1 -1
  186. package/dist/shortcuts/Shortcut.js +11 -13
  187. package/dist/shortcuts/Shortcut.js.map +1 -1
  188. package/dist/shortcuts/ShortcutRegistry.js +1 -1
  189. package/dist/shortcuts/ShortcutRegistry.js.map +1 -1
  190. package/dist/shortcuts/index.js.map +1 -1
  191. package/dist/spectrum/ActionGroup.js.map +1 -1
  192. package/dist/spectrum/ActionMenu.js.map +1 -1
  193. package/dist/spectrum/CheckboxGroup.js.map +1 -1
  194. package/dist/spectrum/Heading.js.map +1 -1
  195. package/dist/spectrum/ItemContent.js +2 -4
  196. package/dist/spectrum/ItemContent.js.map +1 -1
  197. package/dist/spectrum/ItemTooltip.js.map +1 -1
  198. package/dist/spectrum/ListActionGroup.js.map +1 -1
  199. package/dist/spectrum/ListActionMenu.js.map +1 -1
  200. package/dist/spectrum/TabPanels.d.ts.map +1 -1
  201. package/dist/spectrum/TabPanels.js +8 -5
  202. package/dist/spectrum/TabPanels.js.map +1 -1
  203. package/dist/spectrum/Text.js.map +1 -1
  204. package/dist/spectrum/View.js.map +1 -1
  205. package/dist/spectrum/buttons.js.map +1 -1
  206. package/dist/spectrum/collections.js.map +1 -1
  207. package/dist/spectrum/comboBox/ComboBox.js.map +1 -1
  208. package/dist/spectrum/comboBox/ComboBoxNormalized.js.map +1 -1
  209. package/dist/spectrum/comboBox/index.js.map +1 -1
  210. package/dist/spectrum/content.js.map +1 -1
  211. package/dist/spectrum/dateAndTime.js.map +1 -1
  212. package/dist/spectrum/forms.js.map +1 -1
  213. package/dist/spectrum/icons.js.map +1 -1
  214. package/dist/spectrum/index.js.map +1 -1
  215. package/dist/spectrum/layout.js.map +1 -1
  216. package/dist/spectrum/listView/ListView.js.map +1 -1
  217. package/dist/spectrum/listView/ListViewNormalized.js +1 -2
  218. package/dist/spectrum/listView/ListViewNormalized.js.map +1 -1
  219. package/dist/spectrum/listView/ListViewWrapper.js.map +1 -1
  220. package/dist/spectrum/listView/index.js.map +1 -1
  221. package/dist/spectrum/navigation.js.map +1 -1
  222. package/dist/spectrum/overlays.js.map +1 -1
  223. package/dist/spectrum/picker/Picker.js.map +1 -1
  224. package/dist/spectrum/picker/PickerNormalized.js.map +1 -1
  225. package/dist/spectrum/picker/PickerProps.js.map +1 -1
  226. package/dist/spectrum/picker/index.js.map +1 -1
  227. package/dist/spectrum/picker/usePickerItemScale.js.map +1 -1
  228. package/dist/spectrum/picker/usePickerNormalizedProps.d.ts +1 -2
  229. package/dist/spectrum/picker/usePickerNormalizedProps.d.ts.map +1 -1
  230. package/dist/spectrum/picker/usePickerNormalizedProps.js.map +1 -1
  231. package/dist/spectrum/picker/usePickerProps.js.map +1 -1
  232. package/dist/spectrum/picker/usePickerScrollOnOpen.js +1 -1
  233. package/dist/spectrum/picker/usePickerScrollOnOpen.js.map +1 -1
  234. package/dist/spectrum/shared.js.map +1 -1
  235. package/dist/spectrum/status.js.map +1 -1
  236. package/dist/spectrum/utils/index.js.map +1 -1
  237. package/dist/spectrum/utils/itemUtils.d.ts +2 -2
  238. package/dist/spectrum/utils/itemUtils.d.ts.map +1 -1
  239. package/dist/spectrum/utils/itemUtils.js +5 -1
  240. package/dist/spectrum/utils/itemUtils.js.map +1 -1
  241. package/dist/spectrum/utils/itemWrapperUtils.js +3 -4
  242. package/dist/spectrum/utils/itemWrapperUtils.js.map +1 -1
  243. package/dist/spectrum/utils/propsUtils.js.map +1 -1
  244. package/dist/spectrum/utils/themeUtils.js.map +1 -1
  245. package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js +1 -1
  246. package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js.map +1 -1
  247. package/dist/spectrum/utils/useRenderNormalizedItem.js +1 -2
  248. package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -1
  249. package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js +1 -1
  250. package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js.map +1 -1
  251. package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts +1 -1
  252. package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts.map +1 -1
  253. package/dist/spectrum/utils/useStringifiedMultiSelection.js.map +1 -1
  254. package/dist/spectrum/utils/useStringifiedSelection.d.ts +1 -1
  255. package/dist/spectrum/utils/useStringifiedSelection.d.ts.map +1 -1
  256. package/dist/spectrum/utils/useStringifiedSelection.js.map +1 -1
  257. package/dist/theme/Logo.js.map +1 -1
  258. package/dist/theme/SpectrumThemeProvider.js.map +1 -1
  259. package/dist/theme/ThemeModel.js +1 -0
  260. package/dist/theme/ThemeModel.js.map +1 -1
  261. package/dist/theme/ThemePicker.d.ts.map +1 -1
  262. package/dist/theme/ThemePicker.js +3 -1
  263. package/dist/theme/ThemePicker.js.map +1 -1
  264. package/dist/theme/ThemeProvider.js +1 -3
  265. package/dist/theme/ThemeProvider.js.map +1 -1
  266. package/dist/theme/ThemeUtils.js.map +1 -1
  267. package/dist/theme/colorUtils.js.map +1 -1
  268. package/dist/theme/index.js.map +1 -1
  269. package/dist/theme/theme-dark/index.js.map +1 -1
  270. package/dist/theme/theme-light/index.js.map +1 -1
  271. package/dist/theme/theme-spectrum/index.js.map +1 -1
  272. package/dist/theme/useExternalTheme.js.map +1 -1
  273. package/dist/theme/useSpectrumThemeProvider.js.map +1 -1
  274. package/dist/theme/useTheme.js.map +1 -1
  275. package/dist/transitions/FadeTransition.js.map +1 -1
  276. package/dist/transitions/SlideTransition.js.map +1 -1
  277. package/dist/transitions/index.js.map +1 -1
  278. package/package.json +12 -13
@@ -1 +1 @@
1
- {"version":3,"file":"itemUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/itemUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EAEd,KAAK,YAAY,EAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD;;;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,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AA6B,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,CAenD;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;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,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"}
@@ -20,16 +20,19 @@ export var ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';
20
20
  // Picker uses `icon` slot. ListView can use `image` or `illustration` slots.
21
21
  // https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/picker/src/Picker.tsx#L194
22
22
  // https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L266-L267
23
+
23
24
  /**
24
25
  * Augment the Spectrum selection key type to include boolean values.
25
26
  * Spectrum collection components already supports this, but the built in types
26
27
  * don't reflect it.
27
28
  */
29
+
28
30
  /**
29
31
  * Augment the Spectrum selection change handler type to include boolean keys.
30
32
  * Spectrum components already supports this, but the built in types don't
31
33
  * reflect it.
32
34
  */
35
+
33
36
  /**
34
37
  * Spectrum collection components support a variety of item types, including
35
38
  * strings, numbers, booleans, and more complex React elements. This type
@@ -38,6 +41,7 @@ export var ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';
38
41
  * `KeyedItem` interface to be compatible with Windowed data utils
39
42
  * (e.g. `useViewportData`).
40
43
  */
44
+
41
45
  /**
42
46
  * DH wrappers of Spectrum collection components use a normalized item that
43
47
  * includes a `key` prop and an optional `item` prop. This is mostly to support
@@ -49,7 +53,7 @@ export var ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';
49
53
  */
50
54
  export function getItemKey(item) {
51
55
  var _item$item$key, _item$item;
52
- return (_item$item$key = item === null || item === void 0 ? void 0 : (_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.key) !== null && _item$item$key !== void 0 ? _item$item$key : item === null || item === void 0 ? void 0 : item.key;
56
+ return (_item$item$key = item === null || item === void 0 || (_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.key) !== null && _item$item$key !== void 0 ? _item$item$key : item === null || item === void 0 ? void 0 : item.key;
53
57
  }
54
58
 
55
59
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"itemUtils.js","names":["isElementOfType","ensureArray","Item","Section","Text","ItemContent","ITEM_EMPTY_STRING_TEXT_VALUE","getItemKey","item","_item$item$key","_item$item","key","getItemTextValue","props","textValue","itemKeyStr","undefined","String","includes","children","getPositionOfSelectedItemElement","_x","_getPositionOfSelectedItemElement","apply","arguments","_asyncToGenerator","_ref","items","itemHeight","selectedKey","topOffset","position","i","length","isSectionElement","node","isItemElement","isItemElementWithDescription","childrenArray","result","some","child","_child$props","slot","isNormalizedItemsWithKeysList","Array","isArray","isItemOrSection","isNormalizedSection","maybeNormalizedSection","normalizeTooltipOptions","options","placement","itemSelectionToStringSet","itemKeys","Set","map"],"sources":["../../../src/spectrum/utils/itemUtils.ts"],"sourcesContent":["import { type Key, type ReactElement, type ReactNode } from 'react';\nimport type { ItemRenderer } from '@react-types/shared';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, type KeyedItem, type SelectionT } from '@deephaven/utils';\nimport {\n Item,\n type ItemElementOrPrimitive,\n type ItemProps,\n Section,\n type SectionProps,\n} from '../shared';\nimport { type PopperOptions } from '../../popper';\nimport { Text } from '../Text';\nimport ItemContent from '../ItemContent';\n\n/**\n * `Item.textValue` prop needs to be a non-empty string for accessibility\n * purposes. This is not displayed in the UI.\n */\nexport const ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';\n\n/**\n * React Spectrum <Section> supports an `ItemRenderer` function as a child. The\n * DH picker makes use of this internally, but we don't want to support it as\n * an incoming prop.\n */\ntype SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {\n children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;\n};\n\nexport type ItemElement<T = unknown> = ReactElement<ItemProps<T>>;\nexport type SectionElement<T = unknown> = ReactElement<\n SectionPropsNoItemRenderer<T>\n>;\n\nexport type ItemOrSection<T = unknown> =\n | ItemElementOrPrimitive<T>\n | SectionElement<T>;\n\n// Picker uses `icon` slot. ListView can use `image` or `illustration` slots.\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/picker/src/Picker.tsx#L194\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L266-L267\nexport type ItemIconSlot = 'icon' | 'image' | 'illustration';\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * Spectrum collection components already supports this, but the built in types\n * don't reflect it.\n */\nexport type ItemKey = Key | boolean;\n\nexport type ItemSelection = SelectionT<ItemKey>;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * Spectrum components already supports this, but the built in types don't\n * reflect it.\n */\nexport type ItemSelectionChangeHandler = (key: ItemKey) => void;\n\nexport interface MultipleItemSelectionProps {\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (keys: ItemSelection) => void;\n}\n\nexport interface NormalizedItemData {\n key?: ItemKey;\n content: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n textValue: string | undefined;\n}\n\nexport interface NormalizedSectionData {\n key?: Key;\n title?: ReactNode;\n items: NormalizedItem[];\n}\n\n/**\n * Spectrum collection components support a variety of item types, including\n * strings, numbers, booleans, and more complex React elements. This type\n * represents a normalized form to make rendering items simpler and keep the\n * logic of transformation in separate util methods. It also adheres to the\n * `KeyedItem` interface to be compatible with Windowed data utils\n * (e.g. `useViewportData`).\n */\nexport type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey>;\n\nexport type NormalizedSection = KeyedItem<NormalizedSectionData, Key>;\n\nexport type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> =\n TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * DH wrappers of Spectrum collection components use a normalized item that\n * includes a `key` prop and an optional `item` prop. This is mostly to support\n * Windowed data where items are created before their data has been loaded (data\n * gets set in the `item` prop). If data has loaded, return its `key`. If not,\n * return the top-level `key` on the normalized item.\n * @param item The normalized item or section\n * @returns The `key` of the item or section\n */\nexport function getItemKey<\n TItem extends NormalizedItem | NormalizedSection,\n TKey extends TItem extends NormalizedItem\n ? ItemKey\n : TItem extends NormalizedSection\n ? Key\n : undefined,\n>(item: TItem | null | undefined): TKey {\n return (item?.item?.key ?? item?.key) as TKey;\n}\n\n/**\n * Determine Item `textValue` based on the `textValue` prop or primitive children\n * value.\n * @param item The item to get the text value for\n * @returns The text value of the item\n */\nexport function getItemTextValue<T>(item: ItemElement<T>): string | undefined {\n if (item.props.textValue == null) {\n const itemKeyStr = item.key == null ? undefined : String(item.key);\n return ['string', 'boolean', 'number'].includes(typeof item.props.children)\n ? String(item.props.children)\n : itemKeyStr;\n }\n\n return item.props.textValue === ''\n ? ITEM_EMPTY_STRING_TEXT_VALUE\n : item.props.textValue;\n}\n\n/**\n * Get the position of the item with the given selected key in a list of items.\n * @param items The items to search\n * @param itemHeight The height of each item\n * @param selectedKey The key of the selected item\n * @param topOffset The top offset of the list\n * @returns The position of the selected item or the top offset if not found\n */\nexport async function getPositionOfSelectedItemElement<\n TKey extends string | number | boolean | undefined,\n>({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n}: {\n items: ItemElement[];\n selectedKey: TKey | null | undefined;\n itemHeight: number;\n topOffset: number;\n}): Promise<number> {\n let position = topOffset;\n\n if (selectedKey == null) {\n return position;\n }\n\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (item.key === selectedKey) {\n return position;\n }\n\n position += itemHeight;\n }\n\n return topOffset;\n}\n\n/**\n * Determine if a node is a Section element.\n * @param node The node to check\n * @returns True if the node is a Section element\n */\nexport function isSectionElement<T>(\n node: ReactNode\n): node is SectionElement<T> {\n return isElementOfType(node, Section);\n}\n\n/**\n * Determine if a node is an Item element.\n * @param node The node to check\n * @returns True if the node is an Item element\n */\nexport function isItemElement<T>(node: ReactNode): node is ItemElement<T> {\n return isElementOfType(node, Item);\n}\n\n/**\n * Determine if a node is an Item element containing a child `Text` element with\n * a `slot` prop set to `description`.\n * @param node The node to check\n * @returns True if the node is an Item element with a description\n */\nexport function isItemElementWithDescription<T>(\n node: ReactNode\n): node is ReactElement<ItemProps<T>> {\n if (!isItemElement(node)) {\n return false;\n }\n\n // If children are wrapped in `ItemContent`, go down 1 level\n const children = isElementOfType(node.props.children, ItemContent)\n ? node.props.children.props.children\n : node.props.children;\n\n const childrenArray = ensureArray(children);\n\n const result = childrenArray.some(\n child => isElementOfType(child, Text) && child.props?.slot === 'description'\n );\n\n return result;\n}\n\n/**\n * Determine if a node is an array containing normalized items or sections with\n * keys. Note that this only checks the first node in the array.\n * @param node The node to check\n * @returns True if the node is a normalized item or section with keys array\n */\nexport function isNormalizedItemsWithKeysList<\n TItemOrSection extends ItemOrSection,\n>(\n node:\n | TItemOrSection\n | TItemOrSection[]\n | NormalizedItemOrSection<TItemOrSection>[]\n): node is NormalizedItemOrSection<TItemOrSection>[] {\n if (!Array.isArray(node)) {\n return false;\n }\n\n if (node.length === 0) {\n return true;\n }\n\n return (\n !isItemOrSection(node[0]) &&\n node[0] != null &&\n typeof node[0] === 'object' &&\n 'key' in node[0]\n );\n}\n\n/**\n * Determine if an object is a normalized section.\n * @param maybeNormalizedSection The object to check\n * @returns True if the object is a normalized section\n */\nexport function isNormalizedSection(\n maybeNormalizedSection: NormalizedItem | NormalizedSection\n): maybeNormalizedSection is NormalizedSection {\n return (\n maybeNormalizedSection.item != null &&\n 'items' in maybeNormalizedSection.item\n );\n}\n\n/**\n * Determine if a node is an item or section. Valid types include strings,\n * numbers, booleans, Item elements, and Section elements.\n * @param node The node to check\n * @returns True if the node is an item or section\n */\nexport function isItemOrSection(node: ReactNode): node is ItemOrSection {\n return (\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean' ||\n isItemElement(node) ||\n isSectionElement(node)\n );\n}\n\n/**\n * Returns a TooltipOptions object or null if options is false or null.\n * @param options Tooltip options\n * @param placement Default placement for the tooltip if `options` is set\n * explicitly to `true`\n * @returns TooltipOptions or null\n */\nexport function normalizeTooltipOptions(\n options?: boolean | TooltipOptions | null,\n placement: TooltipOptions['placement'] = 'right'\n): TooltipOptions | null {\n if (options == null || options === false) {\n return null;\n }\n\n if (options === true) {\n return { placement };\n }\n\n return options;\n}\n\n/**\n * Convert a selection of `ItemKey`s to a selection of strings.\n * @param itemKeys The selection of `ItemKey`s\n * @returns The selection of strings\n */\nexport function itemSelectionToStringSet<\n TKeys extends 'all' | Iterable<ItemKey> | undefined,\n TResult extends TKeys extends 'all'\n ? 'all'\n : TKeys extends Iterable<ItemKey>\n ? Set<string>\n : undefined,\n>(itemKeys: TKeys): TResult {\n if (itemKeys == null || itemKeys === 'all') {\n return itemKeys as undefined | 'all' as TResult;\n }\n\n return new Set([...itemKeys].map(String)) as TResult;\n}\n"],"mappings":";;AAEA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,QAAyC,kBAAkB;AAAC,SAE9EC,IAAI,EAGJC,OAAO;AAAA,SAIAC,IAAI;AAAA,OACNC,WAAW;AAElB;AACA;AACA;AACA;AACA,OAAO,IAAMC,4BAA4B,GAAG,OAAO;;AAEnD;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAOxBC,IAA8B,EAAQ;EAAA,IAAAC,cAAA,EAAAC,UAAA;EACtC,QAAAD,cAAA,GAAQD,IAAI,aAAJA,IAAI,wBAAAE,UAAA,GAAJF,IAAI,CAAEA,IAAI,cAAAE,UAAA,uBAAVA,UAAA,CAAYC,GAAG,cAAAF,cAAA,cAAAA,cAAA,GAAID,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,GAAG;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAIJ,IAAoB,EAAsB;EAC5E,IAAIA,IAAI,CAACK,KAAK,CAACC,SAAS,IAAI,IAAI,EAAE;IAChC,IAAMC,UAAU,GAAGP,IAAI,CAACG,GAAG,IAAI,IAAI,GAAGK,SAAS,GAAGC,MAAM,CAACT,IAAI,CAACG,GAAG,CAAC;IAClE,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAACO,QAAQ,CAAC,OAAOV,IAAI,CAACK,KA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IAAI,IAAI,IAAI,IACnC,OAAO,IAAIyC,sBAAsB,CAACzC,IAAI;AAE1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASuC,eAAeA,CAACZ,IAAe,EAAyB;EACtE,OACE,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,SAAS,IACzBC,aAAa,CAACD,IAAI,CAAC,IACnBD,gBAAgB,CAACC,IAAI,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASe,uBAAuBA,CACrCC,OAAyC,EAElB;EAAA,IADvBC,SAAsC,GAAA5B,SAAA,CAAAS,MAAA,QAAAT,SAAA,QAAAR,SAAA,GAAAQ,SAAA,MAAG,OAAO;EAEhD,IAAI2B,OAAO,IAAI,IAAI,IAAIA,OAAO,KAAK,KAAK,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,IAAIA,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO;MAAEC;IAAU,CAAC;EACtB;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,wBAAwBA,CAOtCC,QAAe,EAAW;EAC1B,IAAIA,QAAQ,IAAI,IAAI,IAAIA,QAAQ,KAAK,KAAK,EAAE;IAC1C,OAAOA,QAAQ;EACjB;EAEA,OAAO,IAAIC,GAAG,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAACE,GAAG,CAACvC,MAAM,CAAC,CAAC;AAC3C"}
1
+ {"version":3,"file":"itemUtils.js","names":["isElementOfType","ensureArray","Item","Section","Text","ItemContent","ITEM_EMPTY_STRING_TEXT_VALUE","getItemKey","item","_item$item$key","_item$item","key","getItemTextValue","props","textValue","itemKeyStr","undefined","String","includes","children","getPositionOfSelectedItemElement","_x","_getPositionOfSelectedItemElement","apply","arguments","_asyncToGenerator","_ref","items","itemHeight","selectedKey","topOffset","position","i","length","isSectionElement","node","isItemElement","isItemElementWithDescription","childrenArray","result","some","child","_child$props","slot","isNormalizedItemsWithKeysList","Array","isArray","isItemOrSection","isNormalizedSection","maybeNormalizedSection","normalizeTooltipOptions","options","placement","itemSelectionToStringSet","itemKeys","Set","map"],"sources":["../../../src/spectrum/utils/itemUtils.ts"],"sourcesContent":["import { type ReactElement, type ReactNode } from 'react';\nimport type { ItemRenderer, Key } from '@react-types/shared';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, type KeyedItem, type SelectionT } from '@deephaven/utils';\nimport {\n Item,\n type ItemElementOrPrimitive,\n type ItemProps,\n Section,\n type SectionProps,\n} from '../shared';\nimport { type PopperOptions } from '../../popper';\nimport { Text } from '../Text';\nimport ItemContent from '../ItemContent';\n\n/**\n * `Item.textValue` prop needs to be a non-empty string for accessibility\n * purposes. This is not displayed in the UI.\n */\nexport const ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';\n\n/**\n * React Spectrum <Section> supports an `ItemRenderer` function as a child. The\n * DH picker makes use of this internally, but we don't want to support it as\n * an incoming prop.\n */\ntype SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {\n children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;\n};\n\nexport type ItemElement<T = unknown> = ReactElement<ItemProps<T>>;\nexport type SectionElement<T = unknown> = ReactElement<\n SectionPropsNoItemRenderer<T>\n>;\n\nexport type ItemOrSection<T = unknown> =\n | ItemElementOrPrimitive<T>\n | SectionElement<T>;\n\n// Picker uses `icon` slot. ListView can use `image` or `illustration` slots.\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/picker/src/Picker.tsx#L194\n// https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/src/ListViewItem.tsx#L266-L267\nexport type ItemIconSlot = 'icon' | 'image' | 'illustration';\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * Spectrum collection components already supports this, but the built in types\n * don't reflect it.\n */\nexport type ItemKey = Key | boolean;\n\nexport type ItemSelection = SelectionT<ItemKey>;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * Spectrum components already supports this, but the built in types don't\n * reflect it.\n */\nexport type ItemSelectionChangeHandler = (key: ItemKey) => void;\n\nexport interface MultipleItemSelectionProps {\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (keys: ItemSelection) => void;\n}\n\nexport interface NormalizedItemData {\n key?: ItemKey;\n content: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n textValue: string | undefined;\n}\n\nexport interface NormalizedSectionData {\n key?: Key;\n title?: ReactNode;\n items: NormalizedItem[];\n}\n\n/**\n * Spectrum collection components support a variety of item types, including\n * strings, numbers, booleans, and more complex React elements. This type\n * represents a normalized form to make rendering items simpler and keep the\n * logic of transformation in separate util methods. It also adheres to the\n * `KeyedItem` interface to be compatible with Windowed data utils\n * (e.g. `useViewportData`).\n */\nexport type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey>;\n\nexport type NormalizedSection = KeyedItem<NormalizedSectionData, Key>;\n\nexport type NormalizedItemOrSection<TItemOrSection extends ItemOrSection> =\n TItemOrSection extends SectionElement ? NormalizedSection : NormalizedItem;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * DH wrappers of Spectrum collection components use a normalized item that\n * includes a `key` prop and an optional `item` prop. This is mostly to support\n * Windowed data where items are created before their data has been loaded (data\n * gets set in the `item` prop). If data has loaded, return its `key`. If not,\n * return the top-level `key` on the normalized item.\n * @param item The normalized item or section\n * @returns The `key` of the item or section\n */\nexport function getItemKey<\n TItem extends NormalizedItem | NormalizedSection,\n TKey extends TItem extends NormalizedItem\n ? ItemKey\n : TItem extends NormalizedSection\n ? Key\n : undefined,\n>(item: TItem | null | undefined): TKey {\n return (item?.item?.key ?? item?.key) as TKey;\n}\n\n/**\n * Determine Item `textValue` based on the `textValue` prop or primitive children\n * value.\n * @param item The item to get the text value for\n * @returns The text value of the item\n */\nexport function getItemTextValue<T>(item: ItemElement<T>): string | undefined {\n if (item.props.textValue == null) {\n const itemKeyStr = item.key == null ? undefined : String(item.key);\n return ['string', 'boolean', 'number'].includes(typeof item.props.children)\n ? String(item.props.children)\n : itemKeyStr;\n }\n\n return item.props.textValue === ''\n ? ITEM_EMPTY_STRING_TEXT_VALUE\n : item.props.textValue;\n}\n\n/**\n * Get the position of the item with the given selected key in a list of items.\n * @param items The items to search\n * @param itemHeight The height of each item\n * @param selectedKey The key of the selected item\n * @param topOffset The top offset of the list\n * @returns The position of the selected item or the top offset if not found\n */\nexport async function getPositionOfSelectedItemElement<\n TKey extends string | number | boolean | undefined,\n>({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n}: {\n items: ItemElement[];\n selectedKey: TKey | null | undefined;\n itemHeight: number;\n topOffset: number;\n}): Promise<number> {\n let position = topOffset;\n\n if (selectedKey == null) {\n return position;\n }\n\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (item.key === selectedKey) {\n return position;\n }\n\n position += itemHeight;\n }\n\n return topOffset;\n}\n\n/**\n * Determine if a node is a Section element.\n * @param node The node to check\n * @returns True if the node is a Section element\n */\nexport function isSectionElement<T>(\n node: ReactNode\n): node is SectionElement<T> {\n return isElementOfType(node, Section);\n}\n\n/**\n * Determine if a node is an Item element.\n * @param node The node to check\n * @returns True if the node is an Item element\n */\nexport function isItemElement<T>(node: ReactNode): node is ItemElement<T> {\n return isElementOfType(node, Item);\n}\n\n/**\n * Determine if a node is an Item element containing a child `Text` element with\n * a `slot` prop set to `description`.\n * @param node The node to check\n * @returns True if the node is an Item element with a description\n */\nexport function isItemElementWithDescription<T>(\n node: ReactNode\n): node is ReactElement<ItemProps<T>> {\n if (!isItemElement(node)) {\n return false;\n }\n\n // If children are wrapped in `ItemContent`, go down 1 level\n const children = isElementOfType(node.props.children, ItemContent)\n ? node.props.children.props.children\n : node.props.children;\n\n const childrenArray = ensureArray(children);\n\n const result = childrenArray.some(\n child => isElementOfType(child, Text) && child.props?.slot === 'description'\n );\n\n return result;\n}\n\n/**\n * Determine if a node is an array containing normalized items or sections with\n * keys. Note that this only checks the first node in the array.\n * @param node The node to check\n * @returns True if the node is a normalized item or section with keys array\n */\nexport function isNormalizedItemsWithKeysList<\n TItemOrSection extends ItemOrSection,\n>(\n node:\n | TItemOrSection\n | TItemOrSection[]\n | NormalizedItemOrSection<TItemOrSection>[]\n): node is NormalizedItemOrSection<TItemOrSection>[] {\n if (!Array.isArray(node)) {\n return false;\n }\n\n if (node.length === 0) {\n return true;\n }\n\n return (\n !isItemOrSection(node[0] as ReactNode) &&\n node[0] != null &&\n typeof node[0] === 'object' &&\n 'key' in node[0]\n );\n}\n\n/**\n * Determine if an object is a normalized section.\n * @param maybeNormalizedSection The object to check\n * @returns True if the object is a normalized section\n */\nexport function isNormalizedSection(\n maybeNormalizedSection: NormalizedItem | NormalizedSection\n): maybeNormalizedSection is NormalizedSection {\n return (\n maybeNormalizedSection.item != null &&\n 'items' in maybeNormalizedSection.item\n );\n}\n\n/**\n * Determine if a node is an item or section. Valid types include strings,\n * numbers, booleans, Item elements, and Section elements.\n * @param node The node to check\n * @returns True if the node is an item or section\n */\nexport function isItemOrSection(node: ReactNode): node is ItemOrSection {\n return (\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean' ||\n isItemElement(node) ||\n isSectionElement(node)\n );\n}\n\n/**\n * Returns a TooltipOptions object or null if options is false or null.\n * @param options Tooltip options\n * @param placement Default placement for the tooltip if `options` is set\n * explicitly to `true`\n * @returns TooltipOptions or null\n */\nexport function normalizeTooltipOptions(\n options?: boolean | TooltipOptions | null,\n placement: TooltipOptions['placement'] = 'right'\n): TooltipOptions | null {\n if (options == null || options === false) {\n return null;\n }\n\n if (options === true) {\n return { placement };\n }\n\n return options;\n}\n\n/**\n * Convert a selection of `ItemKey`s to a selection of strings.\n * @param itemKeys The selection of `ItemKey`s\n * @returns The selection of strings\n */\nexport function itemSelectionToStringSet<\n TKeys extends 'all' | Iterable<ItemKey> | undefined,\n TResult extends TKeys extends 'all'\n ? 'all'\n : TKeys extends Iterable<ItemKey>\n ? Set<string>\n : undefined,\n>(itemKeys: TKeys): TResult {\n if (itemKeys == null || itemKeys === 'all') {\n return itemKeys as undefined | 'all' as TResult;\n }\n\n return new Set([...itemKeys].map(String)) as TResult;\n}\n"],"mappings":";;AAEA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,QAAyC,kBAAkB;AAAC,SAE9EC,IAAI,EAGJC,OAAO;AAAA,SAIAC,IAAI;AAAA,OACNC,WAAW;AAElB;AACA;AACA;AACA;AACA,OAAO,IAAMC,4BAA4B,GAAG,OAAO;;AAEnD;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAOxBC,IAA8B,EAAQ;EAAA,IAAAC,cAAA,EAAAC,UAAA;EACtC,QAAAD,cAAA,GAAQD,IAAI,aAAJA,IAAI,gBAAAE,UAAA,GAAJF,IAAI,CAAEA,IAAI,cAAAE,UAAA,uBAAVA,UAAA,CAAYC,GAAG,cAAAF,cAAA,cAAAA,cAAA,GAAID,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,GAAG;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAIJ,IAAoB,EAAsB;EAC5E,IAAIA,IAAI,CAACK,KAAK,CAACC,SAAS,IAA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23
23
  */
24
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
25
  export function wrapIcon(maybeIconKey, slot) {
26
- var _maybeIconKey, _dhIcons$maybeIconKey;
26
+ var _dhIcons$maybeIconKey;
27
27
  // eslint-disable-next-line no-param-reassign
28
- maybeIconKey = (_maybeIconKey = maybeIconKey) !== null && _maybeIconKey !== void 0 ? _maybeIconKey : '';
28
+ maybeIconKey = maybeIconKey !== null && maybeIconKey !== void 0 ? maybeIconKey : '';
29
29
  if (typeof maybeIconKey !== 'string') {
30
30
  return maybeIconKey;
31
31
  }
@@ -97,9 +97,8 @@ export function wrapItemChildren(itemsOrSections, tooltipOptions) {
97
97
  * @returns The wrapped content or original content if not a primitive type
98
98
  */
99
99
  export function wrapPrimitiveWithText(content, slot) {
100
- var _content;
101
100
  // eslint-disable-next-line no-param-reassign
102
- content = (_content = content) !== null && _content !== void 0 ? _content : '';
101
+ content = content !== null && content !== void 0 ? content : '';
103
102
  if (['string', 'boolean', 'number'].includes(typeof content)) {
104
103
  return /*#__PURE__*/_jsx(Text, {
105
104
  slot: slot,
@@ -1 +1 @@
1
- {"version":3,"file":"itemWrapperUtils.js","names":["cloneElement","Item","FontAwesomeIcon","dh","dhIcons","isElementOfType","ensureArray","NON_BREAKING_SPACE","getItemTextValue","isItemElement","isSectionElement","ITEM_EMPTY_STRING_TEXT_VALUE","ItemContent","Icon","Text","jsx","_jsx","wrapIcon","maybeIconKey","slot","_maybeIconKey","_dhIcons$maybeIconKey","children","icon","vsBlank","wrapItemChildren","itemsOrSections","tooltipOptions","itemsOrSectionsArray","result","map","item","_item$key","props","key","textValue","_objectSpread","_item$key2","title","undefined","text","String","Array","isArray","wrapPrimitiveWithText","content","_content","includes"],"sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"sourcesContent":["import { cloneElement, type ReactNode } from 'react';\nimport { Item } from '@adobe/react-spectrum';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { dh as dhIcons } from '@deephaven/icons';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, NON_BREAKING_SPACE } from '@deephaven/utils';\nimport {\n getItemTextValue,\n isItemElement,\n isSectionElement,\n type ItemElement,\n type ItemIconSlot,\n type ItemOrSection,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n type SectionElement,\n type TooltipOptions,\n} from './itemUtils';\nimport { ItemContent } from '../ItemContent';\nimport { Icon } from '../icons';\nimport { Text } from '../Text';\n\n/**\n * If the given content is a string, wrap it in an Icon component. Otherwise,\n * return the original content. If the key is not found in the dhIcons object,\n * the vsBlank icon will be used.\n * @param maybeIconKey The content to wrap\n * @param slot The slot to use for the Icon component\n * @returns The wrapped content or original content if not a string\n */\nexport function wrapIcon(\n maybeIconKey: ReactNode,\n slot: ItemIconSlot\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n maybeIconKey = maybeIconKey ?? '';\n\n if (typeof maybeIconKey !== 'string') {\n return maybeIconKey;\n }\n\n return (\n <Icon slot={slot}>\n <FontAwesomeIcon icon={dhIcons[maybeIconKey] ?? dhIcons.vsBlank} />\n </Icon>\n );\n}\n\n/**\n * Ensure all primitive children are wrapped in `Item` elements and that all\n * `Item` element content is wrapped in `ItemContent` elements to handle text\n * overflow consistently and to support tooltips.\n * @param itemsOrSections The items or sections to wrap\n * @param tooltipOptions The tooltip options to use when wrapping items\n * @returns The wrapped items or sections\n */\nexport function wrapItemChildren<T>(\n itemsOrSections: ItemOrSection<T> | ItemOrSection<T>[],\n tooltipOptions: TooltipOptions | null\n): ItemElement<T> | SectionElement<T> | (ItemElement<T> | SectionElement<T>)[] {\n const itemsOrSectionsArray = ensureArray(itemsOrSections);\n\n const result = itemsOrSectionsArray.map(item => {\n if (isItemElement(item)) {\n // Item content is already wrapped\n if (isElementOfType(item.props.children, ItemContent)) {\n return item;\n }\n\n const key = item.key ?? item.props.textValue;\n const textValue = getItemTextValue(item);\n\n // Wrap in `ItemContent` so we can support tooltips and handle text\n // overflow\n return cloneElement(item, {\n ...item.props,\n key,\n textValue,\n children: (\n <ItemContent tooltipOptions={tooltipOptions}>\n {item.props.children}\n </ItemContent>\n ),\n });\n }\n\n if (isSectionElement(item)) {\n return cloneElement(item, {\n ...item.props,\n key:\n item.key ??\n (typeof item.props.title === 'string' ? item.props.title : undefined),\n children: wrapItemChildren<T>(item.props.children, tooltipOptions),\n });\n }\n\n const text = String(item);\n const textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;\n\n return (\n <Item key={text} textValue={textValue}>\n <ItemContent tooltipOptions={tooltipOptions}>{text}</ItemContent>\n </Item>\n );\n });\n\n // Keep consistent with original data structure as array or single node\n return Array.isArray(itemsOrSections) ? result : result[0];\n}\n\n/**\n * If the given content is a primitive type, wrap it in a Text component.\n * @param content The content to wrap\n * @param slot The slot to use for the Text component\n * @returns The wrapped content or original content if not a primitive type\n */\nexport function wrapPrimitiveWithText(\n content?: ReactNode,\n slot?: string\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n content = content ?? '';\n\n if (['string', 'boolean', 'number'].includes(typeof content)) {\n return (\n <Text slot={slot}>\n {/* Non-breaking space is needed to avoid the Text element's height \n collapsing when content is empty */}\n {content === '' ? NON_BREAKING_SPACE : String(content)}\n </Text>\n );\n }\n\n return content;\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,QAAwB,OAAO;AACpD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,EAAE,IAAIC,OAAO,QAAQ,kBAAkB;AAChD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,kBAAkB;AAAC,SAEjEC,gBAAgB,EAChBC,aAAa,EACbC,gBAAgB,EAIhBC,4BAA4B;AAAA,SAIrBC,WAAW;AAAA,SACXC,IAAI;AAAA,SACJC,IAAI;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,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AQ,CAAC,CAACC,QAAQ,CAAC,OAAOF,OAAO,CAAC,EAAE;IAC5D,oBACE7B,IAAA,CAACF,IAAI;MAACK,IAAI,EAAEA,IAAK;MAAAG,QAAA,EAGduB,OAAO,KAAK,EAAE,GAAGtC,kBAAkB,GAAGkC,MAAM,CAACI,OAAO;IAAC,CAClD,CAAC;EAEX;EAEA,OAAOA,OAAO;AAChB"}
1
+ {"version":3,"file":"itemWrapperUtils.js","names":["cloneElement","Item","FontAwesomeIcon","dh","dhIcons","isElementOfType","ensureArray","NON_BREAKING_SPACE","getItemTextValue","isItemElement","isSectionElement","ITEM_EMPTY_STRING_TEXT_VALUE","ItemContent","Icon","Text","jsx","_jsx","wrapIcon","maybeIconKey","slot","_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","includes"],"sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"sourcesContent":["import { cloneElement, type ReactNode } from 'react';\nimport { Item } from '@adobe/react-spectrum';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { dh as dhIcons } from '@deephaven/icons';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, NON_BREAKING_SPACE } from '@deephaven/utils';\nimport {\n getItemTextValue,\n isItemElement,\n isSectionElement,\n type ItemElement,\n type ItemIconSlot,\n type ItemOrSection,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n type SectionElement,\n type TooltipOptions,\n} from './itemUtils';\nimport { ItemContent } from '../ItemContent';\nimport { Icon } from '../icons';\nimport { Text } from '../Text';\n\n/**\n * If the given content is a string, wrap it in an Icon component. Otherwise,\n * return the original content. If the key is not found in the dhIcons object,\n * the vsBlank icon will be used.\n * @param maybeIconKey The content to wrap\n * @param slot The slot to use for the Icon component\n * @returns The wrapped content or original content if not a string\n */\nexport function wrapIcon(\n maybeIconKey: ReactNode,\n slot: ItemIconSlot\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n maybeIconKey = maybeIconKey ?? '';\n\n if (typeof maybeIconKey !== 'string') {\n return maybeIconKey;\n }\n\n return (\n <Icon slot={slot}>\n <FontAwesomeIcon icon={dhIcons[maybeIconKey] ?? dhIcons.vsBlank} />\n </Icon>\n );\n}\n\n/**\n * Ensure all primitive children are wrapped in `Item` elements and that all\n * `Item` element content is wrapped in `ItemContent` elements to handle text\n * overflow consistently and to support tooltips.\n * @param itemsOrSections The items or sections to wrap\n * @param tooltipOptions The tooltip options to use when wrapping items\n * @returns The wrapped items or sections\n */\nexport function wrapItemChildren<T>(\n itemsOrSections: ItemOrSection<T> | ItemOrSection<T>[],\n tooltipOptions: TooltipOptions | null\n): ItemElement<T> | SectionElement<T> | (ItemElement<T> | SectionElement<T>)[] {\n const itemsOrSectionsArray = ensureArray(itemsOrSections);\n\n const result = itemsOrSectionsArray.map(item => {\n if (isItemElement(item)) {\n // Item content is already wrapped\n if (isElementOfType(item.props.children, ItemContent)) {\n return item;\n }\n\n const key = item.key ?? item.props.textValue;\n const textValue = getItemTextValue(item);\n\n // Wrap in `ItemContent` so we can support tooltips and handle text\n // overflow\n return cloneElement(item, {\n ...item.props,\n key,\n textValue,\n children: (\n <ItemContent tooltipOptions={tooltipOptions}>\n {item.props.children}\n </ItemContent>\n ),\n });\n }\n\n if (isSectionElement(item)) {\n return cloneElement(item, {\n ...item.props,\n key:\n item.key ??\n (typeof item.props.title === 'string' ? item.props.title : undefined),\n children: wrapItemChildren<T>(item.props.children, tooltipOptions),\n });\n }\n\n const text = String(item);\n const textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;\n\n return (\n <Item key={text} textValue={textValue}>\n <ItemContent tooltipOptions={tooltipOptions}>{text}</ItemContent>\n </Item>\n );\n });\n\n // Keep consistent with original data structure as array or single node\n return Array.isArray(itemsOrSections) ? result : result[0];\n}\n\n/**\n * If the given content is a primitive type, wrap it in a Text component.\n * @param content The content to wrap\n * @param slot The slot to use for the Text component\n * @returns The wrapped content or original content if not a primitive type\n */\nexport function wrapPrimitiveWithText(\n content?: ReactNode,\n slot?: string\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n content = content ?? '';\n\n if (['string', 'boolean', 'number'].includes(typeof content)) {\n return (\n <Text slot={slot}>\n {/* Non-breaking space is needed to avoid the Text element's height \n collapsing when content is empty */}\n {content === '' ? NON_BREAKING_SPACE : String(content)}\n </Text>\n );\n }\n\n return content;\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,QAAwB,OAAO;AACpD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,EAAE,IAAIC,OAAO,QAAQ,kBAAkB;AAChD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,kBAAkB;AAAC,SAEjEC,gBAAgB,EAChBC,aAAa,EACbC,gBAAgB,EAIhBC,4BAA4B;AAAA,SAIrBC,WAAW;AAAA,SACXC,IAAI;AAAA,SACJC,IAAI;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,OAAO,SAASC,QAAQA,CACtBC,YAAuB,EACvBC,IAAkB,EACP;EAAA,IAAAC,qBAAA;EACX;EACAF,YAAY,GAAGA,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,EAAE;EAEjC,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;IACpC,OAAOA,YAAY;EACrB;EAEA,oBACEF,IAAA,CAACH,IAAI;IAACM,IAAI,EAAEA,IAAK;IAAAE,QAAA,eACfL,IAAA,CAACd,eAAe;MAACoB,IAAI,GAAAF,qBAAA,GAAEhB,OAAO,CAACc,YAAY,CAAC,cAAAE,qBAAA,cAAAA,qBAAA,GAAIhB,OAAO,CAACmB;IAAQ,CAAE;EAAC,CAC/D,CAAC;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CAAIM,IAAI,CAACE,KAAK,CAACX,QAAQ,EAAEK,cAAc;MAAC,EACnE,CAAC;IACJ;IAEA,IAAMa,IAAI,GAAGC,MAAM,CAACV,IAAI,CAAC;IACzB,IAAMI,SAAS,GAAGK,IAAI,KAAK,EAAE,GAAG5B,4BAA4B,GAAG4B,IAAI;IAEnE,oBACEvB,IAAA,CAACf,IAAI;MAAYiC,SAAS,EAAEA,SAAU;MAAAb,QAAA,eACpCL,IAAA,CAACJ,WAAW;QAACc,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,EACnBzB,IAAa,EACF;EACX;EACAyB,OAAO,GAAGA,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE;EAEvB,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAAC,OAAOD,OAAO,CAAC,EAAE;IAC5D,oBACE5B,IAAA,CAACF,IAAI;MAACK,IAAI,EAAEA,IAAK;MAAAE,QAAA,EAGduB,OAAO,KAAK,EAAE,GAAGrC,kBAAkB,GAAGiC,MAAM,CAACI,OAAO;IAAC,CAClD,CAAC;EAEX;EAEA,OAAOA,OAAO;AAChB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"propsUtils.js","names":["separateSpectrumProps","props","ariaLabel","ariaLabelledby","ariaDescribedby","ariaHidden","marginX","marginY","width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","justifySelf","alignSelf","order","gridArea","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","position","zIndex","top","bottom","start","end","left","right","isHidden","componentProps","_objectWithoutProperties","_excluded","ariaLabelProps","styleProps"],"sources":["../../../src/spectrum/utils/propsUtils.ts"],"sourcesContent":["import type { AriaLabelingProps, StyleProps } from '@react-types/shared';\n\n/**\n * Separate props for Spectrum components into AriaLabelingProps, StyleProps, and\n * any remaining props.\n * @param props The props to separate\n * @returns The separated props\n */\nexport function separateSpectrumProps<T extends AriaLabelingProps & StyleProps>(\n props: T\n): {\n ariaLabelProps: AriaLabelingProps;\n styleProps: StyleProps;\n componentProps: Omit<T, keyof (AriaLabelingProps & StyleProps)>;\n} {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n ...componentProps\n } = props;\n\n return {\n ariaLabelProps: {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n },\n styleProps: {\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n },\n componentProps: componentProps as Omit<\n T,\n keyof (AriaLabelingProps & StyleProps)\n >,\n };\n}\n\nexport default separateSpectrumProps;\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAA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file":"propsUtils.js","names":["separateSpectrumProps","props","ariaLabel","ariaLabelledby","ariaDescribedby","ariaHidden","marginX","marginY","width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","justifySelf","alignSelf","order","gridArea","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","position","zIndex","top","bottom","start","end","left","right","isHidden","componentProps","_objectWithoutProperties","_excluded","ariaLabelProps","styleProps"],"sources":["../../../src/spectrum/utils/propsUtils.ts"],"sourcesContent":["import type { AriaLabelingProps, StyleProps } from '@react-types/shared';\n\n/**\n * Separate props for Spectrum components into AriaLabelingProps, StyleProps, and\n * any remaining props.\n * @param props The props to separate\n * @returns The separated props\n */\nexport function separateSpectrumProps<T extends AriaLabelingProps & StyleProps>(\n props: T\n): {\n ariaLabelProps: AriaLabelingProps;\n styleProps: StyleProps;\n componentProps: Omit<T, keyof (AriaLabelingProps & StyleProps)>;\n} {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n ...componentProps\n } = props;\n\n return {\n ariaLabelProps: {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n },\n styleProps: {\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n },\n componentProps: componentProps as Omit<\n T,\n keyof (AriaLabelingProps & StyleProps)\n >,\n };\n}\n\nexport default separateSpectrumProps;\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAqBA,CACnCC,KAAQ,EAKR;EACA,IAAM;MACJ,YAAY,EAAEC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC,eAAe;MACnC,cAAc,EAAEC,UAAU;MAE1BC,OAAO;MACPC,OAAO;MACPC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC,SAAS;MACTC,QAAQ;MACRC,SAAS;MACTC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,UAAU;MACVC,OAAO;MACPC,eAAe;MACfC,aAAa;MACbC,YAAY;MACZC,UAAU;MACVC,QAAQ;MACRC,MAAM;MACNC,GAAG;MACHC,MAAM;MACNC,KAAK;MACLC,GAAG;MACHC,IAAI;MACJC,KAAK;MACLC;IAEF,CAAC,GAAGnC,KAAK;IADJoC,cAAc,GAAAC,wBAAA,CACfrC,KAAK,EAAAsC,SAAA;EAET,OAAO;IACLC,cAAc,EAAE;MACd,YAAY,EAAEtC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC,eAAe;MACnC,cAAc,EAAEC;IAClB,CAAC;IACDoC,UAAU,EAAE;MACVnC,OAAO;MACPC,OAAO;MACPC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC,SAAS;MACTC,QAAQ;MACRC,SAAS;MACTC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,UAAU;MACVC,OAAO;MACPC,eAAe;MACfC,aAAa;MACbC,YAAY;MACZC,UAAU;MACVC,QAAQ;MACRC,MAAM;MACNC,GAAG;MACHC,MAAM;MACNC,KAAK;MACLC,GAAG;MACHC,IAAI;MACJC,KAAK;MACLC;IACF,CAAC;IACDC,cAAc,EAAEA;EAIlB,CAAC;AACH;AAEA,eAAerC,qBAAqB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"themeUtils.js","names":["theme","themeSpectrumClassesCommon","useStyleProps","baseStyleProps","viewStyleProps","global","light","dark","medium","large","themeDHDefault","_objectSpread"],"sources":["../../../src/spectrum/utils/themeUtils.ts"],"sourcesContent":["import { theme } from '@react-spectrum/theme-default';\nimport { themeSpectrumClassesCommon } from '../../theme/theme-spectrum';\n\nexport {\n useStyleProps,\n baseStyleProps,\n viewStyleProps,\n} from '@react-spectrum/utils';\n\nconst { global, light, dark, medium, large } = theme;\n\n/**\n * Extend light + dark theme variables with DH defaults.\n *\n * A theme is just a mapped collection of css class names that are generated\n * from a collection of css modules.\n *\n * e.g.\n * {\n * global: {\n * spectrum: 'spectrum_9e130c',\n * 'spectrum--medium': 'spectrum--medium_9e130c',\n * 'spectrum--large': 'spectrum--large_9e130c',\n * 'spectrum--darkest': 'spectrum--darkest_9e130c',\n * 'spectrum--dark': 'spectrum--dark_9e130c',\n * 'spectrum--light': 'spectrum--light_9e130c',\n * 'spectrum--lightest': 'spectrum--lightest_9e130c',\n * },\n * light: {\n * 'spectrum--light': 'spectrum--light_a40724',\n * 'dh-spectrum-theme--light': '_dh-spectrum-theme--light_1hblg_22',\n * },\n * dark: {\n * 'spectrum--darkest': 'spectrum--darkest_256eeb',\n * 'dh-spectrum-theme--dark': '_dh-spectrum-theme--dark_f7kge_22',\n * },\n * medium: {\n * 'spectrum--medium': 'spectrum--medium_4b172c',\n * },\n * large: {\n * 'spectrum--large': 'spectrum--large_c40598',\n * },\n * }\n */\n/* eslint-disable import/prefer-default-export */\nexport const themeDHDefault = {\n global,\n light: {\n ...light,\n ...themeSpectrumClassesCommon,\n },\n dark: {\n ...dark,\n ...themeSpectrumClassesCommon,\n },\n // scales\n medium,\n large,\n};\n"],"mappings":";;;;;AAAA,SAASA,KAAK,QAAQ,+BAA+B;AAAC,SAC7CC,0BAA0B;AAEnC,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,QACT,uBAAuB;AAE9B,IAAM;EAAEC,MAAM;EAAEC,KAAK;EAAEC,IAAI;EAAEC,MAAM;EAAEC;AAAM,CAAC,GAAGT,KAAK;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMU,cAAc,GAAG;EAC5BL,MAAM;EACNC,KAAK,EAAAK,aAAA,CAAAA,aAAA,KACAL,KAAK,GACLL,0BAA0B,CAC9B;EACDM,IAAI,EAAAI,aAAA,CAAAA,aAAA,KACCJ,IAAI,GACJN,0BAA0B,CAC9B;EACD;EACAO,MAAM;EACNC;AACF,CAAC"}
1
+ {"version":3,"file":"themeUtils.js","names":["theme","themeSpectrumClassesCommon","useStyleProps","baseStyleProps","viewStyleProps","global","light","dark","medium","large","themeDHDefault","_objectSpread"],"sources":["../../../src/spectrum/utils/themeUtils.ts"],"sourcesContent":["import { theme } from '@react-spectrum/theme-default';\nimport { themeSpectrumClassesCommon } from '../../theme/theme-spectrum';\n\nexport {\n useStyleProps,\n baseStyleProps,\n viewStyleProps,\n} from '@react-spectrum/utils';\n\nconst { global, light, dark, medium, large } = theme;\n\n/**\n * Extend light + dark theme variables with DH defaults.\n *\n * A theme is just a mapped collection of css class names that are generated\n * from a collection of css modules.\n *\n * e.g.\n * {\n * global: {\n * spectrum: 'spectrum_9e130c',\n * 'spectrum--medium': 'spectrum--medium_9e130c',\n * 'spectrum--large': 'spectrum--large_9e130c',\n * 'spectrum--darkest': 'spectrum--darkest_9e130c',\n * 'spectrum--dark': 'spectrum--dark_9e130c',\n * 'spectrum--light': 'spectrum--light_9e130c',\n * 'spectrum--lightest': 'spectrum--lightest_9e130c',\n * },\n * light: {\n * 'spectrum--light': 'spectrum--light_a40724',\n * 'dh-spectrum-theme--light': '_dh-spectrum-theme--light_1hblg_22',\n * },\n * dark: {\n * 'spectrum--darkest': 'spectrum--darkest_256eeb',\n * 'dh-spectrum-theme--dark': '_dh-spectrum-theme--dark_f7kge_22',\n * },\n * medium: {\n * 'spectrum--medium': 'spectrum--medium_4b172c',\n * },\n * large: {\n * 'spectrum--large': 'spectrum--large_c40598',\n * },\n * }\n */\n/* eslint-disable import/prefer-default-export */\nexport const themeDHDefault = {\n global,\n light: {\n ...light,\n ...themeSpectrumClassesCommon,\n },\n dark: {\n ...dark,\n ...themeSpectrumClassesCommon,\n },\n // scales\n medium,\n large,\n};\n"],"mappings":";;;;;AAAA,SAASA,KAAK,QAAQ,+BAA+B;AAAC,SAC7CC,0BAA0B;AAEnC,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,QACT,uBAAuB;AAE9B,IAAM;EAAEC,MAAM;EAAEC,KAAK;EAAEC,IAAI;EAAEC,MAAM;EAAEC;AAAM,CAAC,GAAGT,KAAK;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMU,cAAc,GAAG;EAC5BL,MAAM;EACNC,KAAK,EAAAK,aAAA,CAAAA,aAAA,KACAL,KAAK,GACLL,0BAA0B,CAC9B;EACDM,IAAI,EAAAI,aAAA,CAAAA,aAAA,KACCJ,IAAI,GACJN,0BAA0B,CAC9B;EACD;EACAO,MAAM;EACNC;AACF,CAAC","ignoreList":[]}
@@ -20,7 +20,7 @@ export function useOnChangeTrackUncontrolled(_ref) {
20
20
  if (isUncontrolled) {
21
21
  setUncontrolledSelectedKey(key);
22
22
  }
23
- onChangeHandler === null || onChangeHandler === void 0 ? void 0 : onChangeHandler(key);
23
+ onChangeHandler === null || onChangeHandler === void 0 || onChangeHandler(key);
24
24
  }, [isUncontrolled, onChangeHandler]);
25
25
  return {
26
26
  selectedKeyMaybeUncontrolled: isUncontrolled ? uncontrolledSelectedKey : selectedKey,
@@ -1 +1 @@
1
- {"version":3,"file":"useOnChangeTrackUncontrolled.js","names":["useCallback","useState","useOnChangeTrackUncontrolled","_ref","defaultSelectedKey","selectedKey","onChange","onChangeHandler","isUncontrolled","undefined","uncontrolledSelectedKey","setUncontrolledSelectedKey","onChangeMaybeUncontrolled","key","selectedKeyMaybeUncontrolled"],"sources":["../../../src/spectrum/utils/useOnChangeTrackUncontrolled.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { type ItemKey } from './itemUtils';\n\nexport interface UseOnChangeTrackUncontrolledOptions {\n defaultSelectedKey?: ItemKey;\n selectedKey?: ItemKey | null;\n onChange?: (key: ItemKey | null) => void;\n}\n\nexport interface UseOnChangeTrackUncontrolledResult {\n selectedKeyMaybeUncontrolled?: ItemKey | null;\n onChangeMaybeUncontrolled: (key: ItemKey | null) => void;\n}\n\n/**\n * Returns a selectedKey and onChange handler that can manage selection state\n * for both controlled and uncontrolled components. Useful for cases where a\n * component needs to always track its selection state regardless of its\n * controlled / uncontrolled status.\n */\nexport function useOnChangeTrackUncontrolled({\n defaultSelectedKey,\n selectedKey,\n onChange: onChangeHandler,\n}: UseOnChangeTrackUncontrolledOptions): UseOnChangeTrackUncontrolledResult {\n // `null` is a valid value for `selectedKey` in controlled mode, so we check\n // for explicit `undefined` to identify uncontrolled mode.\n const isUncontrolled = selectedKey === undefined;\n const [uncontrolledSelectedKey, setUncontrolledSelectedKey] = useState<\n ItemKey | null | undefined\n >(defaultSelectedKey);\n\n const onChangeMaybeUncontrolled = useCallback(\n (key: ItemKey | null): void => {\n // If our component is uncontrolled, track the selected key internally\n if (isUncontrolled) {\n setUncontrolledSelectedKey(key);\n }\n\n onChangeHandler?.(key);\n },\n [isUncontrolled, onChangeHandler]\n );\n\n return {\n selectedKeyMaybeUncontrolled: isUncontrolled\n ? uncontrolledSelectedKey\n : selectedKey,\n onChangeMaybeUncontrolled,\n };\n}\n\nexport default useOnChangeTrackUncontrolled;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAc7C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAAC,IAAA,EAIgC;EAAA,IAJ/B;IAC3CC,kBAAkB;IAClBC,WAAW;IACXC,QAAQ,EAAEC;EACyB,CAAC,GAAAJ,IAAA;EACpC;EACA;EACA,IAAMK,cAAc,GAAGH,WAAW,KAAKI,SAAS;EAChD,IAAM,CAACC,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGV,QAAQ,CAEpEG,kBAAkB,CAAC;EAErB,IAAMQ,yBAAyB,GAAGZ,WAAW,CAC1Ca,GAAmB,IAAW;IAC7B;IACA,IAAIL,cAAc,EAAE;MAClBG,0BAA0B,CAACE,GAAG,CAAC;IACjC;IAEAN,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAGM,GAAG,CAAC;EACxB,CAAC,EACD,CAACL,cAAc,EAAED,eAAe,CAClC,CAAC;EAED,OAAO;IACLO,4BAA4B,EAAEN,cAAc,GACxCE,uBAAuB,GACvBL,WAAW;IACfO;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B"}
1
+ {"version":3,"file":"useOnChangeTrackUncontrolled.js","names":["useCallback","useState","useOnChangeTrackUncontrolled","_ref","defaultSelectedKey","selectedKey","onChange","onChangeHandler","isUncontrolled","undefined","uncontrolledSelectedKey","setUncontrolledSelectedKey","onChangeMaybeUncontrolled","key","selectedKeyMaybeUncontrolled"],"sources":["../../../src/spectrum/utils/useOnChangeTrackUncontrolled.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { type ItemKey } from './itemUtils';\n\nexport interface UseOnChangeTrackUncontrolledOptions {\n defaultSelectedKey?: ItemKey;\n selectedKey?: ItemKey | null;\n onChange?: (key: ItemKey | null) => void;\n}\n\nexport interface UseOnChangeTrackUncontrolledResult {\n selectedKeyMaybeUncontrolled?: ItemKey | null;\n onChangeMaybeUncontrolled: (key: ItemKey | null) => void;\n}\n\n/**\n * Returns a selectedKey and onChange handler that can manage selection state\n * for both controlled and uncontrolled components. Useful for cases where a\n * component needs to always track its selection state regardless of its\n * controlled / uncontrolled status.\n */\nexport function useOnChangeTrackUncontrolled({\n defaultSelectedKey,\n selectedKey,\n onChange: onChangeHandler,\n}: UseOnChangeTrackUncontrolledOptions): UseOnChangeTrackUncontrolledResult {\n // `null` is a valid value for `selectedKey` in controlled mode, so we check\n // for explicit `undefined` to identify uncontrolled mode.\n const isUncontrolled = selectedKey === undefined;\n const [uncontrolledSelectedKey, setUncontrolledSelectedKey] = useState<\n ItemKey | null | undefined\n >(defaultSelectedKey);\n\n const onChangeMaybeUncontrolled = useCallback(\n (key: ItemKey | null): void => {\n // If our component is uncontrolled, track the selected key internally\n if (isUncontrolled) {\n setUncontrolledSelectedKey(key);\n }\n\n onChangeHandler?.(key);\n },\n [isUncontrolled, onChangeHandler]\n );\n\n return {\n selectedKeyMaybeUncontrolled: isUncontrolled\n ? uncontrolledSelectedKey\n : selectedKey,\n onChangeMaybeUncontrolled,\n };\n}\n\nexport default useOnChangeTrackUncontrolled;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAc7C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAAC,IAAA,EAIgC;EAAA,IAJ/B;IAC3CC,kBAAkB;IAClBC,WAAW;IACXC,QAAQ,EAAEC;EACyB,CAAC,GAAAJ,IAAA;EACpC;EACA;EACA,IAAMK,cAAc,GAAGH,WAAW,KAAKI,SAAS;EAChD,IAAM,CAACC,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGV,QAAQ,CAEpEG,kBAAkB,CAAC;EAErB,IAAMQ,yBAAyB,GAAGZ,WAAW,CAC1Ca,GAAmB,IAAW;IAC7B;IACA,IAAIL,cAAc,EAAE;MAClBG,0BAA0B,CAACE,GAAG,CAAC;IACjC;IAEAN,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAGM,GAAG,CAAC;EACxB,CAAC,EACD,CAACL,cAAc,EAAED,eAAe,CAClC,CAAC;EAED,OAAO;IACLO,4BAA4B,EAAEN,cAAc,GACxCE,uBAAuB,GACvBL,WAAW;IACfO;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B","ignoreList":[]}
@@ -13,8 +13,7 @@ import { ListActionMenu } from "../ListActionMenu.js";
13
13
  import { Item } from "../shared.js";
14
14
  import { getItemKey, ITEM_EMPTY_STRING_TEXT_VALUE } from "./itemUtils.js";
15
15
  import { wrapIcon, wrapPrimitiveWithText } from "./itemWrapperUtils.js";
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { jsxs as _jsxs } from "react/jsx-runtime";
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
17
  /**
19
18
  * Returns a render function that can be used to render a normalized item in
20
19
  * collection components.
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderNormalizedItem.js","names":["isElementOfType","useCallback","ActionGroup","ActionMenu","ItemContent","ListActionGroup","ListActionMenu","Item","getItemKey","ITEM_EMPTY_STRING_TEXT_VALUE","wrapIcon","wrapPrimitiveWithText","jsx","_jsx","jsxs","_jsxs","useRenderNormalizedItem","_ref","itemIconSlot","showItemDescriptions","showItemIcons","tooltipOptions","actions","normalizedItem","_normalizedItem$item","_normalizedItem$item$","_normalizedItem$item2","_normalizedItem$item3","_normalizedItem$item4","itemKey","content","item","textValue","undefined","String","description","icon","action","_objectSpread","props","onAction","key","onChange","keys","_actions$props$onChan","_actions$props","call","onOpenChange","isOpen","_actions$props$onOpen","_actions$props2","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { isElementOfType } from '@deephaven/react-hooks';\nimport { type Key, type ReactElement, useCallback } from 'react';\nimport ActionGroup from '../ActionGroup';\nimport ActionMenu from '../ActionMenu';\nimport { ItemContent } from '../ItemContent';\nimport { ListActionGroup, type ListActionGroupProps } from '../ListActionGroup';\nimport { ListActionMenu, type ListActionMenuProps } from '../ListActionMenu';\nimport { Item } from '../shared';\nimport {\n getItemKey,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n type ItemIconSlot,\n type NormalizedItem,\n type TooltipOptions,\n} from './itemUtils';\nimport { wrapIcon, wrapPrimitiveWithText } from './itemWrapperUtils';\n\nexport type ListActions<T> =\n | ReactElement<ListActionGroupProps<T>>\n | ReactElement<ListActionMenuProps<T>>;\n\nexport interface UseRenderNormalizedItemOptions {\n itemIconSlot: ItemIconSlot;\n showItemDescriptions: boolean;\n showItemIcons: boolean;\n tooltipOptions: TooltipOptions | null;\n actions?: ListActions<unknown>;\n}\n\n/**\n * Returns a render function that can be used to render a normalized item in\n * collection components.\n * @param itemIconSlot Slot to use for item icons\n * @param showItemDescriptions Whether to show item descriptions\n * @param showItemIcons Whether to show item icons\n * @param tooltipOptions Tooltip options to use when rendering the item\n * @param actions Optional actions to render with the item\n * @returns Render function for normalized items\n */\nexport function useRenderNormalizedItem({\n itemIconSlot,\n showItemDescriptions,\n showItemIcons,\n tooltipOptions,\n actions,\n}: UseRenderNormalizedItemOptions): (\n normalizedItem: NormalizedItem\n) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const itemKey = getItemKey(normalizedItem);\n const content = wrapPrimitiveWithText(normalizedItem.item?.content);\n const textValue =\n normalizedItem.item?.textValue ??\n (itemKey == null ? undefined : String(itemKey));\n\n const description = showItemDescriptions\n ? wrapPrimitiveWithText(normalizedItem.item?.description, 'description')\n : null;\n\n const icon = showItemIcons\n ? wrapIcon(normalizedItem.item?.icon, itemIconSlot)\n : null;\n\n let action = null;\n\n if (isElementOfType(actions, ListActionGroup)) {\n action = (\n <ActionGroup\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onChange={keys => actions.props.onChange?.(keys, itemKey)}\n />\n );\n } else if (isElementOfType(actions, ListActionMenu)) {\n action = (\n <ActionMenu\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onOpenChange={isOpen =>\n actions.props.onOpenChange?.(isOpen, itemKey)\n }\n />\n );\n }\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other components that use this hook.\n key={itemKey as Key}\n // The `textValue` prop gets used to provide the content of `<option>`\n // elements that back the Spectrum Picker. These are not visible in the UI,\n // but are used for accessibility purposes, so we set to an arbitrary\n // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.\n textValue={\n textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue\n }\n >\n <ItemContent tooltipOptions={tooltipOptions}>\n {icon}\n {content}\n {description}\n {action}\n </ItemContent>\n </Item>\n );\n },\n [actions, itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]\n );\n}\n\nexport default useRenderNormalizedItem;\n"],"mappings":";;;;;AAAA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAAsCC,WAAW,QAAQ,OAAO;AAAC,OAC1DC,WAAW;AAAA,OACXC,UAAU;AAAA,SACRC,WAAW;AAAA,SACXC,eAAe;AAAA,SACfC,cAAc;AAAA,SACdC,IAAI;AAAA,SAEXC,UAAU,EACVC,4BAA4B;AAAA,SAKrBC,QAAQ,EAAEC,qBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,I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CAAC;EAEX,CAAC,EACD,CAACP,OAAO,EAAEJ,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,cAAc,CAC7E,CAAC;AACH;AAEA,eAAeL,uBAAuB"}
1
+ {"version":3,"file":"useRenderNormalizedItem.js","names":["isElementOfType","useCallback","ActionGroup","ActionMenu","ItemContent","ListActionGroup","ListActionMenu","Item","getItemKey","ITEM_EMPTY_STRING_TEXT_VALUE","wrapIcon","wrapPrimitiveWithText","jsx","_jsx","jsxs","_jsxs","useRenderNormalizedItem","_ref","itemIconSlot","showItemDescriptions","showItemIcons","tooltipOptions","actions","normalizedItem","_normalizedItem$item","_normalizedItem$item$","_normalizedItem$item2","_normalizedItem$item3","_normalizedItem$item4","itemKey","content","item","textValue","undefined","String","description","icon","action","_objectSpread","props","onAction","key","onChange","keys","_actions$props$onChan","_actions$props","call","onOpenChange","isOpen","_actions$props$onOpen","_actions$props2","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { isElementOfType } from '@deephaven/react-hooks';\nimport { type Key, type ReactElement, useCallback } from 'react';\nimport ActionGroup from '../ActionGroup';\nimport ActionMenu from '../ActionMenu';\nimport { ItemContent } from '../ItemContent';\nimport { ListActionGroup, type ListActionGroupProps } from '../ListActionGroup';\nimport { ListActionMenu, type ListActionMenuProps } from '../ListActionMenu';\nimport { Item } from '../shared';\nimport {\n getItemKey,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n type ItemIconSlot,\n type NormalizedItem,\n type TooltipOptions,\n} from './itemUtils';\nimport { wrapIcon, wrapPrimitiveWithText } from './itemWrapperUtils';\n\nexport type ListActions<T> =\n | ReactElement<ListActionGroupProps<T>>\n | ReactElement<ListActionMenuProps<T>>;\n\nexport interface UseRenderNormalizedItemOptions {\n itemIconSlot: ItemIconSlot;\n showItemDescriptions: boolean;\n showItemIcons: boolean;\n tooltipOptions: TooltipOptions | null;\n actions?: ListActions<unknown>;\n}\n\n/**\n * Returns a render function that can be used to render a normalized item in\n * collection components.\n * @param itemIconSlot Slot to use for item icons\n * @param showItemDescriptions Whether to show item descriptions\n * @param showItemIcons Whether to show item icons\n * @param tooltipOptions Tooltip options to use when rendering the item\n * @param actions Optional actions to render with the item\n * @returns Render function for normalized items\n */\nexport function useRenderNormalizedItem({\n itemIconSlot,\n showItemDescriptions,\n showItemIcons,\n tooltipOptions,\n actions,\n}: UseRenderNormalizedItemOptions): (\n normalizedItem: NormalizedItem\n) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const itemKey = getItemKey(normalizedItem);\n const content = wrapPrimitiveWithText(normalizedItem.item?.content);\n const textValue =\n normalizedItem.item?.textValue ??\n (itemKey == null ? undefined : String(itemKey));\n\n const description = showItemDescriptions\n ? wrapPrimitiveWithText(normalizedItem.item?.description, 'description')\n : null;\n\n const icon = showItemIcons\n ? wrapIcon(normalizedItem.item?.icon, itemIconSlot)\n : null;\n\n let action = null;\n\n if (isElementOfType(actions, ListActionGroup)) {\n action = (\n <ActionGroup\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onChange={keys => actions.props.onChange?.(keys, itemKey)}\n />\n );\n } else if (isElementOfType(actions, ListActionMenu)) {\n action = (\n <ActionMenu\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...actions.props}\n onAction={key => actions.props.onAction(key, itemKey)}\n onOpenChange={isOpen =>\n actions.props.onOpenChange?.(isOpen, itemKey)\n }\n />\n );\n }\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other components that use this hook.\n key={itemKey as Key}\n // The `textValue` prop gets used to provide the content of `<option>`\n // elements that back the Spectrum Picker. These are not visible in the UI,\n // but are used for accessibility purposes, so we set to an arbitrary\n // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.\n textValue={\n textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue\n }\n >\n <ItemContent tooltipOptions={tooltipOptions}>\n {icon}\n {content}\n {description}\n {action}\n </ItemContent>\n </Item>\n );\n },\n [actions, itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]\n );\n}\n\nexport default useRenderNormalizedItem;\n"],"mappings":";;;;;AAAA,SAASA,eAAe,QAAQ,wBAAwB;AACxD,SAAsCC,WAAW,QAAQ,OAAO;AAAC,OAC1DC,WAAW;AAAA,OACXC,UAAU;AAAA,SACRC,WAAW;AAAA,SACXC,eAAe;AAAA,SACfC,cAAc;AAAA,SACdC,IAAI;AAAA,SAEXC,UAAU,EACVC,4BAA4B;AAAA,SAKrBC,QAAQ,EAAEC,qBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAcxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAAC,IAAA,EAQtB;EAAA,IARuB;IACtCC,YAAY;IACZC,oBAAoB;IACpBC,aAAa;IACbC,cAAc;IACdC;EAC8B,CAAC,GAAAL,IAAA;EAG/B,OAAOhB,WAAW,CACfsB,cAA8B,IAAK;IAAA,IAAAC,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IAClC,IAAMC,OAAO,GAAGrB,UAAU,CAACe,cAAc,CAAC;IAC1C,IAAMO,OAAO,GAAGnB,qBAAqB,EAAAa,oBAAA,GAACD,cAAc,CAACQ,IAAI,cAAAP,oBAAA,uBAAnBA,oBAAA,CAAqBM,OAAO,CAAC;IACnE,IAAME,SAAS,IAAAP,qBAAA,IAAAC,qBAAA,GACbH,cAAc,CAACQ,IAAI,cAAAL,qBAAA,uBAAnBA,qBAAA,CAAqBM,SAAS,cAAAP,qBAAA,cAAA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O,CAAE;QACtDkB,YAAY,EAAEC,MAAM;UAAA,IAAAC,qBAAA,EAAAC,eAAA;UAAA,QAAAD,qBAAA,GAClB,CAAAC,eAAA,GAAA5B,OAAO,CAACiB,KAAK,EAACQ,YAAY,cAAAE,qBAAA,uBAA1BA,qBAAA,CAAAH,IAAA,CAAAI,eAAA,EAA6BF,MAAM,EAAEnB,OAAO,CAAC;QAAA;MAC9C,EACF,CACF;IACH;IAEA,oBACEhB,IAAA,CAACN;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;MAEA;MACA;MACA;MACA;MACAyB,SAAS,EACPA,SAAS,KAAK,EAAE,GAAGvB,4BAA4B,GAAGuB,SACnD;MAAAmB,QAAA,eAEDpC,KAAA,CAACX,WAAW;QAACiB,cAAc,EAAEA,cAAe;QAAA8B,QAAA,GACzCf,IAAI,EACJN,OAAO,EACPK,WAAW,EACXE,MAAM;MAAA,CACI;IAAC,GAdTR,OAeD,CAAC;EAEX,CAAC,EACD,CAACP,OAAO,EAAEJ,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,cAAc,CAC7E,CAAC;AACH;AAEA,eAAeL,uBAAuB","ignoreList":[]}
@@ -13,7 +13,7 @@ export function useStaticItemInitialScrollPosition(_ref) {
13
13
  // This throws off scroll position calculations, so we disable auto scrolling
14
14
  // if either of these are found.
15
15
  var disableScrollOnOpen = useMemo(() => items.some(item => isSectionElement(item) || isItemElementWithDescription(item)), [items]);
16
- var getInitialScrollPosition = useCallback( /*#__PURE__*/_asyncToGenerator(function* () {
16
+ var getInitialScrollPosition = useCallback(/*#__PURE__*/_asyncToGenerator(function* () {
17
17
  return disableScrollOnOpen ? topOffset : getPositionOfSelectedItemElement({
18
18
  items,
19
19
  itemHeight,
@@ -1 +1 @@
1
- {"version":3,"file":"useStaticItemInitialScrollPosition.js","names":["useCallback","useMemo","getPositionOfSelectedItemElement","isItemElementWithDescription","isSectionElement","useStaticItemInitialScrollPosition","_ref","itemHeight","selectedKey","topOffset","items","disableScrollOnOpen","some","item","getInitialScrollPosition","_asyncToGenerator"],"sources":["../../../src/spectrum/utils/useStaticItemInitialScrollPosition.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport {\n getPositionOfSelectedItemElement,\n isItemElementWithDescription,\n isSectionElement,\n type ItemElement,\n type ItemKey,\n type SectionElement,\n} from './itemUtils';\n\nexport interface UseStaticItemInitialScrollPositionOptions {\n itemHeight: number;\n items: (ItemElement<unknown> | SectionElement<unknown>)[];\n selectedKey?: ItemKey | null;\n topOffset: number;\n}\n\nexport function useStaticItemInitialScrollPosition({\n itemHeight,\n selectedKey,\n topOffset,\n items,\n}: UseStaticItemInitialScrollPositionOptions): () => Promise<number | null> {\n // Item descriptions and Section elements introduce variable item heights.\n // This throws off scroll position calculations, so we disable auto scrolling\n // if either of these are found.\n const disableScrollOnOpen = useMemo(\n () =>\n items.some(\n item => isSectionElement(item) || isItemElementWithDescription(item)\n ),\n [items]\n );\n\n const getInitialScrollPosition = useCallback(\n async () =>\n disableScrollOnOpen\n ? topOffset\n : getPositionOfSelectedItemElement({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n }),\n [disableScrollOnOpen, itemHeight, items, selectedKey, topOffset]\n );\n\n return getInitialScrollPosition;\n}\n\nexport default useStaticItemInitialScrollPosition;\n"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAE3CC,gCAAgC,EAChCC,4BAA4B,EAC5BC,gBAAgB;AAalB,OAAO,SAASC,kCAAkCA,CAAAC,IAAA,EAK0B;EAAA,IALzB;IACjDC,UAAU;IACVC,WAAW;IACXC,SAAS;IACTC;EACyC,CAAC,GAAAJ,IAAA;EAC1C;EACA;EACA;EACA,IAAMK,mBAAmB,GAAGV,OAAO,CACjC,MACES,KAAK,CAACE,IAAI,CACRC,IAAI,IAAIT,gBAAgB,CAACS,IAAI,CAAC,IAAIV,4BAA4B,CAACU,IAAI,CACrE,CAAC,EACH,CAACH,KAAK,CACR,CAAC;EAED,IAAMI,wBAAwB,GAAGd,WAAW,eAAAe,iBAAA,CAC1C;IAAA,OACEJ,mBAAmB,GACfF,SAAS,GACTP,gCAAgC,CAAC;MAC/BQ,KAAK;MACLH,UAAU;MACVC,WAAW;MACXC;IACF,CAAC,CAAC;EAAA,IACR,CAACE,mBAAmB,EAAEJ,UAAU,EAAEG,KAAK,EAAEF,WAAW,EAAEC,SAAS,CACjE,CAAC;EAED,OAAOK,wBAAwB;AACjC;AAEA,eAAeT,kCAAkC"}
1
+ {"version":3,"file":"useStaticItemInitialScrollPosition.js","names":["useCallback","useMemo","getPositionOfSelectedItemElement","isItemElementWithDescription","isSectionElement","useStaticItemInitialScrollPosition","_ref","itemHeight","selectedKey","topOffset","items","disableScrollOnOpen","some","item","getInitialScrollPosition","_asyncToGenerator"],"sources":["../../../src/spectrum/utils/useStaticItemInitialScrollPosition.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport {\n getPositionOfSelectedItemElement,\n isItemElementWithDescription,\n isSectionElement,\n type ItemElement,\n type ItemKey,\n type SectionElement,\n} from './itemUtils';\n\nexport interface UseStaticItemInitialScrollPositionOptions {\n itemHeight: number;\n items: (ItemElement<unknown> | SectionElement<unknown>)[];\n selectedKey?: ItemKey | null;\n topOffset: number;\n}\n\nexport function useStaticItemInitialScrollPosition({\n itemHeight,\n selectedKey,\n topOffset,\n items,\n}: UseStaticItemInitialScrollPositionOptions): () => Promise<number | null> {\n // Item descriptions and Section elements introduce variable item heights.\n // This throws off scroll position calculations, so we disable auto scrolling\n // if either of these are found.\n const disableScrollOnOpen = useMemo(\n () =>\n items.some(\n item => isSectionElement(item) || isItemElementWithDescription(item)\n ),\n [items]\n );\n\n const getInitialScrollPosition = useCallback(\n async () =>\n disableScrollOnOpen\n ? topOffset\n : getPositionOfSelectedItemElement({\n items,\n itemHeight,\n selectedKey,\n topOffset,\n }),\n [disableScrollOnOpen, itemHeight, items, selectedKey, topOffset]\n );\n\n return getInitialScrollPosition;\n}\n\nexport default useStaticItemInitialScrollPosition;\n"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAE3CC,gCAAgC,EAChCC,4BAA4B,EAC5BC,gBAAgB;AAalB,OAAO,SAASC,kCAAkCA,CAAAC,IAAA,EAK0B;EAAA,IALzB;IACjDC,UAAU;IACVC,WAAW;IACXC,SAAS;IACTC;EACyC,CAAC,GAAAJ,IAAA;EAC1C;EACA;EACA;EACA,IAAMK,mBAAmB,GAAGV,OAAO,CACjC,MACES,KAAK,CAACE,IAAI,CACRC,IAAI,IAAIT,gBAAgB,CAACS,IAAI,CAAC,IAAIV,4BAA4B,CAACU,IAAI,CACrE,CAAC,EACH,CAACH,KAAK,CACR,CAAC;EAED,IAAMI,wBAAwB,GAAGd,WAAW,cAAAe,iBAAA,CAC1C;IAAA,OACEJ,mBAAmB,GACfF,SAAS,GACTP,gCAAgC,CAAC;MAC/BQ,KAAK;MACLH,UAAU;MACVC,WAAW;MACXC;IACF,CAAC,CAAC;EAAA,IACR,CAACE,mBAAmB,EAAEJ,UAAU,EAAEG,KAAK,EAAEF,WAAW,EAAEC,SAAS,CACjE,CAAC;EAED,OAAOK,wBAAwB;AACjC;AAEA,eAAeT,kCAAkC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { type Key } from 'react';
1
+ import { type Key } from '@react-types/shared';
2
2
  import { type ItemKey, type ItemSelection, type NormalizedItem } from './itemUtils';
3
3
  export interface UseStringifiedMultiSelectionOptions {
4
4
  normalizedItems: NormalizedItem[];
@@ -1 +1 @@
1
- {"version":3,"file":"useStringifiedMultiSelection.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useStringifiedMultiSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,OAAO,CAAC;AACvD,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,aAAa,EAElB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,mCAAmC;IAClD,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,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;CAC1C;AAED,MAAM,WAAW,kCAAkC;IACjD,iCAAiC;IACjC,kBAAkB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,yCAAyC;IACzC,yBAAyB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7C,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,mEAAmE;IACnE,uBAAuB,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;CAC3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,GACT,EAAE,mCAAmC,GAAG,kCAAkC,CA8C1E;AAED,eAAe,4BAA4B,CAAC"}
1
+ {"version":3,"file":"useStringifiedMultiSelection.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useStringifiedMultiSelection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,aAAa,EAElB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,mCAAmC;IAClD,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,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;CAC1C;AAED,MAAM,WAAW,kCAAkC;IACjD,iCAAiC;IACjC,kBAAkB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,yCAAyC;IACzC,yBAAyB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7C,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,mEAAmE;IACnE,uBAAuB,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;CAC3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,GACT,EAAE,mCAAmC,GAAG,kCAAkC,CA8C1E;AAED,eAAe,4BAA4B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useStringifiedMultiSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedMultiSelection","_ref","normalizedItems","defaultSelectedKeys","disabledKeys","selectedKeys","onChange","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","keys","actualKeys","Set","forEach","item","has","String","add"],"sources":["../../../src/spectrum/utils/useStringifiedMultiSelection.ts"],"sourcesContent":["import { type Key, useCallback, useMemo } from 'react';\nimport {\n getItemKey,\n type ItemKey,\n type ItemSelection,\n itemSelectionToStringSet,\n type NormalizedItem,\n} from './itemUtils';\n\nexport interface UseStringifiedMultiSelectionOptions {\n normalizedItems: NormalizedItem[];\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n}\n\nexport interface UseStringifiedMultiSelectionResult {\n /** Stringified selection keys */\n selectedStringKeys?: 'all' | Set<Key>;\n /** Stringified default selection keys */\n defaultSelectedStringKeys?: 'all' | Set<Key>;\n /** Stringified disabled keys */\n disabledStringKeys?: 'all' | Set<Key>;\n /** Handler that is called when the string key selections change */\n onStringSelectionChange: (keys: 'all' | Set<Key>) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKeys The currently selected keys in the collection.\n * @param defaultSelectedKeys The initial selected keys in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedMultiSelectionResult with stringified key sets and\n * string key selection change handler.\n */\nexport function useStringifiedMultiSelection({\n normalizedItems,\n defaultSelectedKeys,\n disabledKeys,\n selectedKeys,\n onChange,\n}: UseStringifiedMultiSelectionOptions): UseStringifiedMultiSelectionResult {\n const selectedStringKeys = useMemo(\n () => itemSelectionToStringSet(selectedKeys),\n [selectedKeys]\n );\n\n const defaultSelectedStringKeys = useMemo(\n () => itemSelectionToStringSet(defaultSelectedKeys),\n [defaultSelectedKeys]\n );\n\n const disabledStringKeys = useMemo(\n () => itemSelectionToStringSet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (keys: 'all' | Set<Key>) => {\n if (onChange == null) {\n return;\n }\n\n if (keys === 'all') {\n onChange('all');\n return;\n }\n\n const actualKeys = new Set<ItemKey>();\n\n normalizedItems.forEach(item => {\n if (keys.has(String(getItemKey(item)))) {\n actualKeys.add(getItemKey(item));\n }\n });\n\n onChange(actualKeys);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKeys,\n defaultSelectedStringKeys,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedMultiSelection;\n"],"mappings":"AAAA,SAAmBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAErDC,UAAU,EAGVC,wBAAwB;AA6B1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAAC,IAAA,EAMgC;EAAA,IAN/B;IAC3CC,eAAe;IACfC,mBAAmB;IACnBC,YAAY;IACZC,YAAY;IACZC;EACmC,CAAC,GAAAL,IAAA;EACpC,IAAMM,kBAAkB,GAAGV,OAAO,CAChC,MAAME,wBAAwB,CAACM,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMG,yBAAyB,GAAGX,OAAO,CACvC,MAAME,wBAAwB,CAACI,mBAAmB,CAAC,EACnD,CAACA,mBAAmB,CACtB,CAAC;EAED,IAAMM,kBAAkB,GAAGZ,OAAO,CAChC,MAAME,wBAAwB,CAACK,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMM,uBAAuB,GAAGd,WAAW,CACxCe,IAAsB,IAAK;IAC1B,IAAIL,QAAQ,IAAI,IAAI,EAAE;MACpB;IACF;IAEA,IAAIK,IAAI,KAAK,KAAK,EAAE;MAClBL,QAAQ,CAAC,KAAK,CAAC;MACf;IACF;IAEA,IAAMM,UAAU,GAAG,IAAIC,GAAG,CAAU,CAAC;IAErCX,eAAe,CAACY,OAAO,CAACC,IAAI,IAAI;MAC9B,IAAIJ,IAAI,CAACK,GAAG,CAACC,MAAM,CAACnB,UAAU,CAACiB,IAAI,CAAC,CAAC,CAAC,EAAE;QACtCH,UAAU,CAACM,GAAG,CAACpB,UAAU,CAACiB,IAAI,CAAC,CAAC;MAClC;IACF,CAAC,CAAC;IAEFT,QAAQ,CAACM,UAAU,CAAC;EACtB,CAAC,EACD,CAACV,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,kBAAkB;IAClBC,yBAAyB;IACzBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B"}
1
+ {"version":3,"file":"useStringifiedMultiSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedMultiSelection","_ref","normalizedItems","defaultSelectedKeys","disabledKeys","selectedKeys","onChange","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","keys","actualKeys","Set","forEach","item","has","String","add"],"sources":["../../../src/spectrum/utils/useStringifiedMultiSelection.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { type Key } from '@react-types/shared';\nimport {\n getItemKey,\n type ItemKey,\n type ItemSelection,\n itemSelectionToStringSet,\n type NormalizedItem,\n} from './itemUtils';\n\nexport interface UseStringifiedMultiSelectionOptions {\n normalizedItems: NormalizedItem[];\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: ItemSelection) => void;\n}\n\nexport interface UseStringifiedMultiSelectionResult {\n /** Stringified selection keys */\n selectedStringKeys?: 'all' | Set<Key>;\n /** Stringified default selection keys */\n defaultSelectedStringKeys?: 'all' | Set<Key>;\n /** Stringified disabled keys */\n disabledStringKeys?: 'all' | Set<Key>;\n /** Handler that is called when the string key selections change */\n onStringSelectionChange: (keys: 'all' | Set<Key>) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKeys The currently selected keys in the collection.\n * @param defaultSelectedKeys The initial selected keys in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedMultiSelectionResult with stringified key sets and\n * string key selection change handler.\n */\nexport function useStringifiedMultiSelection({\n normalizedItems,\n defaultSelectedKeys,\n disabledKeys,\n selectedKeys,\n onChange,\n}: UseStringifiedMultiSelectionOptions): UseStringifiedMultiSelectionResult {\n const selectedStringKeys = useMemo(\n () => itemSelectionToStringSet(selectedKeys),\n [selectedKeys]\n );\n\n const defaultSelectedStringKeys = useMemo(\n () => itemSelectionToStringSet(defaultSelectedKeys),\n [defaultSelectedKeys]\n );\n\n const disabledStringKeys = useMemo(\n () => itemSelectionToStringSet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (keys: 'all' | Set<Key>) => {\n if (onChange == null) {\n return;\n }\n\n if (keys === 'all') {\n onChange('all');\n return;\n }\n\n const actualKeys = new Set<ItemKey>();\n\n normalizedItems.forEach(item => {\n if (keys.has(String(getItemKey(item)))) {\n actualKeys.add(getItemKey(item));\n }\n });\n\n onChange(actualKeys);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKeys,\n defaultSelectedStringKeys,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedMultiSelection;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAG3CC,UAAU,EAGVC,wBAAwB;AA6B1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAAC,IAAA,EAMgC;EAAA,IAN/B;IAC3CC,eAAe;IACfC,mBAAmB;IACnBC,YAAY;IACZC,YAAY;IACZC;EACmC,CAAC,GAAAL,IAAA;EACpC,IAAMM,kBAAkB,GAAGV,OAAO,CAChC,MAAME,wBAAwB,CAACM,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMG,yBAAyB,GAAGX,OAAO,CACvC,MAAME,wBAAwB,CAACI,mBAAmB,CAAC,EACnD,CAACA,mBAAmB,CACtB,CAAC;EAED,IAAMM,kBAAkB,GAAGZ,OAAO,CAChC,MAAME,wBAAwB,CAACK,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMM,uBAAuB,GAAGd,WAAW,CACxCe,IAAsB,IAAK;IAC1B,IAAIL,QAAQ,IAAI,IAAI,EAAE;MACpB;IACF;IAEA,IAAIK,IAAI,KAAK,KAAK,EAAE;MAClBL,QAAQ,CAAC,KAAK,CAAC;MACf;IACF;IAEA,IAAMM,UAAU,GAAG,IAAIC,GAAG,CAAU,CAAC;IAErCX,eAAe,CAACY,OAAO,CAACC,IAAI,IAAI;MAC9B,IAAIJ,IAAI,CAACK,GAAG,CAACC,MAAM,CAACnB,UAAU,CAACiB,IAAI,CAAC,CAAC,CAAC,EAAE;QACtCH,UAAU,CAACM,GAAG,CAACpB,UAAU,CAACiB,IAAI,CAAC,CAAC;MAClC;IACF,CAAC,CAAC;IAEFT,QAAQ,CAACM,UAAU,CAAC;EACtB,CAAC,EACD,CAACV,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,kBAAkB;IAClBC,yBAAyB;IACzBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { type Key } from 'react';
1
+ import { type Key } from '@react-types/shared';
2
2
  import { type ItemKey, type NormalizedItem, type NormalizedSection } from './itemUtils';
3
3
  export interface UseStringifiedSelectionOptions {
4
4
  normalizedItems: (NormalizedItem | NormalizedSection)[];
@@ -1 +1 @@
1
- {"version":3,"file":"useStringifiedSelection.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useStringifiedSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,OAAO,CAAC;AACvD,OAAO,EAEL,KAAK,OAAO,EAEZ,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,8BAA8B;IAC7C,eAAe,EAAE,CAAC,cAAc,GAAG,iBAAiB,CAAC,EAAE,CAAC;IACxD,WAAW,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,6BAA6B;IAC5C,wBAAwB,CAAC,EAAE,GAAG,CAAC;IAC/B,iBAAiB,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,uBAAuB,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE,8BAA8B,GAAG,6BAA6B,CA6ChE;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"useStringifiedSelection.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useStringifiedSelection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAEL,KAAK,OAAO,EAEZ,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,8BAA8B;IAC7C,eAAe,EAAE,CAAC,cAAc,GAAG,iBAAiB,CAAC,EAAE,CAAC;IACxD,WAAW,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAC;IACxC,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,6BAA6B;IAC5C,wBAAwB,CAAC,EAAE,GAAG,CAAC;IAC/B,iBAAiB,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,uBAAuB,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE,8BAA8B,GAAG,6BAA6B,CA6ChE;AAED,eAAe,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useStringifiedSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedSelection","_ref","normalizedItems","defaultSelectedKey","selectedKey","disabledKeys","onChange","selectedStringKey","String","defaultSelectedStringKey","disabledStringKeys","onStringSelectionChange","key","_getItemKey","selectedItem","find","item","actualKey"],"sources":["../../../src/spectrum/utils/useStringifiedSelection.ts"],"sourcesContent":["import { type Key, useCallback, useMemo } from 'react';\nimport {\n getItemKey,\n type ItemKey,\n itemSelectionToStringSet,\n type NormalizedItem,\n type NormalizedSection,\n} from './itemUtils';\n\nexport interface UseStringifiedSelectionOptions {\n normalizedItems: (NormalizedItem | NormalizedSection)[];\n selectedKey: ItemKey | null | undefined;\n defaultSelectedKey: ItemKey | undefined;\n disabledKeys: Iterable<ItemKey> | undefined;\n onChange: ((key: ItemKey | null) => void) | undefined;\n}\n\nexport interface UseStringifiedSelectionResult {\n defaultSelectedStringKey?: Key;\n selectedStringKey?: Key | null;\n disabledStringKeys?: Set<Key>;\n onStringSelectionChange: (key: Key | null) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKey The currently selected key in the collection.\n * @param defaultSelectedKey The initial selected key in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedSelectionResult with stringified key sets and string\n * key selection change handler.\n */\nexport function useStringifiedSelection({\n normalizedItems,\n defaultSelectedKey,\n selectedKey,\n disabledKeys,\n onChange,\n}: UseStringifiedSelectionOptions): UseStringifiedSelectionResult {\n const selectedStringKey = useMemo(\n () => (selectedKey == null ? selectedKey : String(selectedKey)),\n [selectedKey]\n );\n\n const defaultSelectedStringKey = useMemo(\n () =>\n defaultSelectedKey == null\n ? defaultSelectedKey\n : String(defaultSelectedKey),\n [defaultSelectedKey]\n );\n\n const disabledStringKeys = useMemo(\n () => itemSelectionToStringSet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (key: Key | null): void => {\n if (onChange == null) {\n return;\n }\n\n // The `key` arg will always be a string due to us setting the `Item` key\n // prop in `renderItem`. We need to find the matching item to determine\n // the actual key.\n const selectedItem = normalizedItems.find(\n item => String(getItemKey(item)) === key\n );\n\n const actualKey = getItemKey(selectedItem) ?? key;\n\n onChange(actualKey);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKey,\n defaultSelectedStringKey,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedSelection;\n"],"mappings":"AAAA,SAAmBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAErDC,UAAU,EAEVC,wBAAwB;AAoB1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAAC,IAAA,EAM2B;EAAA,IAN1B;IACtCC,eAAe;IACfC,kBAAkB;IAClBC,WAAW;IACXC,YAAY;IACZC;EAC8B,CAAC,GAAAL,IAAA;EAC/B,IAAMM,iBAAiB,GAAGV,OAAO,CAC/B,MAAOO,WAAW,IAAI,IAAI,GAAGA,WAAW,GAAGI,MAAM,CAACJ,WAAW,CAAE,EAC/D,CAACA,WAAW,CACd,CAAC;EAED,IAAMK,wBAAwB,GAAGZ,OAAO,CACtC,MACEM,kBAAkB,IAAI,IAAI,GACtBA,kBAAkB,GAClBK,MAAM,CAACL,kBAAkB,CAAC,EAChC,CAACA,kBAAkB,CACrB,CAAC;EAED,IAAMO,kBAAkB,GAAGb,OAAO,CAChC,MAAME,wBAAwB,CAACM,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMM,uBAAuB,GAAGf,WAAW,CACxCgB,GAAe,IAAW;IAAA,IAAAC,WAAA;IACzB,IAAIP,QAAQ,IAAI,IAAI,EAAE;MACpB;IACF;;IAEA;IACA;IACA;IACA,IAAMQ,YAAY,GAAGZ,eAAe,CAACa,IAAI,CACvCC,IAAI,IAAIR,MAAM,CAACV,UAAU,CAACkB,IAAI,CAAC,CAAC,KAAKJ,GACvC,CAAC;IAED,IAAMK,SAAS,IAAAJ,WAAA,GAAGf,UAAU,CAACgB,YAAY,CAAC,cAAAD,WAAA,cAAAA,WAAA,GAAID,GAAG;IAEjDN,QAAQ,CAACW,SAAS,CAAC;EACrB,CAAC,EACD,CAACf,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,iBAAiB;IACjBE,wBAAwB;IACxBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeX,uBAAuB"}
1
+ {"version":3,"file":"useStringifiedSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedSelection","_ref","normalizedItems","defaultSelectedKey","selectedKey","disabledKeys","onChange","selectedStringKey","String","defaultSelectedStringKey","disabledStringKeys","onStringSelectionChange","key","_getItemKey","selectedItem","find","item","actualKey"],"sources":["../../../src/spectrum/utils/useStringifiedSelection.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { type Key } from '@react-types/shared';\nimport {\n getItemKey,\n type ItemKey,\n itemSelectionToStringSet,\n type NormalizedItem,\n type NormalizedSection,\n} from './itemUtils';\n\nexport interface UseStringifiedSelectionOptions {\n normalizedItems: (NormalizedItem | NormalizedSection)[];\n selectedKey: ItemKey | null | undefined;\n defaultSelectedKey: ItemKey | undefined;\n disabledKeys: Iterable<ItemKey> | undefined;\n onChange: ((key: ItemKey | null) => void) | undefined;\n}\n\nexport interface UseStringifiedSelectionResult {\n defaultSelectedStringKey?: Key;\n selectedStringKey?: Key | null;\n disabledStringKeys?: Set<Key>;\n onStringSelectionChange: (key: Key | null) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKey The currently selected key in the collection.\n * @param defaultSelectedKey The initial selected key in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedSelectionResult with stringified key sets and string\n * key selection change handler.\n */\nexport function useStringifiedSelection({\n normalizedItems,\n defaultSelectedKey,\n selectedKey,\n disabledKeys,\n onChange,\n}: UseStringifiedSelectionOptions): UseStringifiedSelectionResult {\n const selectedStringKey = useMemo(\n () => (selectedKey == null ? selectedKey : String(selectedKey)),\n [selectedKey]\n );\n\n const defaultSelectedStringKey = useMemo(\n () =>\n defaultSelectedKey == null\n ? defaultSelectedKey\n : String(defaultSelectedKey),\n [defaultSelectedKey]\n );\n\n const disabledStringKeys = useMemo(\n () => itemSelectionToStringSet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (key: Key | null): void => {\n if (onChange == null) {\n return;\n }\n\n // The `key` arg will always be a string due to us setting the `Item` key\n // prop in `renderItem`. We need to find the matching item to determine\n // the actual key.\n const selectedItem = normalizedItems.find(\n item => String(getItemKey(item)) === key\n );\n\n const actualKey = getItemKey(selectedItem) ?? key;\n\n onChange(actualKey);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKey,\n defaultSelectedStringKey,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedSelection;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAG3CC,UAAU,EAEVC,wBAAwB;AAoB1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAAC,IAAA,EAM2B;EAAA,IAN1B;IACtCC,eAAe;IACfC,kBAAkB;IAClBC,WAAW;IACXC,YAAY;IACZC;EAC8B,CAAC,GAAAL,IAAA;EAC/B,IAAMM,iBAAiB,GAAGV,OAAO,CAC/B,MAAOO,WAAW,IAAI,IAAI,GAAGA,WAAW,GAAGI,MAAM,CAACJ,WAAW,CAAE,EAC/D,CAACA,WAAW,CACd,CAAC;EAED,IAAMK,wBAAwB,GAAGZ,OAAO,CACtC,MACEM,kBAAkB,IAAI,IAAI,GACtBA,kBAAkB,GAClBK,MAAM,CAACL,kBAAkB,CAAC,EAChC,CAACA,kBAAkB,CACrB,CAAC;EAED,IAAMO,kBAAkB,GAAGb,OAAO,CAChC,MAAME,wBAAwB,CAACM,YAAY,CAAC,EAC5C,CAACA,YAAY,CACf,CAAC;EAED,IAAMM,uBAAuB,GAAGf,WAAW,CACxCgB,GAAe,IAAW;IAAA,IAAAC,WAAA;IACzB,IAAIP,QAAQ,IAAI,IAAI,EAAE;MACpB;IACF;;IAEA;IACA;IACA;IACA,IAAMQ,YAAY,GAAGZ,eAAe,CAACa,IAAI,CACvCC,IAAI,IAAIR,MAAM,CAACV,UAAU,CAACkB,IAAI,CAAC,CAAC,KAAKJ,GACvC,CAAC;IAED,IAAMK,SAAS,IAAAJ,WAAA,GAAGf,UAAU,CAACgB,YAAY,CAAC,cAAAD,WAAA,cAAAA,WAAA,GAAID,GAAG;IAEjDN,QAAQ,CAACW,SAAS,CAAC;EACrB,CAAC,EACD,CAACf,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,iBAAiB;IACjBE,wBAAwB;IACxBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeX,uBAAuB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Logo.js","names":["classNames","jsx","_jsx","Logo","_ref","className","style"],"sources":["../../src/theme/Logo.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport './Logo.css';\n\ninterface LogoProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function Logo({ className, style }: LogoProps): JSX.Element {\n return <div className={classNames('dh-logo', className)} style={style} />;\n}\n\nexport default Logo;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAAC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAQpC,OAAO,SAASC,IAAIA,CAAAC,IAAA,EAA+C;EAAA,IAA9C;IAAEC,SAAS;IAAEC;EAAiB,CAAC,GAAAF,IAAA;EAClD,oBAAOF,IAAA;IAAKG,SAAS,EAAEL,UAAU,CAAC,SAAS,EAAEK,SAAS,CAAE;IAACC,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC3E;AAEA,eAAeH,IAAI"}
1
+ {"version":3,"file":"Logo.js","names":["classNames","jsx","_jsx","Logo","_ref","className","style"],"sources":["../../src/theme/Logo.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport './Logo.css';\n\ninterface LogoProps {\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function Logo({ className, style }: LogoProps): JSX.Element {\n return <div className={classNames('dh-logo', className)} style={style} />;\n}\n\nexport default Logo;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAAC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAQpC,OAAO,SAASC,IAAIA,CAAAC,IAAA,EAA+C;EAAA,IAA9C;IAAEC,SAAS;IAAEC;EAAiB,CAAC,GAAAF,IAAA;EAClD,oBAAOF,IAAA;IAAKG,SAAS,EAAEL,UAAU,CAAC,SAAS,EAAEK,SAAS,CAAE;IAACC,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC3E;AAEA,eAAeH,IAAI","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"SpectrumThemeProvider.js","names":["useState","Provider","nanoid","themeDHDefault","jsx","_jsx","SpectrumThemeProvider","_ref","children","isPortal","theme","colorScheme","zIndex","position","id","UNSAFE_className"],"sources":["../../src/theme/SpectrumThemeProvider.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\nimport { Provider } from '@adobe/react-spectrum';\nimport type { Theme } from '@react-types/provider';\nimport { nanoid } from 'nanoid';\nimport { themeDHDefault } from '../spectrum/utils';\n\nexport interface SpectrumThemeProviderProps {\n children: ReactNode;\n isPortal?: boolean;\n theme?: Theme;\n colorScheme?: 'light' | 'dark';\n zIndex?: number;\n position?: 'static' | 'absolute' | 'fixed' | 'relative' | 'sticky';\n}\n\n/**\n * Wrapper around React Spectrum's theme Provider that provides DH mappings of\n * Spectrum's theme variables to DH's theme variables. Also exposes an optional\n * `isPortal` prop that if provided, adds a unique `data-unique-id` attribute to\n * the Provider. This is needed to force the Provider to render the theme wrapper\n * inside of portals.\n */\nexport function SpectrumThemeProvider({\n children,\n isPortal = false,\n theme = themeDHDefault,\n colorScheme,\n zIndex,\n position,\n}: SpectrumThemeProviderProps): JSX.Element {\n // a unique ID is used per provider to force it to render the theme wrapper element inside portals\n // based on https://github.com/adobe/react-spectrum/issues/1697#issuecomment-999827266\n // won't be needed if https://github.com/adobe/react-spectrum/pull/2669 is merged\n const [id] = useState(isPortal ? nanoid() : null);\n\n return (\n <Provider\n UNSAFE_className=\"spectrum-theme-provider\"\n theme={theme}\n colorScheme={colorScheme}\n zIndex={zIndex}\n position={position}\n data-unique-id={id}\n >\n {children}\n </Provider>\n );\n}\n"],"mappings":"AAAA,SAAyBA,QAAQ,QAAQ,OAAO;AAChD,SAASC,QAAQ,QAAQ,uBAAuB;AAEhD,SAASC,MAAM,QAAQ,QAAQ;AAAC,SACvBC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAWvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAOO;EAAA,IAPN;IACpCC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IAChBC,KAAK,GAAGP,cAAc;IACtBQ,WAAW;IACXC,MAAM;IACNC;EAC0B,CAAC,GAAAN,IAAA;EAC3B;EACA;EACA;EACA,IAAM,CAACO,EAAE,CAAC,GAAGd,QAAQ,CAACS,QAAQ,GAAGP,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;EAEjD,oBACEG,IAAA,CAACJ,QAAQ;IACPc,gBAAgB,EAAC,yBAAyB;IAC1CL,KAAK,EAAEA,KAAM;IACbC,WAAW,EAAEA,WAAY;IACzBC,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnB,kBAAgBC,EAAG;IAAAN,QAAA,EAElBA;EAAQ,CACD,CAAC;AAEf"}
1
+ {"version":3,"file":"SpectrumThemeProvider.js","names":["useState","Provider","nanoid","themeDHDefault","jsx","_jsx","SpectrumThemeProvider","_ref","children","isPortal","theme","colorScheme","zIndex","position","id","UNSAFE_className"],"sources":["../../src/theme/SpectrumThemeProvider.tsx"],"sourcesContent":["import { type ReactNode, useState } from 'react';\nimport { Provider } from '@adobe/react-spectrum';\nimport type { Theme } from '@react-types/provider';\nimport { nanoid } from 'nanoid';\nimport { themeDHDefault } from '../spectrum/utils';\n\nexport interface SpectrumThemeProviderProps {\n children: ReactNode;\n isPortal?: boolean;\n theme?: Theme;\n colorScheme?: 'light' | 'dark';\n zIndex?: number;\n position?: 'static' | 'absolute' | 'fixed' | 'relative' | 'sticky';\n}\n\n/**\n * Wrapper around React Spectrum's theme Provider that provides DH mappings of\n * Spectrum's theme variables to DH's theme variables. Also exposes an optional\n * `isPortal` prop that if provided, adds a unique `data-unique-id` attribute to\n * the Provider. This is needed to force the Provider to render the theme wrapper\n * inside of portals.\n */\nexport function SpectrumThemeProvider({\n children,\n isPortal = false,\n theme = themeDHDefault,\n colorScheme,\n zIndex,\n position,\n}: SpectrumThemeProviderProps): JSX.Element {\n // a unique ID is used per provider to force it to render the theme wrapper element inside portals\n // based on https://github.com/adobe/react-spectrum/issues/1697#issuecomment-999827266\n // won't be needed if https://github.com/adobe/react-spectrum/pull/2669 is merged\n const [id] = useState(isPortal ? nanoid() : null);\n\n return (\n <Provider\n UNSAFE_className=\"spectrum-theme-provider\"\n theme={theme}\n colorScheme={colorScheme}\n zIndex={zIndex}\n position={position}\n data-unique-id={id}\n >\n {children}\n </Provider>\n );\n}\n"],"mappings":"AAAA,SAAyBA,QAAQ,QAAQ,OAAO;AAChD,SAASC,QAAQ,QAAQ,uBAAuB;AAEhD,SAASC,MAAM,QAAQ,QAAQ;AAAC,SACvBC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAWvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAOO;EAAA,IAPN;IACpCC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IAChBC,KAAK,GAAGP,cAAc;IACtBQ,WAAW;IACXC,MAAM;IACNC;EAC0B,CAAC,GAAAN,IAAA;EAC3B;EACA;EACA;EACA,IAAM,CAACO,EAAE,CAAC,GAAGd,QAAQ,CAACS,QAAQ,GAAGP,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;EAEjD,oBACEG,IAAA,CAACJ,QAAQ;IACPc,gBAAgB,EAAC,yBAAyB;IAC1CL,KAAK,EAAEA,KAAM;IACbC,WAAW,EAAEA,WAAY;IACzBC,MAAM,EAAEA,MAAO;IACfC,QAAQ,EAAEA,QAAS;IACnB,kBAAgBC,EAAG;IAAAN,QAAA,EAElBA;EAAQ,CACD,CAAC;AAEf","ignoreList":[]}
@@ -3,6 +3,7 @@
3
3
  // preload variables defined here are required by DHE due to theme plugins
4
4
  // loading after login. We should consider moving most of these to the DHE
5
5
  // codebase. To be addressed by #1679
6
+
6
7
  export var DEFAULT_DARK_THEME_KEY = 'default-dark';
7
8
  export var DEFAULT_LIGHT_THEME_KEY = 'default-light';
8
9
  export var EXTERNAL_THEME_KEY = 'external-theme';
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeModel.js","names":["DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","EXTERNAL_THEME_KEY","MSG_REQUEST_GET_THEME","MSG_REQUEST_SET_THEME","PRELOAD_TRANSPARENT_THEME_QUERY_PARAM","THEME_KEY_OVERRIDE_QUERY_PARAM","DEFAULT_DARK_THEME_PALETTE","blue","red","gray","DEFAULT_PRELOAD_DATA_VARIABLES","concat","TRANSPARENT_PRELOAD_DATA_VARIABLES","SVG_ICON_MANUAL_COLOR_MAP","THEME_CACHE_LOCAL_STORAGE_KEY"],"sources":["../../src/theme/ThemeModel.ts"],"sourcesContent":["export type BaseThemeType = 'dark' | 'light';\nexport type BaseThemeKey = `default-${BaseThemeType}`;\nexport type CssVariableStyleContent = `:root{${string}`;\nexport type ThemeCssVariableName = `--dh-${string}`;\nexport type ThemeCssColorVariableName = `--dh-color-${string}`;\n\n// DHC should only need to preload variables that are required by the empty page\n// with loading spinner that shows while plugins are loading. The rest of the\n// preload variables defined here are required by DHE due to theme plugins\n// loading after login. We should consider moving most of these to the DHE\n// codebase. To be addressed by #1679\nexport type ThemePreloadColorVariable =\n | '--dh-color-accent-contrast'\n | '--dh-color-accent-bg'\n | '--dh-color-accent-hover-bg'\n | '--dh-color-accent-down-bg'\n | '--dh-color-accent-key-focus-bg'\n | '--dh-color-negative-bg'\n | '--dh-color-loading-spinner-primary'\n | '--dh-color-loading-spinner-secondary'\n | '--dh-color-bg'\n | '--dh-color-fg'\n | '--dh-color-input-bg'\n | '--dh-color-input-fg'\n | '--dh-color-input-disabled-bg'\n | '--dh-color-input-border'\n | '--dh-color-input-placeholder'\n | '--dh-color-input-focus-border'\n | '--dh-color-text-highlight'\n | '--dh-color-login-form-bg'\n | '--dh-color-login-status-message'\n | '--dh-color-login-logo-bg'\n | '--dh-color-login-footer-fg'\n | '--dh-color-random-area-plot-animation-fg-fill'\n | '--dh-color-random-area-plot-animation-fg-stroke'\n | '--dh-color-random-area-plot-animation-bg'\n | '--dh-color-random-area-plot-animation-grid';\n\nexport type ThemeIconsRequiringManualColorChanges =\n | '--dh-svg-icon-select-indicator'\n | '--dh-svg-icon-select-indicator-hover'\n | '--dh-svg-icon-select-indicator-disabled'\n | '--dh-svg-icon-error';\n\nexport const DEFAULT_DARK_THEME_KEY = 'default-dark' satisfies BaseThemeKey;\nexport const DEFAULT_LIGHT_THEME_KEY = 'default-light' satisfies BaseThemeKey;\nexport const EXTERNAL_THEME_KEY = 'external-theme' as const;\nexport const MSG_REQUEST_GET_THEME =\n 'io.deephaven.message.ThemeModel.requestExternalTheme';\nexport const MSG_REQUEST_SET_THEME =\n 'io.deephaven.message.ThemeModel.requestSetTheme';\nexport const PRELOAD_TRANSPARENT_THEME_QUERY_PARAM =\n 'preloadTransparentTheme' as const;\nexport const THEME_KEY_OVERRIDE_QUERY_PARAM = 'theme' as const;\n\n// Hex versions of some of the default dark theme color palette needed for\n// preload defaults.\nexport const DEFAULT_DARK_THEME_PALETTE = {\n blue: {\n 500: '#2f5bc0',\n 400: '#254ba4',\n 600: '#3b6bda', // accent color\n 700: '#4c7dee',\n },\n red: {\n 600: '#c73f61',\n },\n gray: {\n 50: '#1a171a',\n 75: '#211f22',\n 300: '#373438',\n 400: '#403e41',\n 500: '#5b5a5c',\n 600: '#929192',\n 700: '#c0bfbf',\n 800: '#f0f0ee',\n 900: '#fcfcfa',\n },\n} as const;\n\n// Css properties that are used in preload data with default values.\n// DHC should only need to preload variables that are required by the empty page\n// with loading spinner that shows while plugins are loading. The rest of the\n// preload variables defined here are required by DHE due to theme plugins\n// loading after login. We should consider moving most of these to the DHE\n// codebase. To be addressed by #1679\nexport const DEFAULT_PRELOAD_DATA_VARIABLES: Record<\n ThemePreloadColorVariable,\n string\n> = {\n '--dh-color-accent-contrast': DEFAULT_DARK_THEME_PALETTE.gray[900],\n '--dh-color-accent-bg': DEFAULT_DARK_THEME_PALETTE.blue[600],\n '--dh-color-accent-hover-bg': DEFAULT_DARK_THEME_PALETTE.blue[500],\n '--dh-color-accent-down-bg': DEFAULT_DARK_THEME_PALETTE.blue[400],\n '--dh-color-accent-key-focus-bg': DEFAULT_DARK_THEME_PALETTE.blue[500],\n '--dh-color-negative-bg': DEFAULT_DARK_THEME_PALETTE.red[600],\n '--dh-color-loading-spinner-primary': DEFAULT_DARK_THEME_PALETTE.blue[600],\n '--dh-color-loading-spinner-secondary': `${DEFAULT_DARK_THEME_PALETTE.gray[800]}80`, // 50% opacity\n '--dh-color-bg': DEFAULT_DARK_THEME_PALETTE.gray[50],\n '--dh-color-fg': DEFAULT_DARK_THEME_PALETTE.gray[800],\n '--dh-color-input-bg': DEFAULT_DARK_THEME_PALETTE.gray[500],\n '--dh-color-input-fg': DEFAULT_DARK_THEME_PALETTE.gray[800],\n '--dh-color-input-disabled-bg': DEFAULT_DARK_THEME_PALETTE.gray[300],\n '--dh-color-input-border': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-input-placeholder': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-input-focus-border': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}d9`, // 85% opacity\n '--dh-color-text-highlight': `${DEFAULT_DARK_THEME_PALETTE.blue[700]}4d`, // 30% opacity\n '--dh-color-login-form-bg': DEFAULT_DARK_THEME_PALETTE.gray[400],\n '--dh-color-login-status-message': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-login-logo-bg': DEFAULT_DARK_THEME_PALETTE.gray[900],\n '--dh-color-login-footer-fg': DEFAULT_DARK_THEME_PALETTE.gray[700],\n '--dh-color-random-area-plot-animation-fg-fill': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}14`, // .08 opacity\n '--dh-color-random-area-plot-animation-fg-stroke': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}33`, // .2 opacity\n '--dh-color-random-area-plot-animation-bg':\n DEFAULT_DARK_THEME_PALETTE.gray[75],\n '--dh-color-random-area-plot-animation-grid':\n DEFAULT_DARK_THEME_PALETTE.gray[300],\n};\n\nexport const TRANSPARENT_PRELOAD_DATA_VARIABLES: Partial<\n Record<ThemePreloadColorVariable, string>\n> = {\n '--dh-color-bg': 'transparent',\n '--dh-color-loading-spinner-primary': 'transparent',\n '--dh-color-loading-spinner-secondary': 'transparent',\n};\n\n/**\n * Some inline SVGs require manually updating their fill color via\n * `updateSVGFillColors`. This object maps these variables to their respective\n * fill color variables.\n */\nexport const SVG_ICON_MANUAL_COLOR_MAP: Record<\n ThemeIconsRequiringManualColorChanges,\n string\n> = {\n '--dh-svg-icon-select-indicator': '--dh-color-selector-fg',\n '--dh-svg-icon-select-indicator-hover': '--dh-color-selector-hover-fg',\n '--dh-svg-icon-select-indicator-disabled': '--dh-color-selector-disabled-fg',\n '--dh-svg-icon-error': '--dh-color-form-control-error',\n};\n\nexport const THEME_CACHE_LOCAL_STORAGE_KEY = 'deephaven.themeCache';\n\nexport interface ThemePreloadData {\n themeKey: string;\n preloadStyleContent?: CssVariableStyleContent;\n}\n\nexport interface ThemeData {\n baseThemeKey?: BaseThemeKey;\n themeKey: string;\n name: string;\n styleContent: string;\n}\n\nexport interface ThemeRegistrationData {\n base: ThemeData[];\n custom: ThemeData[];\n}\n\nexport interface ExternalThemeData {\n baseThemeKey?: BaseThemeKey;\n name: string;\n cssVars: Record<ThemeCssColorVariableName, string>;\n}\n"],"mappings":"AAMA;AACA;AACA;AACA;AACA;AAkCA,OAAO,IAAMA,sBAAsB,GAAG,cAAqC;AAC3E,OAAO,IAAMC,uBAAuB,GAAG,eAAsC;AAC7E,OAAO,IAAMC,kBAAkB,GAAG,gBAAyB;AAC3D,OAAO,IAAMC,qBAAqB,GAChC,sDAAsD;AACxD,OAAO,IAAMC,qBAAqB,GAChC,iDAAiD;AACnD,OAAO,IAAMC,qCAAqC,GAChD,yBAAkC;AACpC,OAAO,IAAMC,8BAA8B,GAAG,OAAgB;;AAE9D;AACA;AACA,OAAO,IAAMC,0BAA0B,GAAG;EACxCC,IAAI,EAAE;IACJ,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IAAE;IAChB,GAAG,EAAE;EACP,CAAC;EACDC,GAAG,EAAE;IACH,GAAG,EAAE;EACP,CAAC;EACDC,IAAI,EAAE;IACJ,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE;EACP;AACF,CAAU;;AAEV;AACA;AACA;AACA;AACA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IAAI,CAAC,GAAG,CAAC;EACvE,0BAA0B,EAAEH,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EAChE,4BAA4B,EAAEH,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EAClE,+CAA+C,KAAAE,MAAA,CAAKL,0BAA0B,CAACC,IAAI,CAAC,GAAG,CAAC,OAAI;EAAE;EAC9F,iDAAiD,KAAAI,MAAA,CAAKL,0BAA0B,CAACC,IAAI,CAAC,GAAG,CAAC,OAAI;EAAE;EAChG,0CAA0C,EACxCD,0BAA0B,CAACG,IAAI,CAAC,EAAE,CAAC;EACrC,4CAA4C,EAC1CH,0BAA0B,CAACG,IAAI,CAAC,GAAG;AACvC,CAAC;AAED,OAAO,IAAMG,kCAEZ,GAAG;EACF,eAAe,EAAE,aAAa;EAC9B,oCAAoC,EAAE,aAAa;EACnD,sCAAsC,EAAE;AAC1C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,yBAGZ,GAAG;EACF,gCAAgC,EAAE,wBAAwB;EAC1D,sCAAsC,EAAE,8BAA8B;EACtE,yCAAyC,EAAE,iCAAiC;EAC5E,qBAAqB,EAAE;AACzB,CAAC;AAED,OAAO,IAAMC,6BAA6B,GAAG,sBAAsB"}
1
+ {"version":3,"file":"ThemeModel.js","names":["DEFAULT_DARK_THEME_KEY","DEFAULT_LIGHT_THEME_KEY","EXTERNAL_THEME_KEY","MSG_REQUEST_GET_THEME","MSG_REQUEST_SET_THEME","PRELOAD_TRANSPARENT_THEME_QUERY_PARAM","THEME_KEY_OVERRIDE_QUERY_PARAM","DEFAULT_DARK_THEME_PALETTE","blue","red","gray","DEFAULT_PRELOAD_DATA_VARIABLES","concat","TRANSPARENT_PRELOAD_DATA_VARIABLES","SVG_ICON_MANUAL_COLOR_MAP","THEME_CACHE_LOCAL_STORAGE_KEY"],"sources":["../../src/theme/ThemeModel.ts"],"sourcesContent":["export type BaseThemeType = 'dark' | 'light';\nexport type BaseThemeKey = `default-${BaseThemeType}`;\nexport type CssVariableStyleContent = `:root{${string}`;\nexport type ThemeCssVariableName = `--dh-${string}`;\nexport type ThemeCssColorVariableName = `--dh-color-${string}`;\n\n// DHC should only need to preload variables that are required by the empty page\n// with loading spinner that shows while plugins are loading. The rest of the\n// preload variables defined here are required by DHE due to theme plugins\n// loading after login. We should consider moving most of these to the DHE\n// codebase. To be addressed by #1679\nexport type ThemePreloadColorVariable =\n | '--dh-color-accent-contrast'\n | '--dh-color-accent-bg'\n | '--dh-color-accent-hover-bg'\n | '--dh-color-accent-down-bg'\n | '--dh-color-accent-key-focus-bg'\n | '--dh-color-negative-bg'\n | '--dh-color-loading-spinner-primary'\n | '--dh-color-loading-spinner-secondary'\n | '--dh-color-bg'\n | '--dh-color-fg'\n | '--dh-color-input-bg'\n | '--dh-color-input-fg'\n | '--dh-color-input-disabled-bg'\n | '--dh-color-input-border'\n | '--dh-color-input-placeholder'\n | '--dh-color-input-focus-border'\n | '--dh-color-text-highlight'\n | '--dh-color-login-form-bg'\n | '--dh-color-login-status-message'\n | '--dh-color-login-logo-bg'\n | '--dh-color-login-footer-fg'\n | '--dh-color-random-area-plot-animation-fg-fill'\n | '--dh-color-random-area-plot-animation-fg-stroke'\n | '--dh-color-random-area-plot-animation-bg'\n | '--dh-color-random-area-plot-animation-grid';\n\nexport type ThemeIconsRequiringManualColorChanges =\n | '--dh-svg-icon-select-indicator'\n | '--dh-svg-icon-select-indicator-hover'\n | '--dh-svg-icon-select-indicator-disabled'\n | '--dh-svg-icon-error';\n\nexport const DEFAULT_DARK_THEME_KEY = 'default-dark' satisfies BaseThemeKey;\nexport const DEFAULT_LIGHT_THEME_KEY = 'default-light' satisfies BaseThemeKey;\nexport const EXTERNAL_THEME_KEY = 'external-theme' as const;\nexport const MSG_REQUEST_GET_THEME =\n 'io.deephaven.message.ThemeModel.requestExternalTheme';\nexport const MSG_REQUEST_SET_THEME =\n 'io.deephaven.message.ThemeModel.requestSetTheme';\nexport const PRELOAD_TRANSPARENT_THEME_QUERY_PARAM =\n 'preloadTransparentTheme' as const;\nexport const THEME_KEY_OVERRIDE_QUERY_PARAM = 'theme' as const;\n\n// Hex versions of some of the default dark theme color palette needed for\n// preload defaults.\nexport const DEFAULT_DARK_THEME_PALETTE = {\n blue: {\n 500: '#2f5bc0',\n 400: '#254ba4',\n 600: '#3b6bda', // accent color\n 700: '#4c7dee',\n },\n red: {\n 600: '#c73f61',\n },\n gray: {\n 50: '#1a171a',\n 75: '#211f22',\n 300: '#373438',\n 400: '#403e41',\n 500: '#5b5a5c',\n 600: '#929192',\n 700: '#c0bfbf',\n 800: '#f0f0ee',\n 900: '#fcfcfa',\n },\n} as const;\n\n// Css properties that are used in preload data with default values.\n// DHC should only need to preload variables that are required by the empty page\n// with loading spinner that shows while plugins are loading. The rest of the\n// preload variables defined here are required by DHE due to theme plugins\n// loading after login. We should consider moving most of these to the DHE\n// codebase. To be addressed by #1679\nexport const DEFAULT_PRELOAD_DATA_VARIABLES: Record<\n ThemePreloadColorVariable,\n string\n> = {\n '--dh-color-accent-contrast': DEFAULT_DARK_THEME_PALETTE.gray[900],\n '--dh-color-accent-bg': DEFAULT_DARK_THEME_PALETTE.blue[600],\n '--dh-color-accent-hover-bg': DEFAULT_DARK_THEME_PALETTE.blue[500],\n '--dh-color-accent-down-bg': DEFAULT_DARK_THEME_PALETTE.blue[400],\n '--dh-color-accent-key-focus-bg': DEFAULT_DARK_THEME_PALETTE.blue[500],\n '--dh-color-negative-bg': DEFAULT_DARK_THEME_PALETTE.red[600],\n '--dh-color-loading-spinner-primary': DEFAULT_DARK_THEME_PALETTE.blue[600],\n '--dh-color-loading-spinner-secondary': `${DEFAULT_DARK_THEME_PALETTE.gray[800]}80`, // 50% opacity\n '--dh-color-bg': DEFAULT_DARK_THEME_PALETTE.gray[50],\n '--dh-color-fg': DEFAULT_DARK_THEME_PALETTE.gray[800],\n '--dh-color-input-bg': DEFAULT_DARK_THEME_PALETTE.gray[500],\n '--dh-color-input-fg': DEFAULT_DARK_THEME_PALETTE.gray[800],\n '--dh-color-input-disabled-bg': DEFAULT_DARK_THEME_PALETTE.gray[300],\n '--dh-color-input-border': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-input-placeholder': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-input-focus-border': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}d9`, // 85% opacity\n '--dh-color-text-highlight': `${DEFAULT_DARK_THEME_PALETTE.blue[700]}4d`, // 30% opacity\n '--dh-color-login-form-bg': DEFAULT_DARK_THEME_PALETTE.gray[400],\n '--dh-color-login-status-message': DEFAULT_DARK_THEME_PALETTE.gray[600],\n '--dh-color-login-logo-bg': DEFAULT_DARK_THEME_PALETTE.gray[900],\n '--dh-color-login-footer-fg': DEFAULT_DARK_THEME_PALETTE.gray[700],\n '--dh-color-random-area-plot-animation-fg-fill': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}14`, // .08 opacity\n '--dh-color-random-area-plot-animation-fg-stroke': `${DEFAULT_DARK_THEME_PALETTE.blue[600]}33`, // .2 opacity\n '--dh-color-random-area-plot-animation-bg':\n DEFAULT_DARK_THEME_PALETTE.gray[75],\n '--dh-color-random-area-plot-animation-grid':\n DEFAULT_DARK_THEME_PALETTE.gray[300],\n};\n\nexport const TRANSPARENT_PRELOAD_DATA_VARIABLES: Partial<\n Record<ThemePreloadColorVariable, string>\n> = {\n '--dh-color-bg': 'transparent',\n '--dh-color-loading-spinner-primary': 'transparent',\n '--dh-color-loading-spinner-secondary': 'transparent',\n};\n\n/**\n * Some inline SVGs require manually updating their fill color via\n * `updateSVGFillColors`. This object maps these variables to their respective\n * fill color variables.\n */\nexport const SVG_ICON_MANUAL_COLOR_MAP: Record<\n ThemeIconsRequiringManualColorChanges,\n string\n> = {\n '--dh-svg-icon-select-indicator': '--dh-color-selector-fg',\n '--dh-svg-icon-select-indicator-hover': '--dh-color-selector-hover-fg',\n '--dh-svg-icon-select-indicator-disabled': '--dh-color-selector-disabled-fg',\n '--dh-svg-icon-error': '--dh-color-form-control-error',\n};\n\nexport const THEME_CACHE_LOCAL_STORAGE_KEY = 'deephaven.themeCache';\n\nexport interface ThemePreloadData {\n themeKey: string;\n preloadStyleContent?: CssVariableStyleContent;\n}\n\nexport interface ThemeData {\n baseThemeKey?: BaseThemeKey;\n themeKey: string;\n name: string;\n styleContent: string;\n}\n\nexport interface ThemeRegistrationData {\n base: ThemeData[];\n custom: ThemeData[];\n}\n\nexport interface ExternalThemeData {\n baseThemeKey?: BaseThemeKey;\n name: string;\n cssVars: Record<ThemeCssColorVariableName, string>;\n}\n"],"mappings":"AAMA;AACA;AACA;AACA;AACA;;AAkCA,OAAO,IAAMA,sBAAsB,GAAG,cAAqC;AAC3E,OAAO,IAAMC,uBAAuB,GAAG,eAAsC;AAC7E,OAAO,IAAMC,kBAAkB,GAAG,gBAAyB;AAC3D,OAAO,IAAMC,qBAAqB,GAChC,sDAAsD;AACxD,OAAO,IAAMC,qBAAqB,GAChC,iDAAiD;AACnD,OAAO,IAAMC,qCAAqC,GAChD,yBAAkC;AACpC,OAAO,IAAMC,8BAA8B,GAAG,OAAgB;;AAE9D;AACA;AACA,OAAO,IAAMC,0BAA0B,GAAG;EACxCC,IAAI,EAAE;IACJ,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IAAE;IAChB,GAAG,EAAE;EACP,CAAC;EACDC,GAAG,EAAE;IACH,GAAG,EAAE;EACP,CAAC;EACDC,IAAI,EAAE;IACJ,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE;EACP;AACF,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,8BAGZ,GAAG;EACF,4BAA4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A0B,CAACG,IAAI,CAAC,GAAG,CAAC;EAChE,4BAA4B,EAAEH,0BAA0B,CAACG,IAAI,CAAC,GAAG,CAAC;EAClE,+CAA+C,KAAAE,MAAA,CAAKL,0BAA0B,CAACC,IAAI,CAAC,GAAG,CAAC,OAAI;EAAE;EAC9F,iDAAiD,KAAAI,MAAA,CAAKL,0BAA0B,CAACC,IAAI,CAAC,GAAG,CAAC,OAAI;EAAE;EAChG,0CAA0C,EACxCD,0BAA0B,CAACG,IAAI,CAAC,EAAE,CAAC;EACrC,4CAA4C,EAC1CH,0BAA0B,CAACG,IAAI,CAAC,GAAG;AACvC,CAAC;AAED,OAAO,IAAMG,kCAEZ,GAAG;EACF,eAAe,EAAE,aAAa;EAC9B,oCAAoC,EAAE,aAAa;EACnD,sCAAsC,EAAE;AAC1C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,yBAGZ,GAAG;EACF,gCAAgC,EAAE,wBAAwB;EAC1D,sCAAsC,EAAE,8BAA8B;EACtE,yCAAyC,EAAE,iCAAiC;EAC5E,qBAAqB,EAAE;AACzB,CAAC;AAED,OAAO,IAAMC,6BAA6B,GAAG,sBAAsB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../src/theme/ThemePicker.tsx"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAoBhD;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ThemePicker.d.ts","sourceRoot":"","sources":["../../src/theme/ThemePicker.tsx"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAsBhD;AAED,eAAe,WAAW,CAAC"}
@@ -9,7 +9,9 @@ export function ThemePicker() {
9
9
  themes
10
10
  } = useTheme();
11
11
  var onSelectionChange = useCallback(key => {
12
- setSelectedThemeKey(key);
12
+ if (key != null) {
13
+ setSelectedThemeKey("".concat(key));
14
+ }
13
15
  }, [setSelectedThemeKey]);
14
16
  return /*#__PURE__*/_jsx(Picker, {
15
17
  label: "Pick a color scheme",
@@ -1 +1 @@
1
- {"version":3,"file":"ThemePicker.js","names":["useCallback","Item","Picker","useTheme","jsx","_jsx","ThemePicker","selectedThemeKey","setSelectedThemeKey","themes","onSelectionChange","key","label","items","selectedKey","children","item","name","themeKey"],"sources":["../../src/theme/ThemePicker.tsx"],"sourcesContent":["import { type Key, useCallback } from 'react';\nimport { Item, Picker } from '@adobe/react-spectrum';\nimport useTheme from './useTheme';\n\nexport function ThemePicker(): JSX.Element | null {\n const { selectedThemeKey, setSelectedThemeKey, themes } = useTheme();\n\n const onSelectionChange = useCallback(\n (key: Key) => {\n setSelectedThemeKey(key as string);\n },\n [setSelectedThemeKey]\n );\n\n return (\n <Picker\n label=\"Pick a color scheme\"\n items={themes}\n selectedKey={selectedThemeKey}\n onSelectionChange={onSelectionChange}\n >\n {item => <Item key={item.themeKey}>{item.name}</Item>}\n </Picker>\n );\n}\n\nexport default ThemePicker;\n"],"mappings":"AAAA,SAAmBA,WAAW,QAAQ,OAAO;AAC7C,SAASC,IAAI,EAAEC,MAAM,QAAQ,uBAAuB;AAAC,OAC9CC,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEf,OAAO,SAASC,WAAWA,CAAA,EAAuB;EAChD,IAAM;IAAEC,gBAAgB;IAAEC,mBAAmB;IAAEC;EAAO,CAAC,GAAGN,QAAQ,CAAC,CAAC;EAEpE,IAAMO,iBAAiB,GAAGV,WAAW,CAClCW,GAAQ,IAAK;IACZH,mBAAmB,CAACG,GAAa,CAAC;EACpC,CAAC,EACD,CAACH,mBAAmB,CACtB,CAAC;EAED,oBACEH,IAAA,CAACH,MAAM;IACLU,KAAK,EAAC,qBAAqB;IAC3BC,KAAK,EAAEJ,MAAO;IACdK,WAAW,EAAEP,gBAAiB;IAC9BG,iBAAiB,EAAEA,iBAAkB;IAAAK,QAAA,EAEpCC,IAAI,iBAAIX,IAAA,CAACJ,IAAI;MAAAc,QAAA,EAAsBC,IAAI,CAACC;IAAI,GAAzBD,IAAI,CAACE,QAA2B;EAAC,CAC/C,CAAC;AAEb;AAEA,eAAeZ,WAAW"}
1
+ {"version":3,"file":"ThemePicker.js","names":["useCallback","Item","Picker","useTheme","jsx","_jsx","ThemePicker","selectedThemeKey","setSelectedThemeKey","themes","onSelectionChange","key","concat","label","items","selectedKey","children","item","name","themeKey"],"sources":["../../src/theme/ThemePicker.tsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { Item, Picker } from '@adobe/react-spectrum';\nimport type { Key } from '@react-types/shared';\nimport useTheme from './useTheme';\n\nexport function ThemePicker(): JSX.Element | null {\n const { selectedThemeKey, setSelectedThemeKey, themes } = useTheme();\n\n const onSelectionChange = useCallback(\n (key: Key | null) => {\n if (key != null) {\n setSelectedThemeKey(`${key}`);\n }\n },\n [setSelectedThemeKey]\n );\n\n return (\n <Picker\n label=\"Pick a color scheme\"\n items={themes}\n selectedKey={selectedThemeKey}\n onSelectionChange={onSelectionChange}\n >\n {item => <Item key={item.themeKey}>{item.name}</Item>}\n </Picker>\n );\n}\n\nexport default ThemePicker;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,IAAI,EAAEC,MAAM,QAAQ,uBAAuB;AAAC,OAE9CC,QAAQ;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEf,OAAO,SAASC,WAAWA,CAAA,EAAuB;EAChD,IAAM;IAAEC,gBAAgB;IAAEC,mBAAmB;IAAEC;EAAO,CAAC,GAAGN,QAAQ,CAAC,CAAC;EAEpE,IAAMO,iBAAiB,GAAGV,WAAW,CAClCW,GAAe,IAAK;IACnB,IAAIA,GAAG,IAAI,IAAI,EAAE;MACfH,mBAAmB,IAAAI,MAAA,CAAID,GAAG,CAAE,CAAC;IAC/B;EACF,CAAC,EACD,CAACH,mBAAmB,CACtB,CAAC;EAED,oBACEH,IAAA,CAACH,MAAM;IACLW,KAAK,EAAC,qBAAqB;IAC3BC,KAAK,EAAEL,MAAO;IACdM,WAAW,EAAER,gBAAiB;IAC9BG,iBAAiB,EAAEA,iBAAkB;IAAAM,QAAA,EAEpCC,IAAI,iBAAIZ,IAAA,CAACJ,IAAI;MAAAe,QAAA,EAAsBC,IAAI,CAACC;IAAI,GAAzBD,IAAI,CAACE,QAA2B;EAAC,CAC/C,CAAC;AAEb;AAEA,eAAeb,WAAW","ignoreList":[]}
@@ -4,9 +4,7 @@ import { DEFAULT_PRELOAD_DATA_VARIABLES } from "./ThemeModel.js";
4
4
  import { calculatePreloadStyleContent, getActiveThemes, getDefaultBaseThemes, setThemePreloadData, overrideSVGFillColors, getDefaultSelectedThemeKey } from "./ThemeUtils.js";
5
5
  import { SpectrumThemeProvider } from "./SpectrumThemeProvider.js";
6
6
  import "./theme-svg.css";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- import { Fragment as _Fragment } from "react/jsx-runtime";
9
- import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
8
  var log = Log.module('ThemeProvider');
11
9
  export var ThemeContext = /*#__PURE__*/createContext(null);
12
10
  ThemeContext.displayName = 'ThemeContext';