nuance-ui 0.1.7 → 0.1.9
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/dist/module.json +1 -1
- package/dist/module.mjs +1 -20
- package/dist/runtime/components/action-icon/action-icon.d.vue.ts +1 -0
- package/dist/runtime/components/action-icon/action-icon.vue.d.ts +1 -0
- package/dist/runtime/components/alert.d.vue.ts +48 -0
- package/dist/runtime/components/alert.vue +178 -0
- package/dist/runtime/components/alert.vue.d.ts +48 -0
- package/dist/runtime/components/app-shell/app-shell-main.vue +1 -0
- package/dist/runtime/components/box.d.vue.ts +1 -1
- package/dist/runtime/components/box.vue +10 -2
- package/dist/runtime/components/box.vue.d.ts +1 -1
- package/dist/runtime/components/button/button.d.vue.ts +1 -0
- package/dist/runtime/components/button/button.vue +3 -3
- package/dist/runtime/components/button/button.vue.d.ts +1 -0
- package/dist/runtime/components/checkbox/checkbox-card.d.vue.ts +1 -1
- package/dist/runtime/components/checkbox/checkbox-card.vue.d.ts +1 -1
- package/dist/runtime/components/index.d.ts +3 -0
- package/dist/runtime/components/index.js +3 -0
- package/dist/runtime/components/input/number-input.vue +12 -16
- package/dist/runtime/components/input/ui/input-base.d.vue.ts +3 -3
- package/dist/runtime/components/input/ui/input-base.vue +2 -2
- package/dist/runtime/components/input/ui/input-base.vue.d.ts +3 -3
- package/dist/runtime/components/link/lib.d.ts +2 -2
- package/dist/runtime/components/nav-link/nav-link.vue +10 -10
- package/dist/runtime/components/progress/index.d.ts +3 -0
- package/dist/runtime/components/progress/index.js +0 -0
- package/dist/runtime/components/progress/progress-label.d.vue.ts +14 -0
- package/dist/runtime/components/progress/progress-label.vue +14 -0
- package/dist/runtime/components/progress/progress-label.vue.d.ts +14 -0
- package/dist/runtime/components/progress/progress-root.d.vue.ts +25 -0
- package/dist/runtime/components/progress/progress-root.vue +31 -0
- package/dist/runtime/components/progress/progress-root.vue.d.ts +25 -0
- package/dist/runtime/components/progress/progress-section.d.vue.ts +25 -0
- package/dist/runtime/components/progress/progress-section.vue +42 -0
- package/dist/runtime/components/progress/progress-section.vue.d.ts +25 -0
- package/dist/runtime/components/progress/progress.d.vue.ts +16 -0
- package/dist/runtime/components/progress/progress.module.css +1 -0
- package/dist/runtime/components/progress/progress.vue +39 -0
- package/dist/runtime/components/progress/progress.vue.d.ts +16 -0
- package/dist/runtime/components/roving-focus/_lib/context.d.ts +51 -0
- package/dist/runtime/components/roving-focus/_lib/context.js +90 -0
- package/dist/runtime/components/roving-focus/index.d.ts +1 -0
- package/dist/runtime/components/roving-focus/index.js +1 -0
- package/dist/runtime/components/roving-focus/roving-focus-item.d.vue.ts +13 -0
- package/dist/runtime/components/roving-focus/roving-focus-item.vue +32 -0
- package/dist/runtime/components/roving-focus/roving-focus-item.vue.d.ts +13 -0
- package/dist/runtime/components/roving-focus/roving-focus.d.vue.ts +21 -0
- package/dist/runtime/components/roving-focus/roving-focus.vue +23 -0
- package/dist/runtime/components/roving-focus/roving-focus.vue.d.ts +21 -0
- package/dist/runtime/components/select/select.d.vue.ts +2 -2
- package/dist/runtime/components/select/select.vue.d.ts +2 -2
- package/dist/runtime/components/tabs/tabs-tab.d.vue.ts +1 -1
- package/dist/runtime/components/tabs/tabs-tab.vue.d.ts +1 -1
- package/dist/runtime/components/tree/_ui/tree-item.d.vue.ts +0 -0
- package/dist/runtime/components/tree/_ui/tree-item.vue +172 -0
- package/dist/runtime/components/tree/_ui/tree-item.vue.d.ts +0 -0
- package/dist/runtime/components/tree/_ui/tree-root.d.vue.ts +39 -0
- package/dist/runtime/components/tree/_ui/tree-root.vue +87 -0
- package/dist/runtime/components/tree/_ui/tree-root.vue.d.ts +39 -0
- package/dist/runtime/components/tree/index.d.ts +1 -0
- package/dist/runtime/components/tree/index.js +1 -0
- package/dist/runtime/components/tree/lib/context.d.ts +32 -0
- package/dist/runtime/components/tree/lib/context.js +103 -0
- package/dist/runtime/components/tree/lib/get-default.d.ts +7 -0
- package/dist/runtime/components/tree/lib/get-default.js +10 -0
- package/dist/runtime/components/tree/model.d.ts +33 -0
- package/dist/runtime/components/tree/model.js +0 -0
- package/dist/runtime/components/tree/tree.d.vue.ts +23 -0
- package/dist/runtime/components/tree/tree.vue +46 -0
- package/dist/runtime/components/tree/tree.vue.d.ts +23 -0
- package/dist/runtime/composals/index.d.ts +0 -1
- package/dist/runtime/composals/index.js +0 -1
- package/dist/runtime/styles/colors.css +1 -1
- package/dist/runtime/styles/light-theme.css +1 -1
- package/dist/runtime/utils/get-mod.d.ts +2 -0
- package/dist/runtime/{composals/use-mod.js → utils/get-mod.js} +2 -13
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +2 -0
- package/dist/runtime/utils/tree.d.ts +107 -0
- package/dist/runtime/utils/tree.js +85 -0
- package/package.json +1 -1
- package/dist/runtime/composals/use-mod.d.ts +0 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -24,26 +24,7 @@ const module$1 = defineNuxtModule({
|
|
|
24
24
|
"@nuxt/icon": {
|
|
25
25
|
version: ">=2.1.0",
|
|
26
26
|
defaults: {
|
|
27
|
-
|
|
28
|
-
class: "",
|
|
29
|
-
clientBundle: {
|
|
30
|
-
scan: {
|
|
31
|
-
globInclude: ["src/**/*.vue", "src/**/*.ts"],
|
|
32
|
-
globExclude: [
|
|
33
|
-
"node_modules",
|
|
34
|
-
".idea",
|
|
35
|
-
".output",
|
|
36
|
-
".data",
|
|
37
|
-
".nuxt",
|
|
38
|
-
".nitro",
|
|
39
|
-
".cache",
|
|
40
|
-
"dist",
|
|
41
|
-
"server"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
includeCustomCollections: true,
|
|
45
|
-
sizeLimitKb: 256
|
|
46
|
-
}
|
|
27
|
+
class: ""
|
|
47
28
|
}
|
|
48
29
|
}
|
|
49
30
|
},
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { NuanceColor, NuanceRadius } from '@nui/types';
|
|
2
|
+
import type { BoxProps } from './box.vue.js';
|
|
3
|
+
export interface AlertProps extends BoxProps {
|
|
4
|
+
variant?: 'filled' | 'light' | 'outline' | 'default';
|
|
5
|
+
/** Key of `theme.radius` or any valid CSS value to set border-radius @default `theme.defaultRadius` */
|
|
6
|
+
radius?: NuanceRadius;
|
|
7
|
+
/** Key of `theme.colors` or any valid CSS color @default `theme.primaryColor` */
|
|
8
|
+
color?: NuanceColor;
|
|
9
|
+
/** Alert title */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Icon displayed next to the title */
|
|
12
|
+
icon?: string;
|
|
13
|
+
/** Determines whether close button should be displayed @default `false` */
|
|
14
|
+
withCloseButton?: boolean;
|
|
15
|
+
/** Called when the close button is clicked */
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
/** Close button `aria-label` */
|
|
18
|
+
closeButtonLabel?: string;
|
|
19
|
+
/** Styles API */
|
|
20
|
+
classes?: {
|
|
21
|
+
root?: string;
|
|
22
|
+
icon?: string;
|
|
23
|
+
body?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
message?: string;
|
|
27
|
+
closeButton?: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare var __VLS_15: {}, __VLS_21: {};
|
|
31
|
+
type __VLS_Slots = {} & {
|
|
32
|
+
title?: (props: typeof __VLS_15) => any;
|
|
33
|
+
} & {
|
|
34
|
+
default?: (props: typeof __VLS_21) => any;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_base: import("vue").DefineComponent<AlertProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
+
close: () => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<AlertProps> & Readonly<{
|
|
39
|
+
onClose?: (() => any) | undefined;
|
|
40
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
42
|
+
declare const _default: typeof __VLS_export;
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ActionIcon from "@nui/components/action-icon/action-icon.vue";
|
|
3
|
+
import { useStyleResolver } from "@nui/composals";
|
|
4
|
+
import { createVariantColorResolver, getRadius } from "@nui/utils";
|
|
5
|
+
import { computed, useId } from "vue";
|
|
6
|
+
import Box from "./box.vue";
|
|
7
|
+
const {
|
|
8
|
+
mod,
|
|
9
|
+
icon,
|
|
10
|
+
color,
|
|
11
|
+
title,
|
|
12
|
+
radius,
|
|
13
|
+
variant = "light",
|
|
14
|
+
withCloseButton,
|
|
15
|
+
classes
|
|
16
|
+
} = defineProps({
|
|
17
|
+
variant: { type: String, required: false },
|
|
18
|
+
radius: { type: [String, Number], required: false },
|
|
19
|
+
color: { type: null, required: false },
|
|
20
|
+
title: { type: String, required: false },
|
|
21
|
+
icon: { type: String, required: false },
|
|
22
|
+
withCloseButton: { type: Boolean, required: false },
|
|
23
|
+
onClose: { type: Function, required: false },
|
|
24
|
+
closeButtonLabel: { type: String, required: false },
|
|
25
|
+
classes: { type: Object, required: false },
|
|
26
|
+
is: { type: null, required: false },
|
|
27
|
+
mod: { type: [Object, Array, null], required: false }
|
|
28
|
+
});
|
|
29
|
+
defineEmits(["close"]);
|
|
30
|
+
const id = useId();
|
|
31
|
+
const style = computed(() => useStyleResolver((theme) => {
|
|
32
|
+
const { background, border, text } = createVariantColorResolver({
|
|
33
|
+
variant,
|
|
34
|
+
color,
|
|
35
|
+
theme
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
"--alert-radius": radius === void 0 ? void 0 : getRadius(radius),
|
|
39
|
+
"--alert-bg": color || variant ? background : void 0,
|
|
40
|
+
"--alert-color": text,
|
|
41
|
+
"--alert-bd": color || variant ? border : void 0
|
|
42
|
+
};
|
|
43
|
+
}));
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<Box
|
|
48
|
+
role='alert'
|
|
49
|
+
:style
|
|
50
|
+
:class='[$style.root, classes?.root]'
|
|
51
|
+
:mod='[{ variant }, mod]'
|
|
52
|
+
:aria-describedby='$slots.default ? `${id}-body` : void 0'
|
|
53
|
+
:aria-labelledby='$slots.label ? `${id}-title` : void 0'
|
|
54
|
+
>
|
|
55
|
+
<Icon
|
|
56
|
+
v-if='icon'
|
|
57
|
+
:name='icon'
|
|
58
|
+
:class='[$style.icon, classes?.icon]'
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<div :class='[$style.body, classes?.body]'>
|
|
62
|
+
<Box v-if='title || $slots.title' :class='[$style.title, classes?.title]'>
|
|
63
|
+
<span :id='`${id}-title`' :class='[$style.label, classes?.label]'>
|
|
64
|
+
<slot name='title'>
|
|
65
|
+
{{ title }}
|
|
66
|
+
</slot>
|
|
67
|
+
</span>
|
|
68
|
+
</Box>
|
|
69
|
+
|
|
70
|
+
<Box
|
|
71
|
+
v-if='$slots.default'
|
|
72
|
+
:id='`${id}-body`'
|
|
73
|
+
:class='[$style.message, classes?.message]'
|
|
74
|
+
:mod='{ variant }'
|
|
75
|
+
>
|
|
76
|
+
<slot />
|
|
77
|
+
</Box>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<ActionIcon
|
|
81
|
+
v-if='withCloseButton'
|
|
82
|
+
:class='[$style.closeButton, classes?.closeButton]'
|
|
83
|
+
variant='subtle'
|
|
84
|
+
icon='gravity-ui:xmark'
|
|
85
|
+
size='sm'
|
|
86
|
+
:color
|
|
87
|
+
@click='$emit("close")'
|
|
88
|
+
/>
|
|
89
|
+
</Box>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<style module lang="postcss">
|
|
93
|
+
.root {
|
|
94
|
+
--alert-radius: var(--radius-default);
|
|
95
|
+
--alert-bg: var(--color-primary-light);
|
|
96
|
+
--alert-bd: 1px solid transparent;
|
|
97
|
+
--alert-color: var(--color-primary-light-color);
|
|
98
|
+
|
|
99
|
+
position: relative;
|
|
100
|
+
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
display: flex;
|
|
103
|
+
gap: var(--spacing-md);
|
|
104
|
+
|
|
105
|
+
padding: var(--spacing-md) var(--spacing-md);
|
|
106
|
+
border: var(--alert-bd);
|
|
107
|
+
border-radius: var(--alert-radius);
|
|
108
|
+
|
|
109
|
+
color: var(--alert-color);
|
|
110
|
+
|
|
111
|
+
background-color: var(--alert-bg);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.body {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex: 1;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: var(--spacing-xs);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.title {
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: space-between;
|
|
125
|
+
|
|
126
|
+
font-size: var(--font-size-sm);
|
|
127
|
+
font-weight: 700;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.label {
|
|
131
|
+
overflow: hidden;
|
|
132
|
+
display: block;
|
|
133
|
+
|
|
134
|
+
text-overflow: ellipsis;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.icon {
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: flex-start;
|
|
141
|
+
|
|
142
|
+
width: 1.25rem;
|
|
143
|
+
height: 1.25rem;
|
|
144
|
+
margin-top: 1px;
|
|
145
|
+
|
|
146
|
+
line-height: 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.message {
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
|
|
152
|
+
font-size: var(--font-size-sm);
|
|
153
|
+
text-overflow: ellipsis;
|
|
154
|
+
|
|
155
|
+
:where([data-mantine-color-scheme='light']) & {
|
|
156
|
+
color: var(--color-black);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:where([data-mantine-color-scheme='dark']) & {
|
|
160
|
+
color: var(--color-white);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&:where([data-variant='filled']) {
|
|
164
|
+
color: var(--alert-color);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&:where([data-variant='white']) {
|
|
168
|
+
color: var(--color-black);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.closeButton {
|
|
173
|
+
width: 20px;
|
|
174
|
+
height: 20px;
|
|
175
|
+
|
|
176
|
+
color: var(--alert-color);
|
|
177
|
+
}
|
|
178
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { NuanceColor, NuanceRadius } from '@nui/types';
|
|
2
|
+
import type { BoxProps } from './box.vue.js';
|
|
3
|
+
export interface AlertProps extends BoxProps {
|
|
4
|
+
variant?: 'filled' | 'light' | 'outline' | 'default';
|
|
5
|
+
/** Key of `theme.radius` or any valid CSS value to set border-radius @default `theme.defaultRadius` */
|
|
6
|
+
radius?: NuanceRadius;
|
|
7
|
+
/** Key of `theme.colors` or any valid CSS color @default `theme.primaryColor` */
|
|
8
|
+
color?: NuanceColor;
|
|
9
|
+
/** Alert title */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Icon displayed next to the title */
|
|
12
|
+
icon?: string;
|
|
13
|
+
/** Determines whether close button should be displayed @default `false` */
|
|
14
|
+
withCloseButton?: boolean;
|
|
15
|
+
/** Called when the close button is clicked */
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
/** Close button `aria-label` */
|
|
18
|
+
closeButtonLabel?: string;
|
|
19
|
+
/** Styles API */
|
|
20
|
+
classes?: {
|
|
21
|
+
root?: string;
|
|
22
|
+
icon?: string;
|
|
23
|
+
body?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
message?: string;
|
|
27
|
+
closeButton?: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare var __VLS_15: {}, __VLS_21: {};
|
|
31
|
+
type __VLS_Slots = {} & {
|
|
32
|
+
title?: (props: typeof __VLS_15) => any;
|
|
33
|
+
} & {
|
|
34
|
+
default?: (props: typeof __VLS_21) => any;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_base: import("vue").DefineComponent<AlertProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
+
close: () => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<AlertProps> & Readonly<{
|
|
39
|
+
onClose?: (() => any) | undefined;
|
|
40
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
42
|
+
declare const _default: typeof __VLS_export;
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { getMod, isFalsy } from "@nui/utils";
|
|
3
|
+
import { computed } from "vue";
|
|
3
4
|
const { is = "div", mod } = defineProps({
|
|
4
5
|
is: { type: null, required: false },
|
|
5
6
|
mod: { type: [Object, Array, null], required: false }
|
|
6
7
|
});
|
|
7
|
-
const _mod =
|
|
8
|
+
const _mod = computed(() => {
|
|
9
|
+
if (!mod)
|
|
10
|
+
return null;
|
|
11
|
+
if (Array.isArray(mod)) {
|
|
12
|
+
return mod.filter((i) => !isFalsy(i)).reduce((acc, value) => ({ ...acc, ...getMod(value) }), {});
|
|
13
|
+
}
|
|
14
|
+
return getMod(mod);
|
|
15
|
+
});
|
|
8
16
|
</script>
|
|
9
17
|
|
|
10
18
|
<template>
|
|
@@ -34,6 +34,7 @@ const {
|
|
|
34
34
|
is: { type: null, required: false },
|
|
35
35
|
mod: { type: [Object, Array, null], required: false }
|
|
36
36
|
});
|
|
37
|
+
const mod = computed(() => [{ loading, variant }, _mod]);
|
|
37
38
|
const style = computed(() => useStyleResolver((theme) => {
|
|
38
39
|
const {
|
|
39
40
|
background,
|
|
@@ -60,18 +61,17 @@ const style = computed(() => useStyleResolver((theme) => {
|
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
}));
|
|
63
|
-
const mod = computed(() => [{ loading, variant }, _mod]);
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<template>
|
|
67
67
|
<Box
|
|
68
68
|
:is
|
|
69
69
|
:mod='[
|
|
70
|
-
mod,
|
|
71
70
|
{
|
|
72
71
|
"with-left-section": !!$slots?.leftSection,
|
|
73
72
|
"with-right-section": !!$slots?.rightSection
|
|
74
|
-
}
|
|
73
|
+
},
|
|
74
|
+
mod
|
|
75
75
|
]'
|
|
76
76
|
:style='style.root'
|
|
77
77
|
:class='[css.root, classes?.root]'
|
|
@@ -17,10 +17,13 @@ export * from './modal/index.js';
|
|
|
17
17
|
export * from './nav-link/index.js';
|
|
18
18
|
export * from './paper.vue.js';
|
|
19
19
|
export * from './popover/index.js';
|
|
20
|
+
export * from './progress/index.js';
|
|
21
|
+
export * from './roving-focus/index.js';
|
|
20
22
|
export * from './select/index.js';
|
|
21
23
|
export * from './tabs/index.js';
|
|
22
24
|
export * from './text.vue.js';
|
|
23
25
|
export * from './textarea.vue.js';
|
|
24
26
|
export * from './title.vue.js';
|
|
25
27
|
export * from './transition/index.js';
|
|
28
|
+
export * from './tree/index.js';
|
|
26
29
|
export * from './visually-hidden/index.js';
|
|
@@ -17,10 +17,13 @@ export * from "./modal/index.js";
|
|
|
17
17
|
export * from "./nav-link/index.js";
|
|
18
18
|
export * from "./paper.vue";
|
|
19
19
|
export * from "./popover/index.js";
|
|
20
|
+
export * from "./progress/index.js";
|
|
21
|
+
export * from "./roving-focus/index.js";
|
|
20
22
|
export * from "./select/index.js";
|
|
21
23
|
export * from "./tabs/index.js";
|
|
22
24
|
export * from "./text.vue";
|
|
23
25
|
export * from "./textarea.vue";
|
|
24
26
|
export * from "./title.vue";
|
|
25
27
|
export * from "./transition/index.js";
|
|
28
|
+
export * from "./tree/index.js";
|
|
26
29
|
export * from "./visually-hidden/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { clamp
|
|
3
|
-
import { shallowRef, useId
|
|
2
|
+
import { clamp } from "@vueuse/core";
|
|
3
|
+
import { shallowRef, useId } from "vue";
|
|
4
4
|
import UnstyledButton from "../button/unstyled-button.vue";
|
|
5
5
|
import BaseInput from "./ui/input-base.vue";
|
|
6
6
|
import InputWrapper from "./ui/input-wrapper.vue";
|
|
@@ -31,25 +31,21 @@ const {
|
|
|
31
31
|
rightSectionPE: { type: null, required: false }
|
|
32
32
|
});
|
|
33
33
|
const id = useId();
|
|
34
|
-
const value = defineModel({ type: Number, ...{ default: 0 } });
|
|
35
|
-
const { count, inc, dec, set } = useCounter(value, { min, max });
|
|
36
34
|
const focused = shallowRef(false);
|
|
37
|
-
|
|
38
|
-
value.value = count.value;
|
|
39
|
-
});
|
|
35
|
+
const value = defineModel({ type: Number, ...{ default: 0 } });
|
|
40
36
|
function handleWheel(event) {
|
|
41
37
|
if (!focused.value)
|
|
42
38
|
return;
|
|
43
39
|
if (Math.abs(event.deltaY) <= Math.abs(event.deltaX))
|
|
44
40
|
return;
|
|
45
41
|
if (event.deltaY > 0)
|
|
46
|
-
|
|
42
|
+
value.value = clamp(value.value + step, min, max);
|
|
47
43
|
else if (event.deltaY < 0)
|
|
48
|
-
|
|
44
|
+
value.value = clamp(value.value - step, min, max);
|
|
49
45
|
}
|
|
50
46
|
function handleBlur() {
|
|
51
47
|
focused.value = false;
|
|
52
|
-
|
|
48
|
+
value.value = clamp(value.value, min, max);
|
|
53
49
|
}
|
|
54
50
|
</script>
|
|
55
51
|
|
|
@@ -57,12 +53,12 @@ function handleBlur() {
|
|
|
57
53
|
<InputWrapper v-bind='rest' :id :class='$style.root' :right-section-p-e>
|
|
58
54
|
<BaseInput
|
|
59
55
|
:id
|
|
60
|
-
|
|
61
|
-
:readonly
|
|
62
|
-
:disabled
|
|
63
|
-
:step
|
|
56
|
+
v-model='value'
|
|
64
57
|
:min
|
|
65
58
|
:max
|
|
59
|
+
:step
|
|
60
|
+
:readonly
|
|
61
|
+
:disabled
|
|
66
62
|
type='number'
|
|
67
63
|
@focus='focused = true'
|
|
68
64
|
@blur='handleBlur()'
|
|
@@ -77,14 +73,14 @@ function handleBlur() {
|
|
|
77
73
|
<UnstyledButton
|
|
78
74
|
:class='$style.control'
|
|
79
75
|
:disabled='disabled || typeof value === "number" && !Number.isNaN(max) && value >= max'
|
|
80
|
-
@click='
|
|
76
|
+
@click='value = clamp(value + step, min, max)'
|
|
81
77
|
>
|
|
82
78
|
<Icon name='gravity-ui:chevron-up' />
|
|
83
79
|
</UnstyledButton>
|
|
84
80
|
<UnstyledButton
|
|
85
81
|
:class='$style.control'
|
|
86
82
|
:disabled='disabled || typeof value === "number" && !Number.isNaN(min) && value <= min'
|
|
87
|
-
@click='
|
|
83
|
+
@click='value = clamp(value - step, min, max)'
|
|
88
84
|
>
|
|
89
85
|
<Icon name='gravity-ui:chevron-down' />
|
|
90
86
|
</UnstyledButton>
|
|
@@ -4,7 +4,7 @@ import type { InputBaseProps } from '../types/index.js';
|
|
|
4
4
|
export interface BaseInputProps extends InputBaseProps, Omit<WrapperContext, 'id'> {
|
|
5
5
|
id: string;
|
|
6
6
|
is?: 'input' | 'textarea' | Component;
|
|
7
|
-
modelValue?: string;
|
|
7
|
+
modelValue?: string | number;
|
|
8
8
|
}
|
|
9
9
|
declare var __VLS_6: {}, __VLS_17: {};
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
@@ -15,9 +15,9 @@ type __VLS_Slots = {} & {
|
|
|
15
15
|
declare const __VLS_base: import("vue").DefineComponent<BaseInputProps, {
|
|
16
16
|
ref: Readonly<import("vue").ShallowRef<any>>;
|
|
17
17
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
-
"update:modelValue": (value: string | undefined) => any;
|
|
18
|
+
"update:modelValue": (value: string | number | undefined) => any;
|
|
19
19
|
}, string, import("vue").PublicProps, Readonly<BaseInputProps> & Readonly<{
|
|
20
|
-
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
20
|
+
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
21
21
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
23
23
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import Box from "@nui/components/box.vue";
|
|
3
2
|
import { getFontSize, getRadius, getSize } from "@nui/utils";
|
|
4
3
|
import { computed, useTemplateRef } from "vue";
|
|
4
|
+
import Box from "../../box.vue";
|
|
5
5
|
import { useInputWrapperState } from "../lib/input-wrapper.context";
|
|
6
6
|
const {
|
|
7
7
|
is = "input",
|
|
@@ -12,7 +12,7 @@ const {
|
|
|
12
12
|
} = defineProps({
|
|
13
13
|
id: { type: String, required: true },
|
|
14
14
|
is: { type: null, required: false },
|
|
15
|
-
modelValue: { type: String, required: false },
|
|
15
|
+
modelValue: { type: [String, Number], required: false },
|
|
16
16
|
readonly: { type: Boolean, required: false },
|
|
17
17
|
disabled: { type: Boolean, required: false },
|
|
18
18
|
required: { type: Boolean, required: false },
|
|
@@ -4,7 +4,7 @@ import type { InputBaseProps } from '../types/index.js';
|
|
|
4
4
|
export interface BaseInputProps extends InputBaseProps, Omit<WrapperContext, 'id'> {
|
|
5
5
|
id: string;
|
|
6
6
|
is?: 'input' | 'textarea' | Component;
|
|
7
|
-
modelValue?: string;
|
|
7
|
+
modelValue?: string | number;
|
|
8
8
|
}
|
|
9
9
|
declare var __VLS_6: {}, __VLS_17: {};
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
@@ -15,9 +15,9 @@ type __VLS_Slots = {} & {
|
|
|
15
15
|
declare const __VLS_base: import("vue").DefineComponent<BaseInputProps, {
|
|
16
16
|
ref: Readonly<import("vue").ShallowRef<any>>;
|
|
17
17
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
-
"update:modelValue": (value: string | undefined) => any;
|
|
18
|
+
"update:modelValue": (value: string | number | undefined) => any;
|
|
19
19
|
}, string, import("vue").PublicProps, Readonly<BaseInputProps> & Readonly<{
|
|
20
|
-
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
20
|
+
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
21
21
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
23
23
|
declare const _default: typeof __VLS_export;
|
|
@@ -3,14 +3,14 @@ export declare function extractNuxtLinkProps<T extends NuxtLinkProps>(props: T):
|
|
|
3
3
|
link: {
|
|
4
4
|
prefetch: NonNullable<import("vue").UnwrapRef<T["prefetch"]>> | undefined;
|
|
5
5
|
noPrefetch: NonNullable<import("vue").UnwrapRef<T["noPrefetch"]>> | undefined;
|
|
6
|
+
to?: import("vue").UnwrapRef<T["to"]> | undefined;
|
|
6
7
|
target?: import("vue").UnwrapRef<T["target"]> | undefined;
|
|
7
8
|
replace?: import("vue").UnwrapRef<T["replace"]> | undefined;
|
|
8
|
-
to?: import("vue").UnwrapRef<T["to"]> | undefined;
|
|
9
9
|
external?: import("vue").UnwrapRef<T["external"]> | undefined;
|
|
10
10
|
rel?: import("vue").UnwrapRef<T["rel"]> | undefined;
|
|
11
11
|
noRel?: import("vue").UnwrapRef<T["noRel"]> | undefined;
|
|
12
12
|
prefetchOn?: import("vue").UnwrapRef<T["prefetchOn"]> | undefined;
|
|
13
13
|
trailingSlash?: import("vue").UnwrapRef<T["trailingSlash"]> | undefined;
|
|
14
14
|
};
|
|
15
|
-
rest: Omit<T, Extract<"
|
|
15
|
+
rest: Omit<T, Extract<"to", keyof T> | Extract<"target", keyof T> | Extract<"replace", keyof T> | Extract<"external", keyof T> | Extract<"rel", keyof T> | Extract<"noRel", keyof T> | Extract<"prefetch", keyof T> | Extract<"noPrefetch", keyof T> | Extract<"prefetchOn", keyof T> | Extract<"trailingSlash", keyof T>>;
|
|
16
16
|
};
|
|
@@ -121,6 +121,16 @@ const style = useStyleResolver((theme) => {
|
|
|
121
121
|
opacity: 0.4;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
&:hover {
|
|
125
|
+
@mixin where-light {
|
|
126
|
+
background-color: var(--color-gray-0);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@mixin where-dark {
|
|
130
|
+
background-color: var(--color-dark-6);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
124
134
|
&:where([data-active], [aria-current='page']) {
|
|
125
135
|
color: var(--nl-color);
|
|
126
136
|
|
|
@@ -135,16 +145,6 @@ const style = useStyleResolver((theme) => {
|
|
|
135
145
|
background-color: var(--nl-hover);
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
|
-
|
|
139
|
-
@mixin hover {
|
|
140
|
-
@mixin where-light {
|
|
141
|
-
background-color: var(--color-gray-0);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
@mixin where-dark {
|
|
145
|
-
background-color: var(--color-dark-6);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
.section {
|
|
File without changes
|