prime-ui-kit 0.2.5 → 0.3.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 (244) hide show
  1. package/README.md +161 -35
  2. package/dist/components/accordion/Accordion.d.ts +70 -0
  3. package/dist/components/accordion/Accordion.d.ts.map +1 -0
  4. package/dist/components/avatar/Avatar.d.ts +58 -0
  5. package/dist/components/avatar/Avatar.d.ts.map +1 -0
  6. package/dist/components/badge/Badge.d.ts +51 -0
  7. package/dist/components/badge/Badge.d.ts.map +1 -0
  8. package/dist/components/banner/Banner.d.ts +78 -0
  9. package/dist/components/banner/Banner.d.ts.map +1 -0
  10. package/dist/components/breadcrumb/Breadcrumb.d.ts +47 -0
  11. package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -0
  12. package/dist/components/button/Button.d.ts +57 -0
  13. package/dist/components/button/Button.d.ts.map +1 -0
  14. package/dist/components/button-group/ButtonGroup.d.ts +34 -0
  15. package/dist/components/button-group/ButtonGroup.d.ts.map +1 -0
  16. package/dist/components/card/Card.d.ts +234 -0
  17. package/dist/components/card/Card.d.ts.map +1 -0
  18. package/dist/components/checkbox/Checkbox.d.ts +42 -0
  19. package/dist/components/checkbox/Checkbox.d.ts.map +1 -0
  20. package/dist/components/code-block/CodeBlock.d.ts +17 -0
  21. package/dist/components/code-block/CodeBlock.d.ts.map +1 -0
  22. package/dist/components/color-picker/ColorPicker.d.ts +76 -0
  23. package/dist/components/color-picker/ColorPicker.d.ts.map +1 -0
  24. package/dist/components/color-picker/ColorPickerRac.d.ts +76 -0
  25. package/dist/components/color-picker/ColorPickerRac.d.ts.map +1 -0
  26. package/dist/components/command-menu/CommandMenu.d.ts +74 -0
  27. package/dist/components/command-menu/CommandMenu.d.ts.map +1 -0
  28. package/dist/components/data-table/DataTable.d.ts +78 -0
  29. package/dist/components/data-table/DataTable.d.ts.map +1 -0
  30. package/dist/components/datepicker/Datepicker.d.ts +104 -0
  31. package/dist/components/datepicker/Datepicker.d.ts.map +1 -0
  32. package/dist/components/digit-input/DigitInput.d.ts +21 -0
  33. package/dist/components/digit-input/DigitInput.d.ts.map +1 -0
  34. package/dist/components/divider/Divider.d.ts +26 -0
  35. package/dist/components/divider/Divider.d.ts.map +1 -0
  36. package/dist/components/drawer/Drawer.d.ts +71 -0
  37. package/dist/components/drawer/Drawer.d.ts.map +1 -0
  38. package/dist/components/dropdown/Dropdown.d.ts +147 -0
  39. package/dist/components/dropdown/Dropdown.d.ts.map +1 -0
  40. package/dist/components/dropdown/dropdownGeometry.d.ts +10 -0
  41. package/dist/components/dropdown/dropdownGeometry.d.ts.map +1 -0
  42. package/dist/components/dropdown/menuKeyboard.d.ts +4 -0
  43. package/dist/components/dropdown/menuKeyboard.d.ts.map +1 -0
  44. package/dist/components/dropdown/useDropdownPosition.d.ts +18 -0
  45. package/dist/components/dropdown/useDropdownPosition.d.ts.map +1 -0
  46. package/dist/components/example-frame/ExampleFrame.d.ts +53 -0
  47. package/dist/components/example-frame/ExampleFrame.d.ts.map +1 -0
  48. package/dist/components/file-upload/FileUpload.d.ts +176 -0
  49. package/dist/components/file-upload/FileUpload.d.ts.map +1 -0
  50. package/dist/components/hint/Hint.d.ts +27 -0
  51. package/dist/components/hint/Hint.d.ts.map +1 -0
  52. package/dist/components/index.css +6101 -5759
  53. package/dist/components/index.css.map +4 -4
  54. package/dist/components/index.d.ts +95 -2679
  55. package/dist/components/index.d.ts.map +1 -0
  56. package/dist/components/index.js +8510 -7659
  57. package/dist/components/index.js.map +4 -4
  58. package/dist/components/input/Input.d.ts +73 -0
  59. package/dist/components/input/Input.d.ts.map +1 -0
  60. package/dist/components/kbd/Kbd.d.ts +15 -0
  61. package/dist/components/kbd/Kbd.d.ts.map +1 -0
  62. package/dist/components/label/Label.d.ts +29 -0
  63. package/dist/components/label/Label.d.ts.map +1 -0
  64. package/dist/components/link-button/LinkButton.d.ts +18 -0
  65. package/dist/components/link-button/LinkButton.d.ts.map +1 -0
  66. package/dist/components/modal/Modal.d.ts +58 -0
  67. package/dist/components/modal/Modal.d.ts.map +1 -0
  68. package/dist/components/notification/Notification.d.ts +42 -0
  69. package/dist/components/notification/Notification.d.ts.map +1 -0
  70. package/dist/components/notification/NotificationStore.d.ts +18 -0
  71. package/dist/components/notification/NotificationStore.d.ts.map +1 -0
  72. package/dist/components/page-content/PageContent.d.ts +51 -0
  73. package/dist/components/page-content/PageContent.d.ts.map +1 -0
  74. package/dist/components/pagination/Pagination.d.ts +19 -0
  75. package/dist/components/pagination/Pagination.d.ts.map +1 -0
  76. package/dist/components/popover/Popover.d.ts +48 -0
  77. package/dist/components/popover/Popover.d.ts.map +1 -0
  78. package/dist/components/popover/popoverGeometry.d.ts +6 -0
  79. package/dist/components/popover/popoverGeometry.d.ts.map +1 -0
  80. package/dist/components/popover/usePopoverPosition.d.ts +18 -0
  81. package/dist/components/popover/usePopoverPosition.d.ts.map +1 -0
  82. package/dist/components/progress-bar/ProgressBar.d.ts +14 -0
  83. package/dist/components/progress-bar/ProgressBar.d.ts.map +1 -0
  84. package/dist/components/progress-circle/ProgressCircle.d.ts +33 -0
  85. package/dist/components/progress-circle/ProgressCircle.d.ts.map +1 -0
  86. package/dist/components/radio/Radio.d.ts +40 -0
  87. package/dist/components/radio/Radio.d.ts.map +1 -0
  88. package/dist/components/scroll-container/ScrollContainer.d.ts +42 -0
  89. package/dist/components/scroll-container/ScrollContainer.d.ts.map +1 -0
  90. package/dist/components/segmented-control/SegmentedControl.d.ts +40 -0
  91. package/dist/components/segmented-control/SegmentedControl.d.ts.map +1 -0
  92. package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts +22 -0
  93. package/dist/components/segmented-progress-bar/SegmentedProgressBar.d.ts.map +1 -0
  94. package/dist/components/select/Select.d.ts +84 -0
  95. package/dist/components/select/Select.d.ts.map +1 -0
  96. package/dist/components/select/selectListbox.d.ts +13 -0
  97. package/dist/components/select/selectListbox.d.ts.map +1 -0
  98. package/dist/components/slider/Slider.d.ts +23 -0
  99. package/dist/components/slider/Slider.d.ts.map +1 -0
  100. package/dist/components/stepper/HorizontalStepper.d.ts +41 -0
  101. package/dist/components/stepper/HorizontalStepper.d.ts.map +1 -0
  102. package/dist/components/stepper/Stepper.d.ts +77 -0
  103. package/dist/components/stepper/Stepper.d.ts.map +1 -0
  104. package/dist/components/stepper/VerticalStepper.d.ts +41 -0
  105. package/dist/components/stepper/VerticalStepper.d.ts.map +1 -0
  106. package/dist/components/stepper/stepperAlignContext.d.ts +11 -0
  107. package/dist/components/stepper/stepperAlignContext.d.ts.map +1 -0
  108. package/dist/components/switch/Switch.d.ts +48 -0
  109. package/dist/components/switch/Switch.d.ts.map +1 -0
  110. package/dist/components/tabs/Tabs.d.ts +69 -0
  111. package/dist/components/tabs/Tabs.d.ts.map +1 -0
  112. package/dist/components/tag/Tag.d.ts +29 -0
  113. package/dist/components/tag/Tag.d.ts.map +1 -0
  114. package/dist/components/textarea/Textarea.d.ts +43 -0
  115. package/dist/components/textarea/Textarea.d.ts.map +1 -0
  116. package/dist/components/tooltip/Tooltip.d.ts +47 -0
  117. package/dist/components/tooltip/Tooltip.d.ts.map +1 -0
  118. package/dist/components/typography/Typography.d.ts +30 -0
  119. package/dist/components/typography/Typography.d.ts.map +1 -0
  120. package/dist/hooks/useControllableState.d.ts +8 -0
  121. package/dist/hooks/useControllableState.d.ts.map +1 -0
  122. package/dist/hooks/useEscapeKey.d.ts +7 -0
  123. package/dist/hooks/useEscapeKey.d.ts.map +1 -0
  124. package/dist/hooks/useFieldIds.d.ts +17 -0
  125. package/dist/hooks/useFieldIds.d.ts.map +1 -0
  126. package/dist/hooks/useFocusTrap.d.ts +16 -0
  127. package/dist/hooks/useFocusTrap.d.ts.map +1 -0
  128. package/dist/hooks/useMergedRefs.d.ts +3 -0
  129. package/dist/hooks/useMergedRefs.d.ts.map +1 -0
  130. package/dist/hooks/useOutsideClick.d.ts +16 -0
  131. package/dist/hooks/useOutsideClick.d.ts.map +1 -0
  132. package/dist/hooks/useOverlayModal.d.ts +7 -0
  133. package/dist/hooks/useOverlayModal.d.ts.map +1 -0
  134. package/dist/hooks/usePosition.d.ts +41 -0
  135. package/dist/hooks/usePosition.d.ts.map +1 -0
  136. package/dist/hooks/useResponsiveMonths.d.ts +18 -0
  137. package/dist/hooks/useResponsiveMonths.d.ts.map +1 -0
  138. package/dist/hooks/useScrollLock.d.ts +8 -0
  139. package/dist/hooks/useScrollLock.d.ts.map +1 -0
  140. package/dist/icons/Icon.d.ts +13 -0
  141. package/dist/icons/Icon.d.ts.map +1 -0
  142. package/dist/icons/index.d.ts +40 -0
  143. package/dist/icons/index.d.ts.map +1 -0
  144. package/dist/index.css +6101 -5759
  145. package/dist/index.css.map +4 -4
  146. package/dist/index.d.ts +4 -8
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/index.js +8509 -7660
  149. package/dist/index.js.map +4 -4
  150. package/dist/internal/ControlSizeContext.d.ts +17 -0
  151. package/dist/internal/ControlSizeContext.d.ts.map +1 -0
  152. package/dist/internal/DividerContentContext.d.ts +4 -0
  153. package/dist/internal/DividerContentContext.d.ts.map +1 -0
  154. package/dist/internal/OverlayPortalLayerContext.d.ts +13 -0
  155. package/dist/internal/OverlayPortalLayerContext.d.ts.map +1 -0
  156. package/dist/internal/Portal.d.ts +8 -0
  157. package/dist/internal/Portal.d.ts.map +1 -0
  158. package/dist/internal/context.d.ts +11 -0
  159. package/dist/internal/context.d.ts.map +1 -0
  160. package/dist/internal/cx.d.ts +2 -0
  161. package/dist/internal/cx.d.ts.map +1 -0
  162. package/dist/internal/data-attributes.d.ts +6 -0
  163. package/dist/internal/data-attributes.d.ts.map +1 -0
  164. package/dist/internal/highlightTsxHtml.d.ts +3 -0
  165. package/dist/internal/highlightTsxHtml.d.ts.map +1 -0
  166. package/dist/internal/layoutPxFromPrimitives.d.ts +13 -0
  167. package/dist/internal/layoutPxFromPrimitives.d.ts.map +1 -0
  168. package/dist/internal/mergeRefs.d.ts +4 -0
  169. package/dist/internal/mergeRefs.d.ts.map +1 -0
  170. package/dist/internal/runtimeUnits.d.ts +3 -0
  171. package/dist/internal/runtimeUnits.d.ts.map +1 -0
  172. package/dist/internal/scrollAncestors.d.ts +3 -0
  173. package/dist/internal/scrollAncestors.d.ts.map +1 -0
  174. package/dist/internal/slot.d.ts +19 -0
  175. package/dist/internal/slot.d.ts.map +1 -0
  176. package/dist/internal/states.d.ts +87 -0
  177. package/dist/internal/states.d.ts.map +1 -0
  178. package/dist/layout/app-shell/AppShell.d.ts +54 -0
  179. package/dist/layout/app-shell/AppShell.d.ts.map +1 -0
  180. package/dist/layout/index.d.ts +7 -0
  181. package/dist/layout/index.d.ts.map +1 -0
  182. package/dist/layout/sidebar/Sidebar.d.ts +241 -0
  183. package/dist/layout/sidebar/Sidebar.d.ts.map +1 -0
  184. package/dist/layout/sidebar/SidebarRoot.d.ts +51 -0
  185. package/dist/layout/sidebar/SidebarRoot.d.ts.map +1 -0
  186. package/dist/layout/sidebar/sidebar-context.d.ts +19 -0
  187. package/dist/layout/sidebar/sidebar-context.d.ts.map +1 -0
  188. package/dist/layout/sidebar/sidebarLayout.d.ts +12 -0
  189. package/dist/layout/sidebar/sidebarLayout.d.ts.map +1 -0
  190. package/dist/tokens/primitives.d.ts +390 -0
  191. package/dist/tokens/primitives.d.ts.map +1 -0
  192. package/dist/tokens/semantic.d.ts +732 -0
  193. package/dist/tokens/semantic.d.ts.map +1 -0
  194. package/dist/tokens/themes/dark.d.ts +143 -0
  195. package/dist/tokens/themes/dark.d.ts.map +1 -0
  196. package/dist/tokens/themes/light.d.ts +16 -0
  197. package/dist/tokens/themes/light.d.ts.map +1 -0
  198. package/package.json +9 -4
  199. package/src/components/accordion/COMPONENT.md +137 -0
  200. package/src/components/avatar/COMPONENT.md +100 -0
  201. package/src/components/badge/COMPONENT.md +78 -0
  202. package/src/components/banner/COMPONENT.md +118 -0
  203. package/src/components/breadcrumb/COMPONENT.md +94 -0
  204. package/src/components/button/COMPONENT.md +80 -0
  205. package/src/components/button-group/COMPONENT.md +83 -0
  206. package/src/components/card/COMPONENT.md +489 -0
  207. package/src/components/checkbox/COMPONENT.md +98 -0
  208. package/src/components/code-block/COMPONENT.md +58 -0
  209. package/src/components/color-picker/COMPONENT.md +149 -0
  210. package/src/components/command-menu/COMPONENT.md +167 -0
  211. package/src/components/data-table/COMPONENT.md +113 -0
  212. package/src/components/datepicker/COMPONENT.md +137 -0
  213. package/src/components/digit-input/COMPONENT.md +68 -0
  214. package/src/components/divider/COMPONENT.md +70 -0
  215. package/src/components/drawer/COMPONENT.md +149 -0
  216. package/src/components/dropdown/COMPONENT.md +192 -0
  217. package/src/components/file-upload/COMPONENT.md +200 -0
  218. package/src/components/hint/COMPONENT.md +67 -0
  219. package/src/components/input/COMPONENT.md +119 -0
  220. package/src/components/kbd/COMPONENT.md +59 -0
  221. package/src/components/label/COMPONENT.md +94 -0
  222. package/src/components/link-button/COMPONENT.md +60 -0
  223. package/src/components/modal/COMPONENT.md +105 -0
  224. package/src/components/notification/COMPONENT.md +120 -0
  225. package/src/components/pagination/COMPONENT.md +61 -0
  226. package/src/components/popover/COMPONENT.md +93 -0
  227. package/src/components/progress-bar/COMPONENT.md +59 -0
  228. package/src/components/progress-circle/COMPONENT.md +63 -0
  229. package/src/components/radio/COMPONENT.md +95 -0
  230. package/src/components/segmented-control/COMPONENT.md +86 -0
  231. package/src/components/segmented-progress-bar/COMPONENT.md +75 -0
  232. package/src/components/select/COMPONENT.md +175 -0
  233. package/src/components/slider/COMPONENT.md +62 -0
  234. package/src/components/stepper/COMPONENT.md +186 -0
  235. package/src/components/switch/COMPONENT.md +98 -0
  236. package/src/components/tabs/COMPONENT.md +114 -0
  237. package/src/components/tag/COMPONENT.md +67 -0
  238. package/src/components/textarea/COMPONENT.md +98 -0
  239. package/src/components/tooltip/COMPONENT.md +87 -0
  240. package/src/components/typography/COMPONENT.md +89 -0
  241. package/src/styles/theme-dark.css +43 -0
  242. package/src/styles/theme-light.css +43 -0
  243. package/src/styles/tokens.css +23 -4
  244. package/src/styles/tokens.test.ts +0 -27
