nuance-ui 0.2.28 → 0.2.30
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.d.mts +13 -0
- package/dist/module.d.ts +13 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +87 -2
- package/dist/runtime/app-config.d.ts +22 -0
- package/dist/runtime/components/action-icon/action-icon-section.vue +4 -3
- package/dist/runtime/components/action-icon/action-icon.vue +4 -3
- package/dist/runtime/components/alert.vue +5 -4
- package/dist/runtime/components/avatar/avatar.d.vue.ts +1 -4
- package/dist/runtime/components/avatar/avatar.vue +7 -5
- package/dist/runtime/components/avatar/avatar.vue.d.ts +1 -4
- package/dist/runtime/components/badge.d.vue.ts +3 -1
- package/dist/runtime/components/badge.vue +12 -9
- package/dist/runtime/components/badge.vue.d.ts +3 -1
- package/dist/runtime/components/breadcrumbs.d.vue.ts +1 -4
- package/dist/runtime/components/breadcrumbs.vue +4 -2
- package/dist/runtime/components/breadcrumbs.vue.d.ts +1 -4
- package/dist/runtime/components/button/button.module.css +1 -1
- package/dist/runtime/components/button/button.vue +4 -3
- package/dist/runtime/components/calendar/ui/core/calendar-header.vue +9 -4
- package/dist/runtime/components/checkbox/checkbox-indicator.vue +4 -3
- package/dist/runtime/components/checkbox/checkbox.vue +4 -3
- package/dist/runtime/components/chip/chip.vue +8 -7
- package/dist/runtime/components/combobox/combobox-option.vue +6 -3
- package/dist/runtime/components/date-time-picker.vue +4 -3
- package/dist/runtime/components/dialog/ui/dialog-close-button.vue +6 -2
- package/dist/runtime/components/files/file-upload-button.vue +4 -1
- package/dist/runtime/components/files/file-upload-icon.vue +5 -2
- package/dist/runtime/components/index.d.ts +1 -0
- package/dist/runtime/components/input/date-picker.vue +4 -3
- package/dist/runtime/components/input/email-input.vue +6 -2
- package/dist/runtime/components/input/number-input.vue +4 -2
- package/dist/runtime/components/input/password-input.vue +3 -1
- package/dist/runtime/components/link/lib.d.ts +2 -2
- package/dist/runtime/components/modal/modal.module.css +1 -1
- package/dist/runtime/components/nav-link/nav-link.vue +4 -7
- package/dist/runtime/components/select.vue +3 -1
- package/dist/runtime/components/table/ui/table-sort-icon.vue +5 -3
- package/dist/runtime/components/tabs/tabs-root.d.vue.ts +1 -1
- package/dist/runtime/components/tabs/tabs-root.vue.d.ts +1 -1
- package/dist/runtime/components/theme-toggle.vue +3 -2
- package/dist/runtime/components/time-picker/time-picker.vue +4 -2
- package/dist/runtime/components/timeline.d.vue.ts +93 -0
- package/dist/runtime/components/timeline.vue +112 -0
- package/dist/runtime/components/timeline.vue.d.ts +93 -0
- package/dist/runtime/components/tree/_ui/tree-item.vue +9 -6
- package/dist/runtime/components/tree/_ui/tree-root.vue +5 -3
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/use-config.d.ts +6 -0
- package/dist/runtime/composables/use-config.js +12 -0
- package/dist/runtime/styles/colors.css +1 -1
- package/dist/runtime/types/icons.d.ts +51 -0
- package/dist/runtime/types/icons.js +0 -0
- package/dist/runtime/types/index.d.ts +17 -0
- package/dist/runtime/utils/icons/default-icons.d.ts +3 -0
- package/dist/runtime/utils/icons/default-icons.js +33 -0
- package/dist/runtime/utils/icons/index.d.ts +1 -0
- package/dist/runtime/utils/icons/index.js +1 -0
- package/dist/runtime/utils/index.d.ts +1 -0
- package/dist/runtime/utils/index.js +1 -0
- package/dist/runtime/utils/style/create-variant-color-resolver.d.ts +8 -8
- package/dist/runtime/utils/style/create-variant-color-resolver.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useVarsResolver } from "@nui/composables";
|
|
3
|
+
import { getRadius, getSize, getThemeColor, rem } from "@nui/utils";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import Box from "./box.vue";
|
|
6
|
+
const {
|
|
7
|
+
items,
|
|
8
|
+
radius = "full",
|
|
9
|
+
align = "left",
|
|
10
|
+
size,
|
|
11
|
+
lineWidth = 4,
|
|
12
|
+
color,
|
|
13
|
+
classes,
|
|
14
|
+
mod,
|
|
15
|
+
reverse,
|
|
16
|
+
orientation = "vertical",
|
|
17
|
+
valueKey = "value"
|
|
18
|
+
} = defineProps({
|
|
19
|
+
items: { type: Array, required: true },
|
|
20
|
+
color: { type: null, required: false },
|
|
21
|
+
radius: { type: [String, Number], required: false },
|
|
22
|
+
size: { type: [String, Object], required: false },
|
|
23
|
+
align: { type: String, required: false },
|
|
24
|
+
lineWidth: { type: [Number, String], required: false },
|
|
25
|
+
reverse: { type: Boolean, required: false },
|
|
26
|
+
orientation: { type: String, required: false },
|
|
27
|
+
valueKey: { type: String, required: false },
|
|
28
|
+
classes: { type: Object, required: false },
|
|
29
|
+
is: { type: null, required: false },
|
|
30
|
+
mod: { type: [Object, Array, null], required: false }
|
|
31
|
+
});
|
|
32
|
+
defineEmits(["select"]);
|
|
33
|
+
defineSlots();
|
|
34
|
+
const modelValue = defineModel({ type: [String, Number, null] });
|
|
35
|
+
const style = useVarsResolver((theme) => ({
|
|
36
|
+
root: {
|
|
37
|
+
"--tl-size": getSize(size, "tl-size"),
|
|
38
|
+
"--tl-line-width": rem(lineWidth),
|
|
39
|
+
"--tl-radius": radius === void 0 ? void 0 : getRadius(radius),
|
|
40
|
+
"--tl-color": color ? getThemeColor(color, theme) : void 0
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
const currentStepIx = computed(() => {
|
|
44
|
+
const value = modelValue.value;
|
|
45
|
+
if (value == null)
|
|
46
|
+
return -1;
|
|
47
|
+
if (typeof value === "string") {
|
|
48
|
+
return items.findIndex((item) => item[valueKey] === value);
|
|
49
|
+
}
|
|
50
|
+
return reverse ? items.length - 1 - value : value;
|
|
51
|
+
});
|
|
52
|
+
function getActive(ix) {
|
|
53
|
+
if (currentStepIx.value === -1)
|
|
54
|
+
return false;
|
|
55
|
+
if (ix === currentStepIx.value)
|
|
56
|
+
return true;
|
|
57
|
+
if (reverse) {
|
|
58
|
+
return ix > currentStepIx.value;
|
|
59
|
+
} else {
|
|
60
|
+
return ix < currentStepIx.value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<Box
|
|
67
|
+
:style='style.root'
|
|
68
|
+
:class='[$style.root, classes?.root]'
|
|
69
|
+
:mod='[{ align, orientation }, mod]'
|
|
70
|
+
>
|
|
71
|
+
<Box
|
|
72
|
+
v-for='(item, ix) in items'
|
|
73
|
+
:key='item.id'
|
|
74
|
+
:class='[$style.item, classes?.item]'
|
|
75
|
+
:mod='{
|
|
76
|
+
"active": getActive(ix),
|
|
77
|
+
"line-active": getActive(ix)
|
|
78
|
+
}'
|
|
79
|
+
@click='$emit("select", item, $event)'
|
|
80
|
+
>
|
|
81
|
+
<Box
|
|
82
|
+
:class='[$style.bullet, classes?.bullet]'
|
|
83
|
+
:mod='{
|
|
84
|
+
align,
|
|
85
|
+
"active": getActive(ix),
|
|
86
|
+
"with-child": !!item?.icon || !!$slots.bullet
|
|
87
|
+
}'
|
|
88
|
+
>
|
|
89
|
+
<slot name='bullet' :item>
|
|
90
|
+
<Icon v-if='item?.icon' :name='item.icon' />
|
|
91
|
+
</slot>
|
|
92
|
+
</Box>
|
|
93
|
+
|
|
94
|
+
<div :class='[$style.body, classes?.body]'>
|
|
95
|
+
<div v-if='item.label' :class='[$style.label, classes?.label]'>
|
|
96
|
+
<slot name='label' :item>
|
|
97
|
+
{{ item?.label }}
|
|
98
|
+
</slot>
|
|
99
|
+
</div>
|
|
100
|
+
<div :class='[$style.content, classes?.content]'>
|
|
101
|
+
<slot name='content' :item>
|
|
102
|
+
{{ item?.description }}
|
|
103
|
+
</slot>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</Box>
|
|
107
|
+
</Box>
|
|
108
|
+
</template>
|
|
109
|
+
|
|
110
|
+
<style module>
|
|
111
|
+
.root{--tl-size-xs:1rem;--tl-size-sm:1.25rem;--tl-size-md:1.5rem;--tl-size-lg:1.75rem;--tl-size-xl:2rem;--tl-size:var(--tl-size-md);--tl-offset:calc((var(--tl-size) - var(--tl-line-width))/2);--tl-line-width:.25rem;--tl-radius:1000px;--tl-color:var(--color-primary-filled)}.root:where([data-align=left]){padding-inline-start:var(--tl-offset)}.root:where([data-align=right]){padding-inline-end:var(--tl-offset)}.root:where([data-orientation=horizontal]){display:flex;flex-direction:row;padding-block-start:var(--tl-offset);padding-inline:0}.item{--tli-bd-style:solid;--tli-bd-color:var(--color-primary-filled);--item-border:var(--tl-line-width) var(--tli-bd-style) var(--tli-bd-color);color:var(--color-text);position:relative}.item:before{border-inline-start:var(--item-border);bottom:0;content:"";display:var(--timeline-line-display,none);left:var(--timeline-line-left,0);pointer-events:none;position:absolute;right:var(--timeline-line-right,0);top:0}.root[data-align=left] .item:before{--timeline-line-left:calc(var(--tl-line-width)*-1);--timeline-line-right:auto;@mixin rtl{--timeline-line-left:auto;--timeline-line-right:calc(var(--tl-line-width)*-1)}}.root[data-align=right] .item:before{--timeline-line-left:auto;--timeline-line-right:calc(var(--tl-line-width)*-1);@mixin rtl{--timeline-line-left:calc(var(--tl-line-width)*-1);--timeline-line-right:auto}}.root:where([data-align=left]) .item{padding-inline-start:var(--tl-offset);text-align:left}.root:where([data-align=right]) .item{padding-inline-end:var(--tl-offset);text-align:right}.root:where([data-orientation=horizontal]) .item{flex:1;padding-block-start:var(--tl-offset);padding-inline:0;text-align:center}.root:where([data-orientation=horizontal]) .item:before{--timeline-line-top:calc((var(--tl-size) - var(--tl-line-width))/2);border-inline-start:none;border-top:var(--item-border);bottom:auto;height:var(--tl-line-width);left:0;right:0;top:var(--timeline-line-top,0)}.root:where([data-orientation=horizontal]) .item:where(:not(:last-of-type)){--timeline-line-display:block;padding-bottom:0}.item{@mixin where-light{--tli-bd-color:var(--color-gray-3)}}.item{@mixin where-dark{--tli-bd-color:var(--color-dark-4)}}.item:where([data-line-active]){--tli-bd-color:var(--tl-color)}.item:where(:not(:last-of-type)){--timeline-line-display:block;padding-bottom:var(--spacing-xl)}.root:where([data-orientation=horizontal]) .item:where(:not(:first-of-type)){padding-bottom:0}.bullet{--tl-bullet-offset:calc(var(--tl-size)/2*-1 + var(--tl-line-width)/2*-1);align-items:center;background-color:var(--color-body);border:var(--tl-line-width) solid;border-radius:var(--tli-radius,var(--tl-radius));color:var(--color-text);display:flex;height:var(--tl-size);justify-content:center;position:absolute;top:0;width:var(--tl-size);@mixin where-light{border-color:var(--color-gray-3)}@mixin where-dark{border-color:var(--color-dark-4)}}.root:where([data-align=left]) .bullet{left:var(--tl-bullet-offset);right:auto;@mixin where-rtl{left:auto;right:var(--tl-bullet-offset)}}.root:where([data-align=right]) .bullet{left:auto;right:var(--tl-bullet-offset);@mixin where-rtl{left:var(--tl-bullet-offset);right:auto}}.root:where([data-orientation=horizontal]) .bullet{--tl-bullet-offset:0}.bullet:where([data-with-child]){border-width:var(--tl-line-width);@mixin where-light{background-color:var(--color-gray-3)}@mixin where-dark{background-color:var(--color-dark-4)}}.bullet:where([data-active]){background-color:var(--color-white);border-color:var(--tli-color,var(--tl-color));color:var(--tl-icon-color,var(--color-white))}.bullet:where([data-active]):where([data-with-child]){background-color:var(--tli-color,var(--tl-color));color:var(--tl-icon-color,var(--color-white))}.root:where([data-align=left]) .body{padding-inline-start:var(--tl-offset);text-align:left;@mixin where-rtl{text-align:right}}.root:where([data-align=right]) .body{padding-inline-end:var(--tl-offset);text-align:right;@mixin where-rtl{text-align:left}}.root:where([data-orientation=horizontal]) .body{padding-block-start:calc(var(--tl-offset) + var(--spacing-xs));padding-inline:0}.label{font-weight:600;line-height:var(--tl-size)}.content{color:var(--color-dimmed)}
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { AnyString, Classes, DynamicSlots, NuanceColor, NuanceRadius, NuanceSize, SlotProps } from '@nui/types';
|
|
2
|
+
import type { BoxProps } from './box.vue.js';
|
|
3
|
+
export interface TimelineItem {
|
|
4
|
+
/** Unique item id */
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Icon inside bullet */
|
|
10
|
+
icon?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Key of `theme.radius` or any valid CSS value to set `border-radius`,
|
|
13
|
+
* numbers are converted to rem
|
|
14
|
+
* @default 'xl'
|
|
15
|
+
*/
|
|
16
|
+
radius?: NuanceRadius;
|
|
17
|
+
/**
|
|
18
|
+
* Key of `theme.colors` or any valid CSS color to control active item colors
|
|
19
|
+
* @default theme.primaryColor
|
|
20
|
+
*/
|
|
21
|
+
color?: NuanceColor;
|
|
22
|
+
/** Controls line border style @default 'solid' */
|
|
23
|
+
lineVariant?: 'solid' | 'dashed' | 'dotted';
|
|
24
|
+
/** Value used for model-based active state */
|
|
25
|
+
value?: string | number;
|
|
26
|
+
slot?: string;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
export interface TimelineVars {
|
|
30
|
+
root: '--tl-line-width' | '--tl-size' | '--tl-color' | '--tl-radius';
|
|
31
|
+
}
|
|
32
|
+
export type TimelineSlots<T extends TimelineItem = TimelineItem> = {
|
|
33
|
+
bullet?: SlotProps<T>;
|
|
34
|
+
label?: SlotProps<T>;
|
|
35
|
+
content?: SlotProps<T>;
|
|
36
|
+
} & DynamicSlots<T, 'bullet' | 'label' | 'content', {
|
|
37
|
+
item: T;
|
|
38
|
+
}>;
|
|
39
|
+
export interface TimelineEmits<T extends TimelineItem = TimelineItem> {
|
|
40
|
+
select: [item: T, event: Event];
|
|
41
|
+
}
|
|
42
|
+
export interface TimelineProps<T extends TimelineItem> extends BoxProps {
|
|
43
|
+
items: T[];
|
|
44
|
+
/**
|
|
45
|
+
* Key of `theme.colors` or any valid CSS color to control active item colors
|
|
46
|
+
* @default theme.primaryColor
|
|
47
|
+
*/
|
|
48
|
+
color?: NuanceColor;
|
|
49
|
+
/**
|
|
50
|
+
* Key of `theme.radius` or any valid CSS value to set `border-radius`, numbers are converted to rem
|
|
51
|
+
* @default 'full'
|
|
52
|
+
*/
|
|
53
|
+
radius?: NuanceRadius;
|
|
54
|
+
/** Size of the bullet @default 20 */
|
|
55
|
+
size?: NuanceSize | AnyString;
|
|
56
|
+
/** Position of content relative to the bullet @default 'left' */
|
|
57
|
+
align?: 'right' | 'left';
|
|
58
|
+
/** Control width of the line */
|
|
59
|
+
lineWidth?: number | string;
|
|
60
|
+
/** If set, the active items direction is reversed without reversing items order @default false */
|
|
61
|
+
reverse?: boolean;
|
|
62
|
+
/** @default 'vertical' */
|
|
63
|
+
orientation?: 'horizontal' | 'vertical';
|
|
64
|
+
/**
|
|
65
|
+
* Key of item used to match against model value.
|
|
66
|
+
* @default 'value'
|
|
67
|
+
*/
|
|
68
|
+
valueKey?: keyof T & string;
|
|
69
|
+
classes?: Classes<'root' | 'item' | 'body' | 'content' | 'bullet' | 'label'>;
|
|
70
|
+
}
|
|
71
|
+
declare const __VLS_export: <T extends TimelineItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
72
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(TimelineProps<T> & {
|
|
73
|
+
modelValue?: string | number | null;
|
|
74
|
+
}) & {
|
|
75
|
+
onSelect?: ((item: T, event: Event) => any) | undefined;
|
|
76
|
+
"onUpdate:modelValue"?: ((value: string | number | null | undefined) => any) | undefined;
|
|
77
|
+
}> & (typeof globalThis extends {
|
|
78
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
79
|
+
} ? P : {});
|
|
80
|
+
expose: (exposed: {}) => void;
|
|
81
|
+
attrs: any;
|
|
82
|
+
slots: TimelineSlots<T>;
|
|
83
|
+
emit: ((evt: "select", item: T, event: Event) => void) & ((event: "update:modelValue", value: string | number | null | undefined) => void);
|
|
84
|
+
}>) => import("vue").VNode & {
|
|
85
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
86
|
+
};
|
|
87
|
+
declare const _default: typeof __VLS_export;
|
|
88
|
+
export default _default;
|
|
89
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
90
|
+
[K in keyof T]: T[K];
|
|
91
|
+
} : {
|
|
92
|
+
[K in keyof T as K]: T[K];
|
|
93
|
+
}) & {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { useTheme } from "@nui/composables";
|
|
2
|
+
import { useConfig, useTheme } from "@nui/composables";
|
|
3
3
|
import { getThemeColor } from "@nui/utils";
|
|
4
4
|
import { computed, watch } from "vue";
|
|
5
5
|
import ActionIcon from "../../action-icon/action-icon.vue";
|
|
@@ -12,8 +12,8 @@ import { filterTreeItems } from "../lib/filter-tree-items";
|
|
|
12
12
|
import { useTreeItemHandlers } from "../lib/item-handlers";
|
|
13
13
|
const {
|
|
14
14
|
type = "file",
|
|
15
|
-
icon
|
|
16
|
-
trailingIcon
|
|
15
|
+
icon,
|
|
16
|
+
trailingIcon,
|
|
17
17
|
path,
|
|
18
18
|
name,
|
|
19
19
|
level,
|
|
@@ -29,6 +29,9 @@ const {
|
|
|
29
29
|
children: { type: Array, required: false }
|
|
30
30
|
});
|
|
31
31
|
const { value: theme } = useTheme();
|
|
32
|
+
const { icons } = useConfig();
|
|
33
|
+
const resolvedIcon = computed(() => icon ?? icons.folder);
|
|
34
|
+
const resolvedTrailingIcon = computed(() => trailingIcon ?? icons.folderOpen);
|
|
32
35
|
const isFolder = computed(() => type === "directory");
|
|
33
36
|
const ctx = useTreeState();
|
|
34
37
|
const selected = computed(() => ctx.selected.value.includes(path));
|
|
@@ -74,8 +77,8 @@ const { handleClick, handleKeyDown } = useTreeItemHandlers(path, isFolder, expan
|
|
|
74
77
|
</template>
|
|
75
78
|
|
|
76
79
|
<template v-else-if='isFolder'>
|
|
77
|
-
<Icon v-if='expanded' :class='$style.icon' :name='
|
|
78
|
-
<Icon v-else :class='$style.icon' :name='
|
|
80
|
+
<Icon v-if='expanded' :class='$style.icon' :name='resolvedTrailingIcon' />
|
|
81
|
+
<Icon v-else :class='$style.icon' :name='resolvedIcon' />
|
|
79
82
|
</template>
|
|
80
83
|
|
|
81
84
|
<template v-else>
|
|
@@ -91,7 +94,7 @@ const { handleClick, handleKeyDown } = useTreeItemHandlers(path, isFolder, expan
|
|
|
91
94
|
|
|
92
95
|
<template v-if='isFolder' #rightSection>
|
|
93
96
|
<ActionIcon
|
|
94
|
-
icon='
|
|
97
|
+
:icon='icons.chevronDown'
|
|
95
98
|
size='sm'
|
|
96
99
|
:color='ctx.color'
|
|
97
100
|
:classes='{ root: $style.chevron, icon: $style["chevron-icon"] }'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { useVarsResolver } from "@nui/composables";
|
|
2
|
+
import { useConfig, useVarsResolver } from "@nui/composables";
|
|
3
3
|
import { getSize } from "@nui/utils";
|
|
4
4
|
import { onClickOutside, useEventListener } from "@vueuse/core";
|
|
5
5
|
import { useTemplateRef } from "vue";
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
orientation,
|
|
14
14
|
variant = "subtle",
|
|
15
15
|
size = "md",
|
|
16
|
-
iconResolver
|
|
16
|
+
iconResolver,
|
|
17
17
|
removable = false,
|
|
18
18
|
selectable = false,
|
|
19
19
|
loadBranch,
|
|
@@ -32,6 +32,8 @@ const {
|
|
|
32
32
|
attr: { type: String, required: false }
|
|
33
33
|
});
|
|
34
34
|
const emit = defineEmits(["delete"]);
|
|
35
|
+
const { icons } = useConfig();
|
|
36
|
+
const resolvedIconResolver = iconResolver ?? (() => ({ icon: icons.file }));
|
|
35
37
|
const active = defineModel("active", { type: [String, null], ...{ default: null } });
|
|
36
38
|
const selected = defineModel("selected", { type: Array, ...{ default: [] } });
|
|
37
39
|
const expanded = defineModel("expanded", { type: Array, ...{ default: [] } });
|
|
@@ -47,7 +49,7 @@ useProvideTreeState({
|
|
|
47
49
|
active,
|
|
48
50
|
selected,
|
|
49
51
|
expanded,
|
|
50
|
-
iconResolver,
|
|
52
|
+
iconResolver: resolvedIconResolver,
|
|
51
53
|
size,
|
|
52
54
|
color,
|
|
53
55
|
variant,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VariantColorResolverOptions } from '@nui/utils';
|
|
2
|
+
/** Returns the configured icon registry merged with module defaults. */
|
|
3
|
+
export declare function useConfig(): {
|
|
4
|
+
icons: any;
|
|
5
|
+
variantResolver: (options: VariantColorResolverOptions) => import("#imports").VariantColorResolverResult;
|
|
6
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createVariantColorResolver } from "@nui/utils";
|
|
2
|
+
import { useAppConfig } from "#imports";
|
|
3
|
+
export function useConfig() {
|
|
4
|
+
const { icons, gradient } = useAppConfig().nui;
|
|
5
|
+
return {
|
|
6
|
+
icons,
|
|
7
|
+
variantResolver: (options) => createVariantColorResolver({
|
|
8
|
+
...options,
|
|
9
|
+
gradient: options.gradient ?? gradient
|
|
10
|
+
})
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--color-white:#fff;--color-black:#000;--color-
|
|
1
|
+
:root{--color-white:#fff;--color-black:#000;--color-dark-0:#c9c9c9;--color-dark-1:#b8b8b8;--color-dark-2:#828282;--color-dark-3:#696969;--color-dark-4:#424242;--color-dark-5:#3b3b3b;--color-dark-6:#2e2e2e;--color-dark-7:#242424;--color-dark-8:#1f1f1f;--color-dark-9:#141414;--color-gray-0:#f8f9fa;--color-gray-1:#f1f3f5;--color-gray-2:#e9ecef;--color-gray-3:#dee2e6;--color-gray-4:#ced4da;--color-gray-5:#adb5bd;--color-gray-6:#868e96;--color-gray-7:#495057;--color-gray-8:#343a40;--color-gray-9:#212529;--color-red-0:#fff5f5;--color-red-1:#ffe3e3;--color-red-2:#ffc9c9;--color-red-3:#ffa8a8;--color-red-4:#ff8787;--color-red-5:#ff6b6b;--color-red-6:#fa5252;--color-red-7:#f03e3e;--color-red-8:#e03131;--color-red-9:#c92a2a;--color-pink-0:#fdf6f8;--color-pink-1:#f7e4e9;--color-pink-2:#edc2d0;--color-pink-3:#dd9bb0;--color-pink-4:#c97a93;--color-pink-5:#b26179;--color-pink-6:#954d65;--color-pink-7:#7a3e52;--color-pink-8:#603140;--color-pink-9:#4d2733;--color-grape-0:#f8f0fc;--color-grape-1:#f3d9fa;--color-grape-2:#eebefa;--color-grape-3:#e599f7;--color-grape-4:#da77f2;--color-grape-5:#cc5de8;--color-grape-6:#be4bdb;--color-grape-7:#ae3ec9;--color-grape-8:#9c36b5;--color-grape-9:#862e9c;--color-violet-0:#f3f0ff;--color-violet-1:#e5dbff;--color-violet-2:#d0bfff;--color-violet-3:#b197fc;--color-violet-4:#9775fa;--color-violet-5:#845ef7;--color-violet-6:#7950f2;--color-violet-7:#7048e8;--color-violet-8:#6741d9;--color-violet-9:#5f3dc4;--color-indigo-0:#edf2ff;--color-indigo-1:#dbe4ff;--color-indigo-2:#bac8ff;--color-indigo-3:#91a7ff;--color-indigo-4:#748ffc;--color-indigo-5:#5c7cfa;--color-indigo-6:#4c6ef5;--color-indigo-7:#4263eb;--color-indigo-8:#3b5bdb;--color-indigo-9:#364fc7;--color-blue-0:#e7f5ff;--color-blue-1:#d0ebff;--color-blue-2:#a5d8ff;--color-blue-3:#74c0fc;--color-blue-4:#4dabf7;--color-blue-5:#339af0;--color-blue-6:#228be6;--color-blue-7:#1c7ed6;--color-blue-8:#1971c2;--color-blue-9:#1864ab;--color-cyan-0:#e3fafc;--color-cyan-1:#c5f6fa;--color-cyan-2:#99e9f2;--color-cyan-3:#66d9e8;--color-cyan-4:#3bc9db;--color-cyan-5:#22b8cf;--color-cyan-6:#15aabf;--color-cyan-7:#1098ad;--color-cyan-8:#0c8599;--color-cyan-9:#0b7285;--color-green-0:#ebfbee;--color-green-1:#d3f9d8;--color-green-2:#b2f2bb;--color-green-3:#8ce99a;--color-green-4:#69db7c;--color-green-5:#51cf66;--color-green-6:#40c057;--color-green-7:#37b24d;--color-green-8:#2f9e44;--color-green-9:#2b8a3e;--color-teal-0:#e6fcf5;--color-teal-1:#c3fae8;--color-teal-2:#96f2d7;--color-teal-3:#63e6be;--color-teal-4:#38d9a9;--color-teal-5:#20c997;--color-teal-6:#12b886;--color-teal-7:#0ca678;--color-teal-8:#099268;--color-teal-9:#087f5b;--color-lime-0:#f4fce3;--color-lime-1:#e9fac8;--color-lime-2:#d8f5a2;--color-lime-3:#c0eb75;--color-lime-4:#a9e34b;--color-lime-5:#94d82d;--color-lime-6:#82c91e;--color-lime-7:#74b816;--color-lime-8:#66a80f;--color-lime-9:#5c940d;--color-yellow-0:#fff9db;--color-yellow-1:#fff3bf;--color-yellow-2:#ffec99;--color-yellow-3:#ffe066;--color-yellow-4:#ffd43b;--color-yellow-5:#fcc419;--color-yellow-6:#fab005;--color-yellow-7:#f59f00;--color-yellow-8:#f08c00;--color-yellow-9:#e67700;--color-orange-0:#fff4e6;--color-orange-1:#ffe8cc;--color-orange-2:#ffd8a8;--color-orange-3:#ffc078;--color-orange-4:#ffa94d;--color-orange-5:#ff922b;--color-orange-6:#fd7e14;--color-orange-7:#f76707;--color-orange-8:#e8590c;--color-orange-9:#d9480f}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Registry of icon names used by components. Override to swap the icon pack. */
|
|
2
|
+
export interface NuanceIcons {
|
|
3
|
+
/** Close / clear / dismiss */
|
|
4
|
+
close: string;
|
|
5
|
+
/** Confirmation checkmark */
|
|
6
|
+
check: string;
|
|
7
|
+
/** Indeterminate / remove */
|
|
8
|
+
minus: string;
|
|
9
|
+
/** Add */
|
|
10
|
+
plus: string;
|
|
11
|
+
/** Chevron pointing right */
|
|
12
|
+
chevronRight: string;
|
|
13
|
+
/** Chevron pointing left */
|
|
14
|
+
chevronLeft: string;
|
|
15
|
+
/** Chevron pointing down */
|
|
16
|
+
chevronDown: string;
|
|
17
|
+
/** Chevron pointing up */
|
|
18
|
+
chevronUp: string;
|
|
19
|
+
/** Vertical expand chevrons */
|
|
20
|
+
selectExpand: string;
|
|
21
|
+
/** Email field */
|
|
22
|
+
email: string;
|
|
23
|
+
/** Reveal password */
|
|
24
|
+
passwordShow: string;
|
|
25
|
+
/** Hide password */
|
|
26
|
+
passwordHide: string;
|
|
27
|
+
/** Calendar / date field */
|
|
28
|
+
calendar: string;
|
|
29
|
+
/** Clock / time field */
|
|
30
|
+
clock: string;
|
|
31
|
+
/** User avatar placeholder */
|
|
32
|
+
person: string;
|
|
33
|
+
/** Light theme */
|
|
34
|
+
sun: string;
|
|
35
|
+
/** Dark theme */
|
|
36
|
+
moon: string;
|
|
37
|
+
/** Upload */
|
|
38
|
+
upload: string;
|
|
39
|
+
/** File node */
|
|
40
|
+
file: string;
|
|
41
|
+
/** Collapsed folder node */
|
|
42
|
+
folder: string;
|
|
43
|
+
/** Expanded folder node */
|
|
44
|
+
folderOpen: string;
|
|
45
|
+
/** Ascending sort */
|
|
46
|
+
sortAsc: string;
|
|
47
|
+
/** Descending sort */
|
|
48
|
+
sortDesc: string;
|
|
49
|
+
/** Unsorted */
|
|
50
|
+
sortOff: string;
|
|
51
|
+
}
|
|
File without changes
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
2
|
+
export type * from './icons';
|
|
1
3
|
export type * from './styling';
|
|
2
4
|
export type * from './theme';
|
|
3
5
|
/** Value that may be synchronous or wrapped in a promise. */
|
|
4
6
|
export type MaybePromise<T = unknown> = T | Promise<T>;
|
|
5
7
|
export type AnyString = string & {};
|
|
8
|
+
export type DynamicSlotsKeys<Name extends string | undefined, Suffix extends string | undefined = undefined> = (Name extends string ? Suffix extends string ? Name | `${Name}-${Suffix}` : Name : never);
|
|
9
|
+
export type SlotProps<T extends {
|
|
10
|
+
slot?: string;
|
|
11
|
+
}> = (props: {
|
|
12
|
+
item: T;
|
|
13
|
+
}) => VNode[];
|
|
14
|
+
export type DynamicSlots<T extends {
|
|
15
|
+
slot?: string;
|
|
16
|
+
}, Suffix extends string | undefined = undefined, ExtraProps extends object = object> = {
|
|
17
|
+
[K in DynamicSlotsKeys<T['slot'], Suffix>]?: (props: {
|
|
18
|
+
item: Extract<T, {
|
|
19
|
+
slot: K extends `${infer Base}-${Suffix}` ? Base : K;
|
|
20
|
+
}>;
|
|
21
|
+
} & ExtraProps) => VNode[];
|
|
22
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const DEFAULT_ICONS = {
|
|
2
|
+
// ─── Actions ───
|
|
3
|
+
close: "gravity-ui:xmark",
|
|
4
|
+
check: "gravity-ui:check",
|
|
5
|
+
minus: "gravity-ui:minus",
|
|
6
|
+
plus: "gravity-ui:plus",
|
|
7
|
+
// ─── Chevrons ───
|
|
8
|
+
chevronRight: "gravity-ui:chevron-right",
|
|
9
|
+
chevronLeft: "gravity-ui:chevron-left",
|
|
10
|
+
chevronDown: "gravity-ui:chevron-down",
|
|
11
|
+
chevronUp: "gravity-ui:chevron-up",
|
|
12
|
+
selectExpand: "gravity-ui:chevrons-expand-vertical",
|
|
13
|
+
// ─── Inputs ───
|
|
14
|
+
email: "gravity-ui:at",
|
|
15
|
+
passwordShow: "gravity-ui:eye",
|
|
16
|
+
passwordHide: "gravity-ui:eye-slash",
|
|
17
|
+
calendar: "gravity-ui:calendar",
|
|
18
|
+
clock: "gravity-ui:clock",
|
|
19
|
+
// ─── User ───
|
|
20
|
+
person: "gravity-ui:person",
|
|
21
|
+
// ─── Theme ───
|
|
22
|
+
sun: "gravity-ui:sun",
|
|
23
|
+
moon: "gravity-ui:moon",
|
|
24
|
+
// ─── Files & tree ───
|
|
25
|
+
upload: "gravity-ui:arrow-shape-up-from-line",
|
|
26
|
+
file: "gravity-ui:file",
|
|
27
|
+
folder: "gravity-ui:folder",
|
|
28
|
+
folderOpen: "gravity-ui:folder-open",
|
|
29
|
+
// ─── Table sort ───
|
|
30
|
+
sortAsc: "gravity-ui:bars-descending-align-left-arrow-up",
|
|
31
|
+
sortDesc: "gravity-ui:bars-descending-align-left-arrow-down",
|
|
32
|
+
sortOff: "gravity-ui:bars-descending-align-left"
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './default-icons.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./default-icons.js";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { AnyString, NuanceColor, NuanceGradient, NuanceTheme } from '@nui/types';
|
|
2
|
-
interface
|
|
2
|
+
export interface VariantColorResolverOptions {
|
|
3
|
+
color: NuanceColor | AnyString | undefined;
|
|
4
|
+
variant: 'filled' | 'light' | 'outline' | 'subtle' | 'default' | 'gradient' | 'gradient-outline';
|
|
5
|
+
gradient?: NuanceGradient;
|
|
6
|
+
theme: NuanceTheme;
|
|
7
|
+
}
|
|
8
|
+
export interface VariantColorResolverResult {
|
|
3
9
|
/** Base background CSS value. */
|
|
4
10
|
background: string;
|
|
5
11
|
/** Background CSS value applied on hover. */
|
|
@@ -17,10 +23,4 @@ interface VariantColorResolverResult {
|
|
|
17
23
|
* `default`, `gradient`, `gradient-outline`, `dot` — and falls back to the
|
|
18
24
|
* default `--color-*` tokens when no explicit shade is provided.
|
|
19
25
|
*/
|
|
20
|
-
export declare function createVariantColorResolver({ color, variant, gradient, theme, }:
|
|
21
|
-
color: NuanceColor | AnyString | undefined;
|
|
22
|
-
variant: 'filled' | 'light' | 'outline' | 'subtle' | 'default' | 'gradient' | 'gradient-outline' | 'dot';
|
|
23
|
-
gradient?: NuanceGradient;
|
|
24
|
-
theme: NuanceTheme;
|
|
25
|
-
}): VariantColorResolverResult;
|
|
26
|
-
export {};
|
|
26
|
+
export declare function createVariantColorResolver({ color, variant, gradient, theme, }: VariantColorResolverOptions): VariantColorResolverResult;
|
|
@@ -8,7 +8,7 @@ export function createVariantColorResolver({
|
|
|
8
8
|
theme
|
|
9
9
|
}) {
|
|
10
10
|
const parsed = parseThemeColor({ color, theme });
|
|
11
|
-
if (variant === "filled"
|
|
11
|
+
if (variant === "filled") {
|
|
12
12
|
const text = "var(--color-white)";
|
|
13
13
|
if (parsed.shade === void 0) {
|
|
14
14
|
return {
|
|
@@ -82,7 +82,7 @@ export function createVariantColorResolver({
|
|
|
82
82
|
deg: gradient?.deg
|
|
83
83
|
}, theme),
|
|
84
84
|
text: "var(--color-white)",
|
|
85
|
-
border: "
|
|
85
|
+
border: "none"
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
if (variant === "gradient-outline") {
|