@gtivr4/a1-design-system-react 0.1.0 → 0.2.3

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 (108) hide show
  1. package/package.json +1 -1
  2. package/src/color-scheme.css +586 -24
  3. package/src/components/accordion/Accordion.jsx +80 -0
  4. package/src/components/accordion/accordion.css +118 -0
  5. package/src/components/banner/Banner.jsx +66 -0
  6. package/src/components/banner/banner.css +205 -0
  7. package/src/components/bleed/Bleed.jsx +27 -0
  8. package/src/components/bleed/bleed.css +5 -0
  9. package/src/components/blockquote/Blockquote.jsx +40 -0
  10. package/src/components/blockquote/blockquote.css +166 -0
  11. package/src/components/breadcrumb/Breadcrumb.jsx +82 -0
  12. package/src/components/breadcrumb/breadcrumb.css +133 -0
  13. package/src/components/button/button.css +42 -12
  14. package/src/components/button-container/ButtonContainer.jsx +20 -1
  15. package/src/components/button-container/button-container.css +19 -1
  16. package/src/components/calendar/Calendar.jsx +383 -0
  17. package/src/components/calendar/calendar.css +225 -0
  18. package/src/components/card/Card.jsx +50 -12
  19. package/src/components/card/card.css +178 -14
  20. package/src/components/checkbox-group/CheckboxGroup.jsx +120 -0
  21. package/src/components/checkbox-group/checkbox-group.css +304 -0
  22. package/src/components/cluster/Cluster.jsx +52 -0
  23. package/src/components/cluster/cluster.css +9 -0
  24. package/src/components/code/Code.jsx +135 -0
  25. package/src/components/code/code.css +60 -0
  26. package/src/components/data-table/DataTable.jsx +721 -0
  27. package/src/components/data-table/DataTableFilters.jsx +339 -0
  28. package/src/components/data-table/data-table-filters.css +259 -0
  29. package/src/components/data-table/data-table.css +425 -0
  30. package/src/components/dialog/Dialog.jsx +45 -2
  31. package/src/components/dialog/dialog.css +13 -4
  32. package/src/components/divider/Divider.jsx +64 -0
  33. package/src/components/divider/divider.css +170 -0
  34. package/src/components/field/CreditCardField.jsx +131 -0
  35. package/src/components/field/DateField.jsx +11 -0
  36. package/src/components/field/NumberField.jsx +11 -0
  37. package/src/components/field/PhoneField.jsx +107 -0
  38. package/src/components/field/SelectField.jsx +86 -0
  39. package/src/components/field/TextField.jsx +83 -0
  40. package/src/components/field/TextareaField.jsx +147 -0
  41. package/src/components/field/TimeField.jsx +11 -0
  42. package/src/components/field/ZipField.jsx +114 -0
  43. package/src/components/field/credit-card.css +30 -0
  44. package/src/components/field/field.css +380 -0
  45. package/src/components/field/textarea-field.css +185 -0
  46. package/src/components/field-row/FieldRow.jsx +23 -0
  47. package/src/components/field-row/field-row.css +51 -0
  48. package/src/components/fieldset/Fieldset.jsx +49 -0
  49. package/src/components/fieldset/fieldset.css +75 -0
  50. package/src/components/figure/Figure.jsx +63 -0
  51. package/src/components/figure/figure.css +97 -0
  52. package/src/components/grid/Grid.jsx +36 -2
  53. package/src/components/grid/grid.css +129 -4
  54. package/src/components/heading/Heading.jsx +41 -1
  55. package/src/components/heading/heading.css +65 -4
  56. package/src/components/icon/icon.css +1 -0
  57. package/src/components/icon-button/icon-button.css +1 -0
  58. package/src/components/inline/inline.css +51 -0
  59. package/src/components/inline-editable/InlineEditable.jsx +77 -0
  60. package/src/components/inline-editable/inline-editable.css +47 -0
  61. package/src/components/inset/Inset.jsx +27 -0
  62. package/src/components/inset/inset.css +6 -0
  63. package/src/components/labels/Labels.jsx +5 -5
  64. package/src/components/link/Link.jsx +2 -3
  65. package/src/components/link/link.css +30 -1
  66. package/src/components/list/List.jsx +92 -0
  67. package/src/components/list/list.css +178 -0
  68. package/src/components/menu/Menu.jsx +243 -10
  69. package/src/components/menu/menu.css +157 -17
  70. package/src/components/message/Message.jsx +25 -50
  71. package/src/components/message/message.css +50 -33
  72. package/src/components/notification/Notification.jsx +1 -1
  73. package/src/components/page-layout/PageLayout.jsx +16 -1
  74. package/src/components/page-layout/page-layout.css +97 -4
  75. package/src/components/page-nav/PageNav.jsx +110 -0
  76. package/src/components/page-nav/page-nav.css +167 -0
  77. package/src/components/paragraph/Paragraph.jsx +35 -2
  78. package/src/components/paragraph/paragraph.css +38 -1
  79. package/src/components/radio-group/RadioGroup.jsx +121 -0
  80. package/src/components/radio-group/radio-group.css +268 -0
  81. package/src/components/section/Section.jsx +108 -0
  82. package/src/components/section/section.css +280 -0
  83. package/src/components/segmented-control/SegmentedControl.jsx +4 -0
  84. package/src/components/segmented-control/segmented.css +13 -0
  85. package/src/components/side-nav/SideNav.jsx +29 -9
  86. package/src/components/side-nav/scrim.css +1 -1
  87. package/src/components/side-nav/side-nav.css +70 -32
  88. package/src/components/snackbar/Snackbar.jsx +56 -0
  89. package/src/components/snackbar/snackbar.css +113 -0
  90. package/src/components/spacer/Spacer.jsx +36 -0
  91. package/src/components/spacer/spacer.css +44 -0
  92. package/src/components/stack/Stack.jsx +100 -0
  93. package/src/components/stack/stack.css +37 -0
  94. package/src/components/switch/Switch.jsx +114 -0
  95. package/src/components/switch/switch.css +276 -0
  96. package/src/components/system-banner/SystemBanner.jsx +57 -0
  97. package/src/components/system-banner/system-banner.css +118 -0
  98. package/src/components/tabs/Tabs.jsx +96 -28
  99. package/src/components/tabs/tabs.css +352 -15
  100. package/src/components/token-select/TokenSelect.jsx +159 -0
  101. package/src/components/token-select/token-select.css +110 -0
  102. package/src/components/top-header/TopHeader.jsx +641 -0
  103. package/src/components/top-header/top-header.css +337 -0
  104. package/src/illustrations/ComponentThumbnails.jsx +227 -0
  105. package/src/index.js +41 -5
  106. package/src/themes.css +256 -5
  107. package/src/utilities/spacing.css +8 -0
  108. package/src/utilities/sr-only.css +16 -0
