@arbor-education/design-system.components 0.1.5 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/.github/workflows/release.yml +1 -1
  2. package/CHANGELOG.md +12 -0
  3. package/dist/components/formField/fieldset/Fieldset.d.ts +6 -0
  4. package/dist/components/formField/fieldset/Fieldset.d.ts.map +1 -0
  5. package/dist/components/formField/fieldset/Fieldset.js +7 -0
  6. package/dist/components/formField/fieldset/Fieldset.js.map +1 -0
  7. package/dist/components/formField/fieldset/Fieldset.stories.d.ts +28 -0
  8. package/dist/components/formField/fieldset/Fieldset.stories.d.ts.map +1 -0
  9. package/dist/components/formField/fieldset/Fieldset.stories.js +51 -0
  10. package/dist/components/formField/fieldset/Fieldset.stories.js.map +1 -0
  11. package/dist/components/formField/fieldset/Fieldset.test.d.ts +2 -0
  12. package/dist/components/formField/fieldset/Fieldset.test.d.ts.map +1 -0
  13. package/dist/components/formField/fieldset/Fieldset.test.js +62 -0
  14. package/dist/components/formField/fieldset/Fieldset.test.js.map +1 -0
  15. package/dist/components/formField/inputs/checkbox/CheckboxGroup.d.ts +8 -0
  16. package/dist/components/formField/inputs/checkbox/CheckboxGroup.d.ts.map +1 -0
  17. package/dist/components/formField/inputs/checkbox/CheckboxGroup.js +8 -0
  18. package/dist/components/formField/inputs/checkbox/CheckboxGroup.js.map +1 -0
  19. package/dist/components/formField/inputs/checkbox/CheckboxGroup.test.d.ts +2 -0
  20. package/dist/components/formField/inputs/checkbox/CheckboxGroup.test.d.ts.map +1 -0
  21. package/dist/components/formField/inputs/checkbox/CheckboxGroup.test.js +86 -0
  22. package/dist/components/formField/inputs/checkbox/CheckboxGroup.test.js.map +1 -0
  23. package/dist/components/formField/inputs/checkbox/CheckboxInput.stories.d.ts +3 -1
  24. package/dist/components/formField/inputs/checkbox/CheckboxInput.stories.d.ts.map +1 -1
  25. package/dist/components/formField/inputs/checkbox/CheckboxInput.stories.js +7 -0
  26. package/dist/components/formField/inputs/checkbox/CheckboxInput.stories.js.map +1 -1
  27. package/dist/components/formField/inputs/radio/RadioButtonGroup.d.ts +11 -0
  28. package/dist/components/formField/inputs/radio/RadioButtonGroup.d.ts.map +1 -0
  29. package/dist/components/formField/inputs/radio/RadioButtonGroup.js +8 -0
  30. package/dist/components/formField/inputs/radio/RadioButtonGroup.js.map +1 -0
  31. package/dist/components/formField/inputs/radio/RadioButtonGroup.test.d.ts +2 -0
  32. package/dist/components/formField/inputs/radio/RadioButtonGroup.test.d.ts.map +1 -0
  33. package/dist/components/formField/inputs/radio/RadioButtonGroup.test.js +86 -0
  34. package/dist/components/formField/inputs/radio/RadioButtonGroup.test.js.map +1 -0
  35. package/dist/components/formField/inputs/radio/RadioButtonInput.stories.d.ts.map +1 -1
  36. package/dist/components/formField/inputs/radio/RadioButtonInput.stories.js +8 -2
  37. package/dist/components/formField/inputs/radio/RadioButtonInput.stories.js.map +1 -1
  38. package/dist/components/modal/Modal.d.ts +25 -0
  39. package/dist/components/modal/Modal.d.ts.map +1 -0
  40. package/dist/components/modal/Modal.js +22 -0
  41. package/dist/components/modal/Modal.js.map +1 -0
  42. package/dist/components/modal/Modal.stories.d.ts +13 -0
  43. package/dist/components/modal/Modal.stories.d.ts.map +1 -0
  44. package/dist/components/modal/Modal.stories.js +23 -0
  45. package/dist/components/modal/Modal.stories.js.map +1 -0
  46. package/dist/components/modal/Modal.test.d.ts +2 -0
  47. package/dist/components/modal/Modal.test.d.ts.map +1 -0
  48. package/dist/components/modal/Modal.test.js +131 -0
  49. package/dist/components/modal/Modal.test.js.map +1 -0
  50. package/dist/components/modal/ModalBody.d.ts +7 -0
  51. package/dist/components/modal/ModalBody.d.ts.map +1 -0
  52. package/dist/components/modal/ModalBody.js +7 -0
  53. package/dist/components/modal/ModalBody.js.map +1 -0
  54. package/dist/components/modal/ModalCloseButton.d.ts +3 -0
  55. package/dist/components/modal/ModalCloseButton.d.ts.map +1 -0
  56. package/dist/components/modal/ModalCloseButton.js +25 -0
  57. package/dist/components/modal/ModalCloseButton.js.map +1 -0
  58. package/dist/components/modal/ModalFooter.d.ts +7 -0
  59. package/dist/components/modal/ModalFooter.d.ts.map +1 -0
  60. package/dist/components/modal/ModalFooter.js +7 -0
  61. package/dist/components/modal/ModalFooter.js.map +1 -0
  62. package/dist/components/modal/ModalHeader.d.ts +7 -0
  63. package/dist/components/modal/ModalHeader.d.ts.map +1 -0
  64. package/dist/components/modal/ModalHeader.js +8 -0
  65. package/dist/components/modal/ModalHeader.js.map +1 -0
  66. package/dist/components/modal/ModalTitle.d.ts +3 -0
  67. package/dist/components/modal/ModalTitle.d.ts.map +1 -0
  68. package/dist/components/modal/ModalTitle.js +8 -0
  69. package/dist/components/modal/ModalTitle.js.map +1 -0
  70. package/dist/components/modal/modalManager/ModalManager.d.ts +7 -0
  71. package/dist/components/modal/modalManager/ModalManager.d.ts.map +1 -0
  72. package/dist/components/modal/modalManager/ModalManager.js +22 -0
  73. package/dist/components/modal/modalManager/ModalManager.js.map +1 -0
  74. package/dist/components/modal/modalManager/ModalManager.stories.d.ts +13 -0
  75. package/dist/components/modal/modalManager/ModalManager.stories.d.ts.map +1 -0
  76. package/dist/components/modal/modalManager/ModalManager.stories.js +110 -0
  77. package/dist/components/modal/modalManager/ModalManager.stories.js.map +1 -0
  78. package/dist/components/modal/modalManager/ModalManager.test.d.ts +2 -0
  79. package/dist/components/modal/modalManager/ModalManager.test.d.ts.map +1 -0
  80. package/dist/components/modal/modalManager/ModalManager.test.js +191 -0
  81. package/dist/components/modal/modalManager/ModalManager.test.js.map +1 -0
  82. package/dist/components/separator/Separator.d.ts +7 -0
  83. package/dist/components/separator/Separator.d.ts.map +1 -0
  84. package/dist/components/separator/Separator.js +8 -0
  85. package/dist/components/separator/Separator.js.map +1 -0
  86. package/dist/components/separator/Separator.stories.d.ts +10 -0
  87. package/dist/components/separator/Separator.stories.d.ts.map +1 -0
  88. package/dist/components/separator/Separator.stories.js +12 -0
  89. package/dist/components/separator/Separator.stories.js.map +1 -0
  90. package/dist/components/separator/Separator.test.d.ts +2 -0
  91. package/dist/components/separator/Separator.test.d.ts.map +1 -0
  92. package/dist/components/separator/Separator.test.js +10 -0
  93. package/dist/components/separator/Separator.test.js.map +1 -0
  94. package/dist/components/table/Table.d.ts +20 -0
  95. package/dist/components/table/Table.d.ts.map +1 -1
  96. package/dist/components/table/Table.js +45 -7
  97. package/dist/components/table/Table.js.map +1 -1
  98. package/dist/components/table/Table.stories.d.ts.map +1 -1
  99. package/dist/components/table/Table.stories.js +14 -1
  100. package/dist/components/table/Table.stories.js.map +1 -1
  101. package/dist/components/table/Table.test.js +315 -2
  102. package/dist/components/table/Table.test.js.map +1 -1
  103. package/dist/components/table/pagination/TableSettingsDropdown.d.ts +2 -0
  104. package/dist/components/table/pagination/TableSettingsDropdown.d.ts.map +1 -0
  105. package/dist/components/table/pagination/TableSettingsDropdown.js +43 -0
  106. package/dist/components/table/pagination/TableSettingsDropdown.js.map +1 -0
  107. package/dist/components/table/useTableSettings.d.ts +22 -0
  108. package/dist/components/table/useTableSettings.d.ts.map +1 -0
  109. package/dist/components/table/useTableSettings.js +36 -0
  110. package/dist/components/table/useTableSettings.js.map +1 -0
  111. package/dist/index.css +102 -1
  112. package/dist/index.css.map +1 -1
  113. package/dist/index.d.ts +4 -0
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +4 -0
  116. package/dist/index.js.map +1 -1
  117. package/dist/utils/Constants.d.ts +5 -0
  118. package/dist/utils/Constants.d.ts.map +1 -1
  119. package/dist/utils/Constants.js +5 -0
  120. package/dist/utils/Constants.js.map +1 -1
  121. package/dist/utils/ModalUtils.d.ts +7 -0
  122. package/dist/utils/ModalUtils.d.ts.map +1 -0
  123. package/dist/utils/ModalUtils.js +14 -0
  124. package/dist/utils/ModalUtils.js.map +1 -0
  125. package/dist/utils/hooks/useComponentDidUpdate.d.ts +7 -0
  126. package/dist/utils/hooks/useComponentDidUpdate.d.ts.map +1 -0
  127. package/dist/utils/hooks/useComponentDidUpdate.js +18 -0
  128. package/dist/utils/hooks/useComponentDidUpdate.js.map +1 -0
  129. package/dist/utils/hooks/useComponentDidUpdate.test.d.ts +2 -0
  130. package/dist/utils/hooks/useComponentDidUpdate.test.d.ts.map +1 -0
  131. package/dist/utils/hooks/useComponentDidUpdate.test.js +69 -0
  132. package/dist/utils/hooks/useComponentDidUpdate.test.js.map +1 -0
  133. package/package.json +1 -1
  134. package/src/components/formField/fieldset/Fieldset.stories.tsx +89 -0
  135. package/src/components/formField/fieldset/Fieldset.test.tsx +85 -0
  136. package/src/components/formField/fieldset/Fieldset.tsx +17 -0
  137. package/src/components/formField/fieldset/fieldset.scss +19 -0
  138. package/src/components/formField/inputs/checkbox/CheckboxGroup.test.tsx +127 -0
  139. package/src/components/formField/inputs/checkbox/CheckboxGroup.tsx +17 -0
  140. package/src/components/formField/inputs/checkbox/CheckboxInput.stories.tsx +12 -1
  141. package/src/components/formField/inputs/radio/RadioButtonGroup.test.tsx +190 -0
  142. package/src/components/formField/inputs/radio/RadioButtonGroup.tsx +22 -0
  143. package/src/components/formField/inputs/radio/RadioButtonInput.stories.tsx +16 -7
  144. package/src/components/formField/label/label.scss +1 -1
  145. package/src/components/modal/Modal.stories.tsx +37 -0
  146. package/src/components/modal/Modal.test.tsx +244 -0
  147. package/src/components/modal/Modal.tsx +65 -0
  148. package/src/components/modal/ModalBody.tsx +16 -0
  149. package/src/components/modal/ModalCloseButton.tsx +39 -0
  150. package/src/components/modal/ModalFooter.tsx +14 -0
  151. package/src/components/modal/ModalHeader.tsx +20 -0
  152. package/src/components/modal/ModalTitle.tsx +12 -0
  153. package/src/components/modal/modal.scss +74 -0
  154. package/src/components/modal/modalManager/ModalManager.stories.tsx +497 -0
  155. package/src/components/modal/modalManager/ModalManager.test.tsx +255 -0
  156. package/src/components/modal/modalManager/ModalManager.tsx +40 -0
  157. package/src/components/modal/modalManager/modalManager.scss +4 -0
  158. package/src/components/separator/Separator.stories.tsx +15 -0
  159. package/src/components/separator/Separator.test.tsx +10 -0
  160. package/src/components/separator/Separator.tsx +15 -0
  161. package/src/components/separator/separator.scss +6 -0
  162. package/src/components/table/Table.stories.tsx +14 -1
  163. package/src/components/table/Table.test.tsx +553 -1
  164. package/src/components/table/Table.tsx +80 -24
  165. package/src/components/table/pagination/TableSettingsDropdown.tsx +90 -0
  166. package/src/components/table/table.scss +8 -0
  167. package/src/components/table/useTableSettings.ts +59 -0
  168. package/src/index.scss +4 -0
  169. package/src/index.ts +4 -0
  170. package/src/tokens.scss +1 -0
  171. package/src/utils/Constants.ts +6 -0
  172. package/src/utils/ModalUtils.ts +17 -0
  173. package/src/utils/hooks/useComponentDidUpdate.test.ts +107 -0
  174. package/src/utils/hooks/useComponentDidUpdate.ts +19 -0
