@whatsaaaa/ui-vue 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -2
  3. package/dist/color-mode.d.ts +14 -0
  4. package/dist/color-mode.js +34 -0
  5. package/dist/index.d.ts +12 -0
  6. package/dist/index.js +12 -0
  7. package/dist/theme/badge.d.ts +70 -0
  8. package/dist/theme/badge.js +116 -0
  9. package/dist/theme/button.d.ts +136 -0
  10. package/dist/theme/button.js +193 -0
  11. package/dist/theme/card.d.ts +29 -0
  12. package/dist/theme/card.js +44 -0
  13. package/dist/theme/checkbox.d.ts +159 -0
  14. package/dist/theme/checkbox.js +73 -0
  15. package/dist/theme/choice.d.ts +82 -0
  16. package/dist/theme/choice.js +124 -0
  17. package/dist/theme/field-group.d.ts +9 -0
  18. package/dist/theme/field-group.js +16 -0
  19. package/dist/theme/field.d.ts +263 -0
  20. package/dist/theme/field.js +248 -0
  21. package/dist/theme/file-upload.d.ts +106 -0
  22. package/dist/theme/file-upload.js +124 -0
  23. package/dist/theme/form-field.d.ts +44 -0
  24. package/dist/theme/form-field.js +34 -0
  25. package/dist/theme/index.d.ts +2349 -0
  26. package/dist/theme/index.js +130 -0
  27. package/dist/theme/input-date.d.ts +127 -0
  28. package/dist/theme/input-date.js +78 -0
  29. package/dist/theme/input-menu.d.ts +210 -0
  30. package/dist/theme/input-menu.js +83 -0
  31. package/dist/theme/input-number.d.ts +77 -0
  32. package/dist/theme/input-number.js +110 -0
  33. package/dist/theme/input-tags.d.ts +284 -0
  34. package/dist/theme/input-tags.js +38 -0
  35. package/dist/theme/input-time.d.ts +2 -0
  36. package/dist/theme/input-time.js +5 -0
  37. package/dist/theme/input.d.ts +138 -0
  38. package/dist/theme/input.js +48 -0
  39. package/dist/theme/modal.d.ts +31 -0
  40. package/dist/theme/modal.js +44 -0
  41. package/dist/theme/pin-input.d.ts +61 -0
  42. package/dist/theme/pin-input.js +40 -0
  43. package/dist/theme/radio-group.d.ts +177 -0
  44. package/dist/theme/radio-group.js +111 -0
  45. package/dist/theme/select-menu.d.ts +154 -0
  46. package/dist/theme/select-menu.js +22 -0
  47. package/dist/theme/select.d.ts +254 -0
  48. package/dist/theme/select.js +109 -0
  49. package/dist/theme/shared.d.ts +69 -0
  50. package/dist/theme/shared.js +103 -0
  51. package/dist/theme/table.d.ts +45 -0
  52. package/dist/theme/table.js +111 -0
  53. package/dist/theme/tabs.d.ts +95 -0
  54. package/dist/theme/tabs.js +144 -0
  55. package/dist/theme/tags.d.ts +40 -0
  56. package/dist/theme/tags.js +52 -0
  57. package/dist/theme/textarea.d.ts +127 -0
  58. package/dist/theme/textarea.js +72 -0
  59. package/package.json +65 -3
  60. package/src/index.css +123 -0
  61. package/src/nuxt-ui.css +148 -0