@@ -0,0 +1,425 @@
1
+ /* ═══════════════════════════════════════════════════════════════════════════
2
+ DataTable
3
+ ═══════════════════════════════════════════════════════════════════════════ */
4
+
5
+ /* ── Wrapper ─────────────────────────────────────────────────────────────── */
6
+
7
+ .a1-data-table-wrapper {
8
+ box-sizing: border-box;
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: var(--base-spacing-16);
12
+ }
13
+
14
+ .a1-data-table-sort {
15
+ display: none;
16
+ }
17
+
18
+ .a1-data-table-bulk-actions {
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: flex-start;
22
+ gap: var(--base-spacing-12);
23
+ padding: var(--base-spacing-8) var(--base-spacing-12);
24
+ border: var(--component-data-table-border-width) solid var(--semantic-color-border-subtle);
25
+ border-radius: var(--component-card-border-radius);
26
+ background: var(--semantic-color-surface-panel);
27
+ }
28
+
29
+ .a1-data-table-bulk-actions__count {
30
+ font-family: var(--component-paragraph-font-family);
31
+ font-size: var(--semantic-font-size-body-sm);
32
+ font-weight: var(--component-data-table-header-font-weight);
33
+ color: var(--semantic-color-text-default);
34
+ }
35
+
36
+ .a1-data-table-bulk-actions__controls {
37
+ display: flex;
38
+ align-items: center;
39
+ gap: var(--base-spacing-8);
40
+ }
41
+
42
+ /* ── Scroll container ────────────────────────────────────────────────────── */
43
+
44
+ .a1-data-table-scroll {
45
+ border: var(--component-data-table-border-width) solid var(--semantic-color-border-subtle);
46
+ border-radius: var(--component-card-border-radius);
47
+ }
48
+
49
+ /* Opt-in horizontal scroll — add scrollable prop to DataTable */
50
+ .a1-data-table-scroll--scrollable {
51
+ overflow-x: auto;
52
+ }
53
+
54
+ /* ── Table ───────────────────────────────────────────────────────────────── */
55
+
56
+ .a1-data-table {
57
+ width: 100%;
58
+ border-collapse: collapse;
59
+ font-family: var(--component-paragraph-font-family);
60
+ font-size: var(--component-data-table-density-default-font-size);
61
+ color: var(--semantic-color-text-default);
62
+ }
63
+
64
+ /* ── Caption ─────────────────────────────────────────────────────────────── */
65
+
66
+ .a1-data-table caption {
67
+ position: absolute;
68
+ width: 1px;
69
+ height: 1px;
70
+ padding: 0;
71
+ margin: -1px;
72
+ overflow: hidden;
73
+ clip: rect(0, 0, 0, 0);
74
+ white-space: nowrap;
75
+ border: 0;
76
+ }
77
+
78
+ /* ── Header ──────────────────────────────────────────────────────────────── */
79
+
80
+ .a1-data-table th {
81
+ padding: var(--component-data-table-density-default-cell-padding-block)
82
+ var(--component-data-table-density-default-cell-padding-inline);
83
+ text-align: start;
84
+ font-weight: var(--component-data-table-header-font-weight);
85
+ font-size: var(--semantic-font-size-body-sm);
86
+ color: var(--semantic-color-text-muted);
87
+ white-space: nowrap;
88
+ background: var(--semantic-color-surface-panel);
89
+ border-bottom: var(--component-data-table-border-width) solid var(--semantic-color-border-subtle);
90
+ position: sticky;
91
+ top: 0;
92
+ }
93
+
94
+ .a1-data-table th:first-child {
95
+ border-start-start-radius: calc(var(--component-card-border-radius) - 1px);
96
+ }
97
+
98
+ .a1-data-table th:last-child {
99
+ border-start-end-radius: calc(var(--component-card-border-radius) - 1px);
100
+ }
101
+
102
+ .a1-data-table__select-header,
103
+ .a1-data-table__select-cell {
104
+ width: 1%;
105
+ }
106
+
107
+ .a1-data-table__checkbox {
108
+ display: inline-flex;
109
+ width: 16px;
110
+ height: 16px;
111
+ margin: 0;
112
+ accent-color: var(--semantic-color-action-background);
113
+ cursor: pointer;
114
+ }
115
+
116
+ .a1-data-table__checkbox:focus-visible {
117
+ outline: var(--component-data-table-focus-ring-width) solid var(--component-field-focus-ring-color);
118
+ outline-offset: var(--component-data-table-focus-ring-offset);
119
+ }
120
+
121
+ .a1-data-table tbody tr[data-selected="true"] td {
122
+ background: var(--semantic-color-surface-panel);
123
+ }
124
+
125
+ .a1-data-table tbody tr[data-selectable-row="true"] {
126
+ cursor: pointer;
127
+ }
128
+
129
+ .a1-data-table tbody tr[data-selectable-row="true"]:hover td {
130
+ background: var(--semantic-color-surface-panel);
131
+ }
132
+
133
+ .a1-data-table tbody tr[data-selectable-row="true"]:active td {
134
+ background: var(--semantic-color-surface-raised);
135
+ }
136
+
137
+ .a1-data-table th[aria-sort="ascending"],
138
+ .a1-data-table th[aria-sort="descending"] {
139
+ color: var(--semantic-color-text-default);
140
+ }
141
+
142
+ .a1-data-table__sort-button {
143
+ appearance: none;
144
+ display: inline-flex;
145
+ align-items: center;
146
+ justify-content: inherit;
147
+ gap: var(--base-spacing-4);
148
+ width: 100%;
149
+ padding: 0;
150
+ border: 0;
151
+ background: transparent;
152
+ color: inherit;
153
+ font: inherit;
154
+ text-align: inherit;
155
+ cursor: pointer;
156
+ }
157
+
158
+ .a1-data-table__sort-button:hover {
159
+ color: var(--semantic-color-text-default);
160
+ }
161
+
162
+ .a1-data-table__sort-button:focus-visible {
163
+ outline: var(--component-data-table-focus-ring-width) solid var(--component-field-focus-ring-color);
164
+ outline-offset: var(--component-data-table-focus-ring-offset);
165
+ border-radius: var(--base-radius-sm);
166
+ }
167
+
168
+ .a1-data-table__sort-icon {
169
+ flex-shrink: 0;
170
+ font-size: 1.125em;
171
+ opacity: 0.72;
172
+ }
173
+
174
+ .a1-data-table th[aria-sort="none"] .a1-data-table__sort-icon {
175
+ opacity: 0.44;
176
+ }
177
+
178
+ /* ── Column alignment ────────────────────────────────────────────────────── */
179
+
180
+ .a1-data-table th[data-align="end"],
181
+ .a1-data-table td[data-align="end"] {
182
+ text-align: end;
183
+ font-variant-numeric: tabular-nums;
184
+ }
185
+
186
+ .a1-data-table th[data-align="center"],
187
+ .a1-data-table td[data-align="center"] {
188
+ text-align: center;
189
+ }
190
+
191
+ /* ── Cells ───────────────────────────────────────────────────────────────── */
192
+
193
+ .a1-data-table td {
194
+ padding: var(--component-data-table-density-default-cell-padding-block)
195
+ var(--component-data-table-density-default-cell-padding-inline);
196
+ vertical-align: middle;
197
+ border-bottom: var(--component-data-table-border-width) solid var(--semantic-color-border-subtle);
198
+ }
199
+
200
+ .a1-data-table tbody tr:last-child td {
201
+ border-bottom: none;
202
+ }
203
+
204
+ /* ── Zebra striping ──────────────────────────────────────────────────────── */
205
+
206
+ .a1-data-table--zebra tbody tr:nth-child(even) td {
207
+ background: var(--semantic-color-surface-panel);
208
+ }
209
+
210
+ .a1-data-table--zebra tbody tr[data-selectable-row="true"]:hover td {
211
+ background: var(--semantic-color-surface-raised);
212
+ }
213
+
214
+ /* ── Density: compact ────────────────────────────────────────────────────── */
215
+
216
+ .a1-data-table--compact {
217
+ font-size: var(--component-data-table-density-compact-font-size);
218
+ }
219
+
220
+ .a1-data-table--compact th,
221
+ .a1-data-table--compact td {
222
+ padding: var(--component-data-table-density-compact-cell-padding-block)
223
+ var(--component-data-table-density-compact-cell-padding-inline);
224
+ }
225
+
226
+ .a1-data-table--compact caption {
227
+ padding: var(--component-data-table-density-compact-cell-padding-block)
228
+ var(--component-data-table-density-compact-cell-padding-inline);
229
+ }
230
+
231
+ /* ── Density: comfortable ────────────────────────────────────────────────── */
232
+
233
+ .a1-data-table--comfortable {
234
+ font-size: var(--component-data-table-density-comfortable-font-size);
235
+ }
236
+
237
+ .a1-data-table--comfortable th,
238
+ .a1-data-table--comfortable td {
239
+ padding: var(--component-data-table-density-comfortable-cell-padding-block)
240
+ var(--component-data-table-density-comfortable-cell-padding-inline);
241
+ }
242
+
243
+ .a1-data-table--comfortable caption {
244
+ padding: var(--component-data-table-density-comfortable-cell-padding-block)
245
+ var(--component-data-table-density-comfortable-cell-padding-inline);
246
+ }
247
+
248
+ /* ── Avatar cell ─────────────────────────────────────────────────────────── */
249
+
250
+ .a1-data-table__avatar-cell {
251
+ display: flex;
252
+ align-items: center;
253
+ gap: var(--base-spacing-10);
254
+ }
255
+
256
+ .a1-data-table__avatar {
257
+ flex-shrink: 0;
258
+ display: inline-flex;
259
+ align-items: center;
260
+ justify-content: center;
261
+ width: 28px;
262
+ height: 28px;
263
+ border-radius: 9999px;
264
+ background: var(--semantic-color-action-background);
265
+ color: var(--semantic-color-action-foreground);
266
+ font-size: 10px;
267
+ font-weight: 600;
268
+ letter-spacing: 0.02em;
269
+ user-select: none;
270
+ }
271
+
272
+ .a1-data-table--compact .a1-data-table__avatar {
273
+ width: 22px;
274
+ height: 22px;
275
+ font-size: 9px;
276
+ }
277
+
278
+ .a1-data-table__actions {
279
+ display: inline-flex;
280
+ align-items: center;
281
+ justify-content: flex-end;
282
+ gap: var(--base-spacing-8);
283
+ }
284
+
285
+ /* ── Empty state ─────────────────────────────────────────────────────────── */
286
+
287
+ .a1-data-table__empty {
288
+ padding: var(--base-spacing-48) var(--base-spacing-24);
289
+ display: flex;
290
+ justify-content: center;
291
+ }
292
+
293
+ /* ── Pagination footer ───────────────────────────────────────────────────── */
294
+
295
+ .a1-data-table-footer {
296
+ display: flex;
297
+ align-items: center;
298
+ justify-content: space-between;
299
+ gap: var(--base-spacing-12);
300
+ flex-wrap: wrap;
301
+ }
302
+
303
+ .a1-data-table-footer__count {
304
+ font-family: var(--component-paragraph-font-family);
305
+ font-size: var(--semantic-font-size-body-sm);
306
+ color: var(--semantic-color-text-muted);
307
+ white-space: nowrap;
308
+ }
309
+
310
+ /* ── Responsive — card-flip pattern ──────────────────────────────────────── */
311
+ /* Each row becomes a labeled card. thead is visually hidden (still accessible). */
312
+
313
+ @media (max-width: 640px) {
314
+ .a1-data-table-bulk-actions {
315
+ align-items: flex-start;
316
+ flex-direction: column;
317
+ }
318
+
319
+ .a1-data-table-sort {
320
+ display: block;
321
+ }
322
+
323
+ .a1-data-table-scroll {
324
+ border: none;
325
+ border-radius: 0;
326
+ }
327
+
328
+ .a1-data-table-scroll--scrollable {
329
+ overflow-x: visible; /* card layout doesn't need horizontal scroll */
330
+ }
331
+
332
+ .a1-data-table,
333
+ .a1-data-table thead,
334
+ .a1-data-table tbody,
335
+ .a1-data-table tr,
336
+ .a1-data-table td {
337
+ display: block;
338
+ }
339
+
340
+ /* Visually hide header row but keep it accessible for screen readers */
341
+ .a1-data-table thead tr {
342
+ position: absolute;
343
+ width: 1px;
344
+ height: 1px;
345
+ padding: 0;
346
+ margin: -1px;
347
+ overflow: hidden;
348
+ clip: rect(0, 0, 0, 0);
349
+ white-space: nowrap;
350
+ border: 0;
351
+ }
352
+
353
+ .a1-data-table tbody tr {
354
+ border: var(--component-data-table-border-width) solid var(--semantic-color-border-subtle);
355
+ border-radius: var(--component-card-border-radius);
356
+ margin-bottom: var(--base-spacing-12);
357
+ overflow: hidden;
358
+ }
359
+
360
+ .a1-data-table tbody tr:last-child {
361
+ margin-bottom: 0;
362
+ }
363
+
364
+ .a1-data-table td {
365
+ display: flex;
366
+ align-items: center;
367
+ gap: var(--base-spacing-12);
368
+ border-bottom: var(--component-data-table-border-width) solid var(--semantic-color-border-subtle);
369
+ padding: var(--component-data-table-density-default-cell-padding-block)
370
+ var(--component-data-table-density-default-cell-padding-inline);
371
+ }
372
+
373
+ .a1-data-table td > :not(.a1-data-table__avatar-cell):not(.a1-data-table__actions) {
374
+ min-width: 0;
375
+ }
376
+
377
+ .a1-data-table__actions {
378
+ flex-wrap: wrap;
379
+ justify-content: flex-start;
380
+ }
381
+
382
+ .a1-data-table td:last-child {
383
+ border-bottom: none;
384
+ }
385
+
386
+ .a1-data-table__select-cell {
387
+ width: auto;
388
+ }
389
+
390
+ /* Column label shown before each cell value */
391
+ .a1-data-table td::before {
392
+ content: attr(data-label);
393
+ flex-shrink: 0;
394
+ min-width: 110px;
395
+ font-weight: var(--component-data-table-header-font-weight);
396
+ font-size: var(--semantic-font-size-body-sm);
397
+ color: var(--semantic-color-text-muted);
398
+ }
399
+
400
+ /* Numeric/end-aligned cells reset to start in card mode */
401
+ .a1-data-table td[data-align="end"] {
402
+ text-align: start;
403
+ }
404
+
405
+ /* Zebra has no meaning in card mode */
406
+ .a1-data-table--zebra tbody tr:nth-child(even) td {
407
+ background: transparent;
408
+ }
409
+
410
+ /* Density variants: compact cell padding in mobile */
411
+ .a1-data-table--compact td {
412
+ padding: var(--component-data-table-density-compact-cell-padding-block)
413
+ var(--component-data-table-density-compact-cell-padding-inline);
414
+ }
415
+
416
+ .a1-data-table--comfortable td {
417
+ padding: var(--component-data-table-density-comfortable-cell-padding-block)
418
+ var(--component-data-table-density-comfortable-cell-padding-inline);
419
+ }
420
+
421
+ .a1-data-table-footer {
422
+ flex-direction: column;
423
+ align-items: flex-start;
424
+ }
425
+ }
@@ -1,17 +1,31 @@
1
1
  import { useEffect, useRef } from "react";
