@seekalfred/primitives 0.7.1 → 0.7.4

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 (147) hide show
  1. package/README.md +255 -5
  2. package/dist/alert/alert.d.ts +49 -4
  3. package/dist/alert/alert.js +66 -38
  4. package/dist/alert/alert.js.map +1 -1
  5. package/dist/alert/index.d.ts +2 -2
  6. package/dist/alert/index.js +2 -2
  7. package/dist/alert-dialog/alert-dialog.d.ts +31 -4
  8. package/dist/alert-dialog/alert-dialog.js +75 -26
  9. package/dist/alert-dialog/alert-dialog.js.map +1 -1
  10. package/dist/announcement-bar/announcement-bar.d.ts +15 -4
  11. package/dist/announcement-bar/announcement-bar.js +31 -6
  12. package/dist/announcement-bar/announcement-bar.js.map +1 -1
  13. package/dist/avatar/avatar.d.ts +7 -0
  14. package/dist/avatar/avatar.js +33 -12
  15. package/dist/avatar/avatar.js.map +1 -1
  16. package/dist/badge/badge.d.ts +1 -1
  17. package/dist/bar-chart/bar-chart-series.d.ts +75 -0
  18. package/dist/bar-chart/bar-chart-series.js +401 -0
  19. package/dist/bar-chart/bar-chart-series.js.map +1 -0
  20. package/dist/bar-chart/bar-chart.d.ts +25 -1
  21. package/dist/bar-chart/bar-chart.js +26 -1
  22. package/dist/bar-chart/bar-chart.js.map +1 -1
  23. package/dist/bar-chart/index.d.ts +2 -1
  24. package/dist/button/button.d.ts +1 -1
  25. package/dist/calendar/calendar.d.ts +1 -1
  26. package/dist/card/card.d.ts +22 -1
  27. package/dist/card/card.js +60 -7
  28. package/dist/card/card.js.map +1 -1
  29. package/dist/carousel/carousel.d.ts +21 -0
  30. package/dist/carousel/carousel.js +34 -8
  31. package/dist/carousel/carousel.js.map +1 -1
  32. package/dist/chip-group/chip-group.d.ts +11 -0
  33. package/dist/chip-group/chip-group.js +50 -34
  34. package/dist/chip-group/chip-group.js.map +1 -1
  35. package/dist/chip-group/index.d.ts +2 -2
  36. package/dist/copy-button/copy-button.d.ts +37 -5
  37. package/dist/copy-button/copy-button.js +35 -11
  38. package/dist/copy-button/copy-button.js.map +1 -1
  39. package/dist/donut-chart/donut-chart.d.ts +22 -0
  40. package/dist/donut-chart/donut-chart.js +35 -18
  41. package/dist/donut-chart/donut-chart.js.map +1 -1
  42. package/dist/donut-chart/index.d.ts +2 -2
  43. package/dist/empty-state/empty-state.d.ts +21 -0
  44. package/dist/empty-state/empty-state.js +16 -4
  45. package/dist/empty-state/empty-state.js.map +1 -1
  46. package/dist/empty-state/index.d.ts +2 -2
  47. package/dist/empty-state/index.js +2 -2
  48. package/dist/file-drop-zone/file-drop-zone.d.ts +29 -3
  49. package/dist/file-drop-zone/file-drop-zone.js +26 -8
  50. package/dist/file-drop-zone/file-drop-zone.js.map +1 -1
  51. package/dist/filter-bar/filter-bar.d.ts +4 -1
  52. package/dist/filter-bar/filter-bar.js +53 -9
  53. package/dist/filter-bar/filter-bar.js.map +1 -1
  54. package/dist/gauge/gauge.d.ts +18 -1
  55. package/dist/gauge/gauge.js +35 -21
  56. package/dist/gauge/gauge.js.map +1 -1
  57. package/dist/gauge/index.d.ts +2 -2
  58. package/dist/index.d.ts +15 -14
  59. package/dist/index.js +9 -9
  60. package/dist/input/input.d.ts +7 -0
  61. package/dist/input/input.js +7 -5
  62. package/dist/input/input.js.map +1 -1
  63. package/dist/lib/field-shell.js +6 -3
  64. package/dist/lib/field-shell.js.map +1 -1
  65. package/dist/lib/field-surface.js +22 -1
  66. package/dist/lib/field-surface.js.map +1 -1
  67. package/dist/lib/required-marker.js +20 -0
  68. package/dist/lib/required-marker.js.map +1 -0
  69. package/dist/lib/use-copy-feedback.js +17 -3
  70. package/dist/lib/use-copy-feedback.js.map +1 -1
  71. package/dist/line-chart/index.d.ts +2 -2
  72. package/dist/line-chart/line-chart.d.ts +144 -2
  73. package/dist/line-chart/line-chart.js +314 -46
  74. package/dist/line-chart/line-chart.js.map +1 -1
  75. package/dist/money-input/index.d.ts +2 -2
  76. package/dist/money-input/money-input.d.ts +36 -1
  77. package/dist/money-input/money-input.js +30 -14
  78. package/dist/money-input/money-input.js.map +1 -1
  79. package/dist/morph-select/morph-select.d.ts +26 -1
  80. package/dist/morph-select/morph-select.js +28 -6
  81. package/dist/morph-select/morph-select.js.map +1 -1
  82. package/dist/multi-select/index.d.ts +2 -2
  83. package/dist/multi-select/index.js +2 -2
  84. package/dist/multi-select/multi-select.d.ts +74 -2
  85. package/dist/multi-select/multi-select.js +213 -39
  86. package/dist/multi-select/multi-select.js.map +1 -1
  87. package/dist/password-field/password-field.d.ts +16 -0
  88. package/dist/password-field/password-field.js +37 -8
  89. package/dist/password-field/password-field.js.map +1 -1
  90. package/dist/popover/index.d.ts +2 -2
  91. package/dist/popover/index.js +2 -2
  92. package/dist/popover/popover.d.ts +39 -2
  93. package/dist/popover/popover.js +29 -2
  94. package/dist/popover/popover.js.map +1 -1
  95. package/dist/progress/index.d.ts +2 -2
  96. package/dist/progress/index.js +2 -2
  97. package/dist/progress/progress.d.ts +68 -3
  98. package/dist/progress/progress.js +156 -39
  99. package/dist/progress/progress.js.map +1 -1
  100. package/dist/radio-group/index.d.ts +2 -2
  101. package/dist/radio-group/index.js +2 -2
  102. package/dist/radio-group/radio-group.d.ts +33 -3
  103. package/dist/radio-group/radio-group.js +109 -9
  104. package/dist/radio-group/radio-group.js.map +1 -1
  105. package/dist/scroll-area/scroll-area.js +4 -3
  106. package/dist/scroll-area/scroll-area.js.map +1 -1
  107. package/dist/scrub-input/scrub-input.d.ts +11 -1
  108. package/dist/scrub-input/scrub-input.js +22 -10
  109. package/dist/scrub-input/scrub-input.js.map +1 -1
  110. package/dist/search-field/search-field.d.ts +22 -1
  111. package/dist/search-field/search-field.js +22 -7
  112. package/dist/search-field/search-field.js.map +1 -1
  113. package/dist/select/select.d.ts +10 -1
  114. package/dist/select/select.js +11 -8
  115. package/dist/select/select.js.map +1 -1
  116. package/dist/separator/separator.d.ts +21 -9
  117. package/dist/separator/separator.js +33 -11
  118. package/dist/separator/separator.js.map +1 -1
  119. package/dist/sparkline/sparkline.d.ts +27 -2
  120. package/dist/sparkline/sparkline.js +115 -18
  121. package/dist/sparkline/sparkline.js.map +1 -1
  122. package/dist/stat-card/index.d.ts +2 -2
  123. package/dist/stat-card/index.js +2 -2
  124. package/dist/stat-card/stat-card.d.ts +65 -1
  125. package/dist/stat-card/stat-card.js +98 -25
  126. package/dist/stat-card/stat-card.js.map +1 -1
  127. package/dist/styles.css +1 -1
  128. package/dist/table/index.d.ts +2 -2
  129. package/dist/table/index.js +2 -2
  130. package/dist/table/table.d.ts +115 -5
  131. package/dist/table/table.js +374 -94
  132. package/dist/table/table.js.map +1 -1
  133. package/dist/text-shimmer/text-shimmer.d.ts +18 -2
  134. package/dist/text-shimmer/text-shimmer.js +5 -2
  135. package/dist/text-shimmer/text-shimmer.js.map +1 -1
  136. package/dist/textarea/textarea.d.ts +7 -0
  137. package/dist/textarea/textarea.js +3 -1
  138. package/dist/textarea/textarea.js.map +1 -1
  139. package/dist/time-picker/time-picker.d.ts +36 -1
  140. package/dist/time-picker/time-picker.js +33 -5
  141. package/dist/time-picker/time-picker.js.map +1 -1
  142. package/dist/toast/toast.d.ts +2 -2
  143. package/dist/usage-meter/index.d.ts +2 -2
  144. package/dist/usage-meter/usage-meter.d.ts +30 -0
  145. package/dist/usage-meter/usage-meter.js +56 -38
  146. package/dist/usage-meter/usage-meter.js.map +1 -1
  147. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- import { Column, RowKey, Table, TableProps, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableFooterVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableStickyCellVariants, tableVariants } from "./table.js";
