@ansh-ui/react 0.2.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 (111) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chunk-5CFQFMP5.js +178 -0
  3. package/dist/chunk-5CFQFMP5.js.map +1 -0
  4. package/dist/chunk-6VRF7X5C.cjs +164 -0
  5. package/dist/chunk-6VRF7X5C.cjs.map +1 -0
  6. package/dist/chunk-AVPEA5PB.cjs +718 -0
  7. package/dist/chunk-AVPEA5PB.cjs.map +1 -0
  8. package/dist/chunk-C32LKF23.cjs +198 -0
  9. package/dist/chunk-C32LKF23.cjs.map +1 -0
  10. package/dist/chunk-C5JG6TMM.cjs +1200 -0
  11. package/dist/chunk-C5JG6TMM.cjs.map +1 -0
  12. package/dist/chunk-DATBU46V.cjs +614 -0
  13. package/dist/chunk-DATBU46V.cjs.map +1 -0
  14. package/dist/chunk-EGG4CP7C.js +320 -0
  15. package/dist/chunk-EGG4CP7C.js.map +1 -0
  16. package/dist/chunk-H34OXXJU.js +55 -0
  17. package/dist/chunk-H34OXXJU.js.map +1 -0
  18. package/dist/chunk-HO2YSF5O.js +187 -0
  19. package/dist/chunk-HO2YSF5O.js.map +1 -0
  20. package/dist/chunk-HPGCILO4.js +760 -0
  21. package/dist/chunk-HPGCILO4.js.map +1 -0
  22. package/dist/chunk-IBXLC5IE.js +154 -0
  23. package/dist/chunk-IBXLC5IE.js.map +1 -0
  24. package/dist/chunk-LDCZQP3R.js +1185 -0
  25. package/dist/chunk-LDCZQP3R.js.map +1 -0
  26. package/dist/chunk-LXCIXR5T.js +27 -0
  27. package/dist/chunk-LXCIXR5T.js.map +1 -0
  28. package/dist/chunk-O2PX54KX.js +94 -0
  29. package/dist/chunk-O2PX54KX.js.map +1 -0
  30. package/dist/chunk-OHBWBXLO.cjs +101 -0
  31. package/dist/chunk-OHBWBXLO.cjs.map +1 -0
  32. package/dist/chunk-OJN5JBNP.cjs +776 -0
  33. package/dist/chunk-OJN5JBNP.cjs.map +1 -0
  34. package/dist/chunk-OLTS6G5M.js +606 -0
  35. package/dist/chunk-OLTS6G5M.js.map +1 -0
  36. package/dist/chunk-PO5DU3FU.cjs +29 -0
  37. package/dist/chunk-PO5DU3FU.cjs.map +1 -0
  38. package/dist/chunk-QO3E7TJS.js +2940 -0
  39. package/dist/chunk-QO3E7TJS.js.map +1 -0
  40. package/dist/chunk-RHTLNSVW.cjs +2976 -0
  41. package/dist/chunk-RHTLNSVW.cjs.map +1 -0
  42. package/dist/chunk-SFU5EPSN.cjs +61 -0
  43. package/dist/chunk-SFU5EPSN.cjs.map +1 -0
  44. package/dist/chunk-T4AK2KLM.js +699 -0
  45. package/dist/chunk-T4AK2KLM.js.map +1 -0
  46. package/dist/chunk-WGYNCSTP.cjs +333 -0
  47. package/dist/chunk-WGYNCSTP.cjs.map +1 -0
  48. package/dist/chunk-XEP6P7E6.js +279 -0
  49. package/dist/chunk-XEP6P7E6.js.map +1 -0
  50. package/dist/chunk-XMXECSQO.cjs +286 -0
  51. package/dist/chunk-XMXECSQO.cjs.map +1 -0
  52. package/dist/chunk-ZWAFLHC2.cjs +181 -0
  53. package/dist/chunk-ZWAFLHC2.cjs.map +1 -0
  54. package/dist/data.cjs +71 -0
  55. package/dist/data.cjs.map +1 -0
  56. package/dist/data.d.cts +316 -0
  57. package/dist/data.d.ts +316 -0
  58. package/dist/data.js +6 -0
  59. package/dist/data.js.map +1 -0
  60. package/dist/form.cjs +153 -0
  61. package/dist/form.cjs.map +1 -0
  62. package/dist/form.d.cts +660 -0
  63. package/dist/form.d.ts +660 -0
  64. package/dist/form.js +8 -0
  65. package/dist/form.js.map +1 -0
  66. package/dist/index.cjs +1641 -0
  67. package/dist/index.cjs.map +1 -0
  68. package/dist/index.d.cts +552 -0
  69. package/dist/index.d.ts +552 -0
  70. package/dist/index.js +956 -0
  71. package/dist/index.js.map +1 -0
  72. package/dist/layout.cjs +68 -0
  73. package/dist/layout.cjs.map +1 -0
  74. package/dist/layout.d.cts +169 -0
  75. package/dist/layout.d.ts +169 -0
  76. package/dist/layout.js +7 -0
  77. package/dist/layout.js.map +1 -0
  78. package/dist/motion-CQmCq6_k.d.ts +395 -0
  79. package/dist/motion-CSX4g2N8.d.cts +395 -0
  80. package/dist/motion.cjs +79 -0
  81. package/dist/motion.cjs.map +1 -0
  82. package/dist/motion.d.cts +4 -0
  83. package/dist/motion.d.ts +4 -0
  84. package/dist/motion.js +6 -0
  85. package/dist/motion.js.map +1 -0
  86. package/dist/navigation.cjs +48 -0
  87. package/dist/navigation.cjs.map +1 -0
  88. package/dist/navigation.d.cts +210 -0
  89. package/dist/navigation.d.ts +210 -0
  90. package/dist/navigation.js +7 -0
  91. package/dist/navigation.js.map +1 -0
  92. package/dist/overlay.cjs +69 -0
  93. package/dist/overlay.cjs.map +1 -0
  94. package/dist/overlay.d.cts +330 -0
  95. package/dist/overlay.d.ts +330 -0
  96. package/dist/overlay.js +8 -0
  97. package/dist/overlay.js.map +1 -0
  98. package/dist/position-DVScKcaa.d.cts +66 -0
  99. package/dist/position-DVScKcaa.d.ts +66 -0
  100. package/dist/primitives.cjs +162 -0
  101. package/dist/primitives.cjs.map +1 -0
  102. package/dist/primitives.d.cts +294 -0
  103. package/dist/primitives.d.ts +294 -0
  104. package/dist/primitives.js +9 -0
  105. package/dist/primitives.js.map +1 -0
  106. package/dist/sidebar-D-PafAXw.d.cts +71 -0
  107. package/dist/sidebar-D-PafAXw.d.ts +71 -0
  108. package/dist/styles.css +5575 -0
  109. package/dist/use-observers-B9qtimrk.d.cts +99 -0
  110. package/dist/use-observers-B9qtimrk.d.ts +99 -0
  111. package/package.json +92 -0
