@lumx/react 2.2.3-alpha-export-hook1 → 2.2.5

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 (208) hide show
  1. package/esm/_internal/AlertDialog.js +2 -3
  2. package/esm/_internal/AlertDialog.js.map +1 -1
  3. package/esm/_internal/AutocompleteMultiple.js +1 -2
  4. package/esm/_internal/AutocompleteMultiple.js.map +1 -1
  5. package/esm/_internal/Button2.js +1 -1
  6. package/esm/_internal/ButtonGroup.js +4 -0
  7. package/esm/_internal/ButtonGroup.js.map +1 -1
  8. package/esm/_internal/Checkbox2.js +2 -3
  9. package/esm/_internal/Checkbox2.js.map +1 -1
  10. package/esm/_internal/Chip2.js +1 -2
  11. package/esm/_internal/Chip2.js.map +1 -1
  12. package/esm/_internal/ChipGroup.js.map +1 -1
  13. package/esm/_internal/ClickAwayProvider.js +1 -1
  14. package/esm/_internal/ClickAwayProvider.js.map +1 -1
  15. package/esm/_internal/DatePickerField.js +5 -1
  16. package/esm/_internal/DatePickerField.js.map +1 -1
  17. package/esm/_internal/Dialog2.js.map +1 -1
  18. package/esm/_internal/DragHandle.js +1 -2
  19. package/esm/_internal/DragHandle.js.map +1 -1
  20. package/esm/_internal/Dropdown2.js +1 -1
  21. package/esm/_internal/Dropdown2.js.map +1 -1
  22. package/esm/_internal/ExpansionPanel.js +1 -1
  23. package/esm/_internal/Icon2.js +23 -3
  24. package/esm/_internal/Icon2.js.map +1 -1
  25. package/esm/_internal/IconButton.js +5 -1
  26. package/esm/_internal/IconButton.js.map +1 -1
  27. package/esm/_internal/Lightbox2.js +1 -1
  28. package/esm/_internal/Lightbox2.js.map +1 -1
  29. package/esm/_internal/Link2.js +1 -1
  30. package/esm/_internal/LinkPreview.js +1 -1
  31. package/esm/_internal/LinkPreview.js.map +1 -1
  32. package/esm/_internal/List2.js +4 -20
  33. package/esm/_internal/List2.js.map +1 -1
  34. package/esm/_internal/Message2.js +3 -3
  35. package/esm/_internal/Message2.js.map +1 -1
  36. package/esm/_internal/Notification2.js +1 -2
  37. package/esm/_internal/Notification2.js.map +1 -1
  38. package/esm/_internal/Popover2.js.map +1 -1
  39. package/esm/_internal/ProgressTrackerStepPanel.js +1 -2
  40. package/esm/_internal/ProgressTrackerStepPanel.js.map +1 -1
  41. package/esm/_internal/RadioGroup.js +1 -1
  42. package/esm/_internal/SelectMultiple.js +2 -3
  43. package/esm/_internal/SelectMultiple.js.map +1 -1
  44. package/esm/_internal/SideNavigationItem.js +2 -4
  45. package/esm/_internal/SideNavigationItem.js.map +1 -1
  46. package/esm/_internal/Slider2.js +1 -1
  47. package/esm/_internal/Slider2.js.map +1 -1
  48. package/esm/_internal/SlideshowControls.js +3 -101
  49. package/esm/_internal/SlideshowControls.js.map +1 -1
  50. package/esm/_internal/Switch2.js +1 -1
  51. package/esm/_internal/TabPanel.js +1 -1
  52. package/esm/_internal/TabPanel.js.map +1 -1
  53. package/esm/_internal/TableRow.js +2 -4
  54. package/esm/_internal/TableRow.js.map +1 -1
  55. package/esm/_internal/TextField.js +2 -3
  56. package/esm/_internal/TextField.js.map +1 -1
  57. package/esm/_internal/Thumbnail2.js +6 -3
  58. package/esm/_internal/Thumbnail2.js.map +1 -1
  59. package/esm/_internal/Tooltip2.js +145 -12
  60. package/esm/_internal/Tooltip2.js.map +1 -1
  61. package/esm/_internal/alert-dialog.js +4 -5
  62. package/esm/_internal/alert-dialog.js.map +1 -1
  63. package/esm/_internal/autocomplete.js +6 -8
  64. package/esm/_internal/autocomplete.js.map +1 -1
  65. package/esm/_internal/avatar.js +3 -3
  66. package/esm/_internal/badge.js +2 -1
  67. package/esm/_internal/badge.js.map +1 -1
  68. package/esm/_internal/button.js +5 -5
  69. package/esm/_internal/checkbox.js +4 -4
  70. package/esm/_internal/chip.js +2 -2
  71. package/esm/_internal/comment-block.js +3 -3
  72. package/esm/_internal/constants.js.map +1 -1
  73. package/esm/_internal/date-picker.js +5 -6
  74. package/esm/_internal/date-picker.js.map +1 -1
  75. package/esm/_internal/dialog.js +2 -2
  76. package/esm/_internal/divider.js +2 -1
  77. package/esm/_internal/divider.js.map +1 -1
  78. package/esm/_internal/drag-handle.js +3 -3
  79. package/esm/_internal/dropdown.js +3 -4
  80. package/esm/_internal/dropdown.js.map +1 -1
  81. package/esm/_internal/expansion-panel.js +5 -6
  82. package/esm/_internal/expansion-panel.js.map +1 -1
  83. package/esm/_internal/flag.js +3 -2
  84. package/esm/_internal/flag.js.map +1 -1
  85. package/esm/_internal/flex-box.js +2 -1
  86. package/esm/_internal/flex-box.js.map +1 -1
  87. package/esm/_internal/getRootClassName.js +166 -40
  88. package/esm/_internal/getRootClassName.js.map +1 -1
  89. package/esm/_internal/grid.js +2 -1
  90. package/esm/_internal/grid.js.map +1 -1
  91. package/esm/_internal/icon.js +3 -2
  92. package/esm/_internal/icon.js.map +1 -1
  93. package/esm/_internal/image-block.js +3 -3
  94. package/esm/_internal/input-helper.js +2 -1
  95. package/esm/_internal/input-helper.js.map +1 -1
  96. package/esm/_internal/input-label.js +2 -1
  97. package/esm/_internal/input-label.js.map +1 -1
  98. package/esm/_internal/lightbox.js +5 -6
  99. package/esm/_internal/lightbox.js.map +1 -1
  100. package/esm/_internal/link-preview.js +3 -3
  101. package/esm/_internal/link.js +3 -2
  102. package/esm/_internal/link.js.map +1 -1
  103. package/esm/_internal/list.js +3 -3
  104. package/esm/_internal/message.js +3 -3
  105. package/esm/_internal/mosaic.js +3 -3
  106. package/esm/_internal/notification.js +3 -3
  107. package/esm/_internal/popover.js +2 -2
  108. package/esm/_internal/post-block.js +3 -3
  109. package/esm/_internal/progress-tracker.js +4 -4
  110. package/esm/_internal/progress.js +2 -1
  111. package/esm/_internal/progress.js.map +1 -1
  112. package/esm/_internal/radio-button.js +3 -2
  113. package/esm/_internal/radio-button.js.map +1 -1
  114. package/esm/_internal/select.js +6 -8
  115. package/esm/_internal/select.js.map +1 -1
  116. package/esm/_internal/side-navigation.js +5 -7
  117. package/esm/_internal/side-navigation.js.map +1 -1
  118. package/esm/_internal/skeleton.js +2 -1
  119. package/esm/_internal/skeleton.js.map +1 -1
  120. package/esm/_internal/slider.js +3 -2
  121. package/esm/_internal/slider.js.map +1 -1
  122. package/esm/_internal/slideshow.js +6 -8
  123. package/esm/_internal/slideshow.js.map +1 -1
  124. package/esm/_internal/switch.js +3 -2
  125. package/esm/_internal/switch.js.map +1 -1
  126. package/esm/_internal/table.js +3 -4
  127. package/esm/_internal/table.js.map +1 -1
  128. package/esm/_internal/tabs.js +4 -3
  129. package/esm/_internal/tabs.js.map +1 -1
  130. package/esm/_internal/text-field.js +5 -6
  131. package/esm/_internal/text-field.js.map +1 -1
  132. package/esm/_internal/thumbnail.js +3 -3
  133. package/esm/_internal/toolbar.js +2 -1
  134. package/esm/_internal/toolbar.js.map +1 -1
  135. package/esm/_internal/tooltip.js +4 -4
  136. package/esm/_internal/uploader.js +3 -2
  137. package/esm/_internal/uploader.js.map +1 -1
  138. package/esm/_internal/useDelayedVisibility.js.map +1 -1
  139. package/esm/_internal/useDisableBodyScroll.js.map +1 -1
  140. package/esm/_internal/useFocusTrap.js.map +1 -1
  141. package/esm/_internal/useRovingTabIndex.js +1 -1
  142. package/esm/_internal/useRovingTabIndex.js.map +1 -1
  143. package/esm/_internal/user-block.js +3 -3
  144. package/esm/index.js +7 -10
  145. package/esm/index.js.map +1 -1
  146. package/esm/{_internal/index.js → index2.js} +1 -1
  147. package/esm/index2.js.map +1 -0
  148. package/package.json +4 -4
  149. package/src/components/autocomplete/Autocomplete.tsx +1 -1
  150. package/src/components/button/__snapshots__/IconButton.test.tsx.snap +5 -0
  151. package/src/components/chip/Chip.tsx +1 -1
  152. package/src/components/chip/ChipGroup.tsx +1 -1
  153. package/src/components/date-picker/DatePickerField.tsx +2 -2
  154. package/src/components/dialog/Dialog.test.tsx +1 -1
  155. package/src/components/dialog/Dialog.tsx +5 -5
  156. package/src/components/dropdown/Dropdown.tsx +1 -1
  157. package/src/components/icon/Icon.tsx +5 -0
  158. package/src/components/lightbox/Lightbox.tsx +4 -4
  159. package/src/components/link-preview/LinkPreview.tsx +1 -1
  160. package/src/components/link-preview/__snapshots__/LinkPreview.test.tsx.snap +2 -2
  161. package/src/components/list/List.tsx +1 -1
  162. package/src/components/message/Message.tsx +3 -1
  163. package/src/components/mosaic/Mosaic.test.tsx +1 -1
  164. package/src/components/notification/Notification.tsx +1 -1
  165. package/src/components/popover/Popover.tsx +2 -2
  166. package/src/components/progress-tracker/ProgressTracker.tsx +1 -1
  167. package/src/components/select/Select.stories.tsx +1 -1
  168. package/src/components/select/SelectMultiple.stories.tsx +1 -1
  169. package/src/components/select/WithSelectContext.tsx +1 -1
  170. package/src/components/slider/Slider.tsx +1 -1
  171. package/src/components/slideshow/Slideshow.tsx +1 -1
  172. package/src/components/slideshow/useSwipeNavigate.ts +1 -1
  173. package/src/components/tabs/TabList.tsx +4 -4
  174. package/src/components/thumbnail/Thumbnail.tsx +7 -1
  175. package/src/components/tooltip/Tooltip.tsx +4 -7
  176. package/src/components/tooltip/useTooltipOpen.tsx +112 -0
  177. package/src/constants.ts +1 -7
  178. package/src/{_internal/hooks → hooks}/useBooleanState.tsx +0 -0
  179. package/src/{_internal/hooks → hooks}/useCallbackOnEscape.ts +0 -0
  180. package/src/{_internal/hooks → hooks}/useChipGroupNavigation.tsx +0 -0
  181. package/src/{_internal/hooks → hooks}/useClickAway.tsx +0 -0
  182. package/src/{_internal/hooks → hooks}/useDelayedVisibility.tsx +0 -0
  183. package/src/{_internal/hooks → hooks}/useDisableBodyScroll.ts +0 -0
  184. package/src/{_internal/hooks → hooks}/useEventCallback.tsx +0 -0
  185. package/src/{_internal/hooks → hooks}/useFocus.tsx +0 -0
  186. package/src/{_internal/hooks → hooks}/useFocusTrap.ts +0 -0
  187. package/src/{_internal/hooks → hooks}/useInfiniteScroll.tsx +0 -0
  188. package/src/{_internal/hooks → hooks}/useIntersectionObserver.tsx +0 -0
  189. package/src/{_internal/hooks → hooks}/useInterval.tsx +1 -1
  190. package/src/{_internal/hooks → hooks}/useKeyboardListNavigation.tsx +0 -0
  191. package/src/{_internal/hooks → hooks}/useListenFocus.tsx +0 -0
  192. package/src/{_internal/hooks → hooks}/useOnResize.ts +0 -0
  193. package/src/{_internal/hooks → hooks}/useRovingTabIndex.tsx +0 -0
  194. package/src/{_internal/hooks → hooks}/useStopPropagation.ts +0 -0
  195. package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +1 -1
  196. package/types.d.ts +2 -2
  197. package/esm/_internal/index.js.map +0 -1
  198. package/esm/_internal/mdi.js +0 -22
  199. package/esm/_internal/mdi.js.map +0 -1
  200. package/esm/_internal/onEnterPressed.js +0 -20
  201. package/esm/_internal/onEnterPressed.js.map +0 -1
  202. package/esm/_internal/onEscapePressed.js +0 -20
  203. package/esm/_internal/onEscapePressed.js.map +0 -1
  204. package/esm/hooks/useOpenHoverOrLongPress.js +0 -172
  205. package/esm/hooks/useOpenHoverOrLongPress.js.map +0 -1
  206. package/src/hooks/useOpenHoverOrLongPress.ts +0 -140
  207. package/src/utils/browserDoesNotSupportHover.test.js +0 -24
  208. package/src/utils/browserDoesNotSupportHover.ts +0 -2
