@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,124 @@
1
+ import { fieldHighlight } from "./field.js";
2
+ import { byColor, focusRing, forcedControlEdge, forcedIcon, transition } from "./shared.js";
3
+ /*
4
+ * A file chosen or dropped: a drop area, or a button, in the field's edge, on the page color,
5
+ * with the system's focus ring. Nuxt UI dashes the drop area's edge; the system has no dashed
6
+ * edge, so it is solid, the field border, the text color's secondary under the pointer and while
7
+ * a file is dragged over it. A highlighted area takes its color as the edge, an area in error
8
+ * the danger color, wider, its padding taking what it adds. The edge is a border, so forced
9
+ * colors keep it, and draw it in the selection color while a file is over the area.
10
+ *
11
+ * The area's words are a label and its help: the label mono, the description in Inter in the
12
+ * secondary text, as a form field's. A chosen file is a row in the field's edge, its name the
13
+ * value and its size a caption.
14
+ */
15
+ /** The area's padding, and the button's side, at each size. */
16
+ const sizes = {
17
+ xs: {
18
+ base: 'text-body-sm',
19
+ icon: 'size-(--ws-control-icon-size-xs)',
20
+ avatar: 'size-(--ws-control-height-xs) text-(length:--ws-control-icon-size-xs)',
21
+ file: 'text-body-sm px-(--ws-space-8) py-(--ws-space-4) gap-(--ws-control-gap-xs)',
22
+ fileSize: 'text-caption',
23
+ },
24
+ sm: {
25
+ base: 'text-body-sm',
26
+ icon: 'size-(--ws-control-icon-size-sm)',
27
+ avatar: 'size-(--ws-control-height-sm) text-(length:--ws-control-icon-size-sm)',
28
+ file: 'text-body-sm px-(--ws-space-10) py-(--ws-space-6) gap-(--ws-control-gap-sm)',
29
+ fileSize: 'text-caption',
30
+ },
31
+ md: {
32
+ base: 'text-body-sm',
33
+ icon: 'size-(--ws-control-icon-size-md)',
34
+ avatar: 'size-(--ws-control-height-md) text-(length:--ws-control-icon-size-md)',
35
+ file: 'text-body-sm px-(--ws-space-12) py-(--ws-space-6) gap-(--ws-control-gap-md)',
36
+ fileSize: 'text-caption',
37
+ },
38
+ lg: {
39
+ base: 'text-body',
40
+ icon: 'size-(--ws-control-icon-size-lg)',
41
+ avatar: 'size-(--ws-control-height-lg) text-(length:--ws-control-icon-size-lg)',
42
+ file: 'text-body px-(--ws-space-14) py-(--ws-space-8) gap-(--ws-control-gap-lg)',
43
+ fileSize: 'text-caption',
44
+ },
45
+ xl: {
46
+ base: 'text-body',
47
+ icon: 'size-(--ws-control-icon-size-xl)',
48
+ avatar: 'size-(--ws-control-height-xl) text-(length:--ws-control-icon-size-xl)',
49
+ file: 'text-body px-(--ws-space-16) py-(--ws-space-8) gap-(--ws-control-gap-xl)',
50
+ fileSize: 'text-caption',
51
+ },
52
+ };
53
+ /** The button at each size: a square of the control's height around its icon. */
54
+ const buttons = ['xs', 'sm', 'md', 'lg', 'xl'].map((size) => ({
55
+ variant: 'button',
56
+ size,
57
+ class: {
58
+ base: {
59
+ xs: 'flex-none size-(--ws-control-height-xs) p-0 items-center',
60
+ sm: 'flex-none size-(--ws-control-height-sm) p-0 items-center',
61
+ md: 'flex-none size-(--ws-control-height-md) p-0 items-center',
62
+ lg: 'flex-none size-(--ws-control-height-lg) p-0 items-center',
63
+ xl: 'flex-none size-(--ws-control-height-xl) p-0 items-center',
64
+ }[size],
65
+ },
66
+ }));
67
+ export default {
68
+ slots: {
69
+ base: `bg-(--ws-field-bg-rest) border-(length:--ws-control-border-width-rest) border-solid border-(--ws-field-border-rest) rounded-(--ws-control-radius) ${forcedControlEdge} ${transition}`,
70
+ icon: `text-(--ws-field-icon-rest) ${forcedIcon}`,
71
+ avatar: 'bg-raised',
72
+ label: 'mt-(--ws-space-8) font-mono font-normal text-label text-(--ws-field-label-text-rest)',
73
+ description: 'mt-(--ws-space-4) font-sans text-text-secondary',
74
+ actions: 'mt-(--ws-space-16) gap-(--ws-space-8)',
75
+ file: 'font-sans text-(--ws-field-text-rest)',
76
+ fileName: 'text-(--ws-field-text-rest)',
77
+ fileSize: 'font-mono text-text-secondary',
78
+ },
79
+ variants: {
80
+ size: sizes,
81
+ variant: {
82
+ area: {
83
+ base: 'p-[calc(var(--ws-space-16)-var(--field-edge-extra,0px))]',
84
+ wrapper: 'px-(--ws-space-16) py-(--ws-space-12)',
85
+ },
86
+ },
87
+ layout: {
88
+ list: {
89
+ files: 'gap-(--ws-space-8)',
90
+ file: `border-(length:--ws-control-border-width-rest) border-(--ws-field-border-rest) rounded-(--ws-control-radius) ${forcedControlEdge}`,
91
+ },
92
+ grid: {
93
+ fileLeadingAvatar: 'rounded-(--ws-control-radius)',
94
+ files: 'gap-(--ws-space-16)',
95
+ },
96
+ },
97
+ },
98
+ compoundVariants: [
99
+ // over Nuxt UI's ring and edge in each color: the system's ring, the edge as it is at rest
100
+ { class: `${focusRing} focus-visible:border-(--ws-field-border-rest)` },
101
+ {
102
+ interactive: true,
103
+ disabled: false,
104
+ class: 'hover:bg-(--ws-field-bg-rest) hover:border-(--ws-field-border-hover)',
105
+ },
106
+ // disabled, unfaded: the edge and the words in the field's disabled colors
107
+ {
108
+ disabled: true,
109
+ class: {
110
+ base: 'opacity-100 border-(--ws-field-border-disabled)',
111
+ icon: 'text-(--ws-field-text-disabled)',
112
+ label: 'text-(--ws-field-text-disabled)',
113
+ description: 'text-(--ws-field-text-disabled)',
114
+ },
115
+ },
116
+ // solid, as every edge of the system, and under a file dragged over it as under the pointer
117
+ {
118
+ dropzone: true,
119
+ class: 'border-solid data-[dragging=true]:bg-(--ws-field-bg-rest) data-[dragging=true]:border-(--ws-field-border-hover) forced-colors:data-[dragging=true]:border-[Highlight]',
120
+ },
121
+ ...byColor(fieldHighlight, { highlight: true }),
122
+ ...buttons,
123
+ ],
124
+ };
@@ -0,0 +1,44 @@
1
+ declare const _default: {
2
+ slots: {
3
+ label: string;
4
+ description: string;
5
+ hint: string;
6
+ help: string;
7
+ error: string;
8
+ };
9
+ variants: {
10
+ size: {
11
+ xs: {
12
+ root: string;
13
+ label: string;
14
+ };
15
+ sm: {
16
+ root: string;
17
+ label: string;
18
+ };
19
+ md: {
20
+ root: string;
21
+ label: string;
22
+ };
23
+ lg: {
24
+ root: string;
25
+ label: string;
26
+ };
27
+ xl: {
28
+ root: string;
29
+ label: string;
30
+ };
31
+ };
32
+ required: {
33
+ true: {
34
+ label: string;
35
+ };
36
+ };
37
+ orientation: {
38
+ vertical: {
39
+ container: string;
40
+ };
41
+ };
42
+ };
43
+ };
44
+ export default _default;
@@ -0,0 +1,34 @@
1
+ /*
2
+ * The form field of the design system's input spec: a mono label, the control, then the help and
3
+ * the error under it, six pixels apart. The error is a word with the danger icon before it, at
4
+ * the icon size and centered on its first line, never a color alone, and in forced colors the
5
+ * icon takes the text's color. The required mark is the system's red, which reads at 4.5:1 in
6
+ * both themes. Hints go under the field: the help text, not the hint beside the label. The colors
7
+ * read the component tier by name, --ws-field-*.
8
+ */
9
+ export default {
10
+ slots: {
11
+ label: 'font-mono font-normal text-(--ws-field-label-text-rest)',
12
+ description: 'text-text-secondary font-sans',
13
+ hint: 'text-text-secondary font-sans',
14
+ help: 'mt-1.5 text-(--ws-field-help-text-rest) font-sans',
15
+ error: "mt-1.5 flex gap-1.5 font-sans font-(--ws-field-error-font-weight) text-(--ws-field-error-text-rest) before:shrink-0 before:size-icon before:mt-[calc((1lh-var(--ws-size-icon))/2)] before:text-(--ws-field-error-icon-rest) before:bg-current before:content-[''] before:mask-(--ws-icon-danger) before:mask-center before:mask-no-repeat before:mask-size-(--ws-size-icon) forced-colors:before:bg-[CanvasText]",
16
+ },
17
+ variants: {
18
+ size: {
19
+ xs: { root: 'text-body-sm', label: 'text-label-sm' },
20
+ sm: { root: 'text-body-sm', label: 'text-label-sm' },
21
+ md: { root: 'text-body-sm', label: 'text-label' },
22
+ lg: { root: 'text-body-sm', label: 'text-label' },
23
+ xl: { root: 'text-body', label: 'text-label' },
24
+ },
25
+ required: {
26
+ true: {
27
+ label: "after:content-['*'] after:ms-0.5 after:text-(--ws-field-required-text-rest)",
28
+ },
29
+ },
30
+ orientation: {
31
+ vertical: { container: 'mt-1.5' },
32
+ },
33
+ },
34
+ };