@deephaven/components 1.22.1-alpha-pivot-builder.0 → 1.22.2-alpha-pivot-builder.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/AutoCompleteInput.js +41 -79
  2. package/dist/AutoCompleteInput.js.map +1 -1
  3. package/dist/AutoResizeTextarea.js +29 -13
  4. package/dist/AutoResizeTextarea.js.map +1 -1
  5. package/dist/BasicModal.js +17 -15
  6. package/dist/BasicModal.js.map +1 -1
  7. package/dist/BulkActionBar.js +3 -5
  8. package/dist/BulkActionBar.js.map +1 -1
  9. package/dist/Button.js +24 -25
  10. package/dist/Button.js.map +1 -1
  11. package/dist/CardFlip.js +4 -6
  12. package/dist/CardFlip.js.map +1 -1
  13. package/dist/Checkbox.js +22 -13
  14. package/dist/Checkbox.js.map +1 -1
  15. package/dist/Collapse.js +6 -9
  16. package/dist/Collapse.js.map +1 -1
  17. package/dist/CopyButton.js +14 -6
  18. package/dist/CopyButton.js.map +1 -1
  19. package/dist/CustomTimeSelect.js +49 -88
  20. package/dist/CustomTimeSelect.js.map +1 -1
  21. package/dist/DateInput.js +25 -10
  22. package/dist/DateInput.js.map +1 -1
  23. package/dist/DateInputUtils.js +1 -3
  24. package/dist/DateInputUtils.js.map +1 -1
  25. package/dist/DateTimeInput.js +28 -12
  26. package/dist/DateTimeInput.js.map +1 -1
  27. package/dist/DebouncedSearchInput.js +10 -19
  28. package/dist/DebouncedSearchInput.js.map +1 -1
  29. package/dist/DragUtils.js +15 -6
  30. package/dist/DragUtils.js.map +1 -1
  31. package/dist/DraggableItemList.js +42 -57
  32. package/dist/DraggableItemList.js.map +1 -1
  33. package/dist/EditableItemList.js +28 -13
  34. package/dist/EditableItemList.js.map +1 -1
  35. package/dist/ErrorBoundary.js +6 -11
  36. package/dist/ErrorBoundary.js.map +1 -1
  37. package/dist/ErrorView.js +20 -8
  38. package/dist/ErrorView.js.map +1 -1
  39. package/dist/HierarchicalCheckboxMenu.js +30 -28
  40. package/dist/HierarchicalCheckboxMenu.js.map +1 -1
  41. package/dist/ItemList.js +96 -168
  42. package/dist/ItemList.js.map +1 -1
  43. package/dist/ItemListItem.js +46 -60
  44. package/dist/ItemListItem.js.map +1 -1
  45. package/dist/LoadingOverlay.js +13 -9
  46. package/dist/LoadingOverlay.js.map +1 -1
  47. package/dist/LoadingSpinner.js +3 -4
  48. package/dist/LoadingSpinner.js.map +1 -1
  49. package/dist/MaskedInput.js +44 -41
  50. package/dist/MaskedInput.js.map +1 -1
  51. package/dist/MaskedInputUtils.js +1 -3
  52. package/dist/MaskedInputUtils.js.map +1 -1
  53. package/dist/Option.js +1 -3
  54. package/dist/Option.js.map +1 -1
  55. package/dist/RadioGroup.js +17 -9
  56. package/dist/RadioGroup.js.map +1 -1
  57. package/dist/RadioItem.js +25 -14
  58. package/dist/RadioItem.js.map +1 -1
  59. package/dist/RandomAreaPlotAnimation.js +17 -13
  60. package/dist/RandomAreaPlotAnimation.js.map +1 -1
  61. package/dist/SearchInput.js +13 -14
  62. package/dist/SearchInput.js.map +1 -1
  63. package/dist/SearchableCombobox.js +3 -5
  64. package/dist/SearchableCombobox.js.map +1 -1
  65. package/dist/Select.js +5 -7
  66. package/dist/Select.js.map +1 -1
  67. package/dist/SelectValueList.js +21 -30
  68. package/dist/SelectValueList.js.map +1 -1
  69. package/dist/SocketedButton.js +18 -17
  70. package/dist/SocketedButton.js.map +1 -1
  71. package/dist/SplitButtonGroup.js +4 -6
  72. package/dist/SplitButtonGroup.js.map +1 -1
  73. package/dist/TableViewEmptyState.js +14 -6
  74. package/dist/TableViewEmptyState.js.map +1 -1
  75. package/dist/TextWithTooltip.js +3 -4
  76. package/dist/TextWithTooltip.js.map +1 -1
  77. package/dist/TimeInput.js +29 -12
  78. package/dist/TimeInput.js.map +1 -1
  79. package/dist/TimeSlider.js +46 -38
  80. package/dist/TimeSlider.js.map +1 -1
  81. package/dist/ToastNotification.js +9 -10
  82. package/dist/ToastNotification.js.map +1 -1
  83. package/dist/UISwitch.js +8 -9
  84. package/dist/UISwitch.js.map +1 -1
  85. package/dist/actions/ConfirmActionButton.js +7 -9
  86. package/dist/actions/ConfirmActionButton.js.map +1 -1
  87. package/dist/actions/IconActionButton.js +3 -5
  88. package/dist/actions/IconActionButton.js.map +1 -1
  89. package/dist/context-actions/ContextActionUtils.js +1 -3
  90. package/dist/context-actions/ContextActionUtils.js.map +1 -1
  91. package/dist/context-actions/ContextActions.js +8 -18
  92. package/dist/context-actions/ContextActions.js.map +1 -1
  93. package/dist/context-actions/ContextMenu.js +53 -89
  94. package/dist/context-actions/ContextMenu.js.map +1 -1
  95. package/dist/context-actions/ContextMenuItem.js +11 -11
  96. package/dist/context-actions/ContextMenuItem.js.map +1 -1
  97. package/dist/context-actions/ContextMenuRoot.js +6 -11
  98. package/dist/context-actions/ContextMenuRoot.js.map +1 -1
  99. package/dist/context-actions/GlobalContextAction.js +2 -6
  100. package/dist/context-actions/GlobalContextAction.js.map +1 -1
  101. package/dist/context-actions/GlobalContextActions.js +4 -7
  102. package/dist/context-actions/GlobalContextActions.js.map +1 -1
  103. package/dist/dialogs/ActionButtonDialogTrigger.js +7 -9
  104. package/dist/dialogs/ActionButtonDialogTrigger.js.map +1 -1
  105. package/dist/dialogs/ConfirmationDialog.js +8 -11
  106. package/dist/dialogs/ConfirmationDialog.js.map +1 -1
  107. package/dist/menu-actions/DropdownMenu.js +12 -22
  108. package/dist/menu-actions/DropdownMenu.js.map +1 -1
  109. package/dist/menu-actions/Menu.js +19 -45
  110. package/dist/menu-actions/Menu.js.map +1 -1
  111. package/dist/modal/DebouncedModal.js +8 -9
  112. package/dist/modal/DebouncedModal.js.map +1 -1
  113. package/dist/modal/InfoModal.js +6 -7
  114. package/dist/modal/InfoModal.js.map +1 -1
  115. package/dist/modal/Modal.js +27 -15
  116. package/dist/modal/Modal.js.map +1 -1
  117. package/dist/modal/ModalBody.js +4 -6
  118. package/dist/modal/ModalBody.js.map +1 -1
  119. package/dist/modal/ModalFooter.js +3 -5
  120. package/dist/modal/ModalFooter.js.map +1 -1
  121. package/dist/modal/ModalHeader.js +7 -8
  122. package/dist/modal/ModalHeader.js.map +1 -1
  123. package/dist/navigation/DashboardList.js +17 -6
  124. package/dist/navigation/DashboardList.js.map +1 -1
  125. package/dist/navigation/Menu.js +4 -5
  126. package/dist/navigation/Menu.js.map +1 -1
  127. package/dist/navigation/MenuItem.js +7 -10
  128. package/dist/navigation/MenuItem.js.map +1 -1
  129. package/dist/navigation/NavTab.js +14 -17
  130. package/dist/navigation/NavTab.js.map +1 -1
  131. package/dist/navigation/NavTabList.js +39 -33
  132. package/dist/navigation/NavTabList.js.map +1 -1
  133. package/dist/navigation/Page.js +5 -7
  134. package/dist/navigation/Page.js.map +1 -1
  135. package/dist/navigation/Stack.js +20 -7
  136. package/dist/navigation/Stack.js.map +1 -1
  137. package/dist/popper/Popper.js +30 -57
  138. package/dist/popper/Popper.js.map +1 -1
  139. package/dist/popper/Tooltip.js +24 -54
  140. package/dist/popper/Tooltip.js.map +1 -1
  141. package/dist/shortcuts/Shortcut.js +10 -15
  142. package/dist/shortcuts/Shortcut.js.map +1 -1
  143. package/dist/shortcuts/ShortcutRegistry.js +1 -3
  144. package/dist/shortcuts/ShortcutRegistry.js.map +1 -1
  145. package/dist/spectrum/ActionGroup.js +7 -9
  146. package/dist/spectrum/ActionGroup.js.map +1 -1
  147. package/dist/spectrum/ActionMenu.js +3 -5
  148. package/dist/spectrum/ActionMenu.js.map +1 -1
  149. package/dist/spectrum/CheckboxGroup.js +1 -3
  150. package/dist/spectrum/CheckboxGroup.js.map +1 -1
  151. package/dist/spectrum/Heading.js +2 -4
  152. package/dist/spectrum/Heading.js.map +1 -1
  153. package/dist/spectrum/ItemContent.js +16 -10
  154. package/dist/spectrum/ItemContent.js.map +1 -1
  155. package/dist/spectrum/ItemTooltip.js +2 -4
  156. package/dist/spectrum/ItemTooltip.js.map +1 -1
  157. package/dist/spectrum/TabPanels.js +3 -4
  158. package/dist/spectrum/TabPanels.js.map +1 -1
  159. package/dist/spectrum/Text.js +2 -4
  160. package/dist/spectrum/Text.js.map +1 -1
  161. package/dist/spectrum/View.js +11 -14
  162. package/dist/spectrum/View.js.map +1 -1
  163. package/dist/spectrum/comboBox/ComboBox.js +5 -9
  164. package/dist/spectrum/comboBox/ComboBox.js.map +1 -1
  165. package/dist/spectrum/comboBox/ComboBoxNormalized.js +3 -7
  166. package/dist/spectrum/comboBox/ComboBoxNormalized.js.map +1 -1
  167. package/dist/spectrum/listView/ListView.js +11 -11
  168. package/dist/spectrum/listView/ListView.js.map +1 -1
  169. package/dist/spectrum/listView/ListViewNormalized.js +22 -24
  170. package/dist/spectrum/listView/ListViewNormalized.js.map +1 -1
  171. package/dist/spectrum/listView/ListViewWrapper.js +11 -15
  172. package/dist/spectrum/listView/ListViewWrapper.js.map +1 -1
  173. package/dist/spectrum/multiSelect/MultiSelect.js +113 -100
  174. package/dist/spectrum/multiSelect/MultiSelect.js.map +1 -1
  175. package/dist/spectrum/multiSelect/MultiSelectListBox.js +9 -11
  176. package/dist/spectrum/multiSelect/MultiSelectListBox.js.map +1 -1
  177. package/dist/spectrum/multiSelect/MultiSelectNormalized.js +3 -7
  178. package/dist/spectrum/multiSelect/MultiSelectNormalized.js.map +1 -1
  179. package/dist/spectrum/multiSelect/MultiSelectTag.js +5 -7
  180. package/dist/spectrum/multiSelect/MultiSelectTag.js.map +1 -1
  181. package/dist/spectrum/multiSelect/useMultiSelectFilter.js +20 -14
  182. package/dist/spectrum/multiSelect/useMultiSelectFilter.js.map +1 -1
  183. package/dist/spectrum/multiSelect/useMultiSelectKeyboard.js +27 -20
  184. package/dist/spectrum/multiSelect/useMultiSelectKeyboard.js.map +1 -1
  185. package/dist/spectrum/multiSelect/useMultiSelectLoadingSpinner.js +14 -7
  186. package/dist/spectrum/multiSelect/useMultiSelectLoadingSpinner.js.map +1 -1
  187. package/dist/spectrum/multiSelect/useMultiSelectNormalizedProps.js +20 -22
  188. package/dist/spectrum/multiSelect/useMultiSelectNormalizedProps.js.map +1 -1
  189. package/dist/spectrum/multiSelect/useMultiSelectScrollListener.js +13 -6
  190. package/dist/spectrum/multiSelect/useMultiSelectScrollListener.js.map +1 -1
  191. package/dist/spectrum/multiSelect/useMultiSelectState.js +16 -9
  192. package/dist/spectrum/multiSelect/useMultiSelectState.js.map +1 -1
  193. package/dist/spectrum/picker/Picker.js +5 -9
  194. package/dist/spectrum/picker/Picker.js.map +1 -1
  195. package/dist/spectrum/picker/PickerNormalized.js +2 -6
  196. package/dist/spectrum/picker/PickerNormalized.js.map +1 -1
  197. package/dist/spectrum/picker/usePickerItemScale.js +2 -3
  198. package/dist/spectrum/picker/usePickerItemScale.js.map +1 -1
  199. package/dist/spectrum/picker/usePickerNormalizedProps.js +31 -33
  200. package/dist/spectrum/picker/usePickerNormalizedProps.js.map +1 -1
  201. package/dist/spectrum/picker/usePickerProps.js +26 -29
  202. package/dist/spectrum/picker/usePickerProps.js.map +1 -1
  203. package/dist/spectrum/picker/usePickerScrollOnOpen.js +6 -9
  204. package/dist/spectrum/picker/usePickerScrollOnOpen.js.map +1 -1
  205. package/dist/spectrum/utils/itemUtils.js +4 -6
  206. package/dist/spectrum/utils/itemUtils.js.map +1 -1
  207. package/dist/spectrum/utils/propsUtils.js +35 -37
  208. package/dist/spectrum/utils/propsUtils.js.map +1 -1
  209. package/dist/spectrum/utils/themeUtils.js +5 -7
  210. package/dist/spectrum/utils/themeUtils.js.map +1 -1
  211. package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js +13 -6
  212. package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js.map +1 -1
  213. package/dist/spectrum/utils/useRenderNormalizedItem.js +5 -7
  214. package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -1
  215. package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js +4 -6
  216. package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js.map +1 -1
  217. package/dist/spectrum/utils/useStringifiedMultiSelection.js +5 -7
  218. package/dist/spectrum/utils/useStringifiedMultiSelection.js.map +1 -1
  219. package/dist/spectrum/utils/useStringifiedSelection.js +5 -7
  220. package/dist/spectrum/utils/useStringifiedSelection.js.map +1 -1
  221. package/dist/theme/FontBootstrap.js +13 -5
  222. package/dist/theme/FontBootstrap.js.map +1 -1
  223. package/dist/theme/FontsLoaded.js +1 -3
  224. package/dist/theme/FontsLoaded.js.map +1 -1
  225. package/dist/theme/Logo.js +2 -4
  226. package/dist/theme/Logo.js.map +1 -1
  227. package/dist/theme/SpectrumThemeProvider.js +17 -9
  228. package/dist/theme/SpectrumThemeProvider.js.map +1 -1
  229. package/dist/theme/ThemePicker.js +4 -5
  230. package/dist/theme/ThemePicker.js.map +1 -1
  231. package/dist/theme/ThemeProvider.js +20 -8
  232. package/dist/theme/ThemeProvider.js.map +1 -1
  233. package/dist/theme/ThemeUtils.js +35 -19
  234. package/dist/theme/ThemeUtils.js.map +1 -1
  235. package/dist/theme/useExternalTheme.js +16 -7
  236. package/dist/theme/useExternalTheme.js.map +1 -1
  237. package/dist/transitions/FadeTransition.js +5 -6
  238. package/dist/transitions/FadeTransition.js.map +1 -1
  239. package/dist/transitions/SlideTransition.js +6 -7
  240. package/dist/transitions/SlideTransition.js.map +1 -1
  241. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"usePickerScrollOnOpen.js","names":["useCallback","findSpectrumPickerScrollArea","usePopoverOnScrollRef","usePickerScrollOnOpen","_ref","getInitialScrollPosition","onScroll","onOpenChange","ref","popoverOnOpenChange","onOpenChangeInternal","isOpen","menuTrigger"],"sources":["../../../src/spectrum/picker/usePickerScrollOnOpen.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport type { DOMRef } from '@react-types/shared';\nimport {\n findSpectrumPickerScrollArea,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport type { MenuTriggerAction } from '../comboBox';\n\nexport interface UsePickerScrollOnOpenOptions {\n getInitialScrollPosition?: () => Promise<number | null | undefined>;\n onScroll: (event: Event) => void;\n onOpenChange?: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;\n}\n\nexport interface UsePickerScrollOnOpenResult<THtml extends HTMLElement> {\n ref: DOMRef<THtml>;\n onOpenChange: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;\n}\n\n/**\n * Handle scroll event registration and scrolling to initial scroll position\n * whenever a Picker popover is opened.\n * @param getInitialScrollPosition Function to get the initial scroll position.\n * @param onScroll Callback for scroll events.\n * @param onOpenChange Callback for open change events.\n * @return A ref to attach to the Picker and a callback to handle open change\n * events for the Picker.\n */\nexport function usePickerScrollOnOpen<THtml extends HTMLElement = HTMLElement>({\n getInitialScrollPosition,\n onScroll,\n onOpenChange,\n}: UsePickerScrollOnOpenOptions): UsePickerScrollOnOpenResult<THtml> {\n const { ref, onOpenChange: popoverOnOpenChange } = usePopoverOnScrollRef(\n findSpectrumPickerScrollArea<THtml>,\n onScroll,\n getInitialScrollPosition\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean, menuTrigger?: MenuTriggerAction): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen, menuTrigger);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n return {\n ref,\n onOpenChange: onOpenChangeInternal,\n };\n}\n\nexport default usePickerScrollOnOpen;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AAEnC,SACEC,4BAA4B,EAC5BC,qBAAqB,QAChB,wBAAwB;AAc/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAIgC;EAAA,IAJU;IAC7EC,wBAAwB;IACxBC,QAAQ;IACRC;EAC4B,CAAC,GAAAH,IAAA;EAC7B,IAAM;IAAEI,GAAG;IAAED,YAAY,EAAEE;EAAoB,CAAC,GAAGP,qBAAqB,CACtED,4BAA4B,EAC5BK,QAAQ,EACRD,wBACF,CAAC;EAED,IAAMK,oBAAoB,GAAGV,WAAW,CACtC,CAACW,MAAe,EAAEC,WAA+B,KAAW;IAC1D;IACAH,mBAAmB,CAACE,MAAM,CAAC;IAE3BJ,YAAY,aAAZA,YAAY,eAAZA,YAAY,CAAGI,MAAM,EAAEC,WAAW,CAAC;EACrC,CAAC,EACD,CAACL,YAAY,EAAEE,mBAAmB,CACpC,CAAC;EAED,OAAO;IACLD,GAAG;IACHD,YAAY,EAAEG;EAChB,CAAC;AACH;AAEA,eAAeP,qBAAqB","ignoreList":[]}
