@protonradio/proton-ui 0.11.16 → 0.11.18-beta.1

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 (230) hide show
  1. package/dist/assets/svg/icons.svg.cjs.js.map +1 -1
  2. package/dist/assets/svg/icons.svg.es.js.map +1 -1
  3. package/dist/components/ActionMenu/ActionMenu.cjs.js.map +1 -1
  4. package/dist/components/ActionMenu/ActionMenu.es.js.map +1 -1
  5. package/dist/components/Badge/Badge.cjs.js.map +1 -1
  6. package/dist/components/Badge/Badge.es.js.map +1 -1
  7. package/dist/components/Banner/Banner.cjs.js.map +1 -1
  8. package/dist/components/Banner/Banner.es.js.map +1 -1
  9. package/dist/components/Button/Button.cjs.js.map +1 -1
  10. package/dist/components/Button/Button.es.js.map +1 -1
  11. package/dist/components/ButtonGroup/ButtonGroup.cjs.js.map +1 -1
  12. package/dist/components/ButtonGroup/ButtonGroup.es.js.map +1 -1
  13. package/dist/components/ButtonWithSelect/ButtonWithSelect.cjs.js +1 -1
  14. package/dist/components/ButtonWithSelect/ButtonWithSelect.cjs.js.map +1 -1
  15. package/dist/components/ButtonWithSelect/ButtonWithSelect.es.js +26 -26
  16. package/dist/components/ButtonWithSelect/ButtonWithSelect.es.js.map +1 -1
  17. package/dist/components/DataTable/DataTable.cjs.js.map +1 -1
  18. package/dist/components/DataTable/DataTable.es.js.map +1 -1
  19. package/dist/components/Dialog/Dialog.cjs.js.map +1 -1
  20. package/dist/components/Dialog/Dialog.es.js.map +1 -1
  21. package/dist/components/Elevation/Elevation.cjs.js.map +1 -1
  22. package/dist/components/Elevation/Elevation.es.js.map +1 -1
  23. package/dist/components/Icon/Icon.cjs.js.map +1 -1
  24. package/dist/components/Icon/Icon.es.js.map +1 -1
  25. package/dist/components/ImageBackground/ImageBackground.cjs.js.map +1 -1
  26. package/dist/components/ImageBackground/ImageBackground.es.js.map +1 -1
  27. package/dist/components/Input/BaseInput/Input.cjs.js.map +1 -1
  28. package/dist/components/Input/BaseInput/Input.es.js.map +1 -1
  29. package/dist/components/Input/CopyInput/CopyInput.cjs.js +1 -1
  30. package/dist/components/Input/CopyInput/CopyInput.cjs.js.map +1 -1
  31. package/dist/components/Input/CopyInput/CopyInput.es.js +9 -9
  32. package/dist/components/Input/CopyInput/CopyInput.es.js.map +1 -1
  33. package/dist/components/Input/SearchInput/SearchInput.cjs.js.map +1 -1
  34. package/dist/components/Input/SearchInput/SearchInput.es.js.map +1 -1
  35. package/dist/components/Menu/MenuTrigger.cjs.js.map +1 -1
  36. package/dist/components/Menu/MenuTrigger.es.js.map +1 -1
  37. package/dist/components/Menu/PopoverMenu.cjs.js +1 -1
  38. package/dist/components/Menu/PopoverMenu.cjs.js.map +1 -1
  39. package/dist/components/Menu/PopoverMenu.es.js +32 -28
  40. package/dist/components/Menu/PopoverMenu.es.js.map +1 -1
  41. package/dist/components/Modal/Modal.cjs.js.map +1 -1
  42. package/dist/components/Modal/Modal.es.js.map +1 -1
  43. package/dist/components/Popover/Popover.cjs.js.map +1 -1
  44. package/dist/components/Popover/Popover.es.js.map +1 -1
  45. package/dist/components/ScreenOverlay/ScreenOverlay.cjs.js.map +1 -1
  46. package/dist/components/ScreenOverlay/ScreenOverlay.es.js.map +1 -1
  47. package/dist/components/Select/Select.cjs.js.map +1 -1
  48. package/dist/components/Select/Select.es.js +3 -3
  49. package/dist/components/Select/Select.es.js.map +1 -1
  50. package/dist/components/Switch/Switch.cjs.js.map +1 -1
  51. package/dist/components/Switch/Switch.es.js.map +1 -1
  52. package/dist/components/Table/Collection/collectionParser.cjs.js.map +1 -1
  53. package/dist/components/Table/Collection/collectionParser.es.js.map +1 -1
  54. package/dist/components/Table/Collection/useTableCollection.cjs.js.map +1 -1
  55. package/dist/components/Table/Collection/useTableCollection.es.js.map +1 -1
  56. package/dist/components/Table/Table.cjs.js.map +1 -1
  57. package/dist/components/Table/Table.es.js +5 -5
  58. package/dist/components/Table/Table.es.js.map +1 -1
  59. package/dist/components/Text/TextEllipsis/TextEllipsis.cjs.js.map +1 -1
  60. package/dist/components/Text/TextEllipsis/TextEllipsis.es.js.map +1 -1
  61. package/dist/components/Text/TextEmphasis/TextEmphasis.cjs.js.map +1 -1
  62. package/dist/components/Text/TextEmphasis/TextEmphasis.es.js.map +1 -1
  63. package/dist/components/ThemeProvider.cjs.js.map +1 -1
  64. package/dist/components/ThemeProvider.es.js +4 -4
  65. package/dist/components/ThemeProvider.es.js.map +1 -1
  66. package/dist/components/Tombstone/Tombstone.cjs.js.map +1 -1
  67. package/dist/components/Tombstone/Tombstone.es.js.map +1 -1
  68. package/dist/components/Tooltip/Tooltip.cjs.js.map +1 -1
  69. package/dist/components/Tooltip/Tooltip.es.js.map +1 -1
  70. package/dist/components/Waveform/Waveform.cjs.js.map +1 -1
  71. package/dist/components/Waveform/Waveform.es.js.map +1 -1
  72. package/dist/components/Waveform/WaveformBar.cjs.js.map +1 -1
  73. package/dist/components/Waveform/WaveformBar.es.js.map +1 -1
  74. package/dist/design/darkTheme/colors.cjs.js.map +1 -1
  75. package/dist/design/darkTheme/colors.es.js +3 -3
  76. package/dist/design/darkTheme/stylesheet.cjs.js.map +1 -1
  77. package/dist/design/darkTheme/stylesheet.es.js +12 -12
  78. package/dist/design/darkTheme/stylesheet.es.js.map +1 -1
  79. package/dist/design/generateStylesheet.cjs.js.map +1 -1
  80. package/dist/design/generateStylesheet.es.js.map +1 -1
  81. package/dist/design/lightTheme/colors.cjs.js.map +1 -1
  82. package/dist/design/lightTheme/colors.es.js +3 -3
  83. package/dist/design/lightTheme/stylesheet.cjs.js.map +1 -1
  84. package/dist/design/lightTheme/stylesheet.es.js +12 -12
  85. package/dist/design/lightTheme/stylesheet.es.js.map +1 -1
  86. package/dist/hooks/useBreakpoint.cjs.js.map +1 -1
  87. package/dist/hooks/useBreakpoint.es.js.map +1 -1
  88. package/dist/hooks/useIsClosing.cjs.js.map +1 -1
  89. package/dist/hooks/useIsClosing.es.js.map +1 -1
  90. package/dist/hooks/useLockBodyScroll.cjs.js.map +1 -1
  91. package/dist/hooks/useLockBodyScroll.es.js.map +1 -1
  92. package/dist/hooks/usePalette.cjs.js.map +1 -1
  93. package/dist/hooks/usePalette.es.js.map +1 -1
  94. package/dist/index.d.ts +38 -38
  95. package/dist/node_modules/@react-aria/button/dist/useButton.cjs.js +1 -1
  96. package/dist/node_modules/@react-aria/button/dist/useButton.cjs.js.map +1 -1
  97. package/dist/node_modules/@react-aria/button/dist/useButton.es.js +12 -13
  98. package/dist/node_modules/@react-aria/button/dist/useButton.es.js.map +1 -1
  99. package/dist/node_modules/@react-aria/dialog/dist/useDialog.cjs.js.map +1 -1
  100. package/dist/node_modules/@react-aria/dialog/dist/useDialog.es.js.map +1 -1
  101. package/dist/node_modules/@react-aria/focus/dist/FocusScope.cjs.js.map +1 -1
  102. package/dist/node_modules/@react-aria/focus/dist/FocusScope.es.js +3 -3
  103. package/dist/node_modules/@react-aria/focus/dist/FocusScope.es.js.map +1 -1
  104. package/dist/node_modules/@react-aria/form/dist/useFormValidation.cjs.js.map +1 -1
  105. package/dist/node_modules/@react-aria/form/dist/useFormValidation.es.js.map +1 -1
  106. package/dist/node_modules/@react-aria/i18n/dist/context.cjs.js.map +1 -1
  107. package/dist/node_modules/@react-aria/i18n/dist/context.es.js.map +1 -1
  108. package/dist/node_modules/@react-aria/i18n/dist/useDefaultLocale.cjs.js.map +1 -1
  109. package/dist/node_modules/@react-aria/i18n/dist/useDefaultLocale.es.js.map +1 -1
  110. package/dist/node_modules/@react-aria/i18n/dist/utils.cjs.js.map +1 -1
  111. package/dist/node_modules/@react-aria/i18n/dist/utils.es.js.map +1 -1
  112. package/dist/node_modules/@react-aria/interactions/dist/context.cjs.js.map +1 -1
  113. package/dist/node_modules/@react-aria/interactions/dist/context.es.js.map +1 -1
  114. package/dist/node_modules/@react-aria/interactions/dist/createEventHandler.cjs.js.map +1 -1
  115. package/dist/node_modules/@react-aria/interactions/dist/createEventHandler.es.js.map +1 -1
  116. package/dist/node_modules/@react-aria/interactions/dist/focusSafely.cjs.js.map +1 -1
  117. package/dist/node_modules/@react-aria/interactions/dist/focusSafely.es.js.map +1 -1
  118. package/dist/node_modules/@react-aria/interactions/dist/textSelection.cjs.js.map +1 -1
  119. package/dist/node_modules/@react-aria/interactions/dist/textSelection.es.js.map +1 -1
  120. package/dist/node_modules/@react-aria/interactions/dist/useFocus.cjs.js.map +1 -1
  121. package/dist/node_modules/@react-aria/interactions/dist/useFocus.es.js.map +1 -1
  122. package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.cjs.js.map +1 -1
  123. package/dist/node_modules/@react-aria/interactions/dist/useFocusVisible.es.js.map +1 -1
  124. package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.cjs.js.map +1 -1
  125. package/dist/node_modules/@react-aria/interactions/dist/useFocusWithin.es.js.map +1 -1
  126. package/dist/node_modules/@react-aria/interactions/dist/useFocusable.cjs.js.map +1 -1
  127. package/dist/node_modules/@react-aria/interactions/dist/useFocusable.es.js.map +1 -1
  128. package/dist/node_modules/@react-aria/interactions/dist/useInteractOutside.cjs.js.map +1 -1
  129. package/dist/node_modules/@react-aria/interactions/dist/useInteractOutside.es.js.map +1 -1
  130. package/dist/node_modules/@react-aria/interactions/dist/useKeyboard.cjs.js.map +1 -1
  131. package/dist/node_modules/@react-aria/interactions/dist/useKeyboard.es.js.map +1 -1
  132. package/dist/node_modules/@react-aria/interactions/dist/usePress.cjs.js +2 -2
  133. package/dist/node_modules/@react-aria/interactions/dist/usePress.cjs.js.map +1 -1
  134. package/dist/node_modules/@react-aria/interactions/dist/usePress.es.js +23 -23
  135. package/dist/node_modules/@react-aria/interactions/dist/usePress.es.js.map +1 -1
  136. package/dist/node_modules/@react-aria/interactions/dist/utils.cjs.js.map +1 -1
  137. package/dist/node_modules/@react-aria/interactions/dist/utils.es.js.map +1 -1
  138. package/dist/node_modules/@react-aria/label/dist/useField.cjs.js.map +1 -1
  139. package/dist/node_modules/@react-aria/label/dist/useField.es.js.map +1 -1
  140. package/dist/node_modules/@react-aria/label/dist/useLabel.cjs.js.map +1 -1
  141. package/dist/node_modules/@react-aria/label/dist/useLabel.es.js.map +1 -1
  142. package/dist/node_modules/@react-aria/overlays/dist/Overlay.cjs.js.map +1 -1
  143. package/dist/node_modules/@react-aria/overlays/dist/Overlay.es.js.map +1 -1
  144. package/dist/node_modules/@react-aria/overlays/dist/ariaHideOutside.cjs.js +1 -1
  145. package/dist/node_modules/@react-aria/overlays/dist/ariaHideOutside.cjs.js.map +1 -1
  146. package/dist/node_modules/@react-aria/overlays/dist/ariaHideOutside.es.js +18 -18
  147. package/dist/node_modules/@react-aria/overlays/dist/ariaHideOutside.es.js.map +1 -1
  148. package/dist/node_modules/@react-aria/overlays/dist/useModalOverlay.cjs.js.map +1 -1
  149. package/dist/node_modules/@react-aria/overlays/dist/useModalOverlay.es.js.map +1 -1
  150. package/dist/node_modules/@react-aria/overlays/dist/useOverlay.cjs.js.map +1 -1
  151. package/dist/node_modules/@react-aria/overlays/dist/useOverlay.es.js.map +1 -1
  152. package/dist/node_modules/@react-aria/overlays/dist/usePreventScroll.cjs.js.map +1 -1
  153. package/dist/node_modules/@react-aria/overlays/dist/usePreventScroll.es.js.map +1 -1
  154. package/dist/node_modules/@react-aria/radio/dist/useRadio.cjs.js.map +1 -1
  155. package/dist/node_modules/@react-aria/radio/dist/useRadio.es.js.map +1 -1
  156. package/dist/node_modules/@react-aria/radio/dist/useRadioGroup.cjs.js.map +1 -1
  157. package/dist/node_modules/@react-aria/radio/dist/useRadioGroup.es.js.map +1 -1
  158. package/dist/node_modules/@react-aria/ssr/dist/SSRProvider.cjs.js.map +1 -1
  159. package/dist/node_modules/@react-aria/ssr/dist/SSRProvider.es.js.map +1 -1
  160. package/dist/node_modules/@react-aria/switch/dist/useSwitch.cjs.js.map +1 -1
  161. package/dist/node_modules/@react-aria/switch/dist/useSwitch.es.js.map +1 -1
  162. package/dist/node_modules/@react-aria/toggle/dist/useToggle.cjs.js.map +1 -1
  163. package/dist/node_modules/@react-aria/toggle/dist/useToggle.es.js.map +1 -1
  164. package/dist/node_modules/@react-aria/visually-hidden/dist/VisuallyHidden.cjs.js.map +1 -1
  165. package/dist/node_modules/@react-aria/visually-hidden/dist/VisuallyHidden.es.js.map +1 -1
  166. package/dist/node_modules/@react-stately/form/dist/useFormValidationState.cjs.js.map +1 -1
  167. package/dist/node_modules/@react-stately/form/dist/useFormValidationState.es.js +3 -3
  168. package/dist/node_modules/@react-stately/form/dist/useFormValidationState.es.js.map +1 -1
  169. package/dist/node_modules/@react-stately/overlays/dist/useOverlayTriggerState.cjs.js.map +1 -1
  170. package/dist/node_modules/@react-stately/overlays/dist/useOverlayTriggerState.es.js.map +1 -1
  171. package/dist/node_modules/@react-stately/radio/dist/useRadioGroupState.cjs.js.map +1 -1
  172. package/dist/node_modules/@react-stately/radio/dist/useRadioGroupState.es.js.map +1 -1
  173. package/dist/node_modules/@react-stately/toggle/dist/useToggleState.cjs.js.map +1 -1
  174. package/dist/node_modules/@react-stately/toggle/dist/useToggleState.es.js.map +1 -1
  175. package/dist/node_modules/@react-stately/utils/dist/useControlledState.cjs.js.map +1 -1
  176. package/dist/node_modules/@react-stately/utils/dist/useControlledState.es.js.map +1 -1
  177. package/dist/node_modules/@swc/helpers/esm/_check_private_redeclaration.cjs.js +1 -1
  178. package/dist/node_modules/@swc/helpers/esm/_check_private_redeclaration.cjs.js.map +1 -1
  179. package/dist/node_modules/@swc/helpers/esm/_check_private_redeclaration.es.js +2 -1
  180. package/dist/node_modules/@swc/helpers/esm/_check_private_redeclaration.es.js.map +1 -1
  181. package/dist/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.cjs.js +1 -1
  182. package/dist/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.cjs.js.map +1 -1
  183. package/dist/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.es.js +2 -1
  184. package/dist/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.es.js.map +1 -1
  185. package/dist/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.cjs.js +1 -1
  186. package/dist/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.cjs.js.map +1 -1
  187. package/dist/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.es.js +2 -1
  188. package/dist/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.es.js.map +1 -1
  189. package/dist/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.cjs.js +1 -1
  190. package/dist/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.cjs.js.map +1 -1
  191. package/dist/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.es.js +2 -1
  192. package/dist/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.es.js.map +1 -1
  193. package/dist/node_modules/@swc/helpers/esm/_class_private_field_get.cjs.js +1 -1
  194. package/dist/node_modules/@swc/helpers/esm/_class_private_field_get.cjs.js.map +1 -1
  195. package/dist/node_modules/@swc/helpers/esm/_class_private_field_get.es.js +7 -6
  196. package/dist/node_modules/@swc/helpers/esm/_class_private_field_get.es.js.map +1 -1
  197. package/dist/node_modules/@swc/helpers/esm/_class_private_field_init.cjs.js +1 -1
  198. package/dist/node_modules/@swc/helpers/esm/_class_private_field_init.cjs.js.map +1 -1
  199. package/dist/node_modules/@swc/helpers/esm/_class_private_field_init.es.js +4 -3
  200. package/dist/node_modules/@swc/helpers/esm/_class_private_field_init.es.js.map +1 -1
  201. package/dist/node_modules/@swc/helpers/esm/_class_private_field_set.cjs.js +1 -1
  202. package/dist/node_modules/@swc/helpers/esm/_class_private_field_set.cjs.js.map +1 -1
  203. package/dist/node_modules/@swc/helpers/esm/_class_private_field_set.es.js +7 -6
  204. package/dist/node_modules/@swc/helpers/esm/_class_private_field_set.es.js.map +1 -1
  205. package/dist/node_modules/color2k/dist/index.exports.import.es.cjs.js.map +1 -1
  206. package/dist/node_modules/color2k/dist/index.exports.import.es.es.js.map +1 -1
  207. package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs.js +7 -7
  208. package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs.js.map +1 -1
  209. package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js +174 -167
  210. package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js.map +1 -1
  211. package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs.js +1 -1
  212. package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.cjs.js.map +1 -1
  213. package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.es.js +3 -3
  214. package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.es.js.map +1 -1
  215. package/dist/node_modules/react/jsx-runtime.cjs.js.map +1 -1
  216. package/dist/node_modules/react/jsx-runtime.es.js.map +1 -1
  217. package/dist/utils/color2k.cjs.js.map +1 -1
  218. package/dist/utils/color2k.es.js.map +1 -1
  219. package/dist/utils/copy.cjs.js +1 -1
  220. package/dist/utils/copy.cjs.js.map +1 -1
  221. package/dist/utils/copy.es.js +20 -19
  222. package/dist/utils/copy.es.js.map +1 -1
  223. package/dist/utils/image.cjs.js.map +1 -1
  224. package/dist/utils/image.es.js.map +1 -1
  225. package/dist/utils/navigation.cjs.js.map +1 -1
  226. package/dist/utils/navigation.es.js.map +1 -1
  227. package/dist/utils/palette.cjs.js.map +1 -1
  228. package/dist/utils/palette.es.js +1 -1
  229. package/dist/utils/palette.es.js.map +1 -1
  230. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.es.js","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["\"use client\";\n\nimport { useButton } from \"@react-aria/button\";\nimport { useDialog } from \"@react-aria/dialog\";\nimport { FocusScope } from \"@react-aria/focus\";\nimport { useModalOverlay, usePreventScroll } from \"@react-aria/overlays\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport { useRef } from \"react\";\nimport { useOverlayTriggerState } from \"@react-stately/overlays\";\nimport { BREAKPOINTS } from \"../../constants\";\nimport { useBreakpoint } from \"../../hooks\";\nimport { useIsClosing } from \"../../hooks/useIsClosing\";\nimport { csx } from \"../../utils\";\nimport { Button, ButtonProps } from \"../Button/Button\";\nimport \"./Modal.css\";\nimport { ScreenOverlay } from \"../ScreenOverlay/ScreenOverlay\";\n\nconst ModalTitle = ({ children }: { children: React.ReactNode }) => {\n return <h2 className=\"proton-Modal__title\">{children}</h2>;\n};\n\nconst ModalSubtitle = ({ children }: { children: React.ReactNode }) => {\n return <h3 className=\"proton-Modal__subtitle\">{children}</h3>;\n};\n\nconst ModalBody = ({ children }: { children: React.ReactNode }) => {\n return <div className=\"proton-Modal__body\">{children}</div>;\n};\n\nconst ModalAction = (buttonProps: ButtonProps) => {\n return (\n <div className=\"proton-Modal__action\">\n <Button {...buttonProps} />\n </div>\n );\n};\n\nconst ModalActions = ({ children }: { children: React.ReactNode }) => {\n return (\n <FocusScope autoFocus>\n <div className=\"proton-Modal__actions\">{children}</div>\n </FocusScope>\n );\n};\n\nconst ModalContent = ({\n title,\n subtitle,\n body,\n onClose,\n children,\n isClosing,\n \"data-testid\": dataTestId,\n}: ModalProps & {\n isClosing: boolean;\n}) => {\n const ref = useRef<HTMLDivElement>(null);\n const state = useOverlayTriggerState({ isOpen: true, onOpenChange: onClose });\n const { modalProps } = useModalOverlay(\n {\n isDismissable: false, //handle dismiss behavior in useIsClosing\n },\n state,\n ref\n );\n\n const { dialogProps } = useDialog({ role: \"dialog\" }, ref);\n usePreventScroll();\n\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n const { buttonProps: closeButtonProps } = useButton(\n {\n onPress: onClose,\n \"aria-label\": \"Close\",\n },\n closeButtonRef\n );\n\n return (\n <FocusScope contain restoreFocus autoFocus>\n <div\n data-testid={dataTestId}\n className={csx(\"proton-Modal\", isClosing && \"proton-Modal--closing\")}\n {...mergeProps(modalProps, dialogProps)}\n ref={ref}\n >\n <button\n name=\"Close\"\n className=\"proton-Modal__close-button\"\n {...closeButtonProps}\n ref={closeButtonRef}\n >\n ×\n </button>\n {title && <ModalTitle>{title}</ModalTitle>}\n {subtitle && <ModalSubtitle>{subtitle}</ModalSubtitle>}\n {body && <ModalBody>{body}</ModalBody>}\n <div className=\"proton-Modal__content\">{children}</div>\n </div>\n </FocusScope>\n );\n};\n\nexport interface ModalProps {\n /**\n * Optional body text content for the modal\n * */\n body?: string;\n /**\n * Content to render inside the modal\n * */\n children: React.ReactNode;\n /**\n * data-testid for the modal\n * */\n \"data-testid\"?: string;\n /**\n * Controls the visibility of the modal\n * */\n isOpen: boolean;\n /**\n * Whether to show the modal with an overlay background.\n * @default true\n * */\n isOverlay?: boolean;\n /**\n * Callback function when modal is closed\n * */\n onClose?: () => void;\n /**\n * Optional subtitle text below the modal title\n * */\n subtitle?: string;\n /**\n * Optional title text for the modal header\n * */\n title?: string;\n}\n\n/**\n * Modal component with overlay support and responsive behavior.\n *\n * API:\n * - {@link ModalProps}\n */\nconst ModalWrapper = ({\n isOpen,\n onClose,\n title,\n subtitle,\n body,\n children,\n isOverlay = true,\n \"data-testid\": dataTestId,\n}: ModalProps) => {\n const overlayRef = useRef<HTMLDivElement>(null);\n const { isClosing, handleClose } = useIsClosing({\n onClose,\n overlayRef,\n });\n const isMobile = useBreakpoint(BREAKPOINTS.MEDIUM);\n\n if (!isOpen) return null;\n\n const modalContent = (\n <ModalContent\n isOpen={isOpen}\n title={title}\n subtitle={subtitle}\n body={body}\n onClose={handleClose}\n isClosing={isClosing}\n data-testid={dataTestId}\n >\n {children}\n </ModalContent>\n );\n\n return isOverlay || isMobile ? (\n <ScreenOverlay fadeIn ref={overlayRef} onClose={handleClose}>\n {modalContent}\n </ScreenOverlay>\n ) : (\n modalContent\n );\n};\n\nexport const Modal = Object.assign(ModalWrapper, {\n /**\n * Renders a h2 styled title\n * */\n Title: ModalTitle,\n /**\n * Renders a h3 styled subtitle\n * */\n Subtitle: ModalSubtitle,\n /**\n * Renders a div styled body\n * */\n Body: ModalBody,\n /**\n * Renders a Proton Button action\n * - @prop buttonProps {@link ButtonProps}\n * */\n Action: ModalAction,\n /**\n * Renders a group of Proton Buttons\n * */\n Actions: ModalActions,\n});\n"],"names":["ModalTitle","children","jsx","ModalSubtitle","ModalBody","ModalAction","buttonProps","Button","ModalActions","FocusScope","ModalContent","title","subtitle","body","onClose","isClosing","dataTestId","ref","useRef","state","useOverlayTriggerState","modalProps","useModalOverlay","dialogProps","useDialog","usePreventScroll","closeButtonRef","closeButtonProps","useButton","jsxs","csx","mergeProps","ModalWrapper","isOpen","isOverlay","overlayRef","handleClose","useIsClosing","isMobile","useBreakpoint","BREAKPOINTS","modalContent","ScreenOverlay","Modal"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAMA,IAAa,CAAC,EAAE,UAAAC,QACbC,gBAAAA,EAAAA,IAAC,MAAA,EAAG,WAAU,uBAAuB,UAAAD,EAAA,CAAS,GAGjDE,IAAgB,CAAC,EAAE,UAAAF,QAChBC,gBAAAA,EAAAA,IAAC,MAAA,EAAG,WAAU,0BAA0B,UAAAD,EAAA,CAAS,GAGpDG,IAAY,CAAC,EAAE,UAAAH,QACZC,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,sBAAsB,UAAAD,EAAA,CAAS,GAGjDI,IAAc,CAACC,MAEjBJ,gBAAAA,MAAC,SAAI,WAAU,wBACb,gCAACK,GAAA,EAAQ,GAAGD,GAAa,EAAA,CAC3B,GAIEE,IAAe,CAAC,EAAE,UAAAP,QAEpBC,gBAAAA,EAAAA,IAACO,KAAW,WAAS,IACnB,gCAAC,OAAA,EAAI,WAAU,yBAAyB,UAAAR,EAAA,CAAS,EAAA,CACnD,GAIES,IAAe,CAAC;AAAA,EACpB,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAb;AAAA,EACA,WAAAc;AAAA,EACA,eAAeC;AACjB,MAEM;AACJ,QAAMC,IAAMC,EAAuB,IAAI,GACjCC,IAAQC,EAAuB,EAAE,QAAQ,IAAM,cAAcN,GAAS,GACtE,EAAE,YAAAO,MAAeC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AZ;AAAA,EACA,WAAAiC,IAAY;AAAA,EACZ,eAAelB;AACjB,MAAkB;AAChB,QAAMmB,IAAajB,EAAuB,IAAI,GACxC,EAAE,WAAAH,GAAW,aAAAqB,EAAA,IAAgBC,EAAa;AAAA,IAC9C,SAAAvB;AAAA,IACA,YAAAqB;AAAA,EAAA,CACD,GACKG,IAAWC,EAAcC,EAAY,MAAM;AAEjD,MAAI,CAACP,EAAQ,QAAO;AAEpB,QAAMQ,IACJvC,gBAAAA,EAAAA;AAAAA,IAACQ;AAAA,IAAA;AAAA,MACC,QAAAuB;AAAA,MACA,OAAAtB;AAAA,MACA,UAAAC;AAAA,MACA,MAAAC;AAAA,MACA,SAASuB;AAAA,MACT,WAAArB;AAAA,MACA,eAAaC;AAAA,MAEZ,UAAAf;AAAA,IAAA;AAAA,EAAA;AAIL,SAAOiC,KAAaI,IAClBpC,gBAAAA,EAAAA,IAACwC,GAAA,EAAc,QAAM,IAAC,KAAKP,GAAY,SAASC,GAC7C,UAAAK,EAAA,CACH,IAEAA;AAEJ,GAEaE,IAAQ,OAAO,OAAOX,GAAc;AAAA;AAAA;AAAA;AAAA,EAI/C,OAAOhC;AAAA;AAAA;AAAA;AAAA,EAIP,UAAUG;AAAA;AAAA;AAAA;AAAA,EAIV,MAAMC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN,QAAQC;AAAA;AAAA;AAAA;AAAA,EAIR,SAASG;AACX,CAAC;"}
1
+ {"version":3,"file":"Modal.es.js","sources":["../../../src/components/Modal/Modal.tsx"],"sourcesContent":["\"use client\";\n\nimport { useButton } from \"@react-aria/button\";\nimport { useDialog } from \"@react-aria/dialog\";\nimport { FocusScope } from \"@react-aria/focus\";\nimport { useModalOverlay, usePreventScroll } from \"@react-aria/overlays\";\nimport { mergeProps } from \"@react-aria/utils\";\nimport { useRef } from \"react\";\nimport { useOverlayTriggerState } from \"@react-stately/overlays\";\nimport { BREAKPOINTS } from \"../../constants\";\nimport { useBreakpoint } from \"../../hooks\";\nimport { useIsClosing } from \"../../hooks/useIsClosing\";\nimport { csx } from \"../../utils\";\nimport { Button, ButtonProps } from \"../Button/Button\";\nimport \"./Modal.css\";\nimport { ScreenOverlay } from \"../ScreenOverlay/ScreenOverlay\";\n\nconst ModalTitle = ({ children }: { children: React.ReactNode }) => {\n return <h2 className=\"proton-Modal__title\">{children}</h2>;\n};\n\nconst ModalSubtitle = ({ children }: { children: React.ReactNode }) => {\n return <h3 className=\"proton-Modal__subtitle\">{children}</h3>;\n};\n\nconst ModalBody = ({ children }: { children: React.ReactNode }) => {\n return <div className=\"proton-Modal__body\">{children}</div>;\n};\n\nconst ModalAction = (buttonProps: ButtonProps) => {\n return (\n <div className=\"proton-Modal__action\">\n <Button {...buttonProps} />\n </div>\n );\n};\n\nconst ModalActions = ({ children }: { children: React.ReactNode }) => {\n return (\n <FocusScope autoFocus>\n <div className=\"proton-Modal__actions\">{children}</div>\n </FocusScope>\n );\n};\n\nconst ModalContent = ({\n title,\n subtitle,\n body,\n onClose,\n children,\n isClosing,\n \"data-testid\": dataTestId,\n}: ModalProps & {\n isClosing: boolean;\n}) => {\n const ref = useRef<HTMLDivElement>(null);\n const state = useOverlayTriggerState({ isOpen: true, onOpenChange: onClose });\n const { modalProps } = useModalOverlay(\n {\n isDismissable: false, //handle dismiss behavior in useIsClosing\n },\n state,\n ref\n );\n\n const { dialogProps } = useDialog({ role: \"dialog\" }, ref);\n usePreventScroll();\n\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n const { buttonProps: closeButtonProps } = useButton(\n {\n onPress: onClose,\n \"aria-label\": \"Close\",\n },\n closeButtonRef\n );\n\n return (\n <FocusScope contain restoreFocus autoFocus>\n <div\n data-testid={dataTestId}\n className={csx(\"proton-Modal\", isClosing && \"proton-Modal--closing\")}\n {...mergeProps(modalProps, dialogProps)}\n ref={ref}\n >\n <button\n name=\"Close\"\n className=\"proton-Modal__close-button\"\n {...closeButtonProps}\n ref={closeButtonRef}\n >\n ×\n </button>\n {title && <ModalTitle>{title}</ModalTitle>}\n {subtitle && <ModalSubtitle>{subtitle}</ModalSubtitle>}\n {body && <ModalBody>{body}</ModalBody>}\n <div className=\"proton-Modal__content\">{children}</div>\n </div>\n </FocusScope>\n );\n};\n\nexport interface ModalProps {\n /**\n * Optional body text content for the modal\n * */\n body?: string;\n /**\n * Content to render inside the modal\n * */\n children: React.ReactNode;\n /**\n * data-testid for the modal\n * */\n \"data-testid\"?: string;\n /**\n * Controls the visibility of the modal\n * */\n isOpen: boolean;\n /**\n * Whether to show the modal with an overlay background.\n * @default true\n * */\n isOverlay?: boolean;\n /**\n * Callback function when modal is closed\n * */\n onClose?: () => void;\n /**\n * Optional subtitle text below the modal title\n * */\n subtitle?: string;\n /**\n * Optional title text for the modal header\n * */\n title?: string;\n}\n\n/**\n * Modal component with overlay support and responsive behavior.\n *\n * API:\n * - {@link ModalProps}\n */\nconst ModalWrapper = ({\n isOpen,\n onClose,\n title,\n subtitle,\n body,\n children,\n isOverlay = true,\n \"data-testid\": dataTestId,\n}: ModalProps) => {\n const overlayRef = useRef<HTMLDivElement>(null);\n const { isClosing, handleClose } = useIsClosing({\n onClose,\n overlayRef,\n });\n const isMobile = useBreakpoint(BREAKPOINTS.MEDIUM);\n\n if (!isOpen) return null;\n\n const modalContent = (\n <ModalContent\n isOpen={isOpen}\n title={title}\n subtitle={subtitle}\n body={body}\n onClose={handleClose}\n isClosing={isClosing}\n data-testid={dataTestId}\n >\n {children}\n </ModalContent>\n );\n\n return isOverlay || isMobile ? (\n <ScreenOverlay fadeIn ref={overlayRef} onClose={handleClose}>\n {modalContent}\n </ScreenOverlay>\n ) : (\n modalContent\n );\n};\n\nexport const Modal = Object.assign(ModalWrapper, {\n /**\n * Renders a h2 styled title\n * */\n Title: ModalTitle,\n /**\n * Renders a h3 styled subtitle\n * */\n Subtitle: ModalSubtitle,\n /**\n * Renders a div styled body\n * */\n Body: ModalBody,\n /**\n * Renders a Proton Button action\n * - @prop buttonProps {@link ButtonProps}\n * */\n Action: ModalAction,\n /**\n * Renders a group of Proton Buttons\n * */\n Actions: ModalActions,\n});\n"],"names":["ModalTitle","children","jsx","ModalSubtitle","ModalBody","ModalAction","buttonProps","Button","ModalActions","FocusScope","ModalContent","title","subtitle","body","onClose","isClosing","dataTestId","ref","useRef","state","useOverlayTriggerState","modalProps","useModalOverlay","dialogProps","useDialog","usePreventScroll","closeButtonRef","closeButtonProps","useButton","jsxs","csx","mergeProps","ModalWrapper","isOpen","isOverlay","overlayRef","handleClose","useIsClosing","isMobile","useBreakpoint","BREAKPOINTS","modalContent","ScreenOverlay","Modal"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAMA,IAAa,CAAC,EAAE,UAAAC,QACZC,gBAAAA,EAAAA,IAAA,MAAA,EAAG,WAAU,uBAAuB,UAAAD,EAAS,CAAA,GAGjDE,IAAgB,CAAC,EAAE,UAAAF,QACfC,gBAAAA,EAAAA,IAAA,MAAA,EAAG,WAAU,0BAA0B,UAAAD,EAAS,CAAA,GAGpDG,IAAY,CAAC,EAAE,UAAAH,QACXC,gBAAAA,EAAAA,IAAA,OAAA,EAAI,WAAU,sBAAsB,UAAAD,EAAS,CAAA,GAGjDI,IAAc,CAACC,MAEjBJ,gBAAAA,MAAC,SAAI,WAAU,wBACb,gCAACK,GAAQ,EAAA,GAAGD,EAAa,CAAA,EAC3B,CAAA,GAIEE,IAAe,CAAC,EAAE,UAAAP,QAEpBC,gBAAAA,EAAA,IAACO,KAAW,WAAS,IACnB,gCAAC,OAAI,EAAA,WAAU,yBAAyB,UAAAR,EAAS,CAAA,EACnD,CAAA,GAIES,IAAe,CAAC;AAAA,EACpB,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAb;AAAA,EACA,WAAAc;AAAA,EACA,eAAeC;AACjB,MAEM;AACE,QAAAC,IAAMC,EAAuB,IAAI,GACjCC,IAAQC,EAAuB,EAAE,QAAQ,IAAM,cAAcN,GAAS,GACtE,E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ACA,UAAAZ;AAAA,EACA,WAAAiC,IAAY;AAAA,EACZ,eAAelB;AACjB,MAAkB;AACV,QAAAmB,IAAajB,EAAuB,IAAI,GACxC,EAAE,WAAAH,GAAW,aAAAqB,EAAY,IAAIC,EAAa;AAAA,IAC9C,SAAAvB;AAAA,IACA,YAAAqB;AAAA,EAAA,CACD,GACKG,IAAWC,EAAcC,EAAY,MAAM;AAE7C,MAAA,CAACP,EAAe,QAAA;AAEpB,QAAMQ,IACJvC,gBAAAA,EAAA;AAAA,IAACQ;AAAA,IAAA;AAAA,MACC,QAAAuB;AAAA,MACA,OAAAtB;AAAA,MACA,UAAAC;AAAA,MACA,MAAAC;AAAA,MACA,SAASuB;AAAA,MACT,WAAArB;AAAA,MACA,eAAaC;AAAA,MAEZ,UAAAf;AAAA,IAAA;AAAA,EAAA;AAIE,SAAAiC,KAAaI,IAClBpC,gBAAAA,EAAAA,IAACwC,GAAc,EAAA,QAAM,IAAC,KAAKP,GAAY,SAASC,GAC7C,UAAAK,EAAA,CACH,IAEAA;AAEJ,GAEaE,IAAQ,OAAO,OAAOX,GAAc;AAAA;AAAA;AAAA;AAAA,EAI/C,OAAOhC;AAAA;AAAA;AAAA;AAAA,EAIP,UAAUG;AAAA;AAAA;AAAA;AAAA,EAIV,MAAMC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN,QAAQC;AAAA;AAAA;AAAA;AAAA,EAIR,SAASG;AACX,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.cjs.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as RadixPopover } from \"radix-ui\";\nimport React, { CSSProperties } from \"react\";\nimport \"./Popover.css\";\nimport { useTheme } from \"../ThemeProvider\";\nimport { csx } from \"../../utils/string\";\n\nexport type PopoverSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverProps {\n /**\n * The trigger element for the popover.\n */\n trigger: React.ReactNode;\n /**\n * The content of the popover.\n */\n children: React.ReactNode;\n /**\n * Constrain the width of the popover to the width of the trigger.\n */\n constrainWidth?: boolean;\n /**\n * Control open state (controlled mode).\n */\n open?: boolean;\n /**\n * Default open state (uncontrolled mode).\n */\n defaultOpen?: boolean;\n /**\n * Callback when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Popover side placement\n * {@link PopoverSide}\n */\n side?: PopoverSide;\n /**\n * Popover alignment\n * {@link PopoverAlign}\n */\n align?: PopoverAlign;\n /**\n * Show an arrow pointing to the trigger.\n */\n arrow?: boolean;\n /**\n * Test id for the popover content.\n */\n \"data-testid\"?: string;\n}\n\n/**\n * A popover component that handles positioning and supports controlled and uncontrolled modes.\n *\n * A popover displays interactive content in context with a trigger element.\n * A tooltip displays a description of an element on hover or focus.\n *\n * API:\n * - {@link PopoverProps}\n */\nexport function Popover({\n trigger,\n children,\n open,\n defaultOpen,\n onOpenChange,\n side = \"top\",\n align = \"center\",\n arrow = false,\n constrainWidth = false,\n \"data-testid\": testId,\n}: PopoverProps) {\n const { className: themeClass, style: themeStyle } = useTheme();\n\n return (\n <RadixPopover.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n >\n <RadixPopover.Trigger asChild>\n <div>{trigger}</div>\n </RadixPopover.Trigger>\n\n <RadixPopover.Portal>\n <RadixPopover.Content\n side={side}\n sideOffset={2}\n align={align}\n style={themeStyle as CSSProperties}\n className={csx(\n \"proton-Popover\",\n constrainWidth && \"proton-Popover__constrained\",\n themeClass\n )}\n data-testid={testId}\n >\n {arrow && <RadixPopover.Arrow className=\"arrow\" />}\n {children}\n </RadixPopover.Content>\n </RadixPopover.Portal>\n </RadixPopover.Root>\n );\n}\n\nPopover.displayName = \"Popover\";\n"],"names":["Popover","trigger","children","open","defaultOpen","onOpenChange","side","align","arrow","constrainWidth","testId","themeClass","themeStyle","useTheme","jsxs","RadixPopover","jsx","csx"],"mappings":"uRAiEO,SAASA,EAAQ,CACtB,QAAAC,EACA,SAAAC,EACA,KAAAC,EACA,YAAAC,EACA,aAAAC,EACA,KAAAC,EAAO,MACP,MAAAC,EAAQ,SACR,MAAAC,EAAQ,GACR,eAAAC,EAAiB,GACjB,cAAeC,CACjB,EAAiB,CACf,KAAM,CAAE,UAAWC,EAAY,MAAOC,CAAA,EAAeC,EAAAA,SAAA,EAErD,OACEC,EAAAA,kBAAAA,KAACC,EAAAA,QAAa,KAAb,CACC,KAAAZ,EACA,YAAAC,EACA,aAAAC,EAEA,SAAA,CAAAW,EAAAA,kBAAAA,IAACD,EAAAA,QAAa,QAAb,CAAqB,QAAO,GAC3B,SAAAC,EAAAA,kBAAAA,IAAC,MAAA,CAAK,WAAQ,CAAA,CAChB,EAEAA,EAAAA,kBAAAA,IAACD,EAAAA,QAAa,OAAb,CACC,SAAAD,EAAAA,kBAAAA,KAACC,EAAAA,QAAa,QAAb,CACC,KAAAT,EACA,WAAY,EACZ,MAAAC,EACA,MAAOK,EACP,UAAWK,EAAAA,IACT,iBACAR,GAAkB,8BAClBE,CAAA,EAEF,cAAaD,EAEZ,SAAA,CAAAF,GAASQ,EAAAA,kBAAAA,IAACD,EAAAA,QAAa,MAAb,CAAmB,UAAU,QAAQ,EAC/Cb,CAAA,CAAA,CAAA,CACH,CACF,CAAA,CAAA,CAAA,CAGN,CAEAF,EAAQ,YAAc"}
1
+ {"version":3,"file":"Popover.cjs.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as RadixPopover } from \"radix-ui\";\nimport React, { CSSProperties } from \"react\";\nimport \"./Popover.css\";\nimport { useTheme } from \"../ThemeProvider\";\nimport { csx } from \"../../utils/string\";\n\nexport type PopoverSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverProps {\n /**\n * The trigger element for the popover.\n */\n trigger: React.ReactNode;\n /**\n * The content of the popover.\n */\n children: React.ReactNode;\n /**\n * Constrain the width of the popover to the width of the trigger.\n */\n constrainWidth?: boolean;\n /**\n * Control open state (controlled mode).\n */\n open?: boolean;\n /**\n * Default open state (uncontrolled mode).\n */\n defaultOpen?: boolean;\n /**\n * Callback when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Popover side placement\n * {@link PopoverSide}\n */\n side?: PopoverSide;\n /**\n * Popover alignment\n * {@link PopoverAlign}\n */\n align?: PopoverAlign;\n /**\n * Show an arrow pointing to the trigger.\n */\n arrow?: boolean;\n /**\n * Test id for the popover content.\n */\n \"data-testid\"?: string;\n}\n\n/**\n * A popover component that handles positioning and supports controlled and uncontrolled modes.\n *\n * A popover displays interactive content in context with a trigger element.\n * A tooltip displays a description of an element on hover or focus.\n *\n * API:\n * - {@link PopoverProps}\n */\nexport function Popover({\n trigger,\n children,\n open,\n defaultOpen,\n onOpenChange,\n side = \"top\",\n align = \"center\",\n arrow = false,\n constrainWidth = false,\n \"data-testid\": testId,\n}: PopoverProps) {\n const { className: themeClass, style: themeStyle } = useTheme();\n\n return (\n <RadixPopover.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n >\n <RadixPopover.Trigger asChild>\n <div>{trigger}</div>\n </RadixPopover.Trigger>\n\n <RadixPopover.Portal>\n <RadixPopover.Content\n side={side}\n sideOffset={2}\n align={align}\n style={themeStyle as CSSProperties}\n className={csx(\n \"proton-Popover\",\n constrainWidth && \"proton-Popover__constrained\",\n themeClass\n )}\n data-testid={testId}\n >\n {arrow && <RadixPopover.Arrow className=\"arrow\" />}\n {children}\n </RadixPopover.Content>\n </RadixPopover.Portal>\n </RadixPopover.Root>\n );\n}\n\nPopover.displayName = \"Popover\";\n"],"names":["Popover","trigger","children","open","defaultOpen","onOpenChange","side","align","arrow","constrainWidth","testId","themeClass","themeStyle","useTheme","jsxs","RadixPopover","jsx","csx"],"mappings":"uRAiEO,SAASA,EAAQ,CACtB,QAAAC,EACA,SAAAC,EACA,KAAAC,EACA,YAAAC,EACA,aAAAC,EACA,KAAAC,EAAO,MACP,MAAAC,EAAQ,SACR,MAAAC,EAAQ,GACR,eAAAC,EAAiB,GACjB,cAAeC,CACjB,EAAiB,CACf,KAAM,CAAE,UAAWC,EAAY,MAAOC,CAAA,EAAeC,EAAAA,WAGnD,OAAAC,EAAA,kBAAA,KAACC,EAAAA,QAAa,KAAb,CACC,KAAAZ,EACA,YAAAC,EACA,aAAAC,EAEA,SAAA,CAACW,EAAAA,kBAAAA,IAAAD,EAAAA,QAAa,QAAb,CAAqB,QAAO,GAC3B,SAACC,EAAA,kBAAA,IAAA,MAAA,CAAK,WAAQ,CAChB,CAAA,EAEAA,EAAAA,kBAAAA,IAACD,EAAa,QAAA,OAAb,CACC,SAAAD,EAAA,kBAAA,KAACC,EAAAA,QAAa,QAAb,CACC,KAAAT,EACA,WAAY,EACZ,MAAAC,EACA,MAAOK,EACP,UAAWK,EAAA,IACT,iBACAR,GAAkB,8BAClBE,CACF,EACA,cAAaD,EAEZ,SAAA,CAAAF,GAAUQ,EAAA,kBAAA,IAAAD,EAAA,QAAa,MAAb,CAAmB,UAAU,QAAQ,EAC/Cb,CAAA,CAAA,CAAA,EAEL,CAAA,CAAA,CAAA,CAGN,CAEAF,EAAQ,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.es.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as RadixPopover } from \"radix-ui\";\nimport React, { CSSProperties } from \"react\";\nimport \"./Popover.css\";\nimport { useTheme } from \"../ThemeProvider\";\nimport { csx } from \"../../utils/string\";\n\nexport type PopoverSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverProps {\n /**\n * The trigger element for the popover.\n */\n trigger: React.ReactNode;\n /**\n * The content of the popover.\n */\n children: React.ReactNode;\n /**\n * Constrain the width of the popover to the width of the trigger.\n */\n constrainWidth?: boolean;\n /**\n * Control open state (controlled mode).\n */\n open?: boolean;\n /**\n * Default open state (uncontrolled mode).\n */\n defaultOpen?: boolean;\n /**\n * Callback when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Popover side placement\n * {@link PopoverSide}\n */\n side?: PopoverSide;\n /**\n * Popover alignment\n * {@link PopoverAlign}\n */\n align?: PopoverAlign;\n /**\n * Show an arrow pointing to the trigger.\n */\n arrow?: boolean;\n /**\n * Test id for the popover content.\n */\n \"data-testid\"?: string;\n}\n\n/**\n * A popover component that handles positioning and supports controlled and uncontrolled modes.\n *\n * A popover displays interactive content in context with a trigger element.\n * A tooltip displays a description of an element on hover or focus.\n *\n * API:\n * - {@link PopoverProps}\n */\nexport function Popover({\n trigger,\n children,\n open,\n defaultOpen,\n onOpenChange,\n side = \"top\",\n align = \"center\",\n arrow = false,\n constrainWidth = false,\n \"data-testid\": testId,\n}: PopoverProps) {\n const { className: themeClass, style: themeStyle } = useTheme();\n\n return (\n <RadixPopover.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n >\n <RadixPopover.Trigger asChild>\n <div>{trigger}</div>\n </RadixPopover.Trigger>\n\n <RadixPopover.Portal>\n <RadixPopover.Content\n side={side}\n sideOffset={2}\n align={align}\n style={themeStyle as CSSProperties}\n className={csx(\n \"proton-Popover\",\n constrainWidth && \"proton-Popover__constrained\",\n themeClass\n )}\n data-testid={testId}\n >\n {arrow && <RadixPopover.Arrow className=\"arrow\" />}\n {children}\n </RadixPopover.Content>\n </RadixPopover.Portal>\n </RadixPopover.Root>\n );\n}\n\nPopover.displayName = \"Popover\";\n"],"names":["Popover","trigger","children","open","defaultOpen","onOpenChange","side","align","arrow","constrainWidth","testId","themeClass","themeStyle","useTheme","jsxs","RadixPopover","jsx","csx"],"mappings":";;;;;AAiEO,SAASA,EAAQ;AAAA,EACtB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,gBAAAC,IAAiB;AAAA,EACjB,eAAeC;AACjB,GAAiB;AACf,QAAM,EAAE,WAAWC,GAAY,OAAOC,EAAA,IAAeC,EAAA;AAErD,SACEC,gBAAAA,EAAAA;AAAAA,IAACC,EAAa;AAAA,IAAb;AAAA,MACC,MAAAZ;AAAA,MACA,aAAAC;AAAA,MACA,cAAAC;AAAA,MAEA,UAAA;AAAA,QAAAW,gBAAAA,EAAAA,IAACD,EAAa,SAAb,EAAqB,SAAO,IAC3B,UAAAC,gBAAAA,EAAAA,IAAC,OAAA,EAAK,aAAQ,EAAA,CAChB;AAAA,QAEAA,gBAAAA,EAAAA,IAACD,EAAa,QAAb,EACC,UAAAD,gBAAAA,EAAAA;AAAAA,UAACC,EAAa;AAAA,UAAb;AAAA,YACC,MAAAT;AAAA,YACA,YAAY;AAAA,YACZ,OAAAC;AAAA,YACA,OAAOK;AAAA,YACP,WAAWK;AAAA,cACT;AAAA,cACAR,KAAkB;AAAA,cAClBE;AAAA,YAAA;AAAA,YAEF,eAAaD;AAAA,YAEZ,UAAA;AAAA,cAAAF,KAASQ,gBAAAA,EAAAA,IAACD,EAAa,OAAb,EAAmB,WAAU,SAAQ;AAAA,cAC/Cb;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,EACH,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEAF,EAAQ,cAAc;"}
1
+ {"version":3,"file":"Popover.es.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as RadixPopover } from \"radix-ui\";\nimport React, { CSSProperties } from \"react\";\nimport \"./Popover.css\";\nimport { useTheme } from \"../ThemeProvider\";\nimport { csx } from \"../../utils/string\";\n\nexport type PopoverSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverProps {\n /**\n * The trigger element for the popover.\n */\n trigger: React.ReactNode;\n /**\n * The content of the popover.\n */\n children: React.ReactNode;\n /**\n * Constrain the width of the popover to the width of the trigger.\n */\n constrainWidth?: boolean;\n /**\n * Control open state (controlled mode).\n */\n open?: boolean;\n /**\n * Default open state (uncontrolled mode).\n */\n defaultOpen?: boolean;\n /**\n * Callback when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Popover side placement\n * {@link PopoverSide}\n */\n side?: PopoverSide;\n /**\n * Popover alignment\n * {@link PopoverAlign}\n */\n align?: PopoverAlign;\n /**\n * Show an arrow pointing to the trigger.\n */\n arrow?: boolean;\n /**\n * Test id for the popover content.\n */\n \"data-testid\"?: string;\n}\n\n/**\n * A popover component that handles positioning and supports controlled and uncontrolled modes.\n *\n * A popover displays interactive content in context with a trigger element.\n * A tooltip displays a description of an element on hover or focus.\n *\n * API:\n * - {@link PopoverProps}\n */\nexport function Popover({\n trigger,\n children,\n open,\n defaultOpen,\n onOpenChange,\n side = \"top\",\n align = \"center\",\n arrow = false,\n constrainWidth = false,\n \"data-testid\": testId,\n}: PopoverProps) {\n const { className: themeClass, style: themeStyle } = useTheme();\n\n return (\n <RadixPopover.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n >\n <RadixPopover.Trigger asChild>\n <div>{trigger}</div>\n </RadixPopover.Trigger>\n\n <RadixPopover.Portal>\n <RadixPopover.Content\n side={side}\n sideOffset={2}\n align={align}\n style={themeStyle as CSSProperties}\n className={csx(\n \"proton-Popover\",\n constrainWidth && \"proton-Popover__constrained\",\n themeClass\n )}\n data-testid={testId}\n >\n {arrow && <RadixPopover.Arrow className=\"arrow\" />}\n {children}\n </RadixPopover.Content>\n </RadixPopover.Portal>\n </RadixPopover.Root>\n );\n}\n\nPopover.displayName = \"Popover\";\n"],"names":["Popover","trigger","children","open","defaultOpen","onOpenChange","side","align","arrow","constrainWidth","testId","themeClass","themeStyle","useTheme","jsxs","RadixPopover","jsx","csx"],"mappings":";;;;;AAiEO,SAASA,EAAQ;AAAA,EACtB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,gBAAAC,IAAiB;AAAA,EACjB,eAAeC;AACjB,GAAiB;AACf,QAAM,EAAE,WAAWC,GAAY,OAAOC,EAAA,IAAeC;AAGnD,SAAAC,gBAAAA,EAAA;AAAA,IAACC,EAAa;AAAA,IAAb;AAAA,MACC,MAAAZ;AAAA,MACA,aAAAC;AAAA,MACA,cAAAC;AAAA,MAEA,UAAA;AAAA,QAACW,gBAAAA,EAAAA,IAAAD,EAAa,SAAb,EAAqB,SAAO,IAC3B,UAACC,gBAAAA,EAAA,IAAA,OAAA,EAAK,aAAQ,EAChB,CAAA;AAAA,QAEAA,gBAAAA,EAAAA,IAACD,EAAa,QAAb,EACC,UAAAD,gBAAAA,EAAA;AAAA,UAACC,EAAa;AAAA,UAAb;AAAA,YACC,MAAAT;AAAA,YACA,YAAY;AAAA,YACZ,OAAAC;AAAA,YACA,OAAOK;AAAA,YACP,WAAWK;AAAA,cACT;AAAA,cACAR,KAAkB;AAAA,cAClBE;AAAA,YACF;AAAA,YACA,eAAaD;AAAA,YAEZ,UAAA;AAAA,cAAAF,KAAUQ,gBAAAA,EAAA,IAAAD,EAAa,OAAb,EAAmB,WAAU,SAAQ;AAAA,cAC/Cb;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA,GAEL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEAF,EAAQ,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScreenOverlay.cjs.js","sources":["../../../src/components/ScreenOverlay/ScreenOverlay.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect } from \"react\";\nimport \"./ScreenOverlay.css\";\nimport { csx } from \"../../utils\";\nimport { Portal } from \"radix-ui\";\nimport { useTheme, ThemeProvider } from \"../ThemeProvider\";\n\ninterface ScreenOverlayProps {\n /**\n * Children to render inside the overlay.\n */\n children?: React.ReactNode;\n\n /**\n * Whether to fade in the overlay.\n */\n fadeIn?: boolean;\n\n /**\n * Callback function to handle events (click or ESC key).\n */\n onClose?: () => void;\n\n /**\n * Ref to the overlay element.\n */\n ref?: React.RefObject<HTMLDivElement>;\n}\n\n/**\n * Base Overlay component for creating modal-like backgrounds.\n *\n * API:\n * - {@link ScreenOverlayProps}\n */\nexport const ScreenOverlay = forwardRef<HTMLDivElement, ScreenOverlayProps>(\n ({ fadeIn = false, onClose, children }, ref) => {\n const { theme, palette } = useTheme();\n\n useEffect(() => {\n if (!onClose) return;\n\n const handleEscKey = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") onClose();\n };\n\n document.addEventListener(\"keydown\", handleEscKey);\n return () => {\n document.removeEventListener(\"keydown\", handleEscKey);\n };\n }, [onClose]);\n\n return (\n <Portal.Root>\n <ThemeProvider theme={theme} palette={palette}>\n <div\n ref={ref}\n id=\"background\"\n aria-label=\"Background overlay\"\n role=\"dialog\"\n aria-modal=\"true\"\n data-testid=\"screen-overlay\"\n className={csx(\n \"proton-ScreenOverlay__background\",\n \"proton-ScreenOverlay__z-index\",\n fadeIn && \"proton-ScreenOverlay__fade-in\"\n )}\n onClick={(event: React.MouseEvent) => {\n if (!onClose) return;\n\n // Only trigger onClose if the click was directly on the background element\n if (event.target === event.currentTarget) {\n onClose();\n }\n }}\n >\n {children}\n </div>\n </ThemeProvider>\n </Portal.Root>\n );\n }\n);\n\nScreenOverlay.displayName = \"ProtonUIScreenOverlay\";\n"],"names":["ScreenOverlay","forwardRef","fadeIn","onClose","children","ref","theme","palette","useTheme","useEffect","handleEscKey","event","Portal","jsx","ThemeProvider","csx"],"mappings":"gTAoCaA,EAAgBC,EAAAA,WAC3B,CAAC,CAAE,OAAAC,EAAS,GAAO,QAAAC,EAAS,SAAAC,CAAA,EAAYC,IAAQ,CAC9C,KAAM,CAAE,MAAAC,EAAO,QAAAC,CAAA,EAAYC,WAAA,EAE3BC,OAAAA,EAAAA,UAAU,IAAM,CACd,GAAI,CAACN,EAAS,OAEd,MAAMO,EAAgBC,GAAyB,CACzCA,EAAM,MAAQ,UAAUR,EAAA,CAC9B,EAEA,gBAAS,iBAAiB,UAAWO,CAAY,EAC1C,IAAM,CACX,SAAS,oBAAoB,UAAWA,CAAY,CACtD,CACF,EAAG,CAACP,CAAO,CAAC,0BAGTS,EAAAA,OAAO,KAAP,CACC,SAAAC,wBAACC,EAAAA,cAAA,CAAc,MAAAR,EAAc,QAAAC,EAC3B,SAAAM,EAAAA,kBAAAA,IAAC,MAAA,CACC,IAAAR,EACA,GAAG,aACH,aAAW,qBACX,KAAK,SACL,aAAW,OACX,cAAY,iBACZ,UAAWU,EAAAA,IACT,mCACA,gCACAb,GAAU,+BAAA,EAEZ,QAAUS,GAA4B,CAC/BR,GAGDQ,EAAM,SAAWA,EAAM,eACzBR,EAAA,CAEJ,EAEC,SAAAC,CAAA,CAAA,EAEL,CAAA,CACF,CAEJ,CACF,EAEAJ,EAAc,YAAc"}
1
+ {"version":3,"file":"ScreenOverlay.cjs.js","sources":["../../../src/components/ScreenOverlay/ScreenOverlay.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect } from \"react\";\nimport \"./ScreenOverlay.css\";\nimport { csx } from \"../../utils\";\nimport { Portal } from \"radix-ui\";\nimport { useTheme, ThemeProvider } from \"../ThemeProvider\";\n\ninterface ScreenOverlayProps {\n /**\n * Children to render inside the overlay.\n */\n children?: React.ReactNode;\n\n /**\n * Whether to fade in the overlay.\n */\n fadeIn?: boolean;\n\n /**\n * Callback function to handle events (click or ESC key).\n */\n onClose?: () => void;\n\n /**\n * Ref to the overlay element.\n */\n ref?: React.RefObject<HTMLDivElement>;\n}\n\n/**\n * Base Overlay component for creating modal-like backgrounds.\n *\n * API:\n * - {@link ScreenOverlayProps}\n */\nexport const ScreenOverlay = forwardRef<HTMLDivElement, ScreenOverlayProps>(\n ({ fadeIn = false, onClose, children }, ref) => {\n const { theme, palette } = useTheme();\n\n useEffect(() => {\n if (!onClose) return;\n\n const handleEscKey = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") onClose();\n };\n\n document.addEventListener(\"keydown\", handleEscKey);\n return () => {\n document.removeEventListener(\"keydown\", handleEscKey);\n };\n }, [onClose]);\n\n return (\n <Portal.Root>\n <ThemeProvider theme={theme} palette={palette}>\n <div\n ref={ref}\n id=\"background\"\n aria-label=\"Background overlay\"\n role=\"dialog\"\n aria-modal=\"true\"\n data-testid=\"screen-overlay\"\n className={csx(\n \"proton-ScreenOverlay__background\",\n \"proton-ScreenOverlay__z-index\",\n fadeIn && \"proton-ScreenOverlay__fade-in\"\n )}\n onClick={(event: React.MouseEvent) => {\n if (!onClose) return;\n\n // Only trigger onClose if the click was directly on the background element\n if (event.target === event.currentTarget) {\n onClose();\n }\n }}\n >\n {children}\n </div>\n </ThemeProvider>\n </Portal.Root>\n );\n }\n);\n\nScreenOverlay.displayName = \"ProtonUIScreenOverlay\";\n"],"names":["ScreenOverlay","forwardRef","fadeIn","onClose","children","ref","theme","palette","useTheme","useEffect","handleEscKey","event","Portal","jsx","ThemeProvider","csx"],"mappings":"gTAoCaA,EAAgBC,EAAA,WAC3B,CAAC,CAAE,OAAAC,EAAS,GAAO,QAAAC,EAAS,SAAAC,CAAA,EAAYC,IAAQ,CAC9C,KAAM,CAAE,MAAAC,EAAO,QAAAC,CAAQ,EAAIC,EAAS,SAAA,EAEpCC,OAAAA,EAAAA,UAAU,IAAM,CACd,GAAI,CAACN,EAAS,OAER,MAAAO,EAAgBC,GAAyB,CACzCA,EAAM,MAAQ,UAAkBR,EAAA,CAAA,EAG7B,gBAAA,iBAAiB,UAAWO,CAAY,EAC1C,IAAM,CACF,SAAA,oBAAoB,UAAWA,CAAY,CAAA,CACtD,EACC,CAACP,CAAO,CAAC,0BAGTS,EAAAA,OAAO,KAAP,CACC,SAACC,wBAAAC,EAAAA,cAAA,CAAc,MAAAR,EAAc,QAAAC,EAC3B,SAAAM,EAAA,kBAAA,IAAC,MAAA,CACC,IAAAR,EACA,GAAG,aACH,aAAW,qBACX,KAAK,SACL,aAAW,OACX,cAAY,iBACZ,UAAWU,EAAA,IACT,mCACA,gCACAb,GAAU,+BACZ,EACA,QAAUS,GAA4B,CAC/BR,GAGDQ,EAAM,SAAWA,EAAM,eACjBR,GAEZ,EAEC,SAAAC,CAAA,CAAA,CAEL,CAAA,CACF,CAAA,CAEJ,CACF,EAEAJ,EAAc,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScreenOverlay.es.js","sources":["../../../src/components/ScreenOverlay/ScreenOverlay.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect } from \"react\";\nimport \"./ScreenOverlay.css\";\nimport { csx } from \"../../utils\";\nimport { Portal } from \"radix-ui\";\nimport { useTheme, ThemeProvider } from \"../ThemeProvider\";\n\ninterface ScreenOverlayProps {\n /**\n * Children to render inside the overlay.\n */\n children?: React.ReactNode;\n\n /**\n * Whether to fade in the overlay.\n */\n fadeIn?: boolean;\n\n /**\n * Callback function to handle events (click or ESC key).\n */\n onClose?: () => void;\n\n /**\n * Ref to the overlay element.\n */\n ref?: React.RefObject<HTMLDivElement>;\n}\n\n/**\n * Base Overlay component for creating modal-like backgrounds.\n *\n * API:\n * - {@link ScreenOverlayProps}\n */\nexport const ScreenOverlay = forwardRef<HTMLDivElement, ScreenOverlayProps>(\n ({ fadeIn = false, onClose, children }, ref) => {\n const { theme, palette } = useTheme();\n\n useEffect(() => {\n if (!onClose) return;\n\n const handleEscKey = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") onClose();\n };\n\n document.addEventListener(\"keydown\", handleEscKey);\n return () => {\n document.removeEventListener(\"keydown\", handleEscKey);\n };\n }, [onClose]);\n\n return (\n <Portal.Root>\n <ThemeProvider theme={theme} palette={palette}>\n <div\n ref={ref}\n id=\"background\"\n aria-label=\"Background overlay\"\n role=\"dialog\"\n aria-modal=\"true\"\n data-testid=\"screen-overlay\"\n className={csx(\n \"proton-ScreenOverlay__background\",\n \"proton-ScreenOverlay__z-index\",\n fadeIn && \"proton-ScreenOverlay__fade-in\"\n )}\n onClick={(event: React.MouseEvent) => {\n if (!onClose) return;\n\n // Only trigger onClose if the click was directly on the background element\n if (event.target === event.currentTarget) {\n onClose();\n }\n }}\n >\n {children}\n </div>\n </ThemeProvider>\n </Portal.Root>\n );\n }\n);\n\nScreenOverlay.displayName = \"ProtonUIScreenOverlay\";\n"],"names":["ScreenOverlay","forwardRef","fadeIn","onClose","children","ref","theme","palette","useTheme","useEffect","handleEscKey","event","Portal","jsx","ThemeProvider","csx"],"mappings":";;;;;;AAoCO,MAAMA,IAAgBC;AAAA,EAC3B,CAAC,EAAE,QAAAC,IAAS,IAAO,SAAAC,GAAS,UAAAC,EAAA,GAAYC,MAAQ;AAC9C,UAAM,EAAE,OAAAC,GAAO,SAAAC,EAAA,IAAYC,EAAA;AAE3B,WAAAC,EAAU,MAAM;AACd,UAAI,CAACN,EAAS;AAEd,YAAMO,IAAe,CAACC,MAAyB;AAC7C,QAAIA,EAAM,QAAQ,YAAUR,EAAA;AAAA,MAC9B;AAEA,sBAAS,iBAAiB,WAAWO,CAAY,GAC1C,MAAM;AACX,iBAAS,oBAAoB,WAAWA,CAAY;AAAA,MACtD;AAAA,IACF,GAAG,CAACP,CAAO,CAAC,yBAGTS,EAAO,MAAP,EACC,UAAAC,gBAAAA,MAACC,GAAA,EAAc,OAAAR,GAAc,SAAAC,GAC3B,UAAAM,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAR;AAAA,QACA,IAAG;AAAA,QACH,cAAW;AAAA,QACX,MAAK;AAAA,QACL,cAAW;AAAA,QACX,eAAY;AAAA,QACZ,WAAWU;AAAA,UACT;AAAA,UACA;AAAA,UACAb,KAAU;AAAA,QAAA;AAAA,QAEZ,SAAS,CAACS,MAA4B;AACpC,UAAKR,KAGDQ,EAAM,WAAWA,EAAM,iBACzBR,EAAA;AAAA,QAEJ;AAAA,QAEC,UAAAC;AAAA,MAAA;AAAA,IAAA,GAEL,EAAA,CACF;AAAA,EAEJ;AACF;AAEAJ,EAAc,cAAc;"}
1
+ {"version":3,"file":"ScreenOverlay.es.js","sources":["../../../src/components/ScreenOverlay/ScreenOverlay.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, useEffect } from \"react\";\nimport \"./ScreenOverlay.css\";\nimport { csx } from \"../../utils\";\nimport { Portal } from \"radix-ui\";\nimport { useTheme, ThemeProvider } from \"../ThemeProvider\";\n\ninterface ScreenOverlayProps {\n /**\n * Children to render inside the overlay.\n */\n children?: React.ReactNode;\n\n /**\n * Whether to fade in the overlay.\n */\n fadeIn?: boolean;\n\n /**\n * Callback function to handle events (click or ESC key).\n */\n onClose?: () => void;\n\n /**\n * Ref to the overlay element.\n */\n ref?: React.RefObject<HTMLDivElement>;\n}\n\n/**\n * Base Overlay component for creating modal-like backgrounds.\n *\n * API:\n * - {@link ScreenOverlayProps}\n */\nexport const ScreenOverlay = forwardRef<HTMLDivElement, ScreenOverlayProps>(\n ({ fadeIn = false, onClose, children }, ref) => {\n const { theme, palette } = useTheme();\n\n useEffect(() => {\n if (!onClose) return;\n\n const handleEscKey = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") onClose();\n };\n\n document.addEventListener(\"keydown\", handleEscKey);\n return () => {\n document.removeEventListener(\"keydown\", handleEscKey);\n };\n }, [onClose]);\n\n return (\n <Portal.Root>\n <ThemeProvider theme={theme} palette={palette}>\n <div\n ref={ref}\n id=\"background\"\n aria-label=\"Background overlay\"\n role=\"dialog\"\n aria-modal=\"true\"\n data-testid=\"screen-overlay\"\n className={csx(\n \"proton-ScreenOverlay__background\",\n \"proton-ScreenOverlay__z-index\",\n fadeIn && \"proton-ScreenOverlay__fade-in\"\n )}\n onClick={(event: React.MouseEvent) => {\n if (!onClose) return;\n\n // Only trigger onClose if the click was directly on the background element\n if (event.target === event.currentTarget) {\n onClose();\n }\n }}\n >\n {children}\n </div>\n </ThemeProvider>\n </Portal.Root>\n );\n }\n);\n\nScreenOverlay.displayName = \"ProtonUIScreenOverlay\";\n"],"names":["ScreenOverlay","forwardRef","fadeIn","onClose","children","ref","theme","palette","useTheme","useEffect","handleEscKey","event","Portal","jsx","ThemeProvider","csx"],"mappings":";;;;;;AAoCO,MAAMA,IAAgBC;AAAA,EAC3B,CAAC,EAAE,QAAAC,IAAS,IAAO,SAAAC,GAAS,UAAAC,EAAA,GAAYC,MAAQ;AAC9C,UAAM,EAAE,OAAAC,GAAO,SAAAC,EAAQ,IAAIC,EAAS;AAEpC,WAAAC,EAAU,MAAM;AACd,UAAI,CAACN,EAAS;AAER,YAAAO,IAAe,CAACC,MAAyB;AACzC,QAAAA,EAAM,QAAQ,YAAkBR,EAAA;AAAA,MAAA;AAG7B,sBAAA,iBAAiB,WAAWO,CAAY,GAC1C,MAAM;AACF,iBAAA,oBAAoB,WAAWA,CAAY;AAAA,MAAA;AAAA,IACtD,GACC,CAACP,CAAO,CAAC,yBAGTS,EAAO,MAAP,EACC,UAACC,gBAAAA,MAAAC,GAAA,EAAc,OAAAR,GAAc,SAAAC,GAC3B,UAAAM,gBAAAA,EAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAR;AAAA,QACA,IAAG;AAAA,QACH,cAAW;AAAA,QACX,MAAK;AAAA,QACL,cAAW;AAAA,QACX,eAAY;AAAA,QACZ,WAAWU;AAAA,UACT;AAAA,UACA;AAAA,UACAb,KAAU;AAAA,QACZ;AAAA,QACA,SAAS,CAACS,MAA4B;AACpC,UAAKR,KAGDQ,EAAM,WAAWA,EAAM,iBACjBR;QAEZ;AAAA,QAEC,UAAAC;AAAA,MAAA;AAAA,IAAA,EAEL,CAAA,EACF,CAAA;AAAA,EAEJ;AACF;AAEAJ,EAAc,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n ReactNode,\n RefObject,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { Select as RadixSelect } from \"radix-ui\";\n\nimport { BREAKPOINTS } from \"../../constants\";\nimport { useBreakpoint } from \"../../hooks/useBreakpoint\";\nimport { csx } from \"../../utils\";\nimport { ActionMenu, ActionMenuAction } from \"../ActionMenu/ActionMenu\";\n\nimport \"./Select.css\";\nimport \"../Menu/Menu.css\";\nimport { useTheme } from \"../ThemeProvider\";\n\ninterface SelectButtonProps {\n disabled?: boolean;\n isOpen?: boolean;\n children?: ReactNode;\n onClick?: () => void;\n isRounded?: boolean;\n}\n\nconst SelectButton = forwardRef<HTMLButtonElement, SelectButtonProps>(\n (\n { disabled, isOpen, children, onClick, isRounded, ...props },\n ref: RefObject<HTMLButtonElement>\n ) => {\n return (\n <button\n {...props}\n ref={ref}\n disabled={disabled}\n onClick={onClick}\n className={csx(\n \"proton-Select__trigger\",\n disabled && \"proton-Select__trigger--disabled\",\n !isOpen && \"proton-Select__trigger--closed\",\n isOpen && \"proton-Select__trigger--opened\",\n isRounded && \"proton-Select__trigger--rounded\"\n )}\n >\n {children}\n </button>\n );\n }\n);\nSelectButton.displayName = \"ProtonUISelectButton\";\n\nexport interface SelectItem {\n /** The label to display for the item */\n label: string;\n\n /** The key of the item */\n key: string;\n\n /** The URL to navigate to when the item is clicked, turns item into an a tag */\n to?: string;\n}\n\nexport interface SelectProps {\n /** Array of keys that should be disabled\n * @example [\"Thing 1\", \"Thing 2\"]\n */\n disabledKeys?: string[];\n\n /** The key of the default selected item */\n defaultSelectedKey?: string;\n\n /** Test ID for the select */\n \"data-testid\"?: string;\n\n /** Whether the select is disabled */\n isDisabled?: boolean;\n\n /** Array of items to display\n * @example [{ key: \"thing-1\", label: \"Thing 1\" }, { key: \"thing-2\", label: \"Thing 2\" }]\n * @see {@link SelectItem}\n */\n items: SelectItem[];\n\n /** Whether the select button is rounded\n * @default false\n */\n isRounded?: boolean;\n\n /** Label to display above the select\n * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#text\n */\n label?: string;\n\n /** The name of the select field */\n name: string;\n\n /** Callback fired when the menu closes */\n onClose?: () => void;\n\n /** Callback fired when the menu opens */\n onOpen?: () => void;\n\n /** Callback fired when selection changes */\n onSelectionChange?: (key: string) => void;\n\n /** Currently selected key */\n selectedKey?: string;\n}\n\n/**\n * A dropdown select menu that opens a popover on desktop and an action menu on mobile.\n * Supports controlled and uncontrolled modes.\n *\n * API:\n * - {@link SelectProps}\n */\nexport function Select({\n label,\n name,\n isDisabled,\n disabledKeys,\n selectedKey,\n onSelectionChange,\n defaultSelectedKey,\n onOpen, \n onClose,\n items,\n isRounded = false,\n \"data-testid\": testId,\n}: SelectProps) {\n const [isOpen, setIsOpen] = useState(false);\n const [internalSelectedKey, setInternalSelectedKey] = useState(\n selectedKey || defaultSelectedKey || \"\"\n );\n const { className: themeClass, style: themeStyle } = useTheme();\n const isMobile = useBreakpoint(BREAKPOINTS.MEDIUM);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const hiddenInputRef = useRef<HTMLInputElement>(null);\n\n // Handle controlled vs uncontrolled state\n const currentSelectedKey =\n selectedKey !== undefined ? selectedKey : internalSelectedKey;\n const selectedItem = items.find((item) => item.key === currentSelectedKey);\n\n const handleValueChange = (value: string) => {\n if (selectedKey === undefined) {\n setInternalSelectedKey(value);\n }\n onSelectionChange?.(value);\n\n // Update hidden input for form submission\n if (hiddenInputRef.current) {\n hiddenInputRef.current.value = value;\n hiddenInputRef.current.dispatchEvent(\n new Event(\"change\", { bubbles: true })\n );\n }\n };\n\n const handleOpenChange = (open: boolean) => {\n setIsOpen(open);\n if (open) {\n onOpen?.();\n } else {\n onClose?.();\n }\n };\n\n // Update internal state when controlled selectedKey changes\n useEffect(() => {\n if (selectedKey !== undefined) {\n setInternalSelectedKey(selectedKey);\n }\n }, [selectedKey]);\n\n const actionItems: ActionMenuAction[] = items.map((item) => ({\n key: item.key,\n label: item.label,\n to: item.to,\n onAction: () => {\n handleValueChange(item.key);\n setIsOpen(false);\n },\n }));\n\n if (isMobile) {\n return (\n <div\n className=\"proton-Select\"\n aria-label={label || name}\n aria-disabled={isDisabled}\n >\n {label && (\n <div className=\"proton-Select__label\" data-testid=\"select-label\">\n {label}\n </div>\n )}\n\n {/* Hidden input for form submission */}\n <input\n ref={hiddenInputRef}\n type=\"hidden\"\n name={name}\n value={currentSelectedKey}\n data-testid=\"hidden-select-container\"\n />\n\n <SelectButton\n isOpen={isOpen}\n isRounded={isRounded}\n ref={triggerRef}\n disabled={isDisabled}\n data-testid={testId}\n onClick={() => setIsOpen(true)}\n >\n <div className=\"proton-Select__value\">\n {selectedItem ? selectedItem.label : \"Select an option\"}\n </div>\n <div\n className={csx(\n \"proton-Select__trigger_icon\",\n isOpen && \"proton-Select__trigger_icon--flipped\"\n )}\n aria-hidden=\"true\"\n >\n <svg id=\"caret-down\" viewBox=\"0 0 512 512\">\n <title>{isOpen ? \"caret down\" : \"caret up\"}</title>\n <path\n fill=\"currentColor\"\n d=\"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"\n />\n </svg>\n </div>\n </SelectButton>\n\n <ActionMenu\n isOpen={isOpen}\n onClose={() => setIsOpen(false)}\n actions={actionItems}\n selectedKeys={[currentSelectedKey]}\n disabledKeys={disabledKeys}\n />\n </div>\n );\n }\n\n return (\n <div\n className=\"proton-Select\"\n aria-label={label || name}\n aria-disabled={isDisabled}\n >\n {label && (\n <div className=\"proton-Select__label\" data-testid=\"select-label\">\n {label}\n </div>\n )}\n\n {/* Hidden input for form submission */}\n <input\n ref={hiddenInputRef}\n type=\"hidden\"\n name={name}\n value={currentSelectedKey}\n data-testid=\"hidden-select-container\"\n />\n\n <RadixSelect.Root\n value={currentSelectedKey}\n onValueChange={handleValueChange}\n onOpenChange={handleOpenChange}\n disabled={isDisabled}\n >\n <RadixSelect.Trigger asChild>\n <SelectButton\n isRounded={isRounded}\n isOpen={isOpen}\n ref={triggerRef}\n disabled={isDisabled}\n data-testid={testId}\n >\n <RadixSelect.Value\n className=\"proton-Select__value\"\n placeholder=\"Select an option\"\n >\n {selectedItem ? selectedItem.label : \"Select an option\"}\n </RadixSelect.Value>\n <RadixSelect.Icon asChild>\n <div\n className={csx(\n \"proton-Select__trigger_icon\",\n isOpen && \"proton-Select__trigger_icon--flipped\"\n )}\n aria-hidden=\"true\"\n >\n <svg id=\"caret-down\" viewBox=\"0 0 512 512\">\n <title>{isOpen ? \"caret down\" : \"caret up\"}</title>\n <path\n fill=\"currentColor\"\n d=\"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"\n />\n </svg>\n </div>\n </RadixSelect.Icon>\n </SelectButton>\n </RadixSelect.Trigger>\n\n <RadixSelect.Portal>\n <RadixSelect.Content\n className={csx(\n \"proton-Menu\",\n \"proton-MenuTrigger__menu\",\n themeClass\n )}\n style={themeStyle as React.CSSProperties}\n position=\"popper\"\n >\n <RadixSelect.Viewport>\n {items.map((item) => (\n <RadixSelect.Item\n key={item.key}\n value={item.key}\n disabled={disabledKeys?.includes(item.key)}\n className=\"proton-Menu__item\"\n >\n <RadixSelect.ItemText>{item.label}</RadixSelect.ItemText>\n </RadixSelect.Item>\n ))}\n </RadixSelect.Viewport>\n </RadixSelect.Content>\n </RadixSelect.Portal>\n </RadixSelect.Root>\n </div>\n );\n}\n\nSelect.displayName = \"ProtonUISelect\";\n"],"names":["SelectButton","forwardRef","disabled","isOpen","children","onClick","isRounded","props","ref","jsx","csx","Select","label","name","isDisabled","disabledKeys","selectedKey","onSelectionChange","defaultSelectedKey","onOpen","onClose","items","testId","setIsOpen","useState","internalSelectedKey","setInternalSelectedKey","themeClass","themeStyle","useTheme","isMobile","useBreakpoint","BREAKPOINTS","triggerRef","useRef","hiddenInputRef","currentSelectedKey","selectedItem","item","handleValueChange","value","handleOpenChange","open","useEffect","actionItems","jsxs","ActionMenu","RadixSelect"],"mappings":"sdA6BMA,EAAeC,EAAAA,WACnB,CACE,CAAE,SAAAC,EAAU,OAAAC,EAAQ,SAAAC,EAAU,QAAAC,EAAS,UAAAC,EAAW,GAAGC,CAAA,EACrDC,IAGEC,EAAAA,kBAAAA,IAAC,SAAA,CACE,GAAGF,EACJ,IAAAC,EACA,SAAAN,EACA,QAAAG,EACA,UAAWK,EAAAA,IACT,yBACAR,GAAY,mCACZ,CAACC,GAAU,iCACXA,GAAU,iCACVG,GAAa,iCAAA,EAGd,SAAAF,CAAA,CAAA,CAIT,EACAJ,EAAa,YAAc,uBAmEpB,SAASW,EAAO,CACrB,MAAAC,EACA,KAAAC,EACA,WAAAC,EACA,aAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,mBAAAC,EACA,OAAAC,EACA,QAAAC,EACA,MAAAC,EACA,UAAAf,EAAY,GACZ,cAAegB,CACjB,EAAgB,CACd,KAAM,CAACnB,EAAQoB,CAAS,EAAIC,EAAAA,SAAS,EAAK,EACpC,CAACC,EAAqBC,CAAsB,EAAIF,EAAAA,SACpDR,GAAeE,GAAsB,EAAA,EAEjC,CAAE,UAAWS,EAAY,MAAOC,CAAA,EAAeC,EAAAA,SAAA,EAC/CC,EAAWC,EAAAA,cAAcC,EAAAA,YAAY,MAAM,EAC3CC,EAAaC,EAAAA,OAA0B,IAAI,EAC3CC,EAAiBD,EAAAA,OAAyB,IAAI,EAG9CE,EACJpB,IAAgB,OAAYA,EAAcS,EACtCY,EAAehB,EAAM,KAAMiB,GAASA,EAAK,MAAQF,CAAkB,EAEnEG,EAAqBC,GAAkB,CACvCxB,IAA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AC,MAAA,CAAI,GAAG,aAAa,QAAQ,cAC3B,SAAA,CAAApC,EAAAA,kBAAAA,IAAC,QAAA,CAAO,SAAAN,EAAS,aAAe,WAAW,EAC3CM,EAAAA,kBAAAA,IAAC,OAAA,CACC,KAAK,eACL,EAAE,0KAAA,CAAA,CACJ,CAAA,CACF,CAAA,CAAA,CACF,CACF,CAAA,CAAA,CAAA,EAEJ,EAEAA,EAAAA,kBAAAA,IAACsC,EAAAA,OAAY,OAAZ,CACC,SAAAtC,EAAAA,kBAAAA,IAACsC,EAAAA,OAAY,QAAZ,CACC,UAAWrC,EAAAA,IACT,cACA,2BACAiB,CAAA,EAEF,MAAOC,EACP,SAAS,SAET,iCAACmB,EAAAA,OAAY,SAAZ,CACE,SAAA1B,EAAM,IAAKiB,GACV7B,EAAAA,kBAAAA,IAACsC,EAAAA,OAAY,KAAZ,CAEC,MAAOT,EAAK,IACZ,SAAUvB,GAAA,YAAAA,EAAc,SAASuB,EAAK,KACtC,UAAU,oBAEV,SAAA7B,EAAAA,kBAAAA,IAACsC,SAAY,SAAZ,CAAsB,WAAK,KAAA,CAAM,CAAA,EAL7BT,EAAK,GAAA,CAOb,CAAA,CACH,CAAA,CAAA,CACF,CACF,CAAA,CAAA,CAAA,CACF,CAAA,CAAA,CAGN,CAEA3B,EAAO,YAAc"}
1
+ {"version":3,"file":"Select.cjs.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n ReactNode,\n RefObject,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { Select as RadixSelect } from \"radix-ui\";\n\nimport { BREAKPOINTS } from \"../../constants\";\nimport { useBreakpoint } from \"../../hooks/useBreakpoint\";\nimport { csx } from \"../../utils\";\nimport { ActionMenu, ActionMenuAction } from \"../ActionMenu/ActionMenu\";\n\nimport \"./Select.css\";\nimport \"../Menu/Menu.css\";\nimport { useTheme } from \"../ThemeProvider\";\n\ninterface SelectButtonProps {\n disabled?: boolean;\n isOpen?: boolean;\n children?: ReactNode;\n onClick?: () => void;\n isRounded?: boolean;\n}\n\nconst SelectButton = forwardRef<HTMLButtonElement, SelectButtonProps>(\n (\n { disabled, isOpen, children, onClick, isRounded, ...props },\n ref: RefObject<HTMLButtonElement>\n ) => {\n return (\n <button\n {...props}\n ref={ref}\n disabled={disabled}\n onClick={onClick}\n className={csx(\n \"proton-Select__trigger\",\n disabled && \"proton-Select__trigger--disabled\",\n !isOpen && \"proton-Select__trigger--closed\",\n isOpen && \"proton-Select__trigger--opened\",\n isRounded && \"proton-Select__trigger--rounded\"\n )}\n >\n {children}\n </button>\n );\n }\n);\nSelectButton.displayName = \"ProtonUISelectButton\";\n\nexport interface SelectItem {\n /** The label to display for the item */\n label: string;\n\n /** The key of the item */\n key: string;\n\n /** The URL to navigate to when the item is clicked, turns item into an a tag */\n to?: string;\n}\n\nexport interface SelectProps {\n /** Array of keys that should be disabled\n * @example [\"Thing 1\", \"Thing 2\"]\n */\n disabledKeys?: string[];\n\n /** The key of the default selected item */\n defaultSelectedKey?: string;\n\n /** Test ID for the select */\n \"data-testid\"?: string;\n\n /** Whether the select is disabled */\n isDisabled?: boolean;\n\n /** Array of items to display\n * @example [{ key: \"thing-1\", label: \"Thing 1\" }, { key: \"thing-2\", label: \"Thing 2\" }]\n * @see {@link SelectItem}\n */\n items: SelectItem[];\n\n /** Whether the select button is rounded\n * @default false\n */\n isRounded?: boolean;\n\n /** Label to display above the select\n * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#text\n */\n label?: string;\n\n /** The name of the select field */\n name: string;\n\n /** Callback fired when the menu closes */\n onClose?: () => void;\n\n /** Callback fired when the menu opens */\n onOpen?: () => void;\n\n /** Callback fired when selection changes */\n onSelectionChange?: (key: string) => void;\n\n /** Currently selected key */\n selectedKey?: string;\n}\n\n/**\n * A dropdown select menu that opens a popover on desktop and an action menu on mobile.\n * Supports controlled and uncontrolled modes.\n *\n * API:\n * - {@link SelectProps}\n */\nexport function Select({\n label,\n name,\n isDisabled,\n disabledKeys,\n selectedKey,\n onSelectionChange,\n defaultSelectedKey,\n onOpen, \n onClose,\n items,\n isRounded = false,\n \"data-testid\": testId,\n}: SelectProps) {\n const [isOpen, setIsOpen] = useState(false);\n const [internalSelectedKey, setInternalSelectedKey] = useState(\n selectedKey || defaultSelectedKey || \"\"\n );\n const { className: themeClass, style: themeStyle } = useTheme();\n const isMobile = useBreakpoint(BREAKPOINTS.MEDIUM);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const hiddenInputRef = useRef<HTMLInputElement>(null);\n\n // Handle controlled vs uncontrolled state\n const currentSelectedKey =\n selectedKey !== undefined ? selectedKey : internalSelectedKey;\n const selectedItem = items.find((item) => item.key === currentSelectedKey);\n\n const handleValueChange = (value: string) => {\n if (selectedKey === undefined) {\n setInternalSelectedKey(value);\n }\n onSelectionChange?.(value);\n\n // Update hidden input for form submission\n if (hiddenInputRef.current) {\n hiddenInputRef.current.value = value;\n hiddenInputRef.current.dispatchEvent(\n new Event(\"change\", { bubbles: true })\n );\n }\n };\n\n const handleOpenChange = (open: boolean) => {\n setIsOpen(open);\n if (open) {\n onOpen?.();\n } else {\n onClose?.();\n }\n };\n\n // Update internal state when controlled selectedKey changes\n useEffect(() => {\n if (selectedKey !== undefined) {\n setInternalSelectedKey(selectedKey);\n }\n }, [selectedKey]);\n\n const actionItems: ActionMenuAction[] = items.map((item) => ({\n key: item.key,\n label: item.label,\n to: item.to,\n onAction: () => {\n handleValueChange(item.key);\n setIsOpen(false);\n },\n }));\n\n if (isMobile) {\n return (\n <div\n className=\"proton-Select\"\n aria-label={label || name}\n aria-disabled={isDisabled}\n >\n {label && (\n <div className=\"proton-Select__label\" data-testid=\"select-label\">\n {label}\n </div>\n )}\n\n {/* Hidden input for form submission */}\n <input\n ref={hiddenInputRef}\n type=\"hidden\"\n name={name}\n value={currentSelectedKey}\n data-testid=\"hidden-select-container\"\n />\n\n <SelectButton\n isOpen={isOpen}\n isRounded={isRounded}\n ref={triggerRef}\n disabled={isDisabled}\n data-testid={testId}\n onClick={() => setIsOpen(true)}\n >\n <div className=\"proton-Select__value\">\n {selectedItem ? selectedItem.label : \"Select an option\"}\n </div>\n <div\n className={csx(\n \"proton-Select__trigger_icon\",\n isOpen && \"proton-Select__trigger_icon--flipped\"\n )}\n aria-hidden=\"true\"\n >\n <svg id=\"caret-down\" viewBox=\"0 0 512 512\">\n <title>{isOpen ? \"caret down\" : \"caret up\"}</title>\n <path\n fill=\"currentColor\"\n d=\"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"\n />\n </svg>\n </div>\n </SelectButton>\n\n <ActionMenu\n isOpen={isOpen}\n onClose={() => setIsOpen(false)}\n actions={actionItems}\n selectedKeys={[currentSelectedKey]}\n disabledKeys={disabledKeys}\n />\n </div>\n );\n }\n\n return (\n <div\n className=\"proton-Select\"\n aria-label={label || name}\n aria-disabled={isDisabled}\n >\n {label && (\n <div className=\"proton-Select__label\" data-testid=\"select-label\">\n {label}\n </div>\n )}\n\n {/* Hidden input for form submission */}\n <input\n ref={hiddenInputRef}\n type=\"hidden\"\n name={name}\n value={currentSelectedKey}\n data-testid=\"hidden-select-container\"\n />\n\n <RadixSelect.Root\n value={currentSelectedKey}\n onValueChange={handleValueChange}\n onOpenChange={handleOpenChange}\n disabled={isDisabled}\n >\n <RadixSelect.Trigger asChild>\n <SelectButton\n isRounded={isRounded}\n isOpen={isOpen}\n ref={triggerRef}\n disabled={isDisabled}\n data-testid={testId}\n >\n <RadixSelect.Value\n className=\"proton-Select__value\"\n placeholder=\"Select an option\"\n >\n {selectedItem ? selectedItem.label : \"Select an option\"}\n </RadixSelect.Value>\n <RadixSelect.Icon asChild>\n <div\n className={csx(\n \"proton-Select__trigger_icon\",\n isOpen && \"proton-Select__trigger_icon--flipped\"\n )}\n aria-hidden=\"true\"\n >\n <svg id=\"caret-down\" viewBox=\"0 0 512 512\">\n <title>{isOpen ? \"caret down\" : \"caret up\"}</title>\n <path\n fill=\"currentColor\"\n d=\"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"\n />\n </svg>\n </div>\n </RadixSelect.Icon>\n </SelectButton>\n </RadixSelect.Trigger>\n\n <RadixSelect.Portal>\n <RadixSelect.Content\n className={csx(\n \"proton-Menu\",\n \"proton-MenuTrigger__menu\",\n themeClass\n )}\n style={themeStyle as React.CSSProperties}\n position=\"popper\"\n >\n <RadixSelect.Viewport>\n {items.map((item) => (\n <RadixSelect.Item\n key={item.key}\n value={item.key}\n disabled={disabledKeys?.includes(item.key)}\n className=\"proton-Menu__item\"\n >\n <RadixSelect.ItemText>{item.label}</RadixSelect.ItemText>\n </RadixSelect.Item>\n ))}\n </RadixSelect.Viewport>\n </RadixSelect.Content>\n </RadixSelect.Portal>\n </RadixSelect.Root>\n </div>\n );\n}\n\nSelect.displayName = \"ProtonUISelect\";\n"],"names":["SelectButton","forwardRef","disabled","isOpen","children","onClick","isRounded","props","ref","jsx","csx","Select","label","name","isDisabled","disabledKeys","selectedKey","onSelectionChange","defaultSelectedKey","onOpen","onClose","items","testId","setIsOpen","useState","internalSelectedKey","setInternalSelectedKey","themeClass","themeStyle","useTheme","isMobile","useBreakpoint","BREAKPOINTS","triggerRef","useRef","hiddenInputRef","currentSelectedKey","selectedItem","item","handleValueChange","value","handleOpenChange","open","useEffect","actionItems","jsxs","ActionMenu","RadixSelect"],"mappings":"sdA6BMA,EAAeC,EAAA,WACnB,CACE,CAAE,SAAAC,EAAU,OAAAC,EAAQ,SAAAC,EAAU,QAAAC,EAAS,UAAAC,EAAW,GAAGC,CAAM,EAC3DC,IAGEC,EAAA,kBAAA,IAAC,S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,KAAZ,CAEC,MAAOT,EAAK,IACZ,SAAUvB,GAAA,YAAAA,EAAc,SAASuB,EAAK,KACtC,UAAU,oBAEV,SAAC7B,EAAA,kBAAA,IAAAsC,SAAY,SAAZ,CAAsB,WAAK,MAAM,CAAA,EAL7BT,EAAK,GAOb,CAAA,EACH,CAAA,CAAA,EAEJ,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CAGN,CAEA3B,EAAO,YAAc"}
@@ -1,5 +1,5 @@
1
1
  import { j as e } from "../../node_modules/react/jsx-runtime.es.js";
2
- import { useState as w, useRef as M, useEffect as C, forwardRef as L } from "react";
2
+ import { forwardRef as C, useState as w, useRef as M, useEffect as L } from "react";
3
3
  import { Select as n } from "radix-ui";
4
4
  import { useBreakpoint as P } from "../../hooks/useBreakpoint.es.js";
5
5
  import { ActionMenu as V } from "../ActionMenu/ActionMenu.es.js";
@@ -8,7 +8,7 @@ import { ActionMenu as V } from "../ActionMenu/ActionMenu.es.js";
8
8
  import { useTheme as A } from "../ThemeProvider.es.js";
9
9
  import { csx as x } from "../../utils/string.es.js";
10
10
  import { BREAKPOINTS as U } from "../../constants/breakpoint.es.js";
11
- const g = L(
11
+ const g = C(
12
12
  ({ disabled: r, isOpen: c, children: o, onClick: s, isRounded: l, ...a }, f) => /* @__PURE__ */ e.jsx(
13
13
  "button",
14
14
  {
@@ -51,7 +51,7 @@ function z({
51
51
  }, R = (t) => {
52
52
  u(t), t ? _ == null || _() : m == null || m();
53
53
  };
54
- C(() => {
54
+ L(() => {
55
55
  l !== void 0 && N(l);
56
56
  }, [l]);
57
57
  const T = j.map((t) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"Select.es.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n ReactNode,\n RefObject,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { Select as RadixSelect } from \"radix-ui\";\n\nimport { BREAKPOINTS } from \"../../constants\";\nimport { useBreakpoint } from \"../../hooks/useBreakpoint\";\nimport { csx } from \"../../utils\";\nimport { ActionMenu, ActionMenuAction } from \"../ActionMenu/ActionMenu\";\n\nimport \"./Select.css\";\nimport \"../Menu/Menu.css\";\nimport { useTheme } from \"../ThemeProvider\";\n\ninterface SelectButtonProps {\n disabled?: boolean;\n isOpen?: boolean;\n children?: ReactNode;\n onClick?: () => void;\n isRounded?: boolean;\n}\n\nconst SelectButton = forwardRef<HTMLButtonElement, SelectButtonProps>(\n (\n { disabled, isOpen, children, onClick, isRounded, ...props },\n ref: RefObject<HTMLButtonElement>\n ) => {\n return (\n <button\n {...props}\n ref={ref}\n disabled={disabled}\n onClick={onClick}\n className={csx(\n \"proton-Select__trigger\",\n disabled && \"proton-Select__trigger--disabled\",\n !isOpen && \"proton-Select__trigger--closed\",\n isOpen && \"proton-Select__trigger--opened\",\n isRounded && \"proton-Select__trigger--rounded\"\n )}\n >\n {children}\n </button>\n );\n }\n);\nSelectButton.displayName = \"ProtonUISelectButton\";\n\nexport interface SelectItem {\n /** The label to display for the item */\n label: string;\n\n /** The key of the item */\n key: string;\n\n /** The URL to navigate to when the item is clicked, turns item into an a tag */\n to?: string;\n}\n\nexport interface SelectProps {\n /** Array of keys that should be disabled\n * @example [\"Thing 1\", \"Thing 2\"]\n */\n disabledKeys?: string[];\n\n /** The key of the default selected item */\n defaultSelectedKey?: string;\n\n /** Test ID for the select */\n \"data-testid\"?: string;\n\n /** Whether the select is disabled */\n isDisabled?: boolean;\n\n /** Array of items to display\n * @example [{ key: \"thing-1\", label: \"Thing 1\" }, { key: \"thing-2\", label: \"Thing 2\" }]\n * @see {@link SelectItem}\n */\n items: SelectItem[];\n\n /** Whether the select button is rounded\n * @default false\n */\n isRounded?: boolean;\n\n /** Label to display above the select\n * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#text\n */\n label?: string;\n\n /** The name of the select field */\n name: string;\n\n /** Callback fired when the menu closes */\n onClose?: () => void;\n\n /** Callback fired when the menu opens */\n onOpen?: () => void;\n\n /** Callback fired when selection changes */\n onSelectionChange?: (key: string) => void;\n\n /** Currently selected key */\n selectedKey?: string;\n}\n\n/**\n * A dropdown select menu that opens a popover on desktop and an action menu on mobile.\n * Supports controlled and uncontrolled modes.\n *\n * API:\n * - {@link SelectProps}\n */\nexport function Select({\n label,\n name,\n isDisabled,\n disabledKeys,\n selectedKey,\n onSelectionChange,\n defaultSelectedKey,\n onOpen, \n onClose,\n items,\n isRounded = false,\n \"data-testid\": testId,\n}: SelectProps) {\n const [isOpen, setIsOpen] = useState(false);\n const [internalSelectedKey, setInternalSelectedKey] = useState(\n selectedKey || defaultSelectedKey || \"\"\n );\n const { className: themeClass, style: themeStyle } = useTheme();\n const isMobile = useBreakpoint(BREAKPOINTS.MEDIUM);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const hiddenInputRef = useRef<HTMLInputElement>(null);\n\n // Handle controlled vs uncontrolled state\n const currentSelectedKey =\n selectedKey !== undefined ? selectedKey : internalSelectedKey;\n const selectedItem = items.find((item) => item.key === currentSelectedKey);\n\n const handleValueChange = (value: string) => {\n if (selectedKey === undefined) {\n setInternalSelectedKey(value);\n }\n onSelectionChange?.(value);\n\n // Update hidden input for form submission\n if (hiddenInputRef.current) {\n hiddenInputRef.current.value = value;\n hiddenInputRef.current.dispatchEvent(\n new Event(\"change\", { bubbles: true })\n );\n }\n };\n\n const handleOpenChange = (open: boolean) => {\n setIsOpen(open);\n if (open) {\n onOpen?.();\n } else {\n onClose?.();\n }\n };\n\n // Update internal state when controlled selectedKey changes\n useEffect(() => {\n if (selectedKey !== undefined) {\n setInternalSelectedKey(selectedKey);\n }\n }, [selectedKey]);\n\n const actionItems: ActionMenuAction[] = items.map((item) => ({\n key: item.key,\n label: item.label,\n to: item.to,\n onAction: () => {\n handleValueChange(item.key);\n setIsOpen(false);\n },\n }));\n\n if (isMobile) {\n return (\n <div\n className=\"proton-Select\"\n aria-label={label || name}\n aria-disabled={isDisabled}\n >\n {label && (\n <div className=\"proton-Select__label\" data-testid=\"select-label\">\n {label}\n </div>\n )}\n\n {/* Hidden input for form submission */}\n <input\n ref={hiddenInputRef}\n type=\"hidden\"\n name={name}\n value={currentSelectedKey}\n data-testid=\"hidden-select-container\"\n />\n\n <SelectButton\n isOpen={isOpen}\n isRounded={isRounded}\n ref={triggerRef}\n disabled={isDisabled}\n data-testid={testId}\n onClick={() => setIsOpen(true)}\n >\n <div className=\"proton-Select__value\">\n {selectedItem ? selectedItem.label : \"Select an option\"}\n </div>\n <div\n className={csx(\n \"proton-Select__trigger_icon\",\n isOpen && \"proton-Select__trigger_icon--flipped\"\n )}\n aria-hidden=\"true\"\n >\n <svg id=\"caret-down\" viewBox=\"0 0 512 512\">\n <title>{isOpen ? \"caret down\" : \"caret up\"}</title>\n <path\n fill=\"currentColor\"\n d=\"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"\n />\n </svg>\n </div>\n </SelectButton>\n\n <ActionMenu\n isOpen={isOpen}\n onClose={() => setIsOpen(false)}\n actions={actionItems}\n selectedKeys={[currentSelectedKey]}\n disabledKeys={disabledKeys}\n />\n </div>\n );\n }\n\n return (\n <div\n className=\"proton-Select\"\n aria-label={label || name}\n aria-disabled={isDisabled}\n >\n {label && (\n <div className=\"proton-Select__label\" data-testid=\"select-label\">\n {label}\n </div>\n )}\n\n {/* Hidden input for form submission */}\n <input\n ref={hiddenInputRef}\n type=\"hidden\"\n name={name}\n value={currentSelectedKey}\n data-testid=\"hidden-select-container\"\n />\n\n <RadixSelect.Root\n value={currentSelectedKey}\n onValueChange={handleValueChange}\n onOpenChange={handleOpenChange}\n disabled={isDisabled}\n >\n <RadixSelect.Trigger asChild>\n <SelectButton\n isRounded={isRounded}\n isOpen={isOpen}\n ref={triggerRef}\n disabled={isDisabled}\n data-testid={testId}\n >\n <RadixSelect.Value\n className=\"proton-Select__value\"\n placeholder=\"Select an option\"\n >\n {selectedItem ? selectedItem.label : \"Select an option\"}\n </RadixSelect.Value>\n <RadixSelect.Icon asChild>\n <div\n className={csx(\n \"proton-Select__trigger_icon\",\n isOpen && \"proton-Select__trigger_icon--flipped\"\n )}\n aria-hidden=\"true\"\n >\n <svg id=\"caret-down\" viewBox=\"0 0 512 512\">\n <title>{isOpen ? \"caret down\" : \"caret up\"}</title>\n <path\n fill=\"currentColor\"\n d=\"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"\n />\n </svg>\n </div>\n </RadixSelect.Icon>\n </SelectButton>\n </RadixSelect.Trigger>\n\n <RadixSelect.Portal>\n <RadixSelect.Content\n className={csx(\n \"proton-Menu\",\n \"proton-MenuTrigger__menu\",\n themeClass\n )}\n style={themeStyle as React.CSSProperties}\n position=\"popper\"\n >\n <RadixSelect.Viewport>\n {items.map((item) => (\n <RadixSelect.Item\n key={item.key}\n value={item.key}\n disabled={disabledKeys?.includes(item.key)}\n className=\"proton-Menu__item\"\n >\n <RadixSelect.ItemText>{item.label}</RadixSelect.ItemText>\n </RadixSelect.Item>\n ))}\n </RadixSelect.Viewport>\n </RadixSelect.Content>\n </RadixSelect.Portal>\n </RadixSelect.Root>\n </div>\n );\n}\n\nSelect.displayName = \"ProtonUISelect\";\n"],"names":["SelectButton","forwardRef","disabled","isOpen","children","onClick","isRounded","props","ref","jsx","csx","Select","label","name","isDisabled","disabledKeys","selectedKey","onSelectionChange","defaultSelectedKey","onOpen","onClose","items","testId","setIsOpen","useState","internalSelectedKey","setInternalSelectedKey","themeClass","themeStyle","useTheme","isMobile","useBreakpoint","BREAKPOINTS","triggerRef","useRef","hiddenInputRef","currentSelectedKey","selectedItem","item","handleValueChange","value","handleOpenChange","open","useEffect","actionItems","j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;AAAA,oBACAiB;AAAA,kBAAA;AAAA,kBAEF,OAAOC;AAAA,kBACP,UAAS;AAAA,kBAET,gCAACmB,EAAY,UAAZ,EACE,UAAA1B,EAAM,IAAI,CAACiB,MACV7B,gBAAAA,EAAAA;AAAAA,oBAACsC,EAAY;AAAA,oBAAZ;AAAA,sBAEC,OAAOT,EAAK;AAAA,sBACZ,UAAUvB,KAAA,gBAAAA,EAAc,SAASuB,EAAK;AAAA,sBACtC,WAAU;AAAA,sBAEV,UAAA7B,gBAAAA,EAAAA,IAACsC,EAAY,UAAZ,EAAsB,YAAK,MAAA,CAAM;AAAA,oBAAA;AAAA,oBAL7BT,EAAK;AAAA,kBAAA,CAOb,EAAA,CACH;AAAA,gBAAA;AAAA,cAAA,EACF,CACF;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA3B,EAAO,cAAc;"}
1
+ {"version":3,"file":"Select.es.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n ReactNode,\n RefObject,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { Select as RadixSelect } from \"radix-ui\";\n\nimport { BREAKPOINTS } from \"../../constants\";\nimport { useBreakpoint } from \"../../hooks/useBreakpoint\";\nimport { csx } from \"../../utils\";\nimport { ActionMenu, ActionMenuAction } from \"../ActionMenu/ActionMenu\";\n\nimport \"./Select.css\";\nimport \"../Menu/Menu.css\";\nimport { useTheme } from \"../ThemeProvider\";\n\ninterface SelectButtonProps {\n disabled?: boolean;\n isOpen?: boolean;\n children?: ReactNode;\n onClick?: () => void;\n isRounded?: boolean;\n}\n\nconst SelectButton = forwardRef<HTMLButtonElement, SelectButtonProps>(\n (\n { disabled, isOpen, children, onClick, isRounded, ...props },\n ref: RefObject<HTMLButtonElement>\n ) => {\n return (\n <button\n {...props}\n ref={ref}\n disabled={disabled}\n onClick={onClick}\n className={csx(\n \"proton-Select__trigger\",\n disabled && \"proton-Select__trigger--disabled\",\n !isOpen && \"proton-Select__trigger--closed\",\n isOpen && \"proton-Select__trigger--opened\",\n isRounded && \"proton-Select__trigger--rounded\"\n )}\n >\n {children}\n </button>\n );\n }\n);\nSelectButton.displayName = \"ProtonUISelectButton\";\n\nexport interface SelectItem {\n /** The label to display for the item */\n label: string;\n\n /** The key of the item */\n key: string;\n\n /** The URL to navigate to when the item is clicked, turns item into an a tag */\n to?: string;\n}\n\nexport interface SelectProps {\n /** Array of keys that should be disabled\n * @example [\"Thing 1\", \"Thing 2\"]\n */\n disabledKeys?: string[];\n\n /** The key of the default selected item */\n defaultSelectedKey?: string;\n\n /** Test ID for the select */\n \"data-testid\"?: string;\n\n /** Whether the select is disabled */\n isDisabled?: boolean;\n\n /** Array of items to display\n * @example [{ key: \"thing-1\", label: \"Thing 1\" }, { key: \"thing-2\", label: \"Thing 2\" }]\n * @see {@link SelectItem}\n */\n items: SelectItem[];\n\n /** Whether the select button is rounded\n * @default false\n */\n isRounded?: boolean;\n\n /** Label to display above the select\n * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#text\n */\n label?: string;\n\n /** The name of the select field */\n name: string;\n\n /** Callback fired when the menu closes */\n onClose?: () => void;\n\n /** Callback fired when the menu opens */\n onOpen?: () => void;\n\n /** Callback fired when selection changes */\n onSelectionChange?: (key: string) => void;\n\n /** Currently selected key */\n selectedKey?: string;\n}\n\n/**\n * A dropdown select menu that opens a popover on desktop and an action menu on mobile.\n * Supports controlled and uncontrolled modes.\n *\n * API:\n * - {@link SelectProps}\n */\nexport function Select({\n label,\n name,\n isDisabled,\n disabledKeys,\n selectedKey,\n onSelectionChange,\n defaultSelectedKey,\n onOpen, \n onClose,\n items,\n isRounded = false,\n \"data-testid\": testId,\n}: SelectProps) {\n const [isOpen, setIsOpen] = useState(false);\n const [internalSelectedKey, setInternalSelectedKey] = useState(\n selectedKey || defaultSelectedKey || \"\"\n );\n const { className: themeClass, style: themeStyle } = useTheme();\n const isMobile = useBreakpoint(BREAKPOINTS.MEDIUM);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const hiddenInputRef = useRef<HTMLInputElement>(null);\n\n // Handle controlled vs uncontrolled state\n const currentSelectedKey =\n selectedKey !== undefined ? selectedKey : internalSelectedKey;\n const selectedItem = items.find((item) => item.key === currentSelectedKey);\n\n const handleValueChange = (value: string) => {\n if (selectedKey === undefined) {\n setInternalSelectedKey(value);\n }\n onSelectionChange?.(value);\n\n // Update hidden input for form submission\n if (hiddenInputRef.current) {\n hiddenInputRef.current.value = value;\n hiddenInputRef.current.dispatchEvent(\n new Event(\"change\", { bubbles: true })\n );\n }\n };\n\n const handleOpenChange = (open: boolean) => {\n setIsOpen(open);\n if (open) {\n onOpen?.();\n } else {\n onClose?.();\n }\n };\n\n // Update internal state when controlled selectedKey changes\n useEffect(() => {\n if (selectedKey !== undefined) {\n setInternalSelectedKey(selectedKey);\n }\n }, [selectedKey]);\n\n const actionItems: ActionMenuAction[] = items.map((item) => ({\n key: item.key,\n label: item.label,\n to: item.to,\n onAction: () => {\n handleValueChange(item.key);\n setIsOpen(false);\n },\n }));\n\n if (isMobile) {\n return (\n <div\n className=\"proton-Select\"\n aria-label={label || name}\n aria-disabled={isDisabled}\n >\n {label && (\n <div className=\"proton-Select__label\" data-testid=\"select-label\">\n {label}\n </div>\n )}\n\n {/* Hidden input for form submission */}\n <input\n ref={hiddenInputRef}\n type=\"hidden\"\n name={name}\n value={currentSelectedKey}\n data-testid=\"hidden-select-container\"\n />\n\n <SelectButton\n isOpen={isOpen}\n isRounded={isRounded}\n ref={triggerRef}\n disabled={isDisabled}\n data-testid={testId}\n onClick={() => setIsOpen(true)}\n >\n <div className=\"proton-Select__value\">\n {selectedItem ? selectedItem.label : \"Select an option\"}\n </div>\n <div\n className={csx(\n \"proton-Select__trigger_icon\",\n isOpen && \"proton-Select__trigger_icon--flipped\"\n )}\n aria-hidden=\"true\"\n >\n <svg id=\"caret-down\" viewBox=\"0 0 512 512\">\n <title>{isOpen ? \"caret down\" : \"caret up\"}</title>\n <path\n fill=\"currentColor\"\n d=\"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"\n />\n </svg>\n </div>\n </SelectButton>\n\n <ActionMenu\n isOpen={isOpen}\n onClose={() => setIsOpen(false)}\n actions={actionItems}\n selectedKeys={[currentSelectedKey]}\n disabledKeys={disabledKeys}\n />\n </div>\n );\n }\n\n return (\n <div\n className=\"proton-Select\"\n aria-label={label || name}\n aria-disabled={isDisabled}\n >\n {label && (\n <div className=\"proton-Select__label\" data-testid=\"select-label\">\n {label}\n </div>\n )}\n\n {/* Hidden input for form submission */}\n <input\n ref={hiddenInputRef}\n type=\"hidden\"\n name={name}\n value={currentSelectedKey}\n data-testid=\"hidden-select-container\"\n />\n\n <RadixSelect.Root\n value={currentSelectedKey}\n onValueChange={handleValueChange}\n onOpenChange={handleOpenChange}\n disabled={isDisabled}\n >\n <RadixSelect.Trigger asChild>\n <SelectButton\n isRounded={isRounded}\n isOpen={isOpen}\n ref={triggerRef}\n disabled={isDisabled}\n data-testid={testId}\n >\n <RadixSelect.Value\n className=\"proton-Select__value\"\n placeholder=\"Select an option\"\n >\n {selectedItem ? selectedItem.label : \"Select an option\"}\n </RadixSelect.Value>\n <RadixSelect.Icon asChild>\n <div\n className={csx(\n \"proton-Select__trigger_icon\",\n isOpen && \"proton-Select__trigger_icon--flipped\"\n )}\n aria-hidden=\"true\"\n >\n <svg id=\"caret-down\" viewBox=\"0 0 512 512\">\n <title>{isOpen ? \"caret down\" : \"caret up\"}</title>\n <path\n fill=\"currentColor\"\n d=\"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z\"\n />\n </svg>\n </div>\n </RadixSelect.Icon>\n </SelectButton>\n </RadixSelect.Trigger>\n\n <RadixSelect.Portal>\n <RadixSelect.Content\n className={csx(\n \"proton-Menu\",\n \"proton-MenuTrigger__menu\",\n themeClass\n )}\n style={themeStyle as React.CSSProperties}\n position=\"popper\"\n >\n <RadixSelect.Viewport>\n {items.map((item) => (\n <RadixSelect.Item\n key={item.key}\n value={item.key}\n disabled={disabledKeys?.includes(item.key)}\n className=\"proton-Menu__item\"\n >\n <RadixSelect.ItemText>{item.label}</RadixSelect.ItemText>\n </RadixSelect.Item>\n ))}\n </RadixSelect.Viewport>\n </RadixSelect.Content>\n </RadixSelect.Portal>\n </RadixSelect.Root>\n </div>\n );\n}\n\nSelect.displayName = \"ProtonUISelect\";\n"],"names":["SelectButton","forwardRef","disabled","isOpen","children","onClick","isRounded","props","ref","jsx","csx","Select","label","name","isDisabled","disabledKeys","selectedKey","onSelectionChange","defaultSelectedKey","onOpen","onClose","items","testId","setIsOpen","useState","internalSelectedKey","setInternalSelectedKey","themeClass","themeStyle","useTheme","isMobile","useBreakpoint","BREAKPOINTS","triggerRef","useRef","hiddenInputRef","currentSelectedKey","selectedItem","item","handleValueChange","value","handleOpenChange","open","useEffect","actionItems","jsxs","ActionMenu","RadixSelect"],"mappings":";;;;;;;;;;AA6BA,MAAMA,IAAeC;AAAA,EACnB,CACE,EAAE,UAAAC,GAAU,QAAAC,GAAQ,UAAAC,GAAU,SAAAC,GAAS,WAAAC,GAAW,GAAGC,EAAM,GAC3DC,MAGEC,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGF;AAAA,MACJ,KAAAC;AAAA,MACA,UAAAN;AAAA,MACA,SAAAG;AAAA,MACA,WAAWK;AAAA,QACT;AAAA,QACAR,KAAY;AAAA,QACZ,CAACC,KAAU;AAAA,QACXA,KAAU;AAAA,QACVG,KAAa;AAAA,MACf;AAAA,MAEC,UAAAF;A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IAAA;AAAA,EAAA;AAGN;AAEA3B,EAAO,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.cjs.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef } from \"react\";\nimport { useSwitch } from \"@react-aria/switch\";\nimport { VisuallyHidden } from \"@react-aria/visually-hidden\";\nimport { useToggleState } from \"@react-stately/toggle\";\n\nimport { csx } from \"../../utils\";\n\nimport \"./Switch.css\";\n\nexport interface SwitchProps {\n /**\n * Whether the Switch is in the 'on' state (uncontrolled).\n */\n defaultOn?: boolean;\n\n /**\n * Whether the Switch is in the 'on' state. Providing this prop causes the\n * component to become controlled.\n */\n isOn?: boolean;\n\n /**\n * Should the input be non-interactive?\n */\n isDisabled?: boolean;\n\n /**\n * Called when the Switch's on state changes.\n */\n onChange?: (isOn: boolean) => void;\n\n /**\n * The string used for the input label. Forwarded to `aria-label`.\n */\n label?: string;\n\n /**\n * The text or component to be rendered as the Switch's description.\n */\n children?: React.ReactNode;\n}\n\n/**\n * A toggle switch component for boolean state control with support for controlled and uncontrolled modes.\n *\n * API:\n * - {@link SwitchProps}\n */\nexport function Switch(props: SwitchProps) {\n let sanitizedProps = {\n ...props,\n isSelected: props.isOn,\n \"data-testid\": undefined,\n };\n\n let ref = useRef(null);\n\n let state = useToggleState(sanitizedProps);\n let { inputProps } = useSwitch(sanitizedProps, state, ref);\n\n return (\n <label\n className={csx(\n \"proton-Switch\",\n props.isDisabled && \"proton-Switch--disabled\",\n state.isSelected && \"proton-Switch--on\"\n )}\n data-on={state.isSelected || undefined}\n data-disabled={props.isDisabled || undefined}\n data-testid={props[\"data-testid\"] || undefined}\n aria-label={props.label || undefined}\n >\n <VisuallyHidden>\n <input {...inputProps} ref={ref} />\n </VisuallyHidden>\n {props.label && <div className=\"proton-Switch__label\">{props.label}</div>}\n <div className=\"proton-Switch__wrapper\">\n <div className=\"proton-Switch__toggle\">\n <div className=\"proton-Switch__slider\"></div>\n </div>\n {props.children && (\n <div className=\"proton-Switch__description\">{props.children}</div>\n )}\n </div>\n </label>\n );\n}\n"],"names":["Switch","props","sanitizedProps","ref","useRef","state","useToggleState","inputProps","useSwitch","jsxs","csx","jsx","VisuallyHidden"],"mappings":"+dAkDO,SAASA,EAAOC,EAAoB,CACzC,IAAIC,EAAiB,CACnB,GAAGD,EACH,WAAYA,EAAM,KAClB,cAAe,MAAA,EAGbE,EAAMC,EAAAA,OAAO,IAAI,EAEjBC,EAAQC,EAAAA,eAAeJ,CAAc,EACrC,CAAE,WAAAK,CAAA,EAAeC,EAAAA,UAAUN,EAAgBG,EAAOF,CAAG,EAEzD,OACEM,EAAAA,kBAAAA,KAAC,QAAA,CACC,UAAWC,EAAAA,IACT,gBACAT,EAAM,YAAc,0BACpBI,EAAM,YAAc,mBAAA,EAEtB,UAASA,EAAM,YAAc,OAC7B,gBAAeJ,EAAM,YAAc,OACnC,cAAaA,EAAM,aAAa,GAAK,OACrC,aAAYA,EAAM,OAAS,OAE3B,SAAA,CAAAU,wBAACC,EAAAA,gBACC,SAAAD,EAAAA,kBAAAA,IAAC,QAAA,CAAO,GAAGJ,EAAY,IAAAJ,EAAU,EACnC,EACCF,EAAM,OAASU,EAAAA,kBAAAA,IAAC,OAAI,UAAU,uBAAwB,WAAM,MAAM,EACnEF,EAAAA,kBAAAA,KAAC,MAAA,CAAI,UAAU,yBACb,SAAA,CAAAE,EAAAA,kBAAAA,IAAC,OAAI,UAAU,wBACb,iCAAC,MAAA,CAAI,UAAU,wBAAwB,CAAA,CACzC,EACCV,EAAM,UACLU,EAAAA,kBAAAA,IAAC,OAAI,UAAU,6BAA8B,WAAM,QAAA,CAAS,CAAA,CAAA,CAEhE,CAAA,CAAA,CAAA,CAGN"}
1
+ {"version":3,"file":"Switch.cjs.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef } from \"react\";\nimport { useSwitch } from \"@react-aria/switch\";\nimport { VisuallyHidden } from \"@react-aria/visually-hidden\";\nimport { useToggleState } from \"@react-stately/toggle\";\n\nimport { csx } from \"../../utils\";\n\nimport \"./Switch.css\";\n\nexport interface SwitchProps {\n /**\n * Whether the Switch is in the 'on' state (uncontrolled).\n */\n defaultOn?: boolean;\n\n /**\n * Whether the Switch is in the 'on' state. Providing this prop causes the\n * component to become controlled.\n */\n isOn?: boolean;\n\n /**\n * Should the input be non-interactive?\n */\n isDisabled?: boolean;\n\n /**\n * Called when the Switch's on state changes.\n */\n onChange?: (isOn: boolean) => void;\n\n /**\n * The string used for the input label. Forwarded to `aria-label`.\n */\n label?: string;\n\n /**\n * The text or component to be rendered as the Switch's description.\n */\n children?: React.ReactNode;\n}\n\n/**\n * A toggle switch component for boolean state control with support for controlled and uncontrolled modes.\n *\n * API:\n * - {@link SwitchProps}\n */\nexport function Switch(props: SwitchProps) {\n let sanitizedProps = {\n ...props,\n isSelected: props.isOn,\n \"data-testid\": undefined,\n };\n\n let ref = useRef(null);\n\n let state = useToggleState(sanitizedProps);\n let { inputProps } = useSwitch(sanitizedProps, state, ref);\n\n return (\n <label\n className={csx(\n \"proton-Switch\",\n props.isDisabled && \"proton-Switch--disabled\",\n state.isSelected && \"proton-Switch--on\"\n )}\n data-on={state.isSelected || undefined}\n data-disabled={props.isDisabled || undefined}\n data-testid={props[\"data-testid\"] || undefined}\n aria-label={props.label || undefined}\n >\n <VisuallyHidden>\n <input {...inputProps} ref={ref} />\n </VisuallyHidden>\n {props.label && <div className=\"proton-Switch__label\">{props.label}</div>}\n <div className=\"proton-Switch__wrapper\">\n <div className=\"proton-Switch__toggle\">\n <div className=\"proton-Switch__slider\"></div>\n </div>\n {props.children && (\n <div className=\"proton-Switch__description\">{props.children}</div>\n )}\n </div>\n </label>\n );\n}\n"],"names":["Switch","props","sanitizedProps","ref","useRef","state","useToggleState","inputProps","useSwitch","jsxs","csx","jsx","VisuallyHidden"],"mappings":"+dAkDO,SAASA,EAAOC,EAAoB,CACzC,IAAIC,EAAiB,CACnB,GAAGD,EACH,WAAYA,EAAM,KAClB,cAAe,MAAA,EAGbE,EAAMC,SAAO,IAAI,EAEjBC,EAAQC,iBAAeJ,CAAc,EACrC,CAAE,WAAAK,CAAW,EAAIC,EAAAA,UAAUN,EAAgBG,EAAOF,CAAG,EAGvD,OAAAM,EAAA,kBAAA,KAAC,QAAA,CACC,UAAWC,EAAA,IACT,gBACAT,EAAM,YAAc,0BACpBI,EAAM,YAAc,mBACtB,EACA,UAASA,EAAM,YAAc,OAC7B,gBAAeJ,EAAM,YAAc,OACnC,cAAaA,EAAM,aAAa,GAAK,OACrC,aAAYA,EAAM,OAAS,OAE3B,SAAA,CAAAU,wBAACC,EAAAA,gBACC,SAACD,EAAA,kBAAA,IAAA,QAAA,CAAO,GAAGJ,EAAY,IAAAJ,CAAU,CAAA,EACnC,EACCF,EAAM,OAASU,EAAA,kBAAA,IAAC,OAAI,UAAU,uBAAwB,WAAM,MAAM,EACnEF,EAAAA,kBAAAA,KAAC,MAAI,CAAA,UAAU,yBACb,SAAA,CAAAE,EAAAA,kBAAAA,IAAC,OAAI,UAAU,wBACb,iCAAC,MAAI,CAAA,UAAU,wBAAwB,CACzC,CAAA,EACCV,EAAM,UACLU,EAAA,kBAAA,IAAC,OAAI,UAAU,6BAA8B,WAAM,SAAS,CAAA,EAEhE,CAAA,CAAA,CAAA,CAGN"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.es.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef } from \"react\";\nimport { useSwitch } from \"@react-aria/switch\";\nimport { VisuallyHidden } from \"@react-aria/visually-hidden\";\nimport { useToggleState } from \"@react-stately/toggle\";\n\nimport { csx } from \"../../utils\";\n\nimport \"./Switch.css\";\n\nexport interface SwitchProps {\n /**\n * Whether the Switch is in the 'on' state (uncontrolled).\n */\n defaultOn?: boolean;\n\n /**\n * Whether the Switch is in the 'on' state. Providing this prop causes the\n * component to become controlled.\n */\n isOn?: boolean;\n\n /**\n * Should the input be non-interactive?\n */\n isDisabled?: boolean;\n\n /**\n * Called when the Switch's on state changes.\n */\n onChange?: (isOn: boolean) => void;\n\n /**\n * The string used for the input label. Forwarded to `aria-label`.\n */\n label?: string;\n\n /**\n * The text or component to be rendered as the Switch's description.\n */\n children?: React.ReactNode;\n}\n\n/**\n * A toggle switch component for boolean state control with support for controlled and uncontrolled modes.\n *\n * API:\n * - {@link SwitchProps}\n */\nexport function Switch(props: SwitchProps) {\n let sanitizedProps = {\n ...props,\n isSelected: props.isOn,\n \"data-testid\": undefined,\n };\n\n let ref = useRef(null);\n\n let state = useToggleState(sanitizedProps);\n let { inputProps } = useSwitch(sanitizedProps, state, ref);\n\n return (\n <label\n className={csx(\n \"proton-Switch\",\n props.isDisabled && \"proton-Switch--disabled\",\n state.isSelected && \"proton-Switch--on\"\n )}\n data-on={state.isSelected || undefined}\n data-disabled={props.isDisabled || undefined}\n data-testid={props[\"data-testid\"] || undefined}\n aria-label={props.label || undefined}\n >\n <VisuallyHidden>\n <input {...inputProps} ref={ref} />\n </VisuallyHidden>\n {props.label && <div className=\"proton-Switch__label\">{props.label}</div>}\n <div className=\"proton-Switch__wrapper\">\n <div className=\"proton-Switch__toggle\">\n <div className=\"proton-Switch__slider\"></div>\n </div>\n {props.children && (\n <div className=\"proton-Switch__description\">{props.children}</div>\n )}\n </div>\n </label>\n );\n}\n"],"names":["Switch","props","sanitizedProps","ref","useRef","state","useToggleState","inputProps","useSwitch","jsxs","csx","jsx","VisuallyHidden"],"mappings":";;;;;;;AAkDO,SAASA,EAAOC,GAAoB;AACzC,MAAIC,IAAiB;AAAA,IACnB,GAAGD;AAAA,IACH,YAAYA,EAAM;AAAA,IAClB,eAAe;AAAA,EAAA,GAGbE,IAAMC,EAAO,IAAI,GAEjBC,IAAQC,EAAeJ,CAAc,GACrC,EAAE,YAAAK,EAAA,IAAeC,EAAUN,GAAgBG,GAAOF,CAAG;AAEzD,SACEM,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAT,EAAM,cAAc;AAAA,QACpBI,EAAM,cAAc;AAAA,MAAA;AAAA,MAEtB,WAASA,EAAM,cAAc;AAAA,MAC7B,iBAAeJ,EAAM,cAAc;AAAA,MACnC,eAAaA,EAAM,aAAa,KAAK;AAAA,MACrC,cAAYA,EAAM,SAAS;AAAA,MAE3B,UAAA;AAAA,QAAAU,gBAAAA,MAACC,KACC,UAAAD,gBAAAA,EAAAA,IAAC,SAAA,EAAO,GAAGJ,GAAY,KAAAJ,GAAU,GACnC;AAAA,QACCF,EAAM,SAASU,gBAAAA,EAAAA,IAAC,SAAI,WAAU,wBAAwB,YAAM,OAAM;AAAA,QACnEF,gBAAAA,EAAAA,KAAC,OAAA,EAAI,WAAU,0BACb,UAAA;AAAA,UAAAE,gBAAAA,EAAAA,IAAC,SAAI,WAAU,yBACb,gCAAC,OAAA,EAAI,WAAU,yBAAwB,EAAA,CACzC;AAAA,UACCV,EAAM,YACLU,gBAAAA,EAAAA,IAAC,SAAI,WAAU,8BAA8B,YAAM,SAAA,CAAS;AAAA,QAAA,EAAA,CAEhE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"Switch.es.js","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef } from \"react\";\nimport { useSwitch } from \"@react-aria/switch\";\nimport { VisuallyHidden } from \"@react-aria/visually-hidden\";\nimport { useToggleState } from \"@react-stately/toggle\";\n\nimport { csx } from \"../../utils\";\n\nimport \"./Switch.css\";\n\nexport interface SwitchProps {\n /**\n * Whether the Switch is in the 'on' state (uncontrolled).\n */\n defaultOn?: boolean;\n\n /**\n * Whether the Switch is in the 'on' state. Providing this prop causes the\n * component to become controlled.\n */\n isOn?: boolean;\n\n /**\n * Should the input be non-interactive?\n */\n isDisabled?: boolean;\n\n /**\n * Called when the Switch's on state changes.\n */\n onChange?: (isOn: boolean) => void;\n\n /**\n * The string used for the input label. Forwarded to `aria-label`.\n */\n label?: string;\n\n /**\n * The text or component to be rendered as the Switch's description.\n */\n children?: React.ReactNode;\n}\n\n/**\n * A toggle switch component for boolean state control with support for controlled and uncontrolled modes.\n *\n * API:\n * - {@link SwitchProps}\n */\nexport function Switch(props: SwitchProps) {\n let sanitizedProps = {\n ...props,\n isSelected: props.isOn,\n \"data-testid\": undefined,\n };\n\n let ref = useRef(null);\n\n let state = useToggleState(sanitizedProps);\n let { inputProps } = useSwitch(sanitizedProps, state, ref);\n\n return (\n <label\n className={csx(\n \"proton-Switch\",\n props.isDisabled && \"proton-Switch--disabled\",\n state.isSelected && \"proton-Switch--on\"\n )}\n data-on={state.isSelected || undefined}\n data-disabled={props.isDisabled || undefined}\n data-testid={props[\"data-testid\"] || undefined}\n aria-label={props.label || undefined}\n >\n <VisuallyHidden>\n <input {...inputProps} ref={ref} />\n </VisuallyHidden>\n {props.label && <div className=\"proton-Switch__label\">{props.label}</div>}\n <div className=\"proton-Switch__wrapper\">\n <div className=\"proton-Switch__toggle\">\n <div className=\"proton-Switch__slider\"></div>\n </div>\n {props.children && (\n <div className=\"proton-Switch__description\">{props.children}</div>\n )}\n </div>\n </label>\n );\n}\n"],"names":["Switch","props","sanitizedProps","ref","useRef","state","useToggleState","inputProps","useSwitch","jsxs","csx","jsx","VisuallyHidden"],"mappings":";;;;;;;AAkDO,SAASA,EAAOC,GAAoB;AACzC,MAAIC,IAAiB;AAAA,IACnB,GAAGD;AAAA,IACH,YAAYA,EAAM;AAAA,IAClB,eAAe;AAAA,EAAA,GAGbE,IAAMC,EAAO,IAAI,GAEjBC,IAAQC,EAAeJ,CAAc,GACrC,EAAE,YAAAK,EAAW,IAAIC,EAAUN,GAAgBG,GAAOF,CAAG;AAGvD,SAAAM,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAT,EAAM,cAAc;AAAA,QACpBI,EAAM,cAAc;AAAA,MACtB;AAAA,MACA,WAASA,EAAM,cAAc;AAAA,MAC7B,iBAAeJ,EAAM,cAAc;AAAA,MACnC,eAAaA,EAAM,aAAa,KAAK;AAAA,MACrC,cAAYA,EAAM,SAAS;AAAA,MAE3B,UAAA;AAAA,QAAAU,gBAAAA,MAACC,KACC,UAACD,gBAAAA,EAAA,IAAA,SAAA,EAAO,GAAGJ,GAAY,KAAAJ,EAAU,CAAA,GACnC;AAAA,QACCF,EAAM,SAASU,gBAAAA,EAAA,IAAC,SAAI,WAAU,wBAAwB,YAAM,OAAM;AAAA,QACnEF,gBAAAA,EAAAA,KAAC,OAAI,EAAA,WAAU,0BACb,UAAA;AAAA,UAAAE,gBAAAA,EAAAA,IAAC,SAAI,WAAU,yBACb,gCAAC,OAAI,EAAA,WAAU,yBAAwB,EACzC,CAAA;AAAA,UACCV,EAAM,YACLU,gBAAAA,EAAA,IAAC,SAAI,WAAU,8BAA8B,YAAM,UAAS;AAAA,QAAA,GAEhE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1 +1 @@
1
- {"version":3,"file":"collectionParser.cjs.js","sources":["../../../../src/components/Table/Collection/collectionParser.ts"],"sourcesContent":["import {\n Children,\n isValidElement,\n ReactElement,\n ReactNode,\n ComponentType,\n} from \"react\";\n\nimport {\n TableHeader,\n TableColumn as TableColumnComp,\n TableBody,\n TableRow as TableRowComp,\n TableCell as TableCellComp,\n type TableHeaderProps,\n type TableColumnProps,\n type TableBodyProps,\n type TableRowProps,\n type TableCellProps,\n} from \"./CompoundComponents\";\nimport type {\n TableColumnData,\n TableData,\n TableRowData,\n TableCellData,\n} from \"../types\";\n\nfunction isComponentType(\n element: ReactElement,\n componentType: ComponentType<any>\n): boolean {\n return element.type === componentType;\n}\n\n/**\n * Parses JSX table structure into collection data format\n */\nexport function parseTableChildren(children: ReactNode): TableData {\n const columns: TableColumnData[] = [];\n const rows: TableRowData[] = [];\n\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n\n // Parse columns from header\n if (isComponentType(child, TableHeader)) {\n const headerProps = child.props as TableHeaderProps;\n\n Children.forEach(headerProps.children, (columnChild) => {\n if (\n isValidElement(columnChild) &&\n isComponentType(columnChild, TableColumnComp)\n ) {\n const columnProps = columnChild.props as TableColumnProps;\n columns.push({\n key: columnProps.id,\n header: columnProps.children,\n isHidden: headerProps.isHidden || false,\n ariaSort: columnProps[\"aria-sort\"],\n });\n }\n });\n }\n\n // Parse rows from body\n if (isComponentType(child, TableBody)) {\n const bodyProps = child.props as TableBodyProps;\n Children.forEach(bodyProps.children, (rowChild) => {\n if (\n isValidElement(rowChild) &&\n isComponentType(rowChild, TableRowComp)\n ) {\n const rowProps = rowChild.props as TableRowProps;\n const cells: TableCellData[] = [];\n\n let cellIndex = 0;\n Children.forEach(rowProps.children, (cellChild) => {\n if (\n isValidElement(cellChild) &&\n isComponentType(cellChild, TableCellComp)\n ) {\n const cellProps = cellChild.props as TableCellProps;\n\n // Map cell to column by index if no explicit columnKey\n const columnKey = cellProps.columnKey || columns[cellIndex]?.key;\n\n if (columnKey) {\n cells.push({\n columnKey,\n value: cellProps.children,\n colSpan: cellProps.colSpan,\n });\n }\n cellIndex++;\n }\n });\n\n rows.push({\n key:\n (rowChild.key as string) || rowProps.key || String(rows.length),\n cells,\n onClick: rowProps.onClick,\n });\n }\n });\n }\n });\n\n return { columns, rows };\n}\n"],"names":["isComponentType","element","componentType","parseTableChildren","children","columns","rows","Children","child","isValidElement","TableHeader","headerProps","columnChild","TableColumnComp","columnProps","TableBody","bodyProps","rowChild","TableRowComp","rowProps","cells","cellIndex","cellChild","TableCellComp","cellProps","columnKey","_a"],"mappings":"kJA2BA,SAASA,EACPC,EACAC,EACS,CACT,OAAOD,EAAQ,OAASC,CAC1B,CAKO,SAASC,EAAmBC,EAAgC,CACjE,MAAMC,EAA6B,CAAA,EAC7BC,EAAuB,CAAA,EAE7BC,OAAAA,EAAAA,SAAS,QAAQH,EAAWI,GAAU,CACpC,GAAKC,EAAAA,eAAeD,CAAK,EAGzB,IAAIR,EAAgBQ,EAAOE,EAAAA,WAAW,EAAG,CACvC,MAAMC,EAAcH,EAAM,MAE1BD,EAAAA,SAAS,QAAQI,EAAY,SAAWC,GAAgB,CACtD,GACEH,EAAAA,eAAeG,CAAW,GAC1BZ,EAAgBY,EAAaC,EAAAA,WAAe,EAC5C,CACA,MAAMC,EAAcF,EAAY,MAChCP,EAAQ,KAAK,CACX,IAAKS,EAAY,GACjB,OAAQA,EAAY,SACpB,SAAUH,EAAY,UAAY,GAClC,SAAUG,EAAY,WAAW,CAAA,CAClC,CACH,CACF,CAAC,CACH,CAGA,GAAId,EAAgBQ,EAAOO,EAAAA,SAAS,EAAG,CACrC,MAAMC,EAAYR,EAAM,MACxBD,EAAAA,SAAS,QAAQS,EAAU,SAAWC,GAAa,CACjD,GACER,EAAAA,eAAeQ,CAAQ,GACvBjB,EAAgBiB,EAAUC,EAAAA,QAAY,EACtC,CACA,MAAMC,EAAWF,EAAS,MACpBG,EAAyB,CAAA,EAE/B,IAAIC,EAAY,EAChBd,EAAAA,SAAS,QAAQY,EAAS,SAAWG,GAAc,OACjD,GACEb,EAAAA,eAAea,CAAS,GACxBtB,EAAgBsB,EAAWC,EAAAA,SAAa,EACxC,CACA,MAAMC,EAAYF,EAAU,MAGtBG,EAAYD,EAAU,aAAaE,EAAArB,EAAQgB,CAAS,IAAjB,YAAAK,EAAoB,KAEzDD,GACFL,EAAM,KAAK,CACT,UAAAK,EACA,MAAOD,EAAU,SACjB,QAASA,EAAU,OAAA,CACpB,EAEHH,GACF,CACF,CAAC,EAEDf,EAAK,KAAK,CACR,IACGW,EAAS,KAAkBE,EAAS,KAAO,OAAOb,EAAK,MAAM,EAChE,MAAAc,EACA,QAASD,EAAS,OAAA,CACnB,CACH,CACF,CAAC,CACH,EACF,CAAC,EAEM,CAAE,QAAAd,EAAS,KAAAC,CAAA,CACpB"}
1
+ {"version":3,"file":"collectionParser.cjs.js","sources":["../../../../src/components/Table/Collection/collectionParser.ts"],"sourcesContent":["import {\n Children,\n isValidElement,\n ReactElement,\n ReactNode,\n ComponentType,\n} from \"react\";\n\nimport {\n TableHeader,\n TableColumn as TableColumnComp,\n TableBody,\n TableRow as TableRowComp,\n TableCell as TableCellComp,\n type TableHeaderProps,\n type TableColumnProps,\n type TableBodyProps,\n type TableRowProps,\n type TableCellProps,\n} from \"./CompoundComponents\";\nimport type {\n TableColumnData,\n TableData,\n TableRowData,\n TableCellData,\n} from \"../types\";\n\nfunction isComponentType(\n element: ReactElement,\n componentType: ComponentType<any>\n): boolean {\n return element.type === componentType;\n}\n\n/**\n * Parses JSX table structure into collection data format\n */\nexport function parseTableChildren(children: ReactNode): TableData {\n const columns: TableColumnData[] = [];\n const rows: TableRowData[] = [];\n\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n\n // Parse columns from header\n if (isComponentType(child, TableHeader)) {\n const headerProps = child.props as TableHeaderProps;\n\n Children.forEach(headerProps.children, (columnChild) => {\n if (\n isValidElement(columnChild) &&\n isComponentType(columnChild, TableColumnComp)\n ) {\n const columnProps = columnChild.props as TableColumnProps;\n columns.push({\n key: columnProps.id,\n header: columnProps.children,\n isHidden: headerProps.isHidden || false,\n ariaSort: columnProps[\"aria-sort\"],\n });\n }\n });\n }\n\n // Parse rows from body\n if (isComponentType(child, TableBody)) {\n const bodyProps = child.props as TableBodyProps;\n Children.forEach(bodyProps.children, (rowChild) => {\n if (\n isValidElement(rowChild) &&\n isComponentType(rowChild, TableRowComp)\n ) {\n const rowProps = rowChild.props as TableRowProps;\n const cells: TableCellData[] = [];\n\n let cellIndex = 0;\n Children.forEach(rowProps.children, (cellChild) => {\n if (\n isValidElement(cellChild) &&\n isComponentType(cellChild, TableCellComp)\n ) {\n const cellProps = cellChild.props as TableCellProps;\n\n // Map cell to column by index if no explicit columnKey\n const columnKey = cellProps.columnKey || columns[cellIndex]?.key;\n\n if (columnKey) {\n cells.push({\n columnKey,\n value: cellProps.children,\n colSpan: cellProps.colSpan,\n });\n }\n cellIndex++;\n }\n });\n\n rows.push({\n key:\n (rowChild.key as string) || rowProps.key || String(rows.length),\n cells,\n onClick: rowProps.onClick,\n });\n }\n });\n }\n });\n\n return { columns, rows };\n}\n"],"names":["isComponentType","element","componentType","parseTableChildren","children","columns","rows","Children","child","isValidElement","TableHeader","headerProps","columnChild","TableColumnComp","columnProps","TableBody","bodyProps","rowChild","TableRowComp","rowProps","cells","cellIndex","cellChild","TableCellComp","cellProps","columnKey","_a"],"mappings":"kJA2BA,SAASA,EACPC,EACAC,EACS,CACT,OAAOD,EAAQ,OAASC,CAC1B,CAKO,SAASC,EAAmBC,EAAgC,CACjE,MAAMC,EAA6B,CAAA,EAC7BC,EAAuB,CAAA,EAEpBC,OAAAA,EAAAA,SAAA,QAAQH,EAAWI,GAAU,CAChC,GAACC,EAAAA,eAAeD,CAAK,EAGrB,IAAAR,EAAgBQ,EAAOE,EAAAA,WAAW,EAAG,CACvC,MAAMC,EAAcH,EAAM,MAE1BD,EAAAA,SAAS,QAAQI,EAAY,SAAWC,GAAgB,CACtD,GACEH,EAAAA,eAAeG,CAAW,GAC1BZ,EAAgBY,EAAaC,EAAe,WAAA,EAC5C,CACA,MAAMC,EAAcF,EAAY,MAChCP,EAAQ,KAAK,CACX,IAAKS,EAAY,GACjB,OAAQA,EAAY,SACpB,SAAUH,EAAY,UAAY,GAClC,SAAUG,EAAY,WAAW,CAAA,CAClC,CACH,CAAA,CACD,CACH,CAGI,GAAAd,EAAgBQ,EAAOO,EAAAA,SAAS,EAAG,CACrC,MAAMC,EAAYR,EAAM,MACxBD,EAAAA,SAAS,QAAQS,EAAU,SAAWC,GAAa,CACjD,GACER,EAAAA,eAAeQ,CAAQ,GACvBjB,EAAgBiB,EAAUC,EAAY,QAAA,EACtC,CACA,MAAMC,EAAWF,EAAS,MACpBG,EAAyB,CAAA,EAE/B,IAAIC,EAAY,EAChBd,EAAAA,SAAS,QAAQY,EAAS,SAAWG,GAAc,OACjD,GACEb,EAAAA,eAAea,CAAS,GACxBtB,EAAgBsB,EAAWC,EAAa,SAAA,EACxC,CACA,MAAMC,EAAYF,EAAU,MAGtBG,EAAYD,EAAU,aAAaE,EAAArB,EAAQgB,CAAS,IAAjB,YAAAK,EAAoB,KAEzDD,GACFL,EAAM,KAAK,CACT,UAAAK,EACA,MAAOD,EAAU,SACjB,QAASA,EAAU,OAAA,CACpB,EAEHH,GACF,CAAA,CACD,EAEDf,EAAK,KAAK,CACR,IACGW,EAAS,KAAkBE,EAAS,KAAO,OAAOb,EAAK,MAAM,EAChE,MAAAc,EACA,QAASD,EAAS,OAAA,CACnB,CACH,CAAA,CACD,CACH,EAAA,CACD,EAEM,CAAE,QAAAd,EAAS,KAAAC,EACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"collectionParser.es.js","sources":["../../../../src/components/Table/Collection/collectionParser.ts"],"sourcesContent":["import {\n Children,\n isValidElement,\n ReactElement,\n ReactNode,\n ComponentType,\n} from \"react\";\n\nimport {\n TableHeader,\n TableColumn as TableColumnComp,\n TableBody,\n TableRow as TableRowComp,\n TableCell as TableCellComp,\n type TableHeaderProps,\n type TableColumnProps,\n type TableBodyProps,\n type TableRowProps,\n type TableCellProps,\n} from \"./CompoundComponents\";\nimport type {\n TableColumnData,\n TableData,\n TableRowData,\n TableCellData,\n} from \"../types\";\n\nfunction isComponentType(\n element: ReactElement,\n componentType: ComponentType<any>\n): boolean {\n return element.type === componentType;\n}\n\n/**\n * Parses JSX table structure into collection data format\n */\nexport function parseTableChildren(children: ReactNode): TableData {\n const columns: TableColumnData[] = [];\n const rows: TableRowData[] = [];\n\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n\n // Parse columns from header\n if (isComponentType(child, TableHeader)) {\n const headerProps = child.props as TableHeaderProps;\n\n Children.forEach(headerProps.children, (columnChild) => {\n if (\n isValidElement(columnChild) &&\n isComponentType(columnChild, TableColumnComp)\n ) {\n const columnProps = columnChild.props as TableColumnProps;\n columns.push({\n key: columnProps.id,\n header: columnProps.children,\n isHidden: headerProps.isHidden || false,\n ariaSort: columnProps[\"aria-sort\"],\n });\n }\n });\n }\n\n // Parse rows from body\n if (isComponentType(child, TableBody)) {\n const bodyProps = child.props as TableBodyProps;\n Children.forEach(bodyProps.children, (rowChild) => {\n if (\n isValidElement(rowChild) &&\n isComponentType(rowChild, TableRowComp)\n ) {\n const rowProps = rowChild.props as TableRowProps;\n const cells: TableCellData[] = [];\n\n let cellIndex = 0;\n Children.forEach(rowProps.children, (cellChild) => {\n if (\n isValidElement(cellChild) &&\n isComponentType(cellChild, TableCellComp)\n ) {\n const cellProps = cellChild.props as TableCellProps;\n\n // Map cell to column by index if no explicit columnKey\n const columnKey = cellProps.columnKey || columns[cellIndex]?.key;\n\n if (columnKey) {\n cells.push({\n columnKey,\n value: cellProps.children,\n colSpan: cellProps.colSpan,\n });\n }\n cellIndex++;\n }\n });\n\n rows.push({\n key:\n (rowChild.key as string) || rowProps.key || String(rows.length),\n cells,\n onClick: rowProps.onClick,\n });\n }\n });\n }\n });\n\n return { columns, rows };\n}\n"],"names":["isComponentType","element","componentType","parseTableChildren","children","columns","rows","Children","child","isValidElement","TableHeader","headerProps","columnChild","TableColumnComp","columnProps","TableBody","bodyProps","rowChild","TableRowComp","rowProps","cells","cellIndex","cellChild","TableCellComp","cellProps","columnKey","_a"],"mappings":";;AA2BA,SAASA,EACPC,GACAC,GACS;AACT,SAAOD,EAAQ,SAASC;AAC1B;AAKO,SAASC,EAAmBC,GAAgC;AACjE,QAAMC,IAA6B,CAAA,GAC7BC,IAAuB,CAAA;AAE7B,SAAAC,EAAS,QAAQH,GAAU,CAACI,MAAU;AACpC,QAAKC,EAAeD,CAAK,GAGzB;AAAA,UAAIR,EAAgBQ,GAAOE,CAAW,GAAG;AACvC,cAAMC,IAAcH,EAAM;AAE1B,QAAAD,EAAS,QAAQI,EAAY,UAAU,CAACC,MAAgB;AACtD,cACEH,EAAeG,CAAW,KAC1BZ,EAAgBY,GAAaC,CAAe,GAC5C;AACA,kBAAMC,IAAcF,EAAY;AAChC,YAAAP,EAAQ,KAAK;AAAA,cACX,KAAKS,EAAY;AAAA,cACjB,QAAQA,EAAY;AAAA,cACpB,UAAUH,EAAY,YAAY;AAAA,cAClC,UAAUG,EAAY,WAAW;AAAA,YAAA,CAClC;AAAA,UACH;AAAA,QACF,CAAC;AAAA,MACH;AAGA,UAAId,EAAgBQ,GAAOO,CAAS,GAAG;AACrC,cAAMC,IAAYR,EAAM;AACxB,QAAAD,EAAS,QAAQS,EAAU,UAAU,CAACC,MAAa;AACjD,cACER,EAAeQ,CAAQ,KACvBjB,EAAgBiB,GAAUC,CAAY,GACtC;AACA,kBAAMC,IAAWF,EAAS,OACpBG,IAAyB,CAAA;AAE/B,gBAAIC,IAAY;AAChB,YAAAd,EAAS,QAAQY,EAAS,UAAU,CAACG,MAAc;;AACjD,kBACEb,EAAea,CAAS,KACxBtB,EAAgBsB,GAAWC,CAAa,GACxC;AACA,sBAAMC,IAAYF,EAAU,OAGtBG,IAAYD,EAAU,eAAaE,IAAArB,EAAQgB,CAAS,MAAjB,gBAAAK,EAAoB;AAE7D,gBAAID,KACFL,EAAM,KAAK;AAAA,kBACT,WAAAK;AAAA,kBACA,OAAOD,EAAU;AAAA,kBACjB,SAASA,EAAU;AAAA,gBAAA,CACpB,GAEHH;AAAA,cACF;AAAA,YACF,CAAC,GAEDf,EAAK,KAAK;AAAA,cACR,KACGW,EAAS,OAAkBE,EAAS,OAAO,OAAOb,EAAK,MAAM;AAAA,cAChE,OAAAc;AAAA,cACA,SAASD,EAAS;AAAA,YAAA,CACnB;AAAA,UACH;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF,CAAC,GAEM,EAAE,SAAAd,GAAS,MAAAC,EAAA;AACpB;"}
1
+ {"version":3,"file":"collectionParser.es.js","sources":["../../../../src/components/Table/Collection/collectionParser.ts"],"sourcesContent":["import {\n Children,\n isValidElement,\n ReactElement,\n ReactNode,\n ComponentType,\n} from \"react\";\n\nimport {\n TableHeader,\n TableColumn as TableColumnComp,\n TableBody,\n TableRow as TableRowComp,\n TableCell as TableCellComp,\n type TableHeaderProps,\n type TableColumnProps,\n type TableBodyProps,\n type TableRowProps,\n type TableCellProps,\n} from \"./CompoundComponents\";\nimport type {\n TableColumnData,\n TableData,\n TableRowData,\n TableCellData,\n} from \"../types\";\n\nfunction isComponentType(\n element: ReactElement,\n componentType: ComponentType<any>\n): boolean {\n return element.type === componentType;\n}\n\n/**\n * Parses JSX table structure into collection data format\n */\nexport function parseTableChildren(children: ReactNode): TableData {\n const columns: TableColumnData[] = [];\n const rows: TableRowData[] = [];\n\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n\n // Parse columns from header\n if (isComponentType(child, TableHeader)) {\n const headerProps = child.props as TableHeaderProps;\n\n Children.forEach(headerProps.children, (columnChild) => {\n if (\n isValidElement(columnChild) &&\n isComponentType(columnChild, TableColumnComp)\n ) {\n const columnProps = columnChild.props as TableColumnProps;\n columns.push({\n key: columnProps.id,\n header: columnProps.children,\n isHidden: headerProps.isHidden || false,\n ariaSort: columnProps[\"aria-sort\"],\n });\n }\n });\n }\n\n // Parse rows from body\n if (isComponentType(child, TableBody)) {\n const bodyProps = child.props as TableBodyProps;\n Children.forEach(bodyProps.children, (rowChild) => {\n if (\n isValidElement(rowChild) &&\n isComponentType(rowChild, TableRowComp)\n ) {\n const rowProps = rowChild.props as TableRowProps;\n const cells: TableCellData[] = [];\n\n let cellIndex = 0;\n Children.forEach(rowProps.children, (cellChild) => {\n if (\n isValidElement(cellChild) &&\n isComponentType(cellChild, TableCellComp)\n ) {\n const cellProps = cellChild.props as TableCellProps;\n\n // Map cell to column by index if no explicit columnKey\n const columnKey = cellProps.columnKey || columns[cellIndex]?.key;\n\n if (columnKey) {\n cells.push({\n columnKey,\n value: cellProps.children,\n colSpan: cellProps.colSpan,\n });\n }\n cellIndex++;\n }\n });\n\n rows.push({\n key:\n (rowChild.key as string) || rowProps.key || String(rows.length),\n cells,\n onClick: rowProps.onClick,\n });\n }\n });\n }\n });\n\n return { columns, rows };\n}\n"],"names":["isComponentType","element","componentType","parseTableChildren","children","columns","rows","Children","child","isValidElement","TableHeader","headerProps","columnChild","TableColumnComp","columnProps","TableBody","bodyProps","rowChild","TableRowComp","rowProps","cells","cellIndex","cellChild","TableCellComp","cellProps","columnKey","_a"],"mappings":";;AA2BA,SAASA,EACPC,GACAC,GACS;AACT,SAAOD,EAAQ,SAASC;AAC1B;AAKO,SAASC,EAAmBC,GAAgC;AACjE,QAAMC,IAA6B,CAAA,GAC7BC,IAAuB,CAAA;AAEpB,SAAAC,EAAA,QAAQH,GAAU,CAACI,MAAU;AAChC,QAACC,EAAeD,CAAK,GAGrB;AAAA,UAAAR,EAAgBQ,GAAOE,CAAW,GAAG;AACvC,cAAMC,IAAcH,EAAM;AAE1B,QAAAD,EAAS,QAAQI,EAAY,UAAU,CAACC,MAAgB;AACtD,cACEH,EAAeG,CAAW,KAC1BZ,EAAgBY,GAAaC,CAAe,GAC5C;AACA,kBAAMC,IAAcF,EAAY;AAChC,YAAAP,EAAQ,KAAK;AAAA,cACX,KAAKS,EAAY;AAAA,cACjB,QAAQA,EAAY;AAAA,cACpB,UAAUH,EAAY,YAAY;AAAA,cAClC,UAAUG,EAAY,WAAW;AAAA,YAAA,CAClC;AAAA,UACH;AAAA,QAAA,CACD;AAAA,MACH;AAGI,UAAAd,EAAgBQ,GAAOO,CAAS,GAAG;AACrC,cAAMC,IAAYR,EAAM;AACxB,QAAAD,EAAS,QAAQS,EAAU,UAAU,CAACC,MAAa;AACjD,cACER,EAAeQ,CAAQ,KACvBjB,EAAgBiB,GAAUC,CAAY,GACtC;AACA,kBAAMC,IAAWF,EAAS,OACpBG,IAAyB,CAAA;AAE/B,gBAAIC,IAAY;AAChB,YAAAd,EAAS,QAAQY,EAAS,UAAU,CAACG,MAAc;;AACjD,kBACEb,EAAea,CAAS,KACxBtB,EAAgBsB,GAAWC,CAAa,GACxC;AACA,sBAAMC,IAAYF,EAAU,OAGtBG,IAAYD,EAAU,eAAaE,IAAArB,EAAQgB,CAAS,MAAjB,gBAAAK,EAAoB;AAE7D,gBAAID,KACFL,EAAM,KAAK;AAAA,kBACT,WAAAK;AAAA,kBACA,OAAOD,EAAU;AAAA,kBACjB,SAASA,EAAU;AAAA,gBAAA,CACpB,GAEHH;AAAA,cACF;AAAA,YAAA,CACD,GAEDf,EAAK,KAAK;AAAA,cACR,KACGW,EAAS,OAAkBE,EAAS,OAAO,OAAOb,EAAK,MAAM;AAAA,cAChE,OAAAc;AAAA,cACA,SAASD,EAAS;AAAA,YAAA,CACnB;AAAA,UACH;AAAA,QAAA,CACD;AAAA,MACH;AAAA;AAAA,EAAA,CACD,GAEM,EAAE,SAAAd,GAAS,MAAAC;AACpB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableCollection.cjs.js","sources":["../../../../src/components/Table/Collection/useTableCollection.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { TableData, TableRowData } from \"../types\";\n\n/**\n * Hook for managing table data structure and providing navigation methods\n */\nexport function useTableCollection(data: TableData) {\n const keyToIndexMap = useMemo(() => {\n const map = new Map<string | number, number>();\n data.rows.forEach((row, index) => {\n map.set(row.key, index);\n });\n return map;\n }, [data.rows]);\n\n const getItemByKey = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined) return null;\n return data.rows[index];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemAfter = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined || index >= data.rows.length - 1) return null;\n return data.rows[index + 1];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemBefore = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined || index <= 0) return null;\n return data.rows[index - 1];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemIndex = useMemo(\n () =>\n (key: string | number): number => {\n return keyToIndexMap.get(key) ?? -1;\n },\n [keyToIndexMap]\n );\n\n // Computed values\n const firstItem = useMemo(() => data.rows[0] || null, [data.rows]);\n const lastItem = useMemo(\n () => data.rows[data.rows.length - 1] || null,\n [data.rows]\n );\n const size = data.rows.length;\n\n // ARIA helpers\n const isHeaderHidden = data.columns[0]?.isHidden || false;\n const hasVisibleHeader = !isHeaderHidden;\n\n const getTotalRowCount = useMemo(() => {\n return size + (hasVisibleHeader ? 1 : 0);\n }, [size, hasVisibleHeader]);\n\n const getRowAriaIndex = useMemo(\n () => (rowIndex: number) => {\n return rowIndex + (hasVisibleHeader ? 2 : 1); // +2 if header exists and visible, +1 if not\n },\n [hasVisibleHeader]\n );\n\n return {\n // Data\n columns: data.columns,\n rows: data.rows,\n size,\n firstItem,\n lastItem,\n\n // ARIA helpers\n isHeaderHidden,\n hasVisibleHeader,\n getTotalRowCount,\n getRowAriaIndex,\n\n // Navigation functions\n getItemByKey,\n getItemAfter,\n getItemBefore,\n getItemIndex,\n };\n}\n\nexport type TableCollection = ReturnType<typeof useTableCollection>;\n"],"names":["useTableCollection","data","keyToIndexMap","useMemo","map","row","index","getItemByKey","key","getItemAfter","getItemBefore","getItemIndex","firstItem","lastItem","size","isHeaderHidden","_a","hasVisibleHeader","getTotalRowCount","getRowAriaIndex","rowIndex"],"mappings":"yGAMO,SAASA,EAAmBC,EAAiB,OAClD,MAAMC,EAAgBC,EAAAA,QAAQ,IAAM,CAClC,MAAMC,MAAU,IAChB,OAAAH,EAAK,KAAK,QAAQ,CAACI,EAAKC,IAAU,CAChCF,EAAI,IAAIC,EAAI,IAAKC,CAAK,CACxB,CAAC,EACMF,CACT,EAAG,CAACH,EAAK,IAAI,CAAC,EAERM,EAAeJ,EAAAA,QACnB,IACGK,GAA8C,CAC7C,MAAMF,EAAQJ,EAAc,IAAIM,CAAG,EACnC,OAAIF,IAAU,OAAkB,KACzBL,EAAK,KAAKK,CAAK,CACxB,EACF,CAACL,EAAK,KAAMC,CAAa,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,"file":"useTableCollection.cjs.js","sources":["../../../../src/components/Table/Collection/useTableCollection.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { TableData, TableRowData } from \"../types\";\n\n/**\n * Hook for managing table data structure and providing navigation methods\n */\nexport function useTableCollection(data: TableData) {\n const keyToIndexMap = useMemo(() => {\n const map = new Map<string | number, number>();\n data.rows.forEach((row, index) => {\n map.set(row.key, index);\n });\n return map;\n }, [data.rows]);\n\n const getItemByKey = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined) return null;\n return data.rows[index];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemAfter = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined || index >= data.rows.length - 1) return null;\n return data.rows[index + 1];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemBefore = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined || index <= 0) return null;\n return data.rows[index - 1];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemIndex = useMemo(\n () =>\n (key: string | number): number => {\n return keyToIndexMap.get(key) ?? -1;\n },\n [keyToIndexMap]\n );\n\n // Computed values\n const firstItem = useMemo(() => data.rows[0] || null, [data.rows]);\n const lastItem = useMemo(\n () => data.rows[data.rows.length - 1] || null,\n [data.rows]\n );\n const size = data.rows.length;\n\n // ARIA helpers\n const isHeaderHidden = data.columns[0]?.isHidden || false;\n const hasVisibleHeader = !isHeaderHidden;\n\n const getTotalRowCount = useMemo(() => {\n return size + (hasVisibleHeader ? 1 : 0);\n }, [size, hasVisibleHeader]);\n\n const getRowAriaIndex = useMemo(\n () => (rowIndex: number) => {\n return rowIndex + (hasVisibleHeader ? 2 : 1); // +2 if header exists and visible, +1 if not\n },\n [hasVisibleHeader]\n );\n\n return {\n // Data\n columns: data.columns,\n rows: data.rows,\n size,\n firstItem,\n lastItem,\n\n // ARIA helpers\n isHeaderHidden,\n hasVisibleHeader,\n getTotalRowCount,\n getRowAriaIndex,\n\n // Navigation functions\n getItemByKey,\n getItemAfter,\n getItemBefore,\n getItemIndex,\n };\n}\n\nexport type TableCollection = ReturnType<typeof useTableCollection>;\n"],"names":["useTableCollection","data","keyToIndexMap","useMemo","map","row","index","getItemByKey","key","getItemAfter","getItemBefore","getItemIndex","firstItem","lastItem","size","isHeaderHidden","_a","hasVisibleHeader","getTotalRowCount","getRowAriaIndex","rowIndex"],"mappings":"yGAMO,SAASA,EAAmBC,EAAiB,OAC5C,MAAAC,EAAgBC,EAAAA,QAAQ,IAAM,CAC5B,MAAAC,MAAU,IAChB,OAAAH,EAAK,KAAK,QAAQ,CAACI,EAAKC,IAAU,CAC5BF,EAAA,IAAIC,EAAI,IAAKC,CAAK,CAAA,CACvB,EACMF,CAAA,EACN,CAACH,EAAK,IAAI,CAAC,EAERM,EAAeJ,EAAA,QACnB,IACGK,GAA8C,CACvC,MAAAF,EAAQJ,EAAc,IAAIM,CAAG,EAC/B,OAAAF,IAAU,OAAkB,KACzBL,EAAK,KAAKK,CAAK,CACxB,EACF,CAACL,EAAK,KAAMC,CAAa,CAAA,EAGrBO,EAAeN,EAAA,QACnB,IACGK,GAA8C,CACvC,MAAAF,EAAQJ,EAAc,IAAIM,CAAG,EACnC,OAAIF,IAAU,QAAaA,GAASL,EAAK,KAAK,OAAS,EAAU,KAC1DA,EAAK,KAAKK,EAAQ,CAAC,CAC5B,EACF,CAACL,EAAK,KAAMC,CAAa,CAAA,EAGrBQ,EAAgBP,EAAA,QACpB,IACGK,GAA8C,CACvC,MAAAF,EAAQJ,EAAc,IAAIM,CAAG,EACnC,OAAIF,IAAU,QAAaA,GAAS,EAAU,KACvCL,EAAK,KAAKK,EAAQ,CAAC,CAC5B,EACF,CAACL,EAAK,KAAMC,CAAa,CAAA,EAGrBS,EAAeR,EAAA,QACnB,IACGK,GACQN,EAAc,IAAIM,CAAG,GAAK,GAErC,CAACN,CAAa,CAAA,EAIVU,EAAYT,EAAAA,QAAQ,IAAMF,EAAK,KAAK,CAAC,GAAK,KAAM,CAACA,EAAK,IAAI,CAAC,EAC3DY,EAAWV,EAAA,QACf,IAAMF,EAAK,KAAKA,EAAK,KAAK,OAAS,CAAC,GAAK,KACzC,CAACA,EAAK,IAAI,CAAA,EAENa,EAAOb,EAAK,KAAK,OAGjBc,IAAiBC,EAAAf,EAAK,QAAQ,CAAC,IAAd,YAAAe,EAAiB,WAAY,GAC9CC,EAAmB,CAACF,EAEpBG,EAAmBf,EAAAA,QAAQ,IACxBW,GAAQG,EAAmB,EAAI,GACrC,CAACH,EAAMG,CAAgB,CAAC,EAErBE,EAAkBhB,EAAA,QACtB,IAAOiB,GACEA,GAAYH,EAAmB,EAAI,GAE5C,CAACA,CAAgB,CAAA,EAGZ,MAAA,CAEL,QAAShB,EAAK,QACd,KAAMA,EAAK,KACX,KAAAa,EACA,UAAAF,EACA,SAAAC,EAGA,eAAAE,EACA,iBAAAE,EACA,iBAAAC,EACA,gBAAAC,EAGA,aAAAZ,EACA,aAAAE,EACA,cAAAC,EACA,aAAAC,CAAA,CAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableCollection.es.js","sources":["../../../../src/components/Table/Collection/useTableCollection.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { TableData, TableRowData } from \"../types\";\n\n/**\n * Hook for managing table data structure and providing navigation methods\n */\nexport function useTableCollection(data: TableData) {\n const keyToIndexMap = useMemo(() => {\n const map = new Map<string | number, number>();\n data.rows.forEach((row, index) => {\n map.set(row.key, index);\n });\n return map;\n }, [data.rows]);\n\n const getItemByKey = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined) return null;\n return data.rows[index];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemAfter = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined || index >= data.rows.length - 1) return null;\n return data.rows[index + 1];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemBefore = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined || index <= 0) return null;\n return data.rows[index - 1];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemIndex = useMemo(\n () =>\n (key: string | number): number => {\n return keyToIndexMap.get(key) ?? -1;\n },\n [keyToIndexMap]\n );\n\n // Computed values\n const firstItem = useMemo(() => data.rows[0] || null, [data.rows]);\n const lastItem = useMemo(\n () => data.rows[data.rows.length - 1] || null,\n [data.rows]\n );\n const size = data.rows.length;\n\n // ARIA helpers\n const isHeaderHidden = data.columns[0]?.isHidden || false;\n const hasVisibleHeader = !isHeaderHidden;\n\n const getTotalRowCount = useMemo(() => {\n return size + (hasVisibleHeader ? 1 : 0);\n }, [size, hasVisibleHeader]);\n\n const getRowAriaIndex = useMemo(\n () => (rowIndex: number) => {\n return rowIndex + (hasVisibleHeader ? 2 : 1); // +2 if header exists and visible, +1 if not\n },\n [hasVisibleHeader]\n );\n\n return {\n // Data\n columns: data.columns,\n rows: data.rows,\n size,\n firstItem,\n lastItem,\n\n // ARIA helpers\n isHeaderHidden,\n hasVisibleHeader,\n getTotalRowCount,\n getRowAriaIndex,\n\n // Navigation functions\n getItemByKey,\n getItemAfter,\n getItemBefore,\n getItemIndex,\n };\n}\n\nexport type TableCollection = ReturnType<typeof useTableCollection>;\n"],"names":["useTableCollection","data","keyToIndexMap","useMemo","map","row","index","getItemByKey","key","getItemAfter","getItemBefore","getItemIndex","firstItem","lastItem","size","isHeaderHidden","_a","hasVisibleHeader","getTotalRowCount","getRowAriaIndex","rowIndex"],"mappings":";AAMO,SAASA,EAAmBC,GAAiB;;AAClD,QAAMC,IAAgBC,EAAQ,MAAM;AAClC,UAAMC,wBAAU,IAAA;AAChB,WAAAH,EAAK,KAAK,QAAQ,CAACI,GAAKC,MAAU;AAChC,MAAAF,EAAI,IAAIC,EAAI,KAAKC,CAAK;AA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AAC,GAErBE,IAAkBhB;AAAA,IACtB,MAAM,CAACiB,MACEA,KAAYH,IAAmB,IAAI;AAAA,IAE5C,CAACA,CAAgB;AAAA,EAAA;AAGnB,SAAO;AAAA;AAAA,IAEL,SAAShB,EAAK;AAAA,IACd,MAAMA,EAAK;AAAA,IACX,MAAAa;AAAA,IACA,WAAAF;AAAA,IACA,UAAAC;AAAA;AAAA,IAGA,gBAAAE;AAAA,IACA,kBAAAE;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA;AAAA,IAGA,cAAAZ;AAAA,IACA,cAAAE;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"useTableCollection.es.js","sources":["../../../../src/components/Table/Collection/useTableCollection.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { TableData, TableRowData } from \"../types\";\n\n/**\n * Hook for managing table data structure and providing navigation methods\n */\nexport function useTableCollection(data: TableData) {\n const keyToIndexMap = useMemo(() => {\n const map = new Map<string | number, number>();\n data.rows.forEach((row, index) => {\n map.set(row.key, index);\n });\n return map;\n }, [data.rows]);\n\n const getItemByKey = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined) return null;\n return data.rows[index];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemAfter = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined || index >= data.rows.length - 1) return null;\n return data.rows[index + 1];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemBefore = useMemo(\n () =>\n (key: string | number): TableRowData | null => {\n const index = keyToIndexMap.get(key);\n if (index === undefined || index <= 0) return null;\n return data.rows[index - 1];\n },\n [data.rows, keyToIndexMap]\n );\n\n const getItemIndex = useMemo(\n () =>\n (key: string | number): number => {\n return keyToIndexMap.get(key) ?? -1;\n },\n [keyToIndexMap]\n );\n\n // Computed values\n const firstItem = useMemo(() => data.rows[0] || null, [data.rows]);\n const lastItem = useMemo(\n () => data.rows[data.rows.length - 1] || null,\n [data.rows]\n );\n const size = data.rows.length;\n\n // ARIA helpers\n const isHeaderHidden = data.columns[0]?.isHidden || false;\n const hasVisibleHeader = !isHeaderHidden;\n\n const getTotalRowCount = useMemo(() => {\n return size + (hasVisibleHeader ? 1 : 0);\n }, [size, hasVisibleHeader]);\n\n const getRowAriaIndex = useMemo(\n () => (rowIndex: number) => {\n return rowIndex + (hasVisibleHeader ? 2 : 1); // +2 if header exists and visible, +1 if not\n },\n [hasVisibleHeader]\n );\n\n return {\n // Data\n columns: data.columns,\n rows: data.rows,\n size,\n firstItem,\n lastItem,\n\n // ARIA helpers\n isHeaderHidden,\n hasVisibleHeader,\n getTotalRowCount,\n getRowAriaIndex,\n\n // Navigation functions\n getItemByKey,\n getItemAfter,\n getItemBefore,\n getItemIndex,\n };\n}\n\nexport type TableCollection = ReturnType<typeof useTableCollection>;\n"],"names":["useTableCollection","data","keyToIndexMap","useMemo","map","row","index","getItemByKey","key","getItemAfter","getItemBefore","getItemIndex","firstItem","lastItem","size","isHeaderHidden","_a","hasVisibleHeader","getTotalRowCount","getRowAriaIndex","rowIndex"],"mappings":";AAMO,SAASA,EAAmBC,GAAiB;;AAC5C,QAAAC,IAAgBC,EAAQ,MAAM;AAC5B,UAAAC,wBAAU;AAChB,WAAAH,EAAK,KAAK,QAAQ,CAACI,GAAKC,MAAU;AAC5B,MAAAF,EAAA,IAAIC,EAAI,KAAKC,CAAK;AAAA,IAAA,CACvB,GACMF;AAAA,EAAA,GACN,CAACH,EAAK,IAAI,CAAC,GAERM,IAAeJ;AAAA,IACnB,MACE,CAACK,MAA8C;AACvC,YAAAF,IAAQJ,EAAc,IAAIM,CAAG;AAC/B,aAAAF,MAAU,SAAkB,OACzBL,EAAK,KAAKK,CAAK;AAAA,IACxB;AAAA,IACF,CAACL,EAAK,MAAMC,CAAa;AAAA,EAAA,GAGrBO,IAAeN;AAAA,IACnB,MACE,CAAC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AAA,IACA,iBAAAC;AAAA;AAAA,IAGA,cAAAZ;AAAA,IACA,cAAAE;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,EAAA;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Table.cjs.js","sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import { ReactElement, useMemo } from \"react\";\nimport { parseTableChildren } from \"./Collection/collectionParser\";\nimport {\n TableHeader,\n TableColumn,\n TableBody,\n TableRow,\n TableCell,\n TableHeaderProps,\n TableColumnProps,\n TableBodyProps,\n TableRowProps,\n TableCellProps,\n} from \"./Collection/CompoundComponents\";\nimport { useTableCollection } from \"./Collection/useTableCollection\";\nimport type {\n TableData,\n TableColumnData,\n TableRowData,\n TableCellData,\n} from \"./types\";\nimport \"./Table.css\";\n\nexport type { TableColumnData, TableCellData, TableRowData, TableData };\n\nexport interface TableProps {\n children: [ReactElement<TableHeaderProps>, ReactElement<TableBodyProps>];\n /** Table name/caption for accessibility. Provides essential context for screen readers about table content. */\n name: string;\n}\n\nconst TableComponent = ({ children, name }: TableProps) => {\n const tableData: TableData = useMemo(\n () => parseTableChildren(children),\n [children]\n );\n const collection = useTableCollection(tableData);\n\n return (\n <table\n className=\"proton-Table\"\n role=\"table\"\n aria-rowcount={collection.getTotalRowCount}\n aria-colcount={collection.columns.length}\n aria-label={name}\n >\n <caption className=\"proton-Table__caption\">{name}</caption>\n\n {/* Header */}\n <thead\n className=\"proton-Table__rowGroup--header\"\n role=\"rowgroup\"\n style={collection.isHeaderHidden ? { display: \"none\" } : undefined}\n >\n <tr className=\"proton-Table__header-row\" role=\"row\" aria-rowindex={1}>\n {collection.columns.map((column, index) => (\n <th\n key={column.key}\n className=\"proton-Table__header\"\n role=\"columnheader\"\n scope=\"col\"\n aria-colindex={index + 1}\n aria-sort={column.ariaSort}\n >\n {column.header}\n </th>\n ))}\n </tr>\n </thead>\n\n {/* Body */}\n <tbody className=\"proton-Table__body\" role=\"rowgroup\">\n {collection.rows.map((row, rowIndex) => (\n <tr\n key={row.key}\n className=\"proton-Table__row\"\n role=\"row\"\n aria-rowindex={collection.getRowAriaIndex(rowIndex)}\n onClick={row?.onClick}\n tabIndex={row?.onClick ? 0 : undefined}\n onKeyDown={\n row?.onClick\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n // Enable keyboard navigation\n e.preventDefault();\n row.onClick?.();\n }\n }\n : undefined\n }\n >\n {collection.columns.map((column, colIndex) => {\n const cell = row.cells.find((c) => c.columnKey === column.key);\n return (\n <td\n key={column.key}\n className=\"proton-Table__cell\"\n role=\"cell\"\n aria-colindex={colIndex + 1}\n colSpan={cell?.colSpan}\n >\n {cell?.value || \"\"}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\n/**\n * Base Table component that renders data in rows and columns using collections.\n *\n * - Built-in keyboard navigation for interactive rows.\n * - Full ARIA table semantics with proper roles, labels, and indices.\n *\n * API:\n * - {@link TableProps}\n *\n * @example\n * ```tsx\n * <Table caption=\"Employee Directory\">\n * <Table.Header>\n * <Table.Column id=\"name\">Name</Table.Column>\n * </Table.Header>\n * <Table.Body>\n * <Table.Row key=\"1\">\n * <Table.Cell>Joe</Table.Cell>\n * </Table.Row>\n * </Table.Body>\n * </Table>\n * ```\n */\nconst Table = Object.assign(TableComponent, {\n /** Table header: {@link TableHeaderProps} */\n Header: TableHeader,\n /** Table column: {@link TableColumnProps} */\n Column: TableColumn,\n /** Table body: {@link TableBodyProps} */\n Body: TableBody,\n /** Table row: {@link TableRowProps} */\n Row: TableRow,\n /** Table cell: {@link TableCellProps} */\n Cell: TableCell,\n});\n\nexport { Table };\nexport type {\n TableHeaderProps,\n TableColumnProps,\n TableBodyProps,\n TableRowProps,\n TableCellProps,\n};\n"],"names":["TableComponent","children","name","tableData","useMemo","parseTableChildren","collection","useTableCollection","jsxs","jsx","column","index","row","rowIndex","e","_a","colIndex","cell","c","Table","TableHeader","TableColumn","TableBody","TableRow","TableCell"],"mappings":"0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AAA,KAAAH,GAEJ,EACA,OAGL,SAAAN,EAAW,QAAQ,IAAI,CAACI,EAAQM,IAAa,CAC5C,MAAMC,EAAOL,EAAI,MAAM,KAAMM,GAAMA,EAAE,YAAcR,EAAO,GAAG,EAC7D,OACED,EAAAA,kBAAAA,IAAC,KAAA,CAEC,UAAU,qBACV,KAAK,OACL,gBAAeO,EAAW,EAC1B,QAASC,GAAA,YAAAA,EAAM,QAEd,2BAAM,QAAS,EAAA,EANXP,EAAO,GAAA,CASlB,CAAC,CAAA,EA/BIE,EAAI,GAAA,CAiCZ,CAAA,CACH,CAAA,CAAA,CAAA,CAGN,EAyBMO,EAAQ,OAAO,OAAOnB,EAAgB,CAE1C,OAAQoB,EAAAA,YAER,OAAQC,EAAAA,YAER,KAAMC,EAAAA,UAEN,IAAKC,EAAAA,SAEL,KAAMC,EAAAA,SACR,CAAC"}
1
+ {"version":3,"file":"Table.cjs.js","sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import { ReactElement, useMemo } from \"react\";\nimport { parseTableChildren } from \"./Collection/collectionParser\";\nimport {\n TableHeader,\n TableColumn,\n TableBody,\n TableRow,\n TableCell,\n TableHeaderProps,\n TableColumnProps,\n TableBodyProps,\n TableRowProps,\n TableCellProps,\n} from \"./Collection/CompoundComponents\";\nimport { useTableCollection } from \"./Collection/useTableCollection\";\nimport type {\n TableData,\n TableColumnData,\n TableRowData,\n TableCellData,\n} from \"./types\";\nimport \"./Table.css\";\n\nexport type { TableColumnData, TableCellData, TableRowData, TableData };\n\nexport interface TableProps {\n children: [ReactElement<TableHeaderProps>, ReactElement<TableBodyProps>];\n /** Table name/caption for accessibility. Provides essential context for screen readers about table content. */\n name: string;\n}\n\nconst TableComponent = ({ children, name }: TableProps) => {\n const tableData: TableData = useMemo(\n () => parseTableChildren(children),\n [children]\n );\n const collection = useTableCollection(tableData);\n\n return (\n <table\n className=\"proton-Table\"\n role=\"table\"\n aria-rowcount={collection.getTotalRowCount}\n aria-colcount={collection.columns.length}\n aria-label={name}\n >\n <caption className=\"proton-Table__caption\">{name}</caption>\n\n {/* Header */}\n <thead\n className=\"proton-Table__rowGroup--header\"\n role=\"rowgroup\"\n style={collection.isHeaderHidden ? { display: \"none\" } : undefined}\n >\n <tr className=\"proton-Table__header-row\" role=\"row\" aria-rowindex={1}>\n {collection.columns.map((column, index) => (\n <th\n key={column.key}\n className=\"proton-Table__header\"\n role=\"columnheader\"\n scope=\"col\"\n aria-colindex={index + 1}\n aria-sort={column.ariaSort}\n >\n {column.header}\n </th>\n ))}\n </tr>\n </thead>\n\n {/* Body */}\n <tbody className=\"proton-Table__body\" role=\"rowgroup\">\n {collection.rows.map((row, rowIndex) => (\n <tr\n key={row.key}\n className=\"proton-Table__row\"\n role=\"row\"\n aria-rowindex={collection.getRowAriaIndex(rowIndex)}\n onClick={row?.onClick}\n tabIndex={row?.onClick ? 0 : undefined}\n onKeyDown={\n row?.onClick\n ? (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n // Enable keyboard navigation\n e.preventDefault();\n row.onClick?.();\n }\n }\n : undefined\n }\n >\n {collection.columns.map((column, colIndex) => {\n const cell = row.cells.find((c) => c.columnKey === column.key);\n return (\n <td\n key={column.key}\n className=\"proton-Table__cell\"\n role=\"cell\"\n aria-colindex={colIndex + 1}\n colSpan={cell?.colSpan}\n >\n {cell?.value || \"\"}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\n/**\n * Base Table component that renders data in rows and columns using collections.\n *\n * - Built-in keyboard navigation for interactive rows.\n * - Full ARIA table semantics with proper roles, labels, and indices.\n *\n * API:\n * - {@link TableProps}\n *\n * @example\n * ```tsx\n * <Table caption=\"Employee Directory\">\n * <Table.Header>\n * <Table.Column id=\"name\">Name</Table.Column>\n * </Table.Header>\n * <Table.Body>\n * <Table.Row key=\"1\">\n * <Table.Cell>Joe</Table.Cell>\n * </Table.Row>\n * </Table.Body>\n * </Table>\n * ```\n */\nconst Table = Object.assign(TableComponent, {\n /** Table header: {@link TableHeaderProps} */\n Header: TableHeader,\n /** Table column: {@link TableColumnProps} */\n Column: TableColumn,\n /** Table body: {@link TableBodyProps} */\n Body: TableBody,\n /** Table row: {@link TableRowProps} */\n Row: TableRow,\n /** Table cell: {@link TableCellProps} */\n Cell: TableCell,\n});\n\nexport { Table };\nexport type {\n TableHeaderProps,\n TableColumnProps,\n TableBodyProps,\n TableRowProps,\n TableCellProps,\n};\n"],"names":["TableComponent","children","name","tableData","useMemo","parseTableChildren","collection","useTableCollection","jsxs","jsx","column","index","row","rowIndex","e","_a","colIndex","cell","c","Table","TableHeader","TableColumn","TableBody","TableRow","TableCell"],"mappings":"0VA+BA,MAAMA,EAAiB,CAAC,CAAE,SAAAC,EAAU,KAAAC,KAAuB,CACzD,MAAMC,EAAuBC,EAAA,QAC3B,IAAMC,EAAAA,mBAAmBJ,CAAQ,EACjC,CAACA,CAAQ,CAAA,EAELK,EAAaC,qBAAmBJ,CAAS,EAG7C,OAAAK,EAAA,kBAAA,KAAC,QAAA,CACC,UAAU,eACV,KAAK,QACL,gBAAeF,EAAW,iBAC1B,gBAAeA,EAAW,QAAQ,OAClC,aAAYJ,EAEZ,SAAA,CAACO,EAAA,kBAAA,IAAA,UAAA,CAAQ,UAAU,wBAAyB,SAAKP,EAAA,EAGjDO,EAAA,kBAAA,IAAC,QAAA,CACC,UAAU,iCACV,KAAK,WACL,MAAOH,EAAW,eAAiB,CAAE,QAAS,MAAW,EAAA,OAEzD,SAACG,EAAA,kBAAA,IAAA,KAAA,CAAG,UAAU,2BAA2B,KAAK,MAAM,gBAAe,EAChE,SAAWH,EAAA,QAAQ,IAAI,CAACI,EAAQC,IAC/BF,EAAA,kBAAA,IAAC,KAAA,CAEC,UAAU,uBACV,KAAK,eACL,MAAM,MACN,gBAAeE,EAAQ,EACvB,YAAWD,EAAO,SAEjB,SAAOA,EAAA,MAAA,EAPHA,EAAO,GASf,CAAA,EACH,CAAA,CACF,EAGAD,EAAAA,kBAAAA,IAAC,QAAM,CAAA,UAAU,qBAAqB,KAAK,WACxC,SAAAH,EAAW,KAAK,IAAI,CAACM,EAAKC,IACzBJ,EAAA,kBAAA,IAAC,KAAA,CAEC,UAAU,oBACV,KAAK,MACL,gBAAeH,EAAW,gBAAgBO,CAAQ,EAClD,QAASD,GAAA,YAAAA,EAAK,QACd,SAAUA,GAAA,MAAAA,EAAK,QAAU,EAAI,OAC7B,UACEA,GAAA,MAAAA,EAAK,QACAE,GAAM,QACDA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,OAEjCA,EAAE,eAAe,GACjBC,EAAAH,EAAI,UAAJ,MAAAG,EAAA,KAAAH,GAGJ,EAAA,OAGL,SAAWN,EAAA,QAAQ,IAAI,CAACI,EAAQM,IAAa,CACtC,MAAAC,EAAOL,EAAI,MAAM,KAAMM,GAAMA,EAAE,YAAcR,EAAO,GAAG,EAE3D,OAAAD,EAAA,kBAAA,IAAC,KAAA,CAEC,UAAU,qBACV,KAAK,OACL,gBAAeO,EAAW,EAC1B,QAASC,GAAA,YAAAA,EAAM,QAEd,2BAAM,QAAS,EAAA,EANXP,EAAO,GAAA,CAOd,CAEH,CAAA,EA/BIE,EAAI,GAiCZ,CAAA,EACH,CAAA,CAAA,CAAA,CAGN,EAyBMO,EAAQ,OAAO,OAAOnB,EAAgB,CAE1C,OAAQoB,EAAA,YAER,OAAQC,EAAA,YAER,KAAMC,EAAA,UAEN,IAAKC,EAAA,SAEL,KAAMC,EAAA,SACR,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { j as a } from "../../node_modules/react/jsx-runtime.es.js";
2
2
  import { useMemo as p } from "react";
