@nanisoft/prism-ui 0.10.2 → 0.13.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/LICENSE +21 -21
- package/dist/.tsbuildinfo +1 -1
- package/dist/blocks/app-shell-01/app-shell.js +4 -4
- package/dist/blocks/app-shell-01/index.d.ts +2 -2
- package/dist/blocks/app-shell-01/index.js +1 -1
- package/dist/blocks/auth-form-01/auth-form.d.ts +11 -1
- package/dist/blocks/auth-form-01/auth-form.d.ts.map +1 -1
- package/dist/blocks/auth-form-01/auth-form.js +11 -8
- package/dist/blocks/auth-form-01/index.d.ts +2 -2
- package/dist/blocks/auth-form-01/index.js +1 -1
- package/dist/blocks/cta-01/cta.d.ts +26 -21
- package/dist/blocks/cta-01/cta.d.ts.map +1 -1
- package/dist/blocks/cta-01/cta.js +2 -2
- package/dist/blocks/cta-01/index.d.ts +2 -2
- package/dist/blocks/cta-01/index.js +1 -1
- package/dist/blocks/data-table-01/data-table.js +7 -7
- package/dist/blocks/data-table-01/index.d.ts +2 -2
- package/dist/blocks/data-table-01/index.js +1 -1
- package/dist/blocks/empty-state-01/empty-state.d.ts +143 -0
- package/dist/blocks/empty-state-01/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state-01/empty-state.js +104 -0
- package/dist/blocks/empty-state-01/index.d.ts +3 -0
- package/dist/blocks/empty-state-01/index.d.ts.map +1 -0
- package/dist/blocks/empty-state-01/index.js +1 -0
- package/dist/blocks/feature-grid-01/feature-grid.d.ts +28 -1
- package/dist/blocks/feature-grid-01/feature-grid.d.ts.map +1 -1
- package/dist/blocks/feature-grid-01/feature-grid.js +34 -3
- package/dist/blocks/feature-grid-01/index.d.ts +2 -2
- package/dist/blocks/feature-grid-01/index.js +1 -1
- package/dist/blocks/hero-01/hero.d.ts +35 -15
- package/dist/blocks/hero-01/hero.d.ts.map +1 -1
- package/dist/blocks/hero-01/hero.js +14 -9
- package/dist/blocks/hero-01/index.d.ts +2 -1
- package/dist/blocks/hero-01/index.d.ts.map +1 -1
- package/dist/blocks/hero-01/index.js +1 -1
- package/dist/blocks/index.d.ts +20 -20
- package/dist/blocks/index.js +19 -19
- package/dist/blocks/instrument-panel-01/index.d.ts +2 -2
- package/dist/blocks/instrument-panel-01/index.js +1 -1
- package/dist/blocks/instrument-panel-01/instrument-panel.js +1 -1
- package/dist/blocks/logo-strip-01/index.d.ts +2 -2
- package/dist/blocks/logo-strip-01/index.js +1 -1
- package/dist/blocks/logo-strip-01/logo-strip.d.ts +1 -1
- package/dist/blocks/logo-strip-01/logo-strip.js +2 -2
- package/dist/blocks/note-grid-01/index.d.ts +2 -2
- package/dist/blocks/note-grid-01/index.js +1 -1
- package/dist/blocks/note-grid-01/note-grid.d.ts +1 -1
- package/dist/blocks/note-grid-01/note-grid.js +1 -1
- package/dist/blocks/page-header-01/index.d.ts +2 -2
- package/dist/blocks/page-header-01/index.js +1 -1
- package/dist/blocks/page-header-01/page-header.d.ts +1 -1
- package/dist/blocks/page-header-01/page-header.js +4 -4
- package/dist/blocks/pricing-01/index.d.ts +1 -1
- package/dist/blocks/pricing-01/index.js +1 -1
- package/dist/blocks/pricing-01/pricing.d.ts +8 -1
- package/dist/blocks/pricing-01/pricing.d.ts.map +1 -1
- package/dist/blocks/pricing-01/pricing.js +15 -5
- package/dist/blocks/process-flow-01/index.d.ts +3 -0
- package/dist/blocks/process-flow-01/index.d.ts.map +1 -0
- package/dist/blocks/process-flow-01/index.js +1 -0
- package/dist/blocks/process-flow-01/process-flow.d.ts +118 -0
- package/dist/blocks/process-flow-01/process-flow.d.ts.map +1 -0
- package/dist/blocks/process-flow-01/process-flow.js +71 -0
- package/dist/blocks/process-rail-01/index.d.ts +2 -2
- package/dist/blocks/process-rail-01/index.js +1 -1
- package/dist/blocks/process-rail-01/process-rail.d.ts +1 -1
- package/dist/blocks/process-rail-01/process-rail.js +2 -2
- package/dist/blocks/product-grid-01/index.d.ts +2 -2
- package/dist/blocks/product-grid-01/index.js +1 -1
- package/dist/blocks/product-grid-01/product-grid.d.ts +37 -5
- package/dist/blocks/product-grid-01/product-grid.d.ts.map +1 -1
- package/dist/blocks/product-grid-01/product-grid.js +20 -6
- package/dist/blocks/run-console-01/index.d.ts +3 -0
- package/dist/blocks/run-console-01/index.d.ts.map +1 -0
- package/dist/blocks/run-console-01/index.js +1 -0
- package/dist/blocks/run-console-01/run-console.d.ts +111 -0
- package/dist/blocks/run-console-01/run-console.d.ts.map +1 -0
- package/dist/blocks/run-console-01/run-console.js +48 -0
- package/dist/blocks/settings-panel-01/index.d.ts +2 -2
- package/dist/blocks/settings-panel-01/index.js +1 -1
- package/dist/blocks/settings-panel-01/settings-panel.d.ts +11 -1
- package/dist/blocks/settings-panel-01/settings-panel.d.ts.map +1 -1
- package/dist/blocks/settings-panel-01/settings-panel.js +15 -10
- package/dist/blocks/site-footer/index.d.ts +2 -2
- package/dist/blocks/site-footer/index.js +1 -1
- package/dist/blocks/site-footer/site-footer.d.ts +1 -1
- package/dist/blocks/site-footer/site-footer.js +2 -2
- package/dist/blocks/site-header/index.d.ts +2 -2
- package/dist/blocks/site-header/index.js +1 -1
- package/dist/blocks/site-header/site-header.d.ts +2 -2
- package/dist/blocks/site-header/site-header.js +3 -3
- package/dist/blocks/site-navbar/index.d.ts +3 -0
- package/dist/blocks/site-navbar/index.d.ts.map +1 -0
- package/dist/blocks/site-navbar/index.js +1 -0
- package/dist/blocks/site-navbar/mobile-nav.d.ts +48 -0
- package/dist/blocks/site-navbar/mobile-nav.d.ts.map +1 -0
- package/dist/blocks/site-navbar/mobile-nav.js +35 -0
- package/dist/blocks/site-navbar/mode-toggle.d.ts +39 -0
- package/dist/blocks/site-navbar/mode-toggle.d.ts.map +1 -0
- package/dist/blocks/site-navbar/mode-toggle.js +39 -0
- package/dist/blocks/site-navbar/navbar-controls.d.ts +79 -0
- package/dist/blocks/site-navbar/navbar-controls.d.ts.map +1 -0
- package/dist/blocks/site-navbar/navbar-controls.js +40 -0
- package/dist/blocks/site-navbar/search-entry.d.ts +29 -0
- package/dist/blocks/site-navbar/search-entry.d.ts.map +1 -0
- package/dist/blocks/site-navbar/search-entry.js +52 -0
- package/dist/blocks/site-navbar/site-navbar.d.ts +212 -0
- package/dist/blocks/site-navbar/site-navbar.d.ts.map +1 -0
- package/dist/blocks/site-navbar/site-navbar.js +61 -0
- package/dist/blocks/site-navbar/sites-menu.d.ts +40 -0
- package/dist/blocks/site-navbar/sites-menu.d.ts.map +1 -0
- package/dist/blocks/site-navbar/sites-menu.js +48 -0
- package/dist/blocks/site-navbar/theme-menu.d.ts +47 -0
- package/dist/blocks/site-navbar/theme-menu.d.ts.map +1 -0
- package/dist/blocks/site-navbar/theme-menu.js +55 -0
- package/dist/blocks/stack-grid-01/index.d.ts +2 -2
- package/dist/blocks/stack-grid-01/index.js +1 -1
- package/dist/blocks/stack-grid-01/stack-grid.d.ts +42 -11
- package/dist/blocks/stack-grid-01/stack-grid.d.ts.map +1 -1
- package/dist/blocks/stack-grid-01/stack-grid.js +15 -7
- package/dist/blocks/stats-01/index.d.ts +9 -1
- package/dist/blocks/stats-01/index.d.ts.map +1 -1
- package/dist/blocks/stats-01/index.js +8 -1
- package/dist/blocks/stats-01/stats.d.ts +1 -1
- package/dist/blocks/stats-01/stats.js +2 -2
- package/dist/blocks/status-ledger-01/index.d.ts +2 -2
- package/dist/blocks/status-ledger-01/index.js +1 -1
- package/dist/blocks/status-ledger-01/status-ledger.d.ts +1 -1
- package/dist/blocks/status-ledger-01/status-ledger.js +2 -2
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +473 -1
- package/dist/components/index.d.ts +104 -66
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +74 -40
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.d.ts +119 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +82 -0
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +60 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +61 -0
- package/dist/components/ui/avatar.js +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/button-group.d.ts +68 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +54 -0
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.d.ts +158 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +216 -0
- package/dist/components/ui/card.d.ts +18 -6
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +23 -8
- package/dist/components/ui/carousel.d.ts +118 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +152 -0
- package/dist/components/ui/chart-frame.d.ts +216 -0
- package/dist/components/ui/chart-frame.d.ts.map +1 -0
- package/dist/components/ui/chart-frame.js +286 -0
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/collapsible.d.ts +97 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +54 -0
- package/dist/components/ui/combobox.d.ts +141 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +243 -0
- package/dist/components/ui/command-palette.d.ts +106 -0
- package/dist/components/ui/command-palette.d.ts.map +1 -0
- package/dist/components/ui/command-palette.js +176 -0
- package/dist/components/ui/command.d.ts +82 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +37 -0
- package/dist/components/ui/context-menu.d.ts +151 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +97 -0
- package/dist/components/ui/cta-link.js +1 -1
- package/dist/components/ui/date-picker.d.ts +111 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/date-picker.js +74 -0
- package/dist/components/ui/diagram.d.ts +84 -15
- package/dist/components/ui/diagram.d.ts.map +1 -1
- package/dist/components/ui/diagram.js +77 -7
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/diff.d.ts +105 -0
- package/dist/components/ui/diff.d.ts.map +1 -0
- package/dist/components/ui/diff.js +113 -0
- package/dist/components/ui/dropdown-menu.d.ts +18 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/fact-list.js +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/form.d.ts +151 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/form.js +73 -0
- package/dist/components/ui/hover-card.d.ts +105 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +49 -0
- package/dist/components/ui/input-group.d.ts +99 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +83 -0
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/item.d.ts +113 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +61 -0
- package/dist/components/ui/kbd.js +1 -1
- package/dist/components/ui/label.d.ts +58 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +29 -0
- package/dist/components/ui/live-region.d.ts +9 -0
- package/dist/components/ui/live-region.d.ts.map +1 -1
- package/dist/components/ui/live-region.js +10 -2
- package/dist/components/ui/mark.js +1 -1
- package/dist/components/ui/menubar.d.ts +197 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/menubar.js +109 -0
- package/dist/components/ui/meter.d.ts +121 -0
- package/dist/components/ui/meter.d.ts.map +1 -0
- package/dist/components/ui/meter.js +82 -0
- package/dist/components/ui/native-select.d.ts +72 -0
- package/dist/components/ui/native-select.d.ts.map +1 -0
- package/dist/components/ui/native-select.js +55 -0
- package/dist/components/ui/navigation-menu.d.ts +186 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +94 -0
- package/dist/components/ui/number-field.d.ts +111 -0
- package/dist/components/ui/number-field.d.ts.map +1 -0
- package/dist/components/ui/number-field.js +84 -0
- package/dist/components/ui/one-time-code.d.ts +127 -0
- package/dist/components/ui/one-time-code.d.ts.map +1 -0
- package/dist/components/ui/one-time-code.js +57 -0
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/product-mark.d.ts +1 -1
- package/dist/components/ui/product-mark.js +1 -1
- package/dist/components/ui/product-switcher.d.ts +1 -1
- package/dist/components/ui/product-switcher.js +2 -2
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/prose.js +1 -1
- package/dist/components/ui/pulse-graph.js +1 -1
- package/dist/components/ui/pulse-series.js +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/resizable.d.ts +129 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +205 -0
- package/dist/components/ui/scroll-area.d.ts +97 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +68 -0
- package/dist/components/ui/search-dialog.d.ts +139 -0
- package/dist/components/ui/search-dialog.d.ts.map +1 -0
- package/dist/components/ui/search-dialog.js +178 -0
- package/dist/components/ui/section.d.ts +26 -0
- package/dist/components/ui/section.d.ts.map +1 -1
- package/dist/components/ui/section.js +32 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sheet.d.ts +103 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +58 -0
- package/dist/components/ui/sidebar.d.ts +228 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +172 -0
- package/dist/components/ui/signal-field.js +1 -1
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/slider.js +1 -1
- package/dist/components/ui/spinner.d.ts +79 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +79 -0
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/table-sort.d.ts +97 -0
- package/dist/components/ui/table-sort.d.ts.map +1 -0
- package/dist/components/ui/table-sort.js +102 -0
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/timeline.d.ts +106 -0
- package/dist/components/ui/timeline.d.ts.map +1 -0
- package/dist/components/ui/timeline.js +111 -0
- package/dist/components/ui/toast.d.ts +219 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +270 -0
- package/dist/components/ui/toggle-group.d.ts +118 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +194 -0
- package/dist/components/ui/toggle.d.ts +73 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +44 -0
- package/dist/components/ui/tooltip.js +1 -1
- package/dist/components/ui/tree.js +1 -1
- package/dist/components/ui/typography.js +1 -1
- package/dist/fonts/Inter-OFL.txt +93 -93
- package/dist/index.d.ts +72 -70
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -60
- package/dist/lib/rank.d.ts +69 -0
- package/dist/lib/rank.d.ts.map +1 -0
- package/dist/lib/rank.js +77 -0
- package/dist/live/index.d.ts +22 -0
- package/dist/live/index.d.ts.map +1 -0
- package/dist/live/index.js +20 -0
- package/dist/live/run-stream-01/index.d.ts +3 -0
- package/dist/live/run-stream-01/index.d.ts.map +1 -0
- package/dist/live/run-stream-01/index.js +1 -0
- package/dist/live/run-stream-01/run-stream.d.ts +125 -0
- package/dist/live/run-stream-01/run-stream.d.ts.map +1 -0
- package/dist/live/run-stream-01/run-stream.js +111 -0
- package/dist/pages/auth-page/index.d.ts +15 -2
- package/dist/pages/auth-page/index.d.ts.map +1 -1
- package/dist/pages/auth-page/index.js +8 -4
- package/dist/pages/blog-post-page/index.js +5 -5
- package/dist/pages/dashboard-page/index.d.ts +4 -4
- package/dist/pages/dashboard-page/index.js +4 -4
- package/dist/pages/docs-shell/docs-shell.d.ts +37 -4
- package/dist/pages/docs-shell/docs-shell.d.ts.map +1 -1
- package/dist/pages/docs-shell/docs-shell.js +107 -16
- package/dist/pages/docs-shell/index.d.ts +2 -2
- package/dist/pages/docs-shell/index.js +1 -1
- package/dist/pages/index.d.ts +14 -14
- package/dist/pages/index.js +7 -7
- package/dist/pages/marketing-page/index.d.ts +6 -6
- package/dist/pages/marketing-page/index.js +5 -5
- package/dist/pages/not-found-page/index.js +4 -4
- package/dist/pages/settings-page/index.d.ts +3 -3
- package/dist/pages/settings-page/index.js +4 -4
- package/dist/provider/index.d.ts +4 -4
- package/dist/provider/index.js +2 -2
- package/dist/provider/provider.d.ts +1 -1
- package/dist/provider/provider.js +1 -1
- package/dist/provider/theme-script.d.ts +1 -1
- package/dist/provider/theme-script.js +1 -1
- package/dist/styles.css +689 -0
- package/package.json +9 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { Input } from './input.js';
|
|
3
|
+
/**
|
|
4
|
+
* Where an addon sits in the group, and what its border does about it.
|
|
5
|
+
*
|
|
6
|
+
* The addon keeps its own border on the outer edge only, because the group
|
|
7
|
+
* already draws the edge it shares with the control. Two borders on the same line
|
|
8
|
+
* read as a seam down the middle of one field, which is the opposite of what
|
|
9
|
+
* joining them was for.
|
|
10
|
+
*/
|
|
11
|
+
declare const ADDON_POSITION: {
|
|
12
|
+
readonly prefix: "rounded-s-md border-e-0";
|
|
13
|
+
readonly suffix: "rounded-e-md border-s-0";
|
|
14
|
+
};
|
|
15
|
+
/** The props the Input group accepts. */
|
|
16
|
+
export interface InputGroupProps extends ComponentProps<'div'> {
|
|
17
|
+
/**
|
|
18
|
+
* Whether the group ignores interaction.
|
|
19
|
+
*
|
|
20
|
+
* Drawn rather than set: the group's own `disabled` attribute would disable the
|
|
21
|
+
* control in the middle of it without the reader's pointer ever touching it, and
|
|
22
|
+
* a `<div>` cannot be disabled. Put `disabled` on the control and the group dims
|
|
23
|
+
* itself.
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** The props the Input group addon accepts. */
|
|
28
|
+
export interface InputGroupAddonProps extends ComponentProps<'div'> {
|
|
29
|
+
/** Which end of the group the addon sits on. @defaultValue prefix */
|
|
30
|
+
position?: keyof typeof ADDON_POSITION;
|
|
31
|
+
}
|
|
32
|
+
/** The props the Input group input accepts. */
|
|
33
|
+
export type InputGroupInputProps = ComponentProps<typeof Input>;
|
|
34
|
+
/** The props the Input group button accepts. */
|
|
35
|
+
export interface InputGroupButtonProps extends ComponentProps<'button'> {
|
|
36
|
+
/** Which end of the group the button sits on. @defaultValue suffix */
|
|
37
|
+
position?: keyof typeof ADDON_POSITION;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Related controls drawn as one field: a prefix, a suffix, a unit, an action.
|
|
41
|
+
*
|
|
42
|
+
* **The addons are part of the field, not beside it.** They share one border, one
|
|
43
|
+
* height, one corner radius and one focus colour, because the thing they decorate
|
|
44
|
+
* is the field and a reader who sees three boxes has been given three things to
|
|
45
|
+
* reason about where they were given one. A currency symbol and the number it
|
|
46
|
+
* belongs to are one field with two parts, and the Component draws them as one
|
|
47
|
+
* field.
|
|
48
|
+
*
|
|
49
|
+
* **The frame answers the focus, the control draws the ring.** The group is a
|
|
50
|
+
* `div`: it is never focused and it has nothing to ring. It turns its border to the
|
|
51
|
+
* ring token when anything inside it has focus, and the control, which is the
|
|
52
|
+
* element that actually has focus, keeps `Input`'s own full-strength ring. Two
|
|
53
|
+
* indicators would be two things to read, and putting the ring on a wrapper that
|
|
54
|
+
* is not the thing being operated is how a focus indicator ends up drawn around
|
|
55
|
+
* the wrong box.
|
|
56
|
+
*
|
|
57
|
+
* **Use `InputGroupInput` inside it rather than `Input`.** A bordered `Input`
|
|
58
|
+
* inside a bordered group draws a second border inside the first, and the caller
|
|
59
|
+
* should not have to know that `border-0 shadow-none` is the fix. The rest of the
|
|
60
|
+
* surface is plain divs and buttons, so a caller can put any control in the middle
|
|
61
|
+
* once they know they have to take its border off.
|
|
62
|
+
*
|
|
63
|
+
* It is presentational: it renders no state of its own, has no hooks and no event
|
|
64
|
+
* handlers, so it is a server Component and a consumer's field costs no client
|
|
65
|
+
* JavaScript for the frame. Pair it with a `Label` above it and the control inside
|
|
66
|
+
* is the only thing that needs a name.
|
|
67
|
+
*/
|
|
68
|
+
declare function InputGroup({ className, disabled, ...props }: InputGroupProps): import("react").JSX.Element;
|
|
69
|
+
/**
|
|
70
|
+
* A static run of words or an icon inside the group: a unit, a prefix, a currency
|
|
71
|
+
* symbol, a field name.
|
|
72
|
+
*
|
|
73
|
+
* It carries no accessible name of its own and none is needed: the text inside it
|
|
74
|
+
* is read in place, and the control it belongs to is named by the label above the
|
|
75
|
+
* group. Use `InputGroupButton` when the part has to be operated, so it gets a
|
|
76
|
+
* name and a focus ring of its own.
|
|
77
|
+
*/
|
|
78
|
+
declare function InputGroupAddon({ className, position, ...props }: InputGroupAddonProps): import("react").JSX.Element;
|
|
79
|
+
/**
|
|
80
|
+
* The control in the middle of the group, without a border of its own.
|
|
81
|
+
*
|
|
82
|
+
* A thin composition over `Input` rather than a variant of it, so the field keeps
|
|
83
|
+
* every behaviour a plain `Input` has, including its focus ring, its `aria-invalid`
|
|
84
|
+
* border and its disabled state. Only the border and the shadow are dropped,
|
|
85
|
+
* because the group already draws both.
|
|
86
|
+
*/
|
|
87
|
+
declare function InputGroupInput({ className, ...props }: InputGroupInputProps): import("react").JSX.Element;
|
|
88
|
+
/**
|
|
89
|
+
* An operable part inside the group: clear the field, reveal a password, open a
|
|
90
|
+
* picker.
|
|
91
|
+
*
|
|
92
|
+
* A button rather than an addon, because the moment the part can be operated it
|
|
93
|
+
* needs its own accessible name, its own focus ring and its own press feedback,
|
|
94
|
+
* and an addon has none of the three. The name is a prop, as it is everywhere:
|
|
95
|
+
* "Clear" is a word this package does not get to choose for a consumer's product.
|
|
96
|
+
*/
|
|
97
|
+
declare function InputGroupButton({ className, position, type, ...props }: InputGroupButtonProps): import("react").JSX.Element;
|
|
98
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput };
|
|
99
|
+
//# sourceMappingURL=input-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../../src/components/ui/input-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B;;;;;;;GAOG;AACH,QAAA,MAAM,cAAc;;;CAGV,CAAA;AAEV,yCAAyC;AACzC,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC5D;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,+CAA+C;AAC/C,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,KAAK,CAAC;IACjE,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,OAAO,cAAc,CAAA;CACvC;AAED,+CAA+C;AAC/C,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,CAAA;AAE/D,gDAAgD;AAChD,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,QAAQ,CAAC;IACrE,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,OAAO,cAAc,CAAA;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,QAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,+BAgB7E;AAED;;;;;;;;GAQG;AACH,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,QAAmB,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,+BAa1F;AAED;;;;;;;GAOG;AACH,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,+BAQrE;AAED;;;;;;;;GAQG;AACH,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAmB,EACnB,IAAe,EACf,GAAG,KAAK,EACT,EAAE,qBAAqB,+BAiBvB;AAED,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from './input.js';
|
|
3
|
+
import { cn } from '../../lib/utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Where an addon sits in the group, and what its border does about it.
|
|
6
|
+
*
|
|
7
|
+
* The addon keeps its own border on the outer edge only, because the group
|
|
8
|
+
* already draws the edge it shares with the control. Two borders on the same line
|
|
9
|
+
* read as a seam down the middle of one field, which is the opposite of what
|
|
10
|
+
* joining them was for.
|
|
11
|
+
*/
|
|
12
|
+
const ADDON_POSITION = {
|
|
13
|
+
prefix: 'rounded-s-md border-e-0',
|
|
14
|
+
suffix: 'rounded-e-md border-s-0',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Related controls drawn as one field: a prefix, a suffix, a unit, an action.
|
|
18
|
+
*
|
|
19
|
+
* **The addons are part of the field, not beside it.** They share one border, one
|
|
20
|
+
* height, one corner radius and one focus colour, because the thing they decorate
|
|
21
|
+
* is the field and a reader who sees three boxes has been given three things to
|
|
22
|
+
* reason about where they were given one. A currency symbol and the number it
|
|
23
|
+
* belongs to are one field with two parts, and the Component draws them as one
|
|
24
|
+
* field.
|
|
25
|
+
*
|
|
26
|
+
* **The frame answers the focus, the control draws the ring.** The group is a
|
|
27
|
+
* `div`: it is never focused and it has nothing to ring. It turns its border to the
|
|
28
|
+
* ring token when anything inside it has focus, and the control, which is the
|
|
29
|
+
* element that actually has focus, keeps `Input`'s own full-strength ring. Two
|
|
30
|
+
* indicators would be two things to read, and putting the ring on a wrapper that
|
|
31
|
+
* is not the thing being operated is how a focus indicator ends up drawn around
|
|
32
|
+
* the wrong box.
|
|
33
|
+
*
|
|
34
|
+
* **Use `InputGroupInput` inside it rather than `Input`.** A bordered `Input`
|
|
35
|
+
* inside a bordered group draws a second border inside the first, and the caller
|
|
36
|
+
* should not have to know that `border-0 shadow-none` is the fix. The rest of the
|
|
37
|
+
* surface is plain divs and buttons, so a caller can put any control in the middle
|
|
38
|
+
* once they know they have to take its border off.
|
|
39
|
+
*
|
|
40
|
+
* It is presentational: it renders no state of its own, has no hooks and no event
|
|
41
|
+
* handlers, so it is a server Component and a consumer's field costs no client
|
|
42
|
+
* JavaScript for the frame. Pair it with a `Label` above it and the control inside
|
|
43
|
+
* is the only thing that needs a name.
|
|
44
|
+
*/
|
|
45
|
+
function InputGroup({ className, disabled = false, ...props }) {
|
|
46
|
+
return (_jsx("div", { "data-slot": "input-group", "data-disabled": disabled || undefined, "aria-disabled": disabled || undefined, className: cn('border-input bg-background focus-within:border-ring flex w-full items-stretch rounded-md border shadow-xs', 'transition-[color,box-shadow] duration-fast ease-out', 'has-[input:disabled]:opacity-50', disabled && 'opacity-50', className), ...props }));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A static run of words or an icon inside the group: a unit, a prefix, a currency
|
|
50
|
+
* symbol, a field name.
|
|
51
|
+
*
|
|
52
|
+
* It carries no accessible name of its own and none is needed: the text inside it
|
|
53
|
+
* is read in place, and the control it belongs to is named by the label above the
|
|
54
|
+
* group. Use `InputGroupButton` when the part has to be operated, so it gets a
|
|
55
|
+
* name and a focus ring of its own.
|
|
56
|
+
*/
|
|
57
|
+
function InputGroupAddon({ className, position = 'prefix', ...props }) {
|
|
58
|
+
return (_jsx("div", { "data-slot": "input-group-addon", "data-position": position, className: cn('bg-muted text-muted-foreground border-input flex shrink-0 items-center border px-2.5 text-sm', ADDON_POSITION[position], className), ...props }));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The control in the middle of the group, without a border of its own.
|
|
62
|
+
*
|
|
63
|
+
* A thin composition over `Input` rather than a variant of it, so the field keeps
|
|
64
|
+
* every behaviour a plain `Input` has, including its focus ring, its `aria-invalid`
|
|
65
|
+
* border and its disabled state. Only the border and the shadow are dropped,
|
|
66
|
+
* because the group already draws both.
|
|
67
|
+
*/
|
|
68
|
+
function InputGroupInput({ className, ...props }) {
|
|
69
|
+
return (_jsx(Input, { "data-slot": "input-group-input", className: cn('flex-1 border-0 shadow-none focus-visible:border-0', className), ...props }));
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* An operable part inside the group: clear the field, reveal a password, open a
|
|
73
|
+
* picker.
|
|
74
|
+
*
|
|
75
|
+
* A button rather than an addon, because the moment the part can be operated it
|
|
76
|
+
* needs its own accessible name, its own focus ring and its own press feedback,
|
|
77
|
+
* and an addon has none of the three. The name is a prop, as it is everywhere:
|
|
78
|
+
* "Clear" is a word this package does not get to choose for a consumer's product.
|
|
79
|
+
*/
|
|
80
|
+
function InputGroupButton({ className, position = 'suffix', type = 'button', ...props }) {
|
|
81
|
+
return (_jsx("button", { type: type, "data-slot": "input-group-button", "data-position": position, className: cn('border-input text-muted-foreground hover:bg-accent hover:text-accent-foreground flex shrink-0 items-center justify-center border px-2.5 text-sm outline-none', 'transition-[color,background-color] duration-fast ease-out', 'focus-visible:ring-ring focus-visible:ring-[3px]', 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50', ADDON_POSITION[position], className), ...props }));
|
|
82
|
+
}
|
|
83
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* One row: what a reader is being shown, and what they can do about it.
|
|
4
|
+
*
|
|
5
|
+
* The anatomy is fixed by this type rather than assembled from slots, because the
|
|
6
|
+
* order is the row. Media leads, the text block holds a primary and a secondary
|
|
7
|
+
* line, the value sits after it and the actions sit last. A row whose parts can
|
|
8
|
+
* be rearranged is four parts and a decision, and every list that hand-rolled its
|
|
9
|
+
* own row made that decision slightly differently; that is the drift this
|
|
10
|
+
* Component exists to end.
|
|
11
|
+
*
|
|
12
|
+
* `href` is what makes the row reachable, and it is a first-class field rather
|
|
13
|
+
* than a property of the trailing slot, because a row whose only way to be
|
|
14
|
+
* followed is a kebab menu in the corner is a row that hides its own content from
|
|
15
|
+
* a reader who is not looking for a menu.
|
|
16
|
+
*/
|
|
17
|
+
export type ItemEntry = {
|
|
18
|
+
/**
|
|
19
|
+
* A stable key for the row.
|
|
20
|
+
*
|
|
21
|
+
* Required, because the common list this row lives in reorders, filters and
|
|
22
|
+
* replaces itself, and a row keyed by index has a reader's focus and a screen
|
|
23
|
+
* reader's announcement land on a different row when one is inserted above it.
|
|
24
|
+
*/
|
|
25
|
+
id: string;
|
|
26
|
+
/** The primary line: the name of the thing this row is about. */
|
|
27
|
+
title: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* The secondary line under it, in the muted ink.
|
|
30
|
+
*
|
|
31
|
+
* Omit it rather than passing an empty string. A row with no secondary line is
|
|
32
|
+
* one line tall; a row with an empty second line is one line tall with the
|
|
33
|
+
* reader looking for the thing that is not there.
|
|
34
|
+
*/
|
|
35
|
+
description?: ReactNode;
|
|
36
|
+
/** A short value that belongs to the row but is not part of its name. */
|
|
37
|
+
meta?: ReactNode;
|
|
38
|
+
/** Where the row goes. Omit it for a row that is read rather than followed. */
|
|
39
|
+
href?: string;
|
|
40
|
+
/**
|
|
41
|
+
* A thumbnail, an avatar, a status mark. Whatever it is, it is clipped to a
|
|
42
|
+
* fixed square so a row's height is the same whichever media a caller passes.
|
|
43
|
+
*/
|
|
44
|
+
media?: ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* The controls at the trailing edge.
|
|
47
|
+
*
|
|
48
|
+
* These are *in addition to* whatever `href` reaches, never instead of it. A
|
|
49
|
+
* row whose only destination is an action is a row whose content is only
|
|
50
|
+
* reachable by a reader who guesses that the controls are the content, and a
|
|
51
|
+
* caller who has no destination should omit this rather than reach for it.
|
|
52
|
+
*/
|
|
53
|
+
actions?: ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Marks the row as the current one.
|
|
56
|
+
*
|
|
57
|
+
* Marked with `aria-current` as well as with the surface, because a selected
|
|
58
|
+
* row that is only a different colour is invisible to a reader who cannot
|
|
59
|
+
* separate the two inks, and this is the same rule the Timeline's states and the
|
|
60
|
+
* ProductSwitcher's member follow.
|
|
61
|
+
*/
|
|
62
|
+
selected?: boolean;
|
|
63
|
+
};
|
|
64
|
+
/** The props the Item accepts. */
|
|
65
|
+
export interface ItemProps extends Omit<ComponentProps<'div'>, 'children' | 'title'> {
|
|
66
|
+
/** The row's own content. See `ItemEntry` for what a row is made of. */
|
|
67
|
+
entry: ItemEntry;
|
|
68
|
+
/** Layout only. */
|
|
69
|
+
className?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A row in a list or a set: media, a text block, a value and trailing controls.
|
|
73
|
+
*
|
|
74
|
+
* **It is the row, and the list is the caller's.** That is the one decision worth
|
|
75
|
+
* making here, and it is a decision against making this a data-driven list. An
|
|
76
|
+
* Item renders one row and nothing about what encloses it, because the same row
|
|
77
|
+
* appears in a `<ul>`, in a definition list, in a card grid and in a table cell,
|
|
78
|
+
* and a Component that owned the list would have to own all four. A caller writes
|
|
79
|
+
* the list element its content actually is and puts rows in it; what they stop
|
|
80
|
+
* writing is the row.
|
|
81
|
+
*
|
|
82
|
+
* So a caller writes `<li><Item key={id} entry={row} /></li>` and gets a real list
|
|
83
|
+
* item, the count and the position in the accessibility tree, and a row whose
|
|
84
|
+
* geometry cannot drift from the row below it. The wrapper is one element, and
|
|
85
|
+
* the row is the part that was being re-derived in every list in this package.
|
|
86
|
+
*
|
|
87
|
+
* **The trailing controls are never the only route to the row.** `href` is a
|
|
88
|
+
* field on the row rather than something the actions have to carry, so the
|
|
89
|
+
* primary line is a real anchor a reader can tab to, see where it goes before
|
|
90
|
+
* taking it, and open in a new context. A row of forty with its only destination
|
|
91
|
+
* behind a kebab menu is a list a screen reader user cannot read, because the
|
|
92
|
+
* menu's contents are not in the document until the menu is open.
|
|
93
|
+
*
|
|
94
|
+
* **The title is not stretched over the whole row.** The obvious treatment for a
|
|
95
|
+
* clickable row is an anchor with `position: absolute; inset: 0` and the actions
|
|
96
|
+
* raised above it, which makes the entire row a hit target. It is refused for the
|
|
97
|
+
* focus indicator: the ring belongs to the anchor, and an anchor stretched over a
|
|
98
|
+
* row is a box that has sized itself to the text inside it, so the ring a keyboard
|
|
99
|
+
* reader sees is a ring around the words rather than around the thing they are
|
|
100
|
+
* about. Prism's rings are per element at full strength, and a ring that does not
|
|
101
|
+
* bound the thing it names is not an indicator.
|
|
102
|
+
*
|
|
103
|
+
* **The selected row is marked, not only tinted.** `aria-current` carries the
|
|
104
|
+
* state and the surface repeats it for a reader who reads by eye, which is the
|
|
105
|
+
* same order the whole package keeps meaning in: the attribute is the fact and
|
|
106
|
+
* the colour is the reminder.
|
|
107
|
+
*
|
|
108
|
+
* It is a server Component. It holds no state, runs no effect and attaches no
|
|
109
|
+
* handler, so a list of two hundred rows costs no JavaScript at all.
|
|
110
|
+
*/
|
|
111
|
+
declare function Item({ entry, className, ...props }: ItemProps): import("react").JSX.Element;
|
|
112
|
+
export { Item };
|
|
113
|
+
//# sourceMappingURL=item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/components/ui/item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;;;;;OAMG;IACH,EAAE,EAAE,MAAM,CAAA;IACV,iEAAiE;IACjE,KAAK,EAAE,SAAS,CAAA;IAChB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,yEAAyE;IACzE,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,kCAAkC;AAClC,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAClF,wEAAwE;IACxE,KAAK,EAAE,SAAS,CAAA;IAChB,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,iBAAS,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,+BAyFtD;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* A row in a list or a set: media, a text block, a value and trailing controls.
|
|
5
|
+
*
|
|
6
|
+
* **It is the row, and the list is the caller's.** That is the one decision worth
|
|
7
|
+
* making here, and it is a decision against making this a data-driven list. An
|
|
8
|
+
* Item renders one row and nothing about what encloses it, because the same row
|
|
9
|
+
* appears in a `<ul>`, in a definition list, in a card grid and in a table cell,
|
|
10
|
+
* and a Component that owned the list would have to own all four. A caller writes
|
|
11
|
+
* the list element its content actually is and puts rows in it; what they stop
|
|
12
|
+
* writing is the row.
|
|
13
|
+
*
|
|
14
|
+
* So a caller writes `<li><Item key={id} entry={row} /></li>` and gets a real list
|
|
15
|
+
* item, the count and the position in the accessibility tree, and a row whose
|
|
16
|
+
* geometry cannot drift from the row below it. The wrapper is one element, and
|
|
17
|
+
* the row is the part that was being re-derived in every list in this package.
|
|
18
|
+
*
|
|
19
|
+
* **The trailing controls are never the only route to the row.** `href` is a
|
|
20
|
+
* field on the row rather than something the actions have to carry, so the
|
|
21
|
+
* primary line is a real anchor a reader can tab to, see where it goes before
|
|
22
|
+
* taking it, and open in a new context. A row of forty with its only destination
|
|
23
|
+
* behind a kebab menu is a list a screen reader user cannot read, because the
|
|
24
|
+
* menu's contents are not in the document until the menu is open.
|
|
25
|
+
*
|
|
26
|
+
* **The title is not stretched over the whole row.** The obvious treatment for a
|
|
27
|
+
* clickable row is an anchor with `position: absolute; inset: 0` and the actions
|
|
28
|
+
* raised above it, which makes the entire row a hit target. It is refused for the
|
|
29
|
+
* focus indicator: the ring belongs to the anchor, and an anchor stretched over a
|
|
30
|
+
* row is a box that has sized itself to the text inside it, so the ring a keyboard
|
|
31
|
+
* reader sees is a ring around the words rather than around the thing they are
|
|
32
|
+
* about. Prism's rings are per element at full strength, and a ring that does not
|
|
33
|
+
* bound the thing it names is not an indicator.
|
|
34
|
+
*
|
|
35
|
+
* **The selected row is marked, not only tinted.** `aria-current` carries the
|
|
36
|
+
* state and the surface repeats it for a reader who reads by eye, which is the
|
|
37
|
+
* same order the whole package keeps meaning in: the attribute is the fact and
|
|
38
|
+
* the colour is the reminder.
|
|
39
|
+
*
|
|
40
|
+
* It is a server Component. It holds no state, runs no effect and attaches no
|
|
41
|
+
* handler, so a list of two hundred rows costs no JavaScript at all.
|
|
42
|
+
*/
|
|
43
|
+
function Item({ entry, className, ...props }) {
|
|
44
|
+
const { id, title, description, meta, href, media, actions, selected } = entry;
|
|
45
|
+
const hasActions = actions !== undefined && actions !== null && actions !== false;
|
|
46
|
+
return (_jsxs("div", { "data-slot": "item", "data-item": id, "data-selected": selected ? 'true' : undefined, "aria-current": selected ? 'true' : undefined, className: cn('flex items-center gap-3 px-3 py-2',
|
|
47
|
+
// The row is only interactive when there is something to interact with, so
|
|
48
|
+
// the hover surface is conditional. A hover tint on a row that does
|
|
49
|
+
// nothing is a promise the row does not keep, and a reader learns to
|
|
50
|
+
// ignore the tint on every row in the list.
|
|
51
|
+
href === undefined ? '' : 'hover:bg-muted', selected ? 'bg-muted' : '', className), ...props, children: [media === undefined || media === null || media === false ? null : (
|
|
52
|
+
/*
|
|
53
|
+
* Media is left in the accessibility tree. An avatar and a thumbnail both
|
|
54
|
+
* carry information a row's text does not, and hiding the slot would make
|
|
55
|
+
* the caller's `alt` unreachable; a caller whose media really is
|
|
56
|
+
* decoration passes an `aria-hidden` image and decides that for itself,
|
|
57
|
+
* which is the only party that knows.
|
|
58
|
+
*/
|
|
59
|
+
_jsx("div", { "data-slot": "item-media", className: "bg-muted flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-md [&_img]:size-full [&_img]:object-cover", children: media })), _jsxs("div", { "data-slot": "item-content", className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsx("span", { "data-slot": "item-title", className: "min-w-0 truncate text-sm font-medium", children: href === undefined ? (title) : (_jsx("a", { "data-slot": "item-link", href: href, className: cn('hover:underline focus-visible:ring-ring rounded-sm outline-none focus-visible:ring-[3px]'), children: title })) }), description === undefined || description === null || description === false ? null : (_jsx("span", { "data-slot": "item-description", className: "text-muted-foreground min-w-0 truncate text-sm", children: description }))] }), meta === undefined || meta === null || meta === false ? null : (_jsx("span", { "data-slot": "item-meta", className: "text-muted-foreground shrink-0 text-sm tabular-nums", children: meta })), hasActions ? (_jsx("div", { "data-slot": "item-actions", className: "flex shrink-0 items-center gap-1", children: actions })) : null] }));
|
|
60
|
+
}
|
|
61
|
+
export { Item };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
/** The props the Label accepts. */
|
|
3
|
+
export interface LabelProps extends ComponentProps<'label'> {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the control this label names has to be filled in.
|
|
6
|
+
*
|
|
7
|
+
* It draws a mark and it says nothing to a screen reader, because the control's
|
|
8
|
+
* own `required` is what is announced. A mark that were read out would reach a
|
|
9
|
+
* reader as the field's name followed by a glyph, which is a name with a
|
|
10
|
+
* decoration on the end of it, and it is the wrong place for a requirement: the
|
|
11
|
+
* requirement is enforced by the control and reported by it.
|
|
12
|
+
*
|
|
13
|
+
* Put `required` on the control as well as here. This prop is what the reader
|
|
14
|
+
* can see; that one is what the form enforces.
|
|
15
|
+
*/
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The mark that shows a required field.
|
|
19
|
+
*
|
|
20
|
+
* A default rather than a fixed character, because the convention is the
|
|
21
|
+
* reader's: an asterisk, a word, a dagger, nothing at all and a note in the
|
|
22
|
+
* legend instead. A Component that chose one would ship one locale's convention
|
|
23
|
+
* into every consumer's product.
|
|
24
|
+
*/
|
|
25
|
+
requiredText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the control this label names is unavailable.
|
|
28
|
+
*
|
|
29
|
+
* The label dims with the control rather than staying at full strength, because
|
|
30
|
+
* a label at full strength over a greyed field reads as a field that has merely
|
|
31
|
+
* been styled. It is a statement about the field the reader is looking at, and
|
|
32
|
+
* the two states should not disagree.
|
|
33
|
+
*/
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The accessible name of a control, on its own.
|
|
38
|
+
*
|
|
39
|
+
* **`FieldLabel` is this, inside a field.** A label is needed wherever a control
|
|
40
|
+
* is, and a form binding is one place: a dialog's single input, a table's filter
|
|
41
|
+
* row, a settings line that has no group around it because there is nothing to
|
|
42
|
+
* group. `FieldLabel` draws the same thing and is the right choice beside a
|
|
43
|
+
* `Field`; this is the right choice when there is no field, and taking the field
|
|
44
|
+
* apart to get at its label would be rearranging a layout to reach one element of
|
|
45
|
+
* it.
|
|
46
|
+
*
|
|
47
|
+
* **It is a native `<label>` and the association is programmatic.** Pass the
|
|
48
|
+
* control's `id` as `htmlFor` so the name is attached rather than merely adjacent,
|
|
49
|
+
* because adjacent text is not a name: it is read by nobody when the reader tabs
|
|
50
|
+
* to the control, and a visible label with no `for` is a caption.
|
|
51
|
+
*
|
|
52
|
+
* **It is a server Component.** It reads props and renders, so a form built from
|
|
53
|
+
* it costs no client JavaScript for its labels, and that is most of what a form
|
|
54
|
+
* is.
|
|
55
|
+
*/
|
|
56
|
+
declare function Label({ className, required, requiredText, disabled, children, ...props }: LabelProps): import("react").JSX.Element;
|
|
57
|
+
export { Label };
|
|
58
|
+
//# sourceMappingURL=label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/components/ui/label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C,mCAAmC;AACnC,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,OAAO,CAAC;IACzD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,QAAgB,EAChB,YAAkB,EAClB,QAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,+BAuBZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* The accessible name of a control, on its own.
|
|
5
|
+
*
|
|
6
|
+
* **`FieldLabel` is this, inside a field.** A label is needed wherever a control
|
|
7
|
+
* is, and a form binding is one place: a dialog's single input, a table's filter
|
|
8
|
+
* row, a settings line that has no group around it because there is nothing to
|
|
9
|
+
* group. `FieldLabel` draws the same thing and is the right choice beside a
|
|
10
|
+
* `Field`; this is the right choice when there is no field, and taking the field
|
|
11
|
+
* apart to get at its label would be rearranging a layout to reach one element of
|
|
12
|
+
* it.
|
|
13
|
+
*
|
|
14
|
+
* **It is a native `<label>` and the association is programmatic.** Pass the
|
|
15
|
+
* control's `id` as `htmlFor` so the name is attached rather than merely adjacent,
|
|
16
|
+
* because adjacent text is not a name: it is read by nobody when the reader tabs
|
|
17
|
+
* to the control, and a visible label with no `for` is a caption.
|
|
18
|
+
*
|
|
19
|
+
* **It is a server Component.** It reads props and renders, so a form built from
|
|
20
|
+
* it costs no client JavaScript for its labels, and that is most of what a form
|
|
21
|
+
* is.
|
|
22
|
+
*/
|
|
23
|
+
function Label({ className, required = false, requiredText = '*', disabled = false, children, ...props }) {
|
|
24
|
+
return (_jsxs("label", { "data-slot": "label", "data-required": required || undefined, "data-disabled": disabled || undefined, className: cn('text-foreground text-sm leading-none font-medium',
|
|
25
|
+
// No fill of its own, so there is no ink of its own to state: the label
|
|
26
|
+
// inherits whatever the surface it sits on already uses.
|
|
27
|
+
disabled && 'text-muted-foreground', className), ...props, children: [children, required ? (_jsx("span", { "data-slot": "label-required", "aria-hidden": "true", className: "text-destructive ms-1", children: requiredText })) : null] }));
|
|
28
|
+
}
|
|
29
|
+
export { Label };
|
|
@@ -72,6 +72,15 @@ export interface LiveRegionProps extends Omit<ComponentProps<'div'>, 'children'>
|
|
|
72
72
|
* receives what has arrived and announces it. That split is the same one the
|
|
73
73
|
* documentation Page makes with its navigation, and the reason Prism stays
|
|
74
74
|
* transport-agnostic and no consumer inherits a connection it did not ask for.
|
|
75
|
+
*
|
|
76
|
+
* **It is a server Component.** It reads its props, it holds no state, it runs no
|
|
77
|
+
* hook and it takes no event handler, so the client directive would be a claim
|
|
78
|
+
* about work this Component does not do. A live region is announced by the
|
|
79
|
+
* browser's own mutation observer rather than by JavaScript, which is the whole
|
|
80
|
+
* reason it is a good primitive: it works in a server-rendered page. A consumer
|
|
81
|
+
* that needs to pass an event handler to it does so from their own client
|
|
82
|
+
* boundary, which is the ordinary arrangement and is not this Component's to
|
|
83
|
+
* declare.
|
|
75
84
|
*/
|
|
76
85
|
declare function LiveRegion({ className, children, politeness, busy, label, ...props }: LiveRegionProps): import("react").JSX.Element | null;
|
|
77
86
|
export { LiveRegion };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-region.d.ts","sourceRoot":"","sources":["../../../src/components/ui/live-region.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"live-region.d.ts","sourceRoot":"","sources":["../../../src/components/ui/live-region.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,WAAW,CAAA;AAEnD,yCAAyC;AACzC,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,QAAQ,EACR,UAAqB,EACrB,IAAY,EACZ,KAAK,EACL,GAAG,KAAK,EACT,EAAE,eAAe,sCAiCjB;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
2
|
+
import { cn } from '../../lib/utils.js';
|
|
4
3
|
/**
|
|
5
4
|
* A region that announces what just changed in it.
|
|
6
5
|
*
|
|
@@ -21,6 +20,15 @@ import { cn } from '../../lib/utils';
|
|
|
21
20
|
* receives what has arrived and announces it. That split is the same one the
|
|
22
21
|
* documentation Page makes with its navigation, and the reason Prism stays
|
|
23
22
|
* transport-agnostic and no consumer inherits a connection it did not ask for.
|
|
23
|
+
*
|
|
24
|
+
* **It is a server Component.** It reads its props, it holds no state, it runs no
|
|
25
|
+
* hook and it takes no event handler, so the client directive would be a claim
|
|
26
|
+
* about work this Component does not do. A live region is announced by the
|
|
27
|
+
* browser's own mutation observer rather than by JavaScript, which is the whole
|
|
28
|
+
* reason it is a good primitive: it works in a server-rendered page. A consumer
|
|
29
|
+
* that needs to pass an event handler to it does so from their own client
|
|
30
|
+
* boundary, which is the ordinary arrangement and is not this Component's to
|
|
31
|
+
* declare.
|
|
24
32
|
*/
|
|
25
33
|
function LiveRegion({ className, children, politeness = 'polite', busy = false, label, ...props }) {
|
|
26
34
|
// An empty region is not a region. Rendering the element with nothing in it
|