nuance-ui 0.1.8 → 0.1.10
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/runtime/components/action-icon/action-icon-section.d.vue.ts +2 -2
- package/dist/runtime/components/action-icon/action-icon-section.vue.d.ts +2 -2
- package/dist/runtime/components/action-icon/action-icon.d.vue.ts +3 -2
- package/dist/runtime/components/action-icon/action-icon.vue.d.ts +3 -2
- 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/avatar/_lib/context.d.ts +6 -0
- package/dist/runtime/components/avatar/_lib/context.js +4 -0
- package/dist/runtime/components/avatar/_lib/get-initials-color.d.ts +2 -0
- package/dist/runtime/components/avatar/_lib/get-initials-color.js +27 -0
- package/dist/runtime/components/avatar/_lib/get-initials.d.ts +1 -0
- package/dist/runtime/components/avatar/_lib/get-initials.js +6 -0
- package/dist/runtime/components/avatar/avatar-group.d.vue.ts +19 -0
- package/dist/runtime/components/avatar/avatar-group.vue +22 -0
- package/dist/runtime/components/avatar/avatar-group.vue.d.ts +19 -0
- package/dist/runtime/components/avatar/avatar.d.vue.ts +36 -0
- package/dist/runtime/components/avatar/avatar.module.css +1 -0
- package/dist/runtime/components/avatar/avatar.vue +71 -0
- package/dist/runtime/components/avatar/avatar.vue.d.ts +36 -0
- package/dist/runtime/components/avatar/index.d.ts +1 -0
- package/dist/runtime/components/avatar/index.js +0 -0
- package/dist/runtime/components/button/button.d.vue.ts +3 -2
- package/dist/runtime/components/button/button.vue.d.ts +3 -2
- package/dist/runtime/components/index.d.ts +2 -0
- package/dist/runtime/components/index.js +2 -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/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/text.d.vue.ts +2 -2
- package/dist/runtime/components/text.vue.d.ts +2 -2
- package/dist/runtime/components/tree/_ui/tree-item.vue +8 -7
- package/dist/runtime/components/tree/_ui/tree-root.d.vue.ts +11 -5
- package/dist/runtime/components/tree/_ui/tree-root.vue +15 -5
- package/dist/runtime/components/tree/_ui/tree-root.vue.d.ts +11 -5
- package/dist/runtime/components/tree/lib/context.d.ts +9 -1
- package/dist/runtime/components/tree/lib/context.js +16 -15
- package/dist/runtime/components/tree/tree.vue +15 -5
- package/dist/runtime/const/index.d.ts +2 -2
- package/dist/runtime/styles/colors.css +1 -1
- package/dist/runtime/styles/light-theme.css +1 -1
- package/dist/runtime/types/theme.d.ts +1 -1
- package/dist/runtime/utils/color-functions/get-gradient.d.ts +3 -3
- package/dist/runtime/utils/tree.d.ts +19 -0
- package/dist/runtime/utils/tree.js +16 -16
- package/dist/runtime/utils/vars-resolver/create-variant-color-resolver.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type { NuanceColor, NuanceRadius, NuanceSize
|
|
1
|
+
import type { NuanceColor, NuanceGradient, NuanceRadius, NuanceSize } from '@nui/types';
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
3
|
import type { BoxProps } from '../box.vue.js';
|
|
4
4
|
export interface ButtonProps extends BoxProps {
|
|
5
5
|
size?: NuanceSize | `compact-${NuanceSize}`;
|
|
6
6
|
variant?: 'filled' | 'light' | 'outline' | 'subtle' | 'default' | 'gradient' | 'gradient-outline';
|
|
7
|
-
gradient?:
|
|
7
|
+
gradient?: NuanceGradient;
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
color?: NuanceColor;
|
|
10
10
|
radius?: NuanceRadius;
|
|
11
|
+
/** Styles API */
|
|
11
12
|
classes?: {
|
|
12
13
|
root?: string;
|
|
13
14
|
inner?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './action-icon/index.js';
|
|
2
2
|
export * from './app-shell/index.js';
|
|
3
|
+
export * from './avatar/index.js';
|
|
3
4
|
export * from './background-image.vue.js';
|
|
4
5
|
export * from './box.vue.js';
|
|
5
6
|
export * from './button/index.js';
|
|
@@ -17,6 +18,7 @@ export * from './modal/index.js';
|
|
|
17
18
|
export * from './nav-link/index.js';
|
|
18
19
|
export * from './paper.vue.js';
|
|
19
20
|
export * from './popover/index.js';
|
|
21
|
+
export * from './progress/index.js';
|
|
20
22
|
export * from './roving-focus/index.js';
|
|
21
23
|
export * from './select/index.js';
|
|
22
24
|
export * from './tabs/index.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./action-icon/index.js";
|
|
2
2
|
export * from "./app-shell/index.js";
|
|
3
|
+
export * from "./avatar/index.js";
|
|
3
4
|
export * from "./background-image.vue";
|
|
4
5
|
export * from "./box.vue";
|
|
5
6
|
export * from "./button/index.js";
|
|
@@ -17,6 +18,7 @@ export * from "./modal/index.js";
|
|
|
17
18
|
export * from "./nav-link/index.js";
|
|
18
19
|
export * from "./paper.vue";
|
|
19
20
|
export * from "./popover/index.js";
|
|
21
|
+
export * from "./progress/index.js";
|
|
20
22
|
export * from "./roving-focus/index.js";
|
|
21
23
|
export * from "./select/index.js";
|
|
22
24
|
export * from "./tabs/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;
|
|
@@ -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
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BoxProps } from '@nui/components';
|
|
2
|
+
declare var __VLS_6: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_6) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import("vue").DefineComponent<BoxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BoxProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
11
|
+
new (): {
|
|
12
|
+
$slots: S;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import Box from "../box.vue";
|
|
3
|
+
import css from "./progress.module.css";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
is: { type: null, required: false },
|
|
6
|
+
mod: { type: [Object, Array, null], required: false }
|
|
7
|
+
});
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<Box v-bind='props' :class='css.label'>
|
|
12
|
+
<slot />
|
|
13
|
+
</Box>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BoxProps } from '@nui/components';
|
|
2
|
+
declare var __VLS_6: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_6) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import("vue").DefineComponent<BoxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BoxProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
11
|
+
new (): {
|
|
12
|
+
$slots: S;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BoxProps } from '@nui/components';
|
|
2
|
+
import type { NuanceRadius, NuanceSize } from '@nui/types';
|
|
3
|
+
export interface ProgressRootProps extends BoxProps {
|
|
4
|
+
/** Controls track height @default `'md'` */
|
|
5
|
+
size?: NuanceSize | string;
|
|
6
|
+
/** Key of `theme.radius` or any valid CSS value to set `border-radius` @default `theme.defaultRadius` */
|
|
7
|
+
radius?: NuanceRadius;
|
|
8
|
+
/** Controls sections width transition duration, value is specified in ms @default `100` */
|
|
9
|
+
transitionDuration?: number;
|
|
10
|
+
/** Controls orientation @default `'horizontal'` */
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
}
|
|
13
|
+
declare var __VLS_6: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_6) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<ProgressRootProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProgressRootProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getRadius, getSize } from "@nui/utils";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import Box from "../box.vue";
|
|
5
|
+
import css from "./progress.module.css";
|
|
6
|
+
const {
|
|
7
|
+
orientation,
|
|
8
|
+
mod,
|
|
9
|
+
size,
|
|
10
|
+
radius,
|
|
11
|
+
transitionDuration
|
|
12
|
+
} = defineProps({
|
|
13
|
+
size: { type: String, required: false },
|
|
14
|
+
radius: { type: [String, Number], required: false },
|
|
15
|
+
transitionDuration: { type: Number, required: false },
|
|
16
|
+
orientation: { type: String, required: false },
|
|
17
|
+
is: { type: null, required: false },
|
|
18
|
+
mod: { type: [Object, Array, null], required: false }
|
|
19
|
+
});
|
|
20
|
+
const style = computed(() => ({
|
|
21
|
+
"--progress-size": getSize(size, "progress-size"),
|
|
22
|
+
"--progress-radius": radius === void 0 ? void 0 : getRadius(radius),
|
|
23
|
+
"--progress-transition-duration": typeof transitionDuration === "number" ? `${transitionDuration}ms` : void 0
|
|
24
|
+
}));
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<Box :style :class='css.root' :mod='[{ orientation }, mod]'>
|
|
29
|
+
<slot />
|
|
30
|
+
</Box>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BoxProps } from '@nui/components';
|
|
2
|
+
import type { NuanceRadius, NuanceSize } from '@nui/types';
|
|
3
|
+
export interface ProgressRootProps extends BoxProps {
|
|
4
|
+
/** Controls track height @default `'md'` */
|
|
5
|
+
size?: NuanceSize | string;
|
|
6
|
+
/** Key of `theme.radius` or any valid CSS value to set `border-radius` @default `theme.defaultRadius` */
|
|
7
|
+
radius?: NuanceRadius;
|
|
8
|
+
/** Controls sections width transition duration, value is specified in ms @default `100` */
|
|
9
|
+
transitionDuration?: number;
|
|
10
|
+
/** Controls orientation @default `'horizontal'` */
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
}
|
|
13
|
+
declare var __VLS_6: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_6) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<ProgressRootProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProgressRootProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BoxProps } from '@nui/components';
|
|
2
|
+
import type { NuanceColor } from '@nui/types';
|
|
3
|
+
export interface ProgressSectionProps extends BoxProps {
|
|
4
|
+
/** Determines whether `aria-*` props should be added to the root element @default `true` */
|
|
5
|
+
withAria?: boolean;
|
|
6
|
+
/** Key of `theme.colors` or any valid CSS value @default `theme.primaryColor` */
|
|
7
|
+
color?: NuanceColor;
|
|
8
|
+
/** If set, the section has stripes @default `false` */
|
|
9
|
+
striped?: boolean;
|
|
10
|
+
/** If set, the sections stripes are animated, `striped` prop is ignored @default `false` */
|
|
11
|
+
animated?: boolean;
|
|
12
|
+
}
|
|
13
|
+
type __VLS_Props = ProgressSectionProps;
|
|
14
|
+
type __VLS_ModelProps = {
|
|
15
|
+
/** Value of the section in 0–100 range */
|
|
16
|
+
modelValue: number;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
|
+
"update:modelValue": (value: number) => any;
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
22
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useStyleResolver } from "@nui/composals";
|
|
3
|
+
import { getThemeColor } from "@nui/utils";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import Box from "../box.vue";
|
|
6
|
+
import css from "./progress.module.css";
|
|
7
|
+
const {
|
|
8
|
+
withAria,
|
|
9
|
+
animated,
|
|
10
|
+
striped,
|
|
11
|
+
color,
|
|
12
|
+
mod
|
|
13
|
+
} = defineProps({
|
|
14
|
+
withAria: { type: Boolean, required: false },
|
|
15
|
+
color: { type: null, required: false },
|
|
16
|
+
striped: { type: Boolean, required: false },
|
|
17
|
+
animated: { type: Boolean, required: false },
|
|
18
|
+
is: { type: null, required: false },
|
|
19
|
+
mod: { type: [Object, Array, null], required: false }
|
|
20
|
+
});
|
|
21
|
+
const value = defineModel({ type: Number, ...{ required: true } });
|
|
22
|
+
const ariaAttributes = computed(() => withAria ? {
|
|
23
|
+
"role": "progressbar",
|
|
24
|
+
"aria-valuemax": 100,
|
|
25
|
+
"aria-valuemin": 0,
|
|
26
|
+
"aria-valuenow": value.value,
|
|
27
|
+
"aria-valuetext": `${value.value}%`
|
|
28
|
+
} : {});
|
|
29
|
+
const style = computed(() => useStyleResolver((theme) => ({
|
|
30
|
+
"--progress-section-size": `${value.value}%`,
|
|
31
|
+
"--progress-section-color": getThemeColor(color, theme)
|
|
32
|
+
})));
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<Box
|
|
37
|
+
:style
|
|
38
|
+
v-bind='ariaAttributes'
|
|
39
|
+
:class='css.section'
|
|
40
|
+
:mod='[{ striped: striped || animated, animated }, mod]'
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BoxProps } from '@nui/components';
|
|
2
|
+
import type { NuanceColor } from '@nui/types';
|
|
3
|
+
export interface ProgressSectionProps extends BoxProps {
|
|
4
|
+
/** Determines whether `aria-*` props should be added to the root element @default `true` */
|
|
5
|
+
withAria?: boolean;
|
|
6
|
+
/** Key of `theme.colors` or any valid CSS value @default `theme.primaryColor` */
|
|
7
|
+
color?: NuanceColor;
|
|
8
|
+
/** If set, the section has stripes @default `false` */
|
|
9
|
+
striped?: boolean;
|
|
10
|
+
/** If set, the sections stripes are animated, `striped` prop is ignored @default `false` */
|
|
11
|
+
animated?: boolean;
|
|
12
|
+
}
|
|
13
|
+
type __VLS_Props = ProgressSectionProps;
|
|
14
|
+
type __VLS_ModelProps = {
|
|
15
|
+
/** Value of the section in 0–100 range */
|
|
16
|
+
modelValue: number;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
|
+
"update:modelValue": (value: number) => any;
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
22
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ProgressRootProps } from './progress-root.vue.js';
|
|
2
|
+
import type { ProgressSectionProps } from './progress-section.vue.js';
|
|
3
|
+
export interface ProgressProps extends ProgressRootProps, ProgressSectionProps {
|
|
4
|
+
}
|
|
5
|
+
type __VLS_Props = ProgressProps;
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
|
+
modelValue: number;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (value: number) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.root{--progress-radius:var(--radius-default);--progress-size:var(--progress-size-md);--progress-size-xs:rem(8px);--progress-size-sm:rem(12px);--progress-size-md:rem(16px);--progress-size-lg:rem(20px);--progress-size-xl:rem(24px);border-radius:var(--progress-radius);display:flex;height:var(--progress-size);overflow:hidden;position:relative;@mixin where-light{background-color:var(--color-gray-2)}@mixin where-dark{background-color:var(--color-dark-4)}}.root:where([data-orientation=vertical]){flex-direction:column-reverse;height:auto;width:var(--progress-size)}.section{--progress-section-size:var(--progress-size-sm);--progress-section-color:var(--color-primary-4);--progress-transition-duration:100ms;align-items:center;background-color:var(--progress-section-color);background-size:20px 20px;display:flex;height:100%;justify-content:center;overflow:hidden;transition:width var(--progress-transition-duration) ease;width:var(--progress-section-size)}.section:where([data-striped]){background-image:linear-gradient(45deg,hsla(0,0%,100%,.15) 25%,transparent 0,transparent 50%,hsla(0,0%,100%,.15) 0,hsla(0,0%,100%,.15) 75%,transparent 0,transparent)}.section:where([data-animated]){animation:stripes-animation 1s linear infinite}.section:where(:last-of-type){border-radius:0;border-end-end-radius:var(--progress-radius);border-start-end-radius:var(--progress-radius)}.section:where(:first-of-type){border-radius:0;border-end-start-radius:var(--progress-radius);border-start-start-radius:var(--progress-radius)}.root:where([data-orientation=vertical]) .section{height:var(--progress-section-size);transition:height var(--progress-transition-duration,.1s) ease;width:100%}.root:where([data-orientation=vertical]) .section:where([data-striped]){background-image:linear-gradient(135deg,hsla(0,0%,100%,.15) 25%,transparent 0,transparent 50%,hsla(0,0%,100%,.15) 0,hsla(0,0%,100%,.15) 75%,transparent 0,transparent)}.root:where([data-orientation=vertical]) .section:where([data-animated]){animation:stripes-animation-vertical 1s linear infinite}.root:where([data-orientation=vertical]) .section:where(:last-of-type){border-radius:0;border-start-end-radius:var(--progress-radius);border-start-start-radius:var(--progress-radius)}.root:where([data-orientation=vertical]) .section:where(:first-of-type){border-radius:0;border-end-end-radius:var(--progress-radius);border-end-start-radius:var(--progress-radius)}.label{--progress-label-color:var(--color-white);color:var(--progress-label-color);font-size:min(calc(var(--progress-size)*.65));font-weight:700;line-height:1;overflow:hidden;padding-inline:4px;text-overflow:ellipsis;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.root:where([data-orientation=vertical]) .label{writing-mode:vertical-rl}@keyframes stripes-animation{0%{background-position:0 0}to{background-position:40px 0}}@keyframes stripes-animation-vertical{0%{background-position:0 0}to{background-position:0 40px}}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ProgressRoot from "./progress-root.vue";
|
|
3
|
+
import ProgressSection from "./progress-section.vue";
|
|
4
|
+
const {
|
|
5
|
+
mod,
|
|
6
|
+
size,
|
|
7
|
+
color,
|
|
8
|
+
radius,
|
|
9
|
+
striped,
|
|
10
|
+
animated,
|
|
11
|
+
withAria,
|
|
12
|
+
orientation,
|
|
13
|
+
transitionDuration
|
|
14
|
+
} = defineProps({
|
|
15
|
+
size: { type: String, required: false },
|
|
16
|
+
radius: { type: [String, Number], required: false },
|
|
17
|
+
transitionDuration: { type: Number, required: false },
|
|
18
|
+
orientation: { type: String, required: false },
|
|
19
|
+
is: { type: null, required: false },
|
|
20
|
+
mod: { type: [Object, Array, null], required: false },
|
|
21
|
+
withAria: { type: Boolean, required: false },
|
|
22
|
+
color: { type: null, required: false },
|
|
23
|
+
striped: { type: Boolean, required: false },
|
|
24
|
+
animated: { type: Boolean, required: false }
|
|
25
|
+
});
|
|
26
|
+
const value = defineModel({ type: Number, ...{ required: true } });
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<ProgressRoot :size :radius :orientation :transition-duration :mod>
|
|
31
|
+
<ProgressSection
|
|
32
|
+
v-model='value'
|
|
33
|
+
:striped
|
|
34
|
+
:animated
|
|
35
|
+
:color
|
|
36
|
+
:with-aria
|
|
37
|
+
/>
|
|
38
|
+
</ProgressRoot>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ProgressRootProps } from './progress-root.vue.js';
|
|
2
|
+
import type { ProgressSectionProps } from './progress-section.vue.js';
|
|
3
|
+
export interface ProgressProps extends ProgressRootProps, ProgressSectionProps {
|
|
4
|
+
}
|
|
5
|
+
type __VLS_Props = ProgressProps;
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
|
+
modelValue: number;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (value: number) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NuanceColor,
|
|
1
|
+
import type { NuanceColor, NuanceGradient, NuanceSize } from '@nui/types';
|
|
2
2
|
import type { CSSProperties } from 'vue';
|
|
3
3
|
import type { BoxProps } from './box.vue.js';
|
|
4
4
|
type TitleOrder = 1 | 2 | 3 | 4 | 5 | 6;
|
|
@@ -15,7 +15,7 @@ export interface TextProps extends BoxProps {
|
|
|
15
15
|
/** Determines whether font properties should be inherited from the parent, `false` by default */
|
|
16
16
|
inherit?: boolean;
|
|
17
17
|
/** Gradient configuration, ignored when `variant` is not `gradient`, `theme.defaultGradient` by default */
|
|
18
|
-
gradient?:
|
|
18
|
+
gradient?: NuanceGradient;
|
|
19
19
|
variant?: 'text' | 'gradient';
|
|
20
20
|
fz?: NuanceSize | `h${TitleOrder}` | string;
|
|
21
21
|
lh?: NuanceSize | string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NuanceColor,
|
|
1
|
+
import type { NuanceColor, NuanceGradient, NuanceSize } from '@nui/types';
|
|
2
2
|
import type { CSSProperties } from 'vue';
|
|
3
3
|
import type { BoxProps } from './box.vue.js';
|
|
4
4
|
type TitleOrder = 1 | 2 | 3 | 4 | 5 | 6;
|
|
@@ -15,7 +15,7 @@ export interface TextProps extends BoxProps {
|
|
|
15
15
|
/** Determines whether font properties should be inherited from the parent, `false` by default */
|
|
16
16
|
inherit?: boolean;
|
|
17
17
|
/** Gradient configuration, ignored when `variant` is not `gradient`, `theme.defaultGradient` by default */
|
|
18
|
-
gradient?:
|
|
18
|
+
gradient?: NuanceGradient;
|
|
19
19
|
variant?: 'text' | 'gradient';
|
|
20
20
|
fz?: NuanceSize | `h${TitleOrder}` | string;
|
|
21
21
|
lh?: NuanceSize | string;
|
|
@@ -56,9 +56,10 @@ function handleKeyDown(event) {
|
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
58
|
// Enter/Space - выбор элемента
|
|
59
|
-
case "Enter":
|
|
59
|
+
case "Enter": {
|
|
60
60
|
ctx.on("select", value);
|
|
61
61
|
return ctx.setActive(value);
|
|
62
|
+
}
|
|
62
63
|
case " ": {
|
|
63
64
|
event.preventDefault();
|
|
64
65
|
if (event.shiftKey)
|
|
@@ -75,8 +76,10 @@ function handleKeyDown(event) {
|
|
|
75
76
|
<li :class='$style.root' role='presentation'>
|
|
76
77
|
<RovingFocusItem>
|
|
77
78
|
<Button
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
:size='ctx.size'
|
|
80
|
+
:color='ctx.color'
|
|
81
|
+
:variant='ctx.variant'
|
|
82
|
+
:disabled
|
|
80
83
|
role='treeitem'
|
|
81
84
|
:classes='{
|
|
82
85
|
root: $style.button,
|
|
@@ -84,10 +87,9 @@ function handleKeyDown(event) {
|
|
|
84
87
|
inner: $style.inner,
|
|
85
88
|
section: $style.section
|
|
86
89
|
}'
|
|
87
|
-
:mod='{ active, selected, level }'
|
|
88
|
-
:aria-selected='selected'
|
|
89
90
|
:aria-level='level'
|
|
90
|
-
:
|
|
91
|
+
:aria-selected='selected'
|
|
92
|
+
:mod='{ active, selected, level }'
|
|
91
93
|
@click.prevent='handleClick'
|
|
92
94
|
@keydown.prevent='handleKeyDown'
|
|
93
95
|
>
|
|
@@ -135,7 +137,6 @@ function handleKeyDown(event) {
|
|
|
135
137
|
color: var(--color-text);
|
|
136
138
|
|
|
137
139
|
.label {
|
|
138
|
-
font-size: var(--font-size-sm);
|
|
139
140
|
font-weight: 500;
|
|
140
141
|
}
|
|
141
142
|
}
|