prime-ui-kit 0.17.0 → 0.18.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 (227) hide show
  1. package/README.md +2 -1
  2. package/dist/chunks/{chunk-PRP4B6OG.js → chunk-IVS3J7AS.js} +1 -1
  3. package/dist/chunks/{chunk-A4WE3UNC.js → chunk-MB4CXSLL.js} +18473 -17911
  4. package/dist/chunks/{chunk-7WWZYGRC.js → chunk-OAXJWF3L.js} +4477 -3882
  5. package/dist/chunks/{chunk-2ODXLPW3.js → chunk-QFHE5GKW.js} +1 -0
  6. package/dist/chunks/{chunk-SVFWPLNW.js → chunk-X3JT5CLR.js} +14 -3
  7. package/dist/color-picker.js +3 -3
  8. package/dist/components/badge/Badge.d.ts +17 -0
  9. package/dist/components/breadcrumb/Breadcrumb.d.ts +11 -2
  10. package/dist/components/button/Button.d.ts +1 -1
  11. package/dist/components/button-group/ButtonGroup.d.ts +1 -1
  12. package/dist/components/card/Card.d.ts +8 -4
  13. package/dist/components/chat/Chat.d.ts +3 -3
  14. package/dist/components/chat/MessageList.d.ts +5 -1
  15. package/dist/components/chat/groupMessages.d.ts +12 -4
  16. package/dist/components/chat-list/ChatList.d.ts +18 -9
  17. package/dist/components/chat-list/formatChatTime.d.ts +3 -3
  18. package/dist/components/checkbox/Checkbox.d.ts +6 -1
  19. package/dist/components/color-field/ColorField.d.ts +1 -1
  20. package/dist/components/color-picker/ColorPicker.d.ts +6 -1
  21. package/dist/components/color-picker/ColorPresets.d.ts +9 -1
  22. package/dist/components/crossfade/Crossfade.d.ts +1 -1
  23. package/dist/components/data-table/DataTable.d.ts +2 -0
  24. package/dist/components/data-table/Head.d.ts +3 -1
  25. package/dist/components/data-table/types.d.ts +5 -0
  26. package/dist/components/digit-input/DigitInput.d.ts +1 -1
  27. package/dist/components/drawer/Drawer.d.ts +3 -2
  28. package/dist/components/field-list/FieldList.d.ts +18 -6
  29. package/dist/components/hint/Hint.d.ts +8 -2
  30. package/dist/components/index.d.ts +6 -3
  31. package/dist/components/input/Input.d.ts +27 -5
  32. package/dist/components/input/inputSuggestions.d.ts +39 -0
  33. package/dist/components/kanban/Kanban.d.ts +4 -9
  34. package/dist/components/list/List.d.ts +19 -5
  35. package/dist/components/message/Message.d.ts +15 -3
  36. package/dist/components/message/MessageSticker.d.ts +27 -0
  37. package/dist/components/message/formatMessageTime.d.ts +5 -2
  38. package/dist/components/modal/Modal.d.ts +3 -2
  39. package/dist/components/native-select/NativeSelect.d.ts +1 -1
  40. package/dist/components/radio/Radio.d.ts +11 -2
  41. package/dist/components/rich-text/RichText.d.ts +23 -0
  42. package/dist/components/scroll-container/ScrollContainer.d.ts +1 -1
  43. package/dist/components/scroll-container/scrollGlide.d.ts +26 -0
  44. package/dist/components/scroll-container/useScrollMotion.d.ts +25 -0
  45. package/dist/components/segmented-control/SegmentedControl.d.ts +1 -1
  46. package/dist/components/select/selectContext.d.ts +7 -0
  47. package/dist/components/slider/Slider.d.ts +1 -1
  48. package/dist/components/switch/Switch.d.ts +6 -1
  49. package/dist/components/tag-select/TagSelect.d.ts +1 -1
  50. package/dist/components/textarea/Textarea.d.ts +6 -1
  51. package/dist/components/timeline/Timeline.d.ts +1 -1
  52. package/dist/icon-set.js +2 -2
  53. package/dist/index.css +1 -1
  54. package/dist/index.js +5 -3
  55. package/dist/internal/ChoiceField.d.ts +3 -1
  56. package/dist/internal/FieldFrame.d.ts +8 -2
  57. package/dist/internal/fieldCell.d.ts +1 -1
  58. package/dist/internal/formatClock.d.ts +23 -2
  59. package/dist/internal/leaveGuard.d.ts +21 -0
  60. package/dist/internal/messageList.d.ts +2 -0
  61. package/dist/internal/overlay/DialogParts.d.ts +27 -2
  62. package/dist/internal/swatch.d.ts +5 -0
  63. package/dist/internal/tokenDefaults.d.ts +1 -0
  64. package/dist/layout/index.d.ts +1 -1
  65. package/dist/layout/page/Page.d.ts +47 -8
  66. package/dist/skill/anti-slop.md +5 -0
  67. package/dist/skill/api-contract.md +14 -7
  68. package/dist/skill/cheatsheet.md +22 -7
  69. package/dist/skill/checklist.md +5 -0
  70. package/dist/skill/choosing.md +25 -12
  71. package/dist/skill/components.md +1 -0
  72. package/dist/skill/composition.md +19 -5
  73. package/dist/skill/layouts.md +5 -3
  74. package/dist/skill/reference/components/badge/COMPONENT.md +14 -1
  75. package/dist/skill/reference/components/badge/examples/examples.module.css +7 -0
  76. package/dist/skill/reference/components/badge/examples/tag-row.tsx +34 -0
  77. package/dist/skill/reference/components/breadcrumb/COMPONENT.md +9 -4
  78. package/dist/skill/reference/components/breadcrumb/examples/router.tsx +17 -0
  79. package/dist/skill/reference/components/button/COMPONENT.md +1 -1
  80. package/dist/skill/reference/components/button-group/COMPONENT.md +1 -0
  81. package/dist/skill/reference/components/card/COMPONENT.md +7 -1
  82. package/dist/skill/reference/components/card/examples/states.tsx +59 -0
  83. package/dist/skill/reference/components/chat/COMPONENT.md +4 -1
  84. package/dist/skill/reference/components/chat/examples/time-zone.tsx +83 -0
  85. package/dist/skill/reference/components/chat-list/COMPONENT.md +12 -6
  86. package/dist/skill/reference/components/chat-list/examples/links.tsx +1 -1
  87. package/dist/skill/reference/components/chat-list/examples/router.tsx +63 -0
  88. package/dist/skill/reference/components/checkbox/COMPONENT.md +1 -0
  89. package/dist/skill/reference/components/color-field/COMPONENT.md +2 -1
  90. package/dist/skill/reference/components/color-picker/COMPONENT.md +14 -5
  91. package/dist/skill/reference/components/color-picker/examples/presets-custom.tsx +31 -0
  92. package/dist/skill/reference/components/color-swatches/COMPONENT.md +1 -0
  93. package/dist/skill/reference/components/crossfade/COMPONENT.md +1 -1
  94. package/dist/skill/reference/components/data-table/COMPONENT.md +7 -2
  95. package/dist/skill/reference/components/data-table/examples/numeric.tsx +9 -2
  96. package/dist/skill/reference/components/datepicker/COMPONENT.md +3 -1
  97. package/dist/skill/reference/components/datepicker/examples/deadline.tsx +33 -0
  98. package/dist/skill/reference/components/digit-input/COMPONENT.md +1 -0
  99. package/dist/skill/reference/components/drawer/COMPONENT.md +15 -2
  100. package/dist/skill/reference/components/drawer/examples/client-card.tsx +32 -8
  101. package/dist/skill/reference/components/field-list/COMPONENT.md +15 -3
  102. package/dist/skill/reference/components/field-list/examples/saving.tsx +83 -0
  103. package/dist/skill/reference/components/field-list/examples/totals.tsx +82 -0
  104. package/dist/skill/reference/components/file-upload/COMPONENT.md +1 -0
  105. package/dist/skill/reference/components/hint/COMPONENT.md +16 -2
  106. package/dist/skill/reference/components/hint/examples/variants.tsx +48 -0
  107. package/dist/skill/reference/components/input/COMPONENT.md +39 -9
  108. package/dist/skill/reference/components/input/examples/affixes.tsx +4 -2
  109. package/dist/skill/reference/components/input/examples/dismiss.tsx +29 -0
  110. package/dist/skill/reference/components/input/examples/suggestions.tsx +26 -0
  111. package/dist/skill/reference/components/input/examples/time.tsx +24 -0
  112. package/dist/skill/reference/components/input/examples/with-select.tsx +44 -0
  113. package/dist/skill/reference/components/kanban/COMPONENT.md +6 -6
  114. package/dist/skill/reference/components/kanban/examples/columns.tsx +4 -2
  115. package/dist/skill/reference/components/list/COMPONENT.md +23 -7
  116. package/dist/skill/reference/components/list/examples/row-controls.tsx +80 -0
  117. package/dist/skill/reference/components/list/examples/with-icon.tsx +23 -2
  118. package/dist/skill/reference/components/login-form/COMPONENT.md +8 -7
  119. package/dist/skill/reference/components/login-form/examples/states.tsx +12 -14
  120. package/dist/skill/reference/components/message/COMPONENT.md +30 -9
  121. package/dist/skill/reference/components/message/examples/preview.tsx +28 -0
  122. package/dist/skill/reference/components/message/examples/sticker.tsx +35 -0
  123. package/dist/skill/reference/components/modal/COMPONENT.md +15 -3
  124. package/dist/skill/reference/components/modal/examples/long-content.tsx +37 -18
  125. package/dist/skill/reference/components/native-select/COMPONENT.md +1 -0
  126. package/dist/skill/reference/components/notification/COMPONENT.md +1 -1
  127. package/dist/skill/reference/components/radio/COMPONENT.md +2 -0
  128. package/dist/skill/reference/components/rich-text/COMPONENT.md +93 -0
  129. package/dist/skill/reference/components/rich-text/examples/overview.tsx +19 -0
  130. package/dist/skill/reference/components/scroll-container/COMPONENT.md +8 -5
  131. package/dist/skill/reference/components/segmented-control/COMPONENT.md +1 -0
  132. package/dist/skill/reference/components/segmented-control/examples/in-form.tsx +1 -1
  133. package/dist/skill/reference/components/select/COMPONENT.md +7 -3
  134. package/dist/skill/reference/components/slider/COMPONENT.md +1 -0
  135. package/dist/skill/reference/components/slider/examples/controlled.tsx +1 -1
  136. package/dist/skill/reference/components/switch/COMPONENT.md +1 -0
  137. package/dist/skill/reference/components/tag-select/COMPONENT.md +1 -0
  138. package/dist/skill/reference/components/textarea/COMPONENT.md +1 -0
  139. package/dist/skill/reference/components/timeline/COMPONENT.md +3 -3
  140. package/dist/skill/reference/components/timeline/examples/structure.tsx +2 -1
  141. package/dist/skill/reference/layout/app-shell/COMPONENT.md +2 -2
  142. package/dist/skill/reference/layout/bottom-nav/COMPONENT.md +1 -0
  143. package/dist/skill/reference/layout/page/COMPONENT.md +37 -8
  144. package/dist/skill/reference/layout/page/examples/examples.module.css +7 -0
  145. package/dist/skill/reference/layout/page/examples/guard.tsx +87 -0
  146. package/dist/skill/reference/layout/page/examples/loading.tsx +57 -0
  147. package/dist/skill/reference/layout/sidebar/COMPONENT.md +1 -0
  148. package/dist/skill/responsive.md +12 -7
  149. package/dist/skill/ux.md +5 -3
  150. package/dist/tokens/semantic.d.ts +2 -0
  151. package/package.json +2 -2
  152. package/src/components/badge/COMPONENT.md +14 -1
  153. package/src/components/badge/examples/examples.module.css +7 -0
  154. package/src/components/badge/examples/tag-row.tsx +34 -0
  155. package/src/components/breadcrumb/COMPONENT.md +9 -4
  156. package/src/components/breadcrumb/examples/router.tsx +17 -0
  157. package/src/components/button/COMPONENT.md +1 -1
  158. package/src/components/button-group/COMPONENT.md +1 -0
  159. package/src/components/card/COMPONENT.md +7 -1
  160. package/src/components/card/examples/states.tsx +59 -0
  161. package/src/components/chat/COMPONENT.md +4 -1
  162. package/src/components/chat/examples/time-zone.tsx +83 -0
  163. package/src/components/chat-list/COMPONENT.md +12 -6
  164. package/src/components/chat-list/examples/links.tsx +1 -1
  165. package/src/components/chat-list/examples/router.tsx +63 -0
  166. package/src/components/checkbox/COMPONENT.md +1 -0
  167. package/src/components/color-field/COMPONENT.md +2 -1
  168. package/src/components/color-picker/COMPONENT.md +14 -5
  169. package/src/components/color-picker/examples/presets-custom.tsx +31 -0
  170. package/src/components/color-swatches/COMPONENT.md +1 -0
  171. package/src/components/crossfade/COMPONENT.md +1 -1
  172. package/src/components/data-table/COMPONENT.md +7 -2
  173. package/src/components/data-table/examples/numeric.tsx +9 -2
  174. package/src/components/datepicker/COMPONENT.md +3 -1
  175. package/src/components/datepicker/examples/deadline.tsx +33 -0
  176. package/src/components/digit-input/COMPONENT.md +1 -0
  177. package/src/components/drawer/COMPONENT.md +15 -2
  178. package/src/components/drawer/examples/client-card.tsx +32 -8
  179. package/src/components/field-list/COMPONENT.md +15 -3
  180. package/src/components/field-list/examples/saving.tsx +83 -0
  181. package/src/components/field-list/examples/totals.tsx +82 -0
  182. package/src/components/file-upload/COMPONENT.md +1 -0
  183. package/src/components/hint/COMPONENT.md +16 -2
  184. package/src/components/hint/examples/variants.tsx +48 -0
  185. package/src/components/input/COMPONENT.md +39 -9
  186. package/src/components/input/examples/affixes.tsx +4 -2
  187. package/src/components/input/examples/dismiss.tsx +29 -0
  188. package/src/components/input/examples/suggestions.tsx +26 -0
  189. package/src/components/input/examples/time.tsx +24 -0
  190. package/src/components/input/examples/with-select.tsx +44 -0
  191. package/src/components/kanban/COMPONENT.md +6 -6
  192. package/src/components/kanban/examples/columns.tsx +4 -2
  193. package/src/components/list/COMPONENT.md +23 -7
  194. package/src/components/list/examples/row-controls.tsx +80 -0
  195. package/src/components/list/examples/with-icon.tsx +23 -2
  196. package/src/components/login-form/COMPONENT.md +8 -7
  197. package/src/components/login-form/examples/states.tsx +12 -14
  198. package/src/components/message/COMPONENT.md +30 -9
  199. package/src/components/message/examples/preview.tsx +28 -0
  200. package/src/components/message/examples/sticker.tsx +35 -0
  201. package/src/components/modal/COMPONENT.md +15 -3
  202. package/src/components/modal/examples/long-content.tsx +37 -18
  203. package/src/components/native-select/COMPONENT.md +1 -0
  204. package/src/components/notification/COMPONENT.md +1 -1
  205. package/src/components/radio/COMPONENT.md +2 -0
  206. package/src/components/rich-text/COMPONENT.md +93 -0
  207. package/src/components/rich-text/examples/overview.tsx +19 -0
  208. package/src/components/scroll-container/COMPONENT.md +8 -5
  209. package/src/components/segmented-control/COMPONENT.md +1 -0
  210. package/src/components/segmented-control/examples/in-form.tsx +1 -1
  211. package/src/components/select/COMPONENT.md +7 -3
  212. package/src/components/slider/COMPONENT.md +1 -0
  213. package/src/components/slider/examples/controlled.tsx +1 -1
  214. package/src/components/switch/COMPONENT.md +1 -0
  215. package/src/components/tag-select/COMPONENT.md +1 -0
  216. package/src/components/textarea/COMPONENT.md +1 -0
  217. package/src/components/timeline/COMPONENT.md +3 -3
  218. package/src/components/timeline/examples/structure.tsx +2 -1
  219. package/src/layout/app-shell/COMPONENT.md +2 -2
  220. package/src/layout/bottom-nav/COMPONENT.md +1 -0
  221. package/src/layout/page/COMPONENT.md +37 -8
  222. package/src/layout/page/examples/examples.module.css +7 -0
  223. package/src/layout/page/examples/guard.tsx +87 -0
  224. package/src/layout/page/examples/loading.tsx +57 -0
  225. package/src/layout/sidebar/COMPONENT.md +1 -0
  226. package/src/styles/theme-light.css +1 -0
  227. package/dist/components/scroll-container/useWheelToInline.d.ts +0 -10