@@ -0,0 +1,111 @@
1
+ import { focusRing } from "./shared.js";
2
+ /*
3
+ * The table of the design system's table spec, specs/table.spec.json: the table of the system's
4
+ * prose, in a border with the large radius, scrolling inside it. The head is on the surface, as
5
+ * an overline, and the rows on the page color, so the head stands out on a panel too; a cell is
6
+ * small body text, the rows apart by a line. It reads the table tier by name, --ws-table-*, so a
7
+ * change of the tier reaches it.
8
+ *
9
+ * The lines are borders, which forced colors keep: the head's is the border of its cells, where
10
+ * Nuxt UI draws a row of its own filled with the border color, and the foot's the same.
11
+ *
12
+ * Rows are chosen by a checkbox in each row's first cell, as the spec has it: a row with one is
13
+ * raised under the pointer, takes the selection color once chosen, the line under it a step
14
+ * darker in the light theme, and is ringed inside while its checkbox has the focus, not while
15
+ * another control in the row has it. A row Nuxt UI makes a stop of its own, with a handler for
16
+ * the row, is raised and ringed too: those classes have Nuxt UI's variants exactly, so they
17
+ * replace Nuxt UI's own.
18
+ */
19
+ /** A row that can be chosen, by the checkbox in its first cell or by Nuxt UI's handler. */
20
+ const hover = '[&>tr]:has-[>td:first-child_[role=checkbox]]:hover:bg-(--ws-table-row-bg-hover) [&>tr]:data-[selectable=true]:hover:bg-(--ws-table-row-bg-hover)';
21
+ /**
22
+ * The ring inside a row, while the checkbox in its first cell has the focus or the row itself
23
+ * does. The row with its checkbox has the focus in it, but not in another cell: written so, the
24
+ * focus a gallery draws on the checkbox with the focus-visible variant rings the row too.
25
+ *
26
+ * A ringed row also says how wide its ring is, in --table-row-ring, and how far inside the row
27
+ * a cell that lies over the ring has to start for the ring to show, in --table-row-ring-clip: a
28
+ * pinned cell reads both. The clip is a thin border wider than the ring: a cell starts inside
29
+ * its row by a part of the line between the rows, which the browser rounds to a pixel or to none,
30
+ * and what the clip bares past the ring is the row's fill. In a row without a ring the ring is
31
+ * nothing and the clip far outside the cell.
32
+ *
33
+ * In forced colors the ring of a chosen row is HighlightText, the row's text color there, on its
34
+ * Highlight. Left to the browser, the outline of a row that has the focus itself would be in the
35
+ * browser's color for what has the focus, Highlight on Highlight.
36
+ */
37
+ const focus = '[&>tr]:outline-interactive [&>tr]:-outline-offset-(--ws-border-width-medium) [&>tr]:[--table-row-ring:0px] [&>tr]:[--table-row-ring-clip:-100vmax] [&>tr]:has-[>td:first-child_[role=checkbox]]:has-focus-visible:not-has-[>td:not(:first-child)_:focus-visible]:outline-2 [&>tr]:has-[>td:first-child_[role=checkbox]]:has-focus-visible:not-has-[>td:not(:first-child)_:focus-visible]:outline-solid [&>tr]:has-[>td:first-child_[role=checkbox]]:has-focus-visible:not-has-[>td:not(:first-child)_:focus-visible]:[--table-row-ring:var(--ws-border-width-medium)] [&>tr]:has-[>td:first-child_[role=checkbox]]:has-focus-visible:not-has-[>td:not(:first-child)_:focus-visible]:[--table-row-ring-clip:calc(var(--ws-border-width-medium)_+_var(--ws-border-width-thin))] [&>tr]:data-[selectable=true]:outline-interactive [&>tr]:data-[selectable=true]:-outline-offset-(--ws-border-width-medium) [&>tr]:data-[selectable=true]:focus-visible:outline-2 [&>tr]:data-[selectable=true]:focus-visible:outline-solid [&>tr]:data-[selectable=true]:focus-visible:[--table-row-ring:var(--ws-border-width-medium)] [&>tr]:data-[selectable=true]:focus-visible:[--table-row-ring-clip:calc(var(--ws-border-width-medium)_+_var(--ws-border-width-thin))] forced-colors:[&>tr]:data-[selected=true]:outline-[HighlightText]';
38
+ /**
39
+ * A cell's measures. Nuxt UI takes the end padding off a cell with a checkbox, the spec does not;
40
+ * the first cell of a row that can be chosen is only as wide as its checkbox, where a table wider
41
+ * than its columns would widen it as it widens the others.
42
+ */
43
+ const cell = 'px-(--ws-table-cell-padding-inline) py-(--ws-table-cell-padding-block) [&:has([role=checkbox])]:pe-(--ws-table-cell-padding-inline) first:[&:has([role=checkbox])]:w-px';
44
+ /**
45
+ * A cell of a chosen row in forced colors, in HighlightText. Forced colors put a plate of the
46
+ * page color behind each line of text, which would hide it, as HighlightText is near the page
47
+ * color: the cell keeps its colors as they are, and so does the text in it. The parts of Nuxt
48
+ * UI's components in it draw colors of their own, such as a badge's or a button's, and keep the
49
+ * forced colors as they do everywhere, unless a part keeps its own, as a checked box does. An
50
+ * icon of the cell itself, outside any such part, is in HighlightText as the text is, where the
51
+ * stylesheet paints every icon in the text color of the page.
52
+ */
53
+ const chosenCell = 'forced-colors:in-data-[selected=true]:text-[HighlightText] forced-colors:in-data-[selected=true]:forced-color-adjust-none forced-colors:in-data-[selected=true]:[:where(&_[data-slot])]:forced-color-adjust-auto forced-colors:in-data-[selected=true]:[:where(&_.iconify:not(svg,:is(&_[data-slot]_*)))]:bg-[HighlightText]';
54
+ /**
55
+ * The ring of a row over a pinned cell. The cell's fill, which hides what scrolls under it, lies
56
+ * over the row's outline too. So in a ringed row the cell gives way to the outline's lines above
57
+ * and below it: it is clipped there by its row's --table-row-ring-clip, which in every other row
58
+ * is far outside the cell and clips nothing. The first or the last cell of the row keeps its
59
+ * whole height where the ring ends, as wide as --table-row-ring, and draws the end itself: the
60
+ * row's own may have scrolled away under it. A pinned cell between them draws none: Tailwind's
61
+ * after: gives a content to whatever it styles, so those cells are told to have none. The end is
62
+ * a border, which forced colors keep, in the color the outline has there: the text color, or
63
+ * Highlight on a row that has the focus itself and is not chosen, the color the browser gives
64
+ * the outline of what has the focus.
65
+ */
66
+ const pinnedRing = "[clip-path:inset(var(--table-row-ring-clip)_-100vmax)] first:[clip-path:polygon(-100vmax_-100vmax,var(--table-row-ring)_-100vmax,var(--table-row-ring)_var(--table-row-ring-clip),calc(100%_+_100vmax)_var(--table-row-ring-clip),calc(100%_+_100vmax)_calc(100%_-_var(--table-row-ring-clip)),var(--table-row-ring)_calc(100%_-_var(--table-row-ring-clip)),var(--table-row-ring)_calc(100%_+_100vmax),-100vmax_calc(100%_+_100vmax))] last:[clip-path:polygon(-100vmax_var(--table-row-ring-clip),calc(100%_-_var(--table-row-ring))_var(--table-row-ring-clip),calc(100%_-_var(--table-row-ring))_-100vmax,calc(100%_+_100vmax)_-100vmax,calc(100%_+_100vmax)_calc(100%_+_100vmax),calc(100%_-_var(--table-row-ring))_calc(100%_+_100vmax),calc(100%_-_var(--table-row-ring))_calc(100%_-_var(--table-row-ring-clip)),-100vmax_calc(100%_-_var(--table-row-ring-clip)))] after:content-none first:after:content-[''] last:after:content-[''] after:absolute after:inset-y-0 first:after:left-0 last:after:right-0 after:pointer-events-none after:border-s-[length:var(--table-row-ring,0px)] after:border-interactive forced-colors:after:border-current forced-colors:[tr[data-selectable=true]:focus-visible:not([data-selected=true])>&]:after:border-[Highlight]";
67
+ /**
68
+ * A pinned cell hides what scrolls under it: on the page color, or its row's fill, raised under
69
+ * the pointer where the row is, or chosen.
70
+ */
71
+ const pinnedCell = `sticky bg-bg z-1 ${pinnedRing} [@media(hover:hover)]:[tr:has(>td:first-child_[role=checkbox]):hover>&]:bg-(--ws-table-row-bg-hover) [@media(hover:hover)]:[tr[data-selectable=true]:hover>&]:bg-(--ws-table-row-bg-hover) in-data-[selected=true]:bg-(--ws-table-row-bg-selected)! forced-colors:in-data-[selected=true]:bg-[Highlight]!`;
72
+ export default {
73
+ slots: {
74
+ root: `rounded-lg border-thin border-border bg-bg ${focusRing}`,
75
+ tbody: `divide-y-thin divide-border ${hover} ${focus}`,
76
+ // A chosen row keeps its fill under the pointer. In forced colors it is in the selection
77
+ // colors, the system's own, which forced colors keep: Highlight under HighlightText, the
78
+ // color its ring is given, with the ring's other rules. Over a row that is not chosen its
79
+ // line is CanvasText, as the line under every other row is there: forced colors would draw
80
+ // it in the row's HighlightText, the page's color, and the line would vanish over that row.
81
+ // Over a chosen row it stays HighlightText, which reads on the Highlight of both.
82
+ tr: 'data-[selected=true]:bg-(--ws-table-row-bg-selected)! data-[selected=true]:border-b-selection-border forced-colors:data-[selected=true]:bg-[Highlight]! forced-colors:data-[selected=true]:text-[HighlightText] forced-colors:data-[selected=true]:not-has-[+[data-selected=true]]:border-b-[CanvasText]',
83
+ th: `${cell} align-middle bg-(--ws-table-head-bg-rest) font-mono font-bold text-overline uppercase text-(--ws-table-head-text-rest) whitespace-nowrap in-[thead]:border-b-thin in-[thead]:border-border in-[tfoot]:border-t-thin in-[tfoot]:border-border`,
84
+ td: `${cell} align-top font-sans text-body-sm text-(--ws-table-row-text-rest) ${chosenCell}`,
85
+ separator: 'hidden',
86
+ empty: 'font-sans text-body-sm text-text-secondary',
87
+ },
88
+ variants: {
89
+ pinned: {
90
+ true: { th: 'sticky bg-(--ws-table-head-bg-rest) z-1', td: pinnedCell },
91
+ },
92
+ sticky: {
93
+ true: {
94
+ thead: 'sticky top-0 inset-x-0 bg-(--ws-table-head-bg-rest) backdrop-blur-none z-1',
95
+ tfoot: 'sticky bottom-0 inset-x-0 bg-bg backdrop-blur-none z-1',
96
+ },
97
+ header: {
98
+ thead: 'sticky top-0 inset-x-0 bg-(--ws-table-head-bg-rest) backdrop-blur-none z-1',
99
+ },
100
+ footer: { tfoot: 'sticky bottom-0 inset-x-0 bg-bg backdrop-blur-none z-1' },
101
+ },
102
+ },
103
+ compoundVariants: [
104
+ // The loading line is a thin border's height, over the line under the head.
105
+ { loading: true, class: { thead: 'after:bottom-0 after:h-(--ws-border-width-thin)' } },
106
+ { loading: true, loadingColor: 'primary', class: { thead: 'after:bg-interactive' } },
107
+ { loading: true, loadingColor: 'neutral', class: { thead: 'after:bg-text' } },
108
+ // In forced colors the loading bar is in the text color.
109
+ { loading: true, class: { thead: 'forced-colors:after:bg-[CanvasText]' } },
110
+ ],
111
+ };
@@ -0,0 +1,95 @@
1
+ declare const _default: {
2
+ slots: {
3
+ root: string;
4
+ indicator: string;
5
+ leadingIcon: string;
6
+ trigger: string;
7
+ content: string;
8
+ };
9
+ variants: {
10
+ variant: {
11
+ pill: {
12
+ list: string;
13
+ trigger: string;
14
+ indicator: string;
15
+ };
16
+ link: {
17
+ list: string;
18
+ indicator: string;
19
+ trigger: string;
20
+ };
21
+ };
22
+ size: {
23
+ xs: {
24
+ trigger: string;
25
+ leadingIcon: string;
26
+ };
27
+ sm: {
28
+ trigger: string;
29
+ leadingIcon: string;
30
+ };
31
+ md: {
32
+ trigger: string;
33
+ leadingIcon: string;
34
+ };
35
+ lg: {
36
+ trigger: string;
37
+ leadingIcon: string;
38
+ };
39
+ xl: {
40
+ trigger: string;
41
+ leadingIcon: string;
42
+ };
43
+ };
44
+ };
45
+ compoundVariants: (({
46
+ variant: string;
47
+ } & {
48
+ color: import("./shared.ts").Color;
49
+ class: string | Record<string, string>;
50
+ }) | {
51
+ orientation: string;
52
+ class: {
53
+ list: string;
54
+ trigger?: undefined;
55
+ indicator?: undefined;
56
+ content?: undefined;
57
+ };
58
+ variant?: undefined;
59
+ size?: undefined;
60
+ } | {
61
+ variant: string;
62
+ size: string;
63
+ class: {
64
+ trigger: string;
65
+ list?: undefined;
66
+ indicator?: undefined;
67
+ content?: undefined;
68
+ };
69
+ orientation?: undefined;
70
+ } | {
71
+ orientation: string;
72
+ variant: string;
73
+ class: {
74
+ list: string;
75
+ indicator: string;
76
+ trigger: string;
77
+ content?: undefined;
78
+ };
79
+ size?: undefined;
80
+ } | {
81
+ class: {
82
+ trigger: string;
83
+ content: string;
84
+ list?: undefined;
85
+ indicator?: undefined;
86
+ };
87
+ orientation?: undefined;
88
+ variant?: undefined;
89
+ size?: undefined;
90
+ })[];
91
+ defaultVariants: {
92
+ variant: string;
93
+ };
94
+ };
95
+ export default _default;
@@ -0,0 +1,144 @@
1
+ import { byColor, forcedEdge, forcedIcon, transition } from "./shared.js";
2
+ /*
3
+ * Tabs read like the tabs of the frame, as the design system's tabs spec, specs/tabs.spec.json,
4
+ * draws them: a row of mono labels over a line, the idle ones in the secondary text color, whose
5
+ * current tab is marked in the brand color, as the frame marks its current tab. That is the link,
6
+ * and tabs are links unless they ask for a pill: a bar on the page color whose current tab is
7
+ * raised, which the spec leaves to the system's segmented control. The focus ring is drawn inside
8
+ * the tab, as the frame draws it. A tab is as tall as a control, and reads the control tier by
9
+ * name, --ws-control-*, so a change of the tier reaches it; a pill's tab is shorter, inside its
10
+ * bar.
11
+ *
12
+ * Until the indicator is in the page, as in the HTML from the server, the current tab draws it
13
+ * itself: the classes that start with in-[[data-slot=list]...] do that.
14
+ *
15
+ * A tab keeps its whole label: tabs that do not fit their row scroll inside it, as a table does,
16
+ * and the marker of a link is drawn inside the row, over its line.
17
+ *
18
+ * In forced colors the current tab is marked in the selection color: a pill's outlined, a link's
19
+ * underlined, and the bar of the pills is outlined. The pill's mark is a ring, which the
20
+ * stylesheet outlines in the text color there: the outline takes the selection color too.
21
+ */
22
+ /**
23
+ * The current tab of a pill is raised and outlined: the raised fill alone is too close to the bar
24
+ * to be seen, the outline is in a color that reads on it.
25
+ */
26
+ const pill = {
27
+ primary: 'data-[state=active]:text-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-raised in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-field-border',
28
+ success: 'data-[state=active]:text-tip-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-tip-tint in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-tip',
29
+ info: 'data-[state=active]:text-note-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-note-tint in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-note',
30
+ warning: 'data-[state=active]:text-warning-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-warning-tint in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-warning',
31
+ error: 'data-[state=active]:text-danger-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-danger-tint in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-danger',
32
+ neutral: 'data-[state=active]:text-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-raised in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-field-border',
33
+ };
34
+ const pillIndicator = {
35
+ primary: 'bg-raised ring ring-inset ring-field-border',
36
+ success: 'bg-tip-tint ring ring-inset ring-tip',
37
+ info: 'bg-note-tint ring ring-inset ring-note',
38
+ warning: 'bg-warning-tint ring ring-inset ring-warning',
39
+ error: 'bg-danger-tint ring ring-inset ring-danger',
40
+ neutral: 'bg-raised ring ring-inset ring-field-border',
41
+ };
42
+ const link = {
43
+ primary: 'data-[state=active]:text-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-brand',
44
+ success: 'data-[state=active]:text-tip-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-tip',
45
+ info: 'data-[state=active]:text-note-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-note',
46
+ warning: 'data-[state=active]:text-warning-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-warning',
47
+ error: 'data-[state=active]:text-danger-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-danger',
48
+ neutral: 'data-[state=active]:text-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-text',
49
+ };
50
+ const linkIndicator = {
51
+ primary: 'bg-brand',
52
+ success: 'bg-tip',
53
+ info: 'bg-note',
54
+ warning: 'bg-warning',
55
+ error: 'bg-danger',
56
+ neutral: 'bg-text',
57
+ };
58
+ /** The ring inside the tab. */
59
+ const focus = 'outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2';
60
+ export default {
61
+ slots: {
62
+ root: 'gap-4',
63
+ // the indicator moves only for a reader who has not asked for less motion, as Nuxt UI has it
64
+ indicator: 'transition-[translate,width,height] duration-(--ws-motion-duration-base) ease-standard',
65
+ leadingIcon: forcedIcon,
66
+ trigger: `font-mono font-normal cursor-pointer data-[state=inactive]:text-text-secondary hover:data-[state=inactive]:not-disabled:text-text disabled:opacity-100 data-[state=inactive]:disabled:text-text-faint ${transition} ${focus}`,
67
+ content: 'outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-3',
68
+ },
69
+ variants: {
70
+ variant: {
71
+ pill: {
72
+ list: `bg-bg ring ring-inset ring-border rounded-md p-1 ${forcedEdge}`,
73
+ trigger: "grow shrink-0 rounded-sm in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:inset-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:rounded-sm in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-inset in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:-z-10 forced-colors:in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:border-2 forced-colors:in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:border-[Highlight] forced-colors:in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:outline-[Highlight] isolate",
74
+ indicator: 'rounded-sm forced-colors:border-2 forced-colors:border-[Highlight] forced-colors:outline-[Highlight]',
75
+ },
76
+ link: {
77
+ list: 'p-0 border-border',
78
+ indicator: 'rounded-none forced-colors:bg-[Highlight]',
79
+ trigger: "shrink-0 rounded-none in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:absolute forced-colors:in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-[Highlight]",
80
+ },
81
+ },
82
+ size: {
83
+ xs: {
84
+ trigger: 'h-(--ws-control-height-xs) px-(--ws-space-8) gap-(--ws-control-gap-xs) text-label-sm',
85
+ leadingIcon: 'size-(--ws-control-icon-size-xs)',
86
+ },
87
+ sm: {
88
+ trigger: 'h-(--ws-control-height-sm) px-(--ws-space-10) gap-(--ws-control-gap-sm) text-label-sm',
89
+ leadingIcon: 'size-(--ws-control-icon-size-sm)',
90
+ },
91
+ md: {
92
+ trigger: 'h-(--ws-control-height-md) px-(--ws-space-14) gap-(--ws-control-gap-md) text-label',
93
+ leadingIcon: 'size-(--ws-control-icon-size-md)',
94
+ },
95
+ lg: {
96
+ trigger: 'h-(--ws-control-height-lg) px-(--ws-space-16) gap-(--ws-control-gap-lg) text-label',
97
+ leadingIcon: 'size-(--ws-control-icon-size-lg)',
98
+ },
99
+ xl: {
100
+ trigger: 'h-(--ws-control-height-xl) px-(--ws-space-16) gap-(--ws-control-gap-xl) text-label',
101
+ leadingIcon: 'size-(--ws-control-icon-size-xl)',
102
+ },
103
+ },
104
+ },
105
+ compoundVariants: [
106
+ // A row of tabs that does not fit scrolls inside itself. A column keeps its width.
107
+ { orientation: 'horizontal', class: { list: 'overflow-x-auto' } },
108
+ ...byColor(pill, { variant: 'pill' }, 'trigger'),
109
+ ...byColor(pillIndicator, { variant: 'pill' }, 'indicator'),
110
+ ...byColor(link, { variant: 'link' }, 'trigger'),
111
+ ...byColor(linkIndicator, { variant: 'link' }, 'indicator'),
112
+ // A pill's tab is inside its bar, which has a padding of 4 pixels.
113
+ { variant: 'pill', size: 'xs', class: { trigger: 'h-6' } },
114
+ { variant: 'pill', size: 'sm', class: { trigger: 'h-7' } },
115
+ { variant: 'pill', size: 'md', class: { trigger: 'h-8' } },
116
+ { variant: 'pill', size: 'lg', class: { trigger: 'h-9' } },
117
+ { variant: 'pill', size: 'xl', class: { trigger: 'h-10' } },
118
+ // A link's marker is a medium border wide, just over the line.
119
+ {
120
+ orientation: 'horizontal',
121
+ variant: 'link',
122
+ class: {
123
+ list: 'border-b-thin',
124
+ indicator: 'bottom-0 h-(--ws-border-width-medium)',
125
+ trigger: 'in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bottom-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:h-(--ws-border-width-medium)',
126
+ },
127
+ },
128
+ {
129
+ orientation: 'vertical',
130
+ variant: 'link',
131
+ class: {
132
+ list: 'border-s-thin',
133
+ indicator: 'start-0 w-(--ws-border-width-medium)',
134
+ trigger: 'justify-start in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:start-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:w-(--ws-border-width-medium)',
135
+ },
136
+ },
137
+ // Nuxt UI tints the focus outline of a tab and of its panel with the color: the ring is the
138
+ // system's.
139
+ { class: { trigger: focus, content: 'outline-interactive' } },
140
+ ],
141
+ defaultVariants: {
142
+ variant: 'link',
143
+ },
144
+ };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The field at each size: at least the control's height, its tags and its text on lines of the
3
+ * text field's, the paddings of the field's, an edge wider than at rest taking what it adds off
4
+ * them. On the smaller sizes a line of text fills the field, which then has no padding above and
5
+ * under it.
6
+ */
7
+ export declare const tagsFieldSizes: {
8
+ xs: string;
9
+ sm: string;
10
+ md: string;
11
+ lg: string;
12
+ xl: string;
13
+ };
14
+ /** The tag of each size of the field: a size smaller, and the smallest on the two smallest. */
15
+ export declare const tagOfField: {
16
+ xs: string;
17
+ sm: string;
18
+ md: string;
19
+ lg: string;
20
+ xl: string;
21
+ };
22
+ /** A tag, as the badge draws one, neutral: its words wrap where a long one is wider than the field. */
23
+ export declare const tag = "inline-flex items-center rounded-(--ws-tag-radius) font-mono font-normal wrap-anywhere ring-0 bg-(--ws-tag-neutral-bg-rest) text-(--ws-tag-neutral-text-rest) data-disabled:opacity-100 data-disabled:text-(--ws-field-text-disabled) data-[state=active]:bg-(--ws-tag-neutral-bg-rest) outline-interactive data-[state=active]:outline-2 data-[state=active]:outline-solid data-[state=active]:outline-offset-3 forced-colors:border forced-colors:border-[CanvasText] forced-colors:data-[state=active]:bg-[Highlight] forced-colors:data-[state=active]:text-[HighlightText] forced-colors:data-[state=active]:forced-color-adjust-none";
24
+ /** On a raised field, the soft and the subtle one, a tag is on the field's color at rest. */
25
+ export declare const tagOnRaised = "bg-(--ws-field-bg-rest) data-[state=active]:bg-(--ws-field-bg-rest)";
26
+ /** The button that takes a tag out, and its icon. */
27
+ export declare const tagDelete = "inline-flex items-center rounded-(--ws-radius-xs) text-(--ws-field-icon-rest) hover:text-text hover:bg-transparent disabled:opacity-100 disabled:text-(--ws-field-text-disabled) transition-colors motion-reduce:transition-none";
28
+ export declare const tagDeleteIcon = "forced-colors:not-[svg]:bg-[CanvasText] forced-colors:in-disabled:not-[svg]:bg-[GrayText] forced-colors:in-aria-disabled:not-[svg]:bg-[GrayText] forced-colors:in-data-[state=active]:not-[svg]:bg-[HighlightText]";
29
+ /**
30
+ * The icon's size at every size of the field: the system's icon size, as a tag's icons are. Nuxt
31
+ * UI sizes it with the field, so it goes in each of the field's sizes, after Nuxt UI's.
32
+ */
33
+ export declare const tagDeleteIconSize = "size-icon";
34
+ /**
35
+ * The text field after the tags, with no edge of its own: the field shows its focus. It fills
36
+ * what its line leaves, at least --ws-space-48. Its width is a share of the field's, as a text
37
+ * field's is: one with no width takes the browser's twenty characters at least, which would hold
38
+ * a field of tags at the larger sizes, with the room for its icons, wider than a phone's column.
39
+ */
40
+ export declare const tagsInput = "w-full min-w-(--ws-space-48) text-(--ws-field-text-rest) placeholder:text-text-secondary disabled:text-(--ws-field-text-disabled) disabled:opacity-100";
@@ -0,0 +1,52 @@
1
+ import { tagSizes } from "./badge.js";
2
+ import { forcedEdge, forcedIcon, transition } from "./shared.js";
3
+ /*
4
+ * A field of tags: the tags an input tags field holds, and the ones an input menu that takes
5
+ * several values shows. The field is a field at the control height that grows as its tags wrap
6
+ * onto more lines; each tag is the system's tag, neutral, at the size that fits the field's, with
7
+ * a button that takes it out. The text field after the tags is the field's value, in Inter.
8
+ *
9
+ * The tag on its tint has no edge, and an edge in forced colors, as every tag there. The tag the
10
+ * arrow keys are on, the one Backspace takes out, has the system's focus ring, and in forced
11
+ * colors the selection's colors.
12
+ */
13
+ /**
14
+ * The field at each size: at least the control's height, its tags and its text on lines of the
15
+ * text field's, the paddings of the field's, an edge wider than at rest taking what it adds off
16
+ * them. On the smaller sizes a line of text fills the field, which then has no padding above and
17
+ * under it.
18
+ */
19
+ export const tagsFieldSizes = {
20
+ xs: 'h-auto min-h-(--ws-control-height-xs) px-[calc(var(--ws-space-8)-var(--field-edge-extra,0px))] py-0 gap-(--ws-control-gap-xs) text-body-sm',
21
+ sm: 'h-auto min-h-(--ws-control-height-sm) px-[calc(var(--ws-space-10)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-2)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-sm) text-body-sm',
22
+ md: 'h-auto min-h-(--ws-control-height-md) px-[calc(var(--ws-space-12)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-4)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-md) text-body',
23
+ lg: 'h-auto min-h-(--ws-control-height-lg) px-[calc(var(--ws-space-14)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-6)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-lg) text-body',
24
+ xl: 'h-auto min-h-(--ws-control-height-xl) px-[calc(var(--ws-space-16)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-8)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-xl) text-body',
25
+ };
26
+ /** The tag of each size of the field: a size smaller, and the smallest on the two smallest. */
27
+ export const tagOfField = {
28
+ xs: tagSizes.xs,
29
+ sm: tagSizes.xs,
30
+ md: tagSizes.sm,
31
+ lg: tagSizes.md,
32
+ xl: tagSizes.lg,
33
+ };
34
+ /** A tag, as the badge draws one, neutral: its words wrap where a long one is wider than the field. */
35
+ export const tag = `inline-flex items-center rounded-(--ws-tag-radius) font-mono font-normal wrap-anywhere ring-0 bg-(--ws-tag-neutral-bg-rest) text-(--ws-tag-neutral-text-rest) data-disabled:opacity-100 data-disabled:text-(--ws-field-text-disabled) data-[state=active]:bg-(--ws-tag-neutral-bg-rest) outline-interactive data-[state=active]:outline-2 data-[state=active]:outline-solid data-[state=active]:outline-offset-3 ${forcedEdge} forced-colors:data-[state=active]:bg-[Highlight] forced-colors:data-[state=active]:text-[HighlightText] forced-colors:data-[state=active]:forced-color-adjust-none`;
36
+ /** On a raised field, the soft and the subtle one, a tag is on the field's color at rest. */
37
+ export const tagOnRaised = 'bg-(--ws-field-bg-rest) data-[state=active]:bg-(--ws-field-bg-rest)';
38
+ /** The button that takes a tag out, and its icon. */
39
+ export const tagDelete = `inline-flex items-center rounded-(--ws-radius-xs) text-(--ws-field-icon-rest) hover:text-text hover:bg-transparent disabled:opacity-100 disabled:text-(--ws-field-text-disabled) ${transition}`;
40
+ export const tagDeleteIcon = `${forcedIcon} forced-colors:in-data-[state=active]:not-[svg]:bg-[HighlightText]`;
41
+ /**
42
+ * The icon's size at every size of the field: the system's icon size, as a tag's icons are. Nuxt
43
+ * UI sizes it with the field, so it goes in each of the field's sizes, after Nuxt UI's.
44
+ */
45
+ export const tagDeleteIconSize = 'size-icon';
46
+ /**
47
+ * The text field after the tags, with no edge of its own: the field shows its focus. It fills
48
+ * what its line leaves, at least --ws-space-48. Its width is a share of the field's, as a text
49
+ * field's is: one with no width takes the browser's twenty characters at least, which would hold
50
+ * a field of tags at the larger sizes, with the room for its icons, wider than a phone's column.
51
+ */
52
+ export const tagsInput = 'w-full min-w-(--ws-space-48) text-(--ws-field-text-rest) placeholder:text-text-secondary disabled:text-(--ws-field-text-disabled) disabled:opacity-100';
@@ -0,0 +1,127 @@
1
+ declare const _default: {
2
+ slots: {
3
+ base: string;
4
+ leadingIcon: string;
5
+ trailingIcon: string;
6
+ };
7
+ variants: {
8
+ size: {
9
+ xs: {
10
+ base: string;
11
+ leading: string;
12
+ trailing: string;
13
+ leadingIcon: string;
14
+ trailingIcon: string;
15
+ };
16
+ sm: {
17
+ base: string;
18
+ leading: string;
19
+ trailing: string;
20
+ leadingIcon: string;
21
+ trailingIcon: string;
22
+ };
23
+ md: {
24
+ base: string;
25
+ leading: string;
26
+ trailing: string;
27
+ leadingIcon: string;
28
+ trailingIcon: string;
29
+ };
30
+ lg: {
31
+ base: string;
32
+ leading: string;
33
+ trailing: string;
34
+ leadingIcon: string;
35
+ trailingIcon: string;
36
+ };
37
+ xl: {
38
+ base: string;
39
+ leading: string;
40
+ trailing: string;
41
+ leadingIcon: string;
42
+ trailingIcon: string;
43
+ };
44
+ };
45
+ variant: {
46
+ outline: string;
47
+ soft: string;
48
+ subtle: string;
49
+ ghost: string;
50
+ none: string;
51
+ };
52
+ type: {
53
+ file: string;
54
+ };
55
+ };
56
+ compoundVariants: ({
57
+ variant: string;
58
+ highlight: boolean;
59
+ class: string;
60
+ color?: undefined;
61
+ } | {
62
+ variant: string;
63
+ highlight: boolean;
64
+ color: string;
65
+ class: string;
66
+ } | {
67
+ fixed: boolean;
68
+ size: string[];
69
+ class: string;
70
+ } | {
71
+ leading: boolean;
72
+ size: "xs" | "sm" | "md" | "lg" | "xl";
73
+ class: string;
74
+ } | {
75
+ trailing: boolean;
76
+ size: "xs" | "sm" | "md" | "lg" | "xl";
77
+ class: string;
78
+ } | {
79
+ loading: boolean;
80
+ leading: boolean;
81
+ class: {
82
+ leadingIcon: string;
83
+ trailingIcon?: undefined;
84
+ };
85
+ trailing?: undefined;
86
+ } | {
87
+ loading: boolean;
88
+ leading: boolean;
89
+ trailing: boolean;
90
+ class: {
91
+ trailingIcon: string;
92
+ leadingIcon?: undefined;
93
+ };
94
+ } | ({
95
+ highlight: boolean;
96
+ } & {
97
+ color: import("./shared.ts").Color;
98
+ class: string | Record<string, string>;
99
+ }) | {
100
+ variant: string[];
101
+ class: string;
102
+ } | {
103
+ fieldGroup: string[];
104
+ class: {
105
+ root: string;
106
+ };
107
+ highlight?: undefined;
108
+ } | {
109
+ fieldGroup: string[];
110
+ highlight: boolean;
111
+ class: {
112
+ root: string;
113
+ };
114
+ } | {
115
+ variant: string;
116
+ size: string;
117
+ class: {
118
+ leading: string;
119
+ trailing: string;
120
+ };
121
+ } | {
122
+ variant: string;
123
+ size: string;
124
+ class: string;
125
+ })[];
126
+ };
127
+ export default _default;
@@ -0,0 +1,72 @@
1
+ import { fieldSizes } from "./field.js";
2
+ import input from "./input.js";
3
+ /*
4
+ * The design system's text area spec, specs/textarea.spec.json: the input's field, with rows of
5
+ * text in place of its one line and no height of its own, so it is as tall as its rows. Its value
6
+ * is the field's text style at each size, line height and all. The padding above and below the
7
+ * text is half of what the control's height leaves around a line, less the edge, so its first
8
+ * line sits where an input's value does and a text area of one row is as tall as the input of
9
+ * its size. An edge wider than the rest edge, an error's, takes what it adds off the padding on
10
+ * every side, so the text keeps its place.
11
+ *
12
+ * Nuxt UI builds its text area on the input's theme, and so does this one: the edge, the value,
13
+ * the states and the variants are the input's. The spec draws no icons, as several lines have no
14
+ * one line for an icon to sit on: one an app passes anyway sits where the input's does.
15
+ */
16
+ /** The heights of the rows, with the padding around them; the icons' places are the input's. */
17
+ const size = {
18
+ xs: {
19
+ ...fieldSizes.xs,
20
+ base: 'px-[calc(var(--ws-space-8)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-2)-var(--ws-control-border-width-rest)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-xs) text-body-sm',
21
+ },
22
+ sm: {
23
+ ...fieldSizes.sm,
24
+ base: 'px-[calc(var(--ws-space-10)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-4)-var(--ws-control-border-width-rest)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-sm) text-body-sm',
25
+ },
26
+ md: {
27
+ ...fieldSizes.md,
28
+ base: 'px-[calc(var(--ws-space-12)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-6)-var(--ws-control-border-width-rest)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-md) text-body',
29
+ },
30
+ lg: {
31
+ ...fieldSizes.lg,
32
+ base: 'px-[calc(var(--ws-space-14)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-8)-var(--ws-control-border-width-rest)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-lg) text-body',
33
+ },
34
+ xl: {
35
+ ...fieldSizes.xl,
36
+ base: 'px-[calc(var(--ws-space-16)-var(--field-edge-extra,0px))] py-[calc(var(--ws-space-10)-var(--ws-control-border-width-rest)-var(--field-edge-extra,0px))] gap-(--ws-control-gap-xl) text-body',
37
+ },
38
+ };
39
+ export default {
40
+ slots: input.slots,
41
+ variants: { ...input.variants, size },
42
+ compoundVariants: [
43
+ ...input.compoundVariants,
44
+ // The bare field draws no edge, so it takes none off the padding: one row is still as tall as
45
+ // the input of its size.
46
+ {
47
+ variant: 'none',
48
+ size: 'xs',
49
+ class: 'py-[calc(var(--ws-space-2)-var(--field-edge-extra,0px))]',
50
+ },
51
+ {
52
+ variant: 'none',
53
+ size: 'sm',
54
+ class: 'py-[calc(var(--ws-space-4)-var(--field-edge-extra,0px))]',
55
+ },
56
+ {
57
+ variant: 'none',
58
+ size: 'md',
59
+ class: 'py-[calc(var(--ws-space-6)-var(--field-edge-extra,0px))]',
60
+ },
61
+ {
62
+ variant: 'none',
63
+ size: 'lg',
64
+ class: 'py-[calc(var(--ws-space-8)-var(--field-edge-extra,0px))]',
65
+ },
66
+ {
67
+ variant: 'none',
68
+ size: 'xl',
69
+ class: 'py-[calc(var(--ws-space-10)-var(--field-edge-extra,0px))]',
70
+ },
71
+ ],
72
+ };