prime-ui-kit 0.20.1 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{chunk-4KONMO7Z.js → chunk-6L7VWEY6.js} +1 -1
  3. package/dist/chunks/{chunk-3PY52JP3.js → chunk-S27VR4ON.js} +5828 -5596
  4. package/dist/chunks/{chunk-4374EBWV.js → chunk-S4H2ZKWJ.js} +1049 -644
  5. package/dist/color-picker.js +2 -2
  6. package/dist/components/badge/Badge.d.ts +19 -2
  7. package/dist/components/card/Card.d.ts +10 -3
  8. package/dist/components/composer/Composer.d.ts +49 -1
  9. package/dist/components/crossfade/Crossfade.d.ts +6 -4
  10. package/dist/components/data-table/DataTable.d.ts +10 -2
  11. package/dist/components/data-table/Row.d.ts +12 -1
  12. package/dist/components/data-table/SelectionMenu.d.ts +20 -0
  13. package/dist/components/data-table/useRowSelection.d.ts +2 -0
  14. package/dist/components/empty-page/EmptyPage.d.ts +5 -2
  15. package/dist/components/hint/Hint.d.ts +1 -1
  16. package/dist/components/index.d.ts +1 -1
  17. package/dist/components/input/Input.d.ts +15 -3
  18. package/dist/components/message/Message.d.ts +6 -3
  19. package/dist/components/segmented-control/SegmentedControl.d.ts +5 -1
  20. package/dist/components/smart-filter/SmartFilter.d.ts +4 -0
  21. package/dist/components/spinner/Spinner.d.ts +3 -2
  22. package/dist/components/tabs/Tabs.d.ts +10 -1
  23. package/dist/hooks/useModalLayer.d.ts +15 -8
  24. package/dist/index.css +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/internal/RegionSwap.d.ts +18 -10
  27. package/dist/internal/RollingNumber.d.ts +7 -5
  28. package/dist/internal/ToolRow.d.ts +6 -0
  29. package/dist/internal/mediaSlot.d.ts +29 -0
  30. package/dist/internal/overlay/DialogParts.d.ts +30 -6
  31. package/dist/internal/overlay/focus.d.ts +18 -3
  32. package/dist/internal/partPresence.d.ts +19 -2
  33. package/dist/layout/page/Page.d.ts +1 -1
  34. package/dist/layout/sidebar/Sidebar.d.ts +3 -2
  35. package/dist/skill/anti-slop.md +35 -37
  36. package/dist/skill/api-contract.md +50 -2
  37. package/dist/skill/cheatsheet.md +15 -10
  38. package/dist/skill/checklist.md +20 -6
  39. package/dist/skill/choosing.md +82 -8
  40. package/dist/skill/components.md +1 -1
  41. package/dist/skill/composition.md +268 -51
  42. package/dist/skill/foundations.md +17 -6
  43. package/dist/skill/layouts.md +65 -14
  44. package/dist/skill/motion.md +9 -3
  45. package/dist/skill/reference/components/avatar/COMPONENT.md +1 -0
  46. package/dist/skill/reference/components/badge/COMPONENT.md +29 -5
  47. package/dist/skill/reference/components/badge/examples/examples.module.css +14 -0
  48. package/dist/skill/reference/components/badge/examples/overflow-count.tsx +32 -0
  49. package/dist/skill/reference/components/banner/COMPONENT.md +1 -1
  50. package/dist/skill/reference/components/card/COMPONENT.md +8 -4
  51. package/dist/skill/reference/components/card/examples/person-header.tsx +38 -0
  52. package/dist/skill/reference/components/composer/COMPONENT.md +35 -5
  53. package/dist/skill/reference/components/composer/examples/bot-keyboard.tsx +43 -0
  54. package/dist/skill/reference/components/confirm-dialog/COMPONENT.md +1 -1
  55. package/dist/skill/reference/components/crossfade/COMPONENT.md +18 -10
  56. package/dist/skill/reference/components/data-table/COMPONENT.md +17 -11
  57. package/dist/skill/reference/components/data-table/examples/screen.tsx +6 -9
  58. package/dist/skill/reference/components/data-table/examples/selection.tsx +60 -18
  59. package/dist/skill/reference/components/drawer/COMPONENT.md +41 -19
  60. package/dist/skill/reference/components/drawer/examples/footer-actions.tsx +54 -0
  61. package/dist/skill/reference/components/drawer/examples/header-actions.tsx +46 -25
  62. package/dist/skill/reference/components/drawer/examples/link-loading.tsx +57 -0
  63. package/dist/skill/reference/components/drawer/examples/screen.tsx +3 -5
  64. package/dist/skill/reference/components/empty-page/COMPONENT.md +2 -2
  65. package/dist/skill/reference/components/field-list/COMPONENT.md +4 -4
  66. package/dist/skill/reference/components/field-list/examples/row-menu.tsx +1 -1
  67. package/dist/skill/reference/components/hint/COMPONENT.md +1 -1
  68. package/dist/skill/reference/components/input/COMPONENT.md +16 -3
  69. package/dist/skill/reference/components/input/examples/password-policy.tsx +65 -0
  70. package/dist/skill/reference/components/list/COMPONENT.md +1 -1
  71. package/dist/skill/reference/components/login-form/COMPONENT.md +13 -11
  72. package/dist/skill/reference/components/login-form/examples/overview.tsx +5 -5
  73. package/dist/skill/reference/components/login-form/examples/states.tsx +7 -6
  74. package/dist/skill/reference/components/message/COMPONENT.md +5 -5
  75. package/dist/skill/reference/components/message/examples/bot-actions.tsx +47 -28
  76. package/dist/skill/reference/components/modal/COMPONENT.md +31 -12
  77. package/dist/skill/reference/components/modal/examples/structure.tsx +2 -4
  78. package/dist/skill/reference/components/segmented-control/COMPONENT.md +11 -6
  79. package/dist/skill/reference/components/segmented-control/examples/router.tsx +22 -0
  80. package/dist/skill/reference/components/select/COMPONENT.md +4 -1
  81. package/dist/skill/reference/components/sheet/COMPONENT.md +31 -12
  82. package/dist/skill/reference/components/sheet/examples/header-actions.tsx +5 -3
  83. package/dist/skill/reference/components/skeleton/COMPONENT.md +3 -2
  84. package/dist/skill/reference/components/smart-filter/COMPONENT.md +2 -1
  85. package/dist/skill/reference/components/smart-filter/examples/ranges.tsx +8 -2
  86. package/dist/skill/reference/components/spinner/COMPONENT.md +1 -1
  87. package/dist/skill/reference/components/tabs/COMPONENT.md +7 -4
  88. package/dist/skill/reference/components/tabs/examples/in-drawer.tsx +18 -2
  89. package/dist/skill/reference/components/thumbnail/COMPONENT.md +1 -0
  90. package/dist/skill/reference/components/tooltip/COMPONENT.md +3 -3
  91. package/dist/skill/reference/foundation.md +15 -9
  92. package/dist/skill/reference/layout/page/COMPONENT.md +10 -6
  93. package/dist/skill/reference/layout/page/examples/router.tsx +124 -0
  94. package/dist/skill/reference/layout/page/examples/tools.tsx +12 -22
  95. package/dist/skill/reference/layout/sidebar/COMPONENT.md +8 -3
  96. package/dist/skill/reference/layout/sidebar/examples/account-profile.tsx +66 -0
  97. package/dist/skill/responsive.md +28 -6
  98. package/dist/skill/ux.md +97 -2
  99. package/dist/tokens/semantic.d.ts +2 -1
  100. package/dist/tokens/themes/dark.d.ts +1 -0
  101. package/package.json +1 -1
  102. package/src/components/avatar/COMPONENT.md +1 -0
  103. package/src/components/badge/COMPONENT.md +29 -5
  104. package/src/components/badge/examples/examples.module.css +14 -0
  105. package/src/components/badge/examples/overflow-count.tsx +32 -0
  106. package/src/components/banner/COMPONENT.md +1 -1
  107. package/src/components/card/COMPONENT.md +8 -4
  108. package/src/components/card/examples/person-header.tsx +38 -0
  109. package/src/components/composer/COMPONENT.md +35 -5
  110. package/src/components/composer/examples/bot-keyboard.tsx +43 -0
  111. package/src/components/confirm-dialog/COMPONENT.md +1 -1
  112. package/src/components/crossfade/COMPONENT.md +18 -10
  113. package/src/components/data-table/COMPONENT.md +17 -11
  114. package/src/components/data-table/examples/screen.tsx +6 -9
  115. package/src/components/data-table/examples/selection.tsx +60 -18
  116. package/src/components/drawer/COMPONENT.md +41 -19
  117. package/src/components/drawer/examples/footer-actions.tsx +54 -0
  118. package/src/components/drawer/examples/header-actions.tsx +46 -25
  119. package/src/components/drawer/examples/link-loading.tsx +57 -0
  120. package/src/components/drawer/examples/screen.tsx +3 -5
  121. package/src/components/empty-page/COMPONENT.md +2 -2
  122. package/src/components/field-list/COMPONENT.md +4 -4
  123. package/src/components/field-list/examples/row-menu.tsx +1 -1
  124. package/src/components/hint/COMPONENT.md +1 -1
  125. package/src/components/input/COMPONENT.md +16 -3
  126. package/src/components/input/examples/password-policy.tsx +65 -0
  127. package/src/components/list/COMPONENT.md +1 -1
  128. package/src/components/login-form/COMPONENT.md +13 -11
  129. package/src/components/login-form/examples/overview.tsx +5 -5
  130. package/src/components/login-form/examples/states.tsx +7 -6
  131. package/src/components/message/COMPONENT.md +5 -5
  132. package/src/components/message/examples/bot-actions.tsx +47 -28
  133. package/src/components/modal/COMPONENT.md +31 -12
  134. package/src/components/modal/examples/structure.tsx +2 -4
  135. package/src/components/segmented-control/COMPONENT.md +11 -6
  136. package/src/components/segmented-control/examples/router.tsx +22 -0
  137. package/src/components/select/COMPONENT.md +4 -1
  138. package/src/components/sheet/COMPONENT.md +31 -12
  139. package/src/components/sheet/examples/header-actions.tsx +5 -3
  140. package/src/components/skeleton/COMPONENT.md +3 -2
  141. package/src/components/smart-filter/COMPONENT.md +2 -1
  142. package/src/components/smart-filter/examples/ranges.tsx +8 -2
  143. package/src/components/spinner/COMPONENT.md +1 -1
  144. package/src/components/tabs/COMPONENT.md +7 -4
  145. package/src/components/tabs/examples/in-drawer.tsx +18 -2
  146. package/src/components/thumbnail/COMPONENT.md +1 -0
  147. package/src/components/tooltip/COMPONENT.md +3 -3
  148. package/src/layout/page/COMPONENT.md +10 -6
  149. package/src/layout/page/examples/router.tsx +124 -0
  150. package/src/layout/page/examples/tools.tsx +12 -22
  151. package/src/layout/sidebar/COMPONENT.md +8 -3
  152. package/src/layout/sidebar/examples/account-profile.tsx +66 -0
  153. package/src/styles/theme-dark.css +1 -0
  154. package/src/styles/theme-light.css +1 -0