1
+ {"version":3,"file":"usePickerScrollOnOpen.js","names":["useCallback","findSpectrumPickerScrollArea","usePopoverOnScrollRef","usePickerScrollOnOpen","_ref","getInitialScrollPosition","onScroll","onOpenChange","_usePopoverOnScrollRe","ref","popoverOnOpenChange","onOpenChangeInternal","isOpen","menuTrigger"],"sources":["../../../src/spectrum/picker/usePickerScrollOnOpen.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport type { DOMRef } from '@react-types/shared';\nimport {\n findSpectrumPickerScrollArea,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport type { MenuTriggerAction } from '../comboBox';\n\nexport interface UsePickerScrollOnOpenOptions {\n getInitialScrollPosition?: () => Promise<number | null | undefined>;\n onScroll: (event: Event) => void;\n onOpenChange?: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;\n}\n\nexport interface UsePickerScrollOnOpenResult<THtml extends HTMLElement> {\n ref: DOMRef<THtml>;\n onOpenChange: (isOpen: boolean, menuTrigger?: MenuTriggerAction) => void;\n}\n\n/**\n * Handle scroll event registration and scrolling to initial scroll position\n * whenever a Picker popover is opened.\n * @param getInitialScrollPosition Function to get the initial scroll position.\n * @param onScroll Callback for scroll events.\n * @param onOpenChange Callback for open change events.\n * @return A ref to attach to the Picker and a callback to handle open change\n * events for the Picker.\n */\nexport function usePickerScrollOnOpen<THtml extends HTMLElement = HTMLElement>({\n getInitialScrollPosition,\n onScroll,\n onOpenChange,\n}: UsePickerScrollOnOpenOptions): UsePickerScrollOnOpenResult<THtml> {\n const { ref, onOpenChange: popoverOnOpenChange } = usePopoverOnScrollRef(\n findSpectrumPickerScrollArea<THtml>,\n onScroll,\n getInitialScrollPosition\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean, menuTrigger?: MenuTriggerAction): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen, menuTrigger);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n return {\n ref,\n onOpenChange: onOpenChangeInternal,\n };\n}\n\nexport default usePickerScrollOnOpen;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AAEnC,SACEC,4BAA4B,EAC5BC,qBAAqB,QAChB,wBAAwB;AAc/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAAC,IAAA,EAIgC;EAAA,IAHnEC,wBAAwB,GAAAD,IAAA,CAAxBC,wBAAwB;IACxBC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,YAAY,GAAAH,IAAA,CAAZG,YAAY;EAEZ,IAAAC,qBAAA,GAAmDN,qBAAqB,CACtED,4BAA4B,EAC5BK,QAAQ,EACRD,wBACF,CAAC;IAJOI,GAAG,GAAAD,qBAAA,CAAHC,GAAG;IAAgBC,mBAAmB,GAAAF,qBAAA,CAAjCD,YAAY;EAMzB,IAAMI,oBAAoB,GAAGX,WAAW,CACtC,CAACY,MAAe,EAAEC,WAA+B,KAAW;IAC1D;IACAH,mBAAmB,CAACE,MAAM,CAAC;IAE3BL,YAAY,aAAZA,YAAY,eAAZA,YAAY,CAAGK,MAAM,EAAEC,WAAW,CAAC;EACrC,CAAC,EACD,CAACN,YAAY,EAAEG,mBAAmB,CACpC,CAAC;EAED,OAAO;IACLD,GAAG;IACHF,YAAY,EAAEI;EAChB,CAAC;AACH;AAEA,eAAeR,qBAAqB","ignoreList":[]}
@@ -89,12 +89,10 @@ export function getPositionOfSelectedItemElement(_x) {
89
89
  */
90
90
  function _getPositionOfSelectedItemElement() {
91
91
  _getPositionOfSelectedItemElement = _asyncToGenerator(function* (_ref) {
92
- var {
93
- items,
94
- itemHeight,
95
- selectedKey,
96
- topOffset
97
- } = _ref;
92
+ var items = _ref.items,
93
+ itemHeight = _ref.itemHeight,
94
+ selectedKey = _ref.selectedKey,
95
+ topOffset = _ref.topOffset;
98
96
  var position = topOffset;
99
97
  if (selectedKey == null) {
100
98
  return position;
@@ -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 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;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C,GAAA5B,SAAA,CAAAS,MAAA,QAAAT,SAAA,QAAAR,SAAA,GAAAQ,SAAA,MAAG,OAAO;EAEhD,IAAI2B,OAAO,IAAI,IAAI,IAAIA,OAAO,KAAK,KAAK,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,IAAIA,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO;MAAEC;IAAU,CAAC;EACtB;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,wBAAwBA,CAOtCC,QAAe,EAAW;EAC1B,IAAIA,QAAQ,IAAI,IAAI,IAAIA,QAAQ,KAAK,KAAK,EAAE;IAC1C,OAAOA,QAAQ;EACjB;EAEA,OAAO,IAAIC,GAAG,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAACE,GAAG,CAACvC,MAAM,CAAC,CAAC;AAC3C","ignoreList":[]}
1
+ {"version":3,"file":"itemUtils.js","names":["isElementOfType","ensureArray","Item","Section","Text","ItemContent","ITEM_EMPTY_STRING_TEXT_VALUE","getItemKey","item","_item$item$key","_item$item","key","getItemTextValue","props","textValue","itemKeyStr","undefined","String","includes","children","getPositionOfSelectedItemElement","_x","_getPositionOfSelectedItemElement","apply","arguments","_asyncToGenerator","_ref","items","itemHeight","selectedKey","topOffset","position","i","length","isSectionElement","node","isItemElement","isItemElementWithDescription","childrenArray","result","some","child","_child$props","slot","isNormalizedItemsWithKeysList","Array","isArray","isItemOrSection","isNormalizedSection","maybeNormalizedSection","normalizeTooltipOptions","options","placement","itemSelectionToStringSet","itemKeys","Set","map"],"sources":["../../../src/spectrum/utils/itemUtils.ts"],"sourcesContent":["import { type 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 TRes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AAO,SAASuC,eAAeA,CAACZ,IAAe,EAAyB;EACtE,OACE,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,SAAS,IACzBC,aAAa,CAACD,IAAI,CAAC,IACnBD,gBAAgB,CAACC,IAAI,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASe,uBAAuBA,CACrCC,OAAyC,EAElB;EAAA,IADvBC,SAAsC,GAAA5B,SAAA,CAAAS,MAAA,QAAAT,SAAA,QAAAR,SAAA,GAAAQ,SAAA,MAAG,OAAO;EAEhD,IAAI2B,OAAO,IAAI,IAAI,IAAIA,OAAO,KAAK,KAAK,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,IAAIA,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO;MAAEC;IAAU,CAAC;EACtB;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,wBAAwBA,CAOtCC,QAAe,EAAW;EAC1B,IAAIA,QAAQ,IAAI,IAAI,IAAIA,QAAQ,KAAK,KAAK,EAAE;IAC1C,OAAOA,QAAQ;EACjB;EAEA,OAAO,IAAIC,GAAG,CAAC,CAAC,GAAGD,QAAQ,CAAC,CAACE,GAAG,CAACvC,MAAM,CAAC,CAAC;AAC3C","ignoreList":[]}
@@ -8,43 +8,41 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
8
8
  * @returns The separated props
9
9
  */
10
10
  export function separateSpectrumProps(props) {
11
- var {
12
- 'aria-label': ariaLabel,
13
- 'aria-labelledby': ariaLabelledby,
14
- 'aria-describedby': ariaDescribedby,
15
- 'aria-details': ariaHidden,
16
- marginX,
17
- marginY,
18
- width,
19
- height,
20
- minWidth,
21
- minHeight,
22
- maxWidth,
23
- maxHeight,
24
- flex,
25
- flexGrow,
26
- flexShrink,
27
- flexBasis,
28
- justifySelf,
29
- alignSelf,
30
- order,
31
- gridArea,
32
- gridColumn,
33
- gridRow,
34
- gridColumnStart,
35
- gridColumnEnd,
36
- gridRowStart,
37
- gridRowEnd,
38
- position,
39
- zIndex,
40
- top,
41
- bottom,
42
- start,
43
- end,
44
- left,
45
- right,
46
- isHidden
47
- } = props,
11
+ var ariaLabel = props['aria-label'],
12
+ ariaLabelledby = props['aria-labelledby'],
13
+ ariaDescribedby = props['aria-describedby'],
14
+ ariaHidden = props['aria-details'],
15
+ marginX = props.marginX,
16
+ marginY = props.marginY,
17
+ width = props.width,
18
+ height = props.height,
19
+ minWidth = props.minWidth,
20
+ minHeight = props.minHeight,
21
+ maxWidth = props.maxWidth,
22
+ maxHeight = props.maxHeight,
23
+ flex = props.flex,
24
+ flexGrow = props.flexGrow,
25
+ flexShrink = props.flexShrink,
26
+ flexBasis = props.flexBasis,
27
+ justifySelf = props.justifySelf,
28
+ alignSelf = props.alignSelf,
29
+ order = props.order,
30
+ gridArea = props.gridArea,
31
+ gridColumn = props.gridColumn,
32
+ gridRow = props.gridRow,
33
+ gridColumnStart = props.gridColumnStart,
34
+ gridColumnEnd = props.gridColumnEnd,
35
+ gridRowStart = props.gridRowStart,
36
+ gridRowEnd = props.gridRowEnd,
37
+ position = props.position,
38
+ zIndex = props.zIndex,
39
+ top = props.top,
40
+ bottom = props.bottom,
41
+ start = props.start,
42
+ end = props.end,
43
+ left = props.left,
44
+ right = props.right,
45
+ isHidden = props.isHidden,
48
46
  componentProps = _objectWithoutProperties(props, _excluded);
49
47
  return {
50
48
  ariaLabelProps: {
@@ -1 +1 @@
1
- {"version":3,"file":"propsUtils.js","names":["separateSpectrumProps","props","ariaLabel","ariaLabelledby","ariaDescribedby","ariaHidden","marginX","marginY","width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","justifySelf","alignSelf","order","gridArea","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","position","zIndex","top","bottom","start","end","left","right","isHidden","componentProps","_objectWithoutProperties","_excluded","ariaLabelProps","styleProps"],"sources":["../../../src/spectrum/utils/propsUtils.ts"],"sourcesContent":["import type { AriaLabelingProps, StyleProps } from '@react-types/shared';\n\n/**\n * Separate props for Spectrum components into AriaLabelingProps, StyleProps, and\n * any remaining props.\n * @param props The props to separate\n * @returns The separated props\n */\nexport function separateSpectrumProps<T extends AriaLabelingProps & StyleProps>(\n props: T\n): {\n ariaLabelProps: AriaLabelingProps;\n styleProps: StyleProps;\n componentProps: Omit<T, keyof (AriaLabelingProps & StyleProps)>;\n} {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n ...componentProps\n } = props;\n\n return {\n ariaLabelProps: {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n },\n styleProps: {\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n },\n componentProps: componentProps as Omit<\n T,\n keyof (AriaLabelingProps & StyleProps)\n >,\n };\n}\n\nexport default separateSpectrumProps;\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAqBA,CAC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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,IACgBC,SAAS,GAqCrBD,KAAK,CArCP,YAAY;IACOE,cAAc,GAoC/BF,KAAK,CApCP,iBAAiB;IACGG,eAAe,GAmCjCH,KAAK,CAnCP,kBAAkB;IACFI,UAAU,GAkCxBJ,KAAK,CAlCP,cAAc;IAEdK,OAAO,GAgCLL,KAAK,CAhCPK,OAAO;IACPC,OAAO,GA+BLN,KAAK,CA/BPM,OAAO;IACPC,KAAK,GA8BHP,KAAK,CA9BPO,KAAK;IACLC,MAAM,GA6BJR,KAAK,CA7BPQ,MAAM;IACNC,QAAQ,GA4BNT,KAAK,CA5BPS,QAAQ;IACRC,SAAS,GA2BPV,KAAK,CA3BPU,SAAS;IACTC,QAAQ,GA0BNX,KAAK,CA1BPW,QAAQ;IACRC,SAAS,GAyBPZ,KAAK,CAzBPY,SAAS;IACTC,IAAI,GAwBFb,KAAK,CAxBPa,IAAI;IACJC,QAAQ,GAuBNd,KAAK,CAvBPc,QAAQ;IACRC,UAAU,GAsBRf,KAAK,CAtBPe,UAAU;IACVC,SAAS,GAqBPhB,KAAK,CArBPgB,SAAS;IACTC,WAAW,GAoBTjB,KAAK,CApBPiB,WAAW;IACXC,SAAS,GAmBPlB,KAAK,CAnBPkB,SAAS;IACTC,KAAK,GAkBHnB,KAAK,CAlBPmB,KAAK;IACLC,QAAQ,GAiBNpB,KAAK,CAjBPoB,QAAQ;IACRC,UAAU,GAgBRrB,KAAK,CAhBPqB,UAAU;IACVC,OAAO,GAeLtB,KAAK,CAfPsB,OAAO;IACPC,eAAe,GAcbvB,KAAK,CAdPuB,eAAe;IACfC,aAAa,GAaXxB,KAAK,CAbPwB,aAAa;IACbC,YAAY,GAYVzB,KAAK,CAZPyB,YAAY;IACZC,UAAU,GAWR1B,KAAK,CAXP0B,UAAU;IACVC,QAAQ,GAUN3B,KAAK,CAVP2B,QAAQ;IACRC,MAAM,GASJ5B,KAAK,CATP4B,MAAM;IACNC,GAAG,GAQD7B,KAAK,CARP6B,GAAG;IACHC,MAAM,GAOJ9B,KAAK,CAPP8B,MAAM;IACNC,KAAK,GAMH/B,KAAK,CANP+B,KAAK;IACLC,GAAG,GAKDhC,KAAK,CALPgC,GAAG;IACHC,IAAI,GAIFjC,KAAK,CAJPiC,IAAI;IACJC,KAAK,GAGHlC,KAAK,CAHPkC,KAAK;IACLC,QAAQ,GAENnC,KAAK,CAFPmC,QAAQ;IACLC,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":[]}
@@ -6,13 +6,11 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
6
6
  import { theme } from '@react-spectrum/theme-default';
7
7
  import { themeSpectrumClassesCommon } from "../../theme/theme-spectrum/index.js";
8
8
  export { useStyleProps, baseStyleProps, viewStyleProps } from '@react-spectrum/utils';
9
- var {
10
- global,
11
- light,
12
- dark,
13
- medium,
14
- large
15
- } = theme;
9
+ var global = theme.global,
10
+ light = theme.light,
11
+ dark = theme.dark,
12
+ medium = theme.medium,
13
+ large = theme.large;
16
14
 
17
15
  /**
18
16
  * Extend light + dark theme variables with DH defaults.
@@ -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","ignoreList":[]}
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,IAAQC,MAAM,GAAiCL,KAAK,CAA5CK,MAAM;EAAEC,KAAK,GAA0BN,KAAK,CAApCM,KAAK;EAAEC,IAAI,GAAoBP,KAAK,CAA7BO,IAAI;EAAEC,MAAM,GAAYR,KAAK,CAAvBQ,MAAM;EAAEC,KAAK,GAAKT,KAAK,CAAfS,KAAK;;AAE1C;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,IAAMC,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":[]}
@@ -1,3 +1,9 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1
7
  import { useCallback, useState } from 'react';
2
8
  /**
3
9
  * Returns a selectedKey and onChange handler that can manage selection state
@@ -6,15 +12,16 @@ import { useCallback, useState } from 'react';
6
12
  * controlled / uncontrolled status.
7
13
  */
8
14
  export function useOnChangeTrackUncontrolled(_ref) {
9
- var {
10
- defaultSelectedKey,
11
- selectedKey,
12
- onChange: onChangeHandler
13
- } = _ref;
15
+ var defaultSelectedKey = _ref.defaultSelectedKey,
16
+ selectedKey = _ref.selectedKey,
17
+ onChangeHandler = _ref.onChange;
14
18
  // `null` is a valid value for `selectedKey` in controlled mode, so we check
15
19
  // for explicit `undefined` to identify uncontrolled mode.
16
20
  var isUncontrolled = selectedKey === undefined;
17
- var [uncontrolledSelectedKey, setUncontrolledSelectedKey] = useState(defaultSelectedKey);
21
+ var _useState = useState(defaultSelectedKey),
22
+ _useState2 = _slicedToArray(_useState, 2),
23
+ uncontrolledSelectedKey = _useState2[0],
24
+ setUncontrolledSelectedKey = _useState2[1];
18
25
  var onChangeMaybeUncontrolled = useCallback(key => {
19
26
  // If our component is uncontrolled, track the selected key internally
20
27
  if (isUncontrolled) {
@@ -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,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":[]}
1
+ {"version":3,"file":"useOnChangeTrackUncontrolled.js","names":["useCallback","useState","useOnChangeTrackUncontrolled","_ref","defaultSelectedKey","selectedKey","onChangeHandler","onChange","isUncontrolled","undefined","_useState","_useState2","_slicedToArray","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,IAH1EC,kBAAkB,GAAAD,IAAA,CAAlBC,kBAAkB;IAClBC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IACDC,eAAe,GAAAH,IAAA,CAAzBI,QAAQ;EAER;EACA;EACA,IAAMC,cAAc,GAAGH,WAAW,KAAKI,SAAS;EAChD,IAAAC,SAAA,GAA8DT,QAAQ,CAEpEG,kBAAkB,CAAC;IAAAO,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAFdG,uBAAuB,GAAAF,UAAA;IAAEG,0BAA0B,GAAAH,UAAA;EAI1D,IAAMI,yBAAyB,GAAGf,WAAW,CAC1CgB,GAAmB,IAAW;IAC7B;IACA,IAAIR,cAAc,EAAE;MAClBM,0BAA0B,CAACE,GAAG,CAAC;IACjC;IAEAV,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAGU,GAAG,CAAC;EACxB,CAAC,EACD,CAACR,cAAc,EAAEF,eAAe,CAClC,CAAC;EAED,OAAO;IACLW,4BAA4B,EAAET,cAAc,GACxCK,uBAAuB,GACvBR,WAAW;IACfU;EACF,CAAC;AACH;AAEA,eAAeb,4BAA4B","ignoreList":[]}
@@ -25,13 +25,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  * @returns Render function for normalized items
26
26
  */
27
27
  export function useRenderNormalizedItem(_ref) {
28
- var {
29
- itemIconSlot,
30
- showItemDescriptions,
31
- showItemIcons,
32
- tooltipOptions,
33
- actions
34
- } = _ref;
28
+ var itemIconSlot = _ref.itemIconSlot,
29
+ showItemDescriptions = _ref.showItemDescriptions,
30
+ showItemIcons = _ref.showItemIcons,
31
+ tooltipOptions = _ref.tooltipOptions,
32
+ actions = _ref.actions;
35
33
  return useCallback(normalizedItem => {
36
34
  var _normalizedItem$item, _normalizedItem$item$, _normalizedItem$item2, _normalizedItem$item3, _normalizedItem$item4;
37
35
  var itemKey = getItemKey(normalizedItem);
@@ -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,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,cAAAA,qBAAA,GAC7BI,OAAO,IAAI,IAAI,GAAGI,SAAS,GAAGC,MAAM,CAACL,OAAO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A,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":[]}
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,IAPfC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AAC,EACD,CAACP,OAAO,EAAEJ,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,cAAc,CAC7E,CAAC;AACH;AAEA,eAAeL,uBAAuB","ignoreList":[]}
@@ -3,12 +3,10 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
3
3
  import { useCallback, useMemo } from 'react';
4
4
  import { getPositionOfSelectedItemElement, isItemElementWithDescription, isSectionElement } from "./itemUtils.js";
5
5
  export function useStaticItemInitialScrollPosition(_ref) {
6
- var {
7
- itemHeight,
8
- selectedKey,
9
- topOffset,
10
- items
11
- } = _ref;
6
+ var itemHeight = _ref.itemHeight,
7
+ selectedKey = _ref.selectedKey,
8
+ topOffset = _ref.topOffset,
9
+ items = _ref.items;
12
10
  // Item descriptions and Section elements introduce variable item heights.
13
11
  // This throws off scroll position calculations, so we disable auto scrolling
14
12
  // if either of these are found.
@@ -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,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
+ {"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,IAJ1EC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IACXC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;EAEL;EACA;EACA;EACA,IAAMC,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":[]}
@@ -16,13 +16,11 @@ import { getItemKey, itemSelectionToStringSet } from "./itemUtils.js";
16
16
  * string key selection change handler.
17
17
  */
18
18
  export function useStringifiedMultiSelection(_ref) {
19
- var {
20
- normalizedItems,
21
- defaultSelectedKeys,
22
- disabledKeys,
23
- selectedKeys,
24
- onChange
25
- } = _ref;
19
+ var normalizedItems = _ref.normalizedItems,
20
+ defaultSelectedKeys = _ref.defaultSelectedKeys,
21
+ disabledKeys = _ref.disabledKeys,
22
+ selectedKeys = _ref.selectedKeys,
23
+ onChange = _ref.onChange;
26
24
  var selectedStringKeys = useMemo(() => itemSelectionToStringSet(selectedKeys), [selectedKeys]);
27
25
  var defaultSelectedStringKeys = useMemo(() => itemSelectionToStringSet(defaultSelectedKeys), [defaultSelectedKeys]);
28
26
  var disabledStringKeys = useMemo(() => itemSelectionToStringSet(disabledKeys), [disabledKeys]);
@@ -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","foundStringKeys","forEach","item","stringKey","String","has","add","key"],"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 const foundStringKeys = new Set<string>();\n\n normalizedItems.forEach(item => {\n const stringKey = String(getItemKey(item));\n if (keys.has(stringKey)) {\n actualKeys.add(getItemKey(item));\n foundStringKeys.add(stringKey);\n }\n });\n\n // Preserve keys not found in normalizedItems (i.e., filtered out by server-side search).\n // Pass them through as-is since they are already valid ItemKey values.\n keys.forEach(key => {\n if (!foundStringKeys.has(String(key))) {\n actualKeys.add(key);\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;IACrC,IAAMC,eAAe,GAAG,IAAID,GAAG,CAAS,CAAC;IAEzCX,eAAe,CAACa,OAAO,CAACC,IAAI,IAAI;MAC9B,IAAMC,SAAS,GAAGC,MAAM,CAACpB,UAAU,CAACkB,IAAI,CAAC,CAAC;MAC1C,IAAIL,IAAI,CAACQ,GAAG,CAACF,SAAS,CAAC,EAAE;QACvBL,UAAU,CAACQ,GAAG,CAACtB,UAAU,CAACkB,IAAI,CAAC,CAAC;QAChCF,eAAe,CAACM,GAAG,CAACH,SAAS,CAAC;MAChC;IACF,CAAC,CAAC;;IAEF;IACA;IACAN,IAAI,CAACI,OAAO,CAACM,GAAG,IAAI;MAClB,IAAI,CAACP,eAAe,CAACK,GAAG,CAACD,MAAM,CAACG,GAAG,CAAC,CAAC,EAAE;QACrCT,UAAU,CAACQ,GAAG,CAACC,GAAG,CAAC;MACrB;IACF,CAAC,CAAC;IAEFf,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
+ {"version":3,"file":"useStringifiedMultiSelection.js","names":["useCallback","useMemo","getItemKey","itemSelectionToStringSet","useStringifiedMultiSelection","_ref","normalizedItems","defaultSelectedKeys","disabledKeys","selectedKeys","onChange","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","keys","actualKeys","Set","foundStringKeys","forEach","item","stringKey","String","has","add","key"],"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 const foundStringKeys = new Set<string>();\n\n normalizedItems.forEach(item => {\n const stringKey = String(getItemKey(item));\n if (keys.has(stringKey)) {\n actualKeys.add(getItemKey(item));\n foundStringKeys.add(stringKey);\n }\n });\n\n // Preserve keys not found in normalizedItems (i.e., filtered out by server-side search).\n // Pass them through as-is since they are already valid ItemKey values.\n keys.forEach(key => {\n if (!foundStringKeys.has(String(key))) {\n actualKeys.add(key);\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,IAL1EC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,mBAAmB,GAAAF,IAAA,CAAnBE,mBAAmB;IACnBC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;EAER,IAAMC,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;IACrC,IAAMC,eAAe,GAAG,IAAID,GAAG,CAAS,CAAC;IAEzCX,eAAe,CAACa,OAAO,CAACC,IAAI,IAAI;MAC9B,IAAMC,SAAS,GAAGC,MAAM,CAACpB,UAAU,CAACkB,IAAI,CAAC,CAAC;MAC1C,IAAIL,IAAI,CAACQ,GAAG,CAACF,SAAS,CAAC,EAAE;QACvBL,UAAU,CAACQ,GAAG,CAACtB,UAAU,CAACkB,IAAI,CAAC,CAAC;QAChCF,eAAe,CAACM,GAAG,CAACH,SAAS,CAAC;MAChC;IACF,CAAC,CAAC;;IAEF;IACA;IACAN,IAAI,CAACI,OAAO,CAACM,GAAG,IAAI;MAClB,IAAI,CAACP,eAAe,CAACK,GAAG,CAACD,MAAM,CAACG,GAAG,CAAC,CAAC,EAAE;QACrCT,UAAU,CAACQ,GAAG,CAACC,GAAG,CAAC;MACrB;IACF,CAAC,CAAC;IAEFf,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":[]}
@@ -16,13 +16,11 @@ import { getItemKey, itemSelectionToStringSet } from "./itemUtils.js";
16
16
  * key selection change handler.
17
17
  */
18
18
  export function useStringifiedSelection(_ref) {
19
- var {
20
- normalizedItems,
21
- defaultSelectedKey,
22
- selectedKey,
23
- disabledKeys,
24
- onChange
25
- } = _ref;
19
+ var normalizedItems = _ref.normalizedItems,
20
+ defaultSelectedKey = _ref.defaultSelectedKey,
21
+ selectedKey = _ref.selectedKey,
22
+ disabledKeys = _ref.disabledKeys,
23
+ onChange = _ref.onChange;
26
24
  var selectedStringKey = useMemo(() => selectedKey == null ? selectedKey : String(selectedKey), [selectedKey]);
27
25
  var defaultSelectedStringKey = useMemo(() => defaultSelectedKey == null ? defaultSelectedKey : String(defaultSelectedKey), [defaultSelectedKey]);
28
26
  var disabledStringKeys = useMemo(() => itemSelectionToStringSet(disabledKeys), [disabledKeys]);
@@ -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 { 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
+ {"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,IALhEC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,kBAAkB,GAAAF,IAAA,CAAlBE,kBAAkB;IAClBC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;EAER,IAAMC,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,3 +1,9 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1
7
  import React, { createContext, useEffect, useState } from 'react';
2
8
  import '@fontsource/fira-mono/400.css';
3
9
  import '@fontsource/fira-mono/500.css';
@@ -17,11 +23,13 @@ FontsLoadedContext.displayName = 'FontsLoadedContext';
17
23
  * FontBootstrap component. Handles preloading fonts.
18
24
  */
19
25
  export function FontBootstrap(_ref) {
20
- var {
21
- fontClassNames = ['fira-sans-regular', 'fira-sans-semibold', 'fira-mono'],
22
- children
23
- } = _ref;
24
- var [isLoaded, setIsLoaded] = useState(false);
26
+ var _ref$fontClassNames = _ref.fontClassNames,
27
+ fontClassNames = _ref$fontClassNames === void 0 ? ['fira-sans-regular', 'fira-sans-semibold', 'fira-mono'] : _ref$fontClassNames,
28
+ children = _ref.children;
29
+ var _useState = useState(false),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ isLoaded = _useState2[0],
32
+ setIsLoaded = _useState2[1];
25
33
  useEffect(function initFonts() {
26
34
  document.fonts.ready.then(() => {
27
35
  setIsLoaded(true);
@@ -1 +1 @@
1
- {"version":3,"file":"FontBootstrap.js","names":["React","createContext","useEffect","useState","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","FontsLoadedContext","displayName","FontBootstrap","_ref","fontClassNames","children","isLoaded","setIsLoaded","initFonts","document","fonts","ready","then","Provider","value","id","style","visibility","position","top","map","className"],"sources":["../../src/theme/FontBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport '@fontsource/fira-mono/400.css';\nimport '@fontsource/fira-mono/500.css';\nimport '@fontsource/fira-mono/700.css';\nimport '@fontsource/fira-sans/300.css';\nimport '@fontsource/fira-sans/300-italic.css';\nimport '@fontsource/fira-sans/400.css';\nimport '@fontsource/fira-sans/400-italic.css';\nimport '@fontsource/fira-sans/500.css';\nimport '@fontsource/fira-sans/600.css';\nimport '@fontsource/fira-sans/700.css';\nimport '@fontsource/fira-sans/700-italic.css';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\nFontsLoadedContext.displayName = 'FontsLoadedContext';\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-semibold', 'fira-mono'],\n children,\n}: FontBootstrapProps): JSX.Element {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,sCAAsC;AAC7C,OAAO,+BAA+B;AACtC,OAAO,sCAAsC;AAC7C,OAAO,+BAA+B;AACtC,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["React","createContext","useEffect","useState","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","FontsLoadedContext","displayName","FontBootstrap","_ref","_ref$fontClassNames","fontClassNames","children","_useState","_useState2","_slicedToArray","isLoaded","setIsLoaded","initFonts","document","fonts","ready","then","Provider","value","id","style","visibility","position","top","map","className"],"sources":["../../src/theme/FontBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport '@fontsource/fira-mono/400.css';\nimport '@fontsource/fira-mono/500.css';\nimport '@fontsource/fira-mono/700.css';\nimport '@fontsource/fira-sans/300.css';\nimport '@fontsource/fira-sans/300-italic.css';\nimport '@fontsource/fira-sans/400.css';\nimport '@fontsource/fira-sans/400-italic.css';\nimport '@fontsource/fira-sans/500.css';\nimport '@fontsource/fira-sans/600.css';\nimport '@fontsource/fira-sans/700.css';\nimport '@fontsource/fira-sans/700-italic.css';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\nFontsLoadedContext.displayName = 'FontsLoadedContext';\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-semibold', 'fira-mono'],\n children,\n}: FontBootstrapProps): JSX.Element {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,sCAAsC;AAC7C,OAAO,+BAA+B;AACtC,OAAO,sCAAsC;AAC7C,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9C,OAAO,IAAMC,kBAAkB,gBAAGT,aAAa,CAAU,KAAK,CAAC;AAC/DS,kBAAkB,CAACC,WAAW,GAAG,oBAAoB;AAerD;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAAC,IAAA,EAGO;EAAA,IAAAC,mBAAA,GAAAD,IAAA,CAFlCE,cAAc;IAAdA,cAAc,GAAAD,mBAAA,cAAG,CAAC,mBAAmB,EAAE,oBAAoB,EAAE,WAAW,CAAC,GAAAA,mBAAA;IACzEE,QAAQ,GAAAH,IAAA,CAARG,QAAQ;EAER,IAAAC,SAAA,GAAgCd,QAAQ,CAAC,KAAK,CAAC;IAAAe,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAAxCG,QAAQ,GAAAF,UAAA;IAAEG,WAAW,GAAAH,UAAA;EAC5BhB,SAAS,CAAC,SAASoB,SAASA,CAAA,EAAG;IAC7BC,QAAQ,CAACC,KAAK,CAACC,KAAK,CAACC,IAAI,CAAC,MAAM;MAC9BL,WAAW,CAAC,IAAI,CAAC;IACnB,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEZ,KAAA,CAAAF,SAAA;IAAAS,QAAA,gBACEX,IAAA,CAACK,kBAAkB,CAACiB,QAAQ;MAACC,KAAK,EAAER,QAAS;MAAAJ,QAAA,EAC1CA;IAAQ,CACkB,CAAC,eAU9BX,IAAA;MACEwB,EAAE,EAAC,eAAe;MAClBC,KAAK,EAAE;QAAEC,UAAU,EAAE,QAAQ;QAAEC,QAAQ,EAAE,UAAU;QAAEC,GAAG,EAAE,CAAC;MAAM,CAAE;MAAAjB,QAAA,EAGlED,cAAc,CAACmB,GAAG,CAACC,SAAS,iBAC3B9B,IAAA;QAAmB8B,SAAS,EAAEA,SAAU;QAAAnB,QAAA,EAAC;MAEzC,GAFQmB,SAEL,CACJ;IAAC,CACC,CAAC;EAAA,CACN,CAAC;AAEP;AAEA,eAAevB,aAAa","ignoreList":[]}
@@ -3,9 +3,7 @@ import LoadingOverlay from "../LoadingOverlay.js";
3
3
  import { FontsLoadedContext } from "./FontBootstrap.js";
4
4
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
5
5
  export function FontsLoaded(_ref) {
6
- var {
7
- children
8
- } = _ref;
6
+ var children = _ref.children;
9
7
  var isFontsLoaded = useContext(FontsLoadedContext);
10
8
  if (!isFontsLoaded) {
11
9
  return /*#__PURE__*/_jsx(LoadingOverlay, {
@@ -1 +1 @@
1
- {"version":3,"file":"FontsLoaded.js","names":["React","useContext","LoadingOverlay","FontsLoadedContext","jsx","_jsx","Fragment","_Fragment","FontsLoaded","_ref","children","isFontsLoaded"],"sources":["../../src/theme/FontsLoaded.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport LoadingOverlay from '../LoadingOverlay';\nimport { FontsLoadedContext } from './FontBootstrap';\n\nexport type FontsLoadedProps = {\n /** Children to show when the fonts have completed loading */\n children: React.ReactNode;\n};\n\nexport function FontsLoaded({ children }: FontsLoadedProps): JSX.Element {\n const isFontsLoaded = useContext(FontsLoadedContext);\n\n if (!isFontsLoaded) {\n return <LoadingOverlay data-testid=\"fonts-loaded-loading\" />;\n }\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n}\n\nexport default FontsLoaded;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAAC,OACnCC,cAAc;AAAA,SACZC,kBAAkB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAO3B,OAAO,SAASC,WAAWA,CAAAC,IAAA,EAA8C;EAAA,IAA7C;IAAEC;EAA2B,CAAC,GAAAD,IAAA;EACxD,IAAME,aAAa,GAAGV,UAAU,CAACE,kBAAkB,CAAC;EAEpD,IAAI,CAACQ,aAAa,EAAE;IAClB,oBAAON,IAAA,CAACH,cAAc;MAAC,eAAY;IAAsB,CAAE,CAAC;EAC9D;;EAEA;EACA,oBAAOG,IAAA,CAAAE,SAAA;IAAAG,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB;AAEA,eAAeF,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"FontsLoaded.js","names":["React","useContext","LoadingOverlay","FontsLoadedContext","jsx","_jsx","Fragment","_Fragment","FontsLoaded","_ref","children","isFontsLoaded"],"sources":["../../src/theme/FontsLoaded.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport LoadingOverlay from '../LoadingOverlay';\nimport { FontsLoadedContext } from './FontBootstrap';\n\nexport type FontsLoadedProps = {\n /** Children to show when the fonts have completed loading */\n children: React.ReactNode;\n};\n\nexport function FontsLoaded({ children }: FontsLoadedProps): JSX.Element {\n const isFontsLoaded = useContext(FontsLoadedContext);\n\n if (!isFontsLoaded) {\n return <LoadingOverlay data-testid=\"fonts-loaded-loading\" />;\n }\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n}\n\nexport default FontsLoaded;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAAC,OACnCC,cAAc;AAAA,SACZC,kBAAkB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAO3B,OAAO,SAASC,WAAWA,CAAAC,IAAA,EAA8C;EAAA,IAA3CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACpC,IAAMC,aAAa,GAAGV,UAAU,CAACE,kBAAkB,CAAC;EAEpD,IAAI,CAACQ,aAAa,EAAE;IAClB,oBAAON,IAAA,CAACH,cAAc;MAAC,eAAY;IAAsB,CAAE,CAAC;EAC9D;;EAEA;EACA,oBAAOG,IAAA,CAAAE,SAAA;IAAAG,QAAA,EAAGA;EAAQ,CAAG,CAAC;AACxB;AAEA,eAAeF,WAAW","ignoreList":[]}