@@ -0,0 +1,316 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, HTMLAttributes } from 'react';
3
+
4
+ /**
5
+ * Tables.
6
+ *
7
+ * A real `<table>` with `<th scope>`, not a grid of divs. The semantics are the entire point: a
8
+ * screen reader announces "Column 3 of 7, Status, row 12" only if the markup says so. Every
9
+ * div-based table reimplements navigation badly or not at all, and the CSS argument for divs
10
+ * disappeared when `display: contents` and `position: sticky` landed.
11
+ *
12
+ * `DataTable` adds sorting, selection and pagination on top. It stays deliberately short of a full
13
+ * data grid — no virtualisation, no column resizing, no pinned regions. Those need a different
14
+ * architecture (windowing, measured columns), and half-implementing them produces a component that
15
+ * breaks at exactly the scale it was added for.
16
+ */
17
+ type SortDirection = 'asc' | 'desc';
18
+ interface SortState {
19
+ columnId: string;
20
+ direction: SortDirection;
21
+ }
22
+ interface Column<T> {
23
+ id: string;
24
+ header: ReactNode;
25
+ /** Render the cell. Receives the row and its index. */
26
+ cell: (row: T, index: number) => ReactNode;
27
+ /** Allow sorting by this column. */
28
+ sortable?: boolean;
29
+ /**
30
+ * Value used for the default comparator. Without it a sortable column falls back to comparing
31
+ * rendered output, which sorts "10" before "9".
32
+ */
33
+ sortValue?: (row: T) => string | number | Date | null | undefined;
34
+ align?: 'start' | 'center' | 'end';
35
+ /** Any CSS width — `'12rem'`, `'25%'`, `'minmax(8rem, 1fr)'`. */
36
+ width?: string;
37
+ /** Hide below this breakpoint. Uses the token breakpoints. */
38
+ hideBelow?: 'sm' | 'md' | 'lg';
39
+ /** Short label announced instead of a complex header. */
40
+ ariaLabel?: string;
41
+ }
42
+ interface DataTableProps<T> {
43
+ data: readonly T[];
44
+ columns: ReadonlyArray<Column<T>>;
45
+ /** Stable row identity. Required — array index breaks selection the moment rows reorder. */
46
+ getRowId: (row: T) => string;
47
+ /** Describes the table for screen readers. Rendered as a visually hidden `<caption>`. */
48
+ caption: string;
49
+ /** Row checkboxes plus a header select-all. */
50
+ selectable?: boolean;
51
+ selected?: readonly string[];
52
+ onSelectedChange?: (ids: readonly string[]) => void;
53
+ sort?: SortState | null;
54
+ defaultSort?: SortState | null;
55
+ onSortChange?: (sort: SortState | null) => void;
56
+ /** Rows per page. Omit to render everything. */
57
+ pageSize?: number;
58
+ page?: number;
59
+ onPageChange?: (page: number) => void;
60
+ /** Show skeleton rows. */
61
+ loading?: boolean;
62
+ /** Rendered in place of the body when there are no rows. */
63
+ emptyState?: ReactNode;
64
+ onRowClick?: (row: T) => void;
65
+ /** Keep the header visible while the body scrolls. */
66
+ stickyHeader?: boolean;
67
+ density?: 'comfortable' | 'compact';
68
+ /** Zebra striping. Off by default — borders read as cleaner at density. */
69
+ striped?: boolean;
70
+ className?: string;
71
+ /** Per-row extra class, for status highlighting. */
72
+ rowClassName?: (row: T) => string | undefined;
73
+ }
74
+ declare function DataTable<T>({ data, columns, getRowId, caption, selectable, selected, onSelectedChange, sort, defaultSort, onSortChange, pageSize, page, onPageChange, loading, emptyState, onRowClick, stickyHeader, density, striped, className, rowClassName, }: DataTableProps<T>): react.JSX.Element;
75
+ interface PaginationProps {
76
+ /** Zero-based. */
77
+ page: number;
78
+ pageCount: number;
79
+ onPageChange: (page: number) => void;
80
+ /** Total row count, for the "1–20 of 340" summary. */
81
+ total?: number;
82
+ pageSize?: number;
83
+ /** Page buttons either side of the current one. Default `1`. */
84
+ siblings?: number;
85
+ className?: string;
86
+ }
87
+ /**
88
+ * Page navigation.
89
+ *
90
+ * `<nav>` with an ordered list, because that is what a pager is — a list of links to positions in a
91
+ * sequence. The current page is marked `aria-current="page"`, which is how a screen reader user
92
+ * knows where they are without counting buttons.
93
+ *
94
+ * The ellipsis is `aria-hidden`; announcing "ellipsis" between page 3 and page 12 conveys nothing
95
+ * that the numbers don't already.
96
+ */
97
+ declare function Pagination({ page, pageCount, onPageChange, total, pageSize, siblings, className, }: PaginationProps): react.JSX.Element;
98
+ /** A plain styled table, for content that isn't driven by data props. */
99
+ declare function Table({ caption, density, striped, className, children, }: {
100
+ caption?: string;
101
+ density?: 'comfortable' | 'compact';
102
+ striped?: boolean;
103
+ className?: string;
104
+ children: ReactNode;
105
+ }): react.JSX.Element;
106
+
107
+ /**
108
+ * Small display components.
109
+ *
110
+ * Individually trivial, collectively most of what an application screen is made of. The care here
111
+ * goes into the details that get skipped: a badge whose meaning isn't carried by colour alone, an
112
+ * avatar whose fallback initials are readable against a generated background, an empty state that
113
+ * says what to do next rather than just "no data".
114
+ */
115
+ type BadgeTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
116
+ interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
117
+ tone?: BadgeTone;
118
+ variant?: 'soft' | 'solid' | 'outline';
119
+ size?: 'sm' | 'md';
120
+ /** Leading dot. Useful for statuses where the label is short. */
121
+ dot?: boolean;
122
+ icon?: ReactNode;
123
+ children: ReactNode;
124
+ }
125
+ /**
126
+ * A status label.
127
+ *
128
+ * Every badge carries its meaning in **text**, not just colour. A red badge reading "Failed" works
129
+ * for everyone; a red dot alone works for nobody using a screen reader and for the ~4% of the
130
+ * population with a colour vision deficiency. The `dot` is decorative reinforcement.
131
+ */
132
+ declare function Badge({ tone, variant, size, dot, icon, className, children, ...rest }: BadgeProps): react.JSX.Element;
133
+ interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
134
+ src?: string;
135
+ /** The person's name. Used for the alt text and to derive the fallback initials. */
136
+ name: string;
137
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
138
+ shape?: 'circle' | 'square';
139
+ /** Presence indicator. */
140
+ status?: 'online' | 'offline' | 'busy' | 'away';
141
+ }
142
+ declare function Avatar({ src, name, size, shape, status, className, ...rest }: AvatarProps): react.JSX.Element;
143
+ interface AvatarGroupProps {
144
+ /** Maximum shown before collapsing into a "+N" chip. Default `4`. */
145
+ max?: number;
146
+ size?: AvatarProps['size'];
147
+ className?: string;
148
+ children: ReactNode;
149
+ }
150
+ /** Overlapping avatars with an overflow count. */
151
+ declare function AvatarGroup({ max, size, className, children }: AvatarGroupProps): react.JSX.Element;
152
+ /**
153
+ * A keyboard key.
154
+ *
155
+ * Splits on `+` so `<Kbd>⌘+K</Kbd>` renders two keys with a separator, and the separator is
156
+ * `aria-hidden` — a screen reader should say "command K", not "command plus K".
157
+ */
158
+ declare function Kbd({ children, className }: {
159
+ children: string;
160
+ className?: string;
161
+ }): react.JSX.Element;
162
+ interface StatProps {
163
+ label: ReactNode;
164
+ value: ReactNode;
165
+ /** Change since the previous period. Sign decides the direction and colour. */
166
+ delta?: number;
167
+ /** How the delta reads — `'2.4%'` or `'+18 users'`. Defaults to the number with a sign. */
168
+ deltaLabel?: string;
169
+ /** For metrics where down is good, like churn or latency. */
170
+ invertDelta?: boolean;
171
+ hint?: ReactNode;
172
+ icon?: ReactNode;
173
+ className?: string;
174
+ }
175
+ /**
176
+ * A single metric — the building block of every dashboard.
177
+ *
178
+ * The delta's direction is shown by an arrow *and* a sign *and* a colour. Three redundant signals
179
+ * because this is the number people scan fastest and misreading it has consequences.
180
+ */
181
+ declare function Stat({ label, value, delta, deltaLabel, invertDelta, hint, icon, className, }: StatProps): react.JSX.Element;
182
+ interface EmptyStateProps {
183
+ title: ReactNode;
184
+ description?: ReactNode;
185
+ icon?: ReactNode;
186
+ /** The action that resolves the emptiness — "Create your first invoice". */
187
+ action?: ReactNode;
188
+ size?: 'sm' | 'md';
189
+ className?: string;
190
+ }
191
+ /**
192
+ * The "nothing here yet" panel.
193
+ *
194
+ * Always offers the next step. An empty state that only says "No results" leaves the user to work
195
+ * out whether the filter is wrong, the data hasn't loaded, or they need to create something — and
196
+ * that ambiguity is where people abandon a screen.
197
+ */
198
+ declare function EmptyState({ title, description, icon, action, size, className, }: EmptyStateProps): react.JSX.Element;
199
+ interface DescriptionListProps {
200
+ items: ReadonlyArray<{
201
+ term: ReactNode;
202
+ description: ReactNode;
203
+ }>;
204
+ /** Side-by-side rather than stacked. Default `'horizontal'` on wide screens. */
205
+ orientation?: 'horizontal' | 'vertical';
206
+ className?: string;
207
+ }
208
+ /**
209
+ * Key–value pairs — the detail panel of every record in a CRM.
210
+ *
211
+ * A real `<dl>`/`<dt>`/`<dd>`, which is what makes a screen reader pair each label with its value
212
+ * instead of reading twenty unconnected strings.
213
+ */
214
+ declare function DescriptionList({ items, orientation, className, }: DescriptionListProps): react.JSX.Element;
215
+ interface TimelineItem {
216
+ id: string;
217
+ title: ReactNode;
218
+ description?: ReactNode;
219
+ /** Rendered as-is; pass an already-formatted string or a `<time>` element. */
220
+ timestamp?: ReactNode;
221
+ icon?: ReactNode;
222
+ tone?: BadgeTone;
223
+ }
224
+ /**
225
+ * A chronological feed — audit logs, order history, activity streams.
226
+ *
227
+ * An ordered list, because the order carries meaning. The connecting line is drawn with a
228
+ * pseudo-element on the list item rather than a real element, so it can't be selected, read, or
229
+ * land in a copy-paste of the page.
230
+ */
231
+ declare function Timeline({ items, className, }: {
232
+ items: readonly TimelineItem[];
233
+ className?: string;
234
+ }): react.JSX.Element;
235
+ interface CodeBlockProps {
236
+ code: string;
237
+ language?: string;
238
+ /** Show a copy button. Default `true`. */
239
+ copyable?: boolean;
240
+ /** Show line numbers. */
241
+ lineNumbers?: boolean;
242
+ /** Filename or title shown in the header bar. */
243
+ filename?: string;
244
+ className?: string;
245
+ }
246
+ /**
247
+ * A code block with a copy button.
248
+ *
249
+ * No syntax highlighter. Shipping one means a tokeniser and a theme in the bundle of every app that
250
+ * displays a snippet — for a component library, that cost lands on consumers who may never render
251
+ * code at all. Highlighting is better done at build time, or with a highlighter the app already has.
252
+ */
253
+ declare function CodeBlock({ code, language, copyable, lineNumbers, filename, className, }: CodeBlockProps): react.JSX.Element;
254
+
255
+ /**
256
+ * Progress indicators.
257
+ *
258
+ * The distinction that matters and is usually missed: **progress** is work advancing toward
259
+ * completion (`role="progressbar"`), a **meter** is a static measurement within a range
260
+ * (`role="meter"` — disk usage, a score, a quota). Announcing a disk-usage bar as progress tells a
261
+ * screen-reader user that something is loading, which it isn't.
262
+ */
263
+ interface ProgressProps {
264
+ /** `0`–`max`. Omit for an indeterminate bar. */
265
+ value?: number;
266
+ max?: number;
267
+ size?: 'sm' | 'md' | 'lg';
268
+ tone?: 'accent' | 'success' | 'warning' | 'danger';
269
+ /** Accessible name — "Upload progress", not "Progress". */
270
+ label: string;
271
+ /** Show the label and percentage above the bar. */
272
+ showLabel?: boolean;
273
+ /** Override the announced/displayed text. */
274
+ formatValue?: (value: number, max: number) => string;
275
+ className?: string;
276
+ }
277
+ declare function Progress({ value, max, size, tone, label, showLabel, formatValue, className, }: ProgressProps): react.JSX.Element;
278
+ interface CircularProgressProps extends Omit<ProgressProps, 'size'> {
279
+ /** Diameter in px. Default `48`. */
280
+ size?: number;
281
+ /** Ring thickness in px. Default `4`. */
282
+ thickness?: number;
283
+ /** Content in the middle — usually the percentage. */
284
+ children?: ReactNode;
285
+ }
286
+ /**
287
+ * A ring progress indicator.
288
+ *
289
+ * Drawn with `stroke-dasharray` on an SVG circle rather than with conic gradients, so the ends can
290
+ * be rounded and the ring animates smoothly at any size. The circle is rotated -90° so 0% starts at
291
+ * the top, which is where everyone expects it.
292
+ */
293
+ declare function CircularProgress({ value, max, size, thickness, tone, label, formatValue, className, children, }: CircularProgressProps): react.JSX.Element;
294
+ interface MeterProps {
295
+ value: number;
296
+ min?: number;
297
+ max?: number;
298
+ /** Thresholds that colour the bar — below `low` is danger, above `high` is success. */
299
+ low?: number;
300
+ high?: number;
301
+ /** Flip the colours, for metrics where high is bad (disk usage, error rate). */
302
+ inverted?: boolean;
303
+ label: string;
304
+ showValue?: boolean;
305
+ formatValue?: (value: number) => string;
306
+ className?: string;
307
+ }
308
+ /**
309
+ * A measurement within a known range — quota, score, capacity.
310
+ *
311
+ * `role="meter"`, not `progressbar`. Colour follows the thresholds, but the numeric value is always
312
+ * rendered too, so the state is never conveyed by colour alone.
313
+ */
314
+ declare function Meter({ value, min, max, low, high, inverted, label, showValue, formatValue, className, }: MeterProps): react.JSX.Element;
315
+
316
+ export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, type BadgeTone, CircularProgress, type CircularProgressProps, CodeBlock, type CodeBlockProps, type Column, DataTable, type DataTableProps, DescriptionList, type DescriptionListProps, EmptyState, type EmptyStateProps, Kbd, Meter, type MeterProps, Pagination, type PaginationProps, Progress, type ProgressProps, type SortDirection, type SortState, Stat, type StatProps, Table, Timeline, type TimelineItem };
package/dist/data.d.ts ADDED
@@ -0,0 +1,316 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, HTMLAttributes } from 'react';
3
+
4
+ /**
5
+ * Tables.
6
+ *
7
+ * A real `<table>` with `<th scope>`, not a grid of divs. The semantics are the entire point: a
8
+ * screen reader announces "Column 3 of 7, Status, row 12" only if the markup says so. Every
9
+ * div-based table reimplements navigation badly or not at all, and the CSS argument for divs
10
+ * disappeared when `display: contents` and `position: sticky` landed.
11
+ *
12
+ * `DataTable` adds sorting, selection and pagination on top. It stays deliberately short of a full
13
+ * data grid — no virtualisation, no column resizing, no pinned regions. Those need a different
14
+ * architecture (windowing, measured columns), and half-implementing them produces a component that
15
+ * breaks at exactly the scale it was added for.
16
+ */
17
+ type SortDirection = 'asc' | 'desc';
18
+ interface SortState {
19
+ columnId: string;
20
+ direction: SortDirection;
21
+ }
22
+ interface Column<T> {
23
+ id: string;
24
+ header: ReactNode;
25
+ /** Render the cell. Receives the row and its index. */
26
+ cell: (row: T, index: number) => ReactNode;
27
+ /** Allow sorting by this column. */
28
+ sortable?: boolean;
29
+ /**
30
+ * Value used for the default comparator. Without it a sortable column falls back to comparing
31
+ * rendered output, which sorts "10" before "9".
32
+ */
33
+ sortValue?: (row: T) => string | number | Date | null | undefined;
34
+ align?: 'start' | 'center' | 'end';
35
+ /** Any CSS width — `'12rem'`, `'25%'`, `'minmax(8rem, 1fr)'`. */
36
+ width?: string;
37
+ /** Hide below this breakpoint. Uses the token breakpoints. */
38
+ hideBelow?: 'sm' | 'md' | 'lg';
39
+ /** Short label announced instead of a complex header. */
40
+ ariaLabel?: string;
41
+ }
42
+ interface DataTableProps<T> {
43
+ data: readonly T[];
44
+ columns: ReadonlyArray<Column<T>>;
45
+ /** Stable row identity. Required — array index breaks selection the moment rows reorder. */
46
+ getRowId: (row: T) => string;
47
+ /** Describes the table for screen readers. Rendered as a visually hidden `<caption>`. */
48
+ caption: string;
49
+ /** Row checkboxes plus a header select-all. */
50
+ selectable?: boolean;
51
+ selected?: readonly string[];
52
+ onSelectedChange?: (ids: readonly string[]) => void;
53
+ sort?: SortState | null;
54
+ defaultSort?: SortState | null;
55
+ onSortChange?: (sort: SortState | null) => void;
56
+ /** Rows per page. Omit to render everything. */
57
+ pageSize?: number;
58
+ page?: number;
59
+ onPageChange?: (page: number) => void;
60
+ /** Show skeleton rows. */
61
+ loading?: boolean;
62
+ /** Rendered in place of the body when there are no rows. */
63
+ emptyState?: ReactNode;
64
+ onRowClick?: (row: T) => void;
65
+ /** Keep the header visible while the body scrolls. */
66
+ stickyHeader?: boolean;
67
+ density?: 'comfortable' | 'compact';
68
+ /** Zebra striping. Off by default — borders read as cleaner at density. */
69
+ striped?: boolean;
70
+ className?: string;
71
+ /** Per-row extra class, for status highlighting. */
72
+ rowClassName?: (row: T) => string | undefined;
73
+ }
74
+ declare function DataTable<T>({ data, columns, getRowId, caption, selectable, selected, onSelectedChange, sort, defaultSort, onSortChange, pageSize, page, onPageChange, loading, emptyState, onRowClick, stickyHeader, density, striped, className, rowClassName, }: DataTableProps<T>): react.JSX.Element;
75
+ interface PaginationProps {
76
+ /** Zero-based. */
77
+ page: number;
78
+ pageCount: number;
79
+ onPageChange: (page: number) => void;
80
+ /** Total row count, for the "1–20 of 340" summary. */
81
+ total?: number;
82
+ pageSize?: number;
83
+ /** Page buttons either side of the current one. Default `1`. */
84
+ siblings?: number;
85
+ className?: string;
86
+ }
87
+ /**
88
+ * Page navigation.
89
+ *
90
+ * `<nav>` with an ordered list, because that is what a pager is — a list of links to positions in a
91
+ * sequence. The current page is marked `aria-current="page"`, which is how a screen reader user
92
+ * knows where they are without counting buttons.
93
+ *
94
+ * The ellipsis is `aria-hidden`; announcing "ellipsis" between page 3 and page 12 conveys nothing
95
+ * that the numbers don't already.
96
+ */
97
+ declare function Pagination({ page, pageCount, onPageChange, total, pageSize, siblings, className, }: PaginationProps): react.JSX.Element;
98
+ /** A plain styled table, for content that isn't driven by data props. */
99
+ declare function Table({ caption, density, striped, className, children, }: {
100
+ caption?: string;
101
+ density?: 'comfortable' | 'compact';
102
+ striped?: boolean;
103
+ className?: string;
104
+ children: ReactNode;
105
+ }): react.JSX.Element;
106
+
107
+ /**
108
+ * Small display components.
109
+ *
110
+ * Individually trivial, collectively most of what an application screen is made of. The care here
111
+ * goes into the details that get skipped: a badge whose meaning isn't carried by colour alone, an
112
+ * avatar whose fallback initials are readable against a generated background, an empty state that
113
+ * says what to do next rather than just "no data".
114
+ */
115
+ type BadgeTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
116
+ interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
117
+ tone?: BadgeTone;
118
+ variant?: 'soft' | 'solid' | 'outline';
119
+ size?: 'sm' | 'md';
120
+ /** Leading dot. Useful for statuses where the label is short. */
121
+ dot?: boolean;
122
+ icon?: ReactNode;
123
+ children: ReactNode;
124
+ }
125
+ /**
126
+ * A status label.
127
+ *
128
+ * Every badge carries its meaning in **text**, not just colour. A red badge reading "Failed" works
129
+ * for everyone; a red dot alone works for nobody using a screen reader and for the ~4% of the
130
+ * population with a colour vision deficiency. The `dot` is decorative reinforcement.
131
+ */
132
+ declare function Badge({ tone, variant, size, dot, icon, className, children, ...rest }: BadgeProps): react.JSX.Element;
133
+ interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
134
+ src?: string;
135
+ /** The person's name. Used for the alt text and to derive the fallback initials. */
136
+ name: string;
137
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
138
+ shape?: 'circle' | 'square';
139
+ /** Presence indicator. */
140
+ status?: 'online' | 'offline' | 'busy' | 'away';
141
+ }
142
+ declare function Avatar({ src, name, size, shape, status, className, ...rest }: AvatarProps): react.JSX.Element;
143
+ interface AvatarGroupProps {
144
+ /** Maximum shown before collapsing into a "+N" chip. Default `4`. */
145
+ max?: number;
146
+ size?: AvatarProps['size'];
147
+ className?: string;
148
+ children: ReactNode;
149
+ }
150
+ /** Overlapping avatars with an overflow count. */
151
+ declare function AvatarGroup({ max, size, className, children }: AvatarGroupProps): react.JSX.Element;
152
+ /**
153
+ * A keyboard key.
154
+ *
155
+ * Splits on `+` so `<Kbd>⌘+K</Kbd>` renders two keys with a separator, and the separator is
156
+ * `aria-hidden` — a screen reader should say "command K", not "command plus K".
157
+ */
158
+ declare function Kbd({ children, className }: {
159
+ children: string;
160
+ className?: string;
161
+ }): react.JSX.Element;
162
+ interface StatProps {
163
+ label: ReactNode;
164
+ value: ReactNode;
165
+ /** Change since the previous period. Sign decides the direction and colour. */
166
+ delta?: number;
167
+ /** How the delta reads — `'2.4%'` or `'+18 users'`. Defaults to the number with a sign. */
168
+ deltaLabel?: string;
169
+ /** For metrics where down is good, like churn or latency. */
170
+ invertDelta?: boolean;
171
+ hint?: ReactNode;
172
+ icon?: ReactNode;
173
+ className?: string;
174
+ }
175
+ /**
176
+ * A single metric — the building block of every dashboard.
177
+ *
178
+ * The delta's direction is shown by an arrow *and* a sign *and* a colour. Three redundant signals
179
+ * because this is the number people scan fastest and misreading it has consequences.
180
+ */
181
+ declare function Stat({ label, value, delta, deltaLabel, invertDelta, hint, icon, className, }: StatProps): react.JSX.Element;
182
+ interface EmptyStateProps {
183
+ title: ReactNode;
184
+ description?: ReactNode;
185
+ icon?: ReactNode;
186
+ /** The action that resolves the emptiness — "Create your first invoice". */
187
+ action?: ReactNode;
188
+ size?: 'sm' | 'md';
189
+ className?: string;
190
+ }
191
+ /**
192
+ * The "nothing here yet" panel.
193
+ *
194
+ * Always offers the next step. An empty state that only says "No results" leaves the user to work
195
+ * out whether the filter is wrong, the data hasn't loaded, or they need to create something — and
196
+ * that ambiguity is where people abandon a screen.
197
+ */
198
+ declare function EmptyState({ title, description, icon, action, size, className, }: EmptyStateProps): react.JSX.Element;
199
+ interface DescriptionListProps {
200
+ items: ReadonlyArray<{
201
+ term: ReactNode;
202
+ description: ReactNode;
203
+ }>;
204
+ /** Side-by-side rather than stacked. Default `'horizontal'` on wide screens. */
205
+ orientation?: 'horizontal' | 'vertical';
206
+ className?: string;
207
+ }
208
+ /**
209
+ * Key–value pairs — the detail panel of every record in a CRM.
210
+ *
211
+ * A real `<dl>`/`<dt>`/`<dd>`, which is what makes a screen reader pair each label with its value
212
+ * instead of reading twenty unconnected strings.
213
+ */
214
+ declare function DescriptionList({ items, orientation, className, }: DescriptionListProps): react.JSX.Element;
215
+ interface TimelineItem {
216
+ id: string;
217
+ title: ReactNode;
218
+ description?: ReactNode;
219
+ /** Rendered as-is; pass an already-formatted string or a `<time>` element. */
220
+ timestamp?: ReactNode;
221
+ icon?: ReactNode;
222
+ tone?: BadgeTone;
223
+ }
224
+ /**
225
+ * A chronological feed — audit logs, order history, activity streams.
226
+ *
227
+ * An ordered list, because the order carries meaning. The connecting line is drawn with a
228
+ * pseudo-element on the list item rather than a real element, so it can't be selected, read, or
229
+ * land in a copy-paste of the page.
230
+ */
231
+ declare function Timeline({ items, className, }: {
232
+ items: readonly TimelineItem[];
233
+ className?: string;
234
+ }): react.JSX.Element;
235
+ interface CodeBlockProps {
236
+ code: string;
237
+ language?: string;
238
+ /** Show a copy button. Default `true`. */
239
+ copyable?: boolean;
240
+ /** Show line numbers. */
241
+ lineNumbers?: boolean;
242
+ /** Filename or title shown in the header bar. */
243
+ filename?: string;
244
+ className?: string;
245
+ }
246
+ /**
247
+ * A code block with a copy button.
248
+ *
249
+ * No syntax highlighter. Shipping one means a tokeniser and a theme in the bundle of every app that
250
+ * displays a snippet — for a component library, that cost lands on consumers who may never render
251
+ * code at all. Highlighting is better done at build time, or with a highlighter the app already has.
252
+ */
253
+ declare function CodeBlock({ code, language, copyable, lineNumbers, filename, className, }: CodeBlockProps): react.JSX.Element;
254
+
255
+ /**
256
+ * Progress indicators.
257
+ *
258
+ * The distinction that matters and is usually missed: **progress** is work advancing toward
259
+ * completion (`role="progressbar"`), a **meter** is a static measurement within a range
260
+ * (`role="meter"` — disk usage, a score, a quota). Announcing a disk-usage bar as progress tells a
261
+ * screen-reader user that something is loading, which it isn't.
262
+ */
263
+ interface ProgressProps {
264
+ /** `0`–`max`. Omit for an indeterminate bar. */
265
+ value?: number;
266
+ max?: number;
267
+ size?: 'sm' | 'md' | 'lg';
268
+ tone?: 'accent' | 'success' | 'warning' | 'danger';
269
+ /** Accessible name — "Upload progress", not "Progress". */
270
+ label: string;
271
+ /** Show the label and percentage above the bar. */
272
+ showLabel?: boolean;
273
+ /** Override the announced/displayed text. */
274
+ formatValue?: (value: number, max: number) => string;
275
+ className?: string;
276
+ }
277
+ declare function Progress({ value, max, size, tone, label, showLabel, formatValue, className, }: ProgressProps): react.JSX.Element;
278
+ interface CircularProgressProps extends Omit<ProgressProps, 'size'> {
279
+ /** Diameter in px. Default `48`. */
280
+ size?: number;
281
+ /** Ring thickness in px. Default `4`. */
282
+ thickness?: number;
283
+ /** Content in the middle — usually the percentage. */
284
+ children?: ReactNode;
285
+ }
286
+ /**
287
+ * A ring progress indicator.
288
+ *
289
+ * Drawn with `stroke-dasharray` on an SVG circle rather than with conic gradients, so the ends can
290
+ * be rounded and the ring animates smoothly at any size. The circle is rotated -90° so 0% starts at
291
+ * the top, which is where everyone expects it.
292
+ */
293
+ declare function CircularProgress({ value, max, size, thickness, tone, label, formatValue, className, children, }: CircularProgressProps): react.JSX.Element;
294
+ interface MeterProps {
295
+ value: number;
296
+ min?: number;
297
+ max?: number;
298
+ /** Thresholds that colour the bar — below `low` is danger, above `high` is success. */
299
+ low?: number;
300
+ high?: number;
301
+ /** Flip the colours, for metrics where high is bad (disk usage, error rate). */
302
+ inverted?: boolean;
303
+ label: string;
304
+ showValue?: boolean;
305
+ formatValue?: (value: number) => string;
306
+ className?: string;
307
+ }
308
+ /**
309
+ * A measurement within a known range — quota, score, capacity.
310
+ *
311
+ * `role="meter"`, not `progressbar`. Colour follows the thresholds, but the numeric value is always
312
+ * rendered too, so the state is never conveyed by colour alone.
313
+ */
314
+ declare function Meter({ value, min, max, low, high, inverted, label, showValue, formatValue, className, }: MeterProps): react.JSX.Element;
315
+
316
+ export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, type BadgeTone, CircularProgress, type CircularProgressProps, CodeBlock, type CodeBlockProps, type Column, DataTable, type DataTableProps, DescriptionList, type DescriptionListProps, EmptyState, type EmptyStateProps, Kbd, Meter, type MeterProps, Pagination, type PaginationProps, Progress, type ProgressProps, type SortDirection, type SortState, Stat, type StatProps, Table, Timeline, type TimelineItem };
package/dist/data.js ADDED
@@ -0,0 +1,6 @@
1
+ 'use client';
2
+ export { Avatar, AvatarGroup, Badge, CircularProgress, CodeBlock, DataTable, DescriptionList, EmptyState, Kbd, Meter, Pagination, Progress, Stat, Table, Timeline } from './chunk-HPGCILO4.js';
3
+ import './chunk-LXCIXR5T.js';
4
+ import './chunk-H34OXXJU.js';
5
+ //# sourceMappingURL=data.js.map
6
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"data.js"}