prime-ui-kit 0.16.0 → 0.17.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.
- package/README.md +14 -18
- package/dist/chunks/{chunk-4PSQ64S4.js → chunk-7WWZYGRC.js} +3697 -3738
- package/dist/chunks/{chunk-6TPHKCUJ.js → chunk-A4WE3UNC.js} +27340 -26893
- package/dist/chunks/{chunk-A7OQWH6R.js → chunk-PRP4B6OG.js} +1 -1
- package/dist/chunks/{chunk-HDBQICPW.js → chunk-SVFWPLNW.js} +49 -20
- package/dist/color-picker.d.ts +1 -1
- package/dist/color-picker.js +3 -3
- package/dist/components/breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/components/chart-frame/ChartFrame.d.ts +1 -1
- package/dist/components/chat/ChatRows.d.ts +5 -1
- package/dist/components/color-picker/ColorPicker.d.ts +18 -1
- package/dist/components/data-table/DataTable.d.ts +1 -1
- package/dist/components/index.d.ts +0 -4
- package/dist/components/pagination/Pagination.d.ts +5 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/slider/Slider.d.ts +1 -1
- package/dist/components/smart-filter/SmartFilter.d.ts +4 -5
- package/dist/icon-set.js +2 -2
- package/dist/index.css +1 -1
- package/dist/index.js +5 -9
- package/dist/internal/barPlan.d.ts +44 -0
- package/dist/internal/overlay/FloatingPanel.d.ts +1 -1
- package/dist/internal/overlay/focus.d.ts +3 -2
- package/dist/internal/parts.d.ts +1 -1
- package/dist/internal/slot.d.ts +0 -30
- package/dist/layout/app-shell/AppShell.d.ts +19 -38
- package/dist/layout/index.d.ts +3 -3
- package/dist/layout/page/Page.d.ts +263 -0
- package/dist/layout/sidebar/Sidebar.d.ts +1 -1
- package/dist/skill/SKILL.md +10 -10
- package/dist/skill/anti-slop.md +101 -5
- package/dist/skill/api-contract.md +1 -1
- package/dist/skill/cheatsheet.md +27 -22
- package/dist/skill/checklist.md +7 -3
- package/dist/skill/choosing.md +9 -8
- package/dist/skill/components.md +3 -5
- package/dist/skill/composition.md +177 -152
- package/dist/skill/foundations.md +9 -9
- package/dist/skill/layouts.md +39 -98
- package/dist/skill/reference/components/avatar/COMPONENT.md +2 -2
- package/dist/skill/reference/components/avatar/examples/team-group.tsx +1 -1
- package/dist/skill/reference/components/banner/COMPONENT.md +4 -4
- package/dist/skill/reference/components/banner/examples/examples.module.css +6 -1
- package/dist/skill/reference/components/banner/examples/page-strip.tsx +24 -22
- package/dist/skill/reference/components/breadcrumb/COMPONENT.md +9 -8
- package/dist/skill/reference/components/button/COMPONENT.md +1 -0
- package/dist/skill/reference/components/button/examples/hold-to-confirm.tsx +1 -1
- package/dist/skill/reference/components/button/examples/on-colored-host.tsx +8 -8
- package/dist/skill/reference/components/card/COMPONENT.md +7 -7
- package/dist/skill/reference/components/card/examples/screen.module.css +1 -1
- package/dist/skill/reference/components/card/examples/screen.tsx +184 -198
- package/dist/skill/reference/components/chart-frame/COMPONENT.md +1 -1
- package/dist/skill/reference/components/chart-frame/examples/fill-height.tsx +9 -9
- package/dist/skill/reference/components/chat/COMPONENT.md +4 -4
- package/dist/skill/reference/components/chat/examples/screen.module.css +1 -1
- package/dist/skill/reference/components/chat/examples/screen.tsx +110 -117
- package/dist/skill/reference/components/chat-list/COMPONENT.md +2 -2
- package/dist/skill/reference/components/chat-list/examples/controlled.tsx +2 -2
- package/dist/skill/reference/components/chat-list/examples/examples.module.css +8 -0
- package/dist/skill/reference/components/checkbox/examples/examples.module.css +3 -2
- package/dist/skill/reference/components/code-block/COMPONENT.md +1 -1
- package/dist/skill/reference/components/code-block/examples/color-scheme.tsx +2 -4
- package/dist/skill/reference/components/code-block/examples/examples.module.css +0 -11
- package/dist/skill/reference/components/color-picker/COMPONENT.md +18 -7
- package/dist/skill/reference/components/color-picker/examples/examples.module.css +2 -5
- package/dist/skill/reference/components/color-picker/examples/overview.tsx +5 -10
- package/dist/skill/reference/components/color-picker/examples/sizes.tsx +4 -8
- package/dist/skill/reference/components/crossfade/COMPONENT.md +2 -2
- package/dist/skill/reference/components/crossfade/examples/screen.tsx +107 -112
- package/dist/skill/reference/components/data-table/COMPONENT.md +5 -5
- package/dist/skill/reference/components/data-table/examples/examples.module.css +9 -0
- package/dist/skill/reference/components/data-table/examples/screen.tsx +42 -52
- package/dist/skill/reference/components/data-table/examples/server.tsx +6 -2
- package/dist/skill/reference/components/datepicker/examples/examples.module.css +6 -0
- package/dist/skill/reference/components/datepicker/examples/inline-panel.tsx +3 -1
- package/dist/skill/reference/components/description-list/COMPONENT.md +1 -1
- package/dist/skill/reference/components/description-list/examples/screen.tsx +120 -127
- package/dist/skill/reference/components/digit-input/examples/grouped.tsx +4 -4
- package/dist/skill/reference/components/digit-input/examples/validation.tsx +1 -1
- package/dist/skill/reference/components/divider/COMPONENT.md +2 -2
- package/dist/skill/reference/components/divider/examples/examples.module.css +4 -1
- package/dist/skill/reference/components/divider/examples/vertical.tsx +22 -9
- package/dist/skill/reference/components/dnd/examples/examples.module.css +3 -1
- package/dist/skill/reference/components/drawer/COMPONENT.md +1 -1
- package/dist/skill/reference/components/drawer/examples/placement.tsx +26 -31
- package/dist/skill/reference/components/drawer/examples/screen.tsx +137 -160
- package/dist/skill/reference/components/dropdown/COMPONENT.md +1 -1
- package/dist/skill/reference/components/example-frame/COMPONENT.md +3 -3
- package/dist/skill/reference/components/field-list/examples/screen.module.css +1 -1
- package/dist/skill/reference/components/field-list/examples/screen.tsx +19 -19
- package/dist/skill/reference/components/fieldset/COMPONENT.md +1 -1
- package/dist/skill/reference/components/fieldset/examples/states.tsx +1 -1
- package/dist/skill/reference/components/file-upload/COMPONENT.md +1 -1
- package/dist/skill/reference/components/file-upload/examples/screen.module.css +2 -2
- package/dist/skill/reference/components/file-upload/examples/screen.tsx +65 -81
- package/dist/skill/reference/components/gallery/COMPONENT.md +1 -0
- package/dist/skill/reference/components/gantt/COMPONENT.md +1 -1
- package/dist/skill/reference/components/gantt/examples/screen.module.css +1 -1
- package/dist/skill/reference/components/gantt/examples/screen.tsx +55 -73
- package/dist/skill/reference/components/hint/examples/examples.module.css +10 -1
- package/dist/skill/reference/components/hint/examples/overview.tsx +1 -1
- package/dist/skill/reference/components/kanban/COMPONENT.md +1 -1
- package/dist/skill/reference/components/kanban/examples/screen.module.css +1 -1
- package/dist/skill/reference/components/kanban/examples/screen.tsx +50 -65
- package/dist/skill/reference/components/kbd/COMPONENT.md +1 -1
- package/dist/skill/reference/components/label/examples/examples.module.css +12 -1
- package/dist/skill/reference/components/label/examples/overview.tsx +1 -1
- package/dist/skill/reference/components/list/COMPONENT.md +3 -3
- package/dist/skill/reference/components/media-viewer/examples/controlled.tsx +16 -16
- package/dist/skill/reference/components/media-viewer/examples/examples.module.css +1 -3
- package/dist/skill/reference/components/pagination/COMPONENT.md +11 -3
- package/dist/skill/reference/components/pagination/examples/controlled.tsx +2 -1
- package/dist/skill/reference/components/popover/COMPONENT.md +3 -2
- package/dist/skill/reference/components/popover/examples/width.tsx +13 -1
- package/dist/skill/reference/components/slider/COMPONENT.md +3 -3
- package/dist/skill/reference/components/slider/examples/states.tsx +14 -10
- package/dist/skill/reference/components/smart-filter/COMPONENT.md +13 -13
- package/dist/skill/reference/components/smart-filter/examples/examples.module.css +3 -0
- package/dist/skill/reference/components/smart-filter/examples/many-values.tsx +12 -8
- package/dist/skill/reference/components/smart-filter/examples/sizes.tsx +7 -3
- package/dist/skill/reference/components/sparkline/COMPONENT.md +1 -0
- package/dist/skill/reference/components/sparkline/examples/curve.tsx +16 -11
- package/dist/skill/reference/components/sparkline/examples/states.tsx +14 -10
- package/dist/skill/reference/components/switch/COMPONENT.md +1 -1
- package/dist/skill/reference/components/tabs/COMPONENT.md +1 -1
- package/dist/skill/reference/components/typography/COMPONENT.md +2 -2
- package/dist/skill/reference/foundation.md +15 -11
- package/dist/skill/reference/layout/app-shell/COMPONENT.md +25 -38
- package/dist/skill/reference/layout/app-shell/examples/footer.tsx +10 -10
- package/dist/skill/reference/layout/app-shell/examples/overview.tsx +20 -22
- package/dist/skill/reference/layout/app-shell/examples/screen.module.css +2 -2
- package/dist/skill/reference/layout/app-shell/examples/screen.tsx +25 -30
- package/dist/skill/reference/layout/app-shell/examples/template.tsx +13 -17
- package/dist/skill/reference/layout/bottom-nav/COMPONENT.md +3 -3
- package/dist/skill/reference/layout/bottom-nav/examples/floating-action.tsx +10 -19
- package/dist/skill/reference/layout/bottom-nav/examples/floating.tsx +10 -19
- package/dist/skill/reference/layout/bottom-nav/examples/in-app-shell.tsx +11 -19
- package/dist/skill/reference/layout/page/COMPONENT.md +353 -0
- package/dist/skill/reference/layout/page/examples/actions-collapse.tsx +45 -0
- package/dist/skill/reference/layout/page/examples/collapse.tsx +68 -0
- package/dist/skill/reference/{components/page-content → layout/page}/examples/examples.module.css +33 -4
- package/{src/components/page-content → dist/skill/reference/layout/page}/examples/grid.tsx +15 -15
- package/dist/skill/reference/{components/page-content → layout/page}/examples/list-detail.tsx +14 -14
- package/dist/skill/reference/layout/page/examples/narrow.tsx +75 -0
- package/dist/skill/reference/layout/page/examples/overview.tsx +57 -0
- package/dist/skill/reference/{components/page-content → layout/page}/examples/screen.module.css +1 -1
- package/{src/components/page-content → dist/skill/reference/layout/page}/examples/screen.tsx +29 -19
- package/dist/skill/reference/{components/page-content → layout/page}/examples/sections.tsx +17 -24
- package/dist/skill/reference/layout/page/examples/structure.tsx +41 -0
- package/dist/skill/reference/{components/page-toolbar/examples/narrow.tsx → layout/page/examples/tools.tsx} +38 -35
- package/dist/skill/reference/layout/page/examples/top-bar.tsx +85 -0
- package/dist/skill/reference/{components/page-content → layout/page}/examples/variants.tsx +7 -7
- package/dist/skill/reference/layout/sidebar/COMPONENT.md +5 -4
- package/dist/skill/reference/layout/sidebar/examples/dismiss.tsx +10 -7
- package/dist/skill/reference/layout/sidebar/examples/narrow.tsx +11 -8
- package/dist/skill/responsive.md +88 -74
- package/dist/tokens/layers.d.ts +2 -0
- package/dist/tokens/primitives.d.ts +12 -2
- package/dist/tokens/semantic.d.ts +7 -0
- package/dist/tokens/themes/dark.d.ts +7 -2
- package/package.json +2 -2
- package/src/components/avatar/COMPONENT.md +2 -2
- package/src/components/avatar/examples/team-group.tsx +1 -1
- package/src/components/banner/COMPONENT.md +4 -4
- package/src/components/banner/examples/examples.module.css +6 -1
- package/src/components/banner/examples/page-strip.tsx +24 -22
- package/src/components/breadcrumb/COMPONENT.md +9 -8
- package/src/components/button/COMPONENT.md +1 -0
- package/src/components/button/examples/hold-to-confirm.tsx +1 -1
- package/src/components/button/examples/on-colored-host.tsx +8 -8
- package/src/components/card/COMPONENT.md +7 -7
- package/src/components/card/examples/screen.module.css +1 -1
- package/src/components/card/examples/screen.tsx +184 -198
- package/src/components/chart-frame/COMPONENT.md +1 -1
- package/src/components/chart-frame/examples/fill-height.tsx +9 -9
- package/src/components/chat/COMPONENT.md +4 -4
- package/src/components/chat/examples/screen.module.css +1 -1
- package/src/components/chat/examples/screen.tsx +110 -117
- package/src/components/chat-list/COMPONENT.md +2 -2
- package/src/components/chat-list/examples/controlled.tsx +2 -2
- package/src/components/chat-list/examples/examples.module.css +8 -0
- package/src/components/checkbox/examples/examples.module.css +3 -2
- package/src/components/code-block/COMPONENT.md +1 -1
- package/src/components/code-block/examples/color-scheme.tsx +2 -4
- package/src/components/code-block/examples/examples.module.css +0 -11
- package/src/components/color-picker/COMPONENT.md +18 -7
- package/src/components/color-picker/examples/examples.module.css +2 -5
- package/src/components/color-picker/examples/overview.tsx +5 -10
- package/src/components/color-picker/examples/sizes.tsx +4 -8
- package/src/components/crossfade/COMPONENT.md +2 -2
- package/src/components/crossfade/examples/screen.tsx +107 -112
- package/src/components/data-table/COMPONENT.md +5 -5
- package/src/components/data-table/examples/examples.module.css +9 -0
- package/src/components/data-table/examples/screen.tsx +42 -52
- package/src/components/data-table/examples/server.tsx +6 -2
- package/src/components/datepicker/examples/examples.module.css +6 -0
- package/src/components/datepicker/examples/inline-panel.tsx +3 -1
- package/src/components/description-list/COMPONENT.md +1 -1
- package/src/components/description-list/examples/screen.tsx +120 -127
- package/src/components/digit-input/examples/grouped.tsx +4 -4
- package/src/components/digit-input/examples/validation.tsx +1 -1
- package/src/components/divider/COMPONENT.md +2 -2
- package/src/components/divider/examples/examples.module.css +4 -1
- package/src/components/divider/examples/vertical.tsx +22 -9
- package/src/components/dnd/examples/examples.module.css +3 -1
- package/src/components/drawer/COMPONENT.md +1 -1
- package/src/components/drawer/examples/placement.tsx +26 -31
- package/src/components/drawer/examples/screen.tsx +137 -160
- package/src/components/dropdown/COMPONENT.md +1 -1
- package/src/components/example-frame/COMPONENT.md +3 -3
- package/src/components/field-list/examples/screen.module.css +1 -1
- package/src/components/field-list/examples/screen.tsx +19 -19
- package/src/components/fieldset/COMPONENT.md +1 -1
- package/src/components/fieldset/examples/states.tsx +1 -1
- package/src/components/file-upload/COMPONENT.md +1 -1
- package/src/components/file-upload/examples/screen.module.css +2 -2
- package/src/components/file-upload/examples/screen.tsx +65 -81
- package/src/components/gallery/COMPONENT.md +1 -0
- package/src/components/gantt/COMPONENT.md +1 -1
- package/src/components/gantt/examples/screen.module.css +1 -1
- package/src/components/gantt/examples/screen.tsx +55 -73
- package/src/components/hint/examples/examples.module.css +10 -1
- package/src/components/hint/examples/overview.tsx +1 -1
- package/src/components/kanban/COMPONENT.md +1 -1
- package/src/components/kanban/examples/screen.module.css +1 -1
- package/src/components/kanban/examples/screen.tsx +50 -65
- package/src/components/kbd/COMPONENT.md +1 -1
- package/src/components/label/examples/examples.module.css +12 -1
- package/src/components/label/examples/overview.tsx +1 -1
- package/src/components/list/COMPONENT.md +3 -3
- package/src/components/media-viewer/examples/controlled.tsx +16 -16
- package/src/components/media-viewer/examples/examples.module.css +1 -3
- package/src/components/pagination/COMPONENT.md +11 -3
- package/src/components/pagination/examples/controlled.tsx +2 -1
- package/src/components/popover/COMPONENT.md +3 -2
- package/src/components/popover/examples/width.tsx +13 -1
- package/src/components/slider/COMPONENT.md +3 -3
- package/src/components/slider/examples/states.tsx +14 -10
- package/src/components/smart-filter/COMPONENT.md +13 -13
- package/src/components/smart-filter/examples/examples.module.css +3 -0
- package/src/components/smart-filter/examples/many-values.tsx +12 -8
- package/src/components/smart-filter/examples/sizes.tsx +7 -3
- package/src/components/sparkline/COMPONENT.md +1 -0
- package/src/components/sparkline/examples/curve.tsx +16 -11
- package/src/components/sparkline/examples/states.tsx +14 -10
- package/src/components/switch/COMPONENT.md +1 -1
- package/src/components/tabs/COMPONENT.md +1 -1
- package/src/components/typography/COMPONENT.md +2 -2
- package/src/layout/app-shell/COMPONENT.md +25 -38
- package/src/layout/app-shell/examples/footer.tsx +10 -10
- package/src/layout/app-shell/examples/overview.tsx +20 -22
- package/src/layout/app-shell/examples/screen.module.css +2 -2
- package/src/layout/app-shell/examples/screen.tsx +25 -30
- package/src/layout/app-shell/examples/template.tsx +13 -17
- package/src/layout/bottom-nav/COMPONENT.md +3 -3
- package/src/layout/bottom-nav/examples/floating-action.tsx +10 -19
- package/src/layout/bottom-nav/examples/floating.tsx +10 -19
- package/src/layout/bottom-nav/examples/in-app-shell.tsx +11 -19
- package/src/layout/page/COMPONENT.md +353 -0
- package/src/layout/page/examples/actions-collapse.tsx +45 -0
- package/src/layout/page/examples/collapse.tsx +68 -0
- package/src/{components/page-content → layout/page}/examples/examples.module.css +33 -4
- package/{dist/skill/reference/components/page-content → src/layout/page}/examples/grid.tsx +15 -15
- package/src/{components/page-content → layout/page}/examples/list-detail.tsx +14 -14
- package/src/layout/page/examples/narrow.tsx +75 -0
- package/src/layout/page/examples/overview.tsx +57 -0
- package/src/{components/page-content → layout/page}/examples/screen.module.css +1 -1
- package/{dist/skill/reference/components/page-content → src/layout/page}/examples/screen.tsx +29 -19
- package/src/{components/page-content → layout/page}/examples/sections.tsx +17 -24
- package/src/layout/page/examples/structure.tsx +41 -0
- package/src/{components/page-toolbar/examples/narrow.tsx → layout/page/examples/tools.tsx} +38 -35
- package/src/layout/page/examples/top-bar.tsx +85 -0
- package/src/{components/page-content → layout/page}/examples/variants.tsx +7 -7
- package/src/layout/sidebar/COMPONENT.md +5 -4
- package/src/layout/sidebar/examples/dismiss.tsx +10 -7
- package/src/layout/sidebar/examples/narrow.tsx +11 -8
- package/src/styles/theme-dark.css +12 -10
- package/src/styles/theme-light.css +3 -0
- package/src/styles/tokens.css +3 -1
- package/dist/components/page-content/PageContent.d.ts +0 -192
- package/dist/components/page-toolbar/PageToolbar.d.ts +0 -55
- package/dist/layout/app-header/AppHeader.d.ts +0 -118
- package/dist/skill/reference/components/page-content/COMPONENT.md +0 -264
- package/dist/skill/reference/components/page-content/examples/narrow.tsx +0 -25
- package/dist/skill/reference/components/page-content/examples/overview.tsx +0 -41
- package/dist/skill/reference/components/page-toolbar/COMPONENT.md +0 -147
- package/dist/skill/reference/components/page-toolbar/examples/examples.module.css +0 -16
- package/dist/skill/reference/components/page-toolbar/examples/overview.tsx +0 -113
- package/dist/skill/reference/components/page-toolbar/examples/save-changes.tsx +0 -43
- package/dist/skill/reference/components/page-toolbar/examples/without-search.tsx +0 -60
- package/dist/skill/reference/layout/app-header/COMPONENT.md +0 -187
- package/dist/skill/reference/layout/app-header/examples/breadcrumbs.tsx +0 -37
- package/dist/skill/reference/layout/app-header/examples/examples.module.css +0 -28
- package/dist/skill/reference/layout/app-header/examples/in-app-shell.tsx +0 -67
- package/dist/skill/reference/layout/app-header/examples/narrow.tsx +0 -66
- package/dist/skill/reference/layout/app-header/examples/overview.tsx +0 -34
- package/dist/skill/reference/layout/app-header/examples/page-title.tsx +0 -78
- package/dist/skill/reference/layout/app-shell/examples/contained.tsx +0 -30
- package/src/components/page-content/COMPONENT.md +0 -264
- package/src/components/page-content/examples/narrow.tsx +0 -25
- package/src/components/page-content/examples/overview.tsx +0 -41
- package/src/components/page-toolbar/COMPONENT.md +0 -147
- package/src/components/page-toolbar/examples/examples.module.css +0 -16
- package/src/components/page-toolbar/examples/overview.tsx +0 -113
- package/src/components/page-toolbar/examples/save-changes.tsx +0 -43
- package/src/components/page-toolbar/examples/without-search.tsx +0 -60
- package/src/layout/app-header/COMPONENT.md +0 -187
- package/src/layout/app-header/examples/breadcrumbs.tsx +0 -37
- package/src/layout/app-header/examples/examples.module.css +0 -28
- package/src/layout/app-header/examples/in-app-shell.tsx +0 -67
- package/src/layout/app-header/examples/narrow.tsx +0 -66
- package/src/layout/app-header/examples/overview.tsx +0 -34
- package/src/layout/app-header/examples/page-title.tsx +0 -78
- package/src/layout/app-shell/examples/contained.tsx +0 -30
- package/dist/chunks/{chunk-U3Q2I3MY.js → chunk-2ODXLPW3.js} +2 -2
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
> A selectable navigation list of rows: the master half of a list + detail screen (tickets, mail, records).
|
|
7
7
|
|
|
8
8
|
## When to use
|
|
9
|
-
- The list side of a list + detail screen (`
|
|
9
|
+
- The list side of a list + detail screen (`Page.Split` → `Page.List`): tickets, letters, invoices worked through one by one; the open one is `current`.
|
|
10
10
|
- A short column of records that each open something — a page (`href`, `asChild` with a router link) or a detail pane (`onClick`).
|
|
11
11
|
- A short list the team puts in order (funnel stages, queues, priorities) — `onReorder`, a `value` per item.
|
|
12
12
|
|
|
@@ -145,7 +145,7 @@ Root attributes: `data-size`, `role="list"` (the list style reset would drop the
|
|
|
145
145
|
|
|
146
146
|
## Layout & spacing
|
|
147
147
|
- The root fills its container (`width: 100%`); rows are 4px apart, each row a full-width button with the tier radius and field padding.
|
|
148
|
-
- Put the list on a surface: a `Card.Root` pane in `
|
|
148
|
+
- Put the list on a surface: a `Card.Root` pane in `Page.List`, with a `ScrollContainer` around it when it is long — the list never scrolls by itself.
|
|
149
149
|
- Row: leading icon · body (text over description) · trail. Beside two lines the trail stacks — meta on top, count below; beside one line they sit in a row.
|
|
150
150
|
- Text and description truncate with an ellipsis; give a long `List.ItemText` a `title` with the full text.
|
|
151
151
|
- On a coarse pointer a row is at least the touch target (44px).
|
|
@@ -200,4 +200,4 @@ Root attributes: `data-size`, `role="list"` (the list style reset would drop the
|
|
|
200
200
|
|
|
201
201
|
## Related
|
|
202
202
|
- **Built from:** [Badge](../badge/COMPONENT.md) (`List.ItemCount`), [Avatar](../avatar/COMPONENT.md) (`List.ItemIcon` gives an avatar the row tier), [Dnd](../dnd/COMPONENT.md) (`onReorder`: `Dnd.Sortable`, the busy `Dnd.Handle`)
|
|
203
|
-
- **See also:** [
|
|
203
|
+
- **See also:** [Page](../../layout/page/COMPONENT.md), [Sidebar](../../layout/sidebar/COMPONENT.md), [Tabs](../tabs/COMPONENT.md), [DataTable](../data-table/COMPONENT.md), [Card](../card/COMPONENT.md)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The parent owns the page: a finding opens its photo, and paging in the viewer moves the mark along the list — `index`, `onIndexChange`. */
|
|
2
|
-
import {
|
|
2
|
+
import { List, MediaViewer, type MediaViewerItem } from "prime-ui-kit";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
import styles from "./examples.module.css";
|
|
@@ -26,21 +26,21 @@ export default function MediaViewerControlledExample() {
|
|
|
26
26
|
return (
|
|
27
27
|
<>
|
|
28
28
|
<div className={styles.findings}>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
<List.Root aria-label="Замечания проверки">
|
|
30
|
+
{FINDINGS.map(([id, title], at) => (
|
|
31
|
+
<List.Item
|
|
32
|
+
key={id}
|
|
33
|
+
value={id}
|
|
34
|
+
current={at === index}
|
|
35
|
+
onClick={() => {
|
|
36
|
+
setIndex(at);
|
|
37
|
+
setOpen(true);
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<List.ItemText>{title}</List.ItemText>
|
|
41
|
+
</List.Item>
|
|
42
|
+
))}
|
|
43
|
+
</List.Root>
|
|
44
44
|
</div>
|
|
45
45
|
<MediaViewer
|
|
46
46
|
items={PHOTOS}
|
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
inline-size: min(100%, var(--prime-layout-form-width-m));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
/* controlled.tsx: the list of findings beside the photos. */
|
|
11
|
+
/* controlled.tsx: the column of the list of findings beside the photos. */
|
|
12
12
|
.findings {
|
|
13
|
-
display: grid;
|
|
14
|
-
gap: var(--prime-space-2);
|
|
15
13
|
inline-size: min(100%, var(--prime-layout-form-width-s));
|
|
16
14
|
}
|
|
@@ -44,6 +44,7 @@ Pagination <nav aria-label={labels.nav}>; size and compact mode
|
|
|
44
44
|
| `siblingCount` | `number` | `1` | Pages on each side of the current one before an ellipsis (when `totalPages > 2·siblingCount+5`). |
|
|
45
45
|
| `size` | `"xs" \| "s" \| "m" \| "l" \| "xl"` | host tier, else `"m"` | Control tier of the buttons: height 28 · 32 · 36 · 40 · 48. Without it the tier of its host, else `m`. |
|
|
46
46
|
| `compact` | `boolean` | `false` | Always arrows + «current / total» instead of numbers. Without it the nav fills its parent and shows that view only below 22rem of its width. |
|
|
47
|
+
| `align` | `"start" \| "center" \| "end"` | `"center"` | Where the page numbers sit in the width the nav fills: centred under a list, `end` beside a range line (the DataTable footer). The compact view keeps its arrows at the edges. |
|
|
47
48
|
| `labels` | `Partial<PaginationLabels>` | — | Built-in strings, see Labels. |
|
|
48
49
|
| `…rest` | `Omit<HTMLAttributes<HTMLElement>, "defaultValue" \| "onChange">` | — | `className`, `data-*` and the other `<nav>` attributes; `aria-label` comes from `labels.nav`. |
|
|
49
50
|
|
|
@@ -52,9 +53,16 @@ Pagination <nav aria-label={labels.nav}>; size and compact mode
|
|
|
52
53
|
### compact
|
|
53
54
|
| Value | Looks like | Use when | Default |
|
|
54
55
|
|---|---|---|---|
|
|
55
|
-
| `false` | fills the parent: arrows around page numbers
|
|
56
|
+
| `false` | fills the parent: arrows around page numbers placed by `align`, «…» for skipped ranges; below 22rem of its width the compact view with arrows at the edges | list and table footers, anywhere the width varies | yes |
|
|
56
57
|
| `true` | arrows around «3 / 12» (current in primary medium, total muted, tabular figures) at any width | tight toolbars, a pager that must never show numbers | |
|
|
57
58
|
|
|
59
|
+
### align
|
|
60
|
+
| Value | Looks like | Use when | Default |
|
|
61
|
+
|---|---|---|---|
|
|
62
|
+
| `center` | the numbers centred in the width the nav fills | a pager under a list or a grid of cards | yes |
|
|
63
|
+
| `start` | the numbers at the start | a pager under left-aligned content | |
|
|
64
|
+
| `end` | the numbers at the end | beside a range line in a footer (the DataTable footer passes it) | |
|
|
65
|
+
|
|
58
66
|
### size
|
|
59
67
|
| Value | Looks like | Use when | Default |
|
|
60
68
|
|---|---|---|---|
|
|
@@ -78,7 +86,7 @@ Pagination <nav aria-label={labels.nav}>; size and compact mode
|
|
|
78
86
|
| hover / active | pointer | `fill-subtle` / `fill-subtle-active`, primary text, press scale |
|
|
79
87
|
| focus-visible | keyboard | outer focus ring of the Button |
|
|
80
88
|
| disabled arrow | first / last page | native `disabled`, `text-disabled` |
|
|
81
|
-
| size / compact | `size` (else the host tier), `compact` | `data-size`, `data-compact` (`"auto"` · `"compact"`) |
|
|
89
|
+
| size / compact / align | `size` (else the host tier), `compact`, `align` | `data-size`, `data-compact` (`"auto"` · `"compact"`), `data-align` |
|
|
82
90
|
|
|
83
91
|
## Layout & spacing
|
|
84
92
|
- In a list footer: the range text on the left, rows-per-page Select and Pagination on the right (`justify-content: space-between`), the row wraps.
|
|
@@ -120,7 +128,7 @@ Pagination <nav aria-label={labels.nav}>; size and compact mode
|
|
|
120
128
|
| [overview.tsx](examples/overview.tsx) | Pages of an order list: arrows, page numbers and the current page — `totalPages`, `defaultValue`. |
|
|
121
129
|
| [sizes.tsx](examples/sizes.tsx) | Every size tier; buttons are as high as Button and Input of the same tier, 28 to 48 px — `size`. |
|
|
122
130
|
| [overflow.tsx](examples/overflow.tsx) | Up to 7 pages without an ellipsis, then a window around the current page; a wider window — `siblingCount`. |
|
|
123
|
-
| [controlled.tsx](examples/controlled.tsx) | A list footer owns the page: changing rows per page returns it to page 1 — `value`, `onValueChange`. |
|
|
131
|
+
| [controlled.tsx](examples/controlled.tsx) | A list footer owns the page: changing rows per page returns it to page 1, the pages at the end beside the range — `value`, `onValueChange`, `align`. |
|
|
124
132
|
| [narrow.tsx](examples/narrow.tsx) | A 320 px card footer: by default the numbers give way to «current / total» on a narrow width, `compact` always shows it — `compact`. |
|
|
125
133
|
|
|
126
134
|
## Mistakes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** A list footer owns the page: changing rows per page returns it to page 1 — `value`, `onValueChange`. */
|
|
1
|
+
/** A list footer owns the page: changing rows per page returns it to page 1, the pages at the end beside the range — `value`, `onValueChange`, `align`. */
|
|
2
2
|
import { Card, Pagination, Select, Typography } from "prime-ui-kit";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
@@ -39,6 +39,7 @@ export default function PaginationControlledExample() {
|
|
|
39
39
|
</Select.Content>
|
|
40
40
|
</Select.Root>
|
|
41
41
|
<Pagination
|
|
42
|
+
align="end"
|
|
42
43
|
value={page}
|
|
43
44
|
onValueChange={setPage}
|
|
44
45
|
totalPages={Math.ceil(TOTAL_INVOICES / pageSize)}
|
|
@@ -70,7 +70,7 @@ No DOM: clone the single child and merge `ref` and `onClick`. Trigger toggles th
|
|
|
70
70
|
| `side` | `"top" \| "right" \| "bottom" \| "left"` | `"bottom"` | Preferred side; flips to the opposite side when there is no room. |
|
|
71
71
|
| `align` | `"auto" \| "start" \| "center" \| "end"` | `"auto"` | Alignment along the trigger. `auto` lines the panel up with the trigger edge that has more room beyond it; `start`, `center` or `end` fix the edge. |
|
|
72
72
|
| `size` | `"xs" \| "s" \| "m" \| "l" \| "xl"` | `"m"` | Tier of the text, padding and gap; also the size context of the controls inside. |
|
|
73
|
-
| `width` | `"auto" \| "trigger" \| "content"` | `"auto"` | `auto`: by content,
|
|
73
|
+
| `width` | `"auto" \| "trigger" \| "min-trigger" \| "content"` | `"auto"` | `auto`: by content, panel minimum to twice that. `trigger`: exactly the trigger. `min-trigger`: `auto`, never narrower than the trigger. `content`: what the content needs. A sheet is full width. |
|
|
74
74
|
| `trapFocus` | `boolean` | `false` | Tab cycles inside the panel (forms). Without it Tab past the last (Shift+Tab before the first) stop closes the panel and returns focus to the trigger. |
|
|
75
75
|
| `initialFocus` | `boolean` | `true` with `Popover.Trigger`, `false` with `Popover.Anchor` | Focus moves into the panel on open (`[data-autofocus]`, else the first tab stop, else the panel). Turn it on for an anchored panel opened by a command, such as a Dropdown item, so focus does not stay on the menu trigger. |
|
|
76
76
|
| `flush` | `boolean` | `false` | No inner padding and no gap: rows and dividers reach the panel edges; the content lays out its own spacing. |
|
|
@@ -122,6 +122,7 @@ Title uses the tier text size with title weight; Description uses the tier label
|
|
|
122
122
|
|---|---|---|---|
|
|
123
123
|
| `auto` | As wide as the content, between `--prime-panel-min-width` and twice that | Most panels | yes |
|
|
124
124
|
| `trigger` | Exactly as wide as the trigger, below the minimum too; text wraps | Full-width triggers in narrow columns | |
|
|
125
|
+
| `min-trigger` | As `auto`, never narrower than the trigger | A panel under a wide anchor that must stay readable when the anchor is narrow ([SmartFilter](../smart-filter/COMPONENT.md)) | |
|
|
125
126
|
| `content` | What the content needs, within the viewport | A wide calendar, a table of limits | |
|
|
126
127
|
|
|
127
128
|
A bottom sheet is always full width, whatever `width` says.
|
|
@@ -185,7 +186,7 @@ No `labels`.
|
|
|
185
186
|
| [structure.tsx](examples/structure.tsx) | Optional parts: a panel with plain text only, and a panel with a title, a description and actions — `Popover.Header`, `Popover.Actions`. |
|
|
186
187
|
| [sizes.tsx](examples/sizes.tsx) | Every size tier with a header and actions; the tier is the panel's own, set on `Popover.Content`, not taken from its trigger — `size`. |
|
|
187
188
|
| [placement.tsx](examples/placement.tsx) | Every side and alignment relative to the trigger; near the viewport edge the panel flips and shifts — `side`, `align`. |
|
|
188
|
-
| [width.tsx](examples/width.tsx) | In a narrow column the panel takes the exact width of a full-width trigger and its text wraps; a table of limits takes the width it needs — `width`. |
|
|
189
|
+
| [width.tsx](examples/width.tsx) | In a narrow column the panel takes the exact width of a full-width trigger and its text wraps; a short trigger opens a panel at least as wide as itself; a table of limits takes the width it needs — `width`. |
|
|
189
190
|
| [flush.tsx](examples/flush.tsx) | A notification list whose rows and dividers reach the panel edges; each row brings its own padding — `flush`. |
|
|
190
191
|
| [from-menu.tsx](examples/from-menu.tsx) | A menu command opens a panel at the same button: the rename item shows a form anchored to the menu button and focus lands in its field, not back on that button — `Popover.Anchor`, `initialFocus`. |
|
|
191
192
|
| [dismiss.tsx](examples/dismiss.tsx) | A note being typed is not lost to a stray click: the panel closes only from its buttons, and not at all while the note is saved — `closeOnOutsideClick`, `closeOnEscape`. |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** In a narrow column the panel takes the exact width of a full-width trigger and its text wraps; a table of limits takes the width it needs — `width`. */
|
|
1
|
+
/** In a narrow column the panel takes the exact width of a full-width trigger and its text wraps; a short trigger opens a panel at least as wide as itself; a table of limits takes the width it needs — `width`. */
|
|
2
2
|
import { Button, DescriptionList, Popover, Typography } from "prime-ui-kit";
|
|
3
3
|
|
|
4
4
|
import styles from "./examples.module.css";
|
|
@@ -24,6 +24,18 @@ export default function PopoverWidthExample() {
|
|
|
24
24
|
</Typography>
|
|
25
25
|
</Popover.Content>
|
|
26
26
|
</Popover.Root>
|
|
27
|
+
<Popover.Root>
|
|
28
|
+
<Popover.Trigger>
|
|
29
|
+
<Button.Root variant="soft" tone="neutral" fullWidth>
|
|
30
|
+
Что входит в поддержку
|
|
31
|
+
</Button.Root>
|
|
32
|
+
</Popover.Trigger>
|
|
33
|
+
<Popover.Content width="min-trigger">
|
|
34
|
+
<Typography variant="body-s" tone="secondary">
|
|
35
|
+
Ответ в течение 4 часов, персональный менеджер и разбор инцидентов.
|
|
36
|
+
</Typography>
|
|
37
|
+
</Popover.Content>
|
|
38
|
+
</Popover.Root>
|
|
27
39
|
<Popover.Root>
|
|
28
40
|
<Popover.Trigger>
|
|
29
41
|
<Button.Root variant="ghost" tone="neutral" fullWidth>
|
|
@@ -60,7 +60,7 @@ Slider field frame (FieldFrame): className, ref, rest
|
|
|
60
60
|
| `optional` | `boolean` | — | Muted marker right after the label text (`labels.optional`). |
|
|
61
61
|
| `hint` | `ReactNode` | — | Help text under the track (`aria-describedby`). Hidden while `error` is shown. |
|
|
62
62
|
| `error` | `ReactNode` | — | Error message in the hint slot; implies `invalid`. |
|
|
63
|
-
| `invalid` | `boolean` | — | `aria-invalid` on the range input and a danger focus ring on the thumb. A non-empty `error` implies it. |
|
|
63
|
+
| `invalid` | `boolean` | — | `aria-invalid` on the range input, a danger fill (over any `tone`) and a danger focus ring on the thumb. A non-empty `error` implies it. |
|
|
64
64
|
| `showValue` | `boolean` | `false` | Shows the current value at the end of the label row (tabular numbers, `aria-hidden` — the input announces it). |
|
|
65
65
|
| `formatValue` | `(value: number) => string` | — | Formats the shown value and `aria-valuetext` (units, currency). |
|
|
66
66
|
| `id` | `string` | — | Id of the range input (generated when omitted); hint id is `<id>-hint`, error id is `<id>-error`. |
|
|
@@ -121,10 +121,10 @@ Tone never carries meaning alone: the label names what the value means.
|
|
|
121
121
|
|---|---|---|
|
|
122
122
|
| default | — | `data-size`, `data-tone` (`data-orientation="vertical"` when upright); track `fill-strong`, tone pill up to the thumb centre, opaque thumb |
|
|
123
123
|
| hover | pointer (fine pointers only) | light liquid glass: the thumb grows to 110%, turns translucent and slightly frosted |
|
|
124
|
-
| invalid | `invalid` or a non-empty `error` | `data-invalid="true"` on the root, `aria-invalid` on the input; the error replaces the hint, danger focus ring; the control shakes once when an error arrives (`data-shake` on the frame) |
|
|
124
|
+
| invalid | `invalid` or a non-empty `error` | `data-invalid="true"` on the root, `aria-invalid` on the input; the error replaces the hint, danger fill over any `tone`, danger focus ring; the control shakes once when an error arrives (`data-shake` on the frame) |
|
|
125
125
|
| pressed | dragging | clear glass: the thumb grows to 125%, the rounded end of the fill shows through |
|
|
126
126
|
| focus-visible | keyboard | outer focus ring around the thumb |
|
|
127
|
-
| disabled | `disabled` | `data-disabled="true"` on the root, native `disabled`; muted track and fill, flat thumb, `cursor: not-allowed` |
|
|
127
|
+
| disabled | `disabled` | `data-disabled="true"` on the root, native `disabled`; muted track and fill, a flat opaque thumb, `cursor: not-allowed` |
|
|
128
128
|
| saving | `onCommit` returned a pending promise | `data-pending="true"` on the root, `aria-busy` on the input; the thumb quiets to 0.6 (`fast`, both ways); the slider stays usable — only the latest commit's answer counts |
|
|
129
129
|
| refused | that promise rejected | the value goes back to the last saved one (`onValueChange` when controlled); `data-settling` glides the thumb and the fill there (`base`, emphasized) |
|
|
130
130
|
|
|
@@ -3,19 +3,23 @@ import { Slider } from "prime-ui-kit";
|
|
|
3
3
|
|
|
4
4
|
export default function SliderStatesExample() {
|
|
5
5
|
return (
|
|
6
|
-
|
|
6
|
+
<>
|
|
7
7
|
<div>
|
|
8
|
-
<
|
|
8
|
+
<div>
|
|
9
|
+
<Slider label="min" showValue defaultValue={0} />
|
|
10
|
+
</div>
|
|
11
|
+
<div>
|
|
12
|
+
<Slider label="max" showValue defaultValue={100} />
|
|
13
|
+
</div>
|
|
9
14
|
</div>
|
|
10
15
|
<div>
|
|
11
|
-
<
|
|
16
|
+
<div>
|
|
17
|
+
<Slider label="invalid" showValue defaultValue={90} invalid />
|
|
18
|
+
</div>
|
|
19
|
+
<div>
|
|
20
|
+
<Slider label="disabled" showValue defaultValue={35} disabled />
|
|
21
|
+
</div>
|
|
12
22
|
</div>
|
|
13
|
-
|
|
14
|
-
<Slider label="invalid" showValue defaultValue={90} invalid />
|
|
15
|
-
</div>
|
|
16
|
-
<div>
|
|
17
|
-
<Slider label="disabled" showValue defaultValue={35} disabled />
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
23
|
+
</>
|
|
20
24
|
);
|
|
21
25
|
}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
- An API that takes one value per field (`multiple: false`), a screen whose text search lives elsewhere (`searchable={false}`), values of different kinds in one field (`group`).
|
|
14
14
|
|
|
15
15
|
## When not to use
|
|
16
|
-
- One field with a few options → use [SegmentedControl](../segmented-control/COMPONENT.md), [Select](../select/COMPONENT.md) or [TagSelect](../tag-select/COMPONENT.md) in the
|
|
16
|
+
- One field with a few options → use [SegmentedControl](../segmented-control/COMPONENT.md), [Select](../select/COMPONENT.md) or [TagSelect](../tag-select/COMPONENT.md) in the page's `Page.Tools`.
|
|
17
17
|
- A search outside a table or list page (inside a picker, a settings section, a panel) → [Input](../input/COMPONENT.md) with a search icon. Over a table or list page the search is SmartFilter even with no fields yet (`fields={[]}`): it grows into filters without a rebuild.
|
|
18
18
|
- Choosing values for a form field → use [TagSelect](../tag-select/COMPONENT.md).
|
|
19
|
-
- One period that drives a whole dashboard → [Datepicker](../datepicker/COMPONENT.md) in the page
|
|
19
|
+
- One period that drives a whole dashboard → [Datepicker](../datepicker/COMPONENT.md) in the page's `Page.Tools`; SmartFilter ranges filter rows of a list.
|
|
20
20
|
|
|
21
21
|
## Import
|
|
22
22
|
```tsx
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
|
|
31
31
|
## Anatomy
|
|
32
32
|
```
|
|
33
|
-
SmartFilter.Root state + context
|
|
33
|
+
SmartFilter.Root state + context, no DOM
|
|
34
34
|
├─ SmartFilter.Toolbar [search Input (searchable)] [filter Button (count Badge)] — the anchor of the panel
|
|
35
35
|
│ └─ panel flush Popover as wide as the toolbar; sections split by Dividers
|
|
36
36
|
│ ├─ query row ghost Button «Искать «text»» + Kbd ↵, while typing
|
|
@@ -41,14 +41,14 @@ SmartFilter.Root state + context (flex column)
|
|
|
41
41
|
│ └─ footer hint · count · Reset Button
|
|
42
42
|
└─ SmartFilter.Chips applied filters as removable Badges · add / clear all Buttons
|
|
43
43
|
```
|
|
44
|
-
The toolbar and the chips are separate parts so a page can put them in different places; both only need to be inside `Root
|
|
44
|
+
The toolbar and the chips are separate parts so a page can put them in different places; both only need to be inside `Root`, which draws nothing of its own.
|
|
45
45
|
|
|
46
46
|
## API
|
|
47
47
|
|
|
48
48
|
<!-- Generated from api.ts by `bun run docs:build`. Edit api.ts, not this section. -->
|
|
49
49
|
|
|
50
50
|
### SmartFilter.Root
|
|
51
|
-
|
|
51
|
+
No DOM, no ref. The value, the search and the panel state shared by its parts; the host places the parts.
|
|
52
52
|
|
|
53
53
|
| Prop | Type | Default | Description |
|
|
54
54
|
|---|---|---|---|
|
|
@@ -62,11 +62,10 @@ The toolbar and the chips are separate parts so a page can put them in different
|
|
|
62
62
|
| `size` | `"xs" \| "s" \| "m" \| "l" \| "xl"` | host tier, else `"m"` | Tier of the filter button, the search, the tags and the panel. Without it the tier of its host, else `m`. |
|
|
63
63
|
| `collapsedLimit` | `number` | `12` | Values of one field shown before «Ещё N» (not while searching). |
|
|
64
64
|
| `labels` | `Partial<SmartFilterLabels>` | — | Built-in strings, see Labels. |
|
|
65
|
-
| `children` | `ReactNode` | — (required) | `SmartFilter.Toolbar` and `SmartFilter.Chips`, anywhere inside. |
|
|
66
|
-
| `…rest` | `Omit<HTMLAttributes<HTMLDivElement>, "children" \| "defaultValue" \| "onChange">` | — | `className` and the other div attributes. |
|
|
65
|
+
| `children` | `ReactNode` | — (required) | `SmartFilter.Toolbar` and `SmartFilter.Chips`, anywhere inside — in a page bar the Root wraps `Page.Root`. |
|
|
67
66
|
|
|
68
67
|
### SmartFilter.Toolbar
|
|
69
|
-
`ref` → `HTMLDivElement`. A `<div>`: the search Input first, then the filter Button (a count Badge while filters apply); the anchor of the panel, a flush Popover.
|
|
68
|
+
`ref` → `HTMLDivElement`. A `<div>`: the search Input first, then the filter Button (a count Badge while filters apply), which shows only its icon and count when the search would get too little room; the anchor of the panel, a flush Popover.
|
|
70
69
|
|
|
71
70
|
| Prop | Type | Default | Description |
|
|
72
71
|
|---|---|---|---|
|
|
@@ -165,15 +164,16 @@ same height and type.
|
|
|
165
164
|
| range inverted | `from` above `to` | both bound inputs `aria-invalid` with the danger ring; nothing matches |
|
|
166
165
|
| single value | `multiple: false` | at most one value `aria-pressed`; no «−» |
|
|
167
166
|
| no filters | empty value | no count on the button, no Chips |
|
|
167
|
+
| compact button | the toolbar narrower than the search's 9rem plus the labelled button (search and fields both present) | the button shows its icon and the count Badge; its name stays «Фильтр» (`aria-label` without filters, a visually hidden label with them) |
|
|
168
168
|
|
|
169
169
|
## Layout & spacing
|
|
170
|
-
- The panel is a flush Popover as wide as the toolbar; every section is a full-width row with its own padding (`--prime-space-3` × `--prime-space-4`, footer `--prime-space-2` × `--prime-space-4`), Dividers run edge to edge, the field label column is `--prime-space-24
|
|
171
|
-
- The toolbar is one row of controls (`--prime-space-2` gap): the search first, growing from 9rem (`--prime-space-24` × 1.5), then the filter button at its own width. When less than 9rem is left beside the button, the button
|
|
170
|
+
- The panel is a flush Popover at least as wide as the toolbar (`width="min-trigger"`), by its content up to twice the panel minimum when the toolbar is narrow; every section is a full-width row with its own padding (`--prime-space-3` × `--prime-space-4`, footer `--prime-space-2` × `--prime-space-4`), Dividers run edge to edge, the field label column is at least `--prime-space-24` (a longer name takes its own width, never breaking inside a word); a row narrower than 24rem stacks the label over the values (an intrinsic wrap, no breakpoint).
|
|
171
|
+
- The toolbar is one row of controls (`--prime-space-2` gap): the search first, growing from 9rem (`--prime-space-24` × 1.5), then the filter button at its own width. When less than 9rem is left beside the labelled button, the button shows only its icon and count and stays beside the search, which gives its width instead of wrapping. Every row stays one control high. The search and the button also stand alone: `searchable={false}` keeps the button, empty `fields` keep the search. Search first, filter second — the active filters (`SmartFilter.Chips`) sit under them.
|
|
172
172
|
- Chips are Badges of the toolbar tier on the badge scale (`xs` → `s`), so a tag sits lower than the controls above it; «Добавить фильтр» is a tag of the same tier and «Сбросить все» a LinkButton with the tag's text size.
|
|
173
173
|
- Values and chips wrap with `--prime-space-2` gaps; «Сбросить все» is pushed to the end. The chips row rises in with the first filter and closes up in place with the last (`partPresence`).
|
|
174
174
|
- Option groups stack `--prime-space-3` apart, a caption `--prime-space-1` above each group's values. A range row holds two equal Inputs with a dash between them, centred on the field label.
|
|
175
175
|
- While typing a search a range row stays only when its field name matches.
|
|
176
|
-
- The root
|
|
176
|
+
- The root draws nothing: its host places Toolbar and Chips. In a page bar the Toolbar goes in `Page.Tools` and the Chips in `Page.Chips`, with `SmartFilter.Root` around `Page.Root`; outside a page a host stacks them (a `Card.Body`, a form column).
|
|
177
177
|
|
|
178
178
|
## Accessibility
|
|
179
179
|
|
|
@@ -244,7 +244,7 @@ same height and type.
|
|
|
244
244
|
- A fixed field marked `finite: false` → the user can hide every value and get an empty list.
|
|
245
245
|
- Filtering the list with `includes` → use `matchesSmartFilter` (empty `include` is "any", `exclude` rejects; range bounds are inclusive, dates by whole days; an item with no value passes only an empty filter).
|
|
246
246
|
- Sending `include` to a server for a hidden value of a fixed field → use `resolveSmartFilterValues` («hide» becomes «all except», `[]` means no filter).
|
|
247
|
-
- Putting `Chips` outside `SmartFilter.Root` → every part needs the root.
|
|
247
|
+
- Putting `Chips` outside `SmartFilter.Root` → every part needs the root; when Toolbar and Chips stand in different groups of a page bar, wrap `Page.Root` in it.
|
|
248
248
|
- A second row of filter buttons next to the toolbar → fields belong in `fields`.
|
|
249
249
|
- An amount or a period in its own Popover beside the toolbar → a `range` / `date-range` field; it gets a chip and the count.
|
|
250
250
|
- One field split in two because its values are of different kinds → one field with `group` on the options.
|
|
@@ -252,4 +252,4 @@ same height and type.
|
|
|
252
252
|
|
|
253
253
|
## Related
|
|
254
254
|
- **Built from:** [Button](../button/COMPONENT.md), [Badge](../badge/COMPONENT.md), [Input](../input/COMPONENT.md), [Datepicker](../datepicker/COMPONENT.md), [Popover](../popover/COMPONENT.md), [Divider](../divider/COMPONENT.md), [Kbd](../kbd/COMPONENT.md), [EmptyPage](../empty-page/COMPONENT.md), [LinkButton](../link-button/COMPONENT.md), [Typography](../typography/COMPONENT.md), Icon (`action.search`, `action.filter`, `action.add`, `nav.chevronDown`), [VisuallyHidden](../visually-hidden/COMPONENT.md)
|
|
255
|
-
- **See also:** [
|
|
255
|
+
- **See also:** [Page](../../layout/page/COMPONENT.md) (`Page.Tools`, `Page.Chips`), [TagSelect](../tag-select/COMPONENT.md), [DataTable](../data-table/COMPONENT.md)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** An open set of twenty services, degraded ones marked with an icon, collapsed after eight; typing narrows the panel and marks the match in accent — `finite`, `icon`, `collapsedLimit`. */
|
|
2
2
|
import { Icon, SmartFilter, type SmartFilterField } from "prime-ui-kit";
|
|
3
3
|
|
|
4
|
+
import styles from "./examples.module.css";
|
|
5
|
+
|
|
4
6
|
const SERVICES = [
|
|
5
7
|
"access-policy",
|
|
6
8
|
"billing",
|
|
@@ -41,13 +43,15 @@ const FIELDS: SmartFilterField[] = [
|
|
|
41
43
|
|
|
42
44
|
export default function SmartFilterManyValuesExample() {
|
|
43
45
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
<div className={styles.stack}>
|
|
47
|
+
<SmartFilter.Root
|
|
48
|
+
fields={FIELDS}
|
|
49
|
+
collapsedLimit={8}
|
|
50
|
+
defaultValue={{ service: { include: [], exclude: ["events"] } }}
|
|
51
|
+
>
|
|
52
|
+
<SmartFilter.Toolbar />
|
|
53
|
+
<SmartFilter.Chips />
|
|
54
|
+
</SmartFilter.Root>
|
|
55
|
+
</div>
|
|
52
56
|
);
|
|
53
57
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Every size tier: the filter button, the search, the tags and the panel follow one tier — `size`. */
|
|
2
|
-
import { SmartFilter, type SmartFilterField, Typography } from "prime-ui-kit";
|
|
2
|
+
import { Card, SmartFilter, type SmartFilterField, Typography } from "prime-ui-kit";
|
|
3
3
|
|
|
4
4
|
const FIELDS: SmartFilterField[] = [
|
|
5
5
|
{
|
|
@@ -18,8 +18,12 @@ export default function SmartFilterSizesExample() {
|
|
|
18
18
|
{SIZES.map((size) => (
|
|
19
19
|
<div key={size}>
|
|
20
20
|
<SmartFilter.Root fields={FIELDS} size={size} defaultValue={ONLY_GET}>
|
|
21
|
-
<
|
|
22
|
-
|
|
21
|
+
<Card.Root>
|
|
22
|
+
<Card.Body>
|
|
23
|
+
<SmartFilter.Toolbar />
|
|
24
|
+
<SmartFilter.Chips />
|
|
25
|
+
</Card.Body>
|
|
26
|
+
</Card.Root>
|
|
23
27
|
</SmartFilter.Root>
|
|
24
28
|
<Typography as="span" variant="caption" tone="muted">
|
|
25
29
|
{size}
|
|
@@ -133,6 +133,7 @@ Put it in a `Card` for a dashboard tile.
|
|
|
133
133
|
- Bars share the width equally, 4 px apart; the zero line sits where 0 falls on the scale (the bottom when every value is positive).
|
|
134
134
|
- In a dashboard, wrap it in `Card.Root` + `Card.Body`; several cards go in a grid.
|
|
135
135
|
- When the value row does not fit (a narrow card), the change badge wraps under the value.
|
|
136
|
+
- On a head narrower than 20rem (a phone card) the date takes its own line under the title, which wraps instead of being cut; the break follows the width only, so a date that changes while scrubbing never moves it.
|
|
136
137
|
- `layout="compact"` fits a DataTable row of any tier (plot and dot within an `xs` control height) and takes the cell width, at least `--prime-space-24`; give the column a `width` for an even plot per row. Put the number next to it in its own column: the compact plot shows a value only in its tooltip while scrubbed.
|
|
137
138
|
- The tooltip is the kit's chart tooltip, placed like every anchored layer (`usePosition`): right of the pointer at its height, on the left only where the right has no room in the viewport — crossing the middle never moves it; from the keyboard right of the point at mid-height. Portaled, so a card or a table scroller never clips it.
|
|
138
139
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** The same month of active users as a smooth curve, straight segments and steps — `curve`. */
|
|
2
|
-
import { Sparkline, type SparklinePoint
|
|
2
|
+
import { Card, Sparkline, type SparklinePoint } from "prime-ui-kit";
|
|
3
|
+
|
|
4
|
+
import styles from "./examples.module.css";
|
|
3
5
|
|
|
4
6
|
const USERS: SparklinePoint[] = [
|
|
5
7
|
{ label: "сен, 1 нед.", value: 1240 },
|
|
@@ -10,19 +12,22 @@ const USERS: SparklinePoint[] = [
|
|
|
10
12
|
{ label: "окт, 2 нед.", value: 1840 },
|
|
11
13
|
];
|
|
12
14
|
|
|
13
|
-
const CURVES = [
|
|
15
|
+
const CURVES = [
|
|
16
|
+
{ curve: "smooth", title: "Плавная кривая" },
|
|
17
|
+
{ curve: "linear", title: "Прямые отрезки" },
|
|
18
|
+
{ curve: "step", title: "Ступени" },
|
|
19
|
+
] as const;
|
|
14
20
|
|
|
15
21
|
export default function SparklineCurveExample() {
|
|
16
22
|
return (
|
|
17
|
-
|
|
18
|
-
{CURVES.map((curve) => (
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</div>
|
|
23
|
+
<>
|
|
24
|
+
{CURVES.map(({ curve, title }) => (
|
|
25
|
+
<Card.Root key={curve} className={styles.card}>
|
|
26
|
+
<Card.Body>
|
|
27
|
+
<Sparkline data={USERS} label={title} curve={curve} />
|
|
28
|
+
</Card.Body>
|
|
29
|
+
</Card.Root>
|
|
25
30
|
))}
|
|
26
|
-
|
|
31
|
+
</>
|
|
27
32
|
);
|
|
28
33
|
}
|
|
@@ -12,19 +12,23 @@ const formatRubles = (value: number) => `${value.toLocaleString("ru-RU")} ₽`;
|
|
|
12
12
|
|
|
13
13
|
export default function SparklineStatesExample() {
|
|
14
14
|
return (
|
|
15
|
-
|
|
15
|
+
<>
|
|
16
16
|
<div>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
<div>
|
|
18
|
+
<Sparkline data={REVENUE} label="Выручка" formatValue={formatRubles} />
|
|
19
|
+
<Typography as="span" variant="caption" tone="muted">
|
|
20
|
+
data
|
|
21
|
+
</Typography>
|
|
22
|
+
</div>
|
|
21
23
|
</div>
|
|
22
24
|
<div>
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
<div>
|
|
26
|
+
<Sparkline data={[]} label="Выручка" loading />
|
|
27
|
+
<Typography as="span" variant="caption" tone="muted">
|
|
28
|
+
loading
|
|
29
|
+
</Typography>
|
|
30
|
+
</div>
|
|
27
31
|
</div>
|
|
28
|
-
|
|
32
|
+
</>
|
|
29
33
|
);
|
|
30
34
|
}
|
|
@@ -97,7 +97,7 @@ No `variant` / `tone` / `color`.
|
|
|
97
97
|
| off | `checked={false}` / default | `data-state="unchecked"`; track `fill-strong` (hover `fill-strong-hover`), thumb at the start |
|
|
98
98
|
| on | `checked` / `defaultChecked` | `data-state="checked"`; accent track, the thumb glides to the end |
|
|
99
99
|
| invalid | `invalid` or a non-empty `error` | `data-invalid="true"`, `aria-invalid`; danger ring on the off track and on focus; the row shakes once when an error arrives (`data-shake`) |
|
|
100
|
-
| disabled | `disabled` | `data-disabled="true"`; off track `fill-muted`, on track `accent-soft`, `cursor: not-allowed` |
|
|
100
|
+
| disabled | `disabled` | `data-disabled="true"`; off track `fill-muted`, on track `accent-soft`, thumb `control-thumb-disabled` without shadow, `cursor: not-allowed` |
|
|
101
101
|
| read-only | `readOnly` | `aria-readonly="true"` on the input, `data-readonly="true"` on the field; no hover or press, default cursor |
|
|
102
102
|
| saving | `loading`, or `onCheckedChange` returned a pending promise | the thumb stands in the new position with a `Spinner` inside (accent when on, muted when off; it fades in by itself), `aria-busy` on the input, `data-loading` on the track, presses ignored; a rejection glides the thumb back (`base`, emphasized) |
|
|
103
103
|
| pressed | pointer press | the track scales to the compact press scale (not when disabled or read-only) |
|
|
@@ -189,7 +189,7 @@ Avoid icons or descriptions on only some tabs (uneven rows; without an icon on e
|
|
|
189
189
|
| closing, confirm pending | `onRemove` returned a promise that has not settled | the close button is `loading` (`aria-busy`); the tab, its selection and focus stay; resolved → the neighbour takes over, rejected → nothing changes |
|
|
190
190
|
| two-line | `Tabs.Description` child | `data-two-line="true"` |
|
|
191
191
|
| collapsed | tabs wider than the list, or a label that would be cut (horizontal) | list `data-collapse="full" \| "compact" \| "icon"`: `compact` hides icons and descriptions; `icon` takes labels, counts and close buttons out of the row — a `VisuallyHidden` copy of the label names the tab and a `Tooltip` shows it — only when every tab has an icon |
|
|
192
|
-
| overflow | tabs at their narrowest (content width, `minItemWidth` or icon squares) still wider than the list | `data-overflow-start` / `data-overflow-end` on the list (the switcher row, a ScrollContainer), faded edges as deep as the hidden part at most (they grow and melt with the scroll, never switch); the active tab is kept in view and clear of the fades on mount and on every value change, the first and the last tab scroll all the way to the end — only the list scrolls, never the page. A column (a wide vertical list) has plain edges |
|
|
192
|
+
| overflow | tabs at their narrowest (content width, `minItemWidth` or icon squares) still wider than the list | `data-overflow-start` / `data-overflow-end` on the list (the switcher row, a ScrollContainer), faded edges as deep as the hidden part at most (they grow and melt with the scroll, never switch); when the end edge would cut only a tab's empty side, the tabs at `minItemWidth` widen a little (`--tabs-peek`, up to 30%) so a label fades out at the edge and shows that more tabs follow; the active tab is kept in view and clear of the fades on mount and on every value change, the first and the last tab scroll all the way to the end — only the list scrolls, never the page. A column (a wide vertical list) has plain edges |
|
|
193
193
|
|
|
194
194
|
The indicator glides (`emphasized` + `base`, `data-animate="true"`) only into a choice by click, arrow keys or closing the active tab; on mount, a value set from outside, a resize, font loading, tabs added or removed and collapse it is placed without motion, and it stays still under `prefers-reduced-motion`. The list scrolls smoothly to the active tab only after such a choice too.
|
|
195
195
|
|
|
@@ -94,7 +94,7 @@ Text has no interactive states.
|
|
|
94
94
|
- No outer margins: spacing comes from the parent's `gap`.
|
|
95
95
|
- Title, heading and display roles balance their lines (`text-wrap-style: balance`); body and caption avoid a lone last word (`pretty`). Long words break (`overflow-wrap: break-word`).
|
|
96
96
|
- `code` uses the mono family (JetBrains Mono); every other role the sans family (Golos Text).
|
|
97
|
-
- Reading text: cap the column at the reading measure (
|
|
97
|
+
- Reading text: cap the column at the reading measure (`Page.Root maxWidth="readable"`, 60–75 characters).
|
|
98
98
|
- `truncate` needs a block element and a shrinking parent (`min-width: 0` in flex rows).
|
|
99
99
|
|
|
100
100
|
## Accessibility
|
|
@@ -138,4 +138,4 @@ No `labels`.
|
|
|
138
138
|
|
|
139
139
|
## Related
|
|
140
140
|
- **Built from:** —
|
|
141
|
-
- **See also:** [LinkButton](../link-button/COMPONENT.md), [CodeBlock](../code-block/COMPONENT.md), [Label](../label/COMPONENT.md), [
|
|
141
|
+
- **See also:** [LinkButton](../link-button/COMPONENT.md), [CodeBlock](../code-block/COMPONENT.md), [Label](../label/COMPONENT.md), [Page](../../layout/page/COMPONENT.md)
|