@@ -1,10 +1,9 @@
1
- /** The orders page's tools in its top bar: sections with counts, search and filter, the period, in the order written; the active filters on a line under everything — `Page.Tools`, `Page.Chips`. */
1
+ /** The orders page's tools in its top bar: sections with counts, the search and filter that narrow both views, the view, in the order written; the active filters on a line under everything — `Page.Tools`, `Page.Chips`. */
2
2
  import {
3
3
  Button,
4
4
  Icon,
5
5
  Page,
6
6
  SegmentedControl,
7
- Select,
8
7
  SmartFilter,
9
8
  type SmartFilterField,
10
9
  type SmartFilterValue,
@@ -18,10 +17,9 @@ const SECTIONS = [
18
17
  { value: "cancelled", label: "Отменены", count: 20 },
19
18
  ];
20
19
 
21
- const PERIODS = [
22
- { value: "7d", label: "7 дней" },
23
- { value: "30d", label: "30 дней" },
24
- { value: "quarter", label: "Квартал" },
20
+ const VIEWS = [
21
+ { value: "list", label: "Список" },
22
+ { value: "board", label: "Доска" },
25
23
  ];
26
24
 
27
25
  const FIELDS: SmartFilterField[] = [
@@ -46,7 +44,7 @@ const FIELDS: SmartFilterField[] = [
46
44
 
47
45
  export default function PageToolsExample() {
48
46
  const [section, setSection] = React.useState("all");
49
- const [period, setPeriod] = React.useState("30d");
47
+ const [view, setView] = React.useState("list");
50
48
  const [filter, setFilter] = React.useState<SmartFilterValue>({
51
49
  city: { include: ["msk"], exclude: [] },
52
50
  });
@@ -75,21 +73,13 @@ export default function PageToolsExample() {
75
73
  ))}
76
74
  </SegmentedControl.Root>
77
75
  <SmartFilter.Toolbar />
78
- <Select.Root value={period} onValueChange={setPeriod}>
79
- <Select.Trigger aria-label="Период">
80
- <Select.TriggerIcon>
81
- <Icon name="field.calendar" />
82
- </Select.TriggerIcon>
83
- <Select.Value />
84
- </Select.Trigger>
85
- <Select.Content>
86
- {PERIODS.map((item) => (
87
- <Select.Item key={item.value} value={item.value}>
88
- {item.label}
89
- </Select.Item>
90
- ))}
91
- </Select.Content>
92
- </Select.Root>
76
+ <SegmentedControl.Root value={view} onValueChange={setView} aria-label="Вид">
77
+ {VIEWS.map((item) => (
78
+ <SegmentedControl.Item key={item.value} value={item.value}>
79
+ {item.label}
80
+ </SegmentedControl.Item>
81
+ ))}
82
+ </SegmentedControl.Root>
93
83
  </Page.Tools>
94
84
  <Page.Actions>
95
85
  <Button.Root>
@@ -26,7 +26,10 @@ same place. Structure it by what people do, not by how the backend is split.
26
26
  it stays folded; its `…` row marks the page).
27
27
  - **One level of nesting.** `Sidebar.Sub` is one section with 2–6 views of the same objects
28
28
  (Сделки → Новые · В работе · Закрытые). The parent only discloses; an overview page is the first
29
- child («Все сделки»). Never a sub-list inside a sub-list — split the section or use page tabs.
29
+ child («Все сделки»). Never a sub-list inside a sub-list — split the section. Facets of one section
30
+ («Мессенджеры» → «Каналы» · «Статистика») are no sub-list: they are route links in the page's
31
+ `Page.Tools`, and the section's item stays `current` on every sub-route (a `NavLink` without `end`,
32
+ or `current={pathname.startsWith("/messengers")}`).
30
33
  - **Icons.** Every top-level item and every sub-list parent has a distinct icon (on the rail the
31
34
  icon is all that is left); children of a sub-list have none.
32
35
  - **Numbers and dots.** A plain `Sidebar.ItemCount` is information (12 new deals): it leaves the
@@ -70,7 +73,7 @@ Sidebar.Root rail wrapper; renders <nav> inside; size tier
70
73
  │ ├─ Sidebar.SubTrigger disclosure row, chevron at the end
71
74
  │ └─ Sidebar.SubContent child Items on a guide line (a flyout on the compact rail)
72
75
  └─ Sidebar.Footer bottom items, the item Toggle, the account
73
- └─ Sidebar.Account avatar + name + muted line; a Dropdown.Trigger child
76
+ └─ Sidebar.Account avatar + name + muted line; a ↕ chevron as a Dropdown.Trigger child
74
77
  useSidebar() state hook for custom parts inside Root (useAppShellNav outside it, in a shell)
75
78
  ```
76
79
 
@@ -220,7 +223,7 @@ useSidebar() state hook for custom parts inside Root (useA
220
223
  | `…rest` | `Omit<HTMLAttributes<HTMLDivElement>, "role">` | — | `children` (Items), `className` (on the list) and the other div attributes. |
221
224
 
222
225
  ### Sidebar.Account
223
- `ref` → `HTMLButtonElement`. The signed-in person at the bottom of `Sidebar.Footer`: avatar, name, a muted line and a ↕ chevron. A button, so it is a `Dropdown.Trigger` child; in compact mode only the avatar stays, with the name as a tooltip.
226
+ `ref` → `HTMLButtonElement`. The signed-in person at the bottom of `Sidebar.Footer`: avatar, name, a muted line; a ↕ chevron only as a `Dropdown.Trigger` child. In compact mode only the avatar stays, with the name as a tooltip.
224
227
 
225
228
  | Prop | Type | Default | Description |
226
229
  |---|---|---|---|
@@ -311,6 +314,7 @@ Put `<Sidebar.Toggle variant="header" />` next to `Sidebar.Brand` in the header,
311
314
  | flyout | hover / click / keyboard on a SubTrigger, or on the `…` row of a folded group, in compact mode | the row `aria-haspopup="dialog"`, `aria-expanded`; a Popover `role="dialog"` |
312
315
  | attention dot | a coloured `Sidebar.ItemCount` inside a folded Sub (always on the rail) or a folded Group | `Badge.Dot` with `data-attention="shown" \| "hidden"` on the parent row / heading / `…` row |
313
316
  | persisted | `persistKey` on Root | the mode and the open state of collapsible groups and sub-lists are read from and written to `localStorage` |
317
+ | account menu | `Sidebar.Account` inside a `Dropdown.Trigger` (`aria-haspopup="menu"`) | the ↕ chevron at the end of the row; without a menu (a plain `onClick`, a `Drawer.Trigger`) no chevron |
314
318
  | disabled | `disabled` | Item `disabled` / `aria-disabled`, `data-disabled` |
315
319
 
316
320
  `persistKey` stores collapsible groups and sub-lists by their `id`, else by their label text — give an `id` when labels are translated or change. The stored state wins over `defaultMode` / `defaultOpen`; controlled `mode` / `open` are not stored, and unavailable storage is ignored. A hidden rail is stored as the mode it left, so a reload never strands a person on a hidden rail.
@@ -388,6 +392,7 @@ Leaving the narrow viewport closes the off-canvas panel; activating an item (a l
388
392
  | [collapsible-groups.tsx](examples/collapsible-groups.tsx) | Group headings that fold their items away, one group open at a time, with a chevron at the end of the heading; on the compact rail a folded group becomes one row whose items open in a flyout — `collapsible`, `open`, `onOpenChange`. |
389
393
  | [nested-items.tsx](examples/nested-items.tsx) | A parent item with child items on a guide line: a current child opens it and marks the parent; on the compact rail the children open in a flyout — `Sidebar.Sub`, `Sidebar.SubTrigger`, `Sidebar.SubContent`. |
390
394
  | [account.tsx](examples/account.tsx) | Footer items and the collapse row above the signed-in person: avatar, name and email open the account menu; collapse the rail from that row and only the avatar stays, on the icon axis — `Sidebar.Footer`, `Sidebar.Account`, `description`, `Sidebar.Toggle`. |
395
+ | [account-profile.tsx](examples/account-profile.tsx) | The signed-in person opens a profile panel, not a menu, so the row draws no chevron — `Sidebar.Account`, `description`. |
391
396
  | [router.tsx](examples/router.tsx) | Router links as the brand and the items: the router marks the current link and the item shows it as current; render it inside a router — `asChild`. |
392
397
  | [persist.tsx](examples/persist.tsx) | The first visit opens on the icon rail; the mode and the folded groups are remembered and come back after a reload — `persistKey`, `defaultMode`. |
393
398
  | [custom-part.tsx](examples/custom-part.tsx) | A part of your own in the footer reads the rail state: the storage meter shows on the full rail and in the off-canvas panel and steps aside on the icon rail — `useSidebar`. |
@@ -0,0 +1,66 @@
1
+ /** The signed-in person opens a profile panel, not a menu, so the row draws no chevron — `Sidebar.Account`, `description`. */
2
+ import { Avatar, Button, DescriptionList, Drawer, Icon, Sidebar } from "prime-ui-kit";
3
+
4
+ import styles from "./examples.module.css";
5
+
6
+ const PROFILE = [
7
+ { term: "Почта", value: "anna@company.ru" },
8
+ { term: "Роль", value: "Руководитель отдела продаж" },
9
+ { term: "Часовой пояс", value: "Москва, UTC+3" },
10
+ ];
11
+
12
+ export default function SidebarAccountProfileExample() {
13
+ return (
14
+ <div className={styles.stage}>
15
+ <Sidebar.Root offCanvas="never">
16
+ <Sidebar.Content>
17
+ <Sidebar.Item current>
18
+ <Sidebar.ItemIcon>
19
+ <Icon name="nav.home" />
20
+ </Sidebar.ItemIcon>
21
+ Обзор
22
+ </Sidebar.Item>
23
+ <Sidebar.Item>
24
+ <Sidebar.ItemIcon>
25
+ <Icon name="object.document" />
26
+ </Sidebar.ItemIcon>
27
+ Сделки
28
+ </Sidebar.Item>
29
+ </Sidebar.Content>
30
+ <Sidebar.Footer>
31
+ <Drawer.Root>
32
+ <Drawer.Trigger>
33
+ <Sidebar.Account description="anna@company.ru">
34
+ <Avatar.Root color="purple">
35
+ <Avatar.Fallback>АС</Avatar.Fallback>
36
+ </Avatar.Root>
37
+ Анна Смирнова
38
+ </Sidebar.Account>
39
+ </Drawer.Trigger>
40
+ <Drawer.Content size="s">
41
+ <Drawer.Header>
42
+ <Drawer.Title>Анна Смирнова</Drawer.Title>
43
+ <Drawer.Description>Профиль</Drawer.Description>
44
+ </Drawer.Header>
45
+ <Drawer.Body>
46
+ <DescriptionList.Root>
47
+ {PROFILE.map(({ term, value }) => (
48
+ <DescriptionList.Item key={term} label={term}>
49
+ {value}
50
+ </DescriptionList.Item>
51
+ ))}
52
+ </DescriptionList.Root>
53
+ </Drawer.Body>
54
+ <Drawer.Footer>
55
+ <Button.Root variant="outline" tone="neutral">
56
+ Выйти
57
+ </Button.Root>
58
+ </Drawer.Footer>
59
+ </Drawer.Content>
60
+ </Drawer.Root>
61
+ </Sidebar.Footer>
62
+ </Sidebar.Root>
63
+ <div className={styles.content} />
64
+ </div>
65
+ );
66
+ }
@@ -130,6 +130,7 @@
130
130
  --prime-color-palette-yellow-solid-fg: var(--prime-ref-color-gray-950);
131
131
  --prime-color-palette-yellow-text: var(--prime-ref-color-yellow-300);
132
132
  --prime-color-skeleton-fill: color-mix(in srgb, var(--prime-ref-color-gray-100) 10%, transparent);
133
+ --prime-color-success-border: var(--prime-ref-color-green-400);
133
134
  --prime-color-success-default: var(--prime-ref-color-green-400);
134
135
  --prime-color-success-fg: var(--prime-ref-color-gray-950);
135
136
  --prime-color-success-hover: var(--prime-ref-color-green-300);
@@ -205,6 +205,7 @@
205
205
  --prime-color-palette-yellow-solid-fg: var(--prime-ref-color-gray-925);
206
206
  --prime-color-palette-yellow-text: var(--prime-ref-color-yellow-800);
207
207
  --prime-color-skeleton-fill: color-mix(in srgb, var(--prime-ref-color-gray-925) 6%, transparent);
208
+ --prime-color-success-border: var(--prime-ref-color-green-500);
208
209
  --prime-color-success-default: var(--prime-ref-color-green-700);
209
210
  --prime-color-success-fg: var(--prime-ref-color-white);
210
211
  --prime-color-success-hover: var(--prime-ref-color-green-800);