2
2
  import "./dialog.css";
3
3
  import { IconButton } from "../icon-button/IconButton.jsx";
4
+ import { ButtonContainer } from "../button-container/ButtonContainer.jsx";
5
+
6
+ const FOCUSABLE_SELECTORS = [
7
+ "button:not([disabled])",
8
+ "[href]",
9
+ "input:not([disabled])",
10
+ "select:not([disabled])",
11
+ "textarea:not([disabled])",
12
+ '[tabindex]:not([tabindex="-1"])',
13
+ ].join(", ");
4
14
 
5
15
  export function Dialog({ open = false, onClose, title, footer, children, ...props }) {
6
16
  const ref = useRef(null);
17
+ const triggerRef = useRef(null);
7
18
 
8
19
  useEffect(() => {
9
20
  const el = ref.current;
10
21
  if (!el) return;
11
22
  if (open) {
23
+ triggerRef.current = document.activeElement;
12
24
  if (!el.open) el.showModal();
13
25
  } else if (el.open) {
14
26
  el.close();
27
+ triggerRef.current?.focus();
28
+ triggerRef.current = null;
15
29
  }
16
30
  }, [open]);
17
31
 
@@ -26,6 +40,31 @@ export function Dialog({ open = false, onClose, title, footer, children, ...prop
26
40
  return () => el.removeEventListener("cancel", handleCancel);
27
41
  }, [onClose]);
28
42
 
43
+ useEffect(() => {
44
+ const el = ref.current;
45
+ if (!open || !el) return;
46
+ const handleKeyDown = (e) => {
47
+ if (e.key !== "Tab") return;
48
+ const focusable = [...el.querySelectorAll(FOCUSABLE_SELECTORS)];
49
+ if (focusable.length === 0) return;
50
+ const first = focusable[0];
51
+ const last = focusable[focusable.length - 1];
52
+ if (e.shiftKey) {
53
+ if (document.activeElement === first) {
54
+ e.preventDefault();
55
+ last.focus();
56
+ }
57
+ } else {
58
+ if (document.activeElement === last) {
59
+ e.preventDefault();
60
+ first.focus();
61
+ }
62
+ }
63
+ };
64
+ el.addEventListener("keydown", handleKeyDown);
65
+ return () => el.removeEventListener("keydown", handleKeyDown);
66
+ }, [open]);
67
+
29
68
  return (
30
69
  <dialog ref={ref} className="a1-dialog" {...props}>
31
70
  <div className="a1-dialog__header">
@@ -37,8 +76,12 @@ export function Dialog({ open = false, onClose, title, footer, children, ...prop
37
76
  className="a1-dialog__close"
38
77
  />
39
78
  </div>
40
- <div className="a1-dialog__body">{children}</div>
41
- {footer && <div className="a1-dialog__footer">{footer}</div>}
79
+ <div className="a1-dialog__body" tabIndex={0}>{children}</div>
80
+ {footer && (
81
+ <div className="a1-dialog__footer">
82
+ <ButtonContainer align="end">{footer}</ButtonContainer>
83
+ </div>
84
+ )}
42
85
  </dialog>
43
86
  );
44
87
  }
@@ -6,7 +6,7 @@
6
6
  background: var(--semantic-color-surface-page);
7
7
  box-shadow: var(--component-dialog-shadow);
8
8
  color: var(--semantic-color-text-default);
9
- width: min(560px, calc(100vw - var(--base-spacing-64)));
9
+ width: min(var(--component-dialog-width), calc(100vw - var(--base-spacing-64)));
10
10
  max-height: calc(100dvh - var(--base-spacing-64));
11
11
  overflow: hidden;
12
12
  }
@@ -50,9 +50,18 @@
50
50
  }