@@ -0,0 +1,489 @@
1
+ # Card
2
+
3
+ **Проектирование по умолчанию:** для демо и экранов используйте **`variant`** и слоты как в примерах ниже; **`flat`** включайте, когда карточка должна визуально совпадать с плоским слоем страницы (без тени).
4
+
5
+ ## About
6
+
7
+ Composable surfaces for **dashboard KPIs**, **lists**, **CTA tiles**, **split metrics**, **media headers**, and **chart shells**: layout presets driven by **`variant`** on **`Card.Root`**. Typography and spacing use semantic tokens (`--prime-sys-*`). The kit does not ship chart primitives — pass any chart, SVG sparkline, or [ProgressBar](../progress-bar/COMPONENT.md) into **`Card.Media`**, **`Card.Chart`** (**`panel`**, edge-to-edge), padded **`Card.Body`**, or **`Card.Cover`**.
8
+
9
+ **Ссылки на паттерны карточек и дашбордов (для ориентира по типам плиток):**
10
+
11
+ 1. [Material Design 3 — Cards (guidelines)](https://m3.material.io/components/cards/guidelines)
12
+ 2. [IBM Carbon — Tile (usage)](https://carbondesignsystem.com/components/tile/usage/)
13
+ 3. [Ant Design — Card](https://ant.design/components/card)
14
+ 4. [Shopify Polaris — Legacy Card](https://polaris.shopify.com/components/layout-and-structure/legacy-card)
15
+ 5. [shadcn/ui — Card](https://ui.shadcn.com/docs/components/card)
16
+ 6. [Atlassian Design — Composition](https://atlassian.design/get-started/develop/composition)
17
+ 7. [PatternFly — Card](https://www.patternfly.org/components/card/)
18
+ 8. [GOV.UK Design System — Card](https://design-system.service.gov.uk/components/card/)
19
+ 9. [Nielsen Norman Group — Dashboard Design](https://www.nngroup.com/articles/dashboard-design/)
20
+ 10. [GitHub Primer — Card](https://primer.style/product/components/card/)
21
+
22
+ **Кратко по смыслу:** MD3 и большинство дизайн-систем описывают карточку как контейнер с заголовком, опциональным медиа и действиями; Carbon использует **tile** для группировки на сетке; в дашбордах часто выделяют KPI, списки активности, CTA и сравнение метрик — см. NN/g про структуру дашборда. **Responsive dashboards (prime-ui-kit):** CSS Grid для рядов KPI (`repeat(auto-fill, minmax(...))`) — [prime-ui skill](https://github.com/esurkov1/prime-ui/blob/main/SKILL/SKILL.md).
23
+
24
+ - **Use** **`variant="mini"`** for a compact KPI: optional **`IconBox`** + **`Stack`** with **`Label`** and **`Value`**.
25
+ - **Use** **`variant="mini-media"`** for the same **`IconBox`** + **`Stack`** row as **`mini`**, then **`Media`** for a sparkline, ring, or thin progress strip (full width below).
26
+ - **Use** **`variant="metric"`** for a title row: **`HeaderRow`** with **`Lead`** (badge or icon) and **`Value`**, plus **`Description`** underneath.
27
+ - **Use** **`variant="panel"`** for a titled block: **`SectionHeader`** + **`Body`** (padded copy or tables) and/or **`Chart`** (full-width chart area, no inner padding).
28
+ - **Use** **`variant="stat-trend"`** for a large KPI with period delta: **`Label`**, **`Value`**, **`Delta`** (`trend`: `up` | `down` | `neutral`).
29
+ - **Use** **`variant="cta"`** for a call-to-action tile: **`Title`**, **`CtaBody`**, **`Actions`** (buttons / links).
30
+ - **Use** **`variant="list"`** for activity or alerts: **`ListHeader`** (e.g. **`Title`** + link), **`List`** / **`ListItem`**.
31
+ - **Use** **`variant="split"`** for two related metrics: **`Split`** with two **`SplitCell`** blocks (typically **`Label`** + **`Value`** each). Optionally **`IconBox`** + **`Stack`** (same pattern as **`mini`**) — **`IconBox`** surface + label/value column.
32
+ - **Use** **`variant="cover"`** for media on top: **`Cover`** (image or block), then **`Stack`** and optional **`Actions`**.
33
+ - **Do not use** as the only focus target for navigation; wrap a [LinkButton](../link-button/COMPONENT.md) or make an inner control focusable instead of the whole card, unless you add explicit `role`/`tabIndex` and keyboard handling.
34
+ - **Do not use** decorative icons without **`aria-hidden`** when the text repeats the meaning.
35
+
36
+ ## Composition
37
+
38
+ - **`Card.Root`** — required **`variant`**: `"mini"` \| `"mini-media"` \| `"metric"` \| `"panel"` \| `"stat-trend"` \| `"cta"` \| `"list"` \| `"split"` \| `"cover"`. Optional **`flat`** removes the default surface shadow (tile-like). Sets `data-variant` / `data-flat` for styling.
39
+ - **`Card.IconBox`** — square leading area in **`mini`** and **`mini-media`**: background **`status-information-background`**, radius **`size-control-m-radius`**, icon color via **`status-information-foreground`** (decorative icons: **`aria-hidden`**).
40
+ - **`Card.Lead`** — left cluster in **`HeaderRow`** (badge from [Badge](../badge/COMPONENT.md), raw icon, or both).
41
+ - **`Card.HeaderRow`** — top row for **`metric`**: typically **`Lead`** + **`Value`**.
42
+ - **`Card.Stack`** — vertical block for **`Label`** + **`Value`** in **`mini`** and **`mini-media`**.
43
+ - **`Card.Label`** — secondary line (muted).
44
+ - **`Card.Value`** — primary metric string.
45
+ - **`Card.Description`** — supporting line under the header row (`p`).
46
+ - **`Card.Media`** — bottom region with top border; place charts/progress here.
47
+ - **`Card.SectionHeader`** — bar with bottom border for **`panel`**.
48
+ - **`Card.SectionTitle`** — `h3` title.
49
+ - **`Card.SectionTrailing`** — optional actions or icon on the right.
50
+ - **`Card.Body`** — **`panel`**: padded region for text, summaries, or tables. With **`variant="panel"`**, the shell has a **minimum height**; a **single element child** can stretch inside the padded box. Override height via **`className`** on **`Root`** if needed.
51
+ - **`Card.Chart`** — **`panel`**: **no** horizontal or vertical inner padding; mount the chart library root here for **edge-to-edge** drawing under the header. Optional after **`Body`**; then **`Chart`** fills remaining height.
52
+ - **`Card.Title`** — **`h3`** with **`title`** styles; use in **`cta`**, **`list`** header, **`cover`** stack.
53
+ - **`Card.Delta`** — supporting line for **`stat-trend`**; optional **`trend`** sets `data-trend` for color (`up` \| `down` \| `neutral`).
54
+ - **`Card.CtaBody`** — body copy in **`cta`**.
55
+ - **`Card.Actions`** — row of actions (border-top); use in **`cta`** and **`cover`**.
56
+ - **`Card.Cover`** — top media region for **`cover`** (image or decorative block; keep meaningful images described elsewhere for a11y).
57
+ - **`Card.Split`** / **`Card.SplitCell`** — two-column grid for **`split`**.
58
+ - **`Card.ListHeader`** — top bar for **`list`** (border-bottom).
59
+ - **`Card.List`** / **`Card.ListItem`** — semantic **`ul`** / **`li`** for **`list`**.
60
+
61
+ ### Mini example
62
+
63
+ ```tsx
64
+ import { Card } from "prime-ui-kit";
65
+
66
+ export function MiniKpi() {
67
+ return (
68
+ <Card.Root variant="mini">
69
+ <Card.IconBox aria-hidden>…</Card.IconBox>
70
+ <Card.Stack>
71
+ <Card.Label>Age</Card.Label>
72
+ <Card.Value>36 years</Card.Value>
73
+ </Card.Stack>
74
+ </Card.Root>
75
+ );
76
+ }
77
+ ```
78
+
79
+ ### Mini + media example
80
+
81
+ ```tsx
82
+ import { Card } from "prime-ui-kit";
83
+
84
+ export function MiniKpiWithSparkline() {
85
+ return (
86
+ <Card.Root variant="mini-media">
87
+ <Card.IconBox aria-hidden>…</Card.IconBox>
88
+ <Card.Stack>
89
+ <Card.Label>Glucose</Card.Label>
90
+ <Card.Value>5.4 mmol/L</Card.Value>
91
+ </Card.Stack>
92
+ <Card.Media>
93
+ <svg aria-hidden viewBox="0 0 120 40" />
94
+ </Card.Media>
95
+ </Card.Root>
96
+ );
97
+ }
98
+ ```
99
+
100
+ ### Metric example
101
+
102
+ ```tsx
103
+ import { Badge } from "prime-ui-kit";
104
+ import { Card } from "prime-ui-kit";
105
+
106
+ export function MetricCard() {
107
+ return (
108
+ <Card.Root variant="metric">
109
+ <Card.HeaderRow>
110
+ <Card.Lead>
111
+ <Badge.Root color="blue" variant="filled" size="s">
112
+ CRP
113
+ </Badge.Root>
114
+ </Card.Lead>
115
+ <Card.Value>1.8 mg/L</Card.Value>
116
+ </Card.HeaderRow>
117
+ <Card.Description>Slightly elevated</Card.Description>
118
+ </Card.Root>
119
+ );
120
+ }
121
+ ```
122
+
123
+ ### Panel example (chart only)
124
+
125
+ ```tsx
126
+ import { Card } from "prime-ui-kit";
127
+
128
+ export function ChartSection() {
129
+ return (
130
+ <Card.Root variant="panel">
131
+ <Card.SectionHeader>
132
+ <Card.SectionTitle>Revenue</Card.SectionTitle>
133
+ </Card.SectionHeader>
134
+ <Card.Chart>
135
+ <div id="revenue-chart" />
136
+ </Card.Chart>
137
+ </Card.Root>
138
+ );
139
+ }
140
+ ```
141
+
142
+ ### Panel example (padded content + chart)
143
+
144
+ ```tsx
145
+ import { Card } from "prime-ui-kit";
146
+
147
+ export function ChartSectionWithIntro() {
148
+ return (
149
+ <Card.Root variant="panel">
150
+ <Card.SectionHeader>
151
+ <Card.SectionTitle>Revenue</Card.SectionTitle>
152
+ </Card.SectionHeader>
153
+ <Card.Body>
154
+ <p>Short summary or filters.</p>
155
+ </Card.Body>
156
+ <Card.Chart>
157
+ <div id="revenue-chart" />
158
+ </Card.Chart>
159
+ </Card.Root>
160
+ );
161
+ }
162
+ ```
163
+
164
+ ### Stat + trend example
165
+
166
+ ```tsx
167
+ import { Card } from "prime-ui-kit";
168
+
169
+ export function StatTrendCard() {
170
+ return (
171
+ <Card.Root variant="stat-trend">
172
+ <Card.Label>Revenue (30d)</Card.Label>
173
+ <Card.Value>$420k</Card.Value>
174
+ <Card.Delta trend="up">+18% vs prior month</Card.Delta>
175
+ </Card.Root>
176
+ );
177
+ }
178
+ ```
179
+
180
+ ### CTA example
181
+
182
+ ```tsx
183
+ import { Button, Card, LinkButton } from "prime-ui-kit";
184
+
185
+ export function CtaCard() {
186
+ return (
187
+ <Card.Root variant="cta">
188
+ <Card.Title>Export report</Card.Title>
189
+ <Card.CtaBody>Download a CSV for the selected period.</Card.CtaBody>
190
+ <Card.Actions>
191
+ <LinkButton.Root href="#">Download</LinkButton.Root>
192
+ <Button.Root mode="ghost" type="button" variant="neutral">
193
+ Cancel
194
+ </Button.Root>
195
+ </Card.Actions>
196
+ </Card.Root>
197
+ );
198
+ }
199
+ ```
200
+
201
+ ### List example
202
+
203
+ ```tsx
204
+ import { Card } from "prime-ui-kit";
205
+ import { LinkButton } from "prime-ui-kit";
206
+
207
+ export function ListCard() {
208
+ return (
209
+ <Card.Root variant="list">
210
+ <Card.ListHeader>
211
+ <Card.Title>Recent activity</Card.Title>
212
+ <LinkButton.Root href="#">View all</LinkButton.Root>
213
+ </Card.ListHeader>
214
+ <Card.List>
215
+ <Card.ListItem>Payment received</Card.ListItem>
216
+ <Card.ListItem>New comment on ticket #12</Card.ListItem>
217
+ </Card.List>
218
+ </Card.Root>
219
+ );
220
+ }
221
+ ```
222
+
223
+ ### Split example
224
+
225
+ ```tsx
226
+ import { Card } from "prime-ui-kit";
227
+
228
+ export function SplitCard() {
229
+ return (
230
+ <Card.Root variant="split">
231
+ <Card.Split>
232
+ <Card.SplitCell>
233
+ <Card.IconBox>{/* icon */}</Card.IconBox>
234
+ <Card.Stack>
235
+ <Card.Label>Conversion</Card.Label>
236
+ <Card.Value>3.8%</Card.Value>
237
+ </Card.Stack>
238
+ </Card.SplitCell>
239
+ <Card.SplitCell>
240
+ <Card.IconBox>{/* icon */}</Card.IconBox>
241
+ <Card.Stack>
242
+ <Card.Label>AOV</Card.Label>
243
+ <Card.Value>$64</Card.Value>
244
+ </Card.Stack>
245
+ </Card.SplitCell>
246
+ </Card.Split>
247
+ </Card.Root>
248
+ );
249
+ }
250
+ ```
251
+
252
+ ### Cover example
253
+
254
+ ```tsx
255
+ import { Card } from "prime-ui-kit";
256
+
257
+ export function CoverCard() {
258
+ return (
259
+ <Card.Root variant="cover">
260
+ <Card.Cover>
261
+ <img alt="" src="/hero.jpg" />
262
+ </Card.Cover>
263
+ <Card.Stack>
264
+ <Card.Title>Campaign</Card.Title>
265
+ <Card.Label>Last 7 days</Card.Label>
266
+ <Card.Description>Compared to control.</Card.Description>
267
+ </Card.Stack>
268
+ </Card.Root>
269
+ );
270
+ }
271
+ ```
272
+
273
+ ## Rules
274
+
275
+ - Typography follows the **control `m` tier** (`--prime-sys-size-control-m-text` for values and section titles, `--prime-sys-size-control-m-supportText` for labels and descriptions), aligned with [Label](../label/COMPONENT.md) / [Input](../input/COMPONENT.md) defaults — not reading `headingSection` / `headingSubsection` roles, so KPI copy stays visually consistent with form density.
276
+ - Prefer **`flat`** on dense dashboards if shadows feel noisy; default shadow uses **`--prime-sys-elevation-shadow-surface`**.
277
+ - **`SectionTitle`** is an **`h3`**; ensure heading levels match the page outline (skip levels appropriately).
278
+ - **`Description`** is a **`p`** — only one block per card unless you compose custom markup inside **`Body`** for **`panel`**.
279
+ - **`variant="panel"`** sets a **minimum height** on **`Root`**. Order after **`SectionHeader`**: optional **`Body`** (inset content), optional **`Chart`** (full bleed). If both are present, **`Body`** sizes to its content and **`Chart`** takes the **remaining height**. A **single element child** in **`Chart`** (or in **`Body`** when it is the only block) stretches within that region.
280
+ - For **`mini-media`**, keep **`Media`** height predictable so rows in a grid stay aligned, or use one column on narrow viewports.
281
+ - Icons in **`IconBox`** / **`Lead`** should not be the sole carrier of meaning; pair with visible text.
282
+ - **`Title`** is an **`h3`** (like **`SectionTitle`**); avoid duplicate heading levels on the same screen.
283
+ - Decorative content in **`Cover`** should not rely on **`img alt`** alone for critical information — repeat key facts in **`Stack`**.
284
+ - **`List`** uses a real **`ul`**; keep **`ListItem`** text meaningful for screen readers.
285
+
286
+ ## API
287
+
288
+ ### Card.Root
289
+
290
+ | Prop | Type | Default | Required | Description |
291
+ |------|------|---------|----------|-------------|
292
+ | variant | `"mini" \| "mini-media" \| "metric" \| "panel" \| "stat-trend" \| "cta" \| "list" \| "split" \| "cover"` | — | Yes | Layout preset and padding. |
293
+ | flat | `boolean` | `false` | No | When `true`, no drop shadow (surface still bordered). |
294
+ | className | `string` | — | No | Extra class on the root. |
295
+ | children | `React.ReactNode` | — | No | Slots listed in Composition. |
296
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Native attributes on the root `div`. |
297
+
298
+ ### Card.IconBox
299
+
300
+ | Prop | Type | Default | Required | Description |
301
+ |------|------|---------|----------|-------------|
302
+ | className | `string` | — | No | Extra class. |
303
+ | children | `React.ReactNode` | — | No | Icon node. |
304
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the wrapper `div`. |
305
+
306
+ ### Card.Lead
307
+
308
+ | Prop | Type | Default | Required | Description |
309
+ |------|------|---------|----------|-------------|
310
+ | className | `string` | — | No | Extra class. |
311
+ | children | `React.ReactNode` | — | No | Badge, icon, or group. |
312
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the wrapper `div`. |
313
+
314
+ ### Card.HeaderRow
315
+
316
+ | Prop | Type | Default | Required | Description |
317
+ |------|------|---------|----------|-------------|
318
+ | className | `string` | — | No | Extra class. |
319
+ | children | `React.ReactNode` | — | No | Typically `Lead` + `Value`. |
320
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the flex row. |
321
+
322
+ ### Card.Stack
323
+
324
+ | Prop | Type | Default | Required | Description |
325
+ |------|------|---------|----------|-------------|
326
+ | className | `string` | — | No | Extra class. |
327
+ | children | `React.ReactNode` | — | No | `Label` + `Value` for mini. |
328
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the stack `div`. |
329
+
330
+ ### Card.Label
331
+
332
+ | Prop | Type | Default | Required | Description |
333
+ |------|------|---------|----------|-------------|
334
+ | className | `string` | — | No | Extra class. |
335
+ | children | `React.ReactNode` | — | No | Secondary label text. |
336
+ | …rest | `React.HTMLAttributes<HTMLSpanElement>` | — | No | Attributes on the `span`. |
337
+
338
+ ### Card.Value
339
+
340
+ | Prop | Type | Default | Required | Description |
341
+ |------|------|---------|----------|-------------|
342
+ | className | `string` | — | No | Extra class. |
343
+ | children | `React.ReactNode` | — | No | Primary value. |
344
+ | …rest | `React.HTMLAttributes<HTMLSpanElement>` | — | No | Attributes on the `span`. |
345
+
346
+ ### Card.Description
347
+
348
+ | Prop | Type | Default | Required | Description |
349
+ |------|------|---------|----------|-------------|
350
+ | className | `string` | — | No | Extra class. |
351
+ | children | `React.ReactNode` | — | No | Supporting copy. |
352
+ | …rest | `React.HTMLAttributes<HTMLParagraphElement>` | — | No | Attributes on the `p`. |
353
+
354
+ ### Card.Media
355
+
356
+ | Prop | Type | Default | Required | Description |
357
+ |------|------|---------|----------|-------------|
358
+ | className | `string` | — | No | Extra class. |
359
+ | children | `React.ReactNode` | — | No | Chart, SVG, or progress. |
360
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the region `div`. |
361
+
362
+ ### Card.Title
363
+
364
+ | Prop | Type | Default | Required | Description |
365
+ |------|------|---------|----------|-------------|
366
+ | className | `string` | — | No | Extra class. |
367
+ | children | `React.ReactNode` | — | No | Heading text (`h3`). |
368
+ | …rest | `React.HTMLAttributes<HTMLHeadingElement>` | — | No | Attributes on the `h3`. |
369
+
370
+ ### Card.Delta
371
+
372
+ | Prop | Type | Default | Required | Description |
373
+ |------|------|---------|----------|-------------|
374
+ | trend | `"up" \| "down" \| "neutral"` | — | No | Sets `data-trend` for color. |
375
+ | className | `string` | — | No | Extra class. |
376
+ | children | `React.ReactNode` | — | No | Delta / period copy. |
377
+ | …rest | `React.HTMLAttributes<HTMLSpanElement>` | — | No | Attributes on the `span`. |
378
+
379
+ ### Card.CtaBody
380
+
381
+ | Prop | Type | Default | Required | Description |
382
+ |------|------|---------|----------|-------------|
383
+ | className | `string` | — | No | Extra class. |
384
+ | children | `React.ReactNode` | — | No | Supporting copy in **`cta`**. |
385
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the `div`. |
386
+
387
+ ### Card.Actions
388
+
389
+ | Prop | Type | Default | Required | Description |
390
+ |------|------|---------|----------|-------------|
391
+ | className | `string` | — | No | Extra class. |
392
+ | children | `React.ReactNode` | — | No | Buttons / links row. |
393
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the `div`. |
394
+
395
+ ### Card.Cover
396
+
397
+ | Prop | Type | Default | Required | Description |
398
+ |------|------|---------|----------|-------------|
399
+ | className | `string` | — | No | Extra class. |
400
+ | children | `React.ReactNode` | — | No | Image or media block (`cover` variant). |
401
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the `div`. |
402
+
403
+ ### Card.Split
404
+
405
+ | Prop | Type | Default | Required | Description |
406
+ |------|------|---------|----------|-------------|
407
+ | className | `string` | — | No | Extra class. |
408
+ | children | `React.ReactNode` | — | No | Typically two **`SplitCell`** children. |
409
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the grid `div`. |
410
+
411
+ ### Card.SplitCell
412
+
413
+ | Prop | Type | Default | Required | Description |
414
+ |------|------|---------|----------|-------------|
415
+ | className | `string` | — | No | Extra class. |
416
+ | children | `React.ReactNode` | — | No | One metric column: **`Label`** + **`Value`**, or **`IconBox`** + **`Stack`** (as in **`mini`**) when using the icon tile. |
417
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the cell `div`. |
418
+
419
+ ### Card.ListHeader
420
+
421
+ | Prop | Type | Default | Required | Description |
422
+ |------|------|---------|----------|-------------|
423
+ | className | `string` | — | No | Extra class. |
424
+ | children | `React.ReactNode` | — | No | Title row for **`list`**. |
425
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the `div`. |
426
+
427
+ ### Card.List
428
+
429
+ | Prop | Type | Default | Required | Description |
430
+ |------|------|---------|----------|-------------|
431
+ | className | `string` | — | No | Extra class. |
432
+ | children | `React.ReactNode` | — | No | **`ListItem`** nodes. |
433
+ | …rest | `React.HTMLAttributes<HTMLUListElement>` | — | No | Attributes on the `ul` (forwardRef). |
434
+
435
+ ### Card.ListItem
436
+
437
+ | Prop | Type | Default | Required | Description |
438
+ |------|------|---------|----------|-------------|
439
+ | className | `string` | — | No | Extra class. |
440
+ | children | `React.ReactNode` | — | No | Row content. |
441
+ | …rest | `React.HTMLAttributes<HTMLLIElement>` | — | No | Attributes on the `li` (forwardRef). |
442
+
443
+ ### Card.SectionHeader
444
+
445
+ | Prop | Type | Default | Required | Description |
446
+ |------|------|---------|----------|-------------|
447
+ | className | `string` | — | No | Extra class. |
448
+ | children | `React.ReactNode` | — | No | Title row content. |
449
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the header `div`. |
450
+
451
+ ### Card.SectionTitle
452
+
453
+ | Prop | Type | Default | Required | Description |
454
+ |------|------|---------|----------|-------------|
455
+ | className | `string` | — | No | Extra class. |
456
+ | children | `React.ReactNode` | — | No | Heading text. |
457
+ | …rest | `React.HTMLAttributes<HTMLHeadingElement>` | — | No | Attributes on the `h3`. |
458
+
459
+ ### Card.SectionTrailing
460
+
461
+ | Prop | Type | Default | Required | Description |
462
+ |------|------|---------|----------|-------------|
463
+ | className | `string` | — | No | Extra class. |
464
+ | children | `React.ReactNode` | — | No | Icons or actions. |
465
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the trailing `div`. |
466
+
467
+ ### Card.Body
468
+
469
+ | Prop | Type | Default | Required | Description |
470
+ |------|------|---------|----------|-------------|
471
+ | className | `string` | — | No | Extra class. |
472
+ | children | `React.ReactNode` | — | No | Padded **`panel`** content (text, tables). One **element** child can stretch inside the padded area. |
473
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the body `div`. |
474
+
475
+ ### Card.Chart
476
+
477
+ | Prop | Type | Default | Required | Description |
478
+ |------|------|---------|----------|-------------|
479
+ | className | `string` | — | No | Extra class. |
480
+ | children | `React.ReactNode` | — | No | **`panel`** chart root; **no** inner padding (edge-to-edge). |
481
+ | …rest | `React.HTMLAttributes<HTMLDivElement>` | — | No | Attributes on the chart region `div`. |
482
+
483
+ ## Imports
484
+
485
+ ```ts
486
+ import { Card } from "prime-ui-kit";
487
+ ```
488
+
489
+ CSS for this component is included in the main bundle (`prime-ui-kit/styles.css` / `bundle.css`) when you import the library styles.
@@ -0,0 +1,98 @@
1
+ # Checkbox
2
+
3
+ **Проектирование по умолчанию:** при проектировании экранов и примеров изначально выбирай **`m`** для `size` (где есть ось размера), если явно не оговорено иное.
4
+
5
+ ## About
6
+
7
+ A compound checkbox: a visually hidden native `input type="checkbox"`, a decorative box with check or indeterminate mark, and optional label, hint, and error text wired to `aria-describedby` and invalid state.
8
+
9
+ - **When to use** — explicit consent, terms, or other “yes/no” fields that submit with the form (`name`, `value`, `required`).
10
+ - **When to use** — row or “select all” patterns where the parent shows **indeterminate** when only some children are checked.
11
+ - **When to use** — independent toggles (filters, optional features) rather than one-of-many choices.
12
+ - **When to use** — hint text or inline validation aligned under the label column.
13
+ - **When not to use** — exactly one option from a set of alternatives (prefer [Radio](../radio/COMPONENT.md)).
14
+ - **When not to use** — a single binary setting where a switch fits the product language (prefer [Switch](../switch/COMPONENT.md)).
15
+ - **When not to use** — you need `asChild` or fully custom markup; the control is a fixed [Label](../label/COMPONENT.md) row with a hidden input and SVG.
16
+
17
+ ## Composition
18
+
19
+ - **`Checkbox.Root`** — wraps the field in a `div` with `data-size`, `data-variant`, `data-disabled`, `data-invalid`, `data-checked`, `data-indeterminate`; provides context and `ControlSizeProvider` for child parts.
20
+ - **`Checkbox.Label`** — required for the control: hosts the native checkbox and decorative SVG, then optional text in a trailing column; sets `htmlFor` to the input id.
21
+ - **`Checkbox.Hint`** — optional; registers hint text and contributes its id to the input’s `aria-describedby`.
22
+ - **`Checkbox.Error`** — optional; error-styled [Hint](../hint/COMPONENT.md) and registers invalid state when mounted (with `variant="error"` on the root when you want error chrome without the slot).
23
+ - **Order:** `Root` → `Label` (always) → `Hint` / `Error` below when needed. Public API: `Checkbox` with `Root`, `Label`, `Hint`, `Error`.
24
+
25
+ ### Minimal example
26
+
27
+ ```tsx
28
+ import { Checkbox } from "prime-ui-kit";
29
+
30
+ export function Example() {
31
+ return (
32
+ <Checkbox.Root name="terms" value="yes">
33
+ <Checkbox.Label>Accept terms</Checkbox.Label>
34
+ </Checkbox.Root>
35
+ );
36
+ }
37
+ ```
38
+
39
+ ## Rules
40
+
41
+ - Вертикальный ритм между **подписью и hint** задаётся самим компонентом; не вставляйте между ними лишний [Typography](../typography/COMPONENT.md) с другой ролью чтения без необходимости.
42
+ - Support **controlled** (`checked` + `onChange`) and **uncontrolled** (`defaultChecked`); internal state updates from the change handler before your `onChange` runs.
43
+ - **`indeterminate`** only affects visuals and the DOM `indeterminate` property; it is not a separate submitted value—clear or sync it in your handler when the user clicks.
44
+ - Set **`aria-label`** or **`aria-labelledby`** on **`Checkbox.Root`** when **`Checkbox.Label`** has no visible text (icon-only or header “select all” cell).
45
+ - **`aria-describedby`** on the root is merged with hint and error ids when those slots are mounted; include your own ids in `aria-describedby` if you need extra descriptors.
46
+ - **`variant="error"`** or a mounted **`Checkbox.Error`** sets `aria-invalid` and error styling; **`disabled`** disables the input and dims hint styling.
47
+ - Focus and keyboard activation use the native checkbox; the visible focus ring targets the decorative control via `focus-visible`.
48
+ - There is no loading or `asChild` API; **`size`** on the root does not forward to the DOM input (layout token only).
49
+
50
+ ## API
51
+
52
+ ### Checkbox.Root
53
+
54
+ | Prop | Type | Default | Required | Description |
55
+ |------|------|---------|----------|-------------|
56
+ | variant | `"default" \| "error"` | `"default"` | no | Error-colored outline for `error`; `invalid` is also true when `Checkbox.Error` is mounted. |
57
+ | size | `"s" \| "m" \| "l" \| "xl"` | `"m"` | no | Box and typography scale. |
58
+ | indeterminate | `boolean` | `false` | no | Indeterminate visuals; syncs `input.indeterminate`. |
59
+ | id | `string` | auto (`useId`) | no | Stable input id; paired with `Checkbox.Label` via `htmlFor`. |
60
+ | className | `string` | — | no | Class on the field wrapper `div`. |
61
+ | checked | `boolean` | — | no | Controlled checked state. |
62
+ | defaultChecked | `boolean` | `false` | no | Initial checked state when uncontrolled. |
63
+ | onChange | `React.ChangeEventHandler<HTMLInputElement>` | — | no | Fired on toggle; internal checked state updates before this runs. |
64
+ | disabled | `boolean` | — | no | Disables the input and label row. |
65
+ | aria-describedby | `string` | — | no | Combined with hint and error ids when those slots exist. |
66
+ | children | `React.ReactNode` | — | no | Typically `Label`, optional `Hint` / `Error`. |
67
+ | ref | `React.Ref<HTMLInputElement>` | — | no | Ref to the native checkbox input. |
68
+ | …rest | `Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" \| "size">` | — | no | Other native attributes forwarded to the hidden `input` (e.g. `name`, `value`, `required`, `readOnly`, `form`). `type` is always `checkbox`. |
69
+
70
+ ### Checkbox.Label
71
+
72
+ | Prop | Type | Default | Required | Description |
73
+ |------|------|---------|----------|-------------|
74
+ | children | `React.ReactNode` | — | no | Label text beside the box; omit for a box-only control and set an accessible name on `Root`. |
75
+ | className | `string` | — | no | Class on the label row. |
76
+ | …rest | `Omit<React.HTMLAttributes<HTMLLabelElement>, "htmlFor" \| "size">` | — | no | Other label attributes; `htmlFor` is managed internally. |
77
+
78
+ ### Checkbox.Hint
79
+
80
+ | Prop | Type | Default | Required | Description |
81
+ |------|------|---------|----------|-------------|
82
+ | children | `React.ReactNode` | — | yes | Supplementary text below the label. |
83
+ | className | `string` | — | no | Additional class on the hint. |
84
+ | …rest | `Omit<React.HTMLAttributes<HTMLParagraphElement>, "id">` | — | no | Paragraph attributes; `id` is managed internally. |
85
+
86
+ ### Checkbox.Error
87
+
88
+ | Prop | Type | Default | Required | Description |
89
+ |------|------|---------|----------|-------------|
90
+ | children | `React.ReactNode` | — | yes | Error message text. |
91
+ | className | `string` | — | no | Additional class on the message. |
92
+ | …rest | `Omit<React.HTMLAttributes<HTMLParagraphElement>, "id">` | — | no | Paragraph attributes; `id` is managed internally. |
93
+
94
+ ## Related
95
+
96
+ - [Radio](../radio/COMPONENT.md) — one-of-many choice with the same validation variants.
97
+ - [Switch](../switch/COMPONENT.md) — binary setting with a different control pattern.
98
+ - [Label](../label/COMPONENT.md), [Hint](../hint/COMPONENT.md) — primitives used inside the checkbox; pair with [Input](../input/COMPONENT.md) in larger forms.
@@ -0,0 +1,58 @@
1
+ # CodeBlock
2
+
3
+ ## About
4
+
5
+ `CodeBlock` is a static presentation component: it renders a TS or TSX source string with syntax highlighting and a light or dark token palette. The kit exposes a single part, `Root`, which outputs a `pre` whose inner `code` markup is produced by `highlightTsxHtml`.
6
+
7
+ - **When to use** — partner docs, marketing pages, or in-app help where you need a short snippet that matches the kit’s typography and theme.
8
+ - **When to use** — API reference cards, integration guides, or internal tools showing request bodies, configs, or generated output you control.
9
+ - **When to use** — pairing a snippet with surrounding copy (`Typography`, labels) where the block should stay non-interactive and read-only.
10
+ - **When not to use** — raw or untrusted user input as `code` (markup is injected via `dangerouslySetInnerHTML`).
11
+ - **When not to use** — languages other than TS/TSX or cases that need a full parser or line numbers, copy buttons, and tabs (add those in your app layer).
12
+ - **When not to use** — when you need a focusable, editable code field (use an input or a dedicated editor instead).
13
+
14
+ ## Composition
15
+
16
+ - The public API is the `CodeBlock` object with one subpart: **`Root`**.
17
+ - **`Root`** renders a native **`pre`**. Highlighted content is injected as a single inner **`code`** element; do not pass `children` or `dangerouslySetInnerHTML` yourself — they are excluded from the props type.
18
+ - Pass the source as the **`code`** string prop. Optional **`colorScheme`** selects the highlighting palette (`data-theme` on `pre`).
19
+
20
+ ### Minimal example
21
+
22
+ ```tsx
23
+ import { CodeBlock } from "prime-ui-kit";
24
+
25
+ export function Example() {
26
+ return <CodeBlock.Root code='export const n = 1;' />;
27
+ }
28
+ ```
29
+
30
+ ## Rules
31
+
32
+ - **`code`** is required. The implementation applies **`trimEnd()`** before highlighting; leading indentation in the string is preserved aside from trailing whitespace on the whole string.
33
+ - **`colorScheme`** defaults to **`"light"`**; use **`"dark"`** when the block sits on a dark surface so token colors stay readable.
34
+ - **Security:** inner HTML comes from **`highlightTsxHtml`**. Only pass **trusted** strings (constants, vetted CMS content, sanitized backend output).
35
+ - **Highlighting** uses a TS/TSX-oriented heuristic in the kit, not a full language grammar — rare syntax may not get the expected classes.
36
+ - **No built-in `size`:** font size and line height follow the parent; control rhythm with wrapper layout and typography tokens.
37
+ - **Accessibility:** treat the block as static prose context; add **`aria-label`**, **`aria-describedby`**, or nearby headings via standard **`pre`** attributes spread from **`…rest`** when screen readers need an explicit label.
38
+ - **Focus:** the component does not set **`tabIndex`**; make it focusable only if your UX requires it.
39
+
40
+ ## API
41
+
42
+ ### CodeBlock.Root
43
+
44
+ | Prop | Type | Default | Required | Description |
45
+ |------|------|---------|----------|-------------|
46
+ | `code` | `string` | — | Yes | TS/TSX source; trailing whitespace is trimmed with `trimEnd()` before highlighting. |
47
+ | `colorScheme` | `CodeBlockColorScheme` (`"light" \| "dark"`) | `"light"` | No | Token palette / `data-theme` on the root `pre`. |
48
+ | `className` | `string` | — | No | Additional class on the root `pre`. |
49
+ | `…rest` | `Omit<React.HTMLAttributes<HTMLPreElement>, "children" \| "dangerouslySetInnerHTML">` | — | No | Other native `pre` attributes (`id`, `style`, ARIA, `data-*`, event handlers, etc.). `children` and `dangerouslySetInnerHTML` are omitted. |
50
+
51
+ The package also exports **`CodeBlockColorScheme`** and **`CodeBlockRootProps`** for typing.
52
+
53
+ ## Related
54
+
55
+ - [Typography](../typography/COMPONENT.md) — headings and body copy around snippets.
56
+ - [Button](../button/COMPONENT.md) — switching multiple samples from parent state.
57
+ - [Segmented control](../segmented-control/COMPONENT.md) — compact mode or sample switching in toolbars.
58
+ - [Kbd](../kbd/COMPONENT.md) — shortcut hints next to prose, without duplicating the code block’s role.