@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.
- package/LICENSE +21 -0
- package/README.md +24 -2
- package/dist/color-mode.d.ts +14 -0
- package/dist/color-mode.js +34 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/theme/badge.d.ts +70 -0
- package/dist/theme/badge.js +116 -0
- package/dist/theme/button.d.ts +136 -0
- package/dist/theme/button.js +193 -0
- package/dist/theme/card.d.ts +29 -0
- package/dist/theme/card.js +44 -0
- package/dist/theme/checkbox.d.ts +159 -0
- package/dist/theme/checkbox.js +73 -0
- package/dist/theme/choice.d.ts +82 -0
- package/dist/theme/choice.js +124 -0
- package/dist/theme/field-group.d.ts +9 -0
- package/dist/theme/field-group.js +16 -0
- package/dist/theme/field.d.ts +263 -0
- package/dist/theme/field.js +248 -0
- package/dist/theme/file-upload.d.ts +106 -0
- package/dist/theme/file-upload.js +124 -0
- package/dist/theme/form-field.d.ts +44 -0
- package/dist/theme/form-field.js +34 -0
- package/dist/theme/index.d.ts +2349 -0
- package/dist/theme/index.js +130 -0
- package/dist/theme/input-date.d.ts +127 -0
- package/dist/theme/input-date.js +78 -0
- package/dist/theme/input-menu.d.ts +210 -0
- package/dist/theme/input-menu.js +83 -0
- package/dist/theme/input-number.d.ts +77 -0
- package/dist/theme/input-number.js +110 -0
- package/dist/theme/input-tags.d.ts +284 -0
- package/dist/theme/input-tags.js +38 -0
- package/dist/theme/input-time.d.ts +2 -0
- package/dist/theme/input-time.js +5 -0
- package/dist/theme/input.d.ts +138 -0
- package/dist/theme/input.js +48 -0
- package/dist/theme/modal.d.ts +31 -0
- package/dist/theme/modal.js +44 -0
- package/dist/theme/pin-input.d.ts +61 -0
- package/dist/theme/pin-input.js +40 -0
- package/dist/theme/radio-group.d.ts +177 -0
- package/dist/theme/radio-group.js +111 -0
- package/dist/theme/select-menu.d.ts +154 -0
- package/dist/theme/select-menu.js +22 -0
- package/dist/theme/select.d.ts +254 -0
- package/dist/theme/select.js +109 -0
- package/dist/theme/shared.d.ts +69 -0
- package/dist/theme/shared.js +103 -0
- package/dist/theme/table.d.ts +45 -0
- package/dist/theme/table.js +111 -0
- package/dist/theme/tabs.d.ts +95 -0
- package/dist/theme/tabs.js +144 -0
- package/dist/theme/tags.d.ts +40 -0
- package/dist/theme/tags.js +52 -0
- package/dist/theme/textarea.d.ts +127 -0
- package/dist/theme/textarea.js +72 -0
- package/package.json +65 -3
- package/src/index.css +123 -0
- package/src/nuxt-ui.css +148 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Whatsaaaa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="https://raw.githubusercontent.com/whatsaaaa/ui-vue/main/.github/assets/readme-header.svg" alt="whatsaaaa" width="100%" />
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @whatsaaaa/ui-vue
|
|
4
|
+
|
|
5
|
+
[Nuxt UI](https://ui.nuxt.com) themed with the [Whatsaaaa design system](https://github.com/whatsaaaa/design-system), for Vue and Nuxt. A trial: twelve core components (button, badge, input, text area, number field, select and select menu, checkbox, radio group, card, modal, table, tabs) take the system's terminal look through Nuxt UI's central config, in both themes, held to its specs, and seven more (pin input, input tags, input menu, input date, input time, file upload, field group) are restyled on its tiers.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @whatsaaaa/ui-vue '@whatsaaaa/design-system@^1.1.0' '@nuxt/ui@~4.13.0' tailwindcss
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The versions are the package's peer ranges: a release works with one minor of Nuxt UI and, until the design system's 1.0.0, one minor of it.
|
|
14
|
+
|
|
15
|
+
The package brings three things:
|
|
16
|
+
|
|
17
|
+
- **`theme` and `ui`** from `@whatsaaaa/ui-vue`: Nuxt UI's module options and the components' config.
|
|
18
|
+
- **`@whatsaaaa/ui-vue/index.css`**, the app's whole stylesheet, imported alone and first.
|
|
19
|
+
- **`colorModeInitScript` and `vueColorModeInitScript`** from `@whatsaaaa/ui-vue/color-mode`: the head script the design system's theme needs next to Nuxt UI's color mode, on Nuxt and on Vue.
|
|
20
|
+
|
|
21
|
+
The [repository's README](https://github.com/whatsaaaa/ui-vue#use-it) shows the setup on Nuxt and on Vue.
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
[MIT](https://github.com/whatsaaaa/ui-vue/blob/main/LICENSE). Built on [Nuxt UI](https://ui.nuxt.com) and the [Whatsaaaa design system](https://github.com/whatsaaaa/design-system).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The head script on Nuxt, for before any stylesheet, in place of the design system's: its own,
|
|
3
|
+
* which keeps the browser's bars at the theme's background, after forgetting `ws-theme`.
|
|
4
|
+
*
|
|
5
|
+
* app: { head: { script: [{ innerHTML: colorModeInitScript }] } }
|
|
6
|
+
*/
|
|
7
|
+
export declare const colorModeInitScript: string;
|
|
8
|
+
/**
|
|
9
|
+
* The head script on Vue: colorModeInitScript, and VueUse's remembered preference as the class of
|
|
10
|
+
* <html>, so a chosen theme shows from the first paint. With none the tokens follow the system.
|
|
11
|
+
*
|
|
12
|
+
* <script>{vueColorModeInitScript}</script>
|
|
13
|
+
*/
|
|
14
|
+
export declare const vueColorModeInitScript: string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The design system's theme with Nuxt UI's color mode.
|
|
3
|
+
*
|
|
4
|
+
* The design system's tokens follow a dark or light class as they follow data-theme, so Nuxt UI's
|
|
5
|
+
* color mode, @nuxtjs/color-mode on Nuxt and VueUse's useColorMode on Vue, switches the theme by
|
|
6
|
+
* itself: it puts the class of the theme on <html> and remembers the choice. Switch the theme
|
|
7
|
+
* with the color mode, not with the design system's setTheme or toggleTheme: the data-theme they
|
|
8
|
+
* write wins over the class. What is left here is the head script, which keeps a choice
|
|
9
|
+
* remembered under the design system's `ws-theme` from setting a data-theme over the color mode's
|
|
10
|
+
* class, and on Vue puts the color mode's remembered class on before the first paint, as
|
|
11
|
+
* @nuxtjs/color-mode's own head script does on Nuxt.
|
|
12
|
+
*/
|
|
13
|
+
import { THEME_STORAGE_KEY, themeInitScript } from '@whatsaaaa/design-system/theme';
|
|
14
|
+
/** Where VueUse's color mode remembers its preference: `dark`, `light` or `auto`. */
|
|
15
|
+
const VUE_STORAGE_KEY = 'vueuse-color-scheme';
|
|
16
|
+
/**
|
|
17
|
+
* The theme module remembers a choice under `ws-theme`, and the design system's head script sets
|
|
18
|
+
* data-theme from it, which wins over the class. The color mode remembers the choice instead.
|
|
19
|
+
*/
|
|
20
|
+
const forgetTheme = `try{localStorage.removeItem(${JSON.stringify(THEME_STORAGE_KEY)})}catch(e){}`;
|
|
21
|
+
/**
|
|
22
|
+
* The head script on Nuxt, for before any stylesheet, in place of the design system's: its own,
|
|
23
|
+
* which keeps the browser's bars at the theme's background, after forgetting `ws-theme`.
|
|
24
|
+
*
|
|
25
|
+
* app: { head: { script: [{ innerHTML: colorModeInitScript }] } }
|
|
26
|
+
*/
|
|
27
|
+
export const colorModeInitScript = `(function(){${forgetTheme}})();${themeInitScript}`;
|
|
28
|
+
/**
|
|
29
|
+
* The head script on Vue: colorModeInitScript, and VueUse's remembered preference as the class of
|
|
30
|
+
* <html>, so a chosen theme shows from the first paint. With none the tokens follow the system.
|
|
31
|
+
*
|
|
32
|
+
* <script>{vueColorModeInitScript}</script>
|
|
33
|
+
*/
|
|
34
|
+
export const vueColorModeInitScript = `(function(){${forgetTheme}try{var m=localStorage.getItem(${JSON.stringify(VUE_STORAGE_KEY)});if(m==='dark'||m==='light')document.documentElement.classList.add(m)}catch(e){}})();${themeInitScript}`;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nuxt UI themed with the Whatsaaaa design system.
|
|
3
|
+
*
|
|
4
|
+
* - `theme` goes to Nuxt UI's module options: `ui.theme` in nuxt.config.ts, `theme` in the Vite
|
|
5
|
+
* plugin's options.
|
|
6
|
+
* - `ui` is the app config of the components: `defineAppConfig({ ui })` in app.config.ts, `ui`
|
|
7
|
+
* in the Vite plugin's options.
|
|
8
|
+
*
|
|
9
|
+
* With them go the stylesheet, `@whatsaaaa/ui-vue/index.css`, and the color mode's head script
|
|
10
|
+
* in `@whatsaaaa/ui-vue/color-mode`. The repository's README shows each setup.
|
|
11
|
+
*/
|
|
12
|
+
export { theme, ui } from './theme/index.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nuxt UI themed with the Whatsaaaa design system.
|
|
3
|
+
*
|
|
4
|
+
* - `theme` goes to Nuxt UI's module options: `ui.theme` in nuxt.config.ts, `theme` in the Vite
|
|
5
|
+
* plugin's options.
|
|
6
|
+
* - `ui` is the app config of the components: `defineAppConfig({ ui })` in app.config.ts, `ui`
|
|
7
|
+
* in the Vite plugin's options.
|
|
8
|
+
*
|
|
9
|
+
* With them go the stylesheet, `@whatsaaaa/ui-vue/index.css`, and the color mode's head script
|
|
10
|
+
* in `@whatsaaaa/ui-vue/color-mode`. The repository's README shows each setup.
|
|
11
|
+
*/
|
|
12
|
+
export { theme, ui } from "./theme/index.js";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** The tag's room and type at each size: an input's tags take them too. */
|
|
2
|
+
export declare const tagSizes: {
|
|
3
|
+
xs: string;
|
|
4
|
+
sm: string;
|
|
5
|
+
md: string;
|
|
6
|
+
lg: string;
|
|
7
|
+
xl: string;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: {
|
|
10
|
+
slots: {
|
|
11
|
+
base: string;
|
|
12
|
+
label: string;
|
|
13
|
+
leadingIcon: string;
|
|
14
|
+
trailingIcon: string;
|
|
15
|
+
};
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
xs: {
|
|
19
|
+
leadingIcon: string;
|
|
20
|
+
trailingIcon: string;
|
|
21
|
+
base: string;
|
|
22
|
+
};
|
|
23
|
+
sm: {
|
|
24
|
+
leadingIcon: string;
|
|
25
|
+
trailingIcon: string;
|
|
26
|
+
base: string;
|
|
27
|
+
};
|
|
28
|
+
md: {
|
|
29
|
+
leadingIcon: string;
|
|
30
|
+
trailingIcon: string;
|
|
31
|
+
base: string;
|
|
32
|
+
};
|
|
33
|
+
lg: {
|
|
34
|
+
leadingIcon: string;
|
|
35
|
+
trailingIcon: string;
|
|
36
|
+
base: string;
|
|
37
|
+
};
|
|
38
|
+
xl: {
|
|
39
|
+
leadingIcon: string;
|
|
40
|
+
trailingIcon: string;
|
|
41
|
+
base: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
compoundVariants: (({
|
|
46
|
+
variant: string;
|
|
47
|
+
} & {
|
|
48
|
+
color: import("./shared.ts").Color;
|
|
49
|
+
class: string | Record<string, string>;
|
|
50
|
+
}) | {
|
|
51
|
+
variant: string;
|
|
52
|
+
class: string;
|
|
53
|
+
size?: undefined;
|
|
54
|
+
square?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
variant: string;
|
|
57
|
+
size: string;
|
|
58
|
+
class: string;
|
|
59
|
+
square?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
size: string[];
|
|
62
|
+
square: boolean;
|
|
63
|
+
class: string;
|
|
64
|
+
variant?: undefined;
|
|
65
|
+
})[];
|
|
66
|
+
defaultVariants: {
|
|
67
|
+
variant: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export default _default;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { byColor, forcedEdge, forcedIcon, solid } from "./shared.js";
|
|
2
|
+
/*
|
|
3
|
+
* The badge of the design system's spec, specs/badge.spec.json: the system's tag, a mono label on
|
|
4
|
+
* a tint of its color, in the small radius. The tag is the soft variant, so soft is the default.
|
|
5
|
+
* Its kinds are Nuxt UI's colors and variants:
|
|
6
|
+
*
|
|
7
|
+
* primary, success, info, warning, neutral that color, soft
|
|
8
|
+
* danger error, soft
|
|
9
|
+
* outline neutral, outline
|
|
10
|
+
*
|
|
11
|
+
* They read the component tier by name, --ws-tag-*, so a change of the tier reaches them. The
|
|
12
|
+
* other colors and variants keep working on the roles, outside the spec.
|
|
13
|
+
*
|
|
14
|
+
* The outlined tag's edge is a border, not Nuxt UI's ring, so that forced colors keep it, and it
|
|
15
|
+
* is roomier than a tag on a tint: its padding-inline is inside the edge, and its padding-block
|
|
16
|
+
* holds the edge, as .ws-tag--outline draws it. Its icons are the system's icon size at every
|
|
17
|
+
* size: a tag does not grow its icon as a control does.
|
|
18
|
+
*/
|
|
19
|
+
/** A tint of the color under its text color: the tag, at every color of the tier. */
|
|
20
|
+
const tag = {
|
|
21
|
+
primary: 'bg-(--ws-tag-primary-bg-rest) text-(--ws-tag-primary-text-rest)',
|
|
22
|
+
success: 'bg-(--ws-tag-success-bg-rest) text-(--ws-tag-success-text-rest)',
|
|
23
|
+
info: 'bg-(--ws-tag-info-bg-rest) text-(--ws-tag-info-text-rest)',
|
|
24
|
+
warning: 'bg-(--ws-tag-warning-bg-rest) text-(--ws-tag-warning-text-rest)',
|
|
25
|
+
error: 'bg-(--ws-tag-danger-bg-rest) text-(--ws-tag-danger-text-rest)',
|
|
26
|
+
neutral: 'bg-(--ws-tag-neutral-bg-rest) text-(--ws-tag-neutral-text-rest)',
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The outlined tag: the edge of a card, in the text color, on no fill. In another color the edge
|
|
30
|
+
* and the word are that color's.
|
|
31
|
+
*/
|
|
32
|
+
const outline = {
|
|
33
|
+
primary: 'ring-0 bg-transparent border-interactive text-interactive',
|
|
34
|
+
success: 'ring-0 bg-transparent border-tip text-tip-text',
|
|
35
|
+
info: 'ring-0 bg-transparent border-note text-note-text',
|
|
36
|
+
warning: 'ring-0 bg-transparent border-warning text-warning-text',
|
|
37
|
+
error: 'ring-0 bg-transparent border-danger text-danger-text',
|
|
38
|
+
neutral: 'ring-0 bg-transparent border-border text-(--ws-tag-outline-text-rest)',
|
|
39
|
+
};
|
|
40
|
+
/** The edge of a subtle badge, over its tint. */
|
|
41
|
+
const subtleRing = {
|
|
42
|
+
primary: 'ring ring-inset ring-interactive/50',
|
|
43
|
+
success: 'ring ring-inset ring-tip/50',
|
|
44
|
+
info: 'ring ring-inset ring-note/50',
|
|
45
|
+
warning: 'ring ring-inset ring-warning/50',
|
|
46
|
+
error: 'ring ring-inset ring-danger/50',
|
|
47
|
+
neutral: 'ring ring-inset ring-border',
|
|
48
|
+
};
|
|
49
|
+
/** The tag's room and type at each size: an input's tags take them too. */
|
|
50
|
+
export const tagSizes = {
|
|
51
|
+
xs: 'rounded-(--ws-tag-radius) px-(--ws-tag-padding-inline-xs) py-0 gap-(--ws-space-4) text-caption',
|
|
52
|
+
sm: 'rounded-(--ws-tag-radius) px-(--ws-tag-padding-inline-sm) py-(--ws-tag-padding-block-sm) gap-(--ws-space-4) text-caption',
|
|
53
|
+
md: 'rounded-(--ws-tag-radius) px-(--ws-tag-padding-inline-md) py-(--ws-tag-padding-block-md) gap-(--ws-space-6) text-label-sm',
|
|
54
|
+
lg: 'rounded-(--ws-tag-radius) px-(--ws-tag-padding-inline-lg) py-(--ws-tag-padding-block-lg) gap-(--ws-space-6) text-label',
|
|
55
|
+
xl: 'rounded-(--ws-tag-radius) px-(--ws-tag-padding-inline-xl) py-(--ws-tag-padding-block-xl) gap-(--ws-space-8) text-label',
|
|
56
|
+
};
|
|
57
|
+
/** The icon of the system's text, at every size. */
|
|
58
|
+
const icon = { leadingIcon: 'size-icon', trailingIcon: 'size-icon' };
|
|
59
|
+
export default {
|
|
60
|
+
slots: {
|
|
61
|
+
// in forced colors every tag is outlined
|
|
62
|
+
base: `rounded-(--ws-tag-radius) font-mono font-normal whitespace-nowrap ${forcedEdge}`,
|
|
63
|
+
label: 'truncate',
|
|
64
|
+
leadingIcon: forcedIcon,
|
|
65
|
+
trailingIcon: forcedIcon,
|
|
66
|
+
},
|
|
67
|
+
variants: {
|
|
68
|
+
size: {
|
|
69
|
+
xs: { base: tagSizes.xs, ...icon },
|
|
70
|
+
sm: { base: tagSizes.sm, ...icon },
|
|
71
|
+
md: { base: tagSizes.md, ...icon },
|
|
72
|
+
lg: { base: tagSizes.lg, ...icon },
|
|
73
|
+
xl: { base: tagSizes.xl, ...icon },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
compoundVariants: [
|
|
77
|
+
...byColor(solid, { variant: 'solid' }),
|
|
78
|
+
...byColor(outline, { variant: 'outline' }),
|
|
79
|
+
...byColor(tag, { variant: 'soft' }),
|
|
80
|
+
...byColor(tag, { variant: 'subtle' }),
|
|
81
|
+
...byColor(subtleRing, { variant: 'subtle' }),
|
|
82
|
+
// the outlined tag's edge, and its room: the edge is outside its padding-inline and inside its
|
|
83
|
+
// padding-block
|
|
84
|
+
{ variant: 'outline', class: 'border-(length:--ws-border-width-thin) border-solid' },
|
|
85
|
+
{
|
|
86
|
+
variant: 'outline',
|
|
87
|
+
size: 'xs',
|
|
88
|
+
class: 'px-(--ws-tag-outline-padding-inline-xs) py-[calc(var(--ws-tag-outline-padding-block-xs)_-_var(--ws-border-width-thin))]',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
variant: 'outline',
|
|
92
|
+
size: 'sm',
|
|
93
|
+
class: 'px-(--ws-tag-outline-padding-inline-sm) py-[calc(var(--ws-tag-outline-padding-block-sm)_-_var(--ws-border-width-thin))]',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
variant: 'outline',
|
|
97
|
+
size: 'md',
|
|
98
|
+
class: 'px-(--ws-tag-outline-padding-inline-md) py-[calc(var(--ws-tag-outline-padding-block-md)_-_var(--ws-border-width-thin))]',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
variant: 'outline',
|
|
102
|
+
size: 'lg',
|
|
103
|
+
class: 'px-(--ws-tag-outline-padding-inline-lg) py-[calc(var(--ws-tag-outline-padding-block-lg)_-_var(--ws-border-width-thin))]',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
variant: 'outline',
|
|
107
|
+
size: 'xl',
|
|
108
|
+
class: 'px-(--ws-tag-outline-padding-inline-xl) py-[calc(var(--ws-tag-outline-padding-block-xl)_-_var(--ws-border-width-thin))]',
|
|
109
|
+
},
|
|
110
|
+
{ size: ['xs', 'sm'], square: true, class: 'p-0.5' },
|
|
111
|
+
{ size: ['md', 'lg', 'xl'], square: true, class: 'p-1' },
|
|
112
|
+
],
|
|
113
|
+
defaultVariants: {
|
|
114
|
+
variant: 'soft',
|
|
115
|
+
},
|
|
116
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
slots: {
|
|
3
|
+
base: string;
|
|
4
|
+
label: string;
|
|
5
|
+
leadingIcon: string;
|
|
6
|
+
trailingIcon: string;
|
|
7
|
+
};
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
xs: {
|
|
11
|
+
base: string;
|
|
12
|
+
leadingIcon: string;
|
|
13
|
+
trailingIcon: string;
|
|
14
|
+
};
|
|
15
|
+
sm: {
|
|
16
|
+
base: string;
|
|
17
|
+
leadingIcon: string;
|
|
18
|
+
trailingIcon: string;
|
|
19
|
+
};
|
|
20
|
+
md: {
|
|
21
|
+
base: string;
|
|
22
|
+
leadingIcon: string;
|
|
23
|
+
trailingIcon: string;
|
|
24
|
+
};
|
|
25
|
+
lg: {
|
|
26
|
+
base: string;
|
|
27
|
+
leadingIcon: string;
|
|
28
|
+
trailingIcon: string;
|
|
29
|
+
};
|
|
30
|
+
xl: {
|
|
31
|
+
base: string;
|
|
32
|
+
leadingIcon: string;
|
|
33
|
+
trailingIcon: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
block: {
|
|
37
|
+
true: {
|
|
38
|
+
base: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
compoundVariants: (({
|
|
43
|
+
variant: string;
|
|
44
|
+
} & {
|
|
45
|
+
color: import("./shared.ts").Color;
|
|
46
|
+
class: string | Record<string, string>;
|
|
47
|
+
}) | {
|
|
48
|
+
variant: string;
|
|
49
|
+
class: string;
|
|
50
|
+
loading?: undefined;
|
|
51
|
+
fieldGroup?: undefined;
|
|
52
|
+
square?: undefined;
|
|
53
|
+
size?: undefined;
|
|
54
|
+
leading?: undefined;
|
|
55
|
+
trailing?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
variant: string[];
|
|
58
|
+
loading: boolean;
|
|
59
|
+
class: string;
|
|
60
|
+
fieldGroup?: undefined;
|
|
61
|
+
square?: undefined;
|
|
62
|
+
size?: undefined;
|
|
63
|
+
leading?: undefined;
|
|
64
|
+
trailing?: undefined;
|
|
65
|
+
} | {
|
|
66
|
+
variant: string[];
|
|
67
|
+
class: string;
|
|
68
|
+
loading?: undefined;
|
|
69
|
+
fieldGroup?: undefined;
|
|
70
|
+
square?: undefined;
|
|
71
|
+
size?: undefined;
|
|
72
|
+
leading?: undefined;
|
|
73
|
+
trailing?: undefined;
|
|
74
|
+
} | {
|
|
75
|
+
variant: string;
|
|
76
|
+
loading: boolean;
|
|
77
|
+
class: string;
|
|
78
|
+
fieldGroup?: undefined;
|
|
79
|
+
square?: undefined;
|
|
80
|
+
size?: undefined;
|
|
81
|
+
leading?: undefined;
|
|
82
|
+
trailing?: undefined;
|
|
83
|
+
} | {
|
|
84
|
+
class: string;
|
|
85
|
+
variant?: undefined;
|
|
86
|
+
loading?: undefined;
|
|
87
|
+
fieldGroup?: undefined;
|
|
88
|
+
square?: undefined;
|
|
89
|
+
size?: undefined;
|
|
90
|
+
leading?: undefined;
|
|
91
|
+
trailing?: undefined;
|
|
92
|
+
} | {
|
|
93
|
+
fieldGroup: string[];
|
|
94
|
+
class: string;
|
|
95
|
+
variant?: undefined;
|
|
96
|
+
loading?: undefined;
|
|
97
|
+
square?: undefined;
|
|
98
|
+
size?: undefined;
|
|
99
|
+
leading?: undefined;
|
|
100
|
+
trailing?: undefined;
|
|
101
|
+
} | {
|
|
102
|
+
square: boolean;
|
|
103
|
+
size: string;
|
|
104
|
+
class: string;
|
|
105
|
+
variant?: undefined;
|
|
106
|
+
loading?: undefined;
|
|
107
|
+
fieldGroup?: undefined;
|
|
108
|
+
leading?: undefined;
|
|
109
|
+
trailing?: undefined;
|
|
110
|
+
} | {
|
|
111
|
+
loading: boolean;
|
|
112
|
+
leading: boolean;
|
|
113
|
+
class: {
|
|
114
|
+
leadingIcon: string;
|
|
115
|
+
trailingIcon?: undefined;
|
|
116
|
+
};
|
|
117
|
+
variant?: undefined;
|
|
118
|
+
fieldGroup?: undefined;
|
|
119
|
+
square?: undefined;
|
|
120
|
+
size?: undefined;
|
|
121
|
+
trailing?: undefined;
|
|
122
|
+
} | {
|
|
123
|
+
loading: boolean;
|
|
124
|
+
leading: boolean;
|
|
125
|
+
trailing: boolean;
|
|
126
|
+
class: {
|
|
127
|
+
trailingIcon: string;
|
|
128
|
+
leadingIcon?: undefined;
|
|
129
|
+
};
|
|
130
|
+
variant?: undefined;
|
|
131
|
+
fieldGroup?: undefined;
|
|
132
|
+
square?: undefined;
|
|
133
|
+
size?: undefined;
|
|
134
|
+
})[];
|
|
135
|
+
};
|
|
136
|
+
export default _default;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { byColor, focusRing, forcedControlEdge, forcedIcon, solid, text, tint, transition, } from "./shared.js";
|
|
2
|
+
/*
|
|
3
|
+
* The button of the design system's spec, specs/button.spec.json: a mono label in semibold, in a
|
|
4
|
+
* box of the control height, a fill of the interactive color for the one action a view leads to
|
|
5
|
+
* and an outline for the rest. Its five kinds are Nuxt UI's colors and variants:
|
|
6
|
+
*
|
|
7
|
+
* primary primary solid
|
|
8
|
+
* secondary neutral outline
|
|
9
|
+
* ghost neutral ghost
|
|
10
|
+
* quiet primary link
|
|
11
|
+
* danger error outline
|
|
12
|
+
*
|
|
13
|
+
* They read the component tier by name, --ws-button-* and --ws-control-*, so a change of the
|
|
14
|
+
* tier reaches them. The other colors and variants keep working on the roles, outside the spec.
|
|
15
|
+
*
|
|
16
|
+
* Every kind but the link has an edge, a border of the control's width, transparent where the
|
|
17
|
+
* kind has none: a border, not Nuxt UI's ring, so that forced colors keep it. The ring is taken
|
|
18
|
+
* off wherever Nuxt UI draws one.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* A fill, its edge the same color. The primary button takes the system's hover and pressed
|
|
22
|
+
* fills, a step further from the page, and keeps its rest fill while it loads, the pointer on it
|
|
23
|
+
* or not. A status fill has none of its own: it is already the text color in the light theme, so
|
|
24
|
+
* it lightens toward the page, which keeps the contrast of its label.
|
|
25
|
+
*/
|
|
26
|
+
const solidFill = {
|
|
27
|
+
...solid,
|
|
28
|
+
primary: 'bg-(--ws-button-primary-bg-rest) border-(--ws-button-primary-bg-rest) text-(--ws-button-primary-text-rest) disabled:bg-(--ws-button-primary-bg-rest) disabled:border-(--ws-button-primary-bg-rest) aria-disabled:bg-(--ws-button-primary-bg-rest) aria-disabled:border-(--ws-button-primary-bg-rest)',
|
|
29
|
+
};
|
|
30
|
+
const solidHover = {
|
|
31
|
+
primary: 'hover:bg-(--ws-button-primary-bg-hover) hover:border-(--ws-button-primary-bg-hover) active:bg-(--ws-button-primary-bg-active) active:border-(--ws-button-primary-bg-active)',
|
|
32
|
+
success: 'hover:bg-tip-text/85 active:bg-tip-text/85',
|
|
33
|
+
info: 'hover:bg-note-text/85 active:bg-note-text/85',
|
|
34
|
+
warning: 'hover:bg-warning-text/85 active:bg-warning-text/85',
|
|
35
|
+
error: 'hover:bg-danger-text/85 active:bg-danger-text/85',
|
|
36
|
+
neutral: 'hover:bg-text/85 active:bg-text/85',
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* An edge around text on the page, on no fill, loading too: Nuxt UI fills a disabled neutral
|
|
40
|
+
* outline with the page color. Secondary keeps the lighter edge while it is pressed, as Space
|
|
41
|
+
* presses it without the pointer on it: the field border on the raised fill is under 3:1. While
|
|
42
|
+
* it loads it keeps its rest edge, the pointer on it or not.
|
|
43
|
+
*/
|
|
44
|
+
const outline = {
|
|
45
|
+
primary: 'ring-0 border-interactive text-interactive bg-transparent hover:bg-interactive/10 active:bg-interactive/10',
|
|
46
|
+
success: 'ring-0 border-tip text-tip-text bg-transparent hover:bg-tip/10 active:bg-tip/10',
|
|
47
|
+
info: 'ring-0 border-note text-note-text bg-transparent hover:bg-note/10 active:bg-note/10',
|
|
48
|
+
warning: 'ring-0 border-warning text-warning-text bg-transparent hover:bg-warning/10 active:bg-warning/10',
|
|
49
|
+
error: 'ring-0 border-(--ws-button-danger-border-rest) text-(--ws-button-danger-text-rest) bg-transparent hover:bg-(--ws-button-danger-bg-hover) active:bg-(--ws-button-danger-bg-active)',
|
|
50
|
+
neutral: 'ring-0 border-(--ws-button-secondary-border-rest) text-(--ws-button-secondary-text-rest) bg-transparent hover:border-(--ws-button-secondary-border-hover) hover:bg-(--ws-button-secondary-bg-hover) active:border-(--ws-button-secondary-border-active) active:bg-(--ws-button-secondary-bg-active) disabled:bg-transparent disabled:border-(--ws-button-secondary-border-rest) aria-disabled:bg-transparent aria-disabled:border-(--ws-button-secondary-border-rest)',
|
|
51
|
+
};
|
|
52
|
+
const softHover = {
|
|
53
|
+
primary: 'hover:bg-interactive/15 active:bg-interactive/15',
|
|
54
|
+
success: 'hover:bg-tip/15 active:bg-tip/15',
|
|
55
|
+
info: 'hover:bg-note/15 active:bg-note/15',
|
|
56
|
+
warning: 'hover:bg-warning/15 active:bg-warning/15',
|
|
57
|
+
error: 'hover:bg-danger/15 active:bg-danger/15',
|
|
58
|
+
neutral: 'hover:bg-accented active:bg-accented',
|
|
59
|
+
};
|
|
60
|
+
const subtleEdge = {
|
|
61
|
+
primary: 'ring-0 border-interactive/50',
|
|
62
|
+
success: 'ring-0 border-tip/50',
|
|
63
|
+
info: 'ring-0 border-note/50',
|
|
64
|
+
warning: 'ring-0 border-warning/50',
|
|
65
|
+
error: 'ring-0 border-danger/50',
|
|
66
|
+
neutral: 'ring-0 border-border',
|
|
67
|
+
};
|
|
68
|
+
const ghost = {
|
|
69
|
+
...text,
|
|
70
|
+
neutral: 'text-(--ws-button-ghost-text-rest)',
|
|
71
|
+
};
|
|
72
|
+
const ghostHover = {
|
|
73
|
+
primary: 'hover:bg-interactive/10 active:bg-interactive/10',
|
|
74
|
+
success: 'hover:bg-tip/10 active:bg-tip/10',
|
|
75
|
+
info: 'hover:bg-note/10 active:bg-note/10',
|
|
76
|
+
warning: 'hover:bg-warning/10 active:bg-warning/10',
|
|
77
|
+
error: 'hover:bg-danger/10 active:bg-danger/10',
|
|
78
|
+
neutral: 'hover:bg-(--ws-button-ghost-bg-hover) active:bg-(--ws-button-ghost-bg-active)',
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A link is the quiet button: no box, the regular weight, underlined as links in the system are,
|
|
82
|
+
* the line thicker on hover.
|
|
83
|
+
*/
|
|
84
|
+
const link = {
|
|
85
|
+
primary: 'text-(--ws-button-quiet-text-rest) hover:text-(--ws-button-quiet-text-rest) active:text-(--ws-button-quiet-text-rest)',
|
|
86
|
+
success: 'text-tip-text hover:text-tip-text active:text-tip-text',
|
|
87
|
+
info: 'text-note-text hover:text-note-text active:text-note-text',
|
|
88
|
+
warning: 'text-warning-text hover:text-warning-text active:text-warning-text',
|
|
89
|
+
error: 'text-danger-text hover:text-danger-text active:text-danger-text',
|
|
90
|
+
neutral: 'text-text-secondary hover:text-text active:text-text',
|
|
91
|
+
};
|
|
92
|
+
const kinds = ['solid', 'outline', 'soft', 'subtle', 'ghost'];
|
|
93
|
+
export default {
|
|
94
|
+
slots: {
|
|
95
|
+
base: `rounded-(--ws-control-radius) border-(length:--ws-control-border-width-rest) border-transparent font-mono font-semibold cursor-pointer disabled:opacity-100 aria-disabled:opacity-100 ${transition} ${focusRing}`,
|
|
96
|
+
label: 'truncate',
|
|
97
|
+
leadingIcon: forcedIcon,
|
|
98
|
+
trailingIcon: forcedIcon,
|
|
99
|
+
},
|
|
100
|
+
variants: {
|
|
101
|
+
size: {
|
|
102
|
+
xs: {
|
|
103
|
+
base: 'h-(--ws-control-height-xs) px-(--ws-space-10) py-0 gap-(--ws-control-gap-xs) text-label-sm',
|
|
104
|
+
leadingIcon: 'size-(--ws-control-icon-size-xs)',
|
|
105
|
+
trailingIcon: 'size-(--ws-control-icon-size-xs)',
|
|
106
|
+
},
|
|
107
|
+
sm: {
|
|
108
|
+
base: 'h-(--ws-control-height-sm) px-(--ws-space-12) py-0 gap-(--ws-control-gap-sm) text-label-sm',
|
|
109
|
+
leadingIcon: 'size-(--ws-control-icon-size-sm)',
|
|
110
|
+
trailingIcon: 'size-(--ws-control-icon-size-sm)',
|
|
111
|
+
},
|
|
112
|
+
md: {
|
|
113
|
+
base: 'h-(--ws-control-height-md) px-(--ws-space-20) py-0 gap-(--ws-control-gap-md) text-label',
|
|
114
|
+
leadingIcon: 'size-(--ws-control-icon-size-md)',
|
|
115
|
+
trailingIcon: 'size-(--ws-control-icon-size-md)',
|
|
116
|
+
},
|
|
117
|
+
lg: {
|
|
118
|
+
base: 'h-(--ws-control-height-lg) px-(--ws-space-20) py-0 gap-(--ws-control-gap-lg) text-label',
|
|
119
|
+
leadingIcon: 'size-(--ws-control-icon-size-lg)',
|
|
120
|
+
trailingIcon: 'size-(--ws-control-icon-size-lg)',
|
|
121
|
+
},
|
|
122
|
+
xl: {
|
|
123
|
+
base: 'h-(--ws-control-height-xl) px-(--ws-space-24) py-0 gap-(--ws-control-gap-xl) text-body',
|
|
124
|
+
leadingIcon: 'size-(--ws-control-icon-size-xl)',
|
|
125
|
+
trailingIcon: 'size-(--ws-control-icon-size-xl)',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
block: {
|
|
129
|
+
true: { base: 'w-full justify-center' },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
compoundVariants: [
|
|
133
|
+
...byColor(solidFill, { variant: 'solid' }),
|
|
134
|
+
...byColor(solidHover, { variant: 'solid' }),
|
|
135
|
+
...byColor(outline, { variant: 'outline' }),
|
|
136
|
+
...byColor(tint, { variant: 'soft' }),
|
|
137
|
+
...byColor(softHover, { variant: 'soft' }),
|
|
138
|
+
...byColor(tint, { variant: 'subtle' }),
|
|
139
|
+
...byColor(softHover, { variant: 'subtle' }),
|
|
140
|
+
...byColor(subtleEdge, { variant: 'subtle' }),
|
|
141
|
+
...byColor(ghost, { variant: 'ghost' }),
|
|
142
|
+
...byColor(ghostHover, { variant: 'ghost' }),
|
|
143
|
+
...byColor(link, { variant: 'link' }),
|
|
144
|
+
{
|
|
145
|
+
variant: 'link',
|
|
146
|
+
class: 'h-auto px-0 border-0 font-normal underline decoration-1 underline-offset-[0.2em] hover:decoration-2 active:decoration-2',
|
|
147
|
+
},
|
|
148
|
+
// Disabled, every kind is faint: an edge of the faint color around faint text. A loading
|
|
149
|
+
// button is disabled too, but keeps its look, with the icon turning in it.
|
|
150
|
+
{
|
|
151
|
+
variant: kinds,
|
|
152
|
+
loading: false,
|
|
153
|
+
class: 'disabled:bg-transparent disabled:text-(--ws-button-text-disabled) disabled:border-(--ws-button-border-disabled) aria-disabled:bg-transparent aria-disabled:text-(--ws-button-text-disabled) aria-disabled:border-(--ws-button-border-disabled)',
|
|
154
|
+
},
|
|
155
|
+
// In forced colors the edge of every kind but the link takes the system's button border.
|
|
156
|
+
{ variant: kinds, class: forcedControlEdge },
|
|
157
|
+
{
|
|
158
|
+
variant: 'ghost',
|
|
159
|
+
loading: false,
|
|
160
|
+
class: 'disabled:border-transparent aria-disabled:border-transparent',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
variant: 'link',
|
|
164
|
+
loading: false,
|
|
165
|
+
class: 'disabled:text-(--ws-button-text-disabled) disabled:no-underline aria-disabled:text-(--ws-button-text-disabled) aria-disabled:no-underline',
|
|
166
|
+
},
|
|
167
|
+
// Nuxt UI tints the focus outline with the color and widens it: the ring is the system's.
|
|
168
|
+
{
|
|
169
|
+
class: 'outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-3',
|
|
170
|
+
},
|
|
171
|
+
// In a field group the button with the focus comes over a field in a color or under the
|
|
172
|
+
// pointer, which field.ts raises, so that its ring shows whole.
|
|
173
|
+
{ fieldGroup: ['horizontal', 'vertical'], class: 'focus-visible:z-[3]' },
|
|
174
|
+
// An icon button is as wide as it is tall.
|
|
175
|
+
{ square: true, size: 'xs', class: 'w-(--ws-control-height-xs) px-0 justify-center' },
|
|
176
|
+
{ square: true, size: 'sm', class: 'w-(--ws-control-height-sm) px-0 justify-center' },
|
|
177
|
+
{ square: true, size: 'md', class: 'w-(--ws-control-height-md) px-0 justify-center' },
|
|
178
|
+
{ square: true, size: 'lg', class: 'w-(--ws-control-height-lg) px-0 justify-center' },
|
|
179
|
+
{ square: true, size: 'xl', class: 'w-(--ws-control-height-xl) px-0 justify-center' },
|
|
180
|
+
// The loading icon turns only for a reader who has not asked for less motion.
|
|
181
|
+
{
|
|
182
|
+
loading: true,
|
|
183
|
+
leading: true,
|
|
184
|
+
class: { leadingIcon: 'animate-none motion-safe:animate-spin' },
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
loading: true,
|
|
188
|
+
leading: false,
|
|
189
|
+
trailing: true,
|
|
190
|
+
class: { trailingIcon: 'animate-none motion-safe:animate-spin' },
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
slots: {
|
|
3
|
+
root: string;
|
|
4
|
+
header: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
body: string;
|
|
8
|
+
footer: string;
|
|
9
|
+
};
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
solid: {
|
|
13
|
+
root: string;
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
outline: {
|
|
18
|
+
root: string;
|
|
19
|
+
};
|
|
20
|
+
soft: {
|
|
21
|
+
root: string;
|
|
22
|
+
};
|
|
23
|
+
subtle: {
|
|
24
|
+
root: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|