@@ -0,0 +1,87 @@
1
+ /** A client's card edited on its own page: after an edit a press on the navigation or the path asks before the changes are lost, and while it saves nothing leaves — `Page.Guard`, `dirty`, `busy`. */
2
+ import { AppShell, Breadcrumb, Button, Card, Icon, Input, Page, Sidebar } from "prime-ui-kit";
3
+ import * as React from "react";
4
+
5
+ import styles from "./examples.module.css";
6
+
7
+ const SAVED_NAME = "ООО «Северный ветер»";
8
+ const SAVED_MANAGER = "Анна Морозова";
9
+
10
+ export default function PageGuardExample() {
11
+ const [name, setName] = React.useState(SAVED_NAME);
12
+ const [manager, setManager] = React.useState(SAVED_MANAGER);
13
+ const [saved, setSaved] = React.useState({ name: SAVED_NAME, manager: SAVED_MANAGER });
14
+ const [saving, setSaving] = React.useState(false);
15
+ const formId = React.useId();
16
+ const dirty = name !== saved.name || manager !== saved.manager;
17
+
18
+ const save = (event: React.FormEvent<HTMLFormElement>) => {
19
+ event.preventDefault();
20
+ setSaving(true);
21
+ window.setTimeout(() => {
22
+ setSaved({ name, manager });
23
+ setSaving(false);
24
+ }, 1200);
25
+ };
26
+
27
+ return (
28
+ <div className={styles.window}>
29
+ <AppShell.Root fillViewport className={styles.shell}>
30
+ <AppShell.Nav>
31
+ <Sidebar.Root>
32
+ <Sidebar.Content>
33
+ <Sidebar.Item href="#orders">
34
+ <Sidebar.ItemIcon>
35
+ <Icon name="object.package" />
36
+ </Sidebar.ItemIcon>
37
+ Заказы
38
+ </Sidebar.Item>
39
+ <Sidebar.Item href="#clients" current>
40
+ <Sidebar.ItemIcon>
41
+ <Icon name="object.users" />
42
+ </Sidebar.ItemIcon>
43
+ Клиенты
44
+ </Sidebar.Item>
45
+ </Sidebar.Content>
46
+ </Sidebar.Root>
47
+ </AppShell.Nav>
48
+ <AppShell.Main>
49
+ <Page.Root>
50
+ <Page.Guard dirty={dirty} busy={saving} />
51
+ <Page.TopBar>
52
+ <Page.Heading>
53
+ <Breadcrumb.Root>
54
+ <Breadcrumb.Item href="#clients">Клиенты</Breadcrumb.Item>
55
+ </Breadcrumb.Root>
56
+ <Page.Title>{saved.name}</Page.Title>
57
+ </Page.Heading>
58
+ <Page.Actions>
59
+ <Button.Root type="submit" form={formId} loading={saving} disabled={!dirty}>
60
+ Сохранить
61
+ </Button.Root>
62
+ </Page.Actions>
63
+ </Page.TopBar>
64
+ <Page.Body>
65
+ <Card.Root>
66
+ <Card.Body>
67
+ <form id={formId} className={styles.fields} onSubmit={save}>
68
+ <Input.Root label="Название">
69
+ <Input.Wrapper>
70
+ <Input.Field value={name} onValueChange={setName} />
71
+ </Input.Wrapper>
72
+ </Input.Root>
73
+ <Input.Root label="Менеджер">
74
+ <Input.Wrapper>
75
+ <Input.Field value={manager} onValueChange={setManager} />
76
+ </Input.Wrapper>
77
+ </Input.Root>
78
+ </form>
79
+ </Card.Body>
80
+ </Card.Root>
81
+ </Page.Body>
82
+ </Page.Root>
83
+ </AppShell.Main>
84
+ </AppShell.Root>
85
+ </div>
86
+ );
87
+ }
@@ -0,0 +1,57 @@
1
+ /** A page whose figures load after it opens: the line of data keeps its place under the title while it loads, so nothing in the bar moves — `loading`. */
2
+ import { Button, Card, Crossfade, Icon, Page, Skeleton, Typography } from "prime-ui-kit";
3
+ import * as React from "react";
4
+
5
+ const ORDERS = [
6
+ { id: "№ 4821", client: "ООО «Север»", sum: "84 000 ₽" },
7
+ { id: "№ 4820", client: "ИП Котов", sum: "12 500 ₽" },
8
+ { id: "№ 4819", client: "ООО «Вектор»", sum: "230 000 ₽" },
9
+ ];
10
+
11
+ const LOAD_MS = 1200;
12
+
13
+ export default function PageLoadingExample() {
14
+ const [loading, setLoading] = React.useState(true);
15
+
16
+ React.useEffect(() => {
17
+ if (!loading) return;
18
+ const timer = window.setTimeout(() => setLoading(false), LOAD_MS);
19
+ return () => window.clearTimeout(timer);
20
+ }, [loading]);
21
+
22
+ return (
23
+ <Page.Root>
24
+ <Page.TopBar sticky={false}>
25
+ <Page.Heading>
26
+ <Page.Title>Заказы</Page.Title>
27
+ <Page.Description loading={loading}>128 в работе · 6 ждут оплаты</Page.Description>
28
+ </Page.Heading>
29
+ <Page.Actions>
30
+ <Button.Root variant="soft" tone="neutral" onClick={() => setLoading(true)}>
31
+ <Button.Icon>
32
+ <Icon name="action.refresh" />
33
+ </Button.Icon>
34
+ Обновить
35
+ </Button.Root>
36
+ </Page.Actions>
37
+ </Page.TopBar>
38
+ <Page.Body>
39
+ <Card.Root variant="list" aria-busy={loading || undefined}>
40
+ <Card.Body>
41
+ <Crossfade state={loading ? "loading" : "data"}>
42
+ {loading ? (
43
+ <Skeleton lines={ORDERS.length} />
44
+ ) : (
45
+ ORDERS.map((order) => (
46
+ <Typography key={order.id} variant="body-m">
47
+ {order.id} · {order.client} · {order.sum}
48
+ </Typography>
49
+ ))
50
+ )}
51
+ </Crossfade>
52
+ </Card.Body>
53
+ </Card.Root>
54
+ </Page.Body>
55
+ </Page.Root>
56
+ );
57
+ }
@@ -299,6 +299,7 @@ Put `<Sidebar.Toggle variant="header" />` next to `Sidebar.Brand` in the header,
299
299
  ## States
