@rio-cloud/rio-uikit 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/components/actionBarItem/ActionBarItem.d.ts +2 -2
  2. package/components/actionBarItem/ActionBarItem.js.map +1 -1
  3. package/components/applicationHeader/ApplicationHeader.d.ts +6 -7
  4. package/components/applicationHeader/ApplicationHeader.js.map +1 -1
  5. package/components/applicationLayout/SubNavigation.d.ts +7 -0
  6. package/components/applicationLayout/SubNavigation.js.map +1 -1
  7. package/components/assetTree/AssetTree.d.ts +7 -0
  8. package/components/assetTree/AssetTree.js.map +1 -1
  9. package/components/assetTree/Tree.d.ts +15 -0
  10. package/components/assetTree/Tree.js.map +1 -1
  11. package/components/assetTree/TreeIcon.d.ts +30 -0
  12. package/components/assetTree/TreeIcon.js +16 -0
  13. package/components/assetTree/TreeIcon.js.map +1 -0
  14. package/components/assetTree/TreeLeaf.js +22 -22
  15. package/components/assetTree/TreeLeaf.js.map +1 -1
  16. package/components/assetTree/TreeNode.js +25 -25
  17. package/components/assetTree/TreeNode.js.map +1 -1
  18. package/components/assetTree/TreeSearch.d.ts +2 -0
  19. package/components/assetTree/TreeSearch.js.map +1 -1
  20. package/components/barList/BarList.d.ts +26 -0
  21. package/components/barList/BarList.js.map +1 -1
  22. package/components/bottomSheet/BottomSheet.d.ts +17 -3
  23. package/components/bottomSheet/BottomSheet.js.map +1 -1
  24. package/components/bottomSheet/TimedBottomSheet.d.ts +10 -0
  25. package/components/bottomSheet/TimedBottomSheet.js.map +1 -1
  26. package/components/calendarStripe/CalendarStripe.d.ts +1 -1
  27. package/components/calendarStripe/CalendarStripe.js +34 -36
  28. package/components/calendarStripe/CalendarStripe.js.map +1 -1
  29. package/components/charts/Area.d.ts +2 -2
  30. package/components/charts/Area.js.map +1 -1
  31. package/components/charts/Line.d.ts +2 -2
  32. package/components/charts/Line.js.map +1 -1
  33. package/components/checkbox/Checkbox.d.ts +0 -3
  34. package/components/checkbox/Checkbox.js.map +1 -1
  35. package/components/clearableInput/ClearableInput.d.ts +21 -20
  36. package/components/clearableInput/ClearableInput.js.map +1 -1
  37. package/components/collapse/Collapse.d.ts +3 -0
  38. package/components/collapse/Collapse.js +12 -12
  39. package/components/collapse/Collapse.js.map +1 -1
  40. package/components/contentLoader/ContentLoader.d.ts +10 -2
  41. package/components/contentLoader/ContentLoader.js.map +1 -1
  42. package/components/dataTabs/DataTabs.d.ts +6 -0
  43. package/components/dataTabs/DataTabs.js.map +1 -1
  44. package/components/datepicker/DatePicker.d.ts +2 -2
  45. package/components/datepicker/DatePicker.js +31 -31
  46. package/components/datepicker/DatePicker.js.map +1 -1
  47. package/components/dialog/ConfirmationDialog.d.ts +22 -0
  48. package/components/dialog/ConfirmationDialog.js.map +1 -1
  49. package/components/dialog/Dialog.d.ts +13 -1
  50. package/components/dialog/Dialog.js.map +1 -1
  51. package/components/dialog/ReleaseNotesDialog.d.ts +3 -3
  52. package/components/dialog/ReleaseNotesDialog.js.map +1 -1
  53. package/components/dropdown/ButtonDropdown.d.ts +4 -0
  54. package/components/dropdown/ButtonDropdown.js +51 -51
  55. package/components/dropdown/ButtonDropdown.js.map +1 -1
  56. package/components/dropdown/DropdownSubmenu.d.ts +4 -0
  57. package/components/dropdown/DropdownSubmenu.js.map +1 -1
  58. package/components/editableContent/EditableContent.d.ts +6 -0
  59. package/components/editableContent/EditableContent.js.map +1 -1
  60. package/components/expander/ExpanderList.d.ts +3 -0
  61. package/components/expander/ExpanderList.js.map +1 -1
  62. package/components/expander/ExpanderPanel.d.ts +14 -4
  63. package/components/expander/ExpanderPanel.js.map +1 -1
  64. package/components/fade/Fade.d.ts +1 -1
  65. package/components/fade/Fade.js.map +1 -1
  66. package/components/filepicker/FilePicker.d.ts +0 -2
  67. package/components/filepicker/FilePicker.js.map +1 -1
  68. package/components/groupedItemList/GroupedItemList.d.ts +10 -7
  69. package/components/groupedItemList/GroupedItemList.js.map +1 -1
  70. package/components/listMenu/ListMenu.js.map +1 -1
  71. package/components/listMenu/ListMenuGroup.d.ts +2 -1
  72. package/components/listMenu/ListMenuGroup.js.map +1 -1
  73. package/components/map/components/Map.js.map +1 -1
  74. package/components/map/components/constants.js.map +1 -1
  75. package/components/map/components/features/ContextMenuItem.d.ts +1 -1
  76. package/components/map/components/features/ContextMenuItem.js +2 -17
  77. package/components/map/components/features/ContextMenuItem.js.map +1 -1
  78. package/components/map/components/features/basics/Polyline.d.ts +4 -1
  79. package/components/map/components/features/basics/Polyline.js +1 -1
  80. package/components/map/components/features/basics/Polyline.js.map +1 -1
  81. package/components/map/components/features/layers/MarkerLayer.d.ts +3 -1
  82. package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
  83. package/components/map/components/features/layers/clustering/ClusterLayer.js +1 -1
  84. package/components/map/components/features/layers/clustering/ClusterLayer.js.map +1 -1
  85. package/components/map/components/features/layers/clustering/SimpleClusterLayer.d.ts +3 -2
  86. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
  87. package/components/map/components/features/layers/overlayLayers/RoadRestrictionLayer.js +7 -7
  88. package/components/map/components/features/layers/overlayLayers/RoadRestrictionLayer.js.map +1 -1
  89. package/components/map/components/features/layers/overlayLayers/TrafficLayer.js +4 -4
  90. package/components/map/components/features/layers/overlayLayers/TrafficLayer.js.map +1 -1
  91. package/components/map/utils/clustering.d.ts +6 -1
  92. package/components/map/utils/clustering.js +25 -19
  93. package/components/map/utils/clustering.js.map +1 -1
  94. package/components/map/utils/rendering.d.ts +1 -1
  95. package/components/map/utils/rendering.js +23 -23
  96. package/components/map/utils/rendering.js.map +1 -1
  97. package/components/menuItems/MenuItem.d.ts +23 -0
  98. package/components/menuItems/MenuItem.js.map +1 -1
  99. package/components/notification/Notification.js +4 -4
  100. package/components/notification/Notification.js.map +1 -1
  101. package/components/onboarding/OnboardingTip.d.ts +18 -12
  102. package/components/onboarding/OnboardingTip.js.map +1 -1
  103. package/components/overlay/OverlayTrigger.d.ts +43 -1
  104. package/components/overlay/OverlayTrigger.js.map +1 -1
  105. package/components/pager/Pager.d.ts +3 -0
  106. package/components/pager/Pager.js.map +1 -1
  107. package/components/popover/Popover.d.ts +1 -0
  108. package/components/popover/Popover.js.map +1 -1
  109. package/components/preloader/ImagePreloader.d.ts +1 -1
  110. package/components/preloader/ImagePreloader.js.map +1 -1
  111. package/components/radiobutton/RadioButton.d.ts +9 -5
  112. package/components/radiobutton/RadioButton.js.map +1 -1
  113. package/components/releaseNotes/ReleaseNotes.d.ts +0 -3
  114. package/components/releaseNotes/ReleaseNotes.js.map +1 -1
  115. package/components/resizer/Resizer.d.ts +17 -3
  116. package/components/resizer/Resizer.js.map +1 -1
  117. package/components/rioglyph/Rioglyph.d.ts +20 -8
  118. package/components/rioglyph/Rioglyph.js.map +1 -1
  119. package/components/rules/RulesWrapper.js +1 -1
  120. package/components/rules/RulesWrapper.js.map +1 -1
  121. package/components/saveableInput/SaveableDateInput.d.ts +20 -2
  122. package/components/saveableInput/SaveableDateInput.js.map +1 -1
  123. package/components/saveableInput/SaveableInput.d.ts +10 -2
  124. package/components/saveableInput/SaveableInput.js.map +1 -1
  125. package/components/selects/BaseSelectDropdown.js +90 -79
  126. package/components/selects/BaseSelectDropdown.js.map +1 -1
  127. package/components/selects/Select.d.ts +5 -0
  128. package/components/selects/Select.js +94 -94
  129. package/components/selects/Select.js.map +1 -1
  130. package/components/sidebars/Sidebar.d.ts +19 -3
  131. package/components/sidebars/Sidebar.js.map +1 -1
  132. package/components/slider/RangeSlider.d.ts +15 -0
  133. package/components/slider/RangeSlider.js.map +1 -1
  134. package/components/slider/Slider.d.ts +9 -0
  135. package/components/slider/Slider.js.map +1 -1
  136. package/components/smoothScrollbars/SmoothScrollbars.d.ts +44 -0
  137. package/components/smoothScrollbars/SmoothScrollbars.js.map +1 -1
  138. package/components/spinner/Spinner.d.ts +3 -3
  139. package/components/spinner/Spinner.js.map +1 -1
  140. package/components/states/BaseStateProps.d.ts +6 -2
  141. package/components/states/StateIcon.d.ts +14 -1
  142. package/components/states/StateIcon.js.map +1 -1
  143. package/components/statsWidget/StatsWidget.d.ts +2 -0
  144. package/components/statsWidget/StatsWidget.js.map +1 -1
  145. package/components/statsWidget/StatsWidgetBody.d.ts +1 -0
  146. package/components/statsWidget/StatsWidgetBody.js.map +1 -1
  147. package/components/statsWidget/StatsWidgetNumber.d.ts +2 -0
  148. package/components/statsWidget/StatsWidgetNumber.js.map +1 -1
  149. package/components/statusBar/StatusBar.d.ts +2 -31
  150. package/components/statusBar/StatusBar.js.map +1 -1
  151. package/components/statusBar/StatusBarIcon.d.ts +2 -2
  152. package/components/statusBar/StatusBarIcon.js.map +1 -1
  153. package/components/statusBar/StatusBarLabel.d.ts +2 -2
  154. package/components/statusBar/StatusBarLabel.js.map +1 -1
  155. package/components/statusBar/StatusBarProgressBar.d.ts +1 -1
  156. package/components/statusBar/StatusBarProgressBar.js.map +1 -1
  157. package/components/statusBar/{StatusBar.types.d.ts → StatusBarProps.d.ts} +44 -2
  158. package/components/steppedProgressBar/SteppedProgressBar.d.ts +1 -1
  159. package/components/steppedProgressBar/SteppedProgressBar.js.map +1 -1
  160. package/components/switch/Switch.d.ts +13 -1
  161. package/components/switch/Switch.js.map +1 -1
  162. package/components/table/SortArrowDown.d.ts +1 -1
  163. package/components/table/SortArrowDown.js.map +1 -1
  164. package/components/table/SortArrowUp.d.ts +1 -1
  165. package/components/table/SortArrowUp.js.map +1 -1
  166. package/components/table/TableSettingsDialog.d.ts +5 -0
  167. package/components/table/TableSettingsDialog.js +119 -109
  168. package/components/table/TableSettingsDialog.js.map +1 -1
  169. package/components/table/TableSettingsDialogFooter.js +9 -9
  170. package/components/table/TableSettingsDialogFooter.js.map +1 -1
  171. package/components/table/TableViewToggles.d.ts +21 -1
  172. package/components/table/TableViewToggles.js.map +1 -1
  173. package/components/tag/Tag.d.ts +7 -2
  174. package/components/tag/Tag.js.map +1 -1
  175. package/components/tagManager/TagManager.d.ts +15 -0
  176. package/components/tagManager/TagManager.js.map +1 -1
  177. package/components/tagManager/TagManagerTag.d.ts +9 -0
  178. package/components/teaser/Teaser.d.ts +57 -55
  179. package/components/teaser/Teaser.js.map +1 -1
  180. package/components/teaser/TeaserContainer.d.ts +1 -1
  181. package/components/teaser/TeaserContainer.js.map +1 -1
  182. package/components/tooltip/SimpleTooltip.d.ts +22 -4
  183. package/components/tooltip/SimpleTooltip.js.map +1 -1
  184. package/components/tooltip/Tooltip.d.ts +22 -2
  185. package/components/tooltip/Tooltip.js.map +1 -1
  186. package/components/video/ResponsiveVideo.d.ts +8 -3
  187. package/components/video/ResponsiveVideo.js.map +1 -1
  188. package/hooks/useKey.d.ts +1 -1
  189. package/hooks/useKey.js.map +1 -1
  190. package/hooks/useOnboarding.d.ts +86 -80
  191. package/hooks/useOnboarding.js.map +1 -1
  192. package/hooks/useTableExport.js.map +1 -1
  193. package/hooks/useUncontrollable.d.ts +1 -1
  194. package/hooks/useUncontrollable.js.map +1 -1
  195. package/package.json +12 -14
  196. package/utils/colorScheme.js +14 -13
  197. package/utils/colorScheme.js.map +1 -1
  198. package/utils/cssuseragent.js.map +1 -1
  199. package/utils/scrollItemIntoView.js +12 -11
  200. package/utils/scrollItemIntoView.js.map +1 -1
  201. package/utils/urlFeatureToggles.js +19 -20
  202. package/utils/urlFeatureToggles.js.map +1 -1
  203. package/version.d.ts +1 -1
  204. package/version.js +1 -1
  205. package/version.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useRef, useEffect, type ReactNode, type PropsWithChildren } from 'react';\nimport classNames from 'classnames';\nimport { noop } from 'es-toolkit/function';\n\nimport { CheckboxIcon } from './CheckboxIcon';\n\nconst DEFAULT_ICON_SIZE = 16;\n\nconst ICON_LABEL_VERTICAL = 'vertical';\nconst ICON_LABEL_HORIZONTAL = 'horizontal';\n\nexport type CheckboxProps = {\n /**\n * Passed through as HTML attribute to the underlying input.\n * Set an `id` or a `name` otherwise.\n */\n id?: string;\n\n /**\n * Passed through as HTML attribute to the underlying input\n */\n name?: string;\n\n /**\n * Define some text or component as a label.\n */\n label?: string | ReactNode;\n\n /**\n * Define a custom icon for the checkbox by naming a rioglyph icon like `rioglyph-truck`.\n */\n icon?: string;\n\n /**\n * The icon size in pixel.\n */\n iconSize?: number;\n\n /**\n * The label position for a custom icon checkbox. Using this on a regular checkbox has no effect.\n *\n * Possible values are: `horizontal` or `vertical`.\n */\n iconLabelPosition?: typeof ICON_LABEL_VERTICAL | typeof ICON_LABEL_HORIZONTAL;\n\n /**\n * Callback function that is invoked when the checkbox is checked or unchecked.\n * @param event\n * @returns\n */\n onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function that is invoked when the checkbox value changes.\n * This will also be invoked by a keyboard event.\n * @param event\n * @returns\n */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;\n\n /**\n * Defines whether the checkbox is checked or not (state cannot be changed).\n */\n checked?: boolean;\n\n /**\n * Defines whether the checkbox is initially checked or not (state can be changed on click).\n */\n defaultChecked?: boolean;\n\n /**\n * Defines whether the checkbox is disabled or not.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Allows for rendering a completely different layout with or without a checkbox tick.\n * Note, when using the `custom` option, make sure to wrap the children with the class name\n * `checkbox-text-wrapper`. For using the checkbox tick, use an element with class name\n * `checkbox-text`.\n *\n * @example\n *\n * ```tsx\n * <div className='checkbox-text-wrapper display-flex justify-content-between'>\n * <div className='margin-right-15'>\n * <div className='text-medium text-size-16 text-color-darker'>Option 1</div>\n * <div className='text-color-dark'>This option is a first option</div>\n * </div>\n * <div className='checkbox-text' />\n * </div>\n * ```\n */\n custom?: boolean;\n\n /**\n * Defines whether the checkbox is required or not.\n *\n * @default false\n */\n required?: boolean;\n\n /**\n * Defines if the checkbox is in an indeterminate state in regard to other checkboxes that may be in different\n * selection state.\n *\n * @default false\n */\n indeterminate?: boolean;\n\n /**\n * Defines whether the checkbox is applying an inline style. Use this in combination\n * with other checkboxes.\n *\n * @default false\n */\n inline?: boolean;\n\n /**\n * Defines whether the checkbox is on the right side.\n *\n * @default false\n */\n right?: boolean;\n\n /**\n * Use \"error\" to change color of the checkbox.\n *\n * @default false\n */\n error?: boolean;\n\n /**\n * Defines the size of the checkbox. Omitting this prop renders the Checkbox in normal size.\n *\n * Possible values are:\n * `large`\n */\n size?: 'large';\n\n /**\n * A React ref assigned to the input itself.\n */\n inputRef?: React.RefObject<HTMLInputElement>;\n\n /**\n * Number of the index used for keyboard support.\n *\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Additional classes to be set on the input field.\n */\n className?: string;\n};\n\ntype CheckboxEvent =\n | React.MouseEvent<HTMLInputElement>\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLLabelElement>;\n\nconst Checkbox = (props: PropsWithChildren<CheckboxProps>) => {\n const {\n checked,\n children,\n className,\n custom = false,\n defaultChecked,\n disabled = false,\n error = false,\n icon = '',\n iconLabelPosition = ICON_LABEL_VERTICAL,\n iconSize = DEFAULT_ICON_SIZE,\n id = props.name,\n indeterminate = false,\n inline = false,\n inputRef,\n label,\n name,\n onChange = noop,\n onClick = noop,\n required = false,\n right,\n size,\n tabIndex = 0,\n ...remainingProps\n } = props;\n\n const labelRef = useRef<HTMLLabelElement>(null);\n\n useEffect(() => {\n const input = labelRef.current?.firstChild as HTMLInputElement;\n if (input) {\n input.indeterminate = indeterminate;\n }\n }, [indeterminate, labelRef.current]);\n\n const handleToggleKeyDown = (event: React.KeyboardEvent<HTMLLabelElement>) => {\n switch (event.key) {\n case ' ':\n // toggle on space\n toggle(event);\n break;\n case 'Enter':\n // open on enter\n toggle(event);\n break;\n default:\n break;\n }\n };\n\n const toggle = (event: CheckboxEvent) => {\n event.preventDefault();\n\n if (disabled) {\n return;\n }\n\n const input = labelRef.current?.firstChild as HTMLInputElement;\n\n if (input.indeterminate) {\n input.indeterminate = false;\n }\n\n input.checked = !input.checked;\n\n onClick(event as React.MouseEvent<HTMLInputElement>);\n onChange(event as React.ChangeEvent<HTMLInputElement>);\n };\n\n const text = label || children;\n\n const labelClassnames = classNames(\n 'checkbox',\n inline && 'checkbox-inline',\n size === 'large' && 'checkbox-large',\n right && 'checkbox-right',\n className\n );\n\n const inputClassnames = classNames(\n error && 'error',\n size === 'large' && 'large',\n indeterminate && 'indeterminate',\n className\n );\n\n const renderCustomIcon = !!icon;\n const renderCustomContent = custom && children;\n const renderDefault = !icon && !custom;\n\n return (\n <label\n {...remainingProps}\n className={labelClassnames}\n tabIndex={tabIndex}\n htmlFor={id}\n onKeyDown={handleToggleKeyDown}\n ref={labelRef}\n >\n <input\n id={id}\n name={name}\n type='checkbox'\n checked={checked}\n required={required}\n defaultChecked={defaultChecked}\n disabled={disabled}\n className={inputClassnames}\n onClick={onClick}\n onChange={onChange}\n ref={inputRef}\n />\n {renderCustomIcon && (\n <CheckboxIcon icon={icon} iconSize={iconSize} iconLabelPosition={iconLabelPosition} text={text} />\n )}\n {renderDefault && <span className='checkbox-text'>{text && <span>{text}</span>}</span>}\n {renderCustomContent && children}\n </label>\n );\n};\n\nCheckbox.ICON_LABEL_VERTICAL = ICON_LABEL_VERTICAL as typeof ICON_LABEL_VERTICAL;\nCheckbox.ICON_LABEL_HORIZONTAL = ICON_LABEL_HORIZONTAL as typeof ICON_LABEL_HORIZONTAL;\n\nexport default Checkbox;\n"],"names":["DEFAULT_ICON_SIZE","ICON_LABEL_VERTICAL","ICON_LABEL_HORIZONTAL","Checkbox","props","checked","children","className","custom","defaultChecked","disabled","error","icon","iconLabelPosition","iconSize","id","indeterminate","inline","inputRef","label","name","onChange","noop","onClick","required","right","size","tabIndex","remainingProps","labelRef","useRef","useEffect","input","handleToggleKeyDown","event","toggle","text","labelClassnames","classNames","inputClassnames","jsxs","jsx","CheckboxIcon"],"mappings":";;;;;AAMA,MAAMA,IAAoB,IAEpBC,IAAsB,YACtBC,IAAwB,cA2JxBC,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VS,MAAS,WAAW;AAAA,IACpBD,KAAS;AAAA,IACTlB;AAAA,EAAA,GAGEgC,IAAkBD;AAAA,IACpB3B,KAAS;AAAA,IACTe,MAAS,WAAW;AAAA,IACpBV,KAAiB;AAAA,IACjBT;AAAA,EAAA;AAOJ,SACI,gBAAAiC;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGZ;AAAA,MACJ,WAAWS;AAAA,MACX,UAAAV;AAAA,MACA,SAASZ;AAAA,MACT,WAAWkB;AAAA,MACX,KAAKJ;AAAA,MAEL,UAAA;AAAA,QAAA,gBAAAY;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,IAAA1B;AAAA,YACA,MAAAK;AAAA,YACA,MAAK;AAAA,YACL,SAAAf;AAAA,YACA,UAAAmB;AAAA,YACA,gBAAAf;AAAA,YACA,UAAAC;AAAA,YACA,WAAW6B;AAAA,YACX,SAAAhB;AAAA,YACA,UAAAF;AAAA,YACA,KAAKH;AAAA,UAAA;AAAA,QAAA;AAAA,QAxBQ,CAAC,CAACN,KA2Bf,gBAAA6B,EAACC,GAAA,EAAa,MAAA9B,GAAY,UAAAE,GAAoB,mBAAAD,GAAsC,MAAAuB,GAAY;AAAA,QAzBtF,CAACxB,KAAQ,CAACJ,uBA2BL,QAAA,EAAK,WAAU,iBAAiB,UAAA4B,KAAQ,gBAAAK,EAAC,QAAA,EAAM,UAAAL,EAAA,CAAK,EAAA,CAAQ;AAAA,QA5B3D5B,KAAUF,KA6BNA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGpC;AAEAH,EAAS,sBAAsBF;AAC/BE,EAAS,wBAAwBD;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useRef, useEffect, type ReactNode, type PropsWithChildren } from 'react';\nimport classNames from 'classnames';\nimport { noop } from 'es-toolkit/function';\n\nimport { CheckboxIcon } from './CheckboxIcon';\n\nconst DEFAULT_ICON_SIZE = 16;\n\nconst ICON_LABEL_VERTICAL = 'vertical';\nconst ICON_LABEL_HORIZONTAL = 'horizontal';\n\nexport type CheckboxProps = {\n /**\n * Passed through as HTML attribute to the underlying input.\n * Set an `id` or a `name` otherwise.\n */\n id?: string;\n\n /**\n * Passed through as HTML attribute to the underlying input\n */\n name?: string;\n\n /**\n * Define some text or component as a label.\n */\n label?: string | ReactNode;\n\n /**\n * Define a custom icon for the checkbox by naming a rioglyph icon like `rioglyph-truck`.\n */\n icon?: string;\n\n /**\n * The icon size in pixel.\n */\n iconSize?: number;\n\n /**\n * The label position for a custom icon checkbox. Using this on a regular checkbox has no effect.\n *\n * Possible values are: `horizontal` or `vertical`.\n */\n iconLabelPosition?: typeof ICON_LABEL_VERTICAL | typeof ICON_LABEL_HORIZONTAL;\n\n /**\n * Callback function that is invoked when the checkbox is checked or unchecked.\n * @param event\n * @returns\n */\n onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function that is invoked when the checkbox value changes.\n * This will also be invoked by a keyboard event.\n * @param event\n * @returns\n */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;\n\n /**\n * Defines whether the checkbox is checked or not (state cannot be changed).\n */\n checked?: boolean;\n\n /**\n * Defines whether the checkbox is initially checked or not (state can be changed on click).\n */\n defaultChecked?: boolean;\n\n /**\n * Defines whether the checkbox is disabled or not.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Allows for rendering a completely different layout with or without a checkbox tick.\n * Note, when using the `custom` option, make sure to wrap the children with the class name\n * `checkbox-text-wrapper`. For using the checkbox tick, use an element with class name\n * `checkbox-text`.\n *\n * @example\n * <div className='checkbox-text-wrapper display-flex justify-content-between'>\n * <div className='margin-right-15'>\n * <div className='text-medium text-size-16 text-color-darker'>Option 1</div>\n * <div className='text-color-dark'>This option is a first option</div>\n * </div>\n * <div className='checkbox-text' />\n * </div>\n */\n custom?: boolean;\n\n /**\n * Defines whether the checkbox is required or not.\n *\n * @default false\n */\n required?: boolean;\n\n /**\n * Defines if the checkbox is in an indeterminate state in regard to other checkboxes that may be in different\n * selection state.\n *\n * @default false\n */\n indeterminate?: boolean;\n\n /**\n * Defines whether the checkbox is applying an inline style. Use this in combination\n * with other checkboxes.\n *\n * @default false\n */\n inline?: boolean;\n\n /**\n * Defines whether the checkbox is on the right side.\n *\n * @default false\n */\n right?: boolean;\n\n /**\n * Use \"error\" to change color of the checkbox.\n *\n * @default false\n */\n error?: boolean;\n\n /**\n * Defines the size of the checkbox. Omitting this prop renders the Checkbox in normal size.\n *\n * Possible values are:\n * `large`\n */\n size?: 'large';\n\n /**\n * A React ref assigned to the input itself.\n */\n inputRef?: React.RefObject<HTMLInputElement>;\n\n /**\n * Number of the index used for keyboard support.\n *\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Additional classes to be set on the input field.\n */\n className?: string;\n};\n\ntype CheckboxEvent =\n | React.MouseEvent<HTMLInputElement>\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLLabelElement>;\n\nconst Checkbox = (props: PropsWithChildren<CheckboxProps>) => {\n const {\n checked,\n children,\n className,\n custom = false,\n defaultChecked,\n disabled = false,\n error = false,\n icon = '',\n iconLabelPosition = ICON_LABEL_VERTICAL,\n iconSize = DEFAULT_ICON_SIZE,\n id = props.name,\n indeterminate = false,\n inline = false,\n inputRef,\n label,\n name,\n onChange = noop,\n onClick = noop,\n required = false,\n right,\n size,\n tabIndex = 0,\n ...remainingProps\n } = props;\n\n const labelRef = useRef<HTMLLabelElement>(null);\n\n useEffect(() => {\n const input = labelRef.current?.firstChild as HTMLInputElement;\n if (input) {\n input.indeterminate = indeterminate;\n }\n }, [indeterminate, labelRef.current]);\n\n const handleToggleKeyDown = (event: React.KeyboardEvent<HTMLLabelElement>) => {\n switch (event.key) {\n case ' ':\n // toggle on space\n toggle(event);\n break;\n case 'Enter':\n // open on enter\n toggle(event);\n break;\n default:\n break;\n }\n };\n\n const toggle = (event: CheckboxEvent) => {\n event.preventDefault();\n\n if (disabled) {\n return;\n }\n\n const input = labelRef.current?.firstChild as HTMLInputElement;\n\n if (input.indeterminate) {\n input.indeterminate = false;\n }\n\n input.checked = !input.checked;\n\n onClick(event as React.MouseEvent<HTMLInputElement>);\n onChange(event as React.ChangeEvent<HTMLInputElement>);\n };\n\n const text = label || children;\n\n const labelClassnames = classNames(\n 'checkbox',\n inline && 'checkbox-inline',\n size === 'large' && 'checkbox-large',\n right && 'checkbox-right',\n className\n );\n\n const inputClassnames = classNames(\n error && 'error',\n size === 'large' && 'large',\n indeterminate && 'indeterminate',\n className\n );\n\n const renderCustomIcon = !!icon;\n const renderCustomContent = custom && children;\n const renderDefault = !icon && !custom;\n\n return (\n <label\n {...remainingProps}\n className={labelClassnames}\n tabIndex={tabIndex}\n htmlFor={id}\n onKeyDown={handleToggleKeyDown}\n ref={labelRef}\n >\n <input\n id={id}\n name={name}\n type='checkbox'\n checked={checked}\n required={required}\n defaultChecked={defaultChecked}\n disabled={disabled}\n className={inputClassnames}\n onClick={onClick}\n onChange={onChange}\n ref={inputRef}\n />\n {renderCustomIcon && (\n <CheckboxIcon icon={icon} iconSize={iconSize} iconLabelPosition={iconLabelPosition} text={text} />\n )}\n {renderDefault && <span className='checkbox-text'>{text && <span>{text}</span>}</span>}\n {renderCustomContent && children}\n </label>\n );\n};\n\nCheckbox.ICON_LABEL_VERTICAL = ICON_LABEL_VERTICAL as typeof ICON_LABEL_VERTICAL;\nCheckbox.ICON_LABEL_HORIZONTAL = ICON_LABEL_HORIZONTAL as typeof ICON_LABEL_HORIZONTAL;\n\nexport default Checkbox;\n"],"names":["DEFAULT_ICON_SIZE","ICON_LABEL_VERTICAL","ICON_LABEL_HORIZONTAL","Checkbox","props","checked","children","className","custom","defaultChecked","disabled","error","icon","iconLabelPosition","iconSize","id","indeterminate","inline","inputRef","label","name","onChange","noop","onClick","required","right","size","tabIndex","remainingProps","labelRef","useRef","useEffect","input","handleToggleKeyDown","event","toggle","text","labelClassnames","classNames","inputClassnames","jsxs","jsx","Che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ACzD,GAEME,IAAOjB,KAASb,GAEhB+B,IAAkBC;AAAA,IACpB;AAAA,IACArB,KAAU;AAAA,IACVS,MAAS,WAAW;AAAA,IACpBD,KAAS;AAAA,IACTlB;AAAA,EAAA,GAGEgC,IAAkBD;AAAA,IACpB3B,KAAS;AAAA,IACTe,MAAS,WAAW;AAAA,IACpBV,KAAiB;AAAA,IACjBT;AAAA,EAAA;AAOJ,SACI,gBAAAiC;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGZ;AAAA,MACJ,WAAWS;AAAA,MACX,UAAAV;AAAA,MACA,SAASZ;AAAA,MACT,WAAWkB;AAAA,MACX,KAAKJ;AAAA,MAEL,UAAA;AAAA,QAAA,gBAAAY;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,IAAA1B;AAAA,YACA,MAAAK;AAAA,YACA,MAAK;AAAA,YACL,SAAAf;AAAA,YACA,UAAAmB;AAAA,YACA,gBAAAf;AAAA,YACA,UAAAC;AAAA,YACA,WAAW6B;AAAA,YACX,SAAAhB;AAAA,YACA,UAAAF;AAAA,YACA,KAAKH;AAAA,UAAA;AAAA,QAAA;AAAA,QAxBQ,CAAC,CAACN,KA2Bf,gBAAA6B,EAACC,GAAA,EAAa,MAAA9B,GAAY,UAAAE,GAAoB,mBAAAD,GAAsC,MAAAuB,GAAY;AAAA,QAzBtF,CAACxB,KAAQ,CAACJ,uBA2BL,QAAA,EAAK,WAAU,iBAAiB,UAAA4B,KAAQ,gBAAAK,EAAC,QAAA,EAAM,UAAAL,EAAA,CAAK,EAAA,CAAQ;AAAA,QA5B3D5B,KAAUF,KA6BNA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGpC;AAEAH,EAAS,sBAAsBF;AAC/BE,EAAS,wBAAwBD;"}
@@ -26,6 +26,8 @@ export type ClearableInputProps = {
26
26
  *
27
27
  * There are three types supported:
28
28
  * `text`, `email`, `password`.
29
+ *
30
+ * @default 'text'
29
31
  */
30
32
  type?: 'text' | 'password' | 'email';
31
33
  /**
@@ -44,10 +46,14 @@ export type ClearableInputProps = {
44
46
  maxLength?: number;
45
47
  /**
46
48
  * Defines the tab index to be added to the input element.
49
+ *
50
+ * @default 0
47
51
  */
48
52
  tabIndex?: number;
49
53
  /**
50
54
  * Defined whether or not the input has the error styling.
55
+ *
56
+ * @default false
51
57
  */
52
58
  hasError?: boolean;
53
59
  /**
@@ -106,21 +112,16 @@ export type ClearableInputProps = {
106
112
  *
107
113
  * The following characters will define mask format:
108
114
  *
109
- * "0" = allowed input: "0-9" (digit)
110
- *
111
- * "a" = allowed input: "a-z, A-Z" (letter)
112
- *
113
- * "*" = allowed input: any character
114
- *
115
- * "#" = allowed input: "0-9, a-z, A-Z" (digit or letter)
115
+ * - "0" = allowed input: "0-9" (digit)
116
+ * - "a" = allowed input: "a-z, A-Z" (letter)
117
+ * - "*" = allowed input: any character
118
+ * - "#" = allowed input: "0-9, a-z, A-Z" (digit or letter)
116
119
  *
117
120
  * Other chars which is not in custom definitions supposed to be fixed:
118
121
  *
119
- * [] - make input optional
120
- *
121
- * {} - include fixed part in unmasked value
122
- *
123
- * ` - prevent symbols shift back
122
+ * - [] - make input optional
123
+ * - {} - include fixed part in unmasked value
124
+ * - ` - prevent symbols shift back
124
125
  *
125
126
  * If definition character should be treated as fixed it should be escaped by \\ (E.g. \\0).
126
127
  *
@@ -149,8 +150,9 @@ export type ClearableInputProps = {
149
150
  maskDispatch?: (appended: string, dynamicMasked: any) => any;
150
151
  /**
151
152
  * Controls when the mask pattern is visible.
153
+ *
152
154
  * - 'always': Mask is always visible
153
- * - 'onFocus': Mask is hidden but shown when input is focused (default)
155
+ * - 'onFocus': Mask is hidden but shown when input is focused
154
156
  * - 'never': Mask is never shown
155
157
  *
156
158
  * @default 'always'
@@ -188,15 +190,14 @@ export type ClearableInputProps = {
188
190
  * Additional classes to be set on the wrapper element.
189
191
  */
190
192
  className?: string;
191
- };
192
- type ChildrenProp = {
193
193
  /**
194
- * Providing a function enables the render props approach. The function gets the input props
195
- * passed and is responsible for rendering the custom `input` component.
196
- * @param props
197
- * @returns
194
+ * Render-prop to customize the rendered input.
195
+ *
196
+ * The function gets the `inputProps` passed and is responsible for rendering the custom `<input>` component.
197
+ *
198
+ * Receives the computed `input` props so you can render your own field. See: {@link https://reactjs.org/docs/render-props.html}
198
199
  */
199
200
  children?: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactNode;
200
201
  };
201
- declare const ClearableInput: React.ForwardRefExoticComponent<ClearableInputProps & ChildrenProp & React.RefAttributes<HTMLInputElement>>;
202
+ declare const ClearableInput: React.ForwardRefExoticComponent<ClearableInputProps & React.RefAttributes<HTMLInputElement>>;
202
203
  export default ClearableInput;
@@ -1 +1 @@
1
- {"version":3,"file":"ClearableInput.js","sources":["../../../src/components/clearableInput/ClearableInput.tsx"],"sourcesContent":["/** biome-ignore-all lint/complexity/noBannedTypes: <explanation> */\nimport React, { useState, forwardRef, type ForwardedRef, useRef } from 'react';\nimport classNames from 'classnames';\nimport { isEmpty, omit } from 'es-toolkit/compat';\nimport { isFunction, isNil } from 'es-toolkit/predicate';\nimport { noop } from 'es-toolkit/function';\nimport { IMaskInput } from 'react-imask';\n\nimport usePrevious from '../../hooks/usePrevious';\nimport useMergeRefs from '../../hooks/useMergeRefs';\n\nexport const DEFAULT_TYPE = 'text';\nexport const SUPPORTED_TYPES = ['text', 'password', 'email'];\n\nexport type MaskVisibility = 'always' | 'onFocus' | 'never';\nexport type MaskDefinition = {\n mask: string;\n definitions?: Record<string, string | RegExp>;\n startsWith?: string;\n [key: string]: any;\n};\n\nexport type ClearableInputProps = {\n /**\n * Gives the input element the id.\n */\n id?: string;\n\n /**\n * Gives the input element a name.\n */\n name?: string;\n\n /**\n * The translated text that shall be shown when the input is empty.\n */\n placeholder?: string | React.ReactNode;\n\n /**\n * Defines the type of the input itself.\n *\n * There are three types supported:\n * `text`, `email`, `password`.\n */\n type?: 'text' | 'password' | 'email';\n\n /**\n * Initial value of the ClearableInput. Pass this prop if you want to use this\n * component as an uncontrolled component.\n */\n defaultValue?: string;\n\n /**\n * Value of the ClearableInput. Pass this prop if you want to use this\n * component as a controlled component.\n */\n value?: string;\n\n /**\n * Defines the maximum amount of characters that can be entered.\n */\n maxLength?: number;\n\n /**\n * Defines the tab index to be added to the input element.\n */\n tabIndex?: number;\n\n /**\n * Defined whether or not the input has the error styling.\n */\n hasError?: boolean;\n\n /**\n * The callback ref for the underlying input. Alternatively, use can use a forward ref.\n */\n inputRef?: React.RefObject<HTMLInputElement>;\n\n /**\n * Sets autocomplete value for autosuggest forms.\n */\n autoComplete?: string;\n\n /**\n * Callback function for when the value changes. Receives new value as an argument.\n * @param newValue\n * @param event\n * @returns\n */\n onChange?: (\n newValue: string,\n event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLSpanElement>\n ) => void;\n\n /**\n * Callback function which gets triggered when the input looses the focus.\n * @param event\n * @returns\n */\n onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function which gets triggered when the input gains the focus.\n * @param event\n * @returns\n */\n onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function for when the value is cleared via the clear button.\n * @param event\n * @returns\n */\n onClear?: (event: React.MouseEvent<HTMLSpanElement>) => void;\n\n /**\n * Callback function for every key pressed including `Enter` key.\n * @param event\n * @returns\n */\n onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /**\n * Callback triggered when clicked into the input to react on it like when using an auto suggest dropdown\n * @param event\n * @returns\n */\n onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;\n\n /**\n * The mask prop will allow to use the component with an input mask.\n * It defines the pattern that should be followed.\n *\n * For more details on masking, checkout the third party documentation for the\n * input mask here: {@link https://imask.js.org/guide.html}\n *\n * Simple masks can be defined as strings.\n *\n * The following characters will define mask format:\n *\n * \"0\" = allowed input: \"0-9\" (digit)\n *\n * \"a\" = allowed input: \"a-z, A-Z\" (letter)\n *\n * \"*\" = allowed input: any character\n *\n * \"#\" = allowed input: \"0-9, a-z, A-Z\" (digit or letter)\n *\n * Other chars which is not in custom definitions supposed to be fixed:\n *\n * [] - make input optional\n *\n * {} - include fixed part in unmasked value\n *\n * ` - prevent symbols shift back\n *\n * If definition character should be treated as fixed it should be escaped by \\\\ (E.g. \\\\0).\n *\n * Additionally you can provide custom definitions.\n *\n * @example\n * '-- ### ### ###' or '+49 00 000 00'\n */\n mask?: string | (string | RegExp)[] | RegExp | DateConstructor | number | Function | MaskDefinition[];\n\n /**\n * Placeholder to cover unfilled parts of the mask.\n *\n * @default '_'\n */\n maskPlaceholder?: string | null;\n\n /**\n * Enable characters overwriting\n *\n * @default true\n */\n maskOverwrite?: boolean | 'shift' | undefined;\n\n /**\n * Chooses the mask for dynamic masking depending on input value.\n * Note, this function may not be an empty function, otherwise the mask selection won't work\n */\n maskDispatch?: (appended: string, dynamicMasked: any) => any;\n\n /**\n * Controls when the mask pattern is visible.\n * - 'always': Mask is always visible\n * - 'onFocus': Mask is hidden but shown when input is focused (default)\n * - 'never': Mask is never shown\n *\n * @default 'always'\n */\n maskVisibility?: MaskVisibility;\n\n /**\n * Custom definitions to have more control over your mask. The defined character will be replaced in your mask.\n *\n * @example\n * mask='AAA AAA.AA'\n * maskDefinitions={{ A: /[A-Z0-9]/ }}\n */\n maskDefinitions?: Record<string, string | RegExp>;\n\n /**\n * Minimum value to be entered. This prop is extended to accept a Date\n * when used with an input mask.\n */\n min?: string | number | undefined | Date;\n\n /**\n * Maximum value to be entered. This prop is extended to accept a Date\n * when used with an input mask.\n */\n max?: string | number | undefined | Date;\n\n /**\n * Disabled the input component.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Additional classes to be set on the input element.\n */\n inputClassName?: string;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n};\n\ntype ChildrenProp = {\n /**\n * Providing a function enables the render props approach. The function gets the input props\n * passed and is responsible for rendering the custom `input` component.\n * @param props\n * @returns\n */\n children?: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactNode;\n};\n\nconst hasValue = (value: unknown) => !isEmpty(`${value}`);\n\nconst ClearableInput = forwardRef((props: ClearableInputProps & ChildrenProp, ref: ForwardedRef<HTMLInputElement>) => {\n const {\n type = DEFAULT_TYPE,\n defaultValue,\n value,\n maxLength,\n tabIndex = 0,\n hasError = false,\n inputRef,\n autoComplete,\n onChange = noop,\n onBlur = noop,\n onFocus = noop,\n onClear = noop,\n onKeyPress = noop,\n onClick = noop,\n mask,\n maskPlaceholder = '_',\n maskVisibility = 'always',\n maskOverwrite = true,\n maskDefinitions,\n maskDispatch,\n inputClassName = '',\n disabled = false,\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const initialValue = value || defaultValue || '';\n\n const [inputValue, setInputValue] = useState(initialValue);\n const [showClear, setShowClear] = useState(hasValue(initialValue));\n const [isFocused, setIsFocused] = useState(false);\n\n const isControlled = !isNil(value);\n\n const internalMaskRef = useRef<HTMLInputElement>(null);\n const mergedInternalMaskRef = useMergeRefs(internalMaskRef, inputRef, ref);\n\n const hasMask = !!mask;\n\n // Calculate if mask should be visible (lazy=false means visible, lazy=true means hidden)\n const shouldShowMask = () => {\n switch (maskVisibility) {\n case 'always':\n return true;\n case 'onFocus':\n return isFocused;\n case 'never':\n return false;\n default:\n return isFocused;\n }\n };\n\n // Handles new input value and saves it in the local state.\n // The value stored in the state is used for rendering.\n const changeInternalValue = (newValue = '') => {\n // this is there to prevent that onChange and UNSAFE_componentWillReceiveProps set state at the same time\n if (inputValue === newValue) {\n return;\n }\n\n setInputValue(newValue);\n setShowClear(hasValue(newValue));\n };\n\n // important for when used as a controlled component and value changes from the outside.\n const previousValue = usePrevious(value);\n if (previousValue !== value) {\n changeInternalValue(value);\n }\n\n // only gets triggered on user interaction.\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = event.target.value;\n\n if (isControlled) {\n onChange(newValue, event);\n } else {\n changeInternalValue(newValue);\n onChange(newValue, event);\n }\n };\n\n const handleAccept = (newValue: string, maskRef: any, event?: InputEvent) => {\n if (!internalMaskRef.current) {\n return;\n }\n\n // Simulate a ChangeEvent for backwards compatibility since react-imask does not return a change event itself\n const syntheticEvent = {\n target: internalMaskRef.current,\n currentTarget: internalMaskRef.current,\n // Standard synthetic event props\n bubbles: true,\n cancelable: true,\n defaultPrevented: false,\n isTrusted: true,\n preventDefault: () => {},\n stopPropagation: () => {},\n persist: () => {},\n nativeEvent: {} as any,\n type: 'change',\n timeStamp: Date.now(),\n } as unknown as React.ChangeEvent<HTMLInputElement>;\n\n // Set unmasked value manually if needed\n // (you can use data-attributes or attach it directly)\n (syntheticEvent.target as any).unmaskedValue = maskRef.unmaskedValue;\n\n if (isControlled) {\n onChange(newValue, syntheticEvent);\n } else {\n changeInternalValue(newValue);\n onChange(newValue, syntheticEvent);\n }\n };\n\n const handleInputFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true);\n onFocus(event);\n };\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false);\n onBlur(event);\n };\n\n // Will be triggered on every key press but also when pressing 'Enter' for example\n const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyPress(event);\n };\n\n const clearInputValue = (event: React.MouseEvent<HTMLSpanElement>) => {\n changeInternalValue('');\n onChange('', event);\n\n if (onClear) {\n onClear(event);\n }\n };\n\n const classes = classNames(\n 'ClearableInput',\n 'input-group',\n hasError && 'has-error',\n disabled && 'pointer-events-none',\n className && className\n );\n\n const inputClassNames = classNames(\n 'form-control',\n inputClassName,\n showClear && 'withClearButton',\n hasMask && 'withInputMask',\n disabled && 'disabled'\n );\n\n const clearButtonClassNames = classNames('clearButton', !showClear && 'hide');\n\n const convertedType = type?.toLowerCase();\n const inputType = SUPPORTED_TYPES.indexOf(convertedType) !== -1 ? convertedType : DEFAULT_TYPE;\n\n const inputProps = {\n ...omit(remainingProps, ['value', 'defaultValue', 'onClear']),\n className: inputClassNames,\n autoComplete,\n type: inputType,\n value: inputValue,\n onKeyPress: handleKeyPress,\n onBlur: handleInputBlur,\n onFocus: handleInputFocus,\n onChange: hasMask ? undefined : handleChange, // In case of masked input, the onAccept callback is used\n onClick,\n disabled,\n maxLength: hasMask ? undefined : maxLength,\n tabIndex,\n } as any;\n\n // The dispatch function may not be an empty function. Specify it when\n // using dynamic masking and need more control over which mask gets selected\n const maskDispatchObj: any = {};\n if (maskDispatch) {\n maskDispatchObj.dispatch = maskDispatch;\n }\n\n const input = hasMask ? (\n <IMaskInput\n {...inputProps}\n inputRef={mergedInternalMaskRef}\n mask={mask}\n definitions={maskDefinitions}\n {...maskDispatchObj}\n placeholderChar={maskPlaceholder}\n onAccept={handleAccept}\n lazy={!shouldShowMask()}\n overwrite={maskOverwrite}\n />\n ) : (\n <input {...inputProps} ref={inputRef || ref} />\n );\n\n return (\n <div className={classes}>\n {children && isFunction(children) ? children(inputProps) : input}\n <span className={clearButtonClassNames} onClick={clearInputValue}>\n <span className='clearButtonIcon rioglyph rioglyph-remove-sign' />\n </span>\n </div>\n );\n});\n\nexport default ClearableInput;\n"],"names":["DEFAULT_TYPE","SUPPORTED_TYPES","hasValue","value","isEmpty","ClearableInput","forwardRef","props","ref","type","defaultValue","maxLength","tabIndex","hasError","inputRef","autoComplete","onChange","noop","onBlur","onFocus","onClear","onKeyPress","onClick","mask","maskPlaceholder","maskVisibility","maskOverwrite","maskDefinitions","maskDispatch","inputClassName","disabled","className","children","remainingProps","initialValue","inputValue","setInputValue","useState","showClear","setShowClear","isFocused","setIsFocused","isControlled","isNil","internalMaskRef","useRef","mergedInternalMaskRef","useMergeRefs","hasMask","shouldShowMask","changeInternalValue","newValue","usePrevious","handleChange","event","handleAccept","maskRef","syntheticEvent","handleInputFocus","handleInputBlur","handleKeyPress","clearInputValue","classes","classNames","inputClassNames","clearButtonClassNames","convertedType","inputType","inputProps","omit","maskDispatchObj","input","jsx","IMaskInput","jsxs","isFunction"],"mappings":";;;;;;;;;AAWO,MAAM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2C,GAAW3C,CAAQ,IAAIA,EAASoC,CAAU,IAAIG;AAAA,IAC3D,gBAAAC,EAAC,QAAA,EAAK,WAAWP,IAAuB,SAASJ,IAC7C,UAAA,gBAAAW,EAAC,QAAA,EAAK,WAAU,gDAAA,CAAgD,EAAA,CACpE;AAAA,EAAA,GACJ;AAER,CAAC;"}
1
+ {"version":3,"file":"ClearableInput.js","sources":["../../../src/components/clearableInput/ClearableInput.tsx"],"sourcesContent":["/** biome-ignore-all lint/complexity/noBannedTypes: <explanation> */\nimport React, { useState, forwardRef, type ForwardedRef, useRef } from 'react';\nimport classNames from 'classnames';\nimport { isEmpty, omit } from 'es-toolkit/compat';\nimport { isFunction, isNil } from 'es-toolkit/predicate';\nimport { noop } from 'es-toolkit/function';\nimport { IMaskInput } from 'react-imask';\n\nimport usePrevious from '../../hooks/usePrevious';\nimport useMergeRefs from '../../hooks/useMergeRefs';\n\nexport const DEFAULT_TYPE = 'text';\nexport const SUPPORTED_TYPES = ['text', 'password', 'email'];\n\nexport type MaskVisibility = 'always' | 'onFocus' | 'never';\nexport type MaskDefinition = {\n mask: string;\n definitions?: Record<string, string | RegExp>;\n startsWith?: string;\n [key: string]: any;\n};\n\nexport type ClearableInputProps = {\n /**\n * Gives the input element the id.\n */\n id?: string;\n\n /**\n * Gives the input element a name.\n */\n name?: string;\n\n /**\n * The translated text that shall be shown when the input is empty.\n */\n placeholder?: string | React.ReactNode;\n\n /**\n * Defines the type of the input itself.\n *\n * There are three types supported:\n * `text`, `email`, `password`.\n *\n * @default 'text'\n */\n type?: 'text' | 'password' | 'email';\n\n /**\n * Initial value of the ClearableInput. Pass this prop if you want to use this\n * component as an uncontrolled component.\n */\n defaultValue?: string;\n\n /**\n * Value of the ClearableInput. Pass this prop if you want to use this\n * component as a controlled component.\n */\n value?: string;\n\n /**\n * Defines the maximum amount of characters that can be entered.\n */\n maxLength?: number;\n\n /**\n * Defines the tab index to be added to the input element.\n *\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Defined whether or not the input has the error styling.\n *\n * @default false\n */\n hasError?: boolean;\n\n /**\n * The callback ref for the underlying input. Alternatively, use can use a forward ref.\n */\n inputRef?: React.RefObject<HTMLInputElement>;\n\n /**\n * Sets autocomplete value for autosuggest forms.\n */\n autoComplete?: string;\n\n /**\n * Callback function for when the value changes. Receives new value as an argument.\n * @param newValue\n * @param event\n * @returns\n */\n onChange?: (\n newValue: string,\n event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLSpanElement>\n ) => void;\n\n /**\n * Callback function which gets triggered when the input looses the focus.\n * @param event\n * @returns\n */\n onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function which gets triggered when the input gains the focus.\n * @param event\n * @returns\n */\n onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function for when the value is cleared via the clear button.\n * @param event\n * @returns\n */\n onClear?: (event: React.MouseEvent<HTMLSpanElement>) => void;\n\n /**\n * Callback function for every key pressed including `Enter` key.\n * @param event\n * @returns\n */\n onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /**\n * Callback triggered when clicked into the input to react on it like when using an auto suggest dropdown\n * @param event\n * @returns\n */\n onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;\n\n /**\n * The mask prop will allow to use the component with an input mask.\n * It defines the pattern that should be followed.\n *\n * For more details on masking, checkout the third party documentation for the\n * input mask here: {@link https://imask.js.org/guide.html}\n *\n * Simple masks can be defined as strings.\n *\n * The following characters will define mask format:\n *\n * - \"0\" = allowed input: \"0-9\" (digit)\n * - \"a\" = allowed input: \"a-z, A-Z\" (letter)\n * - \"*\" = allowed input: any character\n * - \"#\" = allowed input: \"0-9, a-z, A-Z\" (digit or letter)\n *\n * Other chars which is not in custom definitions supposed to be fixed:\n *\n * - [] - make input optional\n * - {} - include fixed part in unmasked value\n * - ` - prevent symbols shift back\n *\n * If definition character should be treated as fixed it should be escaped by \\\\ (E.g. \\\\0).\n *\n * Additionally you can provide custom definitions.\n *\n * @example\n * '-- ### ### ###' or '+49 00 000 00'\n */\n mask?: string | (string | RegExp)[] | RegExp | DateConstructor | number | Function | MaskDefinition[];\n\n /**\n * Placeholder to cover unfilled parts of the mask.\n *\n * @default '_'\n */\n maskPlaceholder?: string | null;\n\n /**\n * Enable characters overwriting\n *\n * @default true\n */\n maskOverwrite?: boolean | 'shift' | undefined;\n\n /**\n * Chooses the mask for dynamic masking depending on input value.\n * Note, this function may not be an empty function, otherwise the mask selection won't work\n */\n maskDispatch?: (appended: string, dynamicMasked: any) => any;\n\n /**\n * Controls when the mask pattern is visible.\n *\n * - 'always': Mask is always visible\n * - 'onFocus': Mask is hidden but shown when input is focused\n * - 'never': Mask is never shown\n *\n * @default 'always'\n */\n maskVisibility?: MaskVisibility;\n\n /**\n * Custom definitions to have more control over your mask. The defined character will be replaced in your mask.\n *\n * @example\n * mask='AAA AAA.AA'\n * maskDefinitions={{ A: /[A-Z0-9]/ }}\n */\n maskDefinitions?: Record<string, string | RegExp>;\n\n /**\n * Minimum value to be entered. This prop is extended to accept a Date\n * when used with an input mask.\n */\n min?: string | number | undefined | Date;\n\n /**\n * Maximum value to be entered. This prop is extended to accept a Date\n * when used with an input mask.\n */\n max?: string | number | undefined | Date;\n\n /**\n * Disabled the input component.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Additional classes to be set on the input element.\n */\n inputClassName?: string;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n\n /**\n * Render-prop to customize the rendered input.\n *\n * The function gets the `inputProps` passed and is responsible for rendering the custom `<input>` component.\n *\n * Receives the computed `input` props so you can render your own field. See: {@link https://reactjs.org/docs/render-props.html}\n */\n children?: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactNode;\n};\n\nconst hasValue = (value: unknown) => !isEmpty(`${value}`);\n\nconst ClearableInput = forwardRef((props: ClearableInputProps, ref: ForwardedRef<HTMLInputElement>) => {\n const {\n type = DEFAULT_TYPE,\n defaultValue,\n value,\n maxLength,\n tabIndex = 0,\n hasError = false,\n inputRef,\n autoComplete,\n onChange = noop,\n onBlur = noop,\n onFocus = noop,\n onClear = noop,\n onKeyPress = noop,\n onClick = noop,\n mask,\n maskPlaceholder = '_',\n maskVisibility = 'always',\n maskOverwrite = true,\n maskDefinitions,\n maskDispatch,\n inputClassName = '',\n disabled = false,\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const initialValue = value || defaultValue || '';\n\n const [inputValue, setInputValue] = useState(initialValue);\n const [showClear, setShowClear] = useState(hasValue(initialValue));\n const [isFocused, setIsFocused] = useState(false);\n\n const isControlled = !isNil(value);\n\n const internalMaskRef = useRef<HTMLInputElement>(null);\n const mergedInternalMaskRef = useMergeRefs(internalMaskRef, inputRef, ref);\n\n const hasMask = !!mask;\n\n // Calculate if mask should be visible (lazy=false means visible, lazy=true means hidden)\n const shouldShowMask = () => {\n switch (maskVisibility) {\n case 'always':\n return true;\n case 'onFocus':\n return isFocused;\n case 'never':\n return false;\n default:\n return isFocused;\n }\n };\n\n // Handles new input value and saves it in the local state.\n // The value stored in the state is used for rendering.\n const changeInternalValue = (newValue = '') => {\n // this is there to prevent that onChange and UNSAFE_componentWillReceiveProps set state at the same time\n if (inputValue === newValue) {\n return;\n }\n\n setInputValue(newValue);\n setShowClear(hasValue(newValue));\n };\n\n // important for when used as a controlled component and value changes from the outside.\n const previousValue = usePrevious(value);\n if (previousValue !== value) {\n changeInternalValue(value);\n }\n\n // only gets triggered on user interaction.\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = event.target.value;\n\n if (isControlled) {\n onChange(newValue, event);\n } else {\n changeInternalValue(newValue);\n onChange(newValue, event);\n }\n };\n\n const handleAccept = (newValue: string, maskRef: any, event?: InputEvent) => {\n if (!internalMaskRef.current) {\n return;\n }\n\n // Simulate a ChangeEvent for backwards compatibility since react-imask does not return a change event itself\n const syntheticEvent = {\n target: internalMaskRef.current,\n currentTarget: internalMaskRef.current,\n // Standard synthetic event props\n bubbles: true,\n cancelable: true,\n defaultPrevented: false,\n isTrusted: true,\n preventDefault: () => {},\n stopPropagation: () => {},\n persist: () => {},\n nativeEvent: {} as any,\n type: 'change',\n timeStamp: Date.now(),\n } as unknown as React.ChangeEvent<HTMLInputElement>;\n\n // Set unmasked value manually if needed\n // (you can use data-attributes or attach it directly)\n (syntheticEvent.target as any).unmaskedValue = maskRef.unmaskedValue;\n\n if (isControlled) {\n onChange(newValue, syntheticEvent);\n } else {\n changeInternalValue(newValue);\n onChange(newValue, syntheticEvent);\n }\n };\n\n const handleInputFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true);\n onFocus(event);\n };\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false);\n onBlur(event);\n };\n\n // Will be triggered on every key press but also when pressing 'Enter' for example\n const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyPress(event);\n };\n\n const clearInputValue = (event: React.MouseEvent<HTMLSpanElement>) => {\n changeInternalValue('');\n onChange('', event);\n\n if (onClear) {\n onClear(event);\n }\n };\n\n const classes = classNames(\n 'ClearableInput',\n 'input-group',\n hasError && 'has-error',\n disabled && 'pointer-events-none',\n className && className\n );\n\n const inputClassNames = classNames(\n 'form-control',\n inputClassName,\n showClear && 'withClearButton',\n hasMask && 'withInputMask',\n disabled && 'disabled'\n );\n\n const clearButtonClassNames = classNames('clearButton', !showClear && 'hide');\n\n const convertedType = type?.toLowerCase();\n const inputType = SUPPORTED_TYPES.indexOf(convertedType) !== -1 ? convertedType : DEFAULT_TYPE;\n\n const inputProps = {\n ...omit(remainingProps, ['value', 'defaultValue', 'onClear']),\n className: inputClassNames,\n autoComplete,\n type: inputType,\n value: inputValue,\n onKeyPress: handleKeyPress,\n onBlur: handleInputBlur,\n onFocus: handleInputFocus,\n onChange: hasMask ? undefined : handleChange, // In case of masked input, the onAccept callback is used\n onClick,\n disabled,\n maxLength: hasMask ? undefined : maxLength,\n tabIndex,\n } as any;\n\n // The dispatch function may not be an empty function. Specify it when\n // using dynamic masking and need more control over which mask gets selected\n const maskDispatchObj: any = {};\n if (maskDispatch) {\n maskDispatchObj.dispatch = maskDispatch;\n }\n\n const input = hasMask ? (\n <IMaskInput\n {...inputProps}\n inputRef={mergedInternalMaskRef}\n mask={mask}\n definitions={maskDefinitions}\n {...maskDispatchObj}\n placeholderChar={maskPlaceholder}\n onAccept={handleAccept}\n lazy={!shouldShowMask()}\n overwrite={maskOverwrite}\n />\n ) : (\n <input {...inputProps} ref={inputRef || ref} />\n );\n\n return (\n <div className={classes}>\n {children && isFunction(children) ? children(inputProps) : input}\n <span className={clearButtonClassNames} onClick={clearInputValue}>\n <span className='clearButtonIcon rioglyph rioglyph-remove-sign' />\n </span>\n </div>\n );\n});\n\nexport default ClearableInput;\n"],"names":["DEFAULT_TYPE","SUPPORTED_TYPES","hasValue","value","isEmpty","ClearableInput","forwardRef","props","ref","type","defaultValue","maxLength","tabIndex","hasError","inputRef","autoComplete","onChange","noop","onBlur","onFocus","onClear","onKeyPress","onClick","mask","maskPlaceholder","maskVisibility","maskOverwrite","maskDefinitions","maskDispatch","inputClassName","disabled","className","children","remainingProps","initialValue","inputValue","setInputValue","useState","showClear","setShowClear","isFocused","setIsFocused","isControlled","isNil","internalMaskRef","useRef","mergedInternalMaskRef","useMergeRefs","hasMask","shouldShowMask","changeInternalValue","newValue","usePrevious","handleChange","event","handleAccept","maskRef","syntheticEvent","handleInputFocus","handleInputBlur","handleKeyPress","clearInputValue","classes","classNames","inputClassNames","clearButtonClassNames","convertedType","inputType","inputProps","omit","maskDispatchObj","input","jsx","IMaskInput","jsxs","isFunction"],"mappings":";;;;;;;;;AAWO,MAAMA,IAAe,QACfC,KAAkB,CAAC,QAAQ,YAAY,OAAO,GAyOrDC,IAAW,CAACC,MAAmB,CAACC,GAAQ,GAAGD,CAAK,EAAE,GAElDE,KAAiBC,GAAW,CAACC,GAA4BC,MAAwC;AACnG,QAAM;AAAA,IACF,M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ACpE;AAAA,EAAA,GACJ;AAER,CAAC;"}
@@ -2,6 +2,7 @@ import { PropsWithChildren } from 'react';
2
2
  type CollapseProps = {
3
3
  /**
4
4
  * Show the component and triggers the expand or collapse animation.
5
+ *
5
6
  * @default false
6
7
  */
7
8
  open: boolean | undefined;
@@ -11,11 +12,13 @@ type CollapseProps = {
11
12
  unmountOnExit?: boolean;
12
13
  /**
13
14
  * Run the expand animation when the component mounts, if it is initially shown.
15
+ *
14
16
  * @default false
15
17
  */
16
18
  appear?: boolean;
17
19
  /**
18
20
  * Duration of the collapse animation in milliseconds.
21
+ *
19
22
  * @default 270
20
23
  */
21
24
  timeout?: number;
@@ -1,27 +1,27 @@
1
- import { jsx as t, Fragment as u } from "react/jsx-runtime";
2
- import { AnimatePresence as I, motion as x } from "motion/react";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { AnimatePresence as u, motion as I } from "motion/react";
3
3
  import { noop as o } from "es-toolkit/function";
4
- const E = 200, _ = (a) => {
4
+ const x = 200, S = (a) => {
5
5
  const {
6
- open: n = !1,
6
+ open: t = !1,
7
7
  unmountOnExit: i = !1,
8
8
  appear: l = !1,
9
- timeout: s = E,
9
+ timeout: s = x,
10
10
  onEntered: p = o,
11
11
  onExited: c = o,
12
12
  onAnimationStart: m = o,
13
13
  children: r
14
- } = a, d = !i, h = () => m(), A = (e) => {
15
- e === "open" && p(), e === "collapsed" && c();
14
+ } = a, d = !i, h = () => m(), A = (n) => {
15
+ n === "open" && p(), n === "collapsed" && c();
16
16
  }, f = {
17
17
  open: { opacity: 1, height: "auto" },
18
18
  collapsed: { opacity: 0, height: 0 }
19
19
  };
20
- return /* @__PURE__ */ t(u, { children: /* @__PURE__ */ t(I, { initial: l, mode: "wait", children: (n || d) && /* @__PURE__ */ t(
21
- x.div,
20
+ return /* @__PURE__ */ e(u, { initial: l, mode: "wait", children: (t || d) && /* @__PURE__ */ e(
21
+ I.div,
22
22
  {
23
23
  initial: "collapsed",
24
- animate: n ? "open" : "collapsed",
24
+ animate: t ? "open" : "collapsed",
25
25
  exit: "collapsed",
26
26
  className: "collapse display-block width-100pct",
27
27
  variants: f,
@@ -31,9 +31,9 @@ const E = 200, _ = (a) => {
31
31
  children: r
32
32
  },
33
33
  "content"
34
- ) }) });
34
+ ) });
35
35
  };
36
36
  export {
37
- _ as default
37
+ S as default
38
38
  };
39
39
  //# sourceMappingURL=Collapse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Collapse.js","sources":["../../../src/components/collapse/Collapse.tsx"],"sourcesContent":["// biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains\nimport { type PropsWithChildren } from 'react';\nimport { motion, AnimatePresence, type AnimationDefinition } from 'motion/react';\nimport { noop } from 'es-toolkit/function';\n\nconst DEFAULT_ANIMATION_TIME_IN_MS = 200;\n\ntype CollapseProps = {\n /**\n * Show the component and triggers the expand or collapse animation.\n * @default false\n */\n open: boolean | undefined;\n\n /**\n * Unmount the component (remove it from the DOM) when it is collapsed.\n */\n unmountOnExit?: boolean;\n\n /**\n * Run the expand animation when the component mounts, if it is initially shown.\n * @default false\n */\n appear?: boolean;\n\n /**\n * Duration of the collapse animation in milliseconds.\n * @default 270\n */\n timeout?: number;\n\n /**\n * Callback fired after the component has expanded.\n * @returns\n */\n onEntered?: () => void;\n\n /**\n * Callback fired after the component has collapsed.\n * @returns\n */\n onExited?: () => void;\n\n /**\n * Callback fired when the animation starts for either expand or collapse.\n */\n onAnimationStart?: () => void;\n};\n\nconst Collapse = (props: PropsWithChildren<CollapseProps>) => {\n const {\n open = false,\n unmountOnExit = false,\n appear = false,\n timeout = DEFAULT_ANIMATION_TIME_IN_MS,\n onEntered = noop,\n onExited = noop,\n onAnimationStart = noop,\n children,\n } = props;\n\n const shouldKeepContentInDom = !unmountOnExit;\n\n const handleAnimationStart = () => onAnimationStart();\n const handleAnimationComplete = (definition: AnimationDefinition) => {\n if (definition === 'open') {\n onEntered();\n }\n if (definition === 'collapsed') {\n onExited();\n }\n };\n\n const variants = {\n open: { opacity: 1, height: 'auto' },\n collapsed: { opacity: 0, height: 0 },\n };\n\n return (\n <>\n <AnimatePresence initial={appear} mode='wait'>\n {(open || shouldKeepContentInDom) && (\n <motion.div\n key='content'\n initial='collapsed'\n animate={open ? 'open' : 'collapsed'}\n exit='collapsed'\n className='collapse display-block width-100pct'\n variants={variants}\n transition={{ duration: timeout / 1000, ease: 'easeIn' }}\n onAnimationComplete={handleAnimationComplete}\n onAnimationStart={handleAnimationStart}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n </>\n );\n};\n//\n\nexport default Collapse;\n"],"names":["DEFAULT_ANIMATION_TIME_IN_MS","Collapse","props","open","unmountOnExit","appear","timeout","onEntered","noop","onExited","onAnimationStart","children","shouldKeepContentInDom","handleAnimationStart","handleAnimationComplete","definition","variants","jsx","Fragment","AnimatePresence","motion"],"mappings":";;;AAKA,MAAMA,IAA+B,KA4C/BC,IAAW,CAACC,MAA4C;AAC1D,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,eAAAC,IAAgB;AAAA,IAChB,QAAAC,IAAS;AAAA,IACT,SAAAC,IAAUN;AAAA,IACV,WAAAO,IAAYC;AAAA,IACZ,UAAAC,IAAWD;AAAA,IACX,kBAAAE,IAAmBF;AAAA,IACnB,UAAAG;AAAA,EAAA,IACAT,GAEEU,IAAyB,CAACR,GAE1BS,IAAuB,MAAMH,EAAA,GAC7BI,IAA0B,CAACC,MAAoC;AACjE,IAAIA,MAAe,UACfR,EAAA,GAEAQ,MAAe,eACfN,EAAA;AAAA,EAER,GAEMO,IAAW;AAAA,IACb,MAAM,EAAE,SAAS,GAAG,QAAQ,OAAA;AAAA,IAC5B,WAAW,EAAE,SAAS,GAAG,QAAQ,EAAA;AAAA,EAAE;AAGvC,SACI,gBAAAC,EAAAC,GAAA,EACI,4BAACC,GAAA,EAAgB,SAASd,GAAQ,MAAK,QACjC,gBAAQO,MACN,gBAAAK;AAAA,IAACG,EAAO;AAAA,IAAP;AAAA,MAEG,SAAQ;AAAA,MACR,SAASjB,IAAO,SAAS;AAAA,MACzB,MAAK;AAAA,MACL,WAAU;AAAA,MACV,UAAAa;AAAA,MACA,YAAY,EAAE,UAAUV,IAAU,KAAM,MAAM,SAAA;AAAA,MAC9C,qBAAqBQ;AAAA,MACrB,kBAAkBD;AAAA,MAEjB,UAAAF;AAAA,IAAA;AAAA,IAVG;AAAA,EAAA,GAahB,EAAA,CACJ;AAER;"}
1
+ {"version":3,"file":"Collapse.js","sources":["../../../src/components/collapse/Collapse.tsx"],"sourcesContent":["// biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains\nimport { type PropsWithChildren } from 'react';\nimport { motion, AnimatePresence, type AnimationDefinition } from 'motion/react';\nimport { noop } from 'es-toolkit/function';\n\nconst DEFAULT_ANIMATION_TIME_IN_MS = 200;\n\ntype CollapseProps = {\n /**\n * Show the component and triggers the expand or collapse animation.\n *\n * @default false\n */\n open: boolean | undefined;\n\n /**\n * Unmount the component (remove it from the DOM) when it is collapsed.\n */\n unmountOnExit?: boolean;\n\n /**\n * Run the expand animation when the component mounts, if it is initially shown.\n *\n * @default false\n */\n appear?: boolean;\n\n /**\n * Duration of the collapse animation in milliseconds.\n *\n * @default 270\n */\n timeout?: number;\n\n /**\n * Callback fired after the component has expanded.\n * @returns\n */\n onEntered?: () => void;\n\n /**\n * Callback fired after the component has collapsed.\n * @returns\n */\n onExited?: () => void;\n\n /**\n * Callback fired when the animation starts for either expand or collapse.\n */\n onAnimationStart?: () => void;\n};\n\nconst Collapse = (props: PropsWithChildren<CollapseProps>) => {\n const {\n open = false,\n unmountOnExit = false,\n appear = false,\n timeout = DEFAULT_ANIMATION_TIME_IN_MS,\n onEntered = noop,\n onExited = noop,\n onAnimationStart = noop,\n children,\n } = props;\n\n const shouldKeepContentInDom = !unmountOnExit;\n\n const handleAnimationStart = () => onAnimationStart();\n const handleAnimationComplete = (definition: AnimationDefinition) => {\n if (definition === 'open') {\n onEntered();\n }\n if (definition === 'collapsed') {\n onExited();\n }\n };\n\n const variants = {\n open: { opacity: 1, height: 'auto' },\n collapsed: { opacity: 0, height: 0 },\n };\n\n return (\n <AnimatePresence initial={appear} mode='wait'>\n {(open || shouldKeepContentInDom) && (\n <motion.div\n key='content'\n initial='collapsed'\n animate={open ? 'open' : 'collapsed'}\n exit='collapsed'\n className='collapse display-block width-100pct'\n variants={variants}\n transition={{ duration: timeout / 1000, ease: 'easeIn' }}\n onAnimationComplete={handleAnimationComplete}\n onAnimationStart={handleAnimationStart}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n );\n};\n//\n\nexport default Collapse;\n"],"names":["DEFAULT_ANIMATION_TIME_IN_MS","Collapse","props","open","unmountOnExit","appear","timeout","onEntered","noop","onExited","onAnimationStart","children","shouldKeepContentInDom","handleAnimationStart","handleAnimationComplete","definition","variants","AnimatePresence","jsx","motion"],"mappings":";;;AAKA,MAAMA,IAA+B,KA+C/BC,IAAW,CAACC,MAA4C;AAC1D,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,eAAAC,IAAgB;AAAA,IAChB,QAAAC,IAAS;AAAA,IACT,SAAAC,IAAUN;AAAA,IACV,WAAAO,IAAYC;AAAA,IACZ,UAAAC,IAAWD;AAAA,IACX,kBAAAE,IAAmBF;AAAA,IACnB,UAAAG;AAAA,EAAA,IACAT,GAEEU,IAAyB,CAACR,GAE1BS,IAAuB,MAAMH,EAAA,GAC7BI,IAA0B,CAACC,MAAoC;AACjE,IAAIA,MAAe,UACfR,EAAA,GAEAQ,MAAe,eACfN,EAAA;AAAA,EAER,GAEMO,IAAW;AAAA,IACb,MAAM,EAAE,SAAS,GAAG,QAAQ,OAAA;AAAA,IAC5B,WAAW,EAAE,SAAS,GAAG,QAAQ,EAAA;AAAA,EAAE;AAGvC,2BACKC,GAAA,EAAgB,SAASZ,GAAQ,MAAK,QACjC,gBAAQO,MACN,gBAAAM;AAAA,IAACC,EAAO;AAAA,IAAP;AAAA,MAEG,SAAQ;AAAA,MACR,SAAShB,IAAO,SAAS;AAAA,MACzB,MAAK;AAAA,MACL,WAAU;AAAA,MACV,UAAAa;AAAA,MACA,YAAY,EAAE,UAAUV,IAAU,KAAM,MAAM,SAAA;AAAA,MAC9C,qBAAqBQ;AAAA,MACrB,kBAAkBD;AAAA,MAEjB,UAAAF;AAAA,IAAA;AAAA,IAVG;AAAA,EAAA,GAahB;AAER;"}
@@ -4,21 +4,25 @@ declare const CIRCLE = "circle";
4
4
  export type ContentLoaderProps = {
5
5
  /**
6
6
  * Sets the animation speed.
7
+ *
7
8
  * @default 2
8
9
  */
9
10
  speed?: number;
10
11
  /**
11
12
  * Sets the height of the svg element.
13
+ *
12
14
  * @default 14
13
15
  */
14
16
  height?: string | number;
15
17
  /**
16
18
  * Sets the width of the svg element.
19
+ *
17
20
  * @default 100%
18
21
  */
19
22
  width?: string | number;
20
23
  /**
21
24
  * Sets the radius of the svg element. Only relevant for circle elements.
25
+ *
22
26
  * @default 16
23
27
  */
24
28
  radius?: number;
@@ -33,9 +37,13 @@ export type ContentLoaderProps = {
33
37
  * Additional class names to ab added to the wrapping svg element.
34
38
  */
35
39
  className?: string;
36
- /** Rect object prop. Used internally. */
40
+ /**
41
+ * Rect object prop. Used internally.
42
+ */
37
43
  rx?: number;
38
- /** Rect object prop. Used internally. */
44
+ /**
45
+ * Rect object prop. Used internally.
46
+ */
39
47
  ry?: number;
40
48
  };
41
49
  type ContentLoaderPropsWithChildren = PropsWithChildren<ContentLoaderProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"ContentLoader.js","sources":["../../../src/components/contentLoader/ContentLoader.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport { default as _ContentLoader } from 'react-content-loader';\nimport { isNil } from 'es-toolkit/predicate';\nimport { cond } from 'es-toolkit/compat';\n\nimport useDarkMode from '../../hooks/useDarkMode';\n\nconst RECT = 'rect';\nconst CIRCLE = 'circle';\n\nconst DEFAULT_SPEED = 2;\nconst DEFAULT_HEIGHT = 14;\nconst DEFAULT_WIDTH = '100%';\nconst DEFAULT_RADIUS = 16;\nconst DEFAULT_TYPE = RECT;\n\nexport type ContentLoaderProps = {\n /**\n * Sets the animation speed.\n * @default 2\n */\n speed?: number;\n /**\n * Sets the height of the svg element.\n * @default 14\n */\n height?: string | number;\n /**\n * Sets the width of the svg element.\n * @default 100%\n */\n width?: string | number;\n /**\n * Sets the radius of the svg element. Only relevant for circle elements.\n * @default 16\n */\n radius?: number;\n /**\n * Renders either a rectangle or circle.\n *\n * Possible values are:\n * `ContentLoader.RECT`, `ContentLoader.CIRCLE` or `rect`, `circle`\n */\n type?: typeof RECT | typeof CIRCLE;\n /**\n * Additional class names to ab added to the wrapping svg element.\n */\n className?: string;\n /** Rect object prop. Used internally. */\n rx?: number;\n /** Rect object prop. Used internally. */\n ry?: number;\n};\n\ntype ContentLoaderPropsWithChildren = PropsWithChildren<ContentLoaderProps>;\n\nconst hasChildren = ({ children }: ContentLoaderPropsWithChildren) => !isNil(children);\nconst renderChildren = ({ children }: ContentLoaderPropsWithChildren) => children;\n\nconst isRect = ({ type }: ContentLoaderPropsWithChildren) => type === RECT;\nconst isCircle = ({ type }: ContentLoaderPropsWithChildren) => type === CIRCLE;\n\nconst renderRect = ({ rx = 3, ry = 3 }: ContentLoaderPropsWithChildren) => (\n <rect width='100%' height='100%' rx={rx} ry={ry} />\n);\nconst renderCircle = ({ radius }: ContentLoaderPropsWithChildren) => <circle cx={radius} cy={radius} r={radius} />;\n\n/**\n * This UIKIT component is simple wrapper to make it easier to use with a predefined look and feel. It still\n * allows for more complex configurations as all additional props are passed down to the third-party\n * ContentLoader component. For individual customization, it allows passing svg components as rect or circle\n * directly as children.\n * @param props\n * @returns\n */\nconst ContentLoader = (props: ContentLoaderPropsWithChildren) => {\n const {\n speed = DEFAULT_SPEED,\n width = DEFAULT_WIDTH,\n height = DEFAULT_HEIGHT,\n radius = DEFAULT_RADIUS,\n type = DEFAULT_TYPE,\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const isDarkMode = useDarkMode();\n\n // Since we define the default values while destructuring the props, we have to build up a new object\n // with that defaults to be used in the conditional rendering, otherwise it would use only the props as\n // passed into the component without the defined defaults.\n const propsWithDefaults = {\n type,\n radius,\n children,\n } as ContentLoaderPropsWithChildren;\n\n const content = cond([\n [hasChildren, renderChildren],\n [isRect, renderRect],\n [isCircle, renderCircle],\n ])(propsWithDefaults);\n\n const wrapperHeight = isCircle(propsWithDefaults) ? radius * 2 : height;\n const wrapperWidth = isCircle(propsWithDefaults) ? wrapperHeight : width;\n\n return (\n <_ContentLoader\n backgroundColor='#f5f6f7'\n foregroundColor={isDarkMode ? '#aaaaaa' : '#eeeeee'}\n speed={speed}\n height={wrapperHeight}\n width={wrapperWidth}\n className={`ContentLoader ${className} ${isDarkMode ? 'use-mix-blend-mode' : ''}`}\n {...remainingProps}\n >\n {content}\n </_ContentLoader>\n );\n};\n\nContentLoader.RECT = RECT as typeof RECT;\nContentLoader.CIRCLE = CIRCLE as typeof CIRCLE;\n\nexport default ContentLoader;\n"],"names":["RECT","CIRCLE","DEFAULT_SPEED","DEFAULT_HEIGHT","DEFAULT_WIDTH","DEFAULT_RADIUS","DEFAULT_TYPE","hasChildren","children","isNil","renderChildren","isRect","type","isCircle","renderRect","rx","ry","jsx","renderCircle","radius","ContentLoader","props","speed","width","height","className","remainingProps","isDarkMode","useDarkMode","propsWithDefaults","content","cond","wrapperHeight","wrapperWidth","_ContentLoader"],"mappings":";;;;;AAOA,MAAMA,IAAO,QACPC,IAAS,UAETC,IAAgB,GAChBC,IAAiB,IACjBC,IAAgB,QAChBC,IAAiB,IACjBC,IAAeN,GA0CfO,IAAc,CAAC,EAAE,UAAAC,QAA+C,CAACC,EAAMD,CAAQ,GAC/EE,IAAiB,CAAC,EAAE,UAAAF,EAAA,MAA+CA,GAEnEG,IAAS,CAAC,EAAE,MAAAC,EAAA,MAA2CA,MAASZ,GAChEa,IAAW,CAAC,EAAE,MAAAD,EAAA,MAA2CA,MAASX,GAEl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../src/components/contentLoader/ContentLoader.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport { default as _ContentLoader } from 'react-content-loader';\nimport { isNil } from 'es-toolkit/predicate';\nimport { cond } from 'es-toolkit/compat';\n\nimport useDarkMode from '../../hooks/useDarkMode';\n\nconst RECT = 'rect';\nconst CIRCLE = 'circle';\n\nconst DEFAULT_SPEED = 2;\nconst DEFAULT_HEIGHT = 14;\nconst DEFAULT_WIDTH = '100%';\nconst DEFAULT_RADIUS = 16;\nconst DEFAULT_TYPE = RECT;\n\nexport type ContentLoaderProps = {\n /**\n * Sets the animation speed.\n *\n * @default 2\n */\n speed?: number;\n\n /**\n * Sets the height of the svg element.\n *\n * @default 14\n */\n height?: string | number;\n\n /**\n * Sets the width of the svg element.\n *\n * @default 100%\n */\n width?: string | number;\n\n /**\n * Sets the radius of the svg element. Only relevant for circle elements.\n *\n * @default 16\n */\n radius?: number;\n\n /**\n * Renders either a rectangle or circle.\n *\n * Possible values are:\n * `ContentLoader.RECT`, `ContentLoader.CIRCLE` or `rect`, `circle`\n */\n type?: typeof RECT | typeof CIRCLE;\n\n /**\n * Additional class names to ab added to the wrapping svg element.\n */\n className?: string;\n\n /**\n * Rect object prop. Used internally.\n */\n rx?: number;\n\n /**\n * Rect object prop. Used internally.\n */\n ry?: number;\n};\n\ntype ContentLoaderPropsWithChildren = PropsWithChildren<ContentLoaderProps>;\n\nconst hasChildren = ({ children }: ContentLoaderPropsWithChildren) => !isNil(children);\nconst renderChildren = ({ children }: ContentLoaderPropsWithChildren) => children;\n\nconst isRect = ({ type }: ContentLoaderPropsWithChildren) => type === RECT;\nconst isCircle = ({ type }: ContentLoaderPropsWithChildren) => type === CIRCLE;\n\nconst renderRect = ({ rx = 3, ry = 3 }: ContentLoaderPropsWithChildren) => (\n <rect width='100%' height='100%' rx={rx} ry={ry} />\n);\n\nconst renderCircle = ({ radius }: ContentLoaderPropsWithChildren) => <circle cx={radius} cy={radius} r={radius} />;\n\n/**\n * This UIKIT component is simple wrapper to make it easier to use with a predefined look and feel. It still\n * allows for more complex configurations as all additional props are passed down to the third-party\n * ContentLoader component. For individual customization, it allows passing svg components as rect or circle\n * directly as children.\n * @param props\n * @returns\n */\nconst ContentLoader = (props: ContentLoaderPropsWithChildren) => {\n const {\n speed = DEFAULT_SPEED,\n width = DEFAULT_WIDTH,\n height = DEFAULT_HEIGHT,\n radius = DEFAULT_RADIUS,\n type = DEFAULT_TYPE,\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const isDarkMode = useDarkMode();\n\n // Since we define the default values while destructuring the props, we have to build up a new object\n // with that defaults to be used in the conditional rendering, otherwise it would use only the props as\n // passed into the component without the defined defaults.\n const propsWithDefaults = {\n type,\n radius,\n children,\n } as ContentLoaderPropsWithChildren;\n\n const content = cond([\n [hasChildren, renderChildren],\n [isRect, renderRect],\n [isCircle, renderCircle],\n ])(propsWithDefaults);\n\n const wrapperHeight = isCircle(propsWithDefaults) ? radius * 2 : height;\n const wrapperWidth = isCircle(propsWithDefaults) ? wrapperHeight : width;\n\n return (\n <_ContentLoader\n backgroundColor='#f5f6f7'\n foregroundColor={isDarkMode ? '#aaaaaa' : '#eeeeee'}\n speed={speed}\n height={wrapperHeight}\n width={wrapperWidth}\n className={`ContentLoader ${className} ${isDarkMode ? 'use-mix-blend-mode' : ''}`}\n {...remainingProps}\n >\n {content}\n </_ContentLoader>\n );\n};\n\nContentLoader.RECT = RECT as typeof RECT;\nContentLoader.CIRCLE = CIRCLE as typeof CIRCLE;\n\nexport default ContentLoader;\n"],"names":["RECT","CIRCLE","DEFAULT_SPEED","DEFAULT_HEIGHT","DEFAULT_WIDTH","DEFAULT_RADIUS","DEFAULT_TYPE","hasChildren","children","isNil","renderChildren","isRect","type","isCircle","renderRect","rx","ry","jsx","renderCircle","radius","ContentLoader","props","speed","width","height","className","remainingProps","isDarkMode","useDarkMode","propsWithDefaults","content","cond","wrapperHeight","wrapperWidth","_ContentLoader"],"mappings":";;;;;AAOA,MAAMA,IAA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AAgB;AAAA,MAChB,iBAAiBP,IAAa,YAAY;AAAA,MAC1C,OAAAL;AAAA,MACA,QAAQU;AAAA,MACR,OAAOC;AAAA,MACP,WAAW,iBAAiBR,CAAS,IAAIE,IAAa,uBAAuB,EAAE;AAAA,MAC9E,GAAGD;AAAA,MAEH,UAAAI;AAAA,IAAA;AAAA,EAAA;AAGb;AAEAV,EAAc,OAAOpB;AACrBoB,EAAc,SAASnB;"}
@@ -33,6 +33,8 @@ export type DataTabsProps = {
33
33
  disableTransition?: boolean;
34
34
  /**
35
35
  * Additional classes to be set on the arrow.
36
+ *
37
+ * @default 'bg-highlight-dark border-color-transparent'
36
38
  */
37
39
  arrowClassName?: string;
38
40
  /**
@@ -47,10 +49,14 @@ export type DataTabsProps = {
47
49
  tabClassName?: string;
48
50
  /**
49
51
  * Utility hover classes to be set on the tab element.
52
+ *
53
+ * @default 'bg-highlight-decent text-color-darkest'
50
54
  */
51
55
  tabHoverClassName?: string;
52
56
  /**
53
57
  * Utility active classes to be set on the tab element.
58
+ *
59
+ * @default 'bg-highlight-dark text-color-white'
54
60
  */
55
61
  tabActiveClassName?: string;
56
62
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DataTabs.js","sources":["../../../src/components/dataTabs/DataTabs.tsx"],"sourcesContent":["import React, { type PropsWithChildren, useState } from 'react';\nimport classNames from 'classnames';\nimport { AnimatePresence } from 'motion/react';\n\nimport type { DataTabProps } from './DataTab';\nimport DataTabHeader from './DataTabHeader';\n\ntype DataTabElement = React.ReactElement<DataTabProps>;\n\nconst getFirstTabKey = (children: React.ReactNode): string => {\n const [firstItem] = children as DataTabElement[];\n return firstItem?.props.tabKey;\n};\n\nexport type DataTabsProps = {\n /**\n * Sets key and id.\n *\n * @default ''\n */\n activeKey?: string;\n\n /**\n * Whether the component should add a border.\n *\n * @default true\n */\n bordered?: boolean;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n\n /**\n * Tab content that is used for all tabs.\n *\n * Using a common tab content will ignore any DataTab child. Additionally, there will be no transition when\n * switching tabs as it is a single tab content component.\n */\n commonTabContent?: React.ReactNode;\n\n /**\n * Transitions between tab contents are enabled by default. Set if you want to disable them.\n *\n * The Navigation tabs will still remain animated.\n *\n * @default false\n */\n disableTransition?: boolean;\n\n /**\n * Additional classes to be set on the arrow.\n */\n arrowClassName?: string;\n\n /**\n * Called when a tab is being activated.\n *\n * @param tabKey Of the activated tab.\n */\n onSelectTab?: (tabKey: string) => void;\n\n /**\n * Additional classes to be set on the tab element.\n */\n tabClassName?: string;\n\n /**\n * Utility hover classes to be set on the tab element.\n */\n tabHoverClassName?: string;\n\n /**\n * Utility active classes to be set on the tab element.\n */\n tabActiveClassName?: string;\n\n /**\n * Utility first-child classes to be set on the tab element.\n */\n tabFirstChildClassName?: string;\n\n /**\n * Utility last-child classes to be set on the tab element.\n */\n tabLastChildClassName?: string;\n\n /**\n * Utility content classes to be set on the tab element.\n */\n tabContentClassName?: string;\n\n /**\n * Additional classes to be set on the tabs wrapper element.\n */\n tabsWrapperClassName?: string;\n\n /**\n * Whether the layout should be vertical.\n *\n * @default false\n */\n vertical?: boolean;\n};\n\nconst DataTabs = (props: PropsWithChildren<DataTabsProps>) => {\n const {\n activeKey = '',\n bordered = true,\n className: wrapperClassName,\n commonTabContent,\n disableTransition = false,\n arrowClassName = 'bg-highlight-dark border-color-transparent',\n onSelectTab = () => {},\n tabActiveClassName = 'bg-highlight-dark text-color-white',\n tabClassName = '',\n tabContentClassName = '',\n tabFirstChildClassName = '',\n tabHoverClassName = 'bg-highlight-decent text-color-darkest',\n tabLastChildClassName = '',\n tabsWrapperClassName = '',\n vertical = false,\n children,\n ...remainingProps\n } = props;\n\n const [internalActiveKey, setInternalActiveKey] = useState(\n activeKey || getFirstTabKey(React.Children.toArray(children))\n );\n\n // Update internal activeKey when props change\n const [previousActiveKey, setPreviousActiveKey] = useState(activeKey);\n if (activeKey !== previousActiveKey) {\n activeKey && setInternalActiveKey(activeKey);\n setPreviousActiveKey(activeKey);\n }\n\n const handleSelectTab = (event: React.MouseEvent<HTMLLIElement>) => {\n onSelectTab(event.currentTarget?.getAttribute('data-tabkey') as string);\n };\n\n const wrapperClassNames = classNames(\n 'DataTabsContainer',\n bordered && 'DataTab-bordered',\n wrapperClassName,\n vertical ? 'DataTabs-vertical' : 'DataTabs-horizontal'\n );\n\n const enrichChildren = () => {\n if (disableTransition) {\n return React.Children.map(children as DataTabElement[], child => {\n if (!child) {\n return null;\n }\n return React.cloneElement(child, {\n active: child.props.tabKey === internalActiveKey,\n disableTransition,\n });\n });\n }\n\n const enhancedChildren = (React.Children.toArray(children) as DataTabElement[])\n .filter(child => child.props.tabKey === internalActiveKey)\n .map(child => React.cloneElement(child, { active: true, disableTransition }));\n\n return (\n <AnimatePresence initial={false} mode='wait'>\n {enhancedChildren}\n </AnimatePresence>\n );\n };\n\n return (\n <div {...remainingProps} className={wrapperClassNames}>\n <div className={`DataTabsWrapper ${tabsWrapperClassName}`}>\n <ul className='DataTabs' role='tabList'>\n {React.Children.map(children as DataTabElement[], (child, index) => {\n if (!child) {\n return null;\n }\n\n const { tabKey, title, className } = child.props;\n\n return (\n <DataTabHeader\n isActive={tabKey === internalActiveKey}\n tabKey={tabKey}\n title={title}\n onSelectTab={handleSelectTab}\n isFirstTab={index === 0}\n isLastTab={!!((children as DataTabElement[])?.length - 1)}\n tabFirstChildClassName={tabFirstChildClassName}\n tabLastChildClassName={tabLastChildClassName}\n tabActiveClassName={tabActiveClassName}\n tabClassName={tabClassName}\n tabHoverClassName={tabHoverClassName}\n arrowClassName={arrowClassName}\n className={className}\n />\n );\n })}\n </ul>\n </div>\n <div className={`tab-content ${tabContentClassName}`} role='tabpanel'>\n {commonTabContent ? commonTabContent : enrichChildren()}\n </div>\n </div>\n );\n};\n\nexport default DataTabs;\n"],"names":["getFirstTabKey","children","firstItem","DataTabs","props","activeKey","bordered","wrapperClassName","commonTabContent","disableTransition","arrowClassName","onSelectTab","tabActiveClassName","tabClassName","tabContentClassName","tabFirstChildClassName","tabHoverClassName","tabLastChildClassName","tabsWrapperClassName","vertical","remainingProps","internalActiveKey","setInternalActiveKey","useState","React","previousActiveKey","setPreviousActiveKey","handleSelectTab","event","wrapperClassNames","classNames","enrichChildren","child","enhancedChildren","AnimatePresence","jsxs","jsx","index","tabKey","title","className","DataTabHeader"],"mappings":";;;;;AASA,MAAMA,IAAiB,CAACC,MAAsC;AAC1D,QAAM,CAACC,CAAS,IAAID;AACpB,SAAOC,GAAW,MAAM;AAC5B,GA8FMC,IAAW,CAACC,MAA4C;AAC1D,QAAM;AAAA,IACF,WAAAC,IAAY;AAAA,IACZ,UAAAC,IAAW;AAAA,IACX,WAAWC;AAAA,IACX,kBAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,gBAAAC,IAAiB;AAAA,IACjB,aAAAC,IAAc,MAAM;AAAA,IAAC;AAAA,IACrB,oBAAAC,IAAqB;AAAA,IACrB,cAAAC,IAAe;AAAA,IACf,qBAAAC,IAAsB;AAAA,IACtB,wBAAAC,IAAyB;AAAA,IACzB,mBAAAC,IAAoB;AAAA,IACpB,uBAAAC,IAAwB;AAAA,IACxB,sBAAAC,IAAuB;AAAA,IACvB,UAAAC,IAAW;AAAA,IACX,UAAAlB;AAAA,IACA,GAAGmB;AAAA,EAAA,IACHhB,GAEE,CAACiB,GAAmBC,CAAoB,IAAIC;AAAA,IAC9ClB,KAAaL,EAAewB,EAAM,SAAS,QAAQvB,CAAQ,CAAC;AAAA,EAAA,GAI1D,CAACwB,GAAmBC,CAAoB,IAAIH,EAASlB,CAAS;AACpE,EAAIA,MAAcoB,MACdpB,KAAaiB,EAAqBjB,CAAS,GAC3CqB,EAAqBrB,CAAS;AAGlC,QAAMsB,IAAkB,CAACC,MAA2C;AAChE,IAAAjB,EAAYiB,EAAM,eAAe,aAAa,aAAa,CAAW;AAAA,EAC1E,GAEMC,IAAoBC;AAAA,IACtB;AAAA,IACAxB,KAAY;AAAA,IACZC;AAAA,IACAY,IAAW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ACA,gBAAAJ,EAAC,OAAA,EAAI,WAAW,eAAetB,CAAmB,IAAI,MAAK,YACtD,UAAAN,KAAsCuB,EAAA,EAAe,CAC1D;AAAA,EAAA,GACJ;AAER;"}
1
+ {"version":3,"file":"DataTabs.js","sources":["../../../src/components/dataTabs/DataTabs.tsx"],"sourcesContent":["import React, { type PropsWithChildren, useState } from 'react';\nimport classNames from 'classnames';\nimport { AnimatePresence } from 'motion/react';\n\nimport type { DataTabProps } from './DataTab';\nimport DataTabHeader from './DataTabHeader';\n\ntype DataTabElement = React.ReactElement<DataTabProps>;\n\nconst getFirstTabKey = (children: React.ReactNode): string => {\n const [firstItem] = children as DataTabElement[];\n return firstItem?.props.tabKey;\n};\n\nexport type DataTabsProps = {\n /**\n * Sets key and id.\n *\n * @default ''\n */\n activeKey?: string;\n\n /**\n * Whether the component should add a border.\n *\n * @default true\n */\n bordered?: boolean;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n\n /**\n * Tab content that is used for all tabs.\n *\n * Using a common tab content will ignore any DataTab child. Additionally, there will be no transition when\n * switching tabs as it is a single tab content component.\n */\n commonTabContent?: React.ReactNode;\n\n /**\n * Transitions between tab contents are enabled by default. Set if you want to disable them.\n *\n * The Navigation tabs will still remain animated.\n *\n * @default false\n */\n disableTransition?: boolean;\n\n /**\n * Additional classes to be set on the arrow.\n *\n * @default 'bg-highlight-dark border-color-transparent'\n */\n arrowClassName?: string;\n\n /**\n * Called when a tab is being activated.\n *\n * @param tabKey Of the activated tab.\n */\n onSelectTab?: (tabKey: string) => void;\n\n /**\n * Additional classes to be set on the tab element.\n */\n tabClassName?: string;\n\n /**\n * Utility hover classes to be set on the tab element.\n *\n * @default 'bg-highlight-decent text-color-darkest'\n */\n tabHoverClassName?: string;\n\n /**\n * Utility active classes to be set on the tab element.\n *\n * @default 'bg-highlight-dark text-color-white'\n */\n tabActiveClassName?: string;\n\n /**\n * Utility first-child classes to be set on the tab element.\n */\n tabFirstChildClassName?: string;\n\n /**\n * Utility last-child classes to be set on the tab element.\n */\n tabLastChildClassName?: string;\n\n /**\n * Utility content classes to be set on the tab element.\n */\n tabContentClassName?: string;\n\n /**\n * Additional classes to be set on the tabs wrapper element.\n */\n tabsWrapperClassName?: string;\n\n /**\n * Whether the layout should be vertical.\n *\n * @default false\n */\n vertical?: boolean;\n};\n\nconst DataTabs = (props: PropsWithChildren<DataTabsProps>) => {\n const {\n activeKey = '',\n bordered = true,\n className: wrapperClassName,\n commonTabContent,\n disableTransition = false,\n arrowClassName = 'bg-highlight-dark border-color-transparent',\n onSelectTab = () => {},\n tabActiveClassName = 'bg-highlight-dark text-color-white',\n tabClassName = '',\n tabContentClassName = '',\n tabFirstChildClassName = '',\n tabHoverClassName = 'bg-highlight-decent text-color-darkest',\n tabLastChildClassName = '',\n tabsWrapperClassName = '',\n vertical = false,\n children,\n ...remainingProps\n } = props;\n\n const [internalActiveKey, setInternalActiveKey] = useState(\n activeKey || getFirstTabKey(React.Children.toArray(children))\n );\n\n // Update internal activeKey when props change\n const [previousActiveKey, setPreviousActiveKey] = useState(activeKey);\n if (activeKey !== previousActiveKey) {\n activeKey && setInternalActiveKey(activeKey);\n setPreviousActiveKey(activeKey);\n }\n\n const handleSelectTab = (event: React.MouseEvent<HTMLLIElement>) => {\n onSelectTab(event.currentTarget?.getAttribute('data-tabkey') as string);\n };\n\n const wrapperClassNames = classNames(\n 'DataTabsContainer',\n bordered && 'DataTab-bordered',\n wrapperClassName,\n vertical ? 'DataTabs-vertical' : 'DataTabs-horizontal'\n );\n\n const enrichChildren = () => {\n if (disableTransition) {\n return React.Children.map(children as DataTabElement[], child => {\n if (!child) {\n return null;\n }\n return React.cloneElement(child, {\n active: child.props.tabKey === internalActiveKey,\n disableTransition,\n });\n });\n }\n\n const enhancedChildren = (React.Children.toArray(children) as DataTabElement[])\n .filter(child => child.props.tabKey === internalActiveKey)\n .map(child => React.cloneElement(child, { active: true, disableTransition }));\n\n return (\n <AnimatePresence initial={false} mode='wait'>\n {enhancedChildren}\n </AnimatePresence>\n );\n };\n\n return (\n <div {...remainingProps} className={wrapperClassNames}>\n <div className={`DataTabsWrapper ${tabsWrapperClassName}`}>\n <ul className='DataTabs' role='tabList'>\n {React.Children.map(children as DataTabElement[], (child, index) => {\n if (!child) {\n return null;\n }\n\n const { tabKey, title, className } = child.props;\n\n return (\n <DataTabHeader\n isActive={tabKey === internalActiveKey}\n tabKey={tabKey}\n title={title}\n onSelectTab={handleSelectTab}\n isFirstTab={index === 0}\n isLastTab={!!((children as DataTabElement[])?.length - 1)}\n tabFirstChildClassName={tabFirstChildClassName}\n tabLastChildClassName={tabLastChildClassName}\n tabActiveClassName={tabActiveClassName}\n tabClassName={tabClassName}\n tabHoverClassName={tabHoverClassName}\n arrowClassName={arrowClassName}\n className={className}\n />\n );\n })}\n </ul>\n </div>\n <div className={`tab-content ${tabContentClassName}`} role='tabpanel'>\n {commonTabContent ? commonTabContent : enrichChildren()}\n </div>\n </div>\n );\n};\n\nexport default DataTabs;\n"],"names":["getFirstTabKey","children","firstItem","DataTabs","props","activeKey","bordered","wrapperClassName","commonTabContent","disableTransition","arrowClassName","onSelectTab","tabActiveClassName","tabClassName","tabContentClassName","tabFirstChildClassName","tabHoverClassName","tabLastChildClassName","tabsWrapperClassName","vertical","remainingProps","internalActiveKey","setInternalActiveKey","useState","React","previousActiveKey","setPreviousActiveKey","handleSelectTab","event","wrapperClassNames","classNames","enrichChildren","child","enhancedChildren","AnimatePresence","jsxs","jsx","index","tabKey","title","className","DataTabHeader"],"mappings":";;;;;AASA,MAAMA,IAAiB,CAACC,MAAsC;AAC1D,QAAM,CAACC,CAAS,IAAID;AACpB,SAAOC,GAAW,MAAM;AAC5B,GAoGMC,IAAW,CAACC,MAA4C;AAC1D,QAAM;AAAA,IACF,WAAAC,IAAY;AAAA,IACZ,UAAAC,IAAW;AAAA,IACX,WAAWC;AAAA,IACX,kBAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,gBAAAC,IAAiB;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,EAER;AAEA,SACI,gBAAAE,EAAC,OAAA,EAAK,GAAGf,GAAgB,WAAWS,GAChC,UAAA;AAAA,IAAA,gBAAAO,EAAC,SAAI,WAAW,mBAAmBlB,CAAoB,IACnD,4BAAC,MAAA,EAAG,WAAU,YAAW,MAAK,WACzB,UAAAM,EAAM,SAAS,IAAIvB,GAA8B,CAAC+B,GAAOK,MAAU;AAChE,UAAI,CAACL;AACD,eAAO;AAGX,YAAM,EAAE,QAAAM,GAAQ,OAAAC,GAAO,WAAAC,EAAA,IAAcR,EAAM;AAE3C,aACI,gBAAAI;AAAA,QAACK;AAAA,QAAA;AAAA,UACG,UAAUH,MAAWjB;AAAA,UACrB,QAAAiB;AAAA,UACA,OAAAC;AAAA,UACA,aAAaZ;AAAA,UACb,YAAYU,MAAU;AAAA,UACtB,WAAW,CAAC,EAAGpC,GAA+B,SAAS;AAAA,UACvD,wBAAAc;AAAA,UACA,uBAAAE;AAAA,UACA,oBAAAL;AAAA,UACA,cAAAC;AAAA,UACA,mBAAAG;AAAA,UACA,gBAAAN;AAAA,UACA,WAAA8B;AAAA,QAAA;AAAA,MAAA;AAAA,IAGZ,CAAC,GACL,GACJ;AAAA,IACA,gBAAAJ,EAAC,OAAA,EAAI,WAAW,eAAetB,CAAmB,IAAI,MAAK,YACtD,UAAAN,KAAsCuB,EAAA,EAAe,CAC1D;AAAA,EAAA,GACJ;AAER;"}
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { Moment } from 'moment';
3
- import { default as Datetime, DatetimepickerProps } from 'react-datetime';
3
+ import { default as DatetimeImport, DatetimepickerProps } from 'react-datetime';
4
4
  export type DatePickerProps = Omit<DatetimepickerProps, 'onChange' | 'initialValue'> & {
5
5
  /**
6
6
  * An id used for the internal input element.
@@ -85,7 +85,7 @@ export type DatePickerProps = Omit<DatetimepickerProps, 'onChange' | 'initialVal
85
85
  */
86
86
  className?: string;
87
87
  };
88
- declare const DatePicker: React.ForwardRefExoticComponent<Omit<Datetime.DatetimepickerProps, "onChange" | "initialValue"> & {
88
+ declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatetimeImport.DatetimepickerProps, "onChange" | "initialValue"> & {
89
89
  /**
90
90
  * An id used for the internal input element.
91
91
  */
@@ -1,42 +1,42 @@
1
1
  import { jsx as C } from "react/jsx-runtime";
2
- import { forwardRef as I, useState as L } from "react";
3
- import N from "classnames";
4
- import O from "react-datetime";
2
+ import { forwardRef as L, useState as N } from "react";
3
+ import O from "classnames";
4
+ import o from "react-datetime";
5
5
  import { noop as A } from "es-toolkit/function";
6
- const _ = "en-GB", k = 0, T = I((a, x) => {
6
+ const _ = o?.default ? o.default : o, k = "en-GB", x = 0, U = L((s, y) => {
7
7
  const {
8
- id: s,
9
- dropup: n = !1,
10
- alignRight: c = !1,
11
- locale: i = _,
12
- minWidth: p = k,
13
- onChange: l = A,
14
- mandatory: m = !0,
8
+ id: n,
9
+ dropup: c = !1,
10
+ alignRight: i = !1,
11
+ locale: l = k,
12
+ minWidth: p = x,
13
+ onChange: m = A,
14
+ mandatory: f = !0,
15
15
  dateValidation: r,
16
- clearableInput: f = !1,
17
- closeOnSelect: u = !0,
18
- inputProps: d,
19
- className: o,
20
- ...h
21
- } = a, [g, D] = L(!1), P = (e) => r ? r(e) : typeof e == "object", E = (e) => {
22
- const t = m ? P(e) : !0;
23
- D(!t), l(e, t);
24
- }, b = N(
16
+ clearableInput: u = !1,
17
+ closeOnSelect: d = !0,
18
+ inputProps: h,
19
+ className: a,
20
+ ...D
21
+ } = s, [g, P] = N(!1), E = (t) => r ? r(t) : typeof t == "object", I = (t) => {
22
+ const e = f ? E(t) : !0;
23
+ P(!e), m(t, e);
24
+ }, b = O(
25
25
  "DatePicker",
26
26
  "form-group",
27
27
  g && "has-error",
28
- n && "dropup",
29
- c && "align-right",
30
- o && o
31
- ), j = { id: s, ...d };
28
+ c && "dropup",
29
+ i && "align-right",
30
+ a && a
31
+ ), j = { id: n, ...h };
32
32
  return /* @__PURE__ */ C(
33
- O,
33
+ _,
34
34
  {
35
- ...h,
36
- locale: i,
37
- clearableInput: f,
38
- closeOnSelect: u,
39
- onChange: E,
35
+ ...D,
36
+ locale: l,
37
+ clearableInput: u,
38
+ closeOnSelect: d,
39
+ onChange: I,
40
40
  minWidth: p,
41
41
  inputProps: j,
42
42
  className: b
@@ -44,6 +44,6 @@ const _ = "en-GB", k = 0, T = I((a, x) => {
44
44
  );
45
45
  });
46
46
  export {
47
- T as default
47
+ U as default
48
48
  };
49
49
  //# sourceMappingURL=DatePicker.js.map