@@ -2,11 +2,10 @@ import { a as _defineProperty, b as _objectWithoutProperties, c as _extends, _ a
2
2
  import { Size, Emphasis, ColorPalette, Kind } from './components.js';
3
3
  import React, { forwardRef } from 'react';
4
4
  import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
- import { m as mdiAlert, a as mdiInformation, b as mdiCheckCircle, c as mdiAlertCircle } from './mdi.js';
6
- import { u as uid } from './index.js';
5
+ import { I as Icon, m as mdiAlert, a as mdiInformation, b as mdiCheckCircle, c as mdiAlertCircle } from './Icon2.js';
6
+ import { u as uid } from '../index2.js';
7
7
  import { a as Button } from './Button2.js';
8
8
  import { D as Dialog } from './Dialog2.js';
9
- import { I as Icon } from './Icon2.js';
10
9
  import { T as Toolbar } from './Toolbar2.js';
11
10
 
12
11
  var _CONFIG;
@@ -1 +1 @@
1
- {"version":3,"file":"AlertDialog.js","sources":["../../../src/components/alert-dialog/AlertDialog.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n DialogProps,\n Dialog,\n Button,\n Emphasis,\n ColorPalette,\n Icon,\n Size,\n Kind,\n Toolbar,\n ButtonProps,\n} from '@lumx/react';\n\nimport { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons/';\nimport { uid } from 'uid';\nimport { Comp, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nexport interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {\n /** Message variant. */\n kind?: Kind;\n /** Dialog title. */\n title?: string;\n /** Props forwarded to the confirm button */\n confirmProps: ButtonProps & {\n onClick(): void;\n label: string;\n };\n /**\n * Props forwarded to the cancel button.\n * Will not render a cancel button if undefined.\n */\n cancelProps?: ButtonProps & {\n onClick(): void;\n label: string;\n };\n}\n\n/**\n * Associative map from message kind to color and icon.\n */\nconst CONFIG = {\n [Kind.error]: { color: ColorPalette.red, icon: mdiAlert },\n [Kind.info]: { color: ColorPalette.blue, icon: mdiInformation },\n [Kind.success]: { color: ColorPalette.green, icon: mdiCheckCircle },\n [Kind.warning]: { color: ColorPalette.yellow, icon: mdiAlertCircle },\n};\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AlertDialog';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<DialogProps> = {\n size: Size.tiny,\n kind: Kind.info,\n};\n\n/**\n * AlertDialog component.\n *\n * An alert dialog is a modal dialog that interrupts the user's workflow to\n * communicate an important message and acquire a response.\n *\n * It should not have a complex content.\n * Children of this component should only be strings, paragraphs or links.\n */\nexport const AlertDialog: Comp<AlertDialogProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n id,\n title,\n className,\n cancelProps,\n confirmProps,\n kind,\n size,\n dialogProps,\n children,\n ...forwardedProps\n } = props;\n\n const cancelButtonRef = React.useRef(null);\n const confirmationButtonRef = React.useRef(null);\n const { color, icon } = CONFIG[kind as Kind] || {};\n\n // Define a unique ID to target title and description for aria attributes.\n const uniqueId = React.useMemo(() => id || uid(), [id]);\n const titleId = `${uniqueId}-title`;\n const descriptionId = `${uniqueId}-description`;\n\n // If content is a string, set in a paragraph.\n const DescriptionElement = typeof children === 'string' ? 'p' : 'div';\n\n const { label: confirmLabel, onClick: confirmOnClick, ...forwardedConfirmProps } = confirmProps;\n const { label: cancelLabel, onClick: cancelOnClick, ...forwardedCancelProps } = cancelProps || {};\n\n return (\n <Dialog\n ref={ref}\n focusElement={cancelProps ? cancelButtonRef : confirmationButtonRef}\n size={size}\n dialogProps={{\n id: uniqueId,\n role: 'alertdialog',\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n ...dialogProps,\n }}\n className={classNames(\n className,\n handleBasicClasses({\n kind,\n prefix: CLASSNAME,\n }),\n )}\n {...forwardedProps}\n >\n <header>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n before={<Icon icon={icon} size={Size.s} color={color} />}\n label={\n <h2 id={titleId} className=\"lumx-typography-title\">\n {title}\n </h2>\n }\n />\n </header>\n\n {children && (\n <DescriptionElement\n id={descriptionId}\n className=\"lumx-typography-body2 lumx-spacing-padding-vertical-big lumx-spacing-padding-horizontal-huge\"\n >\n {children}\n </DescriptionElement>\n )}\n\n <footer>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n after={\n <>\n {cancelProps && (\n <Button\n {...forwardedCancelProps}\n ref={cancelButtonRef}\n emphasis={Emphasis.medium}\n onClick={cancelOnClick}\n >\n {cancelLabel}\n </Button>\n )}\n <Button\n {...forwardedConfirmProps}\n ref={confirmationButtonRef}\n color={color}\n className=\"lumx-spacing-margin-left-regular\"\n onClick={confirmOnClick}\n >\n {confirmLabel}\n </Button>\n </>\n }\n />\n </footer>\n </Dialog>\n );\n});\n\nAlertDialog.displayName = COMPONENT_NAME;\nAlertDialog.className = CLASSNAME;\nAlertDialog.defaultProps = DEFAULT_PROPS;\n"],"names":["CONFIG","Kind","error","color","ColorPalette","red","icon","mdiAlert","info","blue","mdiInformation","success","green","mdiCheckCircle","warning","yellow","mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","tiny","kind","AlertDialog","forwardRef","props","ref","id","title","className","cancelProps","confirmProps","dialogProps","children","forwardedProps","cancelButtonRef","React","useRef","confirmationButtonRef","uniqueId","useMemo","uid","titleId","descriptionId","DescriptionElement","confirmLabel","label","confirmOnClick","onClick","forwardedConfirmProps","cancelLabel","cancelOnClick","forwardedCancelProps","role","classNames","handleBasicClasses","prefix","s","Emphasis","medium","displayName","defaultProps"],"mappings":";;;;;;;;;;;;;AAyCA;;;AAGA,IAAMA,MAAM,2CACPC,IAAI,CAACC,KADE,EACM;AAAEC,EAAAA,KAAK,EAAEC,YAAY,CAACC,GAAtB;AAA2BC,EAAAA,IAAI,EAAEC;AAAjC,CADN,4BAEPN,IAAI,CAACO,IAFE,EAEK;AAAEL,EAAAA,KAAK,EAAEC,YAAY,CAACK,IAAtB;AAA4BH,EAAAA,IAAI,EAAEI;AAAlC,CAFL,4BAGPT,IAAI,CAACU,OAHE,EAGQ;AAAER,EAAAA,KAAK,EAAEC,YAAY,CAACQ,KAAtB;AAA6BN,EAAAA,IAAI,EAAEO;AAAnC,CAHR,4BAIPZ,IAAI,CAACa,OAJE,EAIQ;AAAEX,EAAAA,KAAK,EAAEC,YAAY,CAACW,MAAtB;AAA8BT,EAAAA,IAAI,EAAEU;AAApC,CAJR,WAAZ;AAOA;;;;AAGA,IAAMC,cAAc,GAAG,aAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAmC,GAAG;AACxCC,EAAAA,IAAI,EAAEC,IAAI,CAACC,IAD6B;A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CI,oCACI,oBAAC,OAAD;AACI,IAAA,SAAS,EAAC,gCADd;AAEI,IAAA,KAAK,EACD,0CACKH,WAAW,IACR,oBAAC,MAAD,eACQsB,oBADR;AAEI,MAAA,GAAG,EAAEjB,eAFT;AAGI,MAAA,QAAQ,EAAEuB,QAAQ,CAACC,MAHvB;AAII,MAAA,OAAO,EAAER;AAJb,QAMKD,WANL,CAFR,EAWI,oBAAC,MAAD,eACQD,qBADR;AAEI,MAAA,GAAG,EAAEX,qBAFT;AAGI,MAAA,KAAK,EAAErC,KAHX;AAII,MAAA,SAAS,EAAC,kCAJd;AAKI,MAAA,OAAO,EAAE8C;AALb,QAOKF,YAPL,CAXJ;AAHR,IADJ,CAzCJ,CADJ;AAwEH,CArG4E;AAuG7EtB,WAAW,CAACqC,WAAZ,GAA0B7C,cAA1B;AACAQ,WAAW,CAACM,SAAZ,GAAwBb,SAAxB;AACAO,WAAW,CAACsC,YAAZ,GAA2B3C,aAA3B;;;;"}
1
+ {"version":3,"file":"AlertDialog.js","sources":["../../../src/components/alert-dialog/AlertDialog.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n DialogProps,\n Dialog,\n Button,\n Emphasis,\n ColorPalette,\n Icon,\n Size,\n Kind,\n Toolbar,\n ButtonProps,\n} from '@lumx/react';\n\nimport { mdiAlert, mdiAlertCircle, mdiCheckCircle, mdiInformation } from '@lumx/icons/';\nimport { uid } from 'uid';\nimport { Comp, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nexport interface AlertDialogProps extends Omit<DialogProps, 'header' | 'footer'> {\n /** Message variant. */\n kind?: Kind;\n /** Dialog title. */\n title?: string;\n /** Props forwarded to the confirm button */\n confirmProps: ButtonProps & {\n onClick(): void;\n label: string;\n };\n /**\n * Props forwarded to the cancel button.\n * Will not render a cancel button if undefined.\n */\n cancelProps?: ButtonProps & {\n onClick(): void;\n label: string;\n };\n}\n\n/**\n * Associative map from message kind to color and icon.\n */\nconst CONFIG = {\n [Kind.error]: { color: ColorPalette.red, icon: mdiAlert },\n [Kind.info]: { color: ColorPalette.blue, icon: mdiInformation },\n [Kind.success]: { color: ColorPalette.green, icon: mdiCheckCircle },\n [Kind.warning]: { color: ColorPalette.yellow, icon: mdiAlertCircle },\n};\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AlertDialog';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<DialogProps> = {\n size: Size.tiny,\n kind: Kind.info,\n};\n\n/**\n * AlertDialog component.\n *\n * An alert dialog is a modal dialog that interrupts the user's workflow to\n * communicate an important message and acquire a response.\n *\n * It should not have a complex content.\n * Children of this component should only be strings, paragraphs or links.\n */\nexport const AlertDialog: Comp<AlertDialogProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n id,\n title,\n className,\n cancelProps,\n confirmProps,\n kind,\n size,\n dialogProps,\n children,\n ...forwardedProps\n } = props;\n\n const cancelButtonRef = React.useRef(null);\n const confirmationButtonRef = React.useRef(null);\n const { color, icon } = CONFIG[kind as Kind] || {};\n\n // Define a unique ID to target title and description for aria attributes.\n const uniqueId = React.useMemo(() => id || uid(), [id]);\n const titleId = `${uniqueId}-title`;\n const descriptionId = `${uniqueId}-description`;\n\n // If content is a string, set in a paragraph.\n const DescriptionElement = typeof children === 'string' ? 'p' : 'div';\n\n const { label: confirmLabel, onClick: confirmOnClick, ...forwardedConfirmProps } = confirmProps;\n const { label: cancelLabel, onClick: cancelOnClick, ...forwardedCancelProps } = cancelProps || {};\n\n return (\n <Dialog\n ref={ref}\n focusElement={cancelProps ? cancelButtonRef : confirmationButtonRef}\n size={size}\n dialogProps={{\n id: uniqueId,\n role: 'alertdialog',\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n ...dialogProps,\n }}\n className={classNames(\n className,\n handleBasicClasses({\n kind,\n prefix: CLASSNAME,\n }),\n )}\n {...forwardedProps}\n >\n <header>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n before={<Icon icon={icon} size={Size.s} color={color} />}\n label={\n <h2 id={titleId} className=\"lumx-typography-title\">\n {title}\n </h2>\n }\n />\n </header>\n\n {children && (\n <DescriptionElement\n id={descriptionId}\n className=\"lumx-typography-body2 lumx-spacing-padding-vertical-big lumx-spacing-padding-horizontal-huge\"\n >\n {children}\n </DescriptionElement>\n )}\n\n <footer>\n <Toolbar\n className=\"lumx-spacing-margin-horizontal\"\n after={\n <>\n {cancelProps && (\n <Button\n {...forwardedCancelProps}\n ref={cancelButtonRef}\n emphasis={Emphasis.medium}\n onClick={cancelOnClick}\n >\n {cancelLabel}\n </Button>\n )}\n <Button\n {...forwardedConfirmProps}\n ref={confirmationButtonRef}\n color={color}\n className=\"lumx-spacing-margin-left-regular\"\n onClick={confirmOnClick}\n >\n {confirmLabel}\n </Button>\n </>\n }\n />\n </footer>\n </Dialog>\n );\n});\n\nAlertDialog.displayName = COMPONENT_NAME;\nAlertDialog.className = CLASSNAME;\nAlertDialog.defaultProps = DEFAULT_PROPS;\n"],"names":["CONFIG","Kind","error","color","ColorPalette","red","icon","mdiAlert","info","blue","mdiInformation","success","green","mdiCheckCircle","warning","yellow","mdiAlertCircle","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","tiny","kind","AlertDialog","forwardRef","props","ref","id","title","className","cancelProps","confirmProps","dialogProps","children","forwardedProps","cancelButtonRef","React","useRef","confirmationButtonRef","uniqueId","useMemo","uid","titleId","descriptionId","DescriptionElement","confirmLabel","label","confirmOnClick","onClick","forwardedConfirmProps","cancelLabel","cancelOnClick","forwardedCancelProps","role","classNames","handleBasicClasses","prefix","s","Emphasis","medium","displayName","defaultProps"],"mappings":";;;;;;;;;;;;AAyCA;;;AAGA,IAAMA,MAAM,2CACPC,IAAI,CAACC,KADE,EACM;AAAEC,EAAAA,KAAK,EAAEC,YAAY,CAACC,GAAtB;AAA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objectWithoutProperties, c as _extends } from './_rollupPluginBab
2
2
  import { Size } from './components.js';
3
3
  import React, { forwardRef, useRef } from 'react';
4
4
  import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
- import { d as mdiClose } from './mdi.js';
5
+ import { I as Icon, d as mdiClose } from './Icon2.js';
6
6
  import { u as useFocus } from './Popover2.js';
7
7
  import { m as mergeRefs } from './mergeRefs.js';
8
8
  import { C as Chip } from './Chip2.js';
9
9
  import { D as Dropdown } from './Dropdown2.js';
10
- import { I as Icon } from './Icon2.js';
11
10
  import { T as TextField } from './TextField.js';
12
11
 
13
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"AutocompleteMultiple.js","sources":["../../../src/components/autocomplete/Autocomplete.tsx","../../../src/components/autocomplete/AutocompleteMultiple.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, RefObject, SyntheticEvent, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Dropdown, IconButtonProps, Offset, Placement, TextField, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useFocus } from '@lumx/react/_internal/hooks/useFocus';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteProps extends GenericProps {\n /**\n * Whether the suggestions list should display anchored to the input or to the wrapper.\n * @see {@link DropdownProps#anchorToInput}\n */\n anchorToInput?: boolean;\n /**\n * Props to pass to the clear button (minus those already set by the TextField props).\n * If not specified, the button won't be displayed.\n * @see {@link TextFieldProps#clearButtonProps}\n */\n clearButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /**\n * Reference to the <input> or <textarea> element.\n * @see {@link TextFieldProps#inputRef}\n */\n inputRef?: RefObject<HTMLInputElement>;\n /**\n * The offset that will be applied to the Dropdown position.\n * @see {@link DropdownProps#offset}\n */\n offset?: Offset;\n /**\n * The preferred Dropdown location against the anchor element.\n * @see {@link DropdownProps#placement}\n */\n placement?: Placement;\n /**\n * Whether the dropdown should fit to the anchor width or not.\n * @see {@link DropdownProps#fitToAnchorWidth}\n */\n fitToAnchorWidth?: boolean;\n /**\n * The error related to the component.\n * @see {@link TextFieldProps#error}\n */\n error?: string | ReactNode;\n /**\n * Whether the text field is displayed with error style or not.\n * @see {@link TextFieldProps#hasError}\n */\n hasError?: boolean;\n /**\n * Whether the text box should be focused upon closing the suggestions or not.\n */\n shouldFocusOnClose?: boolean;\n /**\n * The helper message of the text field.\n * @see {@link TextFieldProps#helper}\n */\n helper?: string;\n /**\n * The icon of the text field (SVG path).\n * @see {@link TextFieldProps#icon}\n */\n icon?: string;\n /**\n * Whether the component is disabled or not.\n * @see {@link TextFieldProps#isDisabled}\n */\n isDisabled?: boolean;\n /**\n * Whether the component is required or not.\n * @see {@link TextFieldProps#isRequired}\n */\n isRequired?: boolean;\n /**\n * Whether the text field is displayed with valid style or not.\n * @see {@link TextFieldProps#isValid}\n */\n isValid?: boolean;\n /**\n * The label of the text field displayed in a label tag.\n * @see {@link TextFieldProps#label}\n */\n label?: string;\n /**\n * The placeholder message of the text field.\n * @see {@link TextFieldProps#placeholder}\n */\n placeholder?: string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** List of suggestions to display during autocomplete. */\n children: React.ReactNode;\n /**\n * The list of chips to be displayed before the text field input.\n */\n chips?: React.ReactNode;\n /**\n * The value of the text field.\n * @see {@link TextFieldProps#value}\n */\n value: string;\n /**\n * Whether the suggestions from the autocomplete should be displayed or not.\n * @see {@link DropdownProps#isOpen}\n */\n isOpen: boolean;\n /**\n * The native input name property.\n * @see {@link TextFieldProps#name}\n */\n name?: string;\n /**\n * Whether a click in the Autocomplete dropdown would close it or not.\n * @see {@link DropdownProps#closeOnClick}\n */\n closeOnClick?: boolean;\n /**\n * Whether a click anywhere out of the Autocomplete would close it or not.\n * @see {@link DropdownProps#closeOnClickAway}\n */\n closeOnClickAway?: boolean;\n /**\n * Whether an escape key press would close the Autocomplete or not.\n * @see {@link DropdownProps#closeOnEscape}\n */\n closeOnEscape?: boolean;\n /**\n * The function called on blur.\n * @see {@link TextFieldProps#onBlur}\n */\n onBlur?(event: React.FocusEvent): void;\n /**\n * On change callback.\n * @see {@link TextFieldProps#onChange}\n */\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n /**\n * The function called on close.\n * @see {@link DropdownProps#onClose}\n */\n onClose?(): void;\n /**\n * The function called on focus.\n * @see {@link TextFieldProps#onFocus}\n */\n onFocus?(event: React.FocusEvent): void;\n /**\n * The function called when the bottom of the dropdown is reached.\n * @see {@link DropdownProps#onInfiniteScroll}\n */\n onInfiniteScroll?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Autocomplete';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AutocompleteProps> = {\n anchorToInput: false,\n closeOnClick: false,\n closeOnClickAway: true,\n closeOnEscape: true,\n shouldFocusOnClose: false,\n};\n\n/**\n * Autocomplete component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Autocomplete: Comp<AutocompleteProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n anchorToInput,\n children,\n chips,\n className,\n closeOnClick,\n closeOnClickAway,\n closeOnEscape,\n disabled,\n error,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isDisabled = disabled,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClose,\n onFocus,\n onInfiniteScroll,\n placeholder,\n placement,\n shouldFocusOnClose,\n theme,\n value,\n ...forwardedProps\n } = props;\n const inputAnchorRef = useRef<HTMLElement>(null);\n const textFieldRef = useRef(null);\n useFocus(inputAnchorRef.current, !isOpen && shouldFocusOnClose);\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n }),\n )}\n >\n <TextField\n chips={chips}\n error={error}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={mergeRefs(inputAnchorRef, inputRef) as any}\n clearButtonProps={clearButtonProps}\n isDisabled={isDisabled}\n isRequired={isRequired}\n isValid={isValid}\n label={label}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n textFieldRef={textFieldRef}\n theme={theme}\n value={value}\n />\n <Dropdown\n anchorRef={anchorToInput ? inputAnchorRef : textFieldRef}\n closeOnClick={closeOnClick}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n fitToAnchorWidth={fitToAnchorWidth}\n isOpen={isOpen}\n offset={offset}\n onClose={onClose}\n onInfiniteScroll={onInfiniteScroll}\n placement={placement}\n shouldFocusOnOpen={false}\n theme={theme}\n >\n {children}\n </Dropdown>\n </div>\n );\n});\nAutocomplete.displayName = COMPONENT_NAME;\nAutocomplete.className = CLASSNAME;\nAutocomplete.defaultProps = DEFAULT_PROPS;\n","import { mdiClose } from '@lumx/icons';\nimport { Autocomplete, AutocompleteProps, Chip, ChipGroup, HorizontalAlignment, Icon, Size } from '@lumx/react';\n\nimport { Comp, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteMultipleProps extends AutocompleteProps {\n /** Selected values. */\n values: any[];\n /** Alignment of the chips in the autocomplete. */\n chipsAlignment?: HorizontalAlignment;\n /** Selected value render function. Default: Renders the value inside of a Chip. */\n selectedChipRender(\n choice: any,\n index: number,\n onClear?: (event: React.MouseEvent, choice: any) => void,\n isDisabled?: boolean,\n ): ReactNode | string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AutocompleteMultiple';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AutocompleteMultipleProps> = {\n closeOnClickAway: true,\n closeOnEscape: true,\n selectedChipRender(choice, index, onClear, isDisabled) {\n const onClick = (event: React.MouseEvent) => onClear && onClear(event, choice);\n return (\n <Chip\n key={index}\n after={onClear && <Icon icon={mdiClose} size={Size.xxs} />}\n isDisabled={isDisabled}\n size={Size.s}\n onAfterClick={onClick}\n onClick={onClick}\n >\n {choice}\n </Chip>\n );\n },\n values: [],\n};\n\n/**\n * AutocompleteMultiple component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const AutocompleteMultiple: Comp<AutocompleteMultipleProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n anchorToInput,\n children,\n chipsAlignment,\n className,\n closeOnClickAway,\n closeOnEscape,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isDisabled,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClear,\n onClose,\n onFocus,\n onInfiniteScroll,\n onKeyDown,\n placeholder,\n placement,\n selectedChipRender,\n shouldFocusOnClose,\n theme,\n type,\n value,\n values,\n ...forwardedProps\n } = props;\n\n return (\n <Autocomplete\n ref={ref}\n {...forwardedProps}\n anchorToInput={anchorToInput}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n }),\n )}\n name={name}\n value={value}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n shouldFocusOnClose={shouldFocusOnClose}\n onFocus={onFocus}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={inputRef}\n chips={values && values.map((chip: any, index: number) => selectedChipRender(chip, index, onClear))}\n isDisabled={isDisabled}\n isRequired={isRequired}\n clearButtonProps={clearButtonProps}\n isValid={isValid}\n label={label}\n placeholder={placeholder}\n theme={theme}\n type={type}\n isOpen={isOpen}\n closeOnClick={false}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n onClose={onClose}\n offset={offset}\n placement={placement}\n fitToAnchorWidth={fitToAnchorWidth}\n onInfiniteScroll={onInfiniteScroll}\n >\n {children}\n </Autocomplete>\n );\n});\nAutocompleteMultiple.displayName = COMPONENT_NAME;\nAutocompleteMultiple.className = CLASSNAME;\nAutocompleteMultiple.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","anchorToInput","closeOnClick","closeOnClickAway","closeOnEscape","shouldFocusOnClose","Autocomplete","forwardRef","props","ref","children","chips","className","disabled","error","fitToAnchorWidth","hasError","helper","icon","inputRef","clearButtonProps","isDisabled","isRequired","isOpen","isValid","label","name","offset","onBlur","onChange","onClose","onFocus","onInfiniteScroll","placeholder","placement","theme","value","forwardedProps","inputAnchorRef","useRef","textFieldRef","useFocus","current","classNames","handleBasicClasses","prefix","mergeRefs","displayName","defaultProps","selectedChipRender","choice","index","onClear","onClick","event","mdiClose","Size","xxs","s","values","AutocompleteMultiple","chipsAlignment","onKeyDown","type","map","chip"],"mappings":";;;;;;;;;;;;AAWA;;;;AAsJA;;;AAGA,IAAMA,cAAc,GAAG,cAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAyC,GAAG;AAC9CC,EAAAA,aAAa,EAAE,KAD+B;AAE9CC,EAAAA,YAAY,EAAE,KAFgC;AAG9CC,EAAAA,gBAAgB,EAAE,IAH4B;AAI9CC,EAAAA,aAAa,EAAE,IAJ+B;AAK9CC,EAAAA,kBAAkB,EAAE;AAL0B,CAAlD;AAQA;;;;;;;;IAOaC,YAAqD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAExFR,aAFwF,GAmCxFO,KAnCwF,CAExFP,aAFwF;AAAA,MAGxFS,QAHwF,GAmC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AAEF,gBAxBtB;AAyBI,IAAA,OAAO,EAAEI,OAzBb;AA0BI,IAAA,KAAK,EAAEC,KA1BX;AA2BI,IAAA,WAAW,EAAEQ,WA3BjB;AA4BI,IAAA,KAAK,EAAEE,KA5BX;AA6BI,IAAA,IAAI,EAAE4B,IA7BV;AA8BI,IAAA,MAAM,EAAExC,MA9BZ;AA+BI,IAAA,YAAY,EAAE,KA/BlB;AAgCI,IAAA,gBAAgB,EAAEpB,gBAhCtB;AAiCI,IAAA,aAAa,EAAEC,aAjCnB;AAkCI,IAAA,OAAO,EAAE0B,OAlCb;AAmCI,IAAA,MAAM,EAAEH,MAnCZ;AAoCI,IAAA,SAAS,EAAEO,SApCf;AAqCI,IAAA,gBAAgB,EAAEnB,gBArCtB;AAsCI,IAAA,gBAAgB,EAAEiB;AAtCtB,MAwCKtB,QAxCL,CADJ;AA4CH,CAnF8F;AAoF/FkD,oBAAoB,CAACb,WAArB,GAAmClD,gBAAnC;AACA+D,oBAAoB,CAAChD,SAArB,GAAiCd,WAAjC;AACA8D,oBAAoB,CAACZ,YAArB,GAAoChD,eAApC;;;;"}
1
+ {"version":3,"file":"AutocompleteMultiple.js","sources":["../../../src/components/autocomplete/Autocomplete.tsx","../../../src/components/autocomplete/AutocompleteMultiple.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode, RefObject, SyntheticEvent, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Dropdown, IconButtonProps, Offset, Placement, TextField, Theme } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useFocus } from '@lumx/react/hooks/useFocus';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteProps extends GenericProps {\n /**\n * Whether the suggestions list should display anchored to the input or to the wrapper.\n * @see {@link DropdownProps#anchorToInput}\n */\n anchorToInput?: boolean;\n /**\n * Props to pass to the clear button (minus those already set by the TextField props).\n * If not specified, the button won't be displayed.\n * @see {@link TextFieldProps#clearButtonProps}\n */\n clearButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /**\n * Reference to the <input> or <textarea> element.\n * @see {@link TextFieldProps#inputRef}\n */\n inputRef?: RefObject<HTMLInputElement>;\n /**\n * The offset that will be applied to the Dropdown position.\n * @see {@link DropdownProps#offset}\n */\n offset?: Offset;\n /**\n * The preferred Dropdown location against the anchor element.\n * @see {@link DropdownProps#placement}\n */\n placement?: Placement;\n /**\n * Whether the dropdown should fit to the anchor width or not.\n * @see {@link DropdownProps#fitToAnchorWidth}\n */\n fitToAnchorWidth?: boolean;\n /**\n * The error related to the component.\n * @see {@link TextFieldProps#error}\n */\n error?: string | ReactNode;\n /**\n * Whether the text field is displayed with error style or not.\n * @see {@link TextFieldProps#hasError}\n */\n hasError?: boolean;\n /**\n * Whether the text box should be focused upon closing the suggestions or not.\n */\n shouldFocusOnClose?: boolean;\n /**\n * The helper message of the text field.\n * @see {@link TextFieldProps#helper}\n */\n helper?: string;\n /**\n * The icon of the text field (SVG path).\n * @see {@link TextFieldProps#icon}\n */\n icon?: string;\n /**\n * Whether the component is disabled or not.\n * @see {@link TextFieldProps#isDisabled}\n */\n isDisabled?: boolean;\n /**\n * Whether the component is required or not.\n * @see {@link TextFieldProps#isRequired}\n */\n isRequired?: boolean;\n /**\n * Whether the text field is displayed with valid style or not.\n * @see {@link TextFieldProps#isValid}\n */\n isValid?: boolean;\n /**\n * The label of the text field displayed in a label tag.\n * @see {@link TextFieldProps#label}\n */\n label?: string;\n /**\n * The placeholder message of the text field.\n * @see {@link TextFieldProps#placeholder}\n */\n placeholder?: string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** List of suggestions to display during autocomplete. */\n children: React.ReactNode;\n /**\n * The list of chips to be displayed before the text field input.\n */\n chips?: React.ReactNode;\n /**\n * The value of the text field.\n * @see {@link TextFieldProps#value}\n */\n value: string;\n /**\n * Whether the suggestions from the autocomplete should be displayed or not.\n * @see {@link DropdownProps#isOpen}\n */\n isOpen: boolean;\n /**\n * The native input name property.\n * @see {@link TextFieldProps#name}\n */\n name?: string;\n /**\n * Whether a click in the Autocomplete dropdown would close it or not.\n * @see {@link DropdownProps#closeOnClick}\n */\n closeOnClick?: boolean;\n /**\n * Whether a click anywhere out of the Autocomplete would close it or not.\n * @see {@link DropdownProps#closeOnClickAway}\n */\n closeOnClickAway?: boolean;\n /**\n * Whether an escape key press would close the Autocomplete or not.\n * @see {@link DropdownProps#closeOnEscape}\n */\n closeOnEscape?: boolean;\n /**\n * The function called on blur.\n * @see {@link TextFieldProps#onBlur}\n */\n onBlur?(event: React.FocusEvent): void;\n /**\n * On change callback.\n * @see {@link TextFieldProps#onChange}\n */\n onChange(value: string, name?: string, event?: SyntheticEvent): void;\n /**\n * The function called on close.\n * @see {@link DropdownProps#onClose}\n */\n onClose?(): void;\n /**\n * The function called on focus.\n * @see {@link TextFieldProps#onFocus}\n */\n onFocus?(event: React.FocusEvent): void;\n /**\n * The function called when the bottom of the dropdown is reached.\n * @see {@link DropdownProps#onInfiniteScroll}\n */\n onInfiniteScroll?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Autocomplete';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AutocompleteProps> = {\n anchorToInput: false,\n closeOnClick: false,\n closeOnClickAway: true,\n closeOnEscape: true,\n shouldFocusOnClose: false,\n};\n\n/**\n * Autocomplete component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Autocomplete: Comp<AutocompleteProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n anchorToInput,\n children,\n chips,\n className,\n closeOnClick,\n closeOnClickAway,\n closeOnEscape,\n disabled,\n error,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isDisabled = disabled,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClose,\n onFocus,\n onInfiniteScroll,\n placeholder,\n placement,\n shouldFocusOnClose,\n theme,\n value,\n ...forwardedProps\n } = props;\n const inputAnchorRef = useRef<HTMLElement>(null);\n const textFieldRef = useRef(null);\n useFocus(inputAnchorRef.current, !isOpen && shouldFocusOnClose);\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n }),\n )}\n >\n <TextField\n chips={chips}\n error={error}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={mergeRefs(inputAnchorRef, inputRef) as any}\n clearButtonProps={clearButtonProps}\n isDisabled={isDisabled}\n isRequired={isRequired}\n isValid={isValid}\n label={label}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n onFocus={onFocus}\n placeholder={placeholder}\n textFieldRef={textFieldRef}\n theme={theme}\n value={value}\n />\n <Dropdown\n anchorRef={anchorToInput ? inputAnchorRef : textFieldRef}\n closeOnClick={closeOnClick}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n fitToAnchorWidth={fitToAnchorWidth}\n isOpen={isOpen}\n offset={offset}\n onClose={onClose}\n onInfiniteScroll={onInfiniteScroll}\n placement={placement}\n shouldFocusOnOpen={false}\n theme={theme}\n >\n {children}\n </Dropdown>\n </div>\n );\n});\nAutocomplete.displayName = COMPONENT_NAME;\nAutocomplete.className = CLASSNAME;\nAutocomplete.defaultProps = DEFAULT_PROPS;\n","import { mdiClose } from '@lumx/icons';\nimport { Autocomplete, AutocompleteProps, Chip, ChipGroup, HorizontalAlignment, Icon, Size } from '@lumx/react';\n\nimport { Comp, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface AutocompleteMultipleProps extends AutocompleteProps {\n /** Selected values. */\n values: any[];\n /** Alignment of the chips in the autocomplete. */\n chipsAlignment?: HorizontalAlignment;\n /** Selected value render function. Default: Renders the value inside of a Chip. */\n selectedChipRender(\n choice: any,\n index: number,\n onClear?: (event: React.MouseEvent, choice: any) => void,\n isDisabled?: boolean,\n ): ReactNode | string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'AutocompleteMultiple';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<AutocompleteMultipleProps> = {\n closeOnClickAway: true,\n closeOnEscape: true,\n selectedChipRender(choice, index, onClear, isDisabled) {\n const onClick = (event: React.MouseEvent) => onClear && onClear(event, choice);\n return (\n <Chip\n key={index}\n after={onClear && <Icon icon={mdiClose} size={Size.xxs} />}\n isDisabled={isDisabled}\n size={Size.s}\n onAfterClick={onClick}\n onClick={onClick}\n >\n {choice}\n </Chip>\n );\n },\n values: [],\n};\n\n/**\n * AutocompleteMultiple component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const AutocompleteMultiple: Comp<AutocompleteMultipleProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n anchorToInput,\n children,\n chipsAlignment,\n className,\n closeOnClickAway,\n closeOnEscape,\n fitToAnchorWidth,\n hasError,\n helper,\n icon,\n inputRef,\n clearButtonProps,\n isDisabled,\n isRequired,\n isOpen,\n isValid,\n label,\n name,\n offset,\n onBlur,\n onChange,\n onClear,\n onClose,\n onFocus,\n onInfiniteScroll,\n onKeyDown,\n placeholder,\n placement,\n selectedChipRender,\n shouldFocusOnClose,\n theme,\n type,\n value,\n values,\n ...forwardedProps\n } = props;\n\n return (\n <Autocomplete\n ref={ref}\n {...forwardedProps}\n anchorToInput={anchorToInput}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n }),\n )}\n name={name}\n value={value}\n onChange={onChange}\n onKeyDown={onKeyDown}\n onBlur={onBlur}\n shouldFocusOnClose={shouldFocusOnClose}\n onFocus={onFocus}\n hasError={hasError}\n helper={helper}\n icon={icon}\n inputRef={inputRef}\n chips={values && values.map((chip: any, index: number) => selectedChipRender(chip, index, onClear))}\n isDisabled={isDisabled}\n isRequired={isRequired}\n clearButtonProps={clearButtonProps}\n isValid={isValid}\n label={label}\n placeholder={placeholder}\n theme={theme}\n type={type}\n isOpen={isOpen}\n closeOnClick={false}\n closeOnClickAway={closeOnClickAway}\n closeOnEscape={closeOnEscape}\n onClose={onClose}\n offset={offset}\n placement={placement}\n fitToAnchorWidth={fitToAnchorWidth}\n onInfiniteScroll={onInfiniteScroll}\n >\n {children}\n </Autocomplete>\n );\n});\nAutocompleteMultiple.displayName = COMPONENT_NAME;\nAutocompleteMultiple.className = CLASSNAME;\nAutocompleteMultiple.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","anchorToInput","closeOnClick","closeOnClickAway","closeOnEscape","shouldFocusOnClose","Autocomplete","forwardRef","props","ref","children","chips","className","disabled","error","fitToAnchorWidth","hasError","helper","icon","inputRef","clearButtonProps","isDisabled","isRequired","isOpen","isValid","label","name","offset","onBlur","onChange","onClose","onFocus","onInfiniteScroll","placeholder","placement","theme","value","forwardedProps","inputAnchorRef","useRef","textFieldRef","useFocus","current","classNames","handleBasicClasses","prefix","mergeRefs","displayName","defaultProps","selectedChipRender","choice","index","onClear","onClick","event","mdiClose","Size","xxs","s","values","AutocompleteMultiple","chipsAlignment","onKeyDown","type","map","chip"],"mappings":";;;;;;;;;;;AAWA;;;;AAsJA;;;AAGA,IAAMA,cAAc,GAAG,cAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAyC,GAAG;AAC9CC,EAAAA,aAAa,EAAE,KAD+B;AAE9CC,EAAAA,YAAY,EAAE,KAFg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QApBd;AAqBI,IAAA,KAAK,EAAEwC,MAAM,IAAIA,MAAM,CAACK,GAAP,CAAW,UAACC,IAAD,EAAYd,KAAZ;AAAA,aAA8BF,kBAAkB,CAACgB,IAAD,EAAOd,KAAP,EAAcC,OAAd,CAAhD;AAAA,KAAX,CArBrB;AAsBI,IAAA,UAAU,EAAE/B,UAtBhB;AAuBI,IAAA,UAAU,EAAEC,UAvBhB;AAwBI,IAAA,gBAAgB,EAAEF,gBAxBtB;AAyBI,IAAA,OAAO,EAAEI,OAzBb;AA0BI,IAAA,KAAK,EAAEC,KA1BX;AA2BI,IAAA,WAAW,EAAEQ,WA3BjB;AA4BI,IAAA,KAAK,EAAEE,KA5BX;AA6BI,IAAA,IAAI,EAAE4B,IA7BV;AA8BI,IAAA,MAAM,EAAExC,MA9BZ;AA+BI,IAAA,YAAY,EAAE,KA/BlB;AAgCI,IAAA,gBAAgB,EAAEpB,gBAhCtB;AAiCI,IAAA,aAAa,EAAEC,aAjCnB;AAkCI,IAAA,OAAO,EAAE0B,OAlCb;AAmCI,IAAA,MAAM,EAAEH,MAnCZ;AAoCI,IAAA,SAAS,EAAEO,SApCf;AAqCI,IAAA,gBAAgB,EAAEnB,gBArCtB;AAsCI,IAAA,gBAAgB,EAAEiB;AAtCtB,MAwCKtB,QAxCL,CADJ;AA4CH,CAnF8F;AAoF/FkD,oBAAoB,CAACb,WAArB,GAAmClD,gBAAnC;AACA+D,oBAAoB,CAAChD,SAArB,GAAiCd,WAAjC;AACA8D,oBAAoB,CAACZ,YAArB,GAAoChD,eAApC;;;;"}
@@ -2,9 +2,9 @@ import { b as _objectWithoutProperties, c as _extends, _ as _objectSpread2 } fro
2
2
  import { Emphasis, Size, Theme } from './components.js';
3
3
  import React, { forwardRef } from 'react';
4
4
  import { g as getRootClassName, c as classnames, a as getBasicClass } from './getRootClassName.js';
5
+ import { I as Icon } from './Icon2.js';
5
6
  import isEmpty from 'lodash/isEmpty';
6
7
  import { B as ButtonRoot } from './ButtonRoot.js';
7
- import { I as Icon } from './Icon2.js';
8
8
 
9
9
  /**
10
10
  * Button emphasis definition.
@@ -1,6 +1,10 @@
1
1
  import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
2
2
  import React, { forwardRef } from 'react';
3
3
  import { g as getRootClassName, c as classnames } from './getRootClassName.js';
4
+ import 'lodash/isBoolean';
5
+ import 'lodash/isEmpty';
6
+ import 'lodash/kebabCase';
7
+ import 'lodash/noop';
4
8
 
5
9
  /**
6
10
  * Defines the props of the component
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.js","sources":["../../../src/components/button/ButtonGroup.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Comp, GenericProps, getRootClassName } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component\n */\nexport type ButtonGroupProps = GenericProps;\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ButtonGroup';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ButtonGroupProps> = {};\n\n/**\n * ButtonGroup component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ButtonGroup: Comp<ButtonGroupProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, ...forwardedProps } = props;\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>\n {children}\n </div>\n );\n});\nButtonGroup.displayName = COMPONENT_NAME;\nButtonGroup.className = CLASSNAME;\nButtonGroup.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","ButtonGroup","forwardRef","props","ref","children","className","forwardedProps","classNames","displayName","defaultProps"],"mappings":";;;;AAMA;;;;AAKA;;;AAGA,IAAMA,cAAc,GAAG,aAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAwC,GAAG,EAAjD;AAEA;;;;;;;;IAOaC,WAAmD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAClFC,QADkF,GACvCF,KADuC,CAClFE,QADkF;AAAA,MACxEC,SADwE,GACvCH,KADuC,CACxEG,SADwE;AAAA,MAC1DC,cAD0D,4BACvCJ,KADuC;;AAG1F,SACI;AAAK,IAAA,GAAG,EAAEC;AAAV,KAAmBG,cAAnB;AAAmC,IAAA,SAAS,EAAEC,UAAU,CAACF,SAAD,EAAYR,SAAZ;AAAxD,MACKO,QADL,CADJ;AAKH,CAR4E;AAS7EJ,WAAW,CAACQ,WAAZ,GAA0BZ,cAA1B;AACAI,WAAW,CAACK,SAAZ,GAAwBR,SAAxB;AACAG,WAAW,CAACS,YAAZ,GAA2BV,aAA3B;;;;"}
1
+ {"version":3,"file":"ButtonGroup.js","sources":["../../../src/components/button/ButtonGroup.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Comp, GenericProps, getRootClassName } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component\n */\nexport type ButtonGroupProps = GenericProps;\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ButtonGroup';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ButtonGroupProps> = {};\n\n/**\n * ButtonGroup component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ButtonGroup: Comp<ButtonGroupProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, ...forwardedProps } = props;\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, CLASSNAME)}>\n {children}\n </div>\n );\n});\nButtonGroup.displayName = COMPONENT_NAME;\nButtonGroup.className = CLASSNAME;\nButtonGroup.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","ButtonGroup","forwardRef","props","ref","children","className","forwardedProps","classNames","displayName","defaultProps"],"mappings":";;;;;;;;AAMA;;;;AAKA;;;AAGA,IAAMA,cAAc,GAAG,aAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAwC,GAAG,EAAjD;AAEA;;;;;;;;IAOaC,WAAmD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAClFC,QADkF,GACvCF,KADuC,CAClFE,QADkF;AAAA,MACxEC,SADwE,GACvCH,KADuC,CACxEG,SADwE;AAAA,MAC1DC,cAD0D,4BACvCJ,KADuC;;AAG1F,SACI;AAAK,IAAA,GAAG,EAAEC;AAAV,KAAmBG,cAAnB;AAAmC,IAAA,SAAS,EAAEC,UAAU,CAACF,SAAD,EAAYR,SAAZ;AAAxD,MACKO,QADL,CADJ;AAKH,CAR4E;AAS7EJ,WAAW,CAACQ,WAAZ,GAA0BZ,cAA1B;AACAI,WAAW,CAACK,SAAZ,GAAwBR,SAAxB;AACAG,WAAW,CAACS,YAAZ,GAA2BV,aAA3B;;;;"}
@@ -2,9 +2,8 @@ import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBab
2
2
  import { Theme } from './components.js';
3
3
  import React, { forwardRef, useMemo } from 'react';
4
4
  import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
- import { e as mdiCheck } from './mdi.js';
6
- import { u as uid } from './index.js';
7
- import { I as Icon } from './Icon2.js';
5
+ import { I as Icon, e as mdiCheck } from './Icon2.js';
6
+ import { u as uid } from '../index2.js';
8
7
  import { I as InputHelper } from './InputHelper.js';
9
8
  import { I as InputLabel } from './InputLabel.js';
10
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox2.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, SyntheticEvent, InputHTMLAttributes } from 'react';\n\nimport classNames from 'classnames';\nimport { uid } from 'uid';\n\nimport { mdiCheck } from '@lumx/icons';\n\nimport { Icon, InputHelper, InputLabel, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface CheckboxProps extends GenericProps {\n /** Helper text. */\n helper?: string;\n /** Native input id property. */\n id?: string;\n /** Whether it is checked or not. */\n isChecked?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Label text. */\n label?: ReactNode;\n /** Native input name property. */\n name?: string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Native input value property. */\n value?: string;\n /** On change callback. */\n onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;\n /** optional props for input */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Checkbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CheckboxProps> = {\n theme: Theme.light,\n};\n\n/**\n * Checkbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n checked,\n className,\n disabled,\n helper,\n id,\n isChecked = checked,\n isDisabled = disabled,\n label,\n name,\n onChange,\n theme,\n value,\n inputProps = {},\n ...forwardedProps\n } = props;\n const inputId = useMemo(() => id || `${CLASSNAME.toLowerCase()}-${uid()}`, [id]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(!isChecked, value, name, event);\n }\n };\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n isChecked,\n isDisabled,\n isUnchecked: !isChecked,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__input-wrapper`}>\n <input\n type=\"checkbox\"\n id={inputId}\n className={`${CLASSNAME}__input-native`}\n tabIndex={isDisabled ? -1 : 0}\n name={name}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n {...inputProps}\n />\n\n <div className={`${CLASSNAME}__input-placeholder`}>\n <div className={`${CLASSNAME}__input-background`} />\n\n <div className={`${CLASSNAME}__input-indicator`}>\n <Icon icon={mdiCheck} />\n </div>\n </div>\n </div>\n\n <div className={`${CLASSNAME}__content`}>\n {label && (\n <InputLabel htmlFor={inputId} className={`${CLASSNAME}__label`} theme={theme}>\n {label}\n </InputLabel>\n )}\n {helper && (\n <InputHelper className={`${CLASSNAME}__helper`} theme={theme}>\n {helper}\n </InputHelper>\n )}\n </div>\n </div>\n );\n});\nCheckbox.displayName = COMPONENT_NAME;\nCheckbox.className = CLASSNAME;\nCheckbox.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","Checkbox","forwardRef","props","ref","checked","className","disabled","helper","id","isChecked","isDisabled","label","name","onChange","value","inputProps","forwardedProps","inputId","useMemo","toLowerCase","uid","handleChange","event","classNames","handleBasicClasses","isUnchecked","prefix","mdiCheck","displayName","defaultProps"],"mappings":";;;;;;;;;;AAUA;;;;AA0BA;;;AAGA,IAAMA,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAqC,GAAG;AAC1CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD6B,CAA9C;AAIA;;;;;;;;IAOaC,QAA6C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAEhFC,OAFgF,GAgBhFF,KAhBgF,CAEhFE,OAFgF;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B,YAAT,GAAwBjC,aAAxB;;;;"}
1
+ {"version":3,"file":"Checkbox2.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useMemo, forwardRef, ReactNode, SyntheticEvent, InputHTMLAttributes } from 'react';\n\nimport classNames from 'classnames';\nimport { uid } from 'uid';\n\nimport { mdiCheck } from '@lumx/icons';\n\nimport { Icon, InputHelper, InputLabel, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface CheckboxProps extends GenericProps {\n /** Helper text. */\n helper?: string;\n /** Native input id property. */\n id?: string;\n /** Whether it is checked or not. */\n isChecked?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Label text. */\n label?: ReactNode;\n /** Native input name property. */\n name?: string;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** Native input value property. */\n value?: string;\n /** On change callback. */\n onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;\n /** optional props for input */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Checkbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CheckboxProps> = {\n theme: Theme.light,\n};\n\n/**\n * Checkbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Checkbox: Comp<CheckboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n checked,\n className,\n disabled,\n helper,\n id,\n isChecked = checked,\n isDisabled = disabled,\n label,\n name,\n onChange,\n theme,\n value,\n inputProps = {},\n ...forwardedProps\n } = props;\n const inputId = useMemo(() => id || `${CLASSNAME.toLowerCase()}-${uid()}`, [id]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n onChange(!isChecked, value, name, event);\n }\n };\n\n return (\n <div\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n isChecked,\n isDisabled,\n isUnchecked: !isChecked,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n >\n <div className={`${CLASSNAME}__input-wrapper`}>\n <input\n type=\"checkbox\"\n id={inputId}\n className={`${CLASSNAME}__input-native`}\n tabIndex={isDisabled ? -1 : 0}\n name={name}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n {...inputProps}\n />\n\n <div className={`${CLASSNAME}__input-placeholder`}>\n <div className={`${CLASSNAME}__input-background`} />\n\n <div className={`${CLASSNAME}__input-indicator`}>\n <Icon icon={mdiCheck} />\n </div>\n </div>\n </div>\n\n <div className={`${CLASSNAME}__content`}>\n {label && (\n <InputLabel htmlFor={inputId} className={`${CLASSNAME}__label`} theme={theme}>\n {label}\n </InputLabel>\n )}\n {helper && (\n <InputHelper className={`${CLASSNAME}__helper`} theme={theme}>\n {helper}\n </InputHelper>\n )}\n </div>\n </div>\n );\n});\nCheckbox.displayName = COMPONENT_NAME;\nCheckbox.className = CLASSNAME;\nCheckbox.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","Checkbox","forwardRef","props","ref","checked","className","disabled","helper","id","isChecked","isDisabled","label","name","onChange","value","inputProps","forwardedProps","inputId","useMemo","toLowerCase","uid","handleChange","event","classNames","handleBasicClasses","isUnchecked","prefix","mdiCheck","displayName","defaultProps"],"mappings":";;;;;;;;;AAUA;;;;AA0BA;;;AAGA,IAAMA,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAqC,GAAG;AAC1CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD6B,CAA9C;AAIA;;;;;;;;IAOaC,QAA6C,GAAGC,UAAU,CAAC,UAACC,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WAAT,GAAuBnC,cAAvB;AACAO,QAAQ,CAACK,SAAT,GAAqBX,SAArB;AACAM,QAAQ,CAAC6B,YAAT,GAAwBjC,aAAxB;;;;"}
@@ -1,8 +1,7 @@
1
1
  import { b as _objectWithoutProperties, c as _extends, a as _defineProperty } from './_rollupPluginBabelHelpers.js';
2
2
  import { Size, Theme, ColorPalette } from './components.js';
3
3
  import React, { useCallback, forwardRef } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
- import { o as onEnterPressed } from './onEnterPressed.js';
4
+ import { g as getRootClassName, c as classnames, h as handleBasicClasses, o as onEnterPressed } from './getRootClassName.js';
6
5
  import isFunction from 'lodash/isFunction';
7
6
 
8
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Chip2.js","sources":["../../../src/_internal/hooks/useStopPropagation.ts","../../../src/components/chip/Chip.tsx"],"sourcesContent":["import isFunction from 'lodash/isFunction';\nimport { MouseEventHandler, useCallback } from 'react';\n\n/**\n * Wrap mouse event handler to stop event propagation.\n *\n * @param handler The mouse handler to wrap.\n * @return Mouse handler stopping propagation.\n */\nexport function useStopPropagation(handler?: MouseEventHandler): MouseEventHandler {\n return useCallback(\n (evt) => {\n if (!evt || !isFunction(handler)) {\n return;\n }\n handler(evt);\n evt.stopPropagation();\n },\n [handler],\n );\n}\n","import { Color, ColorPalette, Size, Theme } from '@lumx/react';\nimport { useStopPropagation } from '@lumx/react/_internal/hooks/useStopPropagation';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, onEnterPressed } from '@lumx/react/utils';\n\nimport classNames from 'classnames';\n\nimport isFunction from 'lodash/isFunction';\nimport React, { forwardRef, MouseEventHandler, ReactNode } from 'react';\n\n/**\n * Chip sizes.\n */\ntype ChipSize = Extract<Size, 's' | 'm'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ChipProps extends GenericProps {\n /** A component to be rendered after the content. */\n after?: ReactNode;\n /** A component to be rendered before the content. */\n before?: ReactNode;\n /** Color variant. */\n color?: Color;\n /** Whether the component is clickable or not. */\n isClickable?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the chip is currently in a highlighted state or not. */\n isHighlighted?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Size variant. */\n size?: ChipSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On \"after\" element clicked callback. */\n onAfterClick?: MouseEventHandler;\n /** On \"before\" element clicked callback. */\n onBeforeClick?: MouseEventHandler;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Chip';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ChipProps> = {\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * Chip component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Chip: Comp<ChipProps, HTMLAnchorElement> = forwardRef((props, ref) => {\n const {\n after,\n before,\n children,\n className,\n color,\n disabled,\n isClickable,\n isDisabled = disabled,\n isHighlighted,\n isSelected,\n onAfterClick,\n onBeforeClick,\n onClick,\n size,\n theme,\n ...forwardedProps\n } = props;\n const hasAfterClick = isFunction(onAfterClick);\n const hasBeforeClick = isFunction(onBeforeClick);\n const hasOnClick = isFunction(onClick);\n\n // Adapt color to the theme.\n const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);\n\n const handleOnBeforeClick = useStopPropagation(onBeforeClick);\n const handleOnAfterClick = useStopPropagation(onAfterClick);\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <a\n {...forwardedProps}\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n clickable: Boolean(hasOnClick) || isClickable,\n color: chipColor,\n isDisabled,\n hasAfter: Boolean(after),\n hasBefore: Boolean(before),\n highlighted: Boolean(isHighlighted),\n prefix: CLASSNAME,\n selected: Boolean(isSelected),\n size,\n unselected: Boolean(!isSelected),\n }),\n )}\n role={hasOnClick ? 'button' : undefined}\n tabIndex={isDisabled || !hasOnClick ? -1 : 0}\n aria-disabled={(hasOnClick && isDisabled) || undefined}\n onClick={hasOnClick ? onClick : undefined}\n onKeyDown={hasOnClick ? onEnterPressed(onClick) : undefined}\n >\n {before && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div\n className={classNames(`${CLASSNAME}__before`, {\n [`${CLASSNAME}__before--is-clickable`]: hasBeforeClick,\n })}\n onClick={handleOnBeforeClick}\n >\n {before}\n </div>\n )}\n\n <div className={`${CLASSNAME}__label`}>{children}</div>\n\n {after && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div\n className={classNames(`${CLASSNAME}__after`, {\n [`${CLASSNAME}__after--is-clickable`]: hasAfterClick,\n })}\n onClick={handleOnAfterClick}\n >\n {after}\n </div>\n )}\n </a>\n );\n});\nChip.displayName = COMPONENT_NAME;\nChip.className = CLASSNAME;\nChip.defaultProps = DEFAULT_PROPS;\n"],"names":["useStopPropagation","handler","useCallback","evt","isFunction","stopPropagation","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","m","theme","Theme","light","Chip","forwardRef","props","ref","after","before","children","className","color","disabled","isClickable","isDisabled","isHighlighted","isSelected","onAfterClick","onBeforeClick","onClick","forwardedProps","hasAfterClick","hasBeforeClick","hasOnClick","chipColor","ColorPalette","dark","handleOnBeforeClick","handleOnAfterClick","classNames","handleBasicClasses","clickable","Boolean","hasAfter","hasBefore","highlighted","prefix","selected","unselected","undefined","onEnterPressed","displayName","defaultProps"],"mappings":";;;;;;;AAGA;;;;;;;AAMO,SAASA,kBAAT,CAA4BC,OAA5B,EAA4E;AAC/E,SAAOC,WAAW,CACd,UAACC,GAAD,EAAS;AACL,QAAI,CAACA,GAAD,IAAQ,CAACC,UAAU,CAACH,OAAD,CAAvB,EAAkC;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AI,EAAEO,UAAU,GAAG,QAAH,GAAcgB,SAlBlC;AAmBI,MAAA,QAAQ,EAAEzB,UAAU,IAAI,CAACS,UAAf,GAA4B,CAAC,CAA7B,GAAiC,CAnB/C;AAoBI,uBAAgBA,UAAU,IAAIT,UAAf,IAA8ByB,SApBjD;AAqBI,MAAA,OAAO,EAAEhB,UAAU,GAAGJ,OAAH,GAAaoB,SArBpC;AAsBI,MAAA,SAAS,EAAEhB,UAAU,GAAGiB,cAAc,CAACrB,OAAD,CAAjB,GAA6BoB;AAtBtD,QAwBK/B,MAAM;AAEH;AACI,MAAA,SAAS,EAAEqB,UAAU,WAAInC,SAAJ,6CACbA,SADa,6BACuB4B,cADvB,EADzB;AAII,MAAA,OAAO,EAAEK;AAJb,OAMKnB,MANL,CA1BR,EAoCI;AAAK,MAAA,SAAS,YAAKd,SAAL;AAAd,OAAwCe,QAAxC,CApCJ,EAsCKF,KAAK;AAEF;AACI,MAAA,SAAS,EAAEsB,UAAU,WAAInC,SAAJ,4CACbA,SADa,4BACsB2B,aADtB,EADzB;AAII,MAAA,OAAO,EAAEO;AAJb,OAMKrB,KANL,CAxCR;AAFJ;AAqDH,CAlFiE;AAmFlEJ,IAAI,CAACsC,WAAL,GAAmBhD,cAAnB;AACAU,IAAI,CAACO,SAAL,GAAiBhB,SAAjB;AACAS,IAAI,CAACuC,YAAL,GAAoB9C,aAApB;;;;"}
1
+ {"version":3,"file":"Chip2.js","sources":["../../../src/hooks/useStopPropagation.ts","../../../src/components/chip/Chip.tsx"],"sourcesContent":["import isFunction from 'lodash/isFunction';\nimport { MouseEventHandler, useCallback } from 'react';\n\n/**\n * Wrap mouse event handler to stop event propagation.\n *\n * @param handler The mouse handler to wrap.\n * @return Mouse handler stopping propagation.\n */\nexport function useStopPropagation(handler?: MouseEventHandler): MouseEventHandler {\n return useCallback(\n (evt) => {\n if (!evt || !isFunction(handler)) {\n return;\n }\n handler(evt);\n evt.stopPropagation();\n },\n [handler],\n );\n}\n","import { Color, ColorPalette, Size, Theme } from '@lumx/react';\nimport { useStopPropagation } from '@lumx/react/hooks/useStopPropagation';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, onEnterPressed } from '@lumx/react/utils';\n\nimport classNames from 'classnames';\n\nimport isFunction from 'lodash/isFunction';\nimport React, { forwardRef, MouseEventHandler, ReactNode } from 'react';\n\n/**\n * Chip sizes.\n */\ntype ChipSize = Extract<Size, 's' | 'm'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ChipProps extends GenericProps {\n /** A component to be rendered after the content. */\n after?: ReactNode;\n /** A component to be rendered before the content. */\n before?: ReactNode;\n /** Color variant. */\n color?: Color;\n /** Whether the component is clickable or not. */\n isClickable?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the chip is currently in a highlighted state or not. */\n isHighlighted?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Size variant. */\n size?: ChipSize;\n /** Theme adapting the component to light or dark background. */\n theme?: Theme;\n /** On \"after\" element clicked callback. */\n onAfterClick?: MouseEventHandler;\n /** On \"before\" element clicked callback. */\n onBeforeClick?: MouseEventHandler;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Chip';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ChipProps> = {\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * Chip component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Chip: Comp<ChipProps, HTMLAnchorElement> = forwardRef((props, ref) => {\n const {\n after,\n before,\n children,\n className,\n color,\n disabled,\n isClickable,\n isDisabled = disabled,\n isHighlighted,\n isSelected,\n onAfterClick,\n onBeforeClick,\n onClick,\n size,\n theme,\n ...forwardedProps\n } = props;\n const hasAfterClick = isFunction(onAfterClick);\n const hasBeforeClick = isFunction(onBeforeClick);\n const hasOnClick = isFunction(onClick);\n\n // Adapt color to the theme.\n const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);\n\n const handleOnBeforeClick = useStopPropagation(onBeforeClick);\n const handleOnAfterClick = useStopPropagation(onAfterClick);\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <a\n {...forwardedProps}\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n clickable: Boolean(hasOnClick) || isClickable,\n color: chipColor,\n isDisabled,\n hasAfter: Boolean(after),\n hasBefore: Boolean(before),\n highlighted: Boolean(isHighlighted),\n prefix: CLASSNAME,\n selected: Boolean(isSelected),\n size,\n unselected: Boolean(!isSelected),\n }),\n )}\n role={hasOnClick ? 'button' : undefined}\n tabIndex={isDisabled || !hasOnClick ? -1 : 0}\n aria-disabled={(hasOnClick && isDisabled) || undefined}\n onClick={hasOnClick ? onClick : undefined}\n onKeyDown={hasOnClick ? onEnterPressed(onClick) : undefined}\n >\n {before && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div\n className={classNames(`${CLASSNAME}__before`, {\n [`${CLASSNAME}__before--is-clickable`]: hasBeforeClick,\n })}\n onClick={handleOnBeforeClick}\n >\n {before}\n </div>\n )}\n\n <div className={`${CLASSNAME}__label`}>{children}</div>\n\n {after && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div\n className={classNames(`${CLASSNAME}__after`, {\n [`${CLASSNAME}__after--is-clickable`]: hasAfterClick,\n })}\n onClick={handleOnAfterClick}\n >\n {after}\n </div>\n )}\n </a>\n );\n});\nChip.displayName = COMPONENT_NAME;\nChip.className = CLASSNAME;\nChip.defaultProps = DEFAULT_PROPS;\n"],"names":["useStopPropagation","handler","useCallback","evt","isFunction","stopPropagation","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","m","theme","Theme","light","Chip","forwardRef","props","ref","after","before","children","className","color","disabled","isClickable","isDisabled","isHighlighted","isSelected","onAfterClick","onBeforeClick","onClick","forwardedProps","hasAfterClick","hasBeforeClick","hasOnClick","chipColor","ColorPalette","dark","handleOnBeforeClick","handleOnAfterClick","classNames","handleBasicClasses","clickable","Boolean","hasAfter","hasBefore","highlighted","prefix","selected","unselected","undefined","onEnterPressed","displayName","defaultProps"],"mappings":";;;;;;AAGA;;;;;;;AAMO,SAASA,kBAAT,CAA4BC,OAA5B,EAA4E;AAC/E,SAAOC,WAAW,CACd,UAACC,GAAD,EAAS;AACL,QAAI,CAACA,GAAD,IAAQ,CAACC,UAAU,CAACH,OAAD,CAAvB,EAAkC;AAC9B;AACH;;AACDA,IAAAA,OAAO,CAACE,GAAD,CAAP;AACAA,IAAAA,GAAG,CAACE,eAAJ;AACH,GAPa,EAQd,CAACJ,OAAD,CARc,CAAlB;AAUH;;ACVD;;;;AAiCA;;;AAGA,IAAMK,cAAc,GAAG,MAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAiC,GAAG;AACtCC,EAAAA,IAAI,EAAEC,IAAI,CAACC,CAD2B;AAEtCC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAFyB,CAA1C;AAKA;;;;;;;;IAOaC,IAAwC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAE3EC,KAF2E,GAkB3EF,KAlB2E,CAE3EE,KAF2E;AAAA,MAG3EC,MAH2E,GAkB3EH,KAlB2E,CAG3EG,MAH2E;AAAA,MAI3EC,QAJ2E,GAkB3EJ,KAlB2E,CAI3EI,QAJ2E;AAAA,MAK3EC,SAL2E,GAkB3EL,KAlB2E,CAK3EK,SAL2E;AAAA,MAM3EC,KAN2E,GAkB3EN,KAlB2E,CAM3EM,KAN2E;AAAA,MAO3EC,QAP2E,GAkB3EP,KAlB2E,CAO3EO,QAP2E;AAAA,MAQ3EC,WAR2E,GAkB3ER,KAlB2E,CAQ3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9C,aAApB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChipGroup.js","sources":["../../../src/_internal/hooks/useChipGroupNavigation.tsx","../../../src/components/chip/ChipGroup.tsx"],"sourcesContent":["import { useState } from 'react';\n\ninterface UseChipGroupNavigation {\n /** the current active chip index */\n activeChip: number;\n\n /** callback to be executed when the backspace was pressed */\n onBackspacePressed(): void;\n\n /** function that allows to reset the navigation */\n resetChipNavigation(): void;\n}\n\nexport type useChipGroupNavigationType<C = any> = (\n chips: C[],\n onChipDeleted: (chip: C) => void,\n initialActiveChip?: number,\n) => UseChipGroupNavigation;\n\nconst INITIAL_STATE_ACTIVE_CHIP = -1;\n\n/**\n * Hook that provides the necessary information to manage chips navigation.\n * @param chips List of chips selected.\n * @param onChipDeleted Callback executed when a chip must be eliminated.\n * @param initialActiveChip Initial active chip index.\n *\n * @return chip navigation tools.\n */\nexport const useChipGroupNavigation: useChipGroupNavigationType = (\n chips,\n onChipDeleted,\n initialActiveChip = INITIAL_STATE_ACTIVE_CHIP,\n) => {\n const [wasBackspacePressed, setWasBackspacePressed] = useState(false);\n const [activeChip, setActiveChip] = useState(initialActiveChip);\n\n /**\n * Resets the active index and backspace control to their initial state\n */\n const resetChipNavigation = () => {\n setWasBackspacePressed(false);\n setActiveChip(initialActiveChip);\n };\n\n /**\n * Callback to be executed when the backspace was pressed. If there are no chips\n * selected, it will return immediately. If there are it will check if the\n * backspace was already pressed. if it was, it means that the user wants to eliminate\n * the chip, so we execute the `onChipDeleted` function and reset internal state.\n *\n * If it was not pressed before, we set the `wasBackspacePressed` flag to true and\n * highlight the last chip.\n */\n const onBackspacePressed = () => {\n if (chips.length === 0) {\n return;\n }\n\n if (wasBackspacePressed) {\n const chipDeleted: any = chips[chips.length - 1];\n onChipDeleted(chipDeleted);\n resetChipNavigation();\n } else {\n setActiveChip(chips.length - 1);\n setWasBackspacePressed(true);\n }\n };\n\n return {\n activeChip,\n onBackspacePressed,\n resetChipNavigation,\n };\n};\n","import { Alignment, HorizontalAlignment } from '@lumx/react/components';\nimport React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useChipGroupNavigation } from '@lumx/react/_internal/hooks/useChipGroupNavigation';\n\n/**\n * Defines the props of the component.\n */\nexport interface ChipGroupProps extends GenericProps {\n /** Chip horizontal alignment. */\n align?: HorizontalAlignment;\n /** List of Chip. */\n children: ReactNode;\n}\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ChipGroupProps> = {\n align: Alignment.left,\n};\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ChipGroup';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * ChipGroup component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nconst InternalChipGroup: Comp<ChipGroupProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { align, children, className, ...forwardedProps } = props;\n const chipGroupClassName = handleBasicClasses({\n align,\n prefix: CLASSNAME,\n });\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, chipGroupClassName)}>\n {children}\n </div>\n );\n});\nInternalChipGroup.displayName = COMPONENT_NAME;\nInternalChipGroup.className = CLASSNAME;\nInternalChipGroup.defaultProps = DEFAULT_PROPS;\n\nexport const ChipGroup = Object.assign(InternalChipGroup, { useChipGroupNavigation });\n"],"names":["INITIAL_STATE_ACTIVE_CHIP","useChipGroupNavigation","chips","onChipDeleted","initialActiveChip","useState","wasBackspacePressed","setWasBackspacePressed","activeChip","setActiveChip","resetChipNavigation","onBackspacePressed","length","chipDeleted","DEFAULT_PROPS","align","Alignment","left","COMPONENT_NAME","CLASSNAME","getRootClassName","InternalChipGroup","forwardRef","props","ref","children","className","forwardedProps","chipGroupClassName","handleBasicClasses","prefix","classNames","displayName","defaultProps","ChipGroup","Object","assign"],"mappings":";;;;;AAmBA,IAAMA,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C,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;AAOA,IAAMG,iBAAuD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAC/ET,KAD+E,GAC7BQ,KAD6B,CAC/ER,KAD+E;AAAA,MACxEU,QADwE,GAC7BF,KAD6B,CACxEE,QADwE;AAAA,MAC9DC,SAD8D,GAC7BH,KAD6B,CAC9DG,SAD8D;AAAA,MAChDC,cADgD,4BAC7BJ,KAD6B;;AAEvF,MAAMK,kBAAkB,GAAGC,kBAAkB,CAAC;AAC1Cd,IAAAA,KAAK,EAALA,KAD0C;AAE1Ce,IAAAA,MAAM,EAAEX;AAFkC,GAAD,CAA7C;AAKA,SACI;AAAK,IAAA,GAAG,EAAEK;AAAV,KAAmBG,cAAnB;AAAmC,IAAA,SAAS,EAAEI,UAAU,CAACL,SAAD,EAAYE,kBAAZ;AAAxD,MACKH,QADL,CADJ;AAKH,CAZyE,CAA1E;AAaAJ,iBAAiB,CAACW,WAAlB,GAAgCd,cAAhC;AACAG,iBAAiB,CAACK,SAAlB,GAA8BP,SAA9B;AACAE,iBAAiB,CAACY,YAAlB,GAAiCnB,aAAjC;IAEaoB,SAAS,GAAGC,MAAM,CAACC,MAAP,CAAcf,iBAAd,EAAiC;AAAEpB,EAAAA,sBAAsB,EAAtBA;AAAF,CAAjC;;;;"}
1
+ {"version":3,"file":"ChipGroup.js","sources":["../../../src/hooks/useChipGroupNavigation.tsx","../../../src/components/chip/ChipGroup.tsx"],"sourcesContent":["import { useState } from 'react';\n\ninterface UseChipGroupNavigation {\n /** the current active chip index */\n activeChip: number;\n\n /** callback to be executed when the backspace was pressed */\n onBackspacePressed(): void;\n\n /** function that allows to reset the navigation */\n resetChipNavigation(): void;\n}\n\nexport type useChipGroupNavigationType<C = any> = (\n chips: C[],\n onChipDeleted: (chip: C) => void,\n initialActiveChip?: number,\n) => UseChipGroupNavigation;\n\nconst INITIAL_STATE_ACTIVE_CHIP = -1;\n\n/**\n * Hook that provides the necessary information to manage chips navigation.\n * @param chips List of chips selected.\n * @param onChipDeleted Callback executed when a chip must be eliminated.\n * @param initialActiveChip Initial active chip index.\n *\n * @return chip navigation tools.\n */\nexport const useChipGroupNavigation: useChipGroupNavigationType = (\n chips,\n onChipDeleted,\n initialActiveChip = INITIAL_STATE_ACTIVE_CHIP,\n) => {\n const [wasBackspacePressed, setWasBackspacePressed] = useState(false);\n const [activeChip, setActiveChip] = useState(initialActiveChip);\n\n /**\n * Resets the active index and backspace control to their initial state\n */\n const resetChipNavigation = () => {\n setWasBackspacePressed(false);\n setActiveChip(initialActiveChip);\n };\n\n /**\n * Callback to be executed when the backspace was pressed. If there are no chips\n * selected, it will return immediately. If there are it will check if the\n * backspace was already pressed. if it was, it means that the user wants to eliminate\n * the chip, so we execute the `onChipDeleted` function and reset internal state.\n *\n * If it was not pressed before, we set the `wasBackspacePressed` flag to true and\n * highlight the last chip.\n */\n const onBackspacePressed = () => {\n if (chips.length === 0) {\n return;\n }\n\n if (wasBackspacePressed) {\n const chipDeleted: any = chips[chips.length - 1];\n onChipDeleted(chipDeleted);\n resetChipNavigation();\n } else {\n setActiveChip(chips.length - 1);\n setWasBackspacePressed(true);\n }\n };\n\n return {\n activeChip,\n onBackspacePressed,\n resetChipNavigation,\n };\n};\n","import { Alignment, HorizontalAlignment } from '@lumx/react/components';\nimport React, { forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\n\nimport { useChipGroupNavigation } from '@lumx/react/hooks/useChipGroupNavigation';\n\n/**\n * Defines the props of the component.\n */\nexport interface ChipGroupProps extends GenericProps {\n /** Chip horizontal alignment. */\n align?: HorizontalAlignment;\n /** List of Chip. */\n children: ReactNode;\n}\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ChipGroupProps> = {\n align: Alignment.left,\n};\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ChipGroup';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * ChipGroup component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nconst InternalChipGroup: Comp<ChipGroupProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { align, children, className, ...forwardedProps } = props;\n const chipGroupClassName = handleBasicClasses({\n align,\n prefix: CLASSNAME,\n });\n\n return (\n <div ref={ref} {...forwardedProps} className={classNames(className, chipGroupClassName)}>\n {children}\n </div>\n );\n});\nInternalChipGroup.displayName = COMPONENT_NAME;\nInternalChipGroup.className = CLASSNAME;\nInternalChipGroup.defaultProps = DEFAULT_PROPS;\n\nexport const ChipGroup = Object.assign(InternalChipGroup, { useChipGroupNavigation });\n"],"names":["INITIAL_STATE_ACTIVE_CHIP","useChipGroupNavigation","chips","onChipDeleted","initialActiveChip","useState","wasBackspacePressed","setWasBackspacePressed","activeChip","setActiveChip","resetChipNavigation","onBackspacePressed","length","chipDeleted","DEFAULT_PROPS","align","Alignment","left","COMPONENT_NAME","CLASSNAME","getRootClassName","InternalChipGroup","forwardRef","props","ref","children","className","forwardedProps","chipGroupClassName","handleBasicClasses","prefix","classNames","displayName","defaultProps","ChipGroup","Object","assign"],"mappings":";;;;;AAmBA,IAAMA,yBAAyB,GAAG,CAAC,CAAnC;AAEA;;;;;;;;;AAQO,IAAMC,sBAAkD,GAAG,SAArDA,sBAAqD,CAC9DC,KAD8D,EAE9DC,aAF8D,EAI7D;AAAA,MADDC,iBACC,uEADmBJ,yBACnB;;AAAA,kBACqDK,QAAQ,CAAC,KAAD,CAD7D;AAAA;AAAA,MACMC,mBADN;AAAA,MAC2BC,sBAD3B;;AAAA,mBAEmCF,QAAQ,CAACD,iBAAD,CAF3C;AAAA;AAAA,MAEMI,UAFN;AAAA,MAEkBC,aAFlB;AAID;;;;;AAGA,MAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,GAAM;AAC9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AAE1Ce,IAAAA,MAAM,EAAEX;AAFkC,GAAD,CAA7C;AAKA,SACI;AAAK,IAAA,GAAG,EAAEK;AAAV,KAAmBG,cAAnB;AAAmC,IAAA,SAAS,EAAEI,UAAU,CAACL,SAAD,EAAYE,kBAAZ;AAAxD,MACKH,QADL,CADJ;AAKH,CAZyE,CAA1E;AAaAJ,iBAAiB,CAACW,WAAlB,GAAgCd,cAAhC;AACAG,iBAAiB,CAACK,SAAlB,GAA8BP,SAA9B;AACAE,iBAAiB,CAACY,YAAlB,GAAiCnB,aAAjC;IAEaoB,SAAS,GAAGC,MAAM,CAACC,MAAP,CAAcf,iBAAd,EAAiC;AAAEpB,EAAAA,sBAAsB,EAAtBA;AAAF,CAAjC;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { e as _toConsumableArray } from './_rollupPluginBabelHelpers.js';
2
2
  import React, { useEffect, createContext, useContext } from 'react';
3
+ import { f as onEscapePressed } from './getRootClassName.js';
3
4
  import isEmpty from 'lodash/isEmpty';
4
- import { o as onEscapePressed } from './onEscapePressed.js';
5
5
  import { D as DOCUMENT } from './constants.js';
6
6
  import pull from 'lodash/pull';
7
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"ClickAwayProvider.js","sources":["../../../src/_internal/hooks/useCallbackOnEscape.ts","../../../src/_internal/hooks/useClickAway.tsx","../../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx"],"sourcesContent":["import { DOCUMENT } from '@lumx/react/constants';\nimport { Callback, onEscapePressed } from '@lumx/react/utils';\nimport { useEffect } from 'react';\n\n/**\n * Triggers a callback when the escape key is pressed.\n *\n * @param callback Callback\n * @param closeOnEscape Disables the hook when false\n * @param rootElement Element on which to listen the escape key\n */\nexport function useCallbackOnEscape(\n callback: Callback | undefined,\n closeOnEscape = true,\n rootElement = DOCUMENT?.body,\n) {\n useEffect(() => {\n if (closeOnEscape && callback && rootElement) {\n const onKeyDown = onEscapePressed(callback);\n rootElement.addEventListener('keydown', onKeyDown);\n return () => rootElement.removeEventListener('keydown', onKeyDown);\n }\n return undefined;\n }, [callback, closeOnEscape, rootElement]);\n}\n","import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils';\n\nimport isEmpty from 'lodash/isEmpty';\n\nconst EVENT_TYPES = ['mousedown', 'touchstart'];\n\nfunction isClickAway(target: HTMLElement, refs: Array<RefObject<HTMLElement>>): boolean {\n // The target element is not contained in any of the listed element references.\n return !refs.some((e) => e?.current?.contains(target));\n}\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: EventListener | Falsy;\n /**\n * Elements from which we want to detect the click away.\n */\n refs: RefObject<Array<RefObject<HTMLElement>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, refs }: ClickAwayParameters): void {\n useEffect(() => {\n const { current: currentRefs } = refs;\n if (!callback || !currentRefs || isEmpty(currentRefs)) {\n return undefined;\n }\n const listener: EventListener = (evt) => {\n if (isClickAway(evt.target as HTMLElement, currentRefs)) {\n callback(evt);\n }\n };\n\n EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n }, [callback, refs]);\n}\n","import React, { createContext, useContext, useEffect } from 'react';\nimport pull from 'lodash/pull';\nimport { ClickAwayParameters, useClickAway } from '@lumx/react/_internal/hooks/useClickAway';\n\nconst ClickAwayAncestorContext = createContext<ClickAwayParameters['refs'] | null>(null);\n\n/**\n * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure\n * we take into account both the DOM tree and the React tree we trying to detect click away.\n *\n * @return the react component.\n */\nexport const ClickAwayProvider: React.FC<ClickAwayParameters> = ({ children, callback, refs }) => {\n const ancestorChildrenRefs = useContext(ClickAwayAncestorContext);\n\n useEffect(() => {\n const { current: currentRefs } = refs;\n const { current: currentAncestorChildrenRefs } = ancestorChildrenRefs || {};\n if (!currentAncestorChildrenRefs || !currentRefs) {\n return undefined;\n }\n // Push current refs to parent.\n currentAncestorChildrenRefs.push(...currentRefs);\n return () => {\n // Pull current refs from parent.\n pull(currentAncestorChildrenRefs, ...currentRefs);\n };\n }, [ancestorChildrenRefs, refs]);\n\n useClickAway({ callback, refs });\n return <ClickAwayAncestorContext.Provider value={refs}>{children}</ClickAwayAncestorContext.Provider>;\n};\nClickAwayProvider.displayName = 'ClickAwayProvider';\n"],"names":["useCallbackOnEscape","callback","closeOnEscape","rootElement","DOCUMENT","body","useEffect","onKeyDown","onEscapePressed","addEventListener","removeEventListener","undefined","EVENT_TYPES","isClickAway","target","refs","some","e","current","contains","useClickAway","currentRefs","isEmpty","listener","evt","forEach","evtType","document","ClickAwayAncestorContext","createContext","ClickAwayProvider","children","ancestorChildrenRefs","useContext","currentAncestorChildrenRefs","push","pull","displayName"],"mappings":";;;;;;;AAIA;;;;;;;;AAOO,SAASA,mBAAT,CACHC,QADG,EAIL;AAAA,MAFEC,aAEF,uEAFkB,IAElB;AAAA,MADEC,WACF,uEADgBC,QAChB,aADgBA,QAChB,uBADgBA,QAAQ,CAAEC,IAC1B;AACEC,EAAAA,SAAS,CAAC,YAAM;AACZ,QAAIJ,aAAa,IAAID,QAAjB,IAA6BE,WAAjC,EAA8C;AAC1C,UAAMI,SAAS,GAAGC,eAAe,CAACP,QAAD,CAAjC;AACAE,MAAAA,WAAW,CAACM,gBAAZ,CAA6B,SAA7B,EAAwCF,SAAxC;AACA,aAAO;AAAA,eAAMJ,WAAW,CAACO,mBAAZ,CAAgC,SAAhC,EAA2CH,SAA3C,CAAN;AAAA,OAAP;AACH;;AACD,WAAOI,SAAP;AACH,GAPQ,EAON,CAACV,QAAD,EAAWC,aAAX,EAA0BC,WAA1B,CAPM,CAAT;AAQH;;AClBD,IAAMS,WAAW,GAAG,CAAC,WAAD,EAAc,YAAd,CAApB;;AAEA,SAASC,WAAT,CAAqBC,MAArB,E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MAArB9B,QAAqB,QAArBA,QAAqB;AAAA,MAAXc,IAAW,QAAXA,IAAW;AAC9F,MAAMiB,oBAAoB,GAAGC,UAAU,CAACL,wBAAD,CAAvC;AAEAtB,EAAAA,SAAS,CAAC,YAAM;AAAA,QACKe,WADL,GACqBN,IADrB,CACJG,OADI;;AAAA,gBAEqCc,oBAAoB,IAAI,EAF7D;AAAA,QAEKE,2BAFL,SAEJhB,OAFI;;AAGZ,QAAI,CAACgB,2BAAD,IAAgC,CAACb,WAArC,EAAkD;AAC9C,aAAOV,SAAP;AACH,KALW;;;AAOZuB,IAAAA,2BAA2B,CAACC,IAA5B,OAAAD,2BAA2B,qBAASb,WAAT,EAA3B;AACA,WAAO,YAAM;AACT;AACAe,MAAAA,IAAI,MAAJ,UAAKF,2BAAL,4BAAqCb,WAArC;AACH,KAHD;AAIH,GAZQ,EAYN,CAACW,oBAAD,EAAuBjB,IAAvB,CAZM,CAAT;AAcAK,EAAAA,YAAY,CAAC;AAAEnB,IAAAA,QAAQ,EAARA,QAAF;AAAYc,IAAAA,IAAI,EAAJA;AAAZ,GAAD,CAAZ;AACA,SAAO,oBAAC,wBAAD,CAA0B,QAA1B;AAAmC,IAAA,KAAK,EAAEA;AAA1C,KAAiDgB,QAAjD,CAAP;AACH;AACDD,iBAAiB,CAACO,WAAlB,GAAgC,mBAAhC;;;;"}
1
+ {"version":3,"file":"ClickAwayProvider.js","sources":["../../../src/hooks/useCallbackOnEscape.ts","../../../src/hooks/useClickAway.tsx","../../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx"],"sourcesContent":["import { DOCUMENT } from '@lumx/react/constants';\nimport { Callback, onEscapePressed } from '@lumx/react/utils';\nimport { useEffect } from 'react';\n\n/**\n * Triggers a callback when the escape key is pressed.\n *\n * @param callback Callback\n * @param closeOnEscape Disables the hook when false\n * @param rootElement Element on which to listen the escape key\n */\nexport function useCallbackOnEscape(\n callback: Callback | undefined,\n closeOnEscape = true,\n rootElement = DOCUMENT?.body,\n) {\n useEffect(() => {\n if (closeOnEscape && callback && rootElement) {\n const onKeyDown = onEscapePressed(callback);\n rootElement.addEventListener('keydown', onKeyDown);\n return () => rootElement.removeEventListener('keydown', onKeyDown);\n }\n return undefined;\n }, [callback, closeOnEscape, rootElement]);\n}\n","import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils';\n\nimport isEmpty from 'lodash/isEmpty';\n\nconst EVENT_TYPES = ['mousedown', 'touchstart'];\n\nfunction isClickAway(target: HTMLElement, refs: Array<RefObject<HTMLElement>>): boolean {\n // The target element is not contained in any of the listed element references.\n return !refs.some((e) => e?.current?.contains(target));\n}\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: EventListener | Falsy;\n /**\n * Elements from which we want to detect the click away.\n */\n refs: RefObject<Array<RefObject<HTMLElement>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, refs }: ClickAwayParameters): void {\n useEffect(() => {\n const { current: currentRefs } = refs;\n if (!callback || !currentRefs || isEmpty(currentRefs)) {\n return undefined;\n }\n const listener: EventListener = (evt) => {\n if (isClickAway(evt.target as HTMLElement, currentRefs)) {\n callback(evt);\n }\n };\n\n EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n }, [callback, refs]);\n}\n","import React, { createContext, useContext, useEffect } from 'react';\nimport pull from 'lodash/pull';\nimport { ClickAwayParameters, useClickAway } from '@lumx/react/hooks/useClickAway';\n\nconst ClickAwayAncestorContext = createContext<ClickAwayParameters['refs'] | null>(null);\n\n/**\n * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure\n * we take into account both the DOM tree and the React tree we trying to detect click away.\n *\n * @return the react component.\n */\nexport const ClickAwayProvider: React.FC<ClickAwayParameters> = ({ children, callback, refs }) => {\n const ancestorChildrenRefs = useContext(ClickAwayAncestorContext);\n\n useEffect(() => {\n const { current: currentRefs } = refs;\n const { current: currentAncestorChildrenRefs } = ancestorChildrenRefs || {};\n if (!currentAncestorChildrenRefs || !currentRefs) {\n return undefined;\n }\n // Push current refs to parent.\n currentAncestorChildrenRefs.push(...currentRefs);\n return () => {\n // Pull current refs from parent.\n pull(currentAncestorChildrenRefs, ...currentRefs);\n };\n }, [ancestorChildrenRefs, refs]);\n\n useClickAway({ callback, refs });\n return <ClickAwayAncestorContext.Provider value={refs}>{children}</ClickAwayAncestorContext.Provider>;\n};\nClickAwayProvider.displayName = 'ClickAwayProvider';\n"],"names":["useCallbackOnEscape","callback","closeOnEscape","rootElement","DOCUMENT","body","useEffect","onKeyDown","onEscapePressed","addEventListener","removeEventListener","undefined","EVENT_TYPES","isClickAway","target","refs","some","e","current","contains","useClickAway","currentRefs","isEmpty","listener","evt","forEach","evtType","document","ClickAwayAncestorContext","createContext","ClickAwayProvider","children","ancestorChildrenRefs","useContext","currentAncestorChildrenRefs","push","pull","displayName"],"mappings":";;;;;;;AAIA;;;;;;;;AAOO,SAASA,mBAAT,CACHC,QADG,EAIL;AAAA,MAFEC,aAEF,uEAFkB,IAElB;AAAA,MADEC,WACF,uEADgBC,QAChB,aADgBA,QAChB,uBADgBA,QAAQ,CAAEC,IAC1B;AACEC,EAAAA,SAAS,CAAC,YAAM;AACZ,QAAIJ,aAAa,IAAID,QAAjB,IAA6BE,WAAjC,EAA8C;AAC1C,UAAMI,SAAS,GAAGC,eAAe,CAACP,QAAD,CAAjC;AACAE,MAAAA,WAAW,CAACM,gBAAZ,CAA6B,SAA7B,EAAwCF,SAAxC;AACA,aAAO;AAAA,eAAMJ,WAAW,CAACO,mBAAZ,CAAgC,SAAhC,EAA2CH,SAA3C,CAAN;AAAA,OAAP;AACH;;AACD,WAAOI,SAAP;AACH,GAPQ,EAON,CAACV,QAAD,EAAWC,aAAX,EAA0BC,WAA1B,CAPM,CAAT;A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;;;;;;IAMaC,iBAAgD,GAAG,SAAnDA,iBAAmD,OAAkC;AAAA,MAA/BC,QAA+B,QAA/BA,QAA+B;AAAA,MAArB9B,QAAqB,QAArBA,QAAqB;AAAA,MAAXc,IAAW,QAAXA,IAAW;AAC9F,MAAMiB,oBAAoB,GAAGC,UAAU,CAACL,wBAAD,CAAvC;AAEAtB,EAAAA,SAAS,CAAC,YAAM;AAAA,QACKe,WADL,GACqBN,IADrB,CACJG,OADI;;AAAA,gBAEqCc,oBAAoB,IAAI,EAF7D;AAAA,QAEKE,2BAFL,SAEJhB,OAFI;;AAGZ,QAAI,CAACgB,2BAAD,IAAgC,CAACb,WAArC,EAAkD;AAC9C,aAAOV,SAAP;AACH,KALW;;;AAOZuB,IAAAA,2BAA2B,CAACC,IAA5B,OAAAD,2BAA2B,qBAASb,WAAT,EAA3B;AACA,WAAO,YAAM;AACT;AACAe,MAAAA,IAAI,MAAJ,UAAKF,2BAAL,4BAAqCb,WAArC;AACH,KAHD;AAIH,GAZQ,EAYN,CAACW,oBAAD,EAAuBjB,IAAvB,CAZM,CAAT;AAcAK,EAAAA,YAAY,CAAC;AAAEnB,IAAAA,QAAQ,EAARA,QAAF;AAAYc,IAAAA,IAAI,EAAJA;AAAZ,GAAD,CAAZ;AACA,SAAO,oBAAC,wBAAD,CAA0B,QAA1B;AAAmC,IAAA,KAAK,EAAEA;AAA1C,KAAiDgB,QAAjD,CAAP;AACH;AACDD,iBAAiB,CAACO,WAAlB,GAAgC,mBAAhC;;;;"}
@@ -2,7 +2,11 @@ import { c as _extends, a as _defineProperty, b as _objectWithoutProperties, d a
2
2
  import { Emphasis } from './components.js';
3
3
  import React, { forwardRef, useState, useRef, useCallback } from 'react';
4
4
  import { g as getRootClassName, c as classnames } from './getRootClassName.js';
5
- import { f as mdiChevronRight, g as mdiChevronLeft } from './mdi.js';
5
+ import { f as mdiChevronRight, g as mdiChevronLeft } from './Icon2.js';
6
+ import 'lodash/isBoolean';
7
+ import 'lodash/isEmpty';
8
+ import 'lodash/kebabCase';
9
+ import 'lodash/noop';
6
10
  import { u as useFocus, a as Popover, P as Placement } from './Popover2.js';
7
11
  import { I as IconButton } from './IconButton.js';
8
12
  import moment$1 from 'moment';
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerField.js","sources":["../../../src/components/date-picker/constants.ts","../../../../lumx-core/src/js/date-picker.ts","../../../src/components/date-picker/DatePickerControlled.tsx","../../../src/components/date-picker/DatePicker.tsx","../../../src/components/date-picker/DatePickerField.tsx"],"sourcesContent":["import { getRootClassName } from '@lumx/react/utils';\n\n/**\n * Component display name.\n */\nexport const COMPONENT_NAME = 'DatePicker';\n\n/**\n * Component default class name and class prefix.\n */\nexport const CLASSNAME = getRootClassName(COMPONENT_NAME);\n","import range from 'lodash/range';\nimport mMoment, { Moment } from 'moment';\nimport { extendMoment } from 'moment-range';\n\nconst moment = extendMoment(mMoment as any);\n\nconst DAYS_PER_WEEK = 7;\n\ninterface AnnotatedDate {\n date: Moment;\n isDisplayed: boolean;\n isClickable: boolean;\n isToday: boolean;\n}\n\n/**\n * Get the list of days in a week based on locale.\n *\n * @param locale The locale using to generate the order of days in a week.\n * @return The list of days in a week based on locale.\n */\nexport function getWeekDays(locale: string): Moment[] {\n return range(DAYS_PER_WEEK).map((_, i) => moment().locale(locale).weekday(i));\n}\n\n/**\n * Get month calendar based on locale and start date.\n *\n * @param locale The locale using to generate the order of days in a week.\n * @param selectedMonth The selected month.\n * @return The list of days in a week based on locale.\n */\nexport function getMonthCalendar(locale: string, selectedMonth?: Moment): Moment[] {\n const firstDayOfMonth = moment(selectedMonth).startOf('month');\n const endDayOfMonth = moment(selectedMonth).endOf('month');\n // The first day of the week depends on the locale used. In FR the first day is a monday but in EN the first day is sunday\n const firstDay = firstDayOfMonth.locale(locale).startOf('week');\n const monthRange = moment.range(firstDay.toDate(), endDayOfMonth.toDate());\n\n return Array.from(monthRange.by('day'));\n}\n\n/**\n * Get month calendar based on locale and start date.\n * Each day is annotated to know if they are displayed and/or clickable.\n *\n * @param locale The locale using to generate the order of days in a week.\n * @param minDate The first selectable date.\n * @param maxDate The last selectable date.\n * @param selectedMonth The selected month.\n * @return The list of days in a week based on locale.\n */\nexport function getAnnotatedMonthCalendar(\n locale: string,\n minDate?: Date,\n maxDate?: Date,\n selectedMonth?: Moment,\n): AnnotatedDate[] {\n const month = moment(selectedMonth).locale(locale).month();\n\n const clickableRange = moment.range(minDate!, maxDate!);\n\n return getMonthCalendar(locale, selectedMonth).map((date) => {\n return {\n date,\n isClickable: clickableRange.contains(date),\n isDisplayed: date.month() === month,\n isToday: date.isSame(moment(), 'day'),\n };\n });\n}\n","import React, { forwardRef } from 'react';\nimport moment from 'moment';\nimport classNames from 'classnames';\nimport { DatePickerProps, Emphasis, IconButton, Toolbar } from '@lumx/react';\nimport { mdiChevronLeft, mdiChevronRight } from '@lumx/icons';\nimport { getAnnotatedMonthCalendar, getWeekDays } from '@lumx/core/js/date-picker';\nimport { Comp } from '@lumx/react/utils';\nimport { CLASSNAME } from './constants';\n\n/**\n * Defines the props of the component.\n */\nexport interface DatePickerControlledProps extends DatePickerProps {\n /** Selected month to display. */\n selectedMonth: Date;\n /** On previous month change callback. */\n onPrevMonthChange(): void;\n /** On next month change callback. */\n onNextMonthChange(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'DatePickerControlled';\n\n/**\n * DatePickerControlled component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DatePickerControlled: Comp<DatePickerControlledProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n locale,\n maxDate,\n minDate,\n nextButtonProps,\n onChange,\n onNextMonthChange,\n onPrevMonthChange,\n previousButtonProps,\n selectedMonth,\n todayOrSelectedDateRef,\n value,\n } = props;\n const days = React.useMemo(() => {\n return getAnnotatedMonthCalendar(locale, minDate, maxDate, moment(selectedMonth));\n }, [locale, minDate, maxDate, selectedMonth]);\n\n const weekDays = React.useMemo(() => {\n return getWeekDays(locale);\n }, [locale]);\n\n return (\n <div ref={ref} className={`${CLASSNAME}`}>\n <Toolbar\n className={`${CLASSNAME}__toolbar`}\n after={\n <IconButton\n {...nextButtonProps}\n emphasis={Emphasis.low}\n icon={mdiChevronRight}\n onClick={onNextMonthChange}\n />\n }\n before={\n <IconButton\n {...previousButtonProps}\n emphasis={Emphasis.low}\n icon={mdiChevronLeft}\n onClick={onPrevMonthChange}\n />\n }\n label={\n <span className={`${CLASSNAME}__month`}>\n {moment(selectedMonth).locale(locale).format('MMMM YYYY')}\n </span>\n }\n />\n <div className={`${CLASSNAME}__calendar`}>\n <div className={`${CLASSNAME}__week-days ${CLASSNAME}__days-wrapper`}>\n {weekDays.map((weekDay) => (\n <div key={weekDay.unix()} className={`${CLASSNAME}__day-wrapper`}>\n <span className={`${CLASSNAME}__week-day`}>\n {weekDay.format('dddd').slice(0, 1).toLocaleUpperCase()}\n </span>\n </div>\n ))}\n </div>\n\n <div className={`${CLASSNAME}__month-days ${CLASSNAME}__days-wrapper`}>\n {days.map((annotatedDate) => {\n if (annotatedDate.isDisplayed) {\n return (\n <div key={annotatedDate.date.unix()} className={`${CLASSNAME}__day-wrapper`}>\n <button\n ref={\n (value && annotatedDate.date.isSame(value, 'day')) ||\n (!value && annotatedDate.isToday)\n ? todayOrSelectedDateRef\n : null\n }\n className={classNames(`${CLASSNAME}__month-day`, {\n [`${CLASSNAME}__month-day--is-selected`]:\n value && annotatedDate.date.isSame(value, 'day'),\n [`${CLASSNAME}__month-day--is-today`]:\n annotatedDate.isClickable && annotatedDate.isToday,\n })}\n disabled={!annotatedDate.isClickable}\n type=\"button\"\n onClick={() => onChange(moment(annotatedDate.date).toDate())}\n >\n <span>{annotatedDate.date.format('DD')}</span>\n </button>\n </div>\n );\n }\n return <div key={annotatedDate.date.unix()} className={`${CLASSNAME}__day-wrapper`} />;\n })}\n </div>\n </div>\n </div>\n );\n});\nDatePickerControlled.displayName = COMPONENT_NAME;\nDatePickerControlled.className = CLASSNAME;\n","import moment from 'moment';\nimport React, { forwardRef, useState } from 'react';\nimport { Comp } from '@lumx/react/utils';\nimport { CLASSNAME, COMPONENT_NAME } from './constants';\nimport { DatePickerControlled } from './DatePickerControlled';\nimport { DatePickerProps } from './types';\n\n/**\n * DatePicker component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DatePicker: Comp<DatePickerProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { defaultMonth, locale, value, onChange, ...forwardedProps } = props;\n let castedValue;\n if (value) {\n castedValue = moment(value);\n } else if (defaultMonth) {\n castedValue = moment(defaultMonth);\n }\n if (castedValue && !castedValue.isValid()) {\n // eslint-disable-next-line no-console\n console.warn(`[@lumx/react/DatePicker] Invalid date provided ${castedValue}`);\n }\n const selectedDay = castedValue && castedValue.isValid() ? castedValue : moment();\n\n const [monthOffset, setMonthOffset] = useState(0);\n\n const setPrevMonth = () => setMonthOffset(monthOffset - 1);\n const setNextMonth = () => setMonthOffset(monthOffset + 1);\n\n const onDatePickerChange = (newDate?: Date) => {\n onChange(newDate);\n setMonthOffset(0);\n };\n\n const selectedMonth = moment(selectedDay).locale(locale).add(monthOffset, 'months').toDate();\n\n return (\n <DatePickerControlled\n ref={ref}\n {...forwardedProps}\n defaultMonth={defaultMonth}\n locale={locale}\n value={value}\n onPrevMonthChange={setPrevMonth}\n onNextMonthChange={setNextMonth}\n selectedMonth={selectedMonth}\n onChange={onDatePickerChange}\n />\n );\n});\nDatePicker.displayName = COMPONENT_NAME;\nDatePicker.className = CLASSNAME;\n","import { DatePicker, Placement, Popover, TextField, IconButtonProps } from '@lumx/react';\nimport { useFocusTrap } from '@lumx/react/_internal/hooks/useFocusTrap';\n\nimport moment from 'moment';\n\nimport React, { forwardRef, SyntheticEvent, useCallback, useRef, useState } from 'react';\n\nimport { useFocus } from '@lumx/react/_internal/hooks/useFocus';\nimport { Comp, GenericProps } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface DatePickerFieldProps extends GenericProps {\n /** Default month. */\n defaultMonth?: Date;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Locale (language or region) to use. */\n locale: string;\n /** Date after which dates can't be selected. */\n maxDate?: Date;\n /** Date before which dates can't be selected. */\n minDate?: Date;\n /** Native input name property. */\n name?: string;\n /** Props to pass to the next month button (minus those already set by the DatePickerControlled props). */\n nextButtonProps: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /** Props to pass to the previous month button (minus those already set by the DatePickerControlled props). */\n previousButtonProps: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /** Currently selected date. */\n value: Date | undefined;\n /** On change callback. */\n onChange(value: Date | undefined, name?: string, event?: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'DatePickerField';\n\n/**\n * DatePickerField component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DatePickerField: Comp<DatePickerFieldProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n defaultMonth,\n disabled,\n isDisabled = disabled,\n locale,\n maxDate,\n minDate,\n name,\n nextButtonProps,\n onChange,\n previousButtonProps,\n value,\n ...forwardedProps\n } = props;\n const wrapperRef = useRef(null);\n const anchorRef = useRef(null);\n\n const [isOpen, setIsOpen] = useState(false);\n\n const toggleSimpleMenu = () => {\n setIsOpen(!isOpen);\n };\n\n const onClose = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n useFocus(anchorRef.current, isOpen);\n const handleKeyboardNav = (evt: React.KeyboardEvent) => {\n if ((evt.key === 'Enter' || evt.key === ' ') && toggleSimpleMenu) {\n toggleSimpleMenu();\n }\n };\n\n // Handle focus trap.\n const todayOrSelectedDateRef = useRef<HTMLButtonElement>(null);\n useFocusTrap(todayOrSelectedDateRef.current && wrapperRef.current, todayOrSelectedDateRef.current);\n\n const onTextFieldChange = (textFieldValue: string, textFieldName?: string, event?: SyntheticEvent) => {\n if (!textFieldValue) {\n onChange(undefined, textFieldName, event);\n }\n };\n\n const onDatePickerChange = (newDate?: Date) => {\n onChange(newDate, name);\n onClose();\n };\n\n return (\n <>\n <TextField\n ref={ref}\n {...forwardedProps}\n name={name}\n forceFocusStyle={isOpen}\n textFieldRef={anchorRef}\n value={value ? moment(value).locale(locale).format('LL') : ''}\n onClick={toggleSimpleMenu}\n onChange={onTextFieldChange}\n onKeyPress={handleKeyboardNav}\n isDisabled={isDisabled}\n readOnly\n />\n {isOpen ? (\n <Popover\n anchorRef={anchorRef}\n placement={Placement.BOTTOM_START}\n isOpen={isOpen}\n onClose={onClose}\n closeOnClickAway\n closeOnEscape\n >\n <div ref={wrapperRef}>\n <DatePicker\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n value={value}\n onChange={onDatePickerChange}\n todayOrSelectedDateRef={todayOrSelectedDateRef}\n defaultMonth={defaultMonth}\n nextButtonProps={nextButtonProps}\n previousButtonProps={previousButtonProps}\n />\n </div>\n </Popover>\n ) : null}\n </>\n );\n});\nDatePickerField.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","moment","extendMoment","mMoment","DAYS_PER_WEEK","getWeekDays","locale","range","map","_","i","weekday","getMonthCalendar","selectedMonth","firstDayOfMonth","startOf","endDayOfMonth","endOf","firstDay","monthRange","toDate","Array","from","by","getAnnotatedMonthCalendar","minDate","maxDate","month","clickableRange","date","isClickable","contains","isDisplayed","isToday","isSame","DatePickerControlled","forwardRef","props","ref","nextButtonProps","onChange","onNextMonthChange","onPrevMonthChange","previousButtonProps","todayOrSelectedDateRef","value","days","React","useMemo","weekDays","Emphasis","low","mdiChevronRight","mdiChevronLeft","format","weekDay","unix","slice","toLocaleUpperCase","annotatedDate","classNames","displayName","className","DatePicker","defaultMonth","forwardedProps","castedValue","isValid","console","warn","selectedDay","useState","monthOffset","setMonthOffset","setPrevMonth","setNextMonth","onDatePickerChange","newDate","add","DatePickerField","disabled","isDisabled","name","wrapperRef","useRef","anchorRef","isOpen","setIsOpen","toggleSimpleMenu","onClose","useCallback","useFocus","current","handleKeyboardNav","evt","key","useFocusTrap","onTextFieldChange","textFieldValue","textFieldName","event","undefined","Placement","BOTTOM_START"],"mappings":";;;;;;;;;;;;;;AAEA;;;;AAGO,IAAMA,cAAc,GAAG,YAAvB;AAEP;;;;AAGO,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;;ACNP,IAAMG,MAAM,GAAGC,YAAY,CAACC,QAAD,CAA3B;AAEA,IAAMC,aAAa,GAAG,CAAtB;;AASA;;;;;;AAMO,SAASC,WAAT,CAAqBC,MAArB,EAA+C;AAClD,SAAOC,KAAK,CAACH,aAAD,CAAL,CAAqBI,GAArB,CAAyB,UAACC,CAAD,EAAIC,CAAJ;AAAA,WAAUT,MAAM,GAAGK,MAAT,CAAgBA,MAAhB,EAAwBK,OAAxB,CAAgCD,CAAhC,CAAV;AAAA,GAAzB,CAAP;AACH;AAED;;;;;;;;AAOO,SAASE,gBAAT,CAA0BN,MAA1B,EAA0CO,aAA1C,EAA4E;AAC/E,MAAMC,eAAe,GAAGb,MAAM,CAACY,aAAD,CAAN,CAAsBE,OAAtB,CAA8B,OAA9B,CAAxB;AACA,MAAMC,aAAa,GAAGf,MAAM,CAACY,aAAD,CAAN,CAAsBI,KAAtB,CAA4B,OAA5B,CAAtB,CAF+E;;AAI/E,MAAMC,QAAQ,GAAGJ,eAAe,CAACR,MAAhB,CAAuBA,MAAvB,EAA+BS,OAA/B,CAAuC,MAAvC,CAAjB;AACA,MAAMI,UAAU,GAAGlB,MAAM,CAACM,KAAP,CAAaW,QAAQ,CAACE,MAAT,EAAb,EAAgCJ,aAAa,CAACI,MAAd,EAAhC,CAAnB;AAEA,SAAOC,KAAK,CAACC,IAAN,CAAWH,UAAU,CAACI,EAAX,CAAc,KAAd,CAAX,CAAP;AACH;AAED;;;;;;;;;;;AAUO,SAASC,yBAAT,CACHl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AAKI,IAAA,gBAAgB,MALpB;AAMI,IAAA,aAAa;AANjB,KAQI;AAAK,IAAA,GAAG,EAAEN;AAAV,KACI,oBAAC,UAAD;AACI,IAAA,MAAM,EAAE7E,MADZ;AAEI,IAAA,OAAO,EAAEoB,OAFb;AAGI,IAAA,OAAO,EAAED,OAHb;AAII,IAAA,KAAK,EAAEoB,KAJX;AAKI,IAAA,QAAQ,EAAE+B,kBALd;AAMI,IAAA,sBAAsB,EAAEhC,sBAN5B;AAOI,IAAA,YAAY,EAAEoB,YAPlB;AAQI,IAAA,eAAe,EAAEzB,eARrB;AASI,IAAA,mBAAmB,EAAEI;AATzB,IADJ,CARJ,CADG,GAuBH,IArCR,CADJ;AAyCH,CA3FoF;AA4FrFoC,eAAe,CAAClB,WAAhB,GAA8B/D,gBAA9B;;;;"}
1
+ {"version":3,"file":"DatePickerField.js","sources":["../../../src/components/date-picker/constants.ts","../../../../lumx-core/src/js/date-picker.ts","../../../src/components/date-picker/DatePickerControlled.tsx","../../../src/components/date-picker/DatePicker.tsx","../../../src/components/date-picker/DatePickerField.tsx"],"sourcesContent":["import { getRootClassName } from '@lumx/react/utils';\n\n/**\n * Component display name.\n */\nexport const COMPONENT_NAME = 'DatePicker';\n\n/**\n * Component default class name and class prefix.\n */\nexport const CLASSNAME = getRootClassName(COMPONENT_NAME);\n","import range from 'lodash/range';\nimport mMoment, { Moment } from 'moment';\nimport { extendMoment } from 'moment-range';\n\nconst moment = extendMoment(mMoment as any);\n\nconst DAYS_PER_WEEK = 7;\n\ninterface AnnotatedDate {\n date: Moment;\n isDisplayed: boolean;\n isClickable: boolean;\n isToday: boolean;\n}\n\n/**\n * Get the list of days in a week based on locale.\n *\n * @param locale The locale using to generate the order of days in a week.\n * @return The list of days in a week based on locale.\n */\nexport function getWeekDays(locale: string): Moment[] {\n return range(DAYS_PER_WEEK).map((_, i) => moment().locale(locale).weekday(i));\n}\n\n/**\n * Get month calendar based on locale and start date.\n *\n * @param locale The locale using to generate the order of days in a week.\n * @param selectedMonth The selected month.\n * @return The list of days in a week based on locale.\n */\nexport function getMonthCalendar(locale: string, selectedMonth?: Moment): Moment[] {\n const firstDayOfMonth = moment(selectedMonth).startOf('month');\n const endDayOfMonth = moment(selectedMonth).endOf('month');\n // The first day of the week depends on the locale used. In FR the first day is a monday but in EN the first day is sunday\n const firstDay = firstDayOfMonth.locale(locale).startOf('week');\n const monthRange = moment.range(firstDay.toDate(), endDayOfMonth.toDate());\n\n return Array.from(monthRange.by('day'));\n}\n\n/**\n * Get month calendar based on locale and start date.\n * Each day is annotated to know if they are displayed and/or clickable.\n *\n * @param locale The locale using to generate the order of days in a week.\n * @param minDate The first selectable date.\n * @param maxDate The last selectable date.\n * @param selectedMonth The selected month.\n * @return The list of days in a week based on locale.\n */\nexport function getAnnotatedMonthCalendar(\n locale: string,\n minDate?: Date,\n maxDate?: Date,\n selectedMonth?: Moment,\n): AnnotatedDate[] {\n const month = moment(selectedMonth).locale(locale).month();\n\n const clickableRange = moment.range(minDate!, maxDate!);\n\n return getMonthCalendar(locale, selectedMonth).map((date) => {\n return {\n date,\n isClickable: clickableRange.contains(date),\n isDisplayed: date.month() === month,\n isToday: date.isSame(moment(), 'day'),\n };\n });\n}\n","import React, { forwardRef } from 'react';\nimport moment from 'moment';\nimport classNames from 'classnames';\nimport { DatePickerProps, Emphasis, IconButton, Toolbar } from '@lumx/react';\nimport { mdiChevronLeft, mdiChevronRight } from '@lumx/icons';\nimport { getAnnotatedMonthCalendar, getWeekDays } from '@lumx/core/js/date-picker';\nimport { Comp } from '@lumx/react/utils';\nimport { CLASSNAME } from './constants';\n\n/**\n * Defines the props of the component.\n */\nexport interface DatePickerControlledProps extends DatePickerProps {\n /** Selected month to display. */\n selectedMonth: Date;\n /** On previous month change callback. */\n onPrevMonthChange(): void;\n /** On next month change callback. */\n onNextMonthChange(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'DatePickerControlled';\n\n/**\n * DatePickerControlled component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DatePickerControlled: Comp<DatePickerControlledProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n locale,\n maxDate,\n minDate,\n nextButtonProps,\n onChange,\n onNextMonthChange,\n onPrevMonthChange,\n previousButtonProps,\n selectedMonth,\n todayOrSelectedDateRef,\n value,\n } = props;\n const days = React.useMemo(() => {\n return getAnnotatedMonthCalendar(locale, minDate, maxDate, moment(selectedMonth));\n }, [locale, minDate, maxDate, selectedMonth]);\n\n const weekDays = React.useMemo(() => {\n return getWeekDays(locale);\n }, [locale]);\n\n return (\n <div ref={ref} className={`${CLASSNAME}`}>\n <Toolbar\n className={`${CLASSNAME}__toolbar`}\n after={\n <IconButton\n {...nextButtonProps}\n emphasis={Emphasis.low}\n icon={mdiChevronRight}\n onClick={onNextMonthChange}\n />\n }\n before={\n <IconButton\n {...previousButtonProps}\n emphasis={Emphasis.low}\n icon={mdiChevronLeft}\n onClick={onPrevMonthChange}\n />\n }\n label={\n <span className={`${CLASSNAME}__month`}>\n {moment(selectedMonth).locale(locale).format('MMMM YYYY')}\n </span>\n }\n />\n <div className={`${CLASSNAME}__calendar`}>\n <div className={`${CLASSNAME}__week-days ${CLASSNAME}__days-wrapper`}>\n {weekDays.map((weekDay) => (\n <div key={weekDay.unix()} className={`${CLASSNAME}__day-wrapper`}>\n <span className={`${CLASSNAME}__week-day`}>\n {weekDay.format('dddd').slice(0, 1).toLocaleUpperCase()}\n </span>\n </div>\n ))}\n </div>\n\n <div className={`${CLASSNAME}__month-days ${CLASSNAME}__days-wrapper`}>\n {days.map((annotatedDate) => {\n if (annotatedDate.isDisplayed) {\n return (\n <div key={annotatedDate.date.unix()} className={`${CLASSNAME}__day-wrapper`}>\n <button\n ref={\n (value && annotatedDate.date.isSame(value, 'day')) ||\n (!value && annotatedDate.isToday)\n ? todayOrSelectedDateRef\n : null\n }\n className={classNames(`${CLASSNAME}__month-day`, {\n [`${CLASSNAME}__month-day--is-selected`]:\n value && annotatedDate.date.isSame(value, 'day'),\n [`${CLASSNAME}__month-day--is-today`]:\n annotatedDate.isClickable && annotatedDate.isToday,\n })}\n disabled={!annotatedDate.isClickable}\n type=\"button\"\n onClick={() => onChange(moment(annotatedDate.date).toDate())}\n >\n <span>{annotatedDate.date.format('DD')}</span>\n </button>\n </div>\n );\n }\n return <div key={annotatedDate.date.unix()} className={`${CLASSNAME}__day-wrapper`} />;\n })}\n </div>\n </div>\n </div>\n );\n});\nDatePickerControlled.displayName = COMPONENT_NAME;\nDatePickerControlled.className = CLASSNAME;\n","import moment from 'moment';\nimport React, { forwardRef, useState } from 'react';\nimport { Comp } from '@lumx/react/utils';\nimport { CLASSNAME, COMPONENT_NAME } from './constants';\nimport { DatePickerControlled } from './DatePickerControlled';\nimport { DatePickerProps } from './types';\n\n/**\n * DatePicker component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DatePicker: Comp<DatePickerProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { defaultMonth, locale, value, onChange, ...forwardedProps } = props;\n let castedValue;\n if (value) {\n castedValue = moment(value);\n } else if (defaultMonth) {\n castedValue = moment(defaultMonth);\n }\n if (castedValue && !castedValue.isValid()) {\n // eslint-disable-next-line no-console\n console.warn(`[@lumx/react/DatePicker] Invalid date provided ${castedValue}`);\n }\n const selectedDay = castedValue && castedValue.isValid() ? castedValue : moment();\n\n const [monthOffset, setMonthOffset] = useState(0);\n\n const setPrevMonth = () => setMonthOffset(monthOffset - 1);\n const setNextMonth = () => setMonthOffset(monthOffset + 1);\n\n const onDatePickerChange = (newDate?: Date) => {\n onChange(newDate);\n setMonthOffset(0);\n };\n\n const selectedMonth = moment(selectedDay).locale(locale).add(monthOffset, 'months').toDate();\n\n return (\n <DatePickerControlled\n ref={ref}\n {...forwardedProps}\n defaultMonth={defaultMonth}\n locale={locale}\n value={value}\n onPrevMonthChange={setPrevMonth}\n onNextMonthChange={setNextMonth}\n selectedMonth={selectedMonth}\n onChange={onDatePickerChange}\n />\n );\n});\nDatePicker.displayName = COMPONENT_NAME;\nDatePicker.className = CLASSNAME;\n","import { DatePicker, Placement, Popover, TextField, IconButtonProps } from '@lumx/react';\nimport { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';\n\nimport moment from 'moment';\n\nimport React, { forwardRef, SyntheticEvent, useCallback, useRef, useState } from 'react';\n\nimport { useFocus } from '@lumx/react/hooks/useFocus';\nimport { Comp, GenericProps } from '@lumx/react/utils';\n\n/**\n * Defines the props of the component.\n */\nexport interface DatePickerFieldProps extends GenericProps {\n /** Default month. */\n defaultMonth?: Date;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Locale (language or region) to use. */\n locale: string;\n /** Date after which dates can't be selected. */\n maxDate?: Date;\n /** Date before which dates can't be selected. */\n minDate?: Date;\n /** Native input name property. */\n name?: string;\n /** Props to pass to the next month button (minus those already set by the DatePickerControlled props). */\n nextButtonProps: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /** Props to pass to the previous month button (minus those already set by the DatePickerControlled props). */\n previousButtonProps: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;\n /** Currently selected date. */\n value: Date | undefined;\n /** On change callback. */\n onChange(value: Date | undefined, name?: string, event?: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'DatePickerField';\n\n/**\n * DatePickerField component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const DatePickerField: Comp<DatePickerFieldProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n defaultMonth,\n disabled,\n isDisabled = disabled,\n locale,\n maxDate,\n minDate,\n name,\n nextButtonProps,\n onChange,\n previousButtonProps,\n value,\n ...forwardedProps\n } = props;\n const wrapperRef = useRef(null);\n const anchorRef = useRef(null);\n\n const [isOpen, setIsOpen] = useState(false);\n\n const toggleSimpleMenu = () => {\n setIsOpen(!isOpen);\n };\n\n const onClose = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n useFocus(anchorRef.current, isOpen);\n const handleKeyboardNav = (evt: React.KeyboardEvent) => {\n if ((evt.key === 'Enter' || evt.key === ' ') && toggleSimpleMenu) {\n toggleSimpleMenu();\n }\n };\n\n // Handle focus trap.\n const todayOrSelectedDateRef = useRef<HTMLButtonElement>(null);\n useFocusTrap(todayOrSelectedDateRef.current && wrapperRef.current, todayOrSelectedDateRef.current);\n\n const onTextFieldChange = (textFieldValue: string, textFieldName?: string, event?: SyntheticEvent) => {\n if (!textFieldValue) {\n onChange(undefined, textFieldName, event);\n }\n };\n\n const onDatePickerChange = (newDate?: Date) => {\n onChange(newDate, name);\n onClose();\n };\n\n return (\n <>\n <TextField\n ref={ref}\n {...forwardedProps}\n name={name}\n forceFocusStyle={isOpen}\n textFieldRef={anchorRef}\n value={value ? moment(value).locale(locale).format('LL') : ''}\n onClick={toggleSimpleMenu}\n onChange={onTextFieldChange}\n onKeyPress={handleKeyboardNav}\n isDisabled={isDisabled}\n readOnly\n />\n {isOpen ? (\n <Popover\n anchorRef={anchorRef}\n placement={Placement.BOTTOM_START}\n isOpen={isOpen}\n onClose={onClose}\n closeOnClickAway\n closeOnEscape\n >\n <div ref={wrapperRef}>\n <DatePicker\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n value={value}\n onChange={onDatePickerChange}\n todayOrSelectedDateRef={todayOrSelectedDateRef}\n defaultMonth={defaultMonth}\n nextButtonProps={nextButtonProps}\n previousButtonProps={previousButtonProps}\n />\n </div>\n </Popover>\n ) : null}\n </>\n );\n});\nDatePickerField.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","moment","extendMoment","mMoment","DAYS_PER_WEEK","getWeekDays","locale","range","map","_","i","weekday","getMonthCalendar","selectedMonth","firstDayOfMonth","startOf","endDayOfMonth","endOf","firstDay","monthRange","toDate","Array","from","by","getAnnotatedMonthCalendar","minDate","maxDate","month","clickableRange","date","isClickable","contains","isDisplayed","isToday","isSame","DatePickerControlled","forwardRef","props","ref","nextButtonProps","onChange","onNextMonthChange","onPrevMonthChange","previousButtonProps","todayOrSelectedDateRef","value","days","React","useMemo","weekDays","Emphasis","low","mdiChevronRight","mdiChevronLeft","format","weekDay","unix","slice","toLocaleUpperCase","annotatedDate","classNames","displayName","className","DatePicker","defaultMonth","forwardedProps","castedValue","isValid","console","warn","selectedDay","useState","monthOffset","setMonthOffset","setPrevMonth","setNextMonth","onDatePickerChange","newDate","add","DatePickerField","disabled","isDisabled","name","wrapperRef","useRef","anchorRef","isOpen","setIsOpen","toggleSimpleMenu","onClose","useCallback","useFocus","current","handleKeyboardNav","evt","key","useFocusTrap","onTextFieldChange","textFieldValue","textFieldName","event","undefined","Placement","BOTTOM_START"],"mappings":";;;;;;;;;;;;;;;;;;AAEA;;;;AAGO,IAAMA,cAAc,GAAG,YAAvB;AAEP;;;;AAGO,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;;ACNP,IAAMG,MAAM,GAAGC,YAAY,CAACC,QAAD,CAA3B;AAEA,IAAMC,aAAa,GAAG,CAAtB;;AASA;;;;;;AAMO,SAASC,WAAT,CAAqBC,MAArB,EAA+C;AAClD,SAAOC,KAAK,CAACH,aAAD,CAAL,CAAqBI,GAArB,CAAyB,UAACC,CAAD,EAAIC,CAAJ;AAAA,WAAUT,MAAM,GAAGK,MAAT,CAAgBA,MAAhB,EAAwBK,OAAxB,CAAgCD,CAAhC,CAAV;AAAA,GAAzB,CAAP;AACH;AAED;;;;;;;;AAOO,SAASE,gBAAT,CAA0BN,MAA1B,EAA0CO,aAA1C,EAA4E;AAC/E,MAAMC,eAAe,GAAGb,MAAM,CAACY,aAAD,CAAN,CAAsBE,OAAtB,CAA8B,OAA9B,CAAxB;AACA,MAAMC,aAAa,GAAGf,MAAM,CAACY,aAAD,CAAN,CAAsBI,KAAtB,CAA4B,OAA5B,CAAtB,CA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