2
- export { type Column, type RowKey, Table, type TableProps, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableFooterVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableStickyCellVariants, tableVariants };
1
+ import { Column, RowKey, Table, TableProps, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableExpandButtonVariants, tableFooterVariants, tableGroupRowVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableSortButtonVariants, tableStickyCellVariants, tableVariants } from "./table.js";
2
+ export { type Column, type RowKey, Table, type TableProps, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableExpandButtonVariants, tableFooterVariants, tableGroupRowVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableSortButtonVariants, tableStickyCellVariants, tableVariants };
@@ -1,2 +1,2 @@
1
- import { Table, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableFooterVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableStickyCellVariants, tableVariants } from "./table.js";
2
- export { Table, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableFooterVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableStickyCellVariants, tableVariants };
1
+ import { Table, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableExpandButtonVariants, tableFooterVariants, tableGroupRowVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableSortButtonVariants, tableStickyCellVariants, tableVariants } from "./table.js";
2
+ export { Table, createColumns, tableCardVariants, tableCellVariants, tableColumnVariants, tableEmptyVariants, tableExpandButtonVariants, tableFooterVariants, tableGroupRowVariants, tableHeaderVariants, tablePaginationVariants, tableRowVariants, tableScrollVariants, tableSelectionBarVariants, tableSortButtonVariants, tableStickyCellVariants, tableVariants };
@@ -64,11 +64,13 @@ import { Selection, SortDescriptor } from "react-aria-components";
64
64
  * shadow stays off and the sticky column's own divider does that job.
