@uva-glass/component-library 1.48.1 → 1.49.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 (180) hide show
  1. package/dist/MultiSelect-Ckf3uGw5.js.map +1 -1
  2. package/dist/assets/CheckboxButton.css +1 -0
  3. package/dist/assets/CheckboxButtonBar.css +1 -0
  4. package/dist/assets/CheckboxTree.css +1 -1
  5. package/dist/assets/Label.css +1 -1
  6. package/dist/assets/PeriodSelector.css +1 -0
  7. package/dist/components/Button/Button.d.ts +4 -0
  8. package/dist/components/Button/Button.js.map +1 -1
  9. package/dist/components/Button/Button.stories.js +14 -13
  10. package/dist/components/Button/Button.stories.js.map +1 -1
  11. package/dist/components/ButtonGroup/ButtonGroup.d.ts +3 -0
  12. package/dist/components/ButtonGroup/ButtonGroup.js.map +1 -1
  13. package/dist/components/ButtonGroup/ButtonGroup.stories.js +1 -0
  14. package/dist/components/ButtonGroup/ButtonGroup.stories.js.map +1 -1
  15. package/dist/components/Card/Card.d.ts +6 -0
  16. package/dist/components/Card/Card.js.map +1 -1
  17. package/dist/components/Card/Card.stories.js +14 -13
  18. package/dist/components/Card/Card.stories.js.map +1 -1
  19. package/dist/components/Checkbox/Checkbox.d.ts +1 -0
  20. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  21. package/dist/components/Checkbox/Checkbox.stories.js +17 -16
  22. package/dist/components/Checkbox/Checkbox.stories.js.map +1 -1
  23. package/dist/components/CheckboxButton/CheckboxButton.d.ts +16 -0
  24. package/dist/components/CheckboxButton/CheckboxButton.js +51 -0
  25. package/dist/components/CheckboxButton/CheckboxButton.js.map +1 -0
  26. package/dist/components/CheckboxButton/CheckboxButton.stories.d.ts +5 -0
  27. package/dist/components/CheckboxButton/CheckboxButton.stories.js +48 -0
  28. package/dist/components/CheckboxButton/CheckboxButton.stories.js.map +1 -0
  29. package/dist/components/CheckboxButton/index.d.ts +1 -0
  30. package/dist/components/CheckboxButton/index.js +5 -0
  31. package/dist/components/CheckboxButton/index.js.map +1 -0
  32. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.d.ts +22 -0
  33. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.js +62 -0
  34. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.js.map +1 -0
  35. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.d.ts +5 -0
  36. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +70 -0
  37. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js.map +1 -0
  38. package/dist/components/CheckboxButtonBar/index.d.ts +1 -0
  39. package/dist/components/CheckboxButtonBar/index.js +5 -0
  40. package/dist/components/CheckboxButtonBar/index.js.map +1 -0
  41. package/dist/components/CheckboxTree/CheckboxTree.d.ts +5 -3
  42. package/dist/components/CheckboxTree/CheckboxTree.js +42 -42
  43. package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
  44. package/dist/components/CheckboxTree/CheckboxTree.stories.js +1 -1
  45. package/dist/components/CheckboxTree/CheckboxTree.stories.js.map +1 -1
  46. package/dist/components/Drawer/Drawer.d.ts +6 -0
  47. package/dist/components/Drawer/Drawer.js.map +1 -1
  48. package/dist/components/Drawer/Drawer.stories.js +16 -15
  49. package/dist/components/Drawer/Drawer.stories.js.map +1 -1
  50. package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.d.ts +3 -0
  51. package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.js.map +1 -1
  52. package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.stories.js +3 -2
  53. package/dist/components/EmptyStateDataDisplay/EmptyStateDataDisplay.stories.js.map +1 -1
  54. package/dist/components/FeedbackBox/FeedbackBox.d.ts +4 -0
  55. package/dist/components/FeedbackBox/FeedbackBox.js.map +1 -1
  56. package/dist/components/FeedbackBox/FeedbackBox.stories.js +10 -9
  57. package/dist/components/FeedbackBox/FeedbackBox.stories.js.map +1 -1
  58. package/dist/components/FieldHint/FieldHint.d.ts +4 -0
  59. package/dist/components/FieldHint/FieldHint.js.map +1 -1
  60. package/dist/components/FieldHint/FieldHint.stories.js +1 -0
  61. package/dist/components/FieldHint/FieldHint.stories.js.map +1 -1
  62. package/dist/components/Fieldset/Fieldset.d.ts +5 -0
  63. package/dist/components/Fieldset/Fieldset.js.map +1 -1
  64. package/dist/components/Fieldset/Fieldset.stories.js +20 -19
  65. package/dist/components/Fieldset/Fieldset.stories.js.map +1 -1
  66. package/dist/components/FormField/FormField.d.ts +3 -0
  67. package/dist/components/FormField/FormField.js.map +1 -1
  68. package/dist/components/FormField/FormField.stories.js +16 -15
  69. package/dist/components/FormField/FormField.stories.js.map +1 -1
  70. package/dist/components/GridRow/GridRow.d.ts +4 -0
  71. package/dist/components/GridRow/GridRow.js +4 -4
  72. package/dist/components/GridRow/GridRow.js.map +1 -1
  73. package/dist/components/GridRow/GridRow.stories.js +1 -0
  74. package/dist/components/GridRow/GridRow.stories.js.map +1 -1
  75. package/dist/components/HorizontalList/HorizontalList.d.ts +3 -0
  76. package/dist/components/HorizontalList/HorizontalList.js.map +1 -1
  77. package/dist/components/HorizontalList/HorizontalList.stories.js +7 -6
  78. package/dist/components/HorizontalList/HorizontalList.stories.js.map +1 -1
  79. package/dist/components/Icon/Icon.d.ts +4 -0
  80. package/dist/components/Icon/Icon.js.map +1 -1
  81. package/dist/components/Icon/Icon.stories.js +1 -0
  82. package/dist/components/Icon/Icon.stories.js.map +1 -1
  83. package/dist/components/IconButton/IconButton.d.ts +5 -0
  84. package/dist/components/IconButton/IconButton.js.map +1 -1
  85. package/dist/components/IconButton/IconButton.stories.js +8 -7
  86. package/dist/components/IconButton/IconButton.stories.js.map +1 -1
  87. package/dist/components/InfoMessage/InfoMessage.d.ts +3 -0
  88. package/dist/components/InfoMessage/InfoMessage.js.map +1 -1
  89. package/dist/components/InfoMessage/InfoMessage.stories.js +4 -3
  90. package/dist/components/InfoMessage/InfoMessage.stories.js.map +1 -1
  91. package/dist/components/Input/Input.d.ts +6 -0
  92. package/dist/components/Input/Input.js.map +1 -1
  93. package/dist/components/Input/Input.stories.js +11 -10
  94. package/dist/components/Input/Input.stories.js.map +1 -1
  95. package/dist/components/InputField/InputField.d.ts +6 -0
  96. package/dist/components/InputField/InputField.js.map +1 -1
  97. package/dist/components/InputField/InputField.stories.js +16 -15
  98. package/dist/components/InputField/InputField.stories.js.map +1 -1
  99. package/dist/components/Label/Label.d.ts +6 -1
  100. package/dist/components/Label/Label.js +12 -10
  101. package/dist/components/Label/Label.js.map +1 -1
  102. package/dist/components/Label/Label.stories.js +1 -0
  103. package/dist/components/Label/Label.stories.js.map +1 -1
  104. package/dist/components/MenuButton/MenuButton.d.ts +4 -0
  105. package/dist/components/MenuButton/MenuButton.js +1 -1
  106. package/dist/components/MenuButton/MenuButton.js.map +1 -1
  107. package/dist/components/MenuButton/MenuButton.stories.js +19 -18
  108. package/dist/components/MenuButton/MenuButton.stories.js.map +1 -1
  109. package/dist/components/MenuLink/MenuLink.d.ts +1 -0
  110. package/dist/components/MenuLink/MenuLink.js.map +1 -1
  111. package/dist/components/MenuLink/MenuLink.stories.js +5 -4
  112. package/dist/components/MenuLink/MenuLink.stories.js.map +1 -1
  113. package/dist/components/MetaDataList/MetaDataList.d.ts +2 -0
  114. package/dist/components/MetaDataList/MetaDataList.js.map +1 -1
  115. package/dist/components/MetaDataList/MetaDataList.stories.js +5 -4
  116. package/dist/components/MetaDataList/MetaDataList.stories.js.map +1 -1
  117. package/dist/components/ModalDialog/ModalDialog.d.ts +20 -1
  118. package/dist/components/ModalDialog/ModalDialog.js.map +1 -1
  119. package/dist/components/ModalDialog/ModalDialog.stories.js +9 -8
  120. package/dist/components/ModalDialog/ModalDialog.stories.js.map +1 -1
  121. package/dist/components/MultiSelect/MultiSelect.d.ts +4 -0
  122. package/dist/components/MultiSelect/MultiSelect.stories.js +23 -22
  123. package/dist/components/MultiSelect/MultiSelect.stories.js.map +1 -1
  124. package/dist/components/OverlayCloseButton/OverlayCloseButton.d.ts +3 -0
  125. package/dist/components/OverlayCloseButton/OverlayCloseButton.js.map +1 -1
  126. package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +11 -10
  127. package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js.map +1 -1
  128. package/dist/components/PeriodSelector/PeriodSelector.d.ts +16 -0
  129. package/dist/components/PeriodSelector/PeriodSelector.js +74 -0
  130. package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -0
  131. package/dist/components/PeriodSelector/PeriodSelector.stories.d.ts +5 -0
  132. package/dist/components/PeriodSelector/PeriodSelector.stories.js +25 -0
  133. package/dist/components/PeriodSelector/PeriodSelector.stories.js.map +1 -0
  134. package/dist/components/PeriodSelector/index.d.ts +1 -0
  135. package/dist/components/PeriodSelector/index.js +5 -0
  136. package/dist/components/PeriodSelector/index.js.map +1 -0
  137. package/dist/components/Periods/Periods.d.ts +4 -0
  138. package/dist/components/Periods/Periods.js.map +1 -1
  139. package/dist/components/Periods/Periods.stories.js +1 -0
  140. package/dist/components/Periods/Periods.stories.js.map +1 -1
  141. package/dist/components/ProgrammeCard/ProgrammeCard.d.ts +4 -0
  142. package/dist/components/ProgrammeCard/ProgrammeCard.js.map +1 -1
  143. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +19 -18
  144. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
  145. package/dist/components/RadioButton/RadioButton.d.ts +5 -0
  146. package/dist/components/RadioButton/RadioButton.js.map +1 -1
  147. package/dist/components/RadioButton/RadioButton.stories.js +9 -8
  148. package/dist/components/RadioButton/RadioButton.stories.js.map +1 -1
  149. package/dist/components/Repeater/Repeater.d.ts +3 -0
  150. package/dist/components/Repeater/Repeater.js.map +1 -1
  151. package/dist/components/Repeater/Repeater.stories.js +6 -5
  152. package/dist/components/Repeater/Repeater.stories.js.map +1 -1
  153. package/dist/components/SectionNotification/SectionNotification.d.ts +2 -0
  154. package/dist/components/SectionNotification/SectionNotification.js.map +1 -1
  155. package/dist/components/SectionNotification/SectionNotification.stories.js +1 -0
  156. package/dist/components/SectionNotification/SectionNotification.stories.js.map +1 -1
  157. package/dist/components/SelectListbox/SelectListBox.stories.d.ts +2 -2
  158. package/dist/components/SelectListbox/SelectListBox.stories.js +1 -0
  159. package/dist/components/SelectListbox/SelectListBox.stories.js.map +1 -1
  160. package/dist/components/SelectListbox/SelectListbox.d.ts +12 -0
  161. package/dist/components/SelectListbox/SelectListbox.js +9 -9
  162. package/dist/components/SelectListbox/SelectListbox.js.map +1 -1
  163. package/dist/components/Spinner/Spinner.d.ts +3 -1
  164. package/dist/components/Spinner/Spinner.js.map +1 -1
  165. package/dist/components/Spinner/Spinner.stories.js +4 -3
  166. package/dist/components/Spinner/Spinner.stories.js.map +1 -1
  167. package/dist/components/StatusPill/StatusPill.d.ts +4 -0
  168. package/dist/components/StatusPill/StatusPill.js.map +1 -1
  169. package/dist/components/StatusPill/StatusPill.stories.js +7 -6
  170. package/dist/components/StatusPill/StatusPill.stories.js.map +1 -1
  171. package/dist/components/Tooltip/Tooltip.d.ts +6 -0
  172. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  173. package/dist/components/Tooltip/Tooltip.stories.js +10 -9
  174. package/dist/components/Tooltip/Tooltip.stories.js.map +1 -1
  175. package/dist/components/index.d.ts +3 -0
  176. package/dist/components/index.js +73 -67
  177. package/dist/components/index.js.map +1 -1
  178. package/dist/index.js +73 -67
  179. package/dist/index.js.map +1 -1
  180. package/package.json +15 -15