300
300
  | State | Driven by | DOM |
301
301
  |---|---|---|
302
+ | held | a `Page.Guard` that is `busy` or `dirty` on the page | a press on `Sidebar.Item` or `Sidebar.Brand` stops before it navigates (a router link included) and the panel stays; `dirty` asks first, then repeats it |
302
303
  | mode | `mode` / `defaultMode` | Root `data-mode`, `data-panel-mode` (the last visible mode while hidden); `<nav inert>` while hidden |
303
304
  | off-canvas | `offCanvas="always"`, or `"auto"` + viewport < 768px | Root `data-off-canvas`, `data-state="open" \| "closed"`; `<nav inert>` while closed; the kit scrim (`role="presentation"`) while open; in an `AppShell` the shell Root `data-off-canvas` |
304
305
  | placing | the viewport crossed the off-canvas breakpoint (not a person's choice) | Root `data-placing` for one painted frame: the rail lands at its new width with no motion (no growing from 0, no folding rows, no sliding panel) |
@@ -48,7 +48,8 @@ A layout inside a page needs no breakpoint: it takes its columns from the room i
48
48
 
49
49
  - The tiles of a page (KPI cards, charts, panels) are one `Page.Grid` with a
50
50
  `Page.Cell span` per tile: it folds by its own width (below 30rem every tile takes the row,
51
- then small tiles pair up, from 64rem each its span).
51
+ then small tiles pair up, from 64rem each its span). Write a wide tile (`span` 7–11) next to a
52
+ narrow one (4–5): between 40 and 64rem the two pair up as 2/3 + 1/3, so an 8 + 4 row keeps no hole.
52
53
  - A grid inside one block (thumbnails, short fields of one record) is the block's own