65
65
  */
66
66
  export declare const tableCardVariants: (props?: ({
67
- frame?: "none" | "card" | null | undefined;
67
+ frame?: "card" | "none" | null | undefined;
68
68
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
69
69
  /** The horizontal scroll container. The table owns it; 5 of 6 consumers built one by hand. */
70
70
  export declare const tableScrollVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
71
- export declare const tableVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
71
+ export declare const tableVariants: (props?: ({
72
+ density?: "default" | "compact" | null | undefined;
73
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
72
74
  /**
73
75
  * The header is near-white, not a grey band.
74
76
  *
@@ -99,15 +101,44 @@ export declare const tableEmptyVariants: (props?: import("class-variance-authori
99
101
  export declare const tableFooterVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
100
102
  export declare const tableColumnVariants: (props?: ({
101
103
  align?: "center" | "start" | "end" | null | undefined;
104
+ density?: "default" | "compact" | null | undefined;
105
+ hidden?: boolean | null | undefined;
102
106
  headerType?: "sentence" | "caps" | null | undefined;
103
107
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
108
+ /**
109
+ * The disclosure button that opens a row's sub-rows (`getSubRows`).
110
+ *
111
+ * A real button in the first cell, named by that cell's own content and
112
+ * carrying `aria-expanded`, so a reader hears "Meta, button, collapsed"
113
+ * without the library inventing copy. 24px square: the WCAG 2.2 target-size
114
+ * floor (2.5.8), and the step each level of sub-rows is indented by, so a
115
+ * child's text lines up one button-width in from its parent's. The chevron
116
+ * turns a quarter when the row opens; with reduced motion it simply flips.
117
+ */
118
+ export declare const tableExpandButtonVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
119
+ /**
120
+ * A group header row (`isGroupRow`): one cell spanning the row, naming the rows
121
+ * under it ("Mobile" / "Desktop"). The header band's fill and label type, so it
122
+ * reads as a heading of the rows that follow rather than as one of them.
123
+ */
124
+ export declare const tableGroupRowVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
125
+ /**
126
+ * The sort control of a column header in a plain table (`keyboardModel="table"`).
127
+ *
128
+ * In the grid the header cell is the control; in a plain table a cell cannot
129
+ * take focus, so the label sits in a real button that Tab reaches. It wears
130
+ * the header's own type and colour, and is at least 24px tall so a compact
131
+ * header still clears the WCAG 2.2 target size (2.5.8).
132
+ */
133
+ export declare const tableSortButtonVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
104
134
  export declare const tableRowVariants: (props?: ({
105
- variant?: "plain" | "lined" | null | undefined;
135
+ variant?: "lined" | "plain" | null | undefined;
106
136
  striped?: boolean | null | undefined;
107
137
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
108
138
  export declare const tableCellVariants: (props?: ({
109
139
  align?: "center" | "start" | "end" | null | undefined;
110
140
  numeric?: boolean | null | undefined;
141
+ density?: "default" | "compact" | null | undefined;
111
142
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
112
143
  /**
113
144
  * The first cell of every row, held in place while the rest scroll under it
@@ -119,7 +150,7 @@ export declare const tableCellVariants: (props?: ({
119
150
  * marks where the frozen column ends.
120
151
  */
121
152
  export declare const tableStickyCellVariants: (props?: ({
122
- part?: "header" | "body" | "bare" | null | undefined;
153
+ part?: "body" | "header" | "bare" | null | undefined;
123
154
  striped?: boolean | null | undefined;
124
155
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
125
156
  /**
@@ -150,6 +181,10 @@ type Column$1<T, V = unknown> = {
150
181
  * bivariantly, which is precisely the semantics a heterogeneous collection
151
182
  * needs. The alternative is `Column<T, any>`, and this package has no
152
183
  * eslint-disable in it anywhere.
184
+ *
185
+ * `index` is the row's position among its siblings (on the current page, in
186
+ * the current sort order), so with `getSubRows` a sub-row counts from 0 under
187
+ * its parent and opening a row never renumbers the rows below it.
153
188
  */
154
189
  cell?(ctx: {
155
190
  value: V;
@@ -192,7 +227,11 @@ export interface TableProps<T> extends VariantProps<typeof tableRowVariants> {
192
227
  data: readonly T[];
193
228
  /** The columns, in display order. */
194
229
  columns: readonly Column$1<T, unknown>[];
195
- /** Stable identity for a row. Used as its key and to resolve `onRowAction`. */
230
+ /**
231
+ * Stable identity for a row. Used as its key and to resolve `onRowAction`.
232
+ * Pass a stable reference (a module-level function or `useCallback`): the row
233
+ * index is memoised on it, so an inline arrow recomputes it every render.
234
+ */
196
235
  getRowId: (row: T) => RowKey;
197
236
  /**
198
237
  * Required. React Aria's Table renders no `<caption>`, so this is the
@@ -358,6 +397,77 @@ export interface TableProps<T> extends VariantProps<typeof tableRowVariants> {
358
397
  * real footer rather than one more row of data, so it is announced as one.
359
398
  */
360
399
  totalRow?: (column: Column$1<T, unknown>) => ReactNode;
400
+ /**
401
+ * The rows nested under a row, shown while it is expanded. Return nothing
402
+ * (or an empty array) for a row with none. Sub-rows are rows like any other
403
+ * -- the same columns, `getRowId`, `onRowAction` and selection -- and may
404
+ * have sub-rows of their own.
405
+ *
406
+ * A row with sub-rows gets a disclosure button in its first cell, named by
407
+ * that cell's content and carrying `aria-expanded`; every row's first cell
408
+ * is indented one step per level. Sorting orders each level on its own, so
409
+ * sub-rows stay under their parent, and `pageSize` counts top-level rows,
410
+ * so a group is never split across pages.
411
+ *
412
+ * Pass a stable reference (a module-level function or `useCallback`) so the
413
+ * row index is memoised; an inline arrow function recomputes it on every
414
+ * render.
415
+ */
416
+ getSubRows?: (row: T) => readonly T[] | null | undefined;
417
+ /** The expanded rows, CONTROLLED: their `getRowId` values. */
418
+ expandedKeys?: Iterable<RowKey>;
419
+ /** The rows expanded at the start, when uncontrolled. Nothing is, by default. */
420
+ defaultExpandedKeys?: Iterable<RowKey>;
421
+ /** Fires with the new set of expanded rows, controlled or not. */
422
+ onExpandedChange?: (keys: Set<RowKey>) => void;
423
+ /**
424
+ * Marks a row as a group header: its first column's content spans the
425
+ * whole row, in the header's type, and its other cells are not rendered.
426
+ * For grouped tables ("Mobile" / "Desktop") whose groups are headed rather
427
+ * than summed; a group with totals is a row with `getSubRows` instead.
428
+ * Combine the two for a group that opens and closes.
429
+ *
430
+ * A group header only heads the rows under it, so it is not actionable:
431
+ * `onRowAction` does not fire for it and it shows no pointer cursor.
432
+ */
433
+ isGroupRow?: (row: T) => boolean;
434
+ /**
435
+ * Row height and type size. `default` takes its padding from the ambient
436
+ * density scope (`--density-row-pad-y`) in body type; `compact` is the
437
+ * product's tight report table, `py-2` rows in small type.
438
+ */
439
+ density?: "default" | "compact";
440
+ /**
441
+ * Hides the header row from sight and keeps it for assistive tech, for a
442
+ * key/value table whose first column already says what each row is
443
+ * ("Plan" | "Growth"). Every column still needs a `header`: it is the
444
+ * column's accessible name, announced as a reader moves across a row.
445
+ *
446
+ * The header cells keep their widths, so `Column.width` still lays the
447
+ * columns out. A hidden header has no sort control, so `sortable` is
448
+ * ignored here (`defaultSortDescriptor` still orders the rows). In the grid
449
+ * a header cell opens up while it holds keyboard focus; with
450
+ * `keyboardModel="table"` nothing in it is focusable.
451
+ */
452
+ headerHidden?: boolean;
453
+ /**
454
+ * How the keyboard moves through the table.
455
+ *
456
+ * `grid` (the default) is React Aria's grid: a composite widget with a
457
+ * tab stop of its own, where the arrow keys move focus between rows and
458
+ * cells and a screen reader switches to its application/grid handling.
459
+ * Row selection and `onRowAction` need it, because the row itself is the
460
+ * control.
461
+ *
462
+ * `table` renders a plain `role="table"`: no row or cell takes focus, the
463
+ * arrow keys are left to the browser and the screen reader's own table
464
+ * commands, and Tab goes straight from one link or button in a cell to the
465
+ * next, in reading order. For tables whose cells hold the actions. A
466
+ * sortable header becomes a button in that Tab order, with `aria-sort` on
467
+ * its column header. A row cannot be a control here, so `selectionMode`
468
+ * and `onRowAction` are ignored: put a link or button in a cell instead.
469
+ */
470
+ keyboardModel?: "grid" | "table";
361
471
  /** Extra classes for the table. Merged last, so they win conflicts with ours. */
362
472
  className?: string;
363
473
  }