@@ -0,0 +1,497 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { ModalManager } from './ModalManager';
3
+ import { ModalUtils } from '../../../utils/ModalUtils';
4
+ import { Button } from '../../button/Button';
5
+ import { Section } from '../../section/Section';
6
+ import { FormField } from '../../formField/FormField';
7
+ import { generateUuid } from '../../../utils/generateUuid';
8
+ import { Modal } from '../Modal';
9
+ import { fn } from 'storybook/test';
10
+ import { Icon } from 'Components/icon/Icon';
11
+
12
+ const meta: Meta = {
13
+ title: 'Components/Modals/ModalManager',
14
+ parameters: {
15
+ layout: 'fullscreen',
16
+ docs: {
17
+ description: {
18
+ component: 'The ModalManager is a container that manages the display of modals. It listens for events to add or remove modals.',
19
+ },
20
+ },
21
+ },
22
+
23
+ tags: ['autodocs'],
24
+ };
25
+
26
+ export default meta;
27
+
28
+ type Story = StoryObj;
29
+
30
+ let modalCount = 0;
31
+
32
+ const addModalWithContent = (content: React.ReactNode) => {
33
+ modalCount++;
34
+ ModalUtils.addModal({
35
+ children: content,
36
+ });
37
+ };
38
+
39
+ const removeModal = () => {
40
+ if (modalCount > 0) {
41
+ modalCount--;
42
+ }
43
+ ModalUtils.removeModal();
44
+ };
45
+
46
+ export const Default: Story = {
47
+ render: () => (
48
+ <>
49
+ <ModalManager />
50
+ <div style={{ padding: '1rem', display: 'flex', gap: '1rem' }}>
51
+ <Button
52
+ onClick={() =>
53
+ addModalWithContent(
54
+ <>
55
+ <Modal.Header>
56
+ <Modal.Title>Simple Modal</Modal.Title>
57
+ </Modal.Header>
58
+ <Modal.Body>
59
+ <p>This is a simple modal with basic content.</p>
60
+ </Modal.Body>
61
+ </>,
62
+ )}
63
+ >
64
+ Open Simple Modal
65
+ </Button>
66
+ </div>
67
+ </>
68
+ ),
69
+ };
70
+
71
+ export const WithHeaderAndFooter: Story = {
72
+ render: () => {
73
+ const handleSave = () => {
74
+ alert('Save clicked!');
75
+ ModalUtils.removeModal();
76
+ };
77
+
78
+ const handleCancel = () => {
79
+ ModalUtils.removeModal();
80
+ };
81
+
82
+ return (
83
+ <>
84
+ <ModalManager />
85
+ <div style={{ padding: '1rem', display: 'flex', gap: '1rem' }}>
86
+ <Button
87
+ onClick={() =>
88
+ addModalWithContent(
89
+ <>
90
+ <Modal.Header>
91
+ <Modal.Title>Modal with Header and Footer</Modal.Title>
92
+ </Modal.Header>
93
+ <Modal.Body>
94
+ <p>This modal has both a header with a close button and a footer with action buttons.</p>
95
+ </Modal.Body>
96
+ <Modal.Footer>
97
+ <div style={{ display: 'flex', gap: '1rem', justifyContent: 'flex-end' }}>
98
+ <Button variant="secondary" onClick={handleCancel}>
99
+ Cancel
100
+ </Button>
101
+ <Button variant="primary" onClick={handleSave}>
102
+ Save Changes
103
+ </Button>
104
+ </div>
105
+ </Modal.Footer>
106
+ </>,
107
+ )}
108
+ >
109
+ Open Modal with Footer
110
+ </Button>
111
+ </div>
112
+ </>
113
+ );
114
+ },
115
+ };
116
+
117
+ export const WithSections: Story = {
118
+ render: () => (
119
+ <>
120
+ <ModalManager />
121
+ <div style={{ padding: '1rem', display: 'flex', gap: '1rem' }}>
122
+ <Button
123
+ onClick={() =>
124
+ addModalWithContent(
125
+ <>
126
+ <Modal.Header>
127
+ <Modal.Title>Modal with Sections</Modal.Title>
128
+ </Modal.Header>
129
+ <Modal.Body>
130
+ <Section title="Section 1" collapsible>
131
+ <p>
132
+ Aliquip ea tempor officia irure do qui culpa. Laborum proident laboris aliqua ad Lorem eiusmod fugiat dolore qui occaecat adipisicing.
133
+ Dolore quis nisi occaecat commodo labore ad nulla aliquip in. Enim labore nisi laborum nostrud officia ad nulla ut quis.
134
+ Aute excepteur quis amet aliquip. Excepteur Lorem cupidatat adipisicing consectetur ipsum Lorem.
135
+ </p>
136
+ </Section>
137
+ <Section title="Section 2" collapsible collapsed>
138
+ <p>
139
+ Veniam adipisicing culpa id esse duis in officia consequat veniam ad ullamco sint sunt anim.
140
+ Incididunt exercitation dolor Lorem anim aute ad deserunt. Nulla culpa sint aliqua ea Lorem sint.
141
+ Elit sit consectetur minim cillum consectetur pariatur Lorem labore consectetur nisi consectetur officia exercitation.
142
+ Est consectetur commodo deserunt ipsum aliqua occaecat qui sunt consectetur.
143
+ </p>
144
+ </Section>
145
+ <Section title="Section 3" collapsible>
146
+ <p>
147
+ Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,
148
+ totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
149
+ </p>
150
+ </Section>
151
+ </Modal.Body>
152
+ </>,
153
+ )}
154
+ >
155
+ Open Modal with Sections
156
+ </Button>
157
+ </div>
158
+ </>
159
+ ),
160
+ };
161
+
162
+ export const WithFormFields: Story = {
163
+ render: () => {
164
+ const handleSubmit = () => {
165
+ alert('Form submitted!');
166
+ ModalUtils.removeModal();
167
+ };
168
+
169
+ return (
170
+ <>
171
+ <ModalManager />
172
+ <div style={{ padding: '1rem', display: 'flex', gap: '1rem' }}>
173
+ <Button
174
+ onClick={() =>
175
+ addModalWithContent(
176
+ <>
177
+ <Modal.Header>
178
+ <Modal.Title>User Information Form</Modal.Title>
179
+ </Modal.Header>
180
+ <Modal.Body>
181
+ <FormField
182
+ id={generateUuid()}
183
+ label="Your Name"
184
+ inputType="text"
185
+ inputProps={{ placeholder: 'e.g. Jane Doe' }}
186
+ fieldDescription="Please enter your full name."
187
+ />
188
+ <FormField
189
+ id={generateUuid()}
190
+ label="Email Address"
191
+ inputType="text"
192
+ inputProps={{ placeholder: 'e.g. jane@example.com', type: 'email' }}
193
+ />
194
+ <FormField
195
+ id={generateUuid()}
196
+ label="Message"
197
+ inputType="textarea"
198
+ inputProps={{ placeholder: 'Enter your message here...', rows: 4 }}
199
+ fieldDescription="Maximum 500 characters."
200
+ />
201
+ <FormField
202
+ id={generateUuid()}
203
+ label="Password"
204
+ inputType="selectDropdown"
205
+ inputProps={{
206
+ options: [{ label: 'Option 1', value: 'option1' }, { label: 'Option 2', value: 'option2' }, { label: 'Option 3', value: 'option3' }],
207
+ onSelectionChange: fn(),
208
+ }}
209
+ />
210
+ </Modal.Body>
211
+ <Modal.Footer>
212
+ <div style={{ display: 'flex', gap: '1rem', justifyContent: 'flex-end' }}>
213
+ <Button variant="secondary" onClick={removeModal}>
214
+ Cancel
215
+ </Button>
216
+ <Button variant="primary" onClick={handleSubmit}>
217
+ Submit
218
+ </Button>
219
+ </div>
220
+ </Modal.Footer>
221
+ </>,
222
+ )}
223
+ >
224
+ Open Form Modal
225
+ </Button>
226
+ </div>
227
+ </>
228
+ );
229
+ },
230
+ };
231
+
232
+ export const WithScrollableContent: Story = {
233
+ render: () => {
234
+ const handleClose = () => {
235
+ ModalUtils.removeModal();
236
+ };
237
+
238
+ return (
239
+ <>
240
+ <ModalManager />
241
+ <div style={{ padding: '1rem', display: 'flex', gap: '1rem' }}>
242
+ <Button
243
+ onClick={() =>
244
+ addModalWithContent(
245
+ <>
246
+ <Modal.Header>
247
+ <Modal.Title>Long Content Modal</Modal.Title>
248
+ </Modal.Header>
249
+ <Modal.Body>
250
+ <Section title="Introduction" collapsible>
251
+ <p>
252
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
253
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
254
+ </p>
255
+ </Section>
256
+ <Section title="Details" collapsible>
257
+ <p>
258
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
259
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
260
+ </p>
261
+ <FormField
262
+ id={generateUuid()}
263
+ label="Field 1"
264
+ inputType="text"
265
+ inputProps={{ placeholder: 'Enter value' }}
266
+ />
267
+ <FormField
268
+ id={generateUuid()}
269
+ label="Field 2"
270
+ inputType="text"
271
+ inputProps={{ placeholder: 'Enter value' }}
272
+ />
273
+ </Section>
274
+ <Section title="Additional Information" collapsible>
275
+ <p>
276
+ Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,
277
+ totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
278
+ Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores
279
+ eos qui ratione voluptatem sequi nesciunt.
280
+ </p>
281
+ <FormField
282
+ id={generateUuid()}
283
+ label="Long Text Field"
284
+ inputType="textarea"
285
+ inputProps={{ placeholder: 'Enter long text', rows: 6 }}
286
+ />
287
+ </Section>
288
+ <Section title="More Content" collapsible>
289
+ <p>
290
+ Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit,
291
+ sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
292
+ Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam.
293
+ </p>
294
+ <FormField
295
+ id={generateUuid()}
296
+ label="Field 3"
297
+ inputType="number"
298
+ inputProps={{ placeholder: 'Enter number' }}
299
+ />
300
+ <FormField
301
+ id={generateUuid()}
302
+ label="Field 4"
303
+ inputType="text"
304
+ inputProps={{ placeholder: 'Enter value' }}
305
+ />
306
+ </Section>
307
+ <Section title="Final Section" collapsible collapsed>
308
+ <p>
309
+ At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque
310
+ corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa
311
+ qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
312
+ </p>
313
+ <FormField
314
+ id={generateUuid()}
315
+ label="Final Field"
316
+ inputType="text"
317
+ inputProps={{ placeholder: 'Enter value' }}
318
+ />
319
+ </Section>
320
+ </Modal.Body>
321
+ <Modal.Footer>
322
+ <div style={{ display: 'flex', gap: '1rem', justifyContent: 'flex-end' }}>
323
+ <Button variant="secondary" onClick={handleClose}>
324
+ Close
325
+ </Button>
326
+ <Button variant="primary" onClick={handleClose}>
327
+ Save
328
+ </Button>
329
+ </div>
330
+ </Modal.Footer>
331
+ </>,
332
+ )}
333
+ >
334
+ Open Scrollable Modal
335
+ </Button>
336
+ </div>
337
+ </>
338
+ );
339
+ },
340
+ };
341
+
342
+ export const DestructiveAction: Story = {
343
+ render: () => {
344
+ const handleDelete = () => {
345
+ alert('Item deleted!');
346
+ ModalUtils.removeModal();
347
+ };
348
+
349
+ const handleCancel = () => {
350
+ ModalUtils.removeModal();
351
+ };
352
+
353
+ return (
354
+ <>
355
+ <ModalManager />
356
+ <div style={{ padding: '1rem', display: 'flex', gap: '1rem' }}>
357
+ <Button
358
+ onClick={() =>
359
+ addModalWithContent(
360
+ <>
361
+ <Modal.Header>
362
+ <Modal.Title>Confirm Deletion</Modal.Title>
363
+ </Modal.Header>
364
+ <Modal.Body>
365
+ <p>Are you sure you want to delete this item? This action cannot be undone.</p>
366
+ <p style={{ marginTop: '1rem', fontWeight: 'bold' }}>
367
+ Item: Important Document.pdf
368
+ </p>
369
+ </Modal.Body>
370
+ <Modal.Footer>
371
+ <div style={{ display: 'flex', gap: '1rem', justifyContent: 'flex-end' }}>
372
+ <Button variant="secondary" onClick={handleCancel}>
373
+ Cancel
374
+ </Button>
375
+ <Button variant="primary-destructive" onClick={handleDelete}>
376
+ Delete
377
+ </Button>
378
+ </div>
379
+ </Modal.Footer>
380
+ </>,
381
+ )}
382
+ >
383
+ Open Deletion Confirmation Modal
384
+ </Button>
385
+ </div>
386
+ </>
387
+ );
388
+ },
389
+ };
390
+
391
+ export const SimpleConfirmation: Story = {
392
+ render: () => {
393
+ const handleConfirm = () => {
394
+ alert('Confirmed!');
395
+ ModalUtils.removeModal();
396
+ };
397
+
398
+ const handleCancel = () => {
399
+ ModalUtils.removeModal();
400
+ };
401
+
402
+ return (
403
+ <>
404
+ <ModalManager />
405
+ <div style={{ padding: '1rem', display: 'flex', gap: '1rem' }}>
406
+ <Button
407
+ onClick={() =>
408
+ addModalWithContent(
409
+ <>
410
+ <Modal.Header>
411
+ <Modal.Title>Confirm Action</Modal.Title>
412
+ </Modal.Header>
413
+ <Modal.Body>
414
+ <p>Are you sure you want to proceed with this action?</p>
415
+ </Modal.Body>
416
+ <Modal.Footer>
417
+ <div style={{ display: 'flex', gap: '1rem', justifyContent: 'flex-end' }}>
418
+ <Button variant="secondary" onClick={handleCancel}>
419
+ No
420
+ </Button>
421
+ <Button variant="primary" onClick={handleConfirm}>
422
+ Yes
423
+ </Button>
424
+ </div>
425
+ </Modal.Footer>
426
+ </>,
427
+ )}
428
+ >
429
+ Open Confirmation Modal
430
+ </Button>
431
+ </div>
432
+ </>
433
+ );
434
+ },
435
+ };
436
+
437
+ export const ExampleErrorModal: Story = {
438
+ render: () => {
439
+ const handleConfirm = () => {
440
+ ModalUtils.removeModal();
441
+ };
442
+
443
+ const handleCancel = () => {
444
+ ModalUtils.removeModal();
445
+ };
446
+ return (
447
+ <>
448
+ <ModalManager />
449
+ <div style={{ padding: '1rem', display: 'flex', gap: '1rem' }}>
450
+ <Button
451
+ onClick={() =>
452
+ addModalWithContent(
453
+ <>
454
+ <Modal.Header>
455
+ <Icon name="triangle-alert" size={24} color="var(--color-semantic-destructive-500)" />
456
+ <Modal.Title>Sorry, we can’t find this page</Modal.Title>
457
+ </Modal.Header>
458
+ <Modal.Body>
459
+ <span>
460
+ <b>Please try finding the page using the navigation.</b>
461
+ {' '}
462
+ If you can't find what you're looking for, there are two options depending on your support plan:
463
+ </span>
464
+ <ul>
465
+ <li>
466
+ <b>Arbor supported:</b>
467
+ {' '}
468
+ Press here to send an email to our Support Team using our Contact Us form (the error ID will be added automatically).
469
+ </li>
470
+ <li>
471
+ <b>Partner supported:</b>
472
+ {' '}
473
+ Please get in touch with your Support Partner, and let them know the error ID below.
474
+ </li>
475
+ </ul>
476
+ <span>ID:f47ecbd4-319b-11f0-a5ae-06f9b8bc5d95</span>
477
+ </Modal.Body>
478
+ <Modal.Footer>
479
+ <div style={{ display: 'flex', gap: '1rem', justifyContent: 'flex-end' }}>
480
+ <Button variant="tertiary" onClick={handleCancel}>
481
+ Close
482
+ </Button>
483
+ <Button variant="primary" onClick={handleConfirm}>
484
+ Primary Action
485
+ </Button>
486
+ </div>
487
+ </Modal.Footer>
488
+ </>,
489
+ )}
490
+ >
491
+ Open Deletion Confirmation Modal
492
+ </Button>
493
+ </div>
494
+ </>
495
+ );
496
+ },
497
+ };