51
51
 
52
52
  .a1-dialog__footer {
53
- display: flex;
54
- justify-content: flex-end;
55
- gap: var(--base-spacing-12);
56
53
  padding-top: var(--base-spacing-16);
57
54
  border-top: var(--component-dialog-footer-border-width) solid var(--semantic-color-border-subtle);
58
55
  }
56
+
57
+ @media (--bp-sm-down) {
58
+ .a1-dialog {
59
+ padding-inline: var(--base-spacing-20);
60
+ }
61
+ }
62
+
63
+ @media (--bp-xs) {
64
+ .a1-dialog {
65
+ width: calc(100vw - var(--base-spacing-32));
66
+ }
67
+ }
@@ -0,0 +1,64 @@
1
+ import "./divider.css";
2
+
3
+ const orientations = ["horizontal", "vertical"];
4
+ const variants = ["subtle", "strong", "accent", "dashed", "dotted"];
5
+ const sizes = ["xs", "sm", "md", "lg"];
6
+ const spacing = ["none", "xs", "sm", "md", "lg", "xl", "xxl"];
7
+ const breakpoints = ["xs", "sm", "md", "lg", "xl"];
8
+
9
+ function isResponsiveOrientation(orientation) {
10
+ return orientation !== null && typeof orientation === "object" && !Array.isArray(orientation);
11
+ }
12
+
13
+ function resolveBaseOrientation(orientation) {
14
+ if (!isResponsiveOrientation(orientation)) {
15
+ return orientations.includes(orientation) ? orientation : "horizontal";
16
+ }
17
+ return orientations.includes(orientation.xs) ? orientation.xs : "horizontal";
18
+ }
19
+
20
+ function getOrientationClasses(orientation) {
21
+ if (!isResponsiveOrientation(orientation)) {
22
+ const resolved = resolveBaseOrientation(orientation);
23
+ return [`a1-divider--${resolved}`];
24
+ }
25
+
26
+ let lastKnown = resolveBaseOrientation(orientation);
27
+ return breakpoints.map((bp) => {
28
+ if (orientations.includes(orientation[bp])) lastKnown = orientation[bp];
29
+ return `a1-divider--${bp}-${lastKnown === "horizontal" ? "h" : "v"}`;
30
+ });
31
+ }
32
+
33
+ export function Divider({
34
+ orientation = "horizontal",
35
+ variant = "subtle",
36
+ size = "xs",
37
+ space = "sm",
38
+ decorative = true,
39
+ className = "",
40
+ ...props
41
+ }) {
42
+ const resolvedVariant = variants.includes(variant) ? variant : "subtle";
43
+ const resolvedSize = sizes.includes(size) ? size : "xs";
44
+ const resolvedSpace = spacing.includes(space) ? space : "sm";
45
+ const resolvedOrientation = resolveBaseOrientation(orientation);
46
+
47
+ const classes = [
48
+ "a1-divider",
49
+ ...getOrientationClasses(orientation),
50
+ `a1-divider--${resolvedVariant}`,
51
+ `a1-divider--${resolvedSize}`,
52
+ `a1-divider--space-${resolvedSpace}`,
53
+ className,
54
+ ].filter(Boolean).join(" ");
55
+
56
+ return (
57
+ <hr
58
+ className={classes}
59
+ aria-orientation={decorative ? undefined : resolvedOrientation}
60
+ role={decorative ? "presentation" : "separator"}
61
+ {...props}
62
+ />
63
+ );
64
+ }