53
54
  `grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--prime-layout-tile-min-width)), 1fr))`
54
55
  — `auto-fill`, so a lone item keeps its column width instead of stretching across the row.
@@ -61,9 +62,9 @@ Use these as they are; never wrap them in your own breakpoints.
61
62
 
62
63
  | Need | Built in |
63
64
  |---|---|
64
- | app frame | `AppShell.Main` hands the page its gutters 16 → 24 → 32 and top air 24 → 32; `Page.TopBar` un-sticks on screens lower than 480px and respects the top safe area; in the bar the title and its line of data truncate |
65
+ | app frame | `AppShell.Main` hands the page its gutters 16 → 24 → 32, top air 24 → 32 and bottom air 64 (the gutter under a `fill` page; above a floating BottomNav it keeps the capsule's room); `Page.TopBar` un-sticks on screens lower than 480px and respects the top safe area |
65
66
  | app navigation | Sidebar: on-canvas from 768px, an off-canvas panel below (`offCanvas="auto"`) opened by the menu button `Page.TopBar` draws by itself while the Sidebar is off-canvas; `BottomNav` in `AppShell.Footer` for 2–6 app sections on phones — flat or a floating glass capsule (`floating`) with an optional round `BottomNav.Action`, icons with or without labels (`iconOnly`); the shell hides it by itself while the Sidebar rail is on screen (from 768px with `offCanvas="auto"`) |
66
- | page top bar | `Page.TopBar` lays out its groups from their natural widths: one line while they fit, then the tools on a line of their own, then icon-only buttons, then «⋯», and the heading truncates last ([below](#the-pages-top-bar--pagetopbar)). `Page.Header` in the flow: actions wrap under the title |
67
+ | page top bar | `Page.TopBar` lays out its groups from their natural widths: one line while they fit, then the tools on a line of their own, then icon-only buttons, then «⋯», and the heading gives last ([below](#the-pages-top-bar--pagetopbar)). `Page.Header` in the flow: actions wrap under the title |
67
68
  | switchers | [Switchers](#switchers) never wrap or truncate: they scroll inside themselves |
68
69
  | tables | DataTable scrolls inside itself, edge shadows show hidden columns, `stickyFirstColumn`, `DataTable.ColumnsMenu` for a column chooser, the toolbar stacks below a 30rem table, sticky head off on short screens |
69
70
  | floating layers | Popover (opened from a Trigger), Dropdown, Select (and Datepicker, ColorPresets) never wider than the viewport − 16, 8 from the edges, flip when out of room; below 640 they open as a bottom sheet — scrim, grab handle, swipe down to close, page scroll locked; Tooltip and TagSelect stay anchored |
@@ -85,12 +86,16 @@ in this order, and nothing ever overflows:
85
86
 
86
87
  1. **One line** — `Page.Heading`, `Page.Tools` and `Page.Actions` side by side while they fit.
87
88
  2. **Tools below** — the tools take a line of their own under the first one and fill its width: a
88
- search (`SmartFilter.Toolbar`, `Input.Root`) grows first, the switchers share the rest and wrap
89
- when one line is not enough. The actions stay on the first line beside the heading at every width.
89
+ search (`SmartFilter.Toolbar`, `Input.Root`) grows first, the switchers and a period
90
+ (`Datepicker.Root`) share the rest and wrap when one line is not enough. Beside a search that
91
+ would get too little room the SmartFilter button shows only its icon and count, on the same row.
92
+ The actions stay on the first line beside the heading at every width.
90
93
  3. **Icons** — every Button with an icon shows only the icon, the secondary ones first, then the
91
94
  primary; its label stays its accessible name and becomes its tooltip.
92
95
  4. **«⋯»** — the secondary Buttons fold into a menu (`labels.more`); the primary always stays.
93
- 5. **The heading truncates** — only after every button step: the path levels first, then the title.
96
+ 5. **The heading gives** — only after every button step: the middle levels of the path fold into
97
+ «…»; a heading with a path that still does not fit stacks (the path on its own line over the
98
+ title, the title and its description wrapping), so no level is cut to a fragment; a heading without a path truncates.
94
99
 
95
100
  `Page.Chips` is always a line of its own under everything, gone while no filter is set. The heading
96
101
  keeps its natural width: the bar sizes the title, so there is nothing to tune.
@@ -182,7 +187,7 @@ export function OrdersPage() {
182
187
  inside takes that tier.
183
188
  - A Button without an icon keeps its label at every step and leaves the bar less room before it
184
189
  folds: give each one a `Button.Icon`.
185
- - A SegmentedControl in `Page.Tools` needs no `fullWidth`: the bar sets it.
190
+ - A SegmentedControl or a Datepicker in `Page.Tools` needs no `fullWidth`: the bar sets it.
186
191
  - The primary action is on screen at every width — as its icon at the narrowest; it never folds and
187
192
  never disappears.
188
193
  - Section totals go into `SegmentedControl.Count`, not into stat cards above the table.
package/dist/skill/ux.md CHANGED
@@ -55,8 +55,10 @@ Every word on screen must carry something the person does not see already.
55
55
  list already counts. The list label names the rows.
56
56
  - **No label that repeats its heading.** A field «Цена» inside the section «Цена» needs no label of
57
57
  its own beyond what the section says; a group of one field is the field.
58
- - **A unit lives in one place.** In the field (`Input.InlineAffix`) or in the heading, never both.
59
- Prefer the field: the unit stays beside the number when the row stacks.
58
+ - **A unit lives in one place.** In the field (`Input.InlineAffix`) or in the heading, never both;
59
+ never in the field's own label («Бюджет», not «Бюджет, ₽»). Prefer the field: the unit stays
60
+ beside the number when the row stacks, and a screen reader hears it with the field (the affix
61
+ describes the input; `aria-label="рублей"` on it when the sign reads badly).
60
62
  - **No text that explains the layout.** «Двигатель, места и скорость всегда первыми» — the lock on
61
63
  those rows says it. A hint says what the person cannot see (a format, a consequence, a limit).
62
64
  - **One name per thing.** The same action, entity and status keep one word on the whole screen
@@ -97,7 +99,7 @@ Pick the lightest step that keeps the person safe ([choosing.md](choosing.md) ha
97
99
  | One standalone action that is easy to redo by hand | `Button.Root holdToConfirm` |
98
100
  | Irreversible loss of work, or an outward action that cannot be called back once it leaves the product (an invoice or a message sent to a client, a payment) | `ConfirmDialog` that names the thing and the consequence |
99
101
  | Bulk destructive | `ConfirmDialog` that names the count («Удалить 12 счетов?») |
100
- | Leaving a form with changes | `Modal.Guard` / `Drawer.Guard dirty` |
102
+ | Leaving a form with changes | `Modal.Guard` / `Drawer.Guard dirty`; a form that is the page — `Page.Guard dirty` |
101
103
 
102
104
  A confirm on every action trains people to click through it; the one that mattered is then missed.
103
105
  Which button starts each step and how the confirm behaves:
@@ -801,6 +801,8 @@ export declare const semanticTokens: {
801
801
  readonly videoNote: "14.5rem";
802
802
  /** The box of a sent round video message (`VideoNote`): its diameter, at most the row. */
803
803
  readonly videoNoteBox: "16.75rem";
804
+ /** The square box of a sticker (`Message.Sticker`), at most the row. */
805
+ readonly sticker: "10rem";
804
806
  /**
805
807
  * A message changing size (a reaction row, a transcript that opens): the bubble's box, its
806
808
  * parts and the messages around glide in one calm stroke, between `fast` and `base`; zeroed
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "prime-ui-kit",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "packageManager": "bun@1.3.13",
5
- "description": "React 19 UI kit for product interfaces: 78 composable components on one design contract — forms, selects, tables, overlays, navigation, app shell. CSS Modules, --prime-* tokens, light and dark themes, TypeScript, a11y, Next.js App Router ready. Ships COMPONENT.md docs, copyable examples and an agent skill.",
5
+ "description": "React 19 UI kit for product interfaces: 79 composable components on one design contract — forms, selects, tables, overlays, navigation, app shell. CSS Modules, --prime-* tokens, light and dark themes, TypeScript, a11y, Next.js App Router ready. Ships COMPONENT.md docs, copyable examples and an agent skill.",
6
6
  "bin": {
7
7
  "prime-ui-kit": "bin/prime-ui-kit.js"
8
8
  },
@@ -12,6 +12,7 @@
12
12
  - A selected value, keyword or applied filter the user can remove (`onRemove`).
13
13
  - Values in a filter panel that toggle on press and hide with a hover action (the `pressed` triad, `Badge.Action`).
14
14
  - A short code as a square tile (a file format «PDF») — `shape="square"`.
15
+ - Several badges as one value (the tags of a client, a record's labels) — `Badge.Group`: it wraps and keeps one gap.
15
16
 
16
17
  ## When not to use
17
18
  - A multi-select field with chips → use [TagSelect](../tag-select/COMPONENT.md) (it renders badges itself).
@@ -33,6 +34,8 @@ Badge.Root <span>: fill, tier dimensions
33
34
  │ (a toggle <button> with the pressed triad; a <span> with a trailing segment; none when read-only)
34
35
  ├─ Badge.Action optional end segment revealed on hover / focus (always shown on touch screens)
35
36
  └─ remove segment with onRemove: full height, the whole end is the hit area (Icon action.close)
37
+
38
+ Badge.Group <div>: a wrapping row of Badge.Root, one value; `size` sets every badge's tier
36
39
  ```
37
40
 
38
41
  ## API
@@ -60,6 +63,14 @@ Badge.Root <span>: fill, tier dimensions
60
63
  | `children` | `ReactNode` | — | Text, `Badge.Dot`, `Badge.Icon`, one `Badge.Action`. Only `Badge.Icon` children (no remove or action) make a square icon-only badge. |
61
64
  | `…rest` | `Omit<HTMLAttributes<HTMLSpanElement>, "onClick" \| "color">` | — | `aria-label` (an icon-only badge named by it is an image) and the other span attributes; no `onClick` — a pressable chip is the toggle. |
62
65
 
66
+ ### Badge.Group
67
+ `ref` → `HTMLDivElement`. A row of badges as one value (the tags of a record): it wraps onto more lines, the badges a chip gap apart.
68
+
69
+ | Prop | Type | Default | Description |
70
+ |---|---|---|---|
71
+ | `size` | `"xs" \| "s" \| "m" \| "l" \| "xl"` | the host tier, one step down | Tier of every badge in the group; a badge's own `size` wins. Small tiers stand closer. |
72
+ | `…rest` | `HTMLAttributes<HTMLDivElement>` | — | `children` (the `Badge.Root`s), `className`, `aria-label` (a named group is `role="group"`) and the other div attributes. |
73
+
63
74
  ### Badge.Icon
64
75
  `ref` → `HTMLSpanElement`. A `<span>` holding one icon at the tier icon size. At the first or last position it becomes a full-height edge segment.
65
76
 
@@ -163,7 +174,7 @@ A status takes `tone`; a category takes `color`. The two never go together (the
163
174
  - `Badge.Dot` is 6px, 8px from `l`; alone it takes the tier of the surrounding control; `color` paints it in the solid step of that hue.
164
175
  - The root never clips: the text ellipsizes in its own box, so the segments' touch areas reach past the chip.
165
176
  - `Badge.Action` room is reserved, so revealing it never changes the badge width.
166
- - Several badges in a row: `gap: var(--prime-space-2)`.
177
+ - Several badges in a row: `Badge.Group` — it wraps, badges 8 apart (4 at the `xs` and `s` tiers).
167
178
  - In a list row the badge is the trailing column; the title column gets `min-width: 0` and an ellipsis.
168
179
 
169
180
  ## Accessibility
@@ -206,6 +217,7 @@ A status takes `tone`; a category takes `color`. The two never go together (the
206
217
  | [server-tags.tsx](examples/server-tags.tsx) | Order tags removed on the server: a badge waits dimmed with a spinner, leaves once the server agrees and stays with an announcement when it refuses — `onRemove`, `labels`. |
207
218
  | [filter-values.tsx](examples/filter-values.tsx) | Filter values as toggles with a hide action that slides in without changing the width — `pressed`, `onPressedChange`, `Badge.Action`, `persistent`. |
208
219
  | [square.tsx](examples/square.tsx) | File formats as square tiles of text, large enough for three letters; the hue sorts them by kind — `shape`, `size`, `color`. |
220
+ | [tag-row.tsx](examples/tag-row.tsx) | The tags of a client as one value: the row wraps in a narrow column and keeps one gap between badges — `Badge.Group`, `size`. |
209
221
  | [controlled.tsx](examples/controlled.tsx) | Delivery cities as toggle chips whose state the screen owns: the summary counts the chosen ones — `pressed`, `onPressedChange`. |
210
222
 
211
223
  ## Mistakes
@@ -217,6 +229,7 @@ A status takes `tone`; a category takes `color`. The two never go together (the
217
229
  - Several removable badges with the default «Удалить» → pass `labels.remove` with the badge text.
218
230
  - A colored badge with no text → keep a word; color alone is not a signal.
219
231
  - An explicit `size` inside a control → drop it; the badge takes the tier one step down.
232
+ - A row of badges in a hand-made flex wrapper with its own gap → `Badge.Group`.
220
233
  - `onRemove` together with `Badge.Action` → one end segment per badge.
221
234
  - Removing the badge from your list first and putting it back when the request fails → return the request's promise and remove it after it succeeds; the badge waits meanwhile.
222
235
 
@@ -23,3 +23,10 @@
23
23
  align-items: center;
24
24
  gap: var(--prime-space-2);
25
25
  }
26
+
27
+ /* tag-row.tsx: a 320 px column, narrow enough for the row of badges to wrap. */
28
+ .column {
29
+ display: grid;
30
+ gap: var(--prime-space-6);
31
+ inline-size: min(100%, calc(var(--prime-space-20) * 4));
32
+ }
@@ -0,0 +1,34 @@
1
+ /** The tags of a client as one value: the row wraps in a narrow column and keeps one gap between badges — `Badge.Group`, `size`. */
2
+ import { Badge } from "prime-ui-kit";
3
+
4
+ import styles from "./examples.module.css";
5
+
6
+ const TAGS = [
7
+ { label: "Ключевой клиент", color: "purple" },
8
+ { label: "Оптовые закупки", color: "blue" },
9
+ { label: "Отсрочка 30 дней", color: "orange" },
10
+ { label: "ЭДО", color: "teal" },
11
+ { label: "Москва", color: "gray" },
12
+ { label: "Новый договор", color: "green" },
13
+ ] as const;
14
+
15
+ export default function BadgeTagRowExample() {
16
+ return (
17
+ <div className={styles.column}>
18
+ <Badge.Group aria-label="Теги клиента">
19
+ {TAGS.map((tag) => (
20
+ <Badge.Root key={tag.label} color={tag.color}>
21
+ {tag.label}
22
+ </Badge.Root>
23
+ ))}
24
+ </Badge.Group>
25
+ <Badge.Group size="s" aria-label="Теги заказа">
26
+ {TAGS.slice(0, 4).map((tag) => (
27
+ <Badge.Root key={tag.label} color={tag.color}>
28
+ {tag.label}
29
+ </Badge.Root>
30
+ ))}
31
+ </Badge.Group>
32
+ </div>
33
+ );
34
+ }
@@ -23,7 +23,7 @@ import { Breadcrumb } from "prime-ui-kit";
23
23
  ## Anatomy
24
24
  ```
25
25
  Breadcrumb.Root <nav aria-label> + <ol>; size; chevrons between levels; auto-collapse into a «…» menu
26
- ├─ Breadcrumb.Item <li>: a link (href → LinkButton), text, or the current page (current)
26
+ ├─ Breadcrumb.Item <li>: a link (href → LinkButton, or a router link with asChild), text, or the current page (current)
27
27
  └─ Breadcrumb.Ellipsis <li> with «…» for levels skipped on purpose
28
28
  ```
29
29
 
@@ -42,14 +42,15 @@ Breadcrumb.Root <nav aria-label> + <ol>; size; chevrons between levels
42
42
  | `…rest` | `HTMLAttributes<HTMLElement>` | — | `className` and the other `nav` attributes; an `aria-label` here overrides `labels.nav`. |
43
43
 
44
44
  ### Breadcrumb.Item
45
- `ref` → `HTMLLIElement`. `<li>`: a muted `LinkButton` (`href`), plain text, or the current page (`current`).
45
+ `ref` → `HTMLLIElement`. `<li>`: a muted `LinkButton` (`href`, or the consumer's router link with `asChild`), plain text, or the current page (`current`). A press on the link goes through `Page.Guard`.
46
46
 
47
47
  | Prop | Type | Default | Description |
48
48
  |---|---|---|---|
49
- | `href` | `string` | — | Renders a link; without it the item is text. |
49
+ | `href` | `string` | — | Renders a link; without it (and without `asChild`) the item is text. |
50
+ | `asChild` | `boolean` | `false` | The single child (a router `Link`) is the level's link with the same look; its own text is the level. In the «…» menu of a folded path it is the menu item. |
50
51
  | `current` | `boolean` | — | Current page: `aria-current="page"` (on the link when `href` is set), primary text, medium weight. Usually the last item, without `href`. |
51
52
  | `aria-label` | `string` | — | Name of a link without visible text (e.g. a home icon); set on the link, not the `li`. |
52
- | `children` | `ReactNode` | — | Text or an `Icon`. A string also becomes the `title` of a text item (full text when truncated). |
53
+ | `children` | `ReactNode` | — | Text or an `Icon`; with `asChild` one element. A string also becomes the `title` of a text item (full text when truncated). |
53
54
  | `…rest` | `Omit<LiHTMLAttributes<HTMLLIElement>, "aria-label">` | — | `className` and the other `li` attributes. |
54
55
 
55
56
  ### Breadcrumb.Ellipsis
@@ -77,6 +78,7 @@ Breadcrumb.Root <nav aria-label> + <ol>; size; chevrons between levels
77
78
  | text (no `href`, no `current`) | muted text | a level without its own page | yes |
78
79
  | current (`current`) | primary text, medium weight | the last item — this page | |
79
80
  | icon link (`href` + `aria-label`, `Icon` child) | icon at the tier icon size | a «home» root | |
81
+ | router link (`asChild`, one `Link` child) | the same muted link, the consumer's element | an app with a client router: the path moves without a reload | |
80
82
 
81
83
  Use links for every ancestor and `current` on the last item; `s` above a `heading-m` page title. Avoid `href` on the current item and two `current` items.
82
84
 
@@ -89,6 +91,7 @@ Use links for every ancestor and `current` on the last item; `s` above a `headin
89
91
  | auto-collapse | 2+ levels whose whole path does not fit the width uncut (measured on every resize) | `data-collapsible="true"`, `data-collapsed="true"`; middle levels are `display: none` and replaced by «… ›»: a ghost menu button (`Dropdown.Trigger`, named by `labels.ellipsis`) whose menu lists them — links stay links, a level without `href` is a disabled row |
90
92
  | deep collapse | the path folded as above still does not fit | `data-collapsed="deep"`; the first level folds too: «…» › current page, the menu lists every level before it |
91
93
  | collapse menu open | a press, `Enter` or `ArrowDown` on the «…» | `aria-expanded="true"` on the button; a `role="menu"` panel at the tier size |
94
+ | held | a `Page.Guard` that is `busy` or `dirty` on the page | a press on a level's link (in the path or the «…» menu) stops before it navigates; `dirty` asks first, then repeats it |
92
95
 
93
96
  Root attributes: `data-size`, `data-collapsible` (`"true"` / `"false"`), `data-collapsed` (`"true"` / `"deep"`).
94
97
 
@@ -133,12 +136,14 @@ Root attributes: `data-size`, `data-collapsible` (`"true"` / `"false"`), `data-c
133
136
  | [with-icon.tsx](examples/with-icon.tsx) | The root level as a home icon; a link without text is named for screen readers — `aria-label`. |
134
137
  | [overflow.tsx](examples/overflow.tsx) | A long path: levels truncate, and in a 320px container the middle ones collapse into a «…» menu that lists them — `Breadcrumb.Item`, `current`. |
135
138
  | [ellipsis.tsx](examples/ellipsis.tsx) | Levels skipped on purpose shown as «…» whose hidden text names them for screen readers — `Breadcrumb.Ellipsis`, `labels`. |
139
+ | [router.tsx](examples/router.tsx) | Router links as the levels above: the path moves without a reload; render it inside a router — `asChild`, `current`. |
136
140
 
137
141
  ## Mistakes
138
142
  - Separators by hand between items → the root draws the chevrons.
139
143
  - `<Breadcrumb.Item href="…" current>` → the current page has no `href`.
140
144
  - Breadcrumb inside a flex row collapsing to zero width → give it `flex: 1 1 auto; min-width: 0`.
141
145
  - Home icon link without `aria-label` → add `aria-label="Главная"`.
146
+ - `href` + `onClick` with `preventDefault()` and `navigate()` for a router → `asChild` with the router's `Link`.
142
147
 
143
148
  ## Related
144
149
  - **Built from:** [LinkButton](../link-button/COMPONENT.md) (`tone="muted"`), [Button](../button/COMPONENT.md) and [Dropdown](../dropdown/COMPONENT.md) (the collapse menu), Icon (`nav.chevronRight`), [VisuallyHidden](../visually-hidden/COMPONENT.md)
@@ -0,0 +1,17 @@
1
+ /** Router links as the levels above: the path moves without a reload; render it inside a router — `asChild`, `current`. */
2
+ import { Breadcrumb } from "prime-ui-kit";
3
+ import { Link } from "react-router-dom";
4
+
5
+ export default function BreadcrumbRouterExample() {
6
+ return (
7
+ <Breadcrumb.Root>
8
+ <Breadcrumb.Item asChild>
9
+ <Link to="/crm">CRM</Link>
10
+ </Breadcrumb.Item>
11
+ <Breadcrumb.Item asChild>
12
+ <Link to="/crm/clients">Клиенты</Link>
13
+ </Breadcrumb.Item>
14
+ <Breadcrumb.Item current>ООО «Северный ветер»</Breadcrumb.Item>
15
+ </Breadcrumb.Root>
16
+ );
17
+ }
@@ -66,7 +66,7 @@ Button.Root <button> (or the single child with asChild); variant, tone, s
66
66
  | `labels` | `Partial<ButtonLabels>` | — | Built-in strings, see Labels. |
67
67
  | `asChild` | `boolean` | `false` | Merges Button props and styles onto the single child element (a link) instead of rendering `<button>`. `disabled`/`loading` become `aria-disabled`; `progress` and `holdToConfirm` need a `<button>`. |
68
68
  | `disabled` | `boolean` | — | Disabled state; `loading` also disables. With `asChild` the child leaves the Tab order and a link loses its `href`. |
69
- | `children` | `ReactNode` | — | Label and `Button.Icon`. Only `Button.Icon` children → a square icon-only button that needs `aria-label`. A changed label morphs letter by letter. With `asChild`, the one child element. |
69
+ | `children` | `ReactNode` | — | Label and `Button.Icon`. Only `Button.Icon` children → a square icon-only button that needs `aria-label`. A changed label morphs letter by letter. With `asChild`, the one child element; its text is the label too. |
70
70
  | `aria-label` | `string` | — | The name of a button without a visible label; required with `shape="circle"`. |
71
71
  | `…rest` | `Omit<ButtonHTMLAttributes<HTMLButtonElement>, "size" \| "aria-pressed">` | — | `onClick`, `type` (`"button"` by default, not passed on with `asChild`), `className`, `aria-*`, `data-*` and the other button attributes. |
72
72
 
@@ -47,6 +47,7 @@ The root is a field root: `className`, `ref` and the native attributes land on t
47
47
  | `required` | `boolean` | `false` | Red `*` after the label and `aria-required` on the `group`. |
48
48
  | `optional` | `boolean` | `false` | Muted marker after the label (`labels.optional`). |
49
49
  | `hint` | `ReactNode` | — | Help text under the control (`aria-describedby`). Hidden while `error` is shown. |
50
+ | `hintTone` | `"neutral" \| "success" \| "warning" \| "danger"` | `"neutral"` | Status color of `hint` («Осталось 12 дней» in `warning`). The words carry the status, the color repeats it; an `error` replaces the hint and its tone. A validation error is `error`, never a `danger` hint. |
50
51
  | `error` | `ReactNode` | — | Error message in the hint slot; implies `invalid`. |
51
52
  | `invalid` | `boolean` | `false` | Danger inset ring, `aria-invalid` and `data-invalid` on the `group`; the control shakes once when an error arrives. |
52
53
  | `reserveSupportRow` | `boolean` | `false` | Always render the support row, so an appearing error does not shift the layout. |
@@ -47,6 +47,7 @@ Card.Root asChild <a> or <button> (the only child) holding the pa
47
47
  |---|---|---|---|
48
48
  | `variant` | `"panel" \| "mini" \| "stat-trend" \| "split" \| "cta" \| "list" \| "cover"` | `"panel"` | Structural template: titled block with zones (`panel`), KPI tiles, a call to action, a list or a cover tile. |
49
49
  | `flat` | `boolean` | `false` | No raised shadow: a flat tile for dense grids. |
50
+ | `loading` | `boolean` | `false` | The KPI is loading: `Card.Value`, `Card.Delta` and `Card.Meta` show a Skeleton in their own geometry and the root sets `aria-busy`; the data fades in when it arrives. Labels and titles stay. |
50
51
  | `asChild` | `boolean` | `false` | The whole card is one link or button: pass that element as the only child with the parts inside it; it gets hover, press and the focus ring. Nothing interactive may sit inside it. |
51
52
  | `…rest` | `HTMLAttributes<HTMLDivElement>` | — | `className`, `role` + `aria-labelledby` for a landmark block, and the other div attributes. |
52
53
 
@@ -154,6 +155,7 @@ Card.Root asChild <a> or <button> (the only child) holding the pa
154
155
  | Value | Looks like | Use when | Default |
155
156
  |---|---|---|---|
156
157
  | `flat` | same fill, no shadow | dense grids of tiles | `false` |
158
+ | `loading` | `Card.Value`, `Card.Delta` and `Card.Meta` hold a Skeleton in their own geometry (the value a bar one line of its role high); the data fades in under the same element | a KPI waits for its report | `false` |
157
159
  | `asChild` | the card is the link or button it wraps: lifts on hover (raised → overlay shadow), presses, focus ring | the whole tile opens its details | `false` |
158
160
 
159
161
  ## States
@@ -161,6 +163,7 @@ Card.Root asChild <a> or <button> (the only child) holding the pa
161
163
  |---|---|---|
162
164
  | template | `variant` | `data-variant` |
163
165
  | flat | `flat` | `data-flat` |
166
+ | loading | `loading` | `aria-busy` on the root; `data-loading` on `Card.Value`, `Card.Delta`, `Card.Meta`, each holding a `Skeleton`; on `false` the data fades in (`useSwapIn`, foundation §1 rule 7) |
164
167
  | depth | nesting: one above the nearest surface (the page and the AppShell panel are 0) | `data-depth` (`1`–`4`, `floating-1`/`floating-2` inside a floating layer); the fill is `--prime-color-layer-current`, the shadow only at depth 1 |
165
168
  | card width | container queries | `split` stacks below 22rem, `Header` wraps below 22rem (a header control under its description), the `stat-trend` value changes at 20rem / 36rem |
166
169
  | hover | `asChild`, a fine pointer | the fill stays (a whole surface never changes its fill, foundation §8); the shadow lifts to `--prime-shadow-overlay` over `fast` |
@@ -195,6 +198,7 @@ Without `asChild` a card is static: no hover, focus or press of its own. With it
195
198
  - `Card.Root` is a plain `<div>`; give it `role="region"` + `aria-labelledby` only when it is a landmark-worthy block.
196
199
  - `Card.Title` renders `<h3>`; directly under the page title pass `as="h2"`.
197
200
  - Decorative icons in `Card.Icon` and cover images in `Card.Media` get `aria-hidden`; controls in `Card.Header` need their own names.
201
+ - A `loading` card sets `aria-busy` on its root; the Skeletons are decorative (`aria-hidden`).
198
202
 
199
203
  ### Labels
200
204
  <!-- Generated from api.ts by `bun run docs:build`. Edit api.ts, not this section. -->
@@ -211,6 +215,7 @@ No `labels`.
211
215
  | [interactive.tsx](examples/interactive.tsx) | Whole cards as links to their reports: one tab stop each, a lift on hover, a press and the focus ring — `asChild`. |
212
216
  | [content-templates.tsx](examples/content-templates.tsx) | Content templates: a call to action, an events list and a campaign tile with a cover — `Card.Footer`, `Card.List`, `Card.Media`. |
213
217
  | [flat.tsx](examples/flat.tsx) | A flat tile without the raised shadow next to the default one, for dense grids — `flat`. |
218
+ | [states.tsx](examples/states.tsx) | A KPI tile while its report loads next to the loaded one, in the `stat-trend` and `mini` templates — `loading`. |
214
219
  | [narrow.tsx](examples/narrow.tsx) | The card is a size container: the split template stacks its cells below 22rem and the trend value shrinks below 20rem — `variant`. |
215
220
  | [screen.tsx](examples/screen.tsx) | A dashboard: the title and a line of data in the page flow, the period switch and the report in the top bar that keeps the title once it scrolls away; one grid of KPI tiles that cross-fade to the new period, a revenue trend, invoiced against paid beside two panels, and the latest payments with a link to the list — `collapse`, `Page.Grid`. |
216
221
 
@@ -225,7 +230,8 @@ No `labels`.
225
230
  - A clickable `<div>` card with `onClick` → `asChild` with a real `<a href>` (Cmd-click, a new tab) or a `<button>`.
226
231
  - Buttons or links inside an `asChild` card → nested interactive elements; move them out of the card.
227
232
  - The reference figures written into `Card.Delta` or `Card.Label` → `Card.Meta`.
233
+ - Skeletons placed by hand inside `Card.Value` → `Card.Root loading`; keep the parts mounted while loading so each holds its place.
228
234
 
229
235
  ## Related
230
- - **Built from:** —
236
+ - **Built from:** [Skeleton](../skeleton/COMPONENT.md)
231
237
  - **See also:** [Page](../../layout/page/COMPONENT.md), [DescriptionList](../description-list/COMPONENT.md) (record details inside a `Card.Body`), [Fieldset](../fieldset/COMPONENT.md) (groups of fields inside a settings card), [DataTable](../data-table/COMPONENT.md), [Badge](../badge/COMPONENT.md), [ProgressBar](../progress-bar/COMPONENT.md), [SegmentedControl](../segmented-control/COMPONENT.md), [Sparkline](../sparkline/COMPONENT.md) (a trend with its total inside a `panel`), [ChartFrame](../chart-frame/COMPONENT.md) (a full chart with legend and states)
@@ -0,0 +1,59 @@
1
+ /** A KPI tile while its report loads next to the loaded one, in the `stat-trend` and `mini` templates — `loading`. */
2
+ import { Card, Icon, Typography } from "prime-ui-kit";
3
+
4
+ export default function CardStatesExample() {
5
+ return (
6
+ <>
7
+ <div>
8
+ <div>
9
+ <Card.Root variant="stat-trend" loading>
10
+ <Card.Label>Выручка за месяц</Card.Label>
11
+ <Card.Value />
12
+ <Card.Delta />
13
+ <Card.Meta />
14
+ </Card.Root>
15
+ <Typography as="span" variant="caption" tone="muted">
16
+ stat-trend · loading
17
+ </Typography>
18
+ </div>
19
+ <div>
20
+ <Card.Root variant="stat-trend">
21
+ <Card.Label>Выручка за месяц</Card.Label>
22
+ <Card.Value>4,2 млн ₽</Card.Value>
23
+ <Card.Delta tone="success">+18% к сентябрю</Card.Delta>
24
+ <Card.Meta>Лидов 1 240 · сделок 186</Card.Meta>
25
+ </Card.Root>
26
+ <Typography as="span" variant="caption" tone="muted">
27
+ stat-trend
28
+ </Typography>
29
+ </div>
30
+ </div>
31
+ <div>
32
+ <div>
33
+ <Card.Root variant="mini" loading>
34
+ <Card.Icon>
35
+ <Icon name="object.users" />
36
+ </Card.Icon>
37
+ <Card.Label>Активные сессии</Card.Label>
38
+ <Card.Value />
39
+ </Card.Root>
40
+ <Typography as="span" variant="caption" tone="muted">
41
+ mini · loading
42
+ </Typography>
43
+ </div>
44
+ <div>
45
+ <Card.Root variant="mini">
46
+ <Card.Icon>
47
+ <Icon name="object.users" />
48
+ </Card.Icon>
49
+ <Card.Label>Активные сессии</Card.Label>
50
+ <Card.Value>1 248</Card.Value>
51
+ </Card.Root>
52
+ <Typography as="span" variant="caption" tone="muted">
53
+ mini
54
+ </Typography>
55
+ </div>
56
+ </div>
57
+ </>
58
+ );
59
+ }
@@ -81,6 +81,7 @@ Chat.Root <div> column, fills its host; owns selection,
81
81
  - `renderMessage` may be an inline function: an item renders again only when it or its place changes, so whatever a row shows lives in its item (an edit, a reaction, a pin). Another message (a reply's original) comes from `entry.find(key)`.
82
82
  - `onRead` reports an incoming message once at least half of it, or half the view, has been on screen while the page is visible (`IntersectionObserver`); batched per frame, each `value` once per mount.
83
83
  - One sound at a time on the page: a `VoicePlayer`, a `VideoNote` and a video in `Message.Media` pause each other; nothing to wire.
84
+ - Times in a profile's zone: `timeZone` (an IANA name) on `Chat.Messages` moves the date separators, the runs and every message's time to it; without it they follow the browser.
84
85
 
85
86
  ## API
86
87
 
@@ -174,7 +175,8 @@ Chat.Root <div> column, fills its host; owns selection,
174
175
  | `unread` | `string` | — | The key of the first unread item: the «Непрочитанные сообщения» band stands above it. |
175
176
  | `groupWindow` | `number` | `5` | Messages of one author further apart than this many minutes start a new run. |
176
177
  | `now` | `Date` | today | «Today» for the dates. |
177
- | `formatDate` | `(date: Date, now: Date) => string` | `formatMessageDate` | The label of a date. |
178
+ | `timeZone` | `string` | the browser's zone | The IANA zone of the date separators, the runs and every message time (`"Asia/Vladivostok"`): a profile's zone, not the browser's. |
179
+ | `formatDate` | `(date: Date, now: Date, timeZone?: string) => string` | `formatMessageDate` | The label of a date; gets the `timeZone`. |
178
180
  | `loading` | `boolean` | `false` | The first load: bubble-shaped `Skeleton`s on both sides stand in the list's place (`aria-busy`, `labels.loading` announced), then cross-fade into the messages; none of them counts as new. |
179
181
  | `hasOlder` | `boolean` | `false` | Older history exists: a bubble-shaped placeholder stands above the first message and `onLoadOlder` runs when the reader reaches the top. |
180
182
  | `onLoadOlder` | `() => void \| Promise<void>` | — | Load older messages and prepend them (while `hasOlder`); the reader's place is kept. |
@@ -334,6 +336,7 @@ Chat.Root <div> column, fills its host; owns selection,
334
336
  | [reactions.tsx](examples/reactions.tsx) | A team's own reactions for approvals: a double tap or `L` puts the approval mark, a long press or `R` opens the team's set, and a chip toggles them back — `quickReaction`, `reactionOptions`, `onReactionToggle`. |
335
337
  | [live.tsx](examples/live.tsx) | A live support chat: the client types — the header and the end of the list say so — then answers; new messages enter at the end, read receipts come from what is on screen, and scrolled up the round button counts what arrived — `typing`, `onNewMessage`, `onRead`. |
336
338
  | [search.tsx](examples/search.tsx) | Search and pinned messages: the search bar marks every match in the texts and transcripts, counts them and steps between them while the others step back; a pinned message's press jumps to it and blinks it — `Chat.SearchButton`, `Chat.Search`, `defaultSearch`, `Chat.Pinned`. |
339
+ | [time-zone.tsx](examples/time-zone.tsx) | The conversation in the zone of the manager's profile, not the browser's: the date separators, the runs and every time follow it — `timeZone`, `items`, `renderMessage`. |
337
340
  | [states.tsx](examples/states.tsx) | The first load of a conversation: bubble-shaped placeholders on both sides stand in the list's place, then cross-fade into the messages — `loading`. |
338
341
  | [controlled.tsx](examples/controlled.tsx) | Selection mode owned by the screen: the Select item of a message's menu starts it, a check stands beside every message, a press toggles one while the others step back, the bar counts and acts, Escape leaves — `selected`, `onSelectedChange`, `Chat.SelectionBar`. |
339
342
  | [narrow.tsx](examples/narrow.tsx) | At phone width the header keeps its actions and lets the title ellipsize, bubbles take up to 85% of the chat, long links wrap and an album keeps its layout — `Chat.Root`, `Chat.Header`, `Chat.Messages`, `Chat.Footer`. |