3
3
  import { parseTableChildren as m } from "./Collection/collectionParser.es.js";
4
- import { TableCell as b, TableRow as T, TableBody as u, TableColumn as x, TableHeader as h } from "./Collection/CompoundComponents.es.js";
4
+ import { TableHeader as b, TableColumn as T, TableBody as u, TableRow as x, TableCell as h } from "./Collection/CompoundComponents.es.js";
5
5
  import { useTableCollection as y } from "./Collection/useTableCollection.es.js";
6
6
  /* empty css */
7
7
  const _ = ({ children: s, name: i }) => {
@@ -73,15 +73,15 @@ const _ = ({ children: s, name: i }) => {
73
73
  );
74
74
  }, v = Object.assign(_, {
75
75
  /** Table header: {@link TableHeaderProps} */
76
- Header: h,
76
+ Header: b,
77
77
  /** Table column: {@link TableColumnProps} */
78
- Column: x,
78
+ Column: T,
79
79
  /** Table body: {@link TableBodyProps} */
80
80
  Body: u,
81
81
  /** Table row: {@link TableRowProps} */
82
- Row: T,
82
+ Row: x,
83
83
  /** Table cell: {@link TableCellProps} */
84
- Cell: b
84
+ Cell: h
85
85
  });
86
86
  export {
87
87
  v as Table