@@ -0,0 +1,62 @@
1
+ import { jsxs as a, jsx as c } from "react/jsx-runtime";
2
+ import { useRef as d } from "react";
3
+ import { c as g } from "../../clsx-OuTLNxxd.js";
4
+ import { CheckboxButton as w } from "../CheckboxButton/CheckboxButton.js";
5
+ import { Label as C } from "../Label/Label.js";
6
+ import { Icon as N } from "../Icon/Icon.js";
7
+ import '../../assets/CheckboxButtonBar.css';const n = {
8
+ "checkbox-button-bar__container": "_checkbox-button-bar__container_1b278_1",
9
+ "checkbox-button-bar__container--label-left": "_checkbox-button-bar__container--label-left_1b278_6",
10
+ "checkbox-button-bar__container--label-top": "_checkbox-button-bar__container--label-top_1b278_12",
11
+ "checkbox-button-bar__row-container": "_checkbox-button-bar__row-container_1b278_19",
12
+ "checkbox-button-bar__row": "_checkbox-button-bar__row_1b278_19",
13
+ "checkbox-button-bar__error": "_checkbox-button-bar__error_1b278_30"
14
+ }, y = ({
15
+ checkboxes: i,
16
+ defaultValues: t,
17
+ label: l,
18
+ labelPosition: s = "top",
19
+ required: h = !1,
20
+ notValidatedText: b = "",
21
+ disableGroup: u = !1,
22
+ onSetValues: m
23
+ }) => {
24
+ const e = d(t ? t.map(String) : []), x = (o, r) => {
25
+ o === null ? e.current = e.current.filter((_) => _ !== r) : e.current = [...e.current, r], m(e.current);
26
+ }, k = (o, r) => o === 0 && r !== 1 ? "start" : o < r - 1 ? "middle" : r === 1 ? "single" : "end";
27
+ return /* @__PURE__ */ a(
28
+ "div",
29
+ {
30
+ className: g(
31
+ n["checkbox-button-bar__container"],
32
+ n[`checkbox-button-bar__container--label-${s}`]
33
+ ),
34
+ children: [
35
+ l && /* @__PURE__ */ c(C, { htmlFor: "", required: h, children: l }),
36
+ /* @__PURE__ */ a("div", { className: n["checkbox-button-bar__row-container"], children: [
37
+ /* @__PURE__ */ c("div", { className: n["checkbox-button-bar__row"], children: i.map(({ label: o, value: r, disabled: _ }, f) => /* @__PURE__ */ c(
38
+ w,
39
+ {
40
+ label: o,
41
+ value: r,
42
+ isChecked: t ? t.includes(r) : !1,
43
+ variant: k(f, i.length),
44
+ disabled: _ || u,
45
+ notValid: b !== "",
46
+ onSetValue: (p) => x(p, r)
47
+ },
48
+ `${r}`
49
+ )) }),
50
+ b !== "" && /* @__PURE__ */ a("div", { className: n["checkbox-button-bar__error"], children: [
51
+ /* @__PURE__ */ c(N, { name: "ExclamationTriangleFill", size: 24 }),
52
+ b
53
+ ] })
54
+ ] })
55
+ ]
56
+ }
57
+ );
58
+ };
59
+ export {
60
+ y as CheckboxButtonBar
61
+ };
62
+ //# sourceMappingURL=CheckboxButtonBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxButtonBar.js","sources":["../../../src/components/CheckboxButtonBar/CheckboxButtonBar.tsx"],"sourcesContent":["import { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport type { CheckboxButtonProps } from 'components/CheckboxButton';\n\nimport styles from './CheckboxButtonBar.module.css';\n\nimport { CheckboxButton } from 'components/CheckboxButton';\nimport { Label } from 'components/Label';\nimport { Icon } from 'components/Icon';\n\ntype CheckboxProps = {\n label: string;\n value: string;\n disabled?: boolean;\n};\n\nexport interface CheckboxButtonBarProps {\n /** array with objects with label, value */\n checkboxes: CheckboxProps[];\n //** array with values */\n defaultValues?: string[];\n label?: string;\n /** 'top' | 'left' */\n labelPosition?: 'top' | 'left';\n required?: boolean;\n /** error text to display if set */\n notValidatedText?: string;\n /** disables all checkboxes in the bar */\n disableGroup?: boolean;\n onSetValues: (value: string[]) => void;\n}\n\n/** Represents a component that shows a collection of [CheckboxButton](/story/atoms-checkboxbutton--checkbox-button-example)s. */\nexport const CheckboxButtonBar = ({\n checkboxes,\n defaultValues,\n label,\n labelPosition = 'top',\n required = false,\n notValidatedText = '',\n disableGroup = false,\n onSetValues,\n}: CheckboxButtonBarProps) => {\n const values = useRef<string[]>(defaultValues ? defaultValues.map(String) : []);\n\n const handleChange = (setValue: string | null, value: string) => {\n if (setValue === null) {\n values.current = values.current.filter((val) => val !== value);\n } else {\n values.current = [...values.current, value];\n }\n onSetValues(values.current);\n };\n\n const getVariant = (index: number, totalItems: number): CheckboxButtonProps['variant'] => {\n if (index === 0 && totalItems !== 1) {\n return 'start';\n } else if (index < totalItems - 1) {\n return 'middle';\n } else if (totalItems === 1) {\n return 'single';\n } else {\n return 'end';\n }\n };\n\n return (\n <div\n className={clsx(\n styles['checkbox-button-bar__container'],\n styles[`checkbox-button-bar__container--label-${labelPosition}`]\n )}\n >\n {label && (\n <Label htmlFor=\"\" required={required}>\n {label}\n </Label>\n )}\n <div className={styles['checkbox-button-bar__row-container']}>\n <div className={styles['checkbox-button-bar__row']}>\n {checkboxes.map(({ label, value, disabled }, index) => (\n <CheckboxButton\n key={`${value}`}\n label={label}\n value={value}\n isChecked={defaultValues ? defaultValues.includes(value) : false}\n variant={getVariant(index, checkboxes.length)}\n disabled={disabled || disableGroup}\n notValid={notValidatedText !== ''}\n onSetValue={(newValue) => handleChange(newValue, value)}\n />\n ))}\n </div>\n {notValidatedText !== '' && (\n <div className={styles['checkbox-button-bar__error']}>\n <Icon name=\"ExclamationTriangleFill\" size={24} />\n {notValidatedText}\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"names":["CheckboxButtonBar","checkboxes","defaultValues","label","labelPosition","required","notValidatedText","disableGroup","onSetValues","values","useRef","handleChange","setValue","value","val","getVariant","index","totalItems","jsxs","clsx","styles","jsx","Label","disabled","CheckboxButton","newValue","Icon"],"mappings":";;;;;;;;;;;;;GAkCaA,IAAoB,CAAC;AAAA,EAChC,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,UAAAC,IAAW;AAAA,EACX,kBAAAC,IAAmB;AAAA,EACnB,cAAAC,IAAe;AAAA,EACf,aAAAC;AACF,MAA8B;AACtB,QAAAC,IAASC,EAAiBR,IAAgBA,EAAc,IAAI,MAAM,IAAI,CAAA,CAAE,GAExES,IAAe,CAACC,GAAyBC,MAAkB;AAC/D,IAAID,MAAa,OACfH,EAAO,UAAUA,EAAO,QAAQ,OAAO,CAACK,MAAQA,MAAQD,CAAK,IAE7DJ,EAAO,UAAU,CAAC,GAAGA,EAAO,SAASI,CAAK,GAE5CL,EAAYC,EAAO,OAAO;AAAA,EAAA,GAGtBM,IAAa,CAACC,GAAeC,MAC7BD,MAAU,KAAKC,MAAe,IACzB,UACED,IAAQC,IAAa,IACvB,WACEA,MAAe,IACjB,WAEA;AAKT,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACTC,EAAO,gCAAgC;AAAA,QACvCA,EAAO,yCAAyChB,CAAa,EAAE;AAAA,MACjE;AAAA,MAEC,UAAA;AAAA,QAAAD,KACE,gBAAAkB,EAAAC,GAAA,EAAM,SAAQ,IAAG,UAAAjB,GACf,UACHF,GAAA;AAAA,QAED,gBAAAe,EAAA,OAAA,EAAI,WAAWE,EAAO,oCAAoC,GACzD,UAAA;AAAA,UAAA,gBAAAC,EAAC,OAAI,EAAA,WAAWD,EAAO,0BAA0B,GAC9C,UAAWnB,EAAA,IAAI,CAAC,EAAE,OAAAE,GAAO,OAAAU,GAAO,UAAAU,EAAA,GAAYP,MAC3C,gBAAAK;AAAA,YAACG;AAAA,YAAA;AAAA,cAEC,OAAOrB;AAAAA,cACP,OAAAU;AAAA,cACA,WAAWX,IAAgBA,EAAc,SAASW,CAAK,IAAI;AAAA,cAC3D,SAASE,EAAWC,GAAOf,EAAW,MAAM;AAAA,cAC5C,UAAUsB,KAAYhB;AAAA,cACtB,UAAUD,MAAqB;AAAA,cAC/B,YAAY,CAACmB,MAAad,EAAac,GAAUZ,CAAK;AAAA,YAAA;AAAA,YAPjD,GAAGA,CAAK;AAAA,UAShB,CAAA,GACH;AAAA,UACCP,MAAqB,MACpB,gBAAAY,EAAC,SAAI,WAAWE,EAAO,4BAA4B,GACjD,UAAA;AAAA,YAAA,gBAAAC,EAACK,GAAK,EAAA,MAAK,2BAA0B,MAAM,IAAI;AAAA,YAC9CpB;AAAA,UAAA,GACH;AAAA,QAAA,GAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { CheckboxButtonBarProps } from './CheckboxButtonBar';
3
+ declare const _default: Meta<CheckboxButtonBarProps>;
4
+ export default _default;
5
+ export declare const CheckboxButtonBarExample: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, CheckboxButtonBarProps>;
@@ -0,0 +1,70 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { fn as l } from "../../index-MQ0yPLdl.js";
3
+ import { CheckboxButtonBar as e } from "./CheckboxButtonBar.js";
4
+ const a = "<CheckboxButtonBar checkboxes={} defaultValues={} label={} labelPosition={} required={} notValidatedText={} disableGroup={} onSetValues={} />", i = {
5
+ title: "Molecules/CheckboxButtonBar",
6
+ component: e,
7
+ argTypes: {
8
+ checkboxes: {
9
+ table: {
10
+ disable: !0
11
+ }
12
+ },
13
+ defaultValues: {
14
+ table: {
15
+ disable: !0
16
+ }
17
+ },
18
+ label: {
19
+ control: "text"
20
+ },
21
+ labelPosition: {
22
+ control: "radio",
23
+ options: ["top", "left"]
24
+ },
25
+ required: {
26
+ control: "boolean"
27
+ },
28
+ notValidatedText: {
29
+ control: "text"
30
+ },
31
+ disableGroup: {
32
+ control: "boolean"
33
+ },
34
+ onSetValues: {
35
+ table: {
36
+ disable: !0
37
+ }
38
+ }
39
+ },
40
+ parameters: {
41
+ inspectComponent: e,
42
+ codeString: a
43
+ }
44
+ }, r = (o) => /* @__PURE__ */ t(e, { ...o }), n = r.bind({});
45
+ n.args = {
46
+ label: "Periode",
47
+ required: !0,
48
+ checkboxes: [
49
+ {
50
+ label: "1.1",
51
+ value: "1"
52
+ },
53
+ {
54
+ label: "1.2",
55
+ value: "2"
56
+ },
57
+ {
58
+ label: "1.3",
59
+ value: "3"
60
+ }
61
+ ],
62
+ defaultValues: ["1", "2"],
63
+ labelPosition: "top",
64
+ onSetValues: l()
65
+ };
66
+ export {
67
+ n as CheckboxButtonBarExample,
68
+ i as default
69
+ };
70
+ //# sourceMappingURL=CheckboxButtonBar.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxButtonBar.stories.js","sources":["../../../src/components/CheckboxButtonBar/CheckboxButtonBar.stories.tsx"],"sourcesContent":["import { fn } from '@storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { CheckboxButtonBarProps } from './CheckboxButtonBar';\n\nimport { CheckboxButtonBar } from './CheckboxButtonBar';\n\nconst codeString =\n '<CheckboxButtonBar checkboxes={} defaultValues={} label={} labelPosition={} required={} notValidatedText={} disableGroup={} onSetValues={} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Molecules/CheckboxButtonBar',\n component: CheckboxButtonBar,\n argTypes: {\n checkboxes: {\n table: {\n disable: true,\n },\n },\n defaultValues: {\n table: {\n disable: true,\n },\n },\n label: {\n control: 'text',\n },\n labelPosition: {\n control: 'radio',\n options: ['top', 'left'],\n },\n required: {\n control: 'boolean',\n },\n notValidatedText: {\n control: 'text',\n },\n disableGroup: {\n control: 'boolean',\n },\n onSetValues: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: CheckboxButtonBar,\n codeString: codeString,\n },\n} as Meta<CheckboxButtonBarProps>;\n\nconst Template: StoryFn<CheckboxButtonBarProps> = (args) => <CheckboxButtonBar {...args} />;\n\nexport const CheckboxButtonBarExample = Template.bind({});\nCheckboxButtonBarExample.args = {\n label: 'Periode',\n required: true,\n checkboxes: [\n {\n label: '1.1',\n value: '1',\n },\n {\n label: '1.2',\n value: '2',\n },\n {\n label: '1.3',\n value: '3',\n },\n ],\n defaultValues: ['1', '2'],\n labelPosition: 'top',\n onSetValues: fn(),\n};\n"],"names":["codeString","CheckboxButtonBar_stories","CheckboxButtonBar","Template","args","jsx","CheckboxButtonBarExample","fn"],"mappings":";;;AAOA,MAAMA,IACJ,iJAGaC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,YAAY;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,OAAO;AAAA,MACL,SAAS;AAAA,IACX;AAAA,IACA,eAAe;AAAA,MACb,SAAS;AAAA,MACT,SAAS,CAAC,OAAO,MAAM;AAAA,IACzB;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,IACX;AAAA,IACA,kBAAkB;AAAA,MAChB,SAAS;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACZ,SAAS;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACX,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EACF;AACF,GAEMG,IAA4C,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAmB,GAAGE,EAAM,CAAA,GAE5EE,IAA2BH,EAAS,KAAK,EAAE;AACxDG,EAAyB,OAAO;AAAA,EAC9B,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,IACV;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,eAAe,CAAC,KAAK,GAAG;AAAA,EACxB,eAAe;AAAA,EACf,aAAaC,EAAG;AAClB;"}
@@ -0,0 +1 @@
1
+ export * from './CheckboxButtonBar';
@@ -0,0 +1,5 @@
1
+ import { CheckboxButtonBar as t } from "./CheckboxButtonBar.js";
2
+ export {
3
+ t as CheckboxButtonBar
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -8,13 +8,15 @@ type CheckboxBranch = {
8
8
  children: CheckboxLeaf[];
9
9
  };
10
10
  export interface CheckboxTreeProps {
11
+ /** The title of the component. */
11
12
  title?: string;
12
- /** array of checkbox groups with a label and array of children (itemname, itemvalue and disabled boolean)*/
13
+ /** Array of checkbox groups with a label and array of children (itemName, itemValue and disabled boolean). */
13
14
  checkboxTree: CheckboxBranch[];
14
- /** array of selected values */
15
+ /** Array of selected values. */
15
16
  defaultValue?: string[];
16
- /** returns array of selected values*/
17
+ /** Returns array of selected values. */
17
18
  onChange?: (value: string[]) => void;
18
19
  }
20
+ /** Represents a component to render a tree of checkboxes. */
19
21
  export declare const CheckboxTree: ({ title, checkboxTree, defaultValue, onChange }: CheckboxTreeProps) => import("react/jsx-runtime").JSX.Element;
20
22
  export {};
@@ -1,110 +1,110 @@
1
- import { jsxs as l, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
2
  import { useRef as T, useEffect as N } from "react";
3
3
  import { c as g } from "../../clsx-OuTLNxxd.js";
4
4
  import { Icon as L } from "../Icon/Icon.js";
5
5
  import "@react-aria/button";
6
6
  import { Button as R } from "../Button/Button.js";
7
7
  import { Checkbox as y } from "../Checkbox/Checkbox.js";
8
+ import { Label as S } from "../Label/Label.js";
8
9
  import "@react-aria/dialog";
9
10
  import "@react-aria/focus";
10
11
  import "@react-aria/overlays";
11
12
  import "../OverlayCloseButton/OverlayCloseButton.js";
12
- import { FormField as S } from "../FormField/FormField.js";
13
+ import { FormField as C } from "../FormField/FormField.js";
13
14
  import "../GridRow/GridRow.js";
14
15
  import "../IconButton/IconButton.js";
15
16
  import "../Input/Input.js";
16
17
  import "../InputField/InputField.js";
17
- import { Label as C } from "../Label/Label.js";
18
18
  import "react-router-dom";
19
19
  import "../../MultiSelect-Ckf3uGw5.js";
20
20
  import "../SelectListbox/SelectListbox.js";
21
21
  import "../SelectListbox/SelectProvider.js";
22
22
  import { useResponsive as j } from "../hooks/useResponsive.js";
23
- import '../../assets/CheckboxTree.css';const a = {
24
- "checkbox-tree__header": "_checkbox-tree__header_28uha_1",
25
- "checkbox-tree__branch": "_checkbox-tree__branch_28uha_8",
26
- "checkbox-tree__branch--icon": "_checkbox-tree__branch--icon_28uha_21",
27
- "checkbox-tree__branch--icon--expanded": "_checkbox-tree__branch--icon--expanded_28uha_27",
28
- "checkbox-tree__branch--formfield": "_checkbox-tree__branch--formfield_28uha_32",
29
- "checkbox-tree__leaves": "_checkbox-tree__leaves_28uha_39",
30
- "checkbox-tree__leaves--expanded": "_checkbox-tree__leaves--expanded_28uha_48",
31
- "checkbox-tree__leaf": "_checkbox-tree__leaf_28uha_52"
32
- }, ce = ({ title: u, checkboxTree: A, defaultValue: i, onChange: b }) => {
33
- const s = T([]), { lessThan: n } = j(), h = (r, e = document) => [].slice.call(e.querySelectorAll(r)), E = () => {
23
+ import '../../assets/CheckboxTree.css';const o = {
24
+ "checkbox-tree__header": "_checkbox-tree__header_xbe4e_1",
25
+ "checkbox-tree__branch": "_checkbox-tree__branch_xbe4e_8",
26
+ "checkbox-tree__branch--icon": "_checkbox-tree__branch--icon_xbe4e_21",
27
+ "checkbox-tree__branch--icon--expanded": "_checkbox-tree__branch--icon--expanded_xbe4e_27",
28
+ "checkbox-tree__branch--formfield": "_checkbox-tree__branch--formfield_xbe4e_32",
29
+ "checkbox-tree__leaves": "_checkbox-tree__leaves_xbe4e_39",
30
+ "checkbox-tree__leaves--expanded": "_checkbox-tree__leaves--expanded_xbe4e_48",
31
+ "checkbox-tree__leaf": "_checkbox-tree__leaf_xbe4e_52"
32
+ }, ce = ({ title: p, checkboxTree: A, defaultValue: i, onChange: x }) => {
33
+ const s = T([]), { lessThan: n } = j(), _ = (r, e = document) => [].slice.call(e.querySelectorAll(r)), E = () => {
34
34
  const r = s.current.reduce((e, t) => (t.name && t.checked && e.push(t.value), e), []);
35
- b && b(r);
36
- }, m = (r) => {
35
+ x && x(r);
36
+ }, u = (r) => {
37
37
  var e, t, d;
38
38
  for (; r; ) {
39
- const c = (t = (e = r.closest("[data-ul]")) == null ? void 0 : e.parentNode) == null ? void 0 : t.querySelector("input"), f = h(
39
+ const c = (t = (e = r.closest("[data-ul]")) == null ? void 0 : e.parentNode) == null ? void 0 : t.querySelector("input"), f = _(
40
40
  "input",
41
41
  (d = c == null ? void 0 : c.closest("[data-li]")) == null ? void 0 : d.querySelector("[data-ul]")
42
- ).reduce((k, v) => (v.disabled || k.push(v.checked), k), []), p = f.every(Boolean), F = f.some(Boolean);
43
- if (c && (c.checked = p, c.indeterminate = !p && p !== F), !c || r === c)
42
+ ).reduce((k, v) => (v.disabled || k.push(v.checked), k), []), b = f.every(Boolean), F = f.some(Boolean);
43
+ if (c && (c.checked = b, c.indeterminate = !b && b !== F), !c || r === c)
44
44
  break;
45
45
  r = c;
46
46
  }
47
- }, x = (r, e) => {
47
+ }, m = (r, e) => {
48
48
  var d, c;
49
49
  const t = e == null ? void 0 : e.querySelector("[data-ul]");
50
- r.childNodes[0].classList.toggle(a["checkbox-tree__branch--icon--expanded"]), (c = e == null ? void 0 : e.closest("[data-li]")) == null || c.setAttribute(
50
+ r.childNodes[0].classList.toggle(o["checkbox-tree__branch--icon--expanded"]), (c = e == null ? void 0 : e.closest("[data-li]")) == null || c.setAttribute(
51
51
  "aria-expanded",
52
52
  ((d = e == null ? void 0 : e.closest("[data-li]")) == null ? void 0 : d.getAttribute("aria-expanded")) === "false" ? "true" : "false"
53
- ), t && t.classList.toggle(a["checkbox-tree__leaves--expanded"]);
53
+ ), t && t.classList.toggle(o["checkbox-tree__leaves--expanded"]);
54
54
  }, q = (r) => {
55
55
  var c;
56
56
  const e = r.target;
57
57
  if (!e || !e.parentNode || !e.parentNode.parentNode) return;
58
58
  const t = e.parentNode.parentNode;
59
59
  if (n.md && ((c = e.previousElementSibling) == null ? void 0 : c.tagName) === "BUTTON" && t.getAttribute("aria-expanded") === "false") {
60
- r.preventDefault(), x(t.querySelector("button"), t);
60
+ r.preventDefault(), m(t.querySelector("button"), t);
61
61
  return;
62
62
  }
63
63
  if (s.current.indexOf(e) === -1) return;
64
- (e.parentNode.parentNode ? h("input", e.parentNode.parentNode) : []).forEach((_) => _.checked = _.disabled ? !1 : e.checked), m(e), E();
64
+ (e.parentNode.parentNode ? _("input", e.parentNode.parentNode) : []).forEach((h) => h.checked = h.disabled ? !1 : e.checked), u(e), E();
65
65
  }, B = (r) => {
66
66
  const e = r.target, t = e.closest("[data-li]");
67
- x(e, t);
67
+ m(e, t);
68
68
  };
69
69
  return N(() => {
70
- s.current = h("input") || [];
70
+ s.current = _("input") || [];
71
71
  }, []), N(() => {
72
72
  i && s.current.forEach((r) => {
73
- i.includes(r.value) && (r.checked = !0, m(r));
73
+ i.includes(r.value) && (r.checked = !0, u(r));
74
74
  });
75
75
  }, [i]), /* @__PURE__ */ l("div", { children: [
76
- u && /* @__PURE__ */ o("span", { className: a["checkbox-tree__header"], children: u }),
77
- /* @__PURE__ */ o("div", { onClick: q, "data-ul": !0, role: "tree", tabIndex: 0, children: A.map(({ itemName: r, children: e }) => /* @__PURE__ */ l(
76
+ p && /* @__PURE__ */ a("span", { className: o["checkbox-tree__header"], children: p }),
77
+ /* @__PURE__ */ a("div", { onClick: q, "data-ul": !0, role: "tree", tabIndex: 0, children: A.map(({ itemName: r, children: e }) => /* @__PURE__ */ l(
78
78
  "div",
79
79
  {
80
- className: a["checkbox-tree__branch"],
80
+ className: o["checkbox-tree__branch"],
81
81
  "data-li": !0,
82
82
  "aria-expanded": n.md ? "false" : "true",
83
83
  children: [
84
- /* @__PURE__ */ l(S, { inline: !0, className: a["checkbox-tree__branch--formfield"], children: [
85
- /* @__PURE__ */ o(R, { variant: "blank", onClick: B, children: /* @__PURE__ */ o(
84
+ /* @__PURE__ */ l(C, { inline: !0, className: o["checkbox-tree__branch--formfield"], children: [
85
+ /* @__PURE__ */ a(R, { variant: "blank", onClick: B, children: /* @__PURE__ */ a(
86
86
  L,
87
87
  {
88
88
  name: "CheveronRight",
89
89
  size: 16,
90
- className: g(a["checkbox-tree__branch--icon"], {
91
- [a["checkbox-tree__branch--icon--expanded"]]: !n.md
90
+ className: g(o["checkbox-tree__branch--icon"], {
91
+ [o["checkbox-tree__branch--icon--expanded"]]: !n.md
92
92
  })
93
93
  }
94
94
  ) }),
95
- /* @__PURE__ */ o(y, { id: r, disabled: e.every((t) => t.disabled) }),
96
- /* @__PURE__ */ o(C, { htmlFor: r, children: r })
95
+ /* @__PURE__ */ a(y, { id: r, disabled: e.every((t) => t.disabled) }),
96
+ /* @__PURE__ */ a(S, { htmlFor: r, children: r })
97
97
  ] }),
98
- /* @__PURE__ */ o(
98
+ /* @__PURE__ */ a(
99
99
  "div",
100
100
  {
101
- className: g(a["checkbox-tree__leaves"], {
102
- [a["checkbox-tree__leaves--expanded"]]: !n.md
101
+ className: g(o["checkbox-tree__leaves"], {
102
+ [o["checkbox-tree__leaves--expanded"]]: !n.md
103
103
  }),
104
104
  "data-ul": !0,
105
- children: e.map(({ itemName: t, itemValue: d, disabled: c }) => /* @__PURE__ */ o("div", { className: a["checkbox-tree__leaf"], "data-li": !0, children: /* @__PURE__ */ l(S, { inline: !0, className: a["checkbox-tree__branch--formfield"], children: [
106
- /* @__PURE__ */ o(y, { id: t, name: t, value: d, disabled: c }),
107
- /* @__PURE__ */ o(C, { htmlFor: t, children: t })
105
+ children: e.map(({ itemName: t, itemValue: d, disabled: c }) => /* @__PURE__ */ a("div", { className: o["checkbox-tree__leaf"], "data-li": !0, children: /* @__PURE__ */ l(C, { inline: !0, className: o["checkbox-tree__branch--formfield"], children: [
106
+ /* @__PURE__ */ a(y, { id: t, name: t, value: d, disabled: c }),
107
+ /* @__PURE__ */ a(S, { htmlFor: t, children: t })
108
108
  ] }) }, t))
109
109
  }
110
110
  )
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxTree.js","sources":["../../../src/components/CheckboxTree/CheckboxTree.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport type { MouseEventHandler } from 'react';\n\nimport styles from './CheckboxTree.module.css';\n\nimport { Button, Checkbox, FormField, Icon, Label } from 'components';\nimport { useResponsive } from 'components/hooks/useResponsive';\n\ntype CheckboxLeaf = {\n itemName: string;\n itemValue: string;\n disabled?: boolean;\n};\n\ntype CheckboxBranch = {\n itemName: string;\n children: CheckboxLeaf[];\n};\n\nexport interface CheckboxTreeProps {\n title?: string;\n /** array of checkbox groups with a label and array of children (itemname, itemvalue and disabled boolean)*/\n checkboxTree: CheckboxBranch[];\n /** array of selected values */\n defaultValue?: string[];\n /** returns array of selected values*/\n onChange?: (value: string[]) => void;\n}\n\nexport const CheckboxTree = ({ title, checkboxTree, defaultValue, onChange }: CheckboxTreeProps) => {\n const checkboxNodes = useRef<HTMLInputElement[]>([]);\n const { lessThan } = useResponsive();\n\n const nodeArray = (selector: string, parent = document) => [].slice.call(parent.querySelectorAll(selector));\n\n const setValue = () => {\n const values = checkboxNodes.current.reduce((values, checkbox) => {\n if (checkbox.name && checkbox.checked) {\n values.push(checkbox.value);\n }\n return values;\n }, [] as string[]);\n\n if (onChange) onChange(values);\n };\n\n const setCheckboxesState = (check: HTMLInputElement) => {\n while (check) {\n const parent = check.closest('[data-ul]')?.parentNode?.querySelector('input');\n const siblings: HTMLInputElement[] = nodeArray(\n 'input',\n parent?.closest('[data-li]')?.querySelector('[data-ul]') as Document | undefined\n );\n\n const checkStatus = siblings.reduce((status, check) => {\n if (!check.disabled) status.push(check.checked);\n return status;\n }, [] as boolean[]);\n\n const every = checkStatus.every(Boolean);\n const some = checkStatus.some(Boolean);\n\n if (parent) {\n parent.checked = every;\n parent.indeterminate = !every && every !== some;\n }\n\n if (!parent || check === parent) {\n break;\n }\n\n check = parent;\n }\n };\n\n const setExpandedAttributes = (trigger: HTMLButtonElement, container: Element | null) => {\n const children = container?.querySelector('[data-ul]');\n\n (trigger.childNodes[0] as Element).classList.toggle(styles['checkbox-tree__branch--icon--expanded']);\n container\n ?.closest('[data-li]')\n ?.setAttribute(\n 'aria-expanded',\n container?.closest('[data-li]')?.getAttribute('aria-expanded') === 'false' ? 'true' : 'false'\n );\n\n if (children) {\n children.classList.toggle(styles['checkbox-tree__leaves--expanded']);\n }\n };\n\n const handleChange: MouseEventHandler<HTMLDivElement> = (event) => {\n const check = event.target as HTMLInputElement;\n\n if (!check || !check.parentNode || !check.parentNode.parentNode) return;\n const parentCheckbox = check.parentNode.parentNode as HTMLElement;\n\n if (\n lessThan.md &&\n check.previousElementSibling?.tagName === 'BUTTON' &&\n parentCheckbox.getAttribute('aria-expanded') === 'false'\n ) {\n event.preventDefault();\n setExpandedAttributes(parentCheckbox.querySelector('button') as HTMLButtonElement, parentCheckbox);\n return;\n }\n\n if (checkboxNodes.current.indexOf(check) === -1) return;\n\n const children: HTMLInputElement[] = (check.parentNode.parentNode as Document)\n ? nodeArray('input', check.parentNode.parentNode as Document)\n : [];\n\n children.forEach((child) => {\n return (child.checked = child.disabled ? false : check.checked);\n });\n\n setCheckboxesState(check);\n setValue();\n };\n\n const handleExpanded: MouseEventHandler<HTMLButtonElement> = (event) => {\n const target = event.target as HTMLButtonElement;\n const parent = target.closest('[data-li]');\n setExpandedAttributes(target, parent);\n };\n\n useEffect(() => {\n checkboxNodes.current = nodeArray('input') || [];\n }, []);\n\n useEffect(() => {\n if (defaultValue) {\n checkboxNodes.current.forEach((checkbox) => {\n if (defaultValue.includes(checkbox.value)) {\n checkbox.checked = true;\n setCheckboxesState(checkbox);\n }\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [defaultValue]);\n\n return (\n <div>\n {title && <span className={styles['checkbox-tree__header']}>{title}</span>}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div onClick={handleChange} data-ul role=\"tree\" tabIndex={0}>\n {checkboxTree.map(({ itemName, children }) => (\n <div\n key={itemName}\n className={styles['checkbox-tree__branch']}\n data-li\n aria-expanded={lessThan.md ? 'false' : 'true'}\n >\n <FormField inline className={styles['checkbox-tree__branch--formfield']}>\n <Button variant=\"blank\" onClick={handleExpanded}>\n <Icon\n name=\"CheveronRight\"\n size={16}\n className={clsx(styles['checkbox-tree__branch--icon'], {\n [styles['checkbox-tree__branch--icon--expanded']]: !lessThan.md,\n })}\n />\n </Button>\n <Checkbox id={itemName} disabled={children.every((checkbox) => checkbox.disabled)} />\n <Label htmlFor={itemName}>{itemName}</Label>\n </FormField>\n <div\n className={clsx(styles['checkbox-tree__leaves'], {\n [styles['checkbox-tree__leaves--expanded']]: !lessThan.md,\n })}\n data-ul\n >\n {children.map(({ itemName, itemValue, disabled }) => (\n <div key={itemName} className={styles['checkbox-tree__leaf']} data-li>\n <FormField inline className={styles['checkbox-tree__branch--formfield']}>\n <Checkbox id={itemName} name={itemName} value={itemValue} disabled={disabled} />\n <Label htmlFor={itemName}>{itemName}</Label>\n </FormField>\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["CheckboxTree","title","checkboxTree","defaultValue","onChange","checkboxNodes","useRef","lessThan","useResponsive","nodeArray","selector","parent","setValue","values","checkbox","setCheckboxesState","check","_b","_a","checkStatus","_c","status","every","some","setExpandedAttributes","trigger","container","children","styles","handleChange","event","parentCheckbox","child","handleExpanded","target","useEffect","itemName","jsxs","FormField","jsx","Button","Icon","clsx","Checkbox","Label","itemValue","disabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BaA,KAAe,CAAC,EAAE,OAAAC,GAAO,cAAAC,GAAc,cAAAC,GAAc,UAAAC,QAAkC;AAC5F,QAAAC,IAAgBC,EAA2B,CAAA,CAAE,GAC7C,EAAE,UAAAC,MAAaC,KAEfC,IAAY,CAACC,GAAkBC,IAAS,aAAa,CAAA,EAAG,MAAM,KAAKA,EAAO,iBAAiBD,CAAQ,CAAC,GAEpGE,IAAW,MAAM;AACrB,UAAMC,IAASR,EAAc,QAAQ,OAAO,CAACQ,GAAQC,OAC/CA,EAAS,QAAQA,EAAS,WAC5BD,EAAO,KAAKC,EAAS,KAAK,GAErBD,IACN,CAAc,CAAA;AAEb,IAAAT,OAAmBS,CAAM;AAAA,EAAA,GAGzBE,IAAqB,CAACC,MAA4B;;AACtD,WAAOA,KAAO;AACZ,YAAML,KAASM,KAAAC,IAAAF,EAAM,QAAQ,WAAW,MAAzB,gBAAAE,EAA4B,eAA5B,gBA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AAK;AAAA,gBACL,MAAM;AAAA,gBACN,WAAWC,EAAKd,EAAO,6BAA6B,GAAG;AAAA,kBACrD,CAACA,EAAO,uCAAuC,CAAC,GAAG,CAACrB,EAAS;AAAA,gBAAA,CAC9D;AAAA,cAAA;AAAA,YAAA,GAEL;AAAA,YACA,gBAAAgC,EAACI,GAAS,EAAA,IAAIP,GAAU,UAAUT,EAAS,MAAM,CAACb,MAAaA,EAAS,QAAQ,EAAG,CAAA;AAAA,YAClF,gBAAAyB,EAAAK,GAAA,EAAM,SAASR,GAAW,UAASA,GAAA;AAAA,UAAA,GACtC;AAAA,UACA,gBAAAG;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWG,EAAKd,EAAO,uBAAuB,GAAG;AAAA,gBAC/C,CAACA,EAAO,iCAAiC,CAAC,GAAG,CAACrB,EAAS;AAAA,cAAA,CACxD;AAAA,cACD,WAAO;AAAA,cAEN,UAAAoB,EAAS,IAAI,CAAC,EAAE,UAAAS,GAAU,WAAAS,GAAW,UAAAC,EACpC,MAAA,gBAAAP,EAAC,OAAmB,EAAA,WAAWX,EAAO,qBAAqB,GAAG,WAAO,IACnE,UAAC,gBAAAS,EAAAC,GAAA,EAAU,QAAM,IAAC,WAAWV,EAAO,kCAAkC,GACpE,UAAA;AAAA,gBAAA,gBAAAW,EAACI,KAAS,IAAIP,GAAU,MAAMA,GAAU,OAAOS,GAAW,UAAAC,GAAoB;AAAA,gBAC7E,gBAAAP,EAAAK,GAAA,EAAM,SAASR,GAAW,UAAAA,GAAS;AAAA,cAAA,GACtC,EAAA,GAJQA,CAKV,CACD;AAAA,YAAA;AAAA,UACH;AAAA,QAAA;AAAA,MAAA;AAAA,MAhCKA;AAAA,IAkCR,CAAA,GACH;AAAA,EACF,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"CheckboxTree.js","sources":["../../../src/components/CheckboxTree/CheckboxTree.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport type { MouseEventHandler } from 'react';\n\nimport styles from './CheckboxTree.module.css';\n\nimport { Button, Checkbox, FormField, Icon, Label } from 'components';\nimport { useResponsive } from 'components/hooks/useResponsive';\n\n// TODO: Currently the checkbox tree shows odd behavior when a disabled checkbox is checked. When deselecting the parent checkbox, the disabled checkbox is deselected, and will never be checked again. We'll leave this for now, until we run into a real world example where this is necessary.\n\ntype CheckboxLeaf = {\n itemName: string;\n itemValue: string;\n disabled?: boolean;\n};\n\ntype CheckboxBranch = {\n itemName: string;\n children: CheckboxLeaf[];\n};\n\nexport interface CheckboxTreeProps {\n /** The title of the component. */\n title?: string;\n /** Array of checkbox groups with a label and array of children (itemName, itemValue and disabled boolean). */\n checkboxTree: CheckboxBranch[];\n /** Array of selected values. */\n defaultValue?: string[];\n /** Returns array of selected values. */\n onChange?: (value: string[]) => void;\n}\n\n/** Represents a component to render a tree of checkboxes. */\nexport const CheckboxTree = ({ title, checkboxTree, defaultValue, onChange }: CheckboxTreeProps) => {\n const checkboxNodes = useRef<HTMLInputElement[]>([]);\n const { lessThan } = useResponsive();\n\n const nodeArray = (selector: string, parent = document) => [].slice.call(parent.querySelectorAll(selector));\n\n const setValue = () => {\n const values = checkboxNodes.current.reduce((values, checkbox) => {\n if (checkbox.name && checkbox.checked) {\n values.push(checkbox.value);\n }\n return values;\n }, [] as string[]);\n\n if (onChange) onChange(values);\n };\n\n const setCheckboxesState = (check: HTMLInputElement) => {\n while (check) {\n const parent = check.closest('[data-ul]')?.parentNode?.querySelector('input');\n const siblings: HTMLInputElement[] = nodeArray(\n 'input',\n parent?.closest('[data-li]')?.querySelector('[data-ul]') as Document | undefined\n );\n\n const checkStatus = siblings.reduce((status, check) => {\n if (!check.disabled) status.push(check.checked);\n return status;\n }, [] as boolean[]);\n\n const every = checkStatus.every(Boolean);\n const some = checkStatus.some(Boolean);\n\n if (parent) {\n parent.checked = every;\n parent.indeterminate = !every && every !== some;\n }\n\n if (!parent || check === parent) {\n break;\n }\n\n check = parent;\n }\n };\n\n const setExpandedAttributes = (trigger: HTMLButtonElement, container: Element | null) => {\n const children = container?.querySelector('[data-ul]');\n\n (trigger.childNodes[0] as Element).classList.toggle(styles['checkbox-tree__branch--icon--expanded']);\n container\n ?.closest('[data-li]')\n ?.setAttribute(\n 'aria-expanded',\n container?.closest('[data-li]')?.getAttribute('aria-expanded') === 'false' ? 'true' : 'false'\n );\n\n if (children) {\n children.classList.toggle(styles['checkbox-tree__leaves--expanded']);\n }\n };\n\n const handleChange: MouseEventHandler<HTMLDivElement> = (event) => {\n const check = event.target as HTMLInputElement;\n\n if (!check || !check.parentNode || !check.parentNode.parentNode) return;\n const parentCheckbox = check.parentNode.parentNode as HTMLElement;\n\n if (\n lessThan.md &&\n check.previousElementSibling?.tagName === 'BUTTON' &&\n parentCheckbox.getAttribute('aria-expanded') === 'false'\n ) {\n event.preventDefault();\n setExpandedAttributes(parentCheckbox.querySelector('button') as HTMLButtonElement, parentCheckbox);\n return;\n }\n\n if (checkboxNodes.current.indexOf(check) === -1) return;\n\n const children: HTMLInputElement[] = (check.parentNode.parentNode as Document)\n ? nodeArray('input', check.parentNode.parentNode as Document)\n : [];\n\n children.forEach((child) => {\n return (child.checked = child.disabled ? false : check.checked);\n });\n\n setCheckboxesState(check);\n setValue();\n };\n\n const handleExpanded: MouseEventHandler<HTMLButtonElement> = (event) => {\n const target = event.target as HTMLButtonElement;\n const parent = target.closest('[data-li]');\n setExpandedAttributes(target, parent);\n };\n\n useEffect(() => {\n checkboxNodes.current = nodeArray('input') || [];\n }, []);\n\n useEffect(() => {\n if (defaultValue) {\n checkboxNodes.current.forEach((checkbox) => {\n if (defaultValue.includes(checkbox.value)) {\n checkbox.checked = true;\n setCheckboxesState(checkbox);\n }\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [defaultValue]);\n\n return (\n <div>\n {title && <span className={styles['checkbox-tree__header']}>{title}</span>}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div onClick={handleChange} data-ul role=\"tree\" tabIndex={0}>\n {checkboxTree.map(({ itemName, children }) => (\n <div\n key={itemName}\n className={styles['checkbox-tree__branch']}\n data-li\n aria-expanded={lessThan.md ? 'false' : 'true'}\n >\n <FormField inline className={styles['checkbox-tree__branch--formfield']}>\n <Button variant=\"blank\" onClick={handleExpanded}>\n <Icon\n name=\"CheveronRight\"\n size={16}\n className={clsx(styles['checkbox-tree__branch--icon'], {\n [styles['checkbox-tree__branch--icon--expanded']]: !lessThan.md,\n })}\n />\n </Button>\n <Checkbox id={itemName} disabled={children.every((checkbox) => checkbox.disabled)} />\n <Label htmlFor={itemName}>{itemName}</Label>\n </FormField>\n <div\n className={clsx(styles['checkbox-tree__leaves'], {\n [styles['checkbox-tree__leaves--expanded']]: !lessThan.md,\n })}\n data-ul\n >\n {children.map(({ itemName, itemValue, disabled }) => (\n <div key={itemName} className={styles['checkbox-tree__leaf']} data-li>\n <FormField inline className={styles['checkbox-tree__branch--formfield']}>\n <Checkbox id={itemName} name={itemName} value={itemValue} disabled={disabled} />\n <Label htmlFor={itemName}>{itemName}</Label>\n </FormField>\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["CheckboxTree","title","checkboxTree","defaultValue","onChange","checkboxNodes","useRef","lessThan","useResponsive","nodeArray","selector","parent","setValue","values","checkbox","setCheckboxesState","check","_b","_a","checkStatus","_c","status","every","some","setExpandedAttributes","trigger","container","children","styles","handleChange","event","parentCheckbox","child","handleExpanded","target","useEffect","itemName","jsxs","FormField","jsx","Button","Icon","clsx","Checkbox","Label","itemValue","disabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCaA,KAAe,CAAC,EAAE,OAAAC,GAAO,cAAAC,GAAc,cAAAC,GAAc,UAAAC,QAAkC;AAC5F,QAAAC,IAAgBC,EAA2B,CAAA,CAAE,GAC7C,EAAE,UAAAC,MAAaC,KAEfC,IAAY,CAACC,GAAkBC,IAAS,aAAa,CAAA,EAAG,MAAM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AAW,UAAAC,GAAoB;AAAA,gBAC7E,gBAAAP,EAAAK,GAAA,EAAM,SAASR,GAAW,UAAAA,GAAS;AAAA,cAAA,GACtC,EAAA,GAJQA,CAKV,CACD;AAAA,YAAA;AAAA,UACH;AAAA,QAAA;AAAA,MAAA;AAAA,MAhCKA;AAAA,IAkCR,CAAA,GACH;AAAA,EACF,EAAA,CAAA;AAEJ;"}
@@ -64,7 +64,7 @@ r.args = {
64
64
  title: "Periode",
65
65
  checkboxTree: i,
66
66
  // eslint-disable-next-line @typescript-eslint/no-magic-numbers
67
- defaultValue: ["3", "5"],
67
+ defaultValue: ["3", "4"],
68
68
  onChange: m()
69
69
  };
70
70
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxTree.stories.js","sources":["../../../src/components/CheckboxTree/CheckboxTree.stories.tsx"],"sourcesContent":["import { fn } from '@storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { CheckboxTreeProps } from './CheckboxTree';\n\nimport { CheckboxTree } from './CheckboxTree';\n\nconst MOCK_CHECKBOX_TREE = [\n {\n itemName: 'Semester 1',\n children: [\n {\n itemName: '1.1',\n itemValue: '1',\n disabled: true,\n },\n {\n itemName: '1.2',\n itemValue: '2',\n disabled: false,\n },\n {\n itemName: '1.3',\n itemValue: '3',\n disabled: false,\n },\n ],\n },\n {\n itemName: 'Semester 2',\n children: [\n {\n itemName: '2.1',\n itemValue: '4',\n disabled: false,\n },\n {\n itemName: '2.2',\n itemValue: '5',\n disabled: true,\n },\n {\n itemName: '2.3',\n itemValue: '6',\n disabled: false,\n },\n ],\n },\n {\n itemName: 'Semester 3',\n children: [\n {\n itemName: '3',\n itemValue: '7',\n disabled: false,\n },\n ],\n },\n];\n\nconst codeString = '<CheckboxTree title={} checkboxTree={} defaultValue={} onChange={} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/CheckboxTree',\n component: CheckboxTree,\n parameters: {\n inspectComponent: CheckboxTree,\n codeString: codeString,\n },\n} as Meta<CheckboxTreeProps>;\n\nconst Template: StoryFn<CheckboxTreeProps> = (args) => <CheckboxTree {...args} />;\n\nexport const CheckboxTreeExample = Template.bind({});\nCheckboxTreeExample.args = {\n title: 'Periode',\n checkboxTree: MOCK_CHECKBOX_TREE,\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n defaultValue: ['3', '5'],\n onChange: fn(),\n};\n"],"names":["MOCK_CHECKBOX_TREE","codeString","CheckboxTree_stories","CheckboxTree","Template","args","jsx","CheckboxTreeExample","fn"],"mappings":";;;AAOA,MAAMA,IAAqB;AAAA,EACzB;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,MACR;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,MACR;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,MACR;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF,GAEMC,IAAa,0EAGJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EACF;AACF,GAEMG,IAAuC,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAc,GAAGE,EAAM,CAAA,GAElEE,IAAsBH,EAAS,KAAK,EAAE;AACnDG,EAAoB,OAAO;AAAA,EACzB,OAAO;AAAA,EACP,cAAcP;AAAA;AAAA,EAEd,cAAc,CAAC,KAAK,GAAG;AAAA,EACvB,UAAUQ,EAAG;AACf;"}
1
+ {"version":3,"file":"CheckboxTree.stories.js","sources":["../../../src/components/CheckboxTree/CheckboxTree.stories.tsx"],"sourcesContent":["import { fn } from '@storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { CheckboxTreeProps } from './CheckboxTree';\n\nimport { CheckboxTree } from './CheckboxTree';\n\nconst MOCK_CHECKBOX_TREE = [\n {\n itemName: 'Semester 1',\n children: [\n {\n itemName: '1.1',\n itemValue: '1',\n disabled: true,\n },\n {\n itemName: '1.2',\n itemValue: '2',\n disabled: false,\n },\n {\n itemName: '1.3',\n itemValue: '3',\n disabled: false,\n },\n ],\n },\n {\n itemName: 'Semester 2',\n children: [\n {\n itemName: '2.1',\n itemValue: '4',\n disabled: false,\n },\n {\n itemName: '2.2',\n itemValue: '5',\n disabled: true,\n },\n {\n itemName: '2.3',\n itemValue: '6',\n disabled: false,\n },\n ],\n },\n {\n itemName: 'Semester 3',\n children: [\n {\n itemName: '3',\n itemValue: '7',\n disabled: false,\n },\n ],\n },\n];\n\nconst codeString = '<CheckboxTree title={} checkboxTree={} defaultValue={} onChange={} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/CheckboxTree',\n component: CheckboxTree,\n parameters: {\n inspectComponent: CheckboxTree,\n codeString: codeString,\n },\n} as Meta<CheckboxTreeProps>;\n\nconst Template: StoryFn<CheckboxTreeProps> = (args) => <CheckboxTree {...args} />;\n\nexport const CheckboxTreeExample = Template.bind({});\nCheckboxTreeExample.args = {\n title: 'Periode',\n checkboxTree: MOCK_CHECKBOX_TREE,\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n defaultValue: ['3', '4'],\n onChange: fn(),\n};\n"],"names":["MOCK_CHECKBOX_TREE","codeString","CheckboxTree_stories","CheckboxTree","Template","args","jsx","CheckboxTreeExample","fn"],"mappings":";;;AAOA,MAAMA,IAAqB;AAAA,EACzB;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,MACR;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,MACR;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,MACR;AAAA,QACE,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF,GAEMC,IAAa,0EAGJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EACF;AACF,GAEMG,IAAuC,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAc,GAAGE,EAAM,CAAA,GAElEE,IAAsBH,EAAS,KAAK,EAAE;AACnDG,EAAoB,OAAO;AAAA,EACzB,OAAO;AAAA,EACP,cAAcP;AAAA;AAAA,EAEd,cAAc,CAAC,KAAK,GAAG;AAAA,EACvB,UAAUQ,EAAG;AACf;"}
@@ -1,9 +1,15 @@
1
1
  import { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
2
2
  export interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style' | 'className'> {
3
+ /** The buttons to render in the drawer. */
3
4
  buttons?: ReactNode;
5
+ /** true if the drawer should be open; otherwise, false. The default is false. */
4
6
  isOpen?: boolean;
7
+ /** The callback method that is invoked when the drawer is closed. */
5
8
  onClose: () => void;
9
+ /** The title of the drawer. */
6
10
  title: string;
11
+ /** The aria-label of the close button. */
7
12
  closeButtonAriaValueText?: string;
8
13
  }
14
+ /** Represents a Drawer component. */
9
15
  export declare function Drawer({ buttons, children, isOpen, onClose, title, closeButtonAriaValueText, ...restProps }: PropsWithChildren<DrawerProps>): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sources":["../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { useDialog } from '@react-aria/dialog';\nimport { FocusScope } from '@react-aria/focus';\nimport { OverlayContainer, useModal, useOverlay, usePreventScroll } from '@react-aria/overlays';\nimport { clsx } from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';\n\nimport styles from './Drawer.module.css';\n\nimport { Backdrop } from 'components/Backdrop/Backdrop';\nimport { OverlayCloseButton } from 'components/OverlayCloseButton';\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style' | 'className'> {\n buttons?: ReactNode;\n isOpen?: boolean;\n onClose: () => void;\n title: string;\n closeButtonAriaValueText?: string;\n}\n\nconst closingDelay = 200;\n\nexport function Drawer({\n buttons,\n children,\n isOpen,\n onClose,\n title,\n closeButtonAriaValueText = 'Close',\n ...restProps\n}: PropsWithChildren<DrawerProps>) {\n const [containerClassNames, setContainerClassNames] = useState(styles.drawer);\n // Hide content outside the modal from screen readers.\n const { modalProps } = useModal({ isDisabled: !isOpen });\n const contentRef = useRef<HTMLDivElement>(null);\n\n function onCloseDrawer() {\n setContainerClassNames(styles.drawer);\n\n globalThis.setTimeout(() => {\n onClose();\n }, closingDelay);\n }\n\n // Handle interacting outside the dialog and pressing\n // the Escape key to close the modal.\n const { overlayProps, underlayProps } = useOverlay(\n { isDismissable: true, isKeyboardDismissDisabled: false, isOpen, onClose: onCloseDrawer },\n contentRef\n );\n\n // Get props for the dialog and its title\n const { dialogProps, titleProps } = useDialog({}, contentRef);\n\n usePreventScroll({ isDisabled: !isOpen });\n\n useEffect(() => {\n // setting class name after render so that element can slide in after it is mounted and slide out\n // before it is unmounted\n setContainerClassNames(clsx(styles.drawer, { [styles['drawer--open']]: isOpen }));\n }, [isOpen]);\n\n return (\n <OverlayContainer>\n <Backdrop {...underlayProps}>\n <FocusScope contain restoreFocus>\n <aside\n {...modalProps}\n {...overlayProps}\n {...dialogProps}\n {...restProps}\n className={containerClassNames}\n ref={contentRef}\n >\n <header className={styles.drawer__header}>\n <h1 className={styles.drawer__heading} {...titleProps}>\n {title}\n </h1>\n\n <OverlayCloseButton aria-label={closeButtonAriaValueText} onClick={onCloseDrawer} />\n </header>\n\n <div className={styles.drawer__content}>{children}</div>\n\n {buttons && (\n <footer className={styles.drawer__footer}>\n <div className={styles.drawer__buttons}>{buttons}</div>\n </footer>\n )}\n </aside>\n </FocusScope>\n </Backdrop>\n </OverlayContainer>\n );\n}\n"],"names":["closingDelay","Drawer","buttons","children","isOpen","onClose","title","closeButtonAriaValueText","restProps","containerClassNames","setContainerClassNames","useState","styles","modalProps","useModal","contentRef","useRef","onCloseDrawer","overlayProps","underlayProps","useOverlay","dialogProps","titleProps","useDialog","usePreventScroll","useEffect","clsx","jsx","OverlayContainer","Backdrop","FocusScope","jsxs","OverlayCloseButton"],"mappings":";;;;;;;;;;;;;;;;GAqBMA,IAAe;AAEd,SAASC,EAAO;AAAA,EACrB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA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AA,EAAmB,cAAYzB,GAA0B,SAASU,GAAe;AAAA,QAAA,GACpF;AAAA,QAEC,gBAAAU,EAAA,OAAA,EAAI,WAAWf,EAAO,iBAAkB,UAAAT,GAAS;AAAA,QAEjDD,KACC,gBAAAyB,EAAC,UAAO,EAAA,WAAWf,EAAO,gBACxB,UAAC,gBAAAe,EAAA,OAAA,EAAI,WAAWf,EAAO,iBAAkB,UAAAV,EAAQ,CAAA,GACnD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGN,GACF,EACF,CAAA;AAEJ;"}
1
+ {"version":3,"file":"Drawer.js","sources":["../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { useDialog } from '@react-aria/dialog';\nimport { FocusScope } from '@react-aria/focus';\nimport { OverlayContainer, useModal, useOverlay, usePreventScroll } from '@react-aria/overlays';\nimport { clsx } from 'clsx';\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';\n\nimport styles from './Drawer.module.css';\n\nimport { Backdrop } from 'components/Backdrop/Backdrop';\nimport { OverlayCloseButton } from 'components/OverlayCloseButton';\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'style' | 'className'> {\n /** The buttons to render in the drawer. */\n buttons?: ReactNode;\n /** true if the drawer should be open; otherwise, false. The default is false. */\n isOpen?: boolean;\n /** The callback method that is invoked when the drawer is closed. */\n onClose: () => void;\n /** The title of the drawer. */\n title: string;\n /** The aria-label of the close button. */\n closeButtonAriaValueText?: string;\n}\n\nconst closingDelay = 200;\n\n/** Represents a Drawer component. */\nexport function Drawer({\n buttons,\n children,\n isOpen,\n onClose,\n title,\n closeButtonAriaValueText = 'Close',\n ...restProps\n}: PropsWithChildren<DrawerProps>) {\n const [containerClassNames, setContainerClassNames] = useState(styles.drawer);\n // Hide content outside the modal from screen readers.\n const { modalProps } = useModal({ isDisabled: !isOpen });\n const contentRef = useRef<HTMLDivElement>(null);\n\n function onCloseDrawer() {\n setContainerClassNames(styles.drawer);\n\n globalThis.setTimeout(() => {\n onClose();\n }, closingDelay);\n }\n\n // Handle interacting outside the dialog and pressing\n // the Escape key to close the modal.\n const { overlayProps, underlayProps } = useOverlay(\n { isDismissable: true, isKeyboardDismissDisabled: false, isOpen, onClose: onCloseDrawer },\n contentRef\n );\n\n // Get props for the dialog and its title\n const { dialogProps, titleProps } = useDialog({}, contentRef);\n\n usePreventScroll({ isDisabled: !isOpen });\n\n useEffect(() => {\n // setting class name after render so that element can slide in after it is mounted and slide out\n // before it is unmounted\n setContainerClassNames(clsx(styles.drawer, { [styles['drawer--open']]: isOpen }));\n }, [isOpen]);\n\n return (\n <OverlayContainer>\n <Backdrop {...underlayProps}>\n <FocusScope contain restoreFocus>\n <aside\n {...modalProps}\n {...overlayProps}\n {...dialogProps}\n {...restProps}\n className={containerClassNames}\n ref={contentRef}\n >\n <header className={styles.drawer__header}>\n <h1 className={styles.drawer__heading} {...titleProps}>\n {title}\n </h1>\n\n <OverlayCloseButton aria-label={closeButtonAriaValueText} onClick={onCloseDrawer} />\n </header>\n\n <div className={styles.drawer__content}>{children}</div>\n\n {buttons && (\n <footer className={styles.drawer__footer}>\n <div className={styles.drawer__buttons}>{buttons}</div>\n </footer>\n )}\n </aside>\n </FocusScope>\n </Backdrop>\n </OverlayContainer>\n );\n}\n"],"names":["closingDelay","Drawer","buttons","children","isOpen","onClose","title","closeButtonAriaValueText","restProps","containerClassNames","setContainerClassNames","useState","styles","modalProps","useModal","contentRef","useRef","onCloseDrawer","overlayProps","underlayProps","useOverlay","dialogProps","titleProps","useDialog","usePreventScroll","useEffect","clsx","jsx","OverlayContainer","Backdrop","FocusScope","jsxs","OverlayCloseButton"],"mappings":";;;;;;;;;;;;;;;;GA0BMA,IAAe;AAGd,SAASC,EAAO;AAAA,EACrB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,0BAAAC,IAA2B;AAAA,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AASU,GAAe;AAAA,QAAA,GACpF;AAAA,QAEC,gBAAAU,EAAA,OAAA,EAAI,WAAWf,EAAO,iBAAkB,UAAAT,GAAS;AAAA,QAEjDD,KACC,gBAAAyB,EAAC,UAAO,EAAA,WAAWf,EAAO,gBACxB,UAAC,gBAAAe,EAAA,OAAA,EAAI,WAAWf,EAAO,iBAAkB,UAAAV,EAAQ,CAAA,GACnD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGN,GACF,EACF,CAAA;AAEJ;"}
@@ -1,15 +1,15 @@
1
- import { jsxs as n, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
2
  import { OverlayProvider as p } from "@react-aria/overlays";
3
3
  import { fn as m } from "../../index-MQ0yPLdl.js";
4
- import { useState as u } from "react";
5
- import { Drawer as a } from "./Drawer.js";
6
- import { Button as r } from "../Button/Button.js";
7
- import { ButtonGroup as c } from "../ButtonGroup/ButtonGroup.js";
4
+ import { useState as c } from "react";
5
+ import { Drawer as r } from "./Drawer.js";
6
+ import { Button as n } from "../Button/Button.js";
7
+ import { ButtonGroup as u } from "../ButtonGroup/ButtonGroup.js";
8
8
  const d = `
9
9
  <Drawer isOpen={isOpen} onClose={onCloseFunction} title={title} buttons={buttons}> {children} </Drawer>
10
- `, C = {
10
+ `, O = {
11
11
  title: "Molecules/Drawer",
12
- component: a,
12
+ component: r,
13
13
  argTypes: {
14
14
  isOpen: {
15
15
  table: {
@@ -28,14 +28,15 @@ const d = `
28
28
  }
29
29
  },
30
30
  parameters: {
31
+ inspectComponent: r,
31
32
  codeString: d
32
33
  }
33
34
  }, s = (l) => {
34
- const [e, o] = u(!1);
35
- return /* @__PURE__ */ n(p, { children: [
36
- /* @__PURE__ */ t(r, { onClick: () => o(!e), variant: "primary", children: "Open drawer" }),
35
+ const [e, o] = c(!1);
36
+ return /* @__PURE__ */ a(p, { children: [
37
+ /* @__PURE__ */ t(n, { onClick: () => o(!e), variant: "primary", children: "Open drawer" }),
37
38
  e && /* @__PURE__ */ t(
38
- a,
39
+ r,
39
40
  {
40
41
  ...l,
41
42
  isOpen: e,
@@ -54,14 +55,14 @@ b.args = {
54
55
  const f = s.bind({});
55
56
  f.args = {
56
57
  ...i,
57
- buttons: /* @__PURE__ */ n(c, { children: [
58
- /* @__PURE__ */ t(r, { variant: "primary", children: "Primary Example Button" }),
59
- /* @__PURE__ */ t(r, { variant: "secondary", children: "Secondary Example Button" })
58
+ buttons: /* @__PURE__ */ a(u, { children: [
59
+ /* @__PURE__ */ t(n, { variant: "primary", children: "Primary Example Button" }),
60
+ /* @__PURE__ */ t(n, { variant: "secondary", children: "Secondary Example Button" })
60
61
  ] })
61
62
  };
62
63
  export {
63
64
  b as DrawerExample,
64
65
  f as WithButtons,
65
- C as default
66
+ O as default
66
67
  };
67
68
  //# sourceMappingURL=Drawer.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.stories.js","sources":["../../../src/components/Drawer/Drawer.stories.tsx"],"sourcesContent":["import { OverlayProvider } from '@react-aria/overlays';\nimport { fn } from '@storybook/test';\nimport { useState } from 'react';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { DrawerProps } from './Drawer';\n\nimport { Drawer } from './Drawer';\n\nimport { Button } from 'components/Button';\nimport { ButtonGroup } from 'components/ButtonGroup';\n\nconst codeString = `\n <Drawer isOpen={isOpen} onClose={onCloseFunction} title={title} buttons={buttons}> {children} </Drawer>\n`;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Molecules/Drawer',\n component: Drawer,\n argTypes: {\n isOpen: {\n table: {\n disable: true,\n },\n },\n buttons: {\n table: {\n disable: true,\n },\n },\n closeButtonAriaValueText: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n codeString: codeString,\n },\n} as Meta<DrawerProps>;\n\nconst Template: StoryFn<DrawerProps> = (args) => {\n const [isOpen, setIsOpen] = useState(false);\n\n return (\n <OverlayProvider>\n <Button onClick={() => setIsOpen(!isOpen)} variant=\"primary\">\n Open drawer\n </Button>\n {isOpen && (\n <Drawer\n {...args}\n isOpen={isOpen}\n onClose={() => {\n fn()();\n return setIsOpen(!isOpen);\n }}\n >\n Example Drawer Content\n </Drawer>\n )}\n </OverlayProvider>\n );\n};\n\nconst defaultArgs: Partial<DrawerProps> = {\n title: 'Example Title',\n closeButtonAriaValueText: 'Close',\n};\n\nexport const DrawerExample = Template.bind({});\nDrawerExample.args = {\n ...defaultArgs,\n};\n\nexport const WithButtons = Template.bind({});\nWithButtons.args = {\n ...defaultArgs,\n buttons: (\n <ButtonGroup>\n <Button variant=\"primary\">Primary Example Button</Button>\n <Button variant=\"secondary\">Secondary Example Button</Button>\n </ButtonGroup>\n ),\n};\n"],"names":["codeString","Drawer_stories","Drawer","Template","args","isOpen","setIsOpen","useState","OverlayProvider","jsx","Button","fn","defaultArgs","DrawerExample","WithButtons","ButtonGroup"],"mappings":";;;;;;;AAYA,MAAMA,IAAa;AAAA;AAAA,GAKJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,0BAA0B;AAAA,MACxB,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,YAAAF;AAAA,EACF;AACF,GAEMG,IAAiC,CAACC,MAAS;AAC/C,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK;AAE1C,2BACGC,GACC,EAAA,UAAA;AAAA,IAAC,gBAAAC,EAAAC,GAAA,EAAO,SAAS,MAAMJ,EAAU,CAACD,CAAM,GAAG,SAAQ,WAAU,UAE7D,cAAA,CAAA;AAAA,IACCA,KACC,gBAAAI;AAAA,MAACP;AAAA,MAAA;AAAA,QACE,GAAGE;AAAA,QACJ,QAAAC;AAAA,QACA,SAAS,OACPM,EAAK,EAAA,GACEL,EAAU,CAACD,CAAM;AAAA,QAE3B,UAAA;AAAA,MAAA;AAAA,IAED;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEMO,IAAoC;AAAA,EACxC,OAAO;AAAA,EACP,0BAA0B;AAC5B,GAEaC,IAAgBV,EAAS,KAAK,EAAE;AAC7CU,EAAc,OAAO;AAAA,EACnB,GAAGD;AACL;AAEO,MAAME,IAAcX,EAAS,KAAK,EAAE;AAC3CW,EAAY,OAAO;AAAA,EACjB,GAAGF;AAAA,EACH,2BACGG,GACC,EAAA,UAAA;AAAA,IAAC,gBAAAN,EAAAC,GAAA,EAAO,SAAQ,WAAU,UAAsB,0BAAA;AAAA,IAC/C,gBAAAD,EAAAC,GAAA,EAAO,SAAQ,aAAY,UAAwB,4BAAA;AAAA,EAAA,GACtD;AAEJ;"}
1
+ {"version":3,"file":"Drawer.stories.js","sources":["../../../src/components/Drawer/Drawer.stories.tsx"],"sourcesContent":["import { OverlayProvider } from '@react-aria/overlays';\nimport { fn } from '@storybook/test';\nimport { useState } from 'react';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { DrawerProps } from './Drawer';\n\nimport { Drawer } from './Drawer';\n\nimport { Button } from 'components/Button';\nimport { ButtonGroup } from 'components/ButtonGroup';\n\nconst codeString = `\n <Drawer isOpen={isOpen} onClose={onCloseFunction} title={title} buttons={buttons}> {children} </Drawer>\n`;\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Molecules/Drawer',\n component: Drawer,\n argTypes: {\n isOpen: {\n table: {\n disable: true,\n },\n },\n buttons: {\n table: {\n disable: true,\n },\n },\n closeButtonAriaValueText: {\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Drawer,\n codeString: codeString,\n },\n} as Meta<DrawerProps>;\n\nconst Template: StoryFn<DrawerProps> = (args) => {\n const [isOpen, setIsOpen] = useState(false);\n\n return (\n <OverlayProvider>\n <Button onClick={() => setIsOpen(!isOpen)} variant=\"primary\">\n Open drawer\n </Button>\n {isOpen && (\n <Drawer\n {...args}\n isOpen={isOpen}\n onClose={() => {\n fn()();\n return setIsOpen(!isOpen);\n }}\n >\n Example Drawer Content\n </Drawer>\n )}\n </OverlayProvider>\n );\n};\n\nconst defaultArgs: Partial<DrawerProps> = {\n title: 'Example Title',\n closeButtonAriaValueText: 'Close',\n};\n\nexport const DrawerExample = Template.bind({});\nDrawerExample.args = {\n ...defaultArgs,\n};\n\nexport const WithButtons = Template.bind({});\nWithButtons.args = {\n ...defaultArgs,\n buttons: (\n <ButtonGroup>\n <Button variant=\"primary\">Primary Example Button</Button>\n <Button variant=\"secondary\">Secondary Example Button</Button>\n </ButtonGroup>\n ),\n};\n"],"names":["codeString","Drawer_stories","Drawer","Template","args","isOpen","setIsOpen","useState","OverlayProvider","jsx","Button","fn","defaultArgs","DrawerExample","WithButtons","ButtonGroup"],"mappings":";;;;;;;AAYA,MAAMA,IAAa;AAAA;AAAA,GAKJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,IACA,0BAA0B;AAAA,MACxB,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EACF;AACF,GAEMG,IAAiC,CAACC,MAAS;AAC/C,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK;AAE1C,2BACGC,GACC,EAAA,UAAA;AAAA,IAAC,gBAAAC,EAAAC,GAAA,EAAO,SAAS,MAAMJ,EAAU,CAACD,CAAM,GAAG,SAAQ,WAAU,UAE7D,cAAA,CAAA;AAAA,IACCA,KACC,gBAAAI;AAAA,MAACP;AAAA,MAAA;AAAA,QACE,GAAGE;AAAA,QACJ,QAAAC;AAAA,QACA,SAAS,OACPM,EAAK,EAAA,GACEL,EAAU,CAACD,CAAM;AAAA,QAE3B,UAAA;AAAA,MAAA;AAAA,IAED;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEMO,IAAoC;AAAA,EACxC,OAAO;AAAA,EACP,0BAA0B;AAC5B,GAEaC,IAAgBV,EAAS,KAAK,EAAE;AAC7CU,EAAc,OAAO;AAAA,EACnB,GAAGD;AACL;AAEO,MAAME,IAAcX,EAAS,KAAK,EAAE;AAC3CW,EAAY,OAAO;AAAA,EACjB,GAAGF;AAAA,EACH,2BACGG,GACC,EAAA,UAAA;AAAA,IAAC,gBAAAN,EAAAC,GAAA,EAAO,SAAQ,WAAU,UAAsB,0BAAA;AAAA,IAC/C,gBAAAD,EAAAC,GAAA,EAAO,SAAQ,aAAY,UAAwB,4BAAA;AAAA,EAAA,GACtD;AAEJ;"}
@@ -1,5 +1,8 @@
1
1
  export interface EmptyStateDataDisplayProps {
2
+ /** The main text to display. */
2
3
  label: string;
4
+ /** The sub-text to display. */
3
5
  paragraph: string;
4
6
  }
7
+ /** Represents a component to indicate an empty state. */
5
8
  export declare function EmptyStateDataDisplay({ label, paragraph }: EmptyStateDataDisplayProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyStateDataDisplay.js","sources":["../../../src/components/EmptyStateDataDisplay/EmptyStateDataDisplay.tsx"],"sourcesContent":["import styles from './EmptyStateDataDisplay.module.css';\n\nimport { Icon } from 'components/Icon';\n\nexport interface EmptyStateDataDisplayProps {\n label: string;\n paragraph: string;\n}\n\nexport function EmptyStateDataDisplay({ label, paragraph }: EmptyStateDataDisplayProps) {\n return (\n <div className={styles['empty-state-data-display_wrapper']}>\n <div className={styles['empty-state-data-display_icon-frame']}>\n <Icon name=\"CubeTransparent\" />\n </div>\n <div className={styles['empty-state-data-display_text-content']}>\n <label className={styles['empty-state-data-display_label']}>{label}</label>\n <p className={styles['empty-state-data-display_paragraph']}>{paragraph}</p>\n </div>\n </div>\n );\n}\n"],"names":["EmptyStateDataDisplay","label","paragraph","jsxs","styles","jsx","Icon"],"mappings":";;;;;;;;;AASO,SAASA,EAAsB,EAAE,OAAAC,GAAO,WAAAC,KAAyC;AACtF,SACG,gBAAAC,EAAA,OAAA,EAAI,WAAWC,EAAO,kCAAkC,GACvD,UAAA;AAAA,IAAC,gBAAAC,EAAA,OAAA,EAAI,WAAWD,EAAO,qCAAqC,GAC1D,UAAC,gBAAAC,EAAAC,GAAA,EAAK,MAAK,kBAAA,CAAkB,EAC/B,CAAA;AAAA,IACC,gBAAAH,EAAA,OAAA,EAAI,WAAWC,EAAO,uCAAuC,GAC5D,UAAA;AAAA,MAAA,gBAAAC,EAAC,SAAM,EAAA,WAAWD,EAAO,gCAAgC,GAAI,UAAMH,GAAA;AAAA,wBAClE,KAAE,EAAA,WAAWG,EAAO,oCAAoC,GAAI,UAAUF,GAAA;AAAA,IAAA,GACzE;AAAA,EACF,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"EmptyStateDataDisplay.js","sources":["../../../src/components/EmptyStateDataDisplay/EmptyStateDataDisplay.tsx"],"sourcesContent":["import styles from './EmptyStateDataDisplay.module.css';\n\nimport { Icon } from 'components/Icon';\n\nexport interface EmptyStateDataDisplayProps {\n /** The main text to display. */\n label: string;\n /** The sub-text to display. */\n paragraph: string;\n}\n\n/** Represents a component to indicate an empty state. */\nexport function EmptyStateDataDisplay({ label, paragraph }: EmptyStateDataDisplayProps) {\n return (\n <div className={styles['empty-state-data-display_wrapper']}>\n <div className={styles['empty-state-data-display_icon-frame']}>\n <Icon name=\"CubeTransparent\" />\n </div>\n <div className={styles['empty-state-data-display_text-content']}>\n <label className={styles['empty-state-data-display_label']}>{label}</label>\n <p className={styles['empty-state-data-display_paragraph']}>{paragraph}</p>\n </div>\n </div>\n );\n}\n"],"names":["EmptyStateDataDisplay","label","paragraph","jsxs","styles","jsx","Icon"],"mappings":";;;;;;;;;AAYO,SAASA,EAAsB,EAAE,OAAAC,GAAO,WAAAC,KAAyC;AACtF,SACG,gBAAAC,EAAA,OAAA,EAAI,WAAWC,EAAO,kCAAkC,GACvD,UAAA;AAAA,IAAC,gBAAAC,EAAA,OAAA,EAAI,WAAWD,EAAO,qCAAqC,GAC1D,UAAC,gBAAAC,EAAAC,GAAA,EAAK,MAAK,kBAAA,CAAkB,EAC/B,CAAA;AAAA,IACC,gBAAAH,EAAA,OAAA,EAAI,WAAWC,EAAO,uCAAuC,GAC5D,UAAA;AAAA,MAAA,gBAAAC,EAAC,SAAM,EAAA,WAAWD,EAAO,gCAAgC,GAAI,UAAMH,GAAA;AAAA,wBAClE,KAAE,EAAA,WAAWG,EAAO,oCAAoC,GAAI,UAAUF,GAAA;AAAA,IAAA,GACzE;AAAA,EACF,EAAA,CAAA;AAEJ;"}
@@ -1,9 +1,10 @@
1
1
  import { jsx as p } from "react/jsx-runtime";
2
2
  import { EmptyStateDataDisplay as a } from "./EmptyStateDataDisplay.js";
3
- const e = "<EmptyStateDataDisplay label={label} paragraph={paragraph} />", m = {
3
+ const e = "<EmptyStateDataDisplay label={label} paragraph={paragraph} />", o = {
4
4
  title: "Molecules/EmptyStateDataDisplay",
5
5
  component: a,
6
6
  parameters: {
7
+ inspectComponent: a,
7
8
  codeString: e
8
9
  }
9
10
  }, s = (t) => /* @__PURE__ */ p(a, { ...t }), l = s.bind({});
@@ -13,6 +14,6 @@ l.args = {
13
14
  };
14
15
  export {
15
16
  l as EmptyStateDataDisplayExample,
16
- m as default
17
+ o as default
17
18
  };
18
19
  //# sourceMappingURL=EmptyStateDataDisplay.stories.js.map