@byyuurin/ui 0.5.2 → 0.5.3
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/README.md +11 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/CheckboxGroup.vue +1 -1
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +5 -5
- package/dist/runtime/components/InputNumber.vue +4 -3
- package/dist/runtime/components/Select.vue +4 -2
- package/dist/runtime/plugins/colors.js +14 -12
- package/dist/shared/{ui.B6u-xvto.mjs → ui.zcNpBAcn.mjs} +10 -10
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ import { createUnoPreset } from '@byyuurin/ui/unocss'
|
|
|
56
56
|
import { defineConfig, presetWind4 } from 'unocss'
|
|
57
57
|
|
|
58
58
|
export default defineConfig({
|
|
59
|
+
outputToCssLayers: true,
|
|
59
60
|
presets: [
|
|
60
61
|
presetWind4(),
|
|
61
62
|
createUnoPreset({
|
|
@@ -65,6 +66,10 @@ export default defineConfig({
|
|
|
65
66
|
})
|
|
66
67
|
```
|
|
67
68
|
|
|
69
|
+
> [!NOTE]
|
|
70
|
+
> This preset relies on CSS layers to ensure generated CSS variables
|
|
71
|
+
> can be properly overridden. Make sure `outputToCssLayers` is enabled.
|
|
72
|
+
|
|
68
73
|
> [!IMPORTANT]
|
|
69
74
|
> The preset colors configuration must be the same as your nuxt configuration
|
|
70
75
|
|
|
@@ -160,7 +165,7 @@ export default defineConfig({
|
|
|
160
165
|
})
|
|
161
166
|
```
|
|
162
167
|
|
|
163
|
-
|
|
168
|
+
1. Add UnoCSS preset in your `uno.config.ts`:
|
|
164
169
|
|
|
165
170
|
```ts
|
|
166
171
|
import { createUnoPreset } from '@byyuurin/ui/unocss' // <---
|
|
@@ -168,6 +173,7 @@ import { defineConfig, presetWebFonts, presetWind4 } from 'unocss'
|
|
|
168
173
|
import uiConfig from './ui.config' // <---
|
|
169
174
|
|
|
170
175
|
export default defineConfig({
|
|
176
|
+
outputToCssLayers: true, // <--
|
|
171
177
|
presets: [
|
|
172
178
|
presetWind4(),
|
|
173
179
|
createUnoPreset(uiConfig.uno), // <---
|
|
@@ -180,6 +186,10 @@ export default defineConfig({
|
|
|
180
186
|
})
|
|
181
187
|
```
|
|
182
188
|
|
|
189
|
+
> [!NOTE]
|
|
190
|
+
> This preset relies on CSS layers to ensure generated CSS variables
|
|
191
|
+
> can be properly overridden. Make sure `outputToCssLayers` is enabled.
|
|
192
|
+
|
|
183
193
|
4. Add the UI Vue plugin in your `src/main.ts`
|
|
184
194
|
|
|
185
195
|
```ts
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
|
-
import { v as version, n as name, a as addTemplates } from './shared/ui.
|
|
3
|
+
import { v as version, n as name, a as addTemplates } from './shared/ui.zcNpBAcn.mjs';
|
|
4
4
|
import { d as defaultOptions, r as resolveColors, g as getDefaultConfig } from './shared/ui.Dy7aH7sf.mjs';
|
|
5
5
|
import 'node:module';
|
|
6
6
|
import 'node:url';
|
|
@@ -33,7 +33,7 @@ const props = defineProps({
|
|
|
33
33
|
indicator: { type: null, required: false },
|
|
34
34
|
icon: { type: [String, Object], required: false }
|
|
35
35
|
});
|
|
36
|
-
const emit = defineEmits(["
|
|
36
|
+
const emit = defineEmits(["change", "update:modelValue"]);
|
|
37
37
|
const slots = defineSlots();
|
|
38
38
|
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "orientation", "loop", "required"), emit);
|
|
39
39
|
const checkboxProps = useForwardProps(reactivePick(props, "indicator", "icon"));
|
|
@@ -2,7 +2,7 @@ import type { VariantProps } from '@byyuurin/ui-kit';
|
|
|
2
2
|
import type { CheckboxGroupRootEmits, CheckboxGroupRootProps, CheckboxRootProps } from 'reka-ui';
|
|
3
3
|
import theme from '#build/ui/checkbox-group';
|
|
4
4
|
import type { CheckboxProps, ComponentBaseProps, ComponentUIProps } from '../types';
|
|
5
|
-
import type { AcceptableValue, GetItemKeys, GetModelValue, StaticSlot } from '../types/utils';
|
|
5
|
+
import type { AcceptableValue, GetItemKeys, GetModelValue, GetModelValueEmits, StaticSlot } from '../types/utils';
|
|
6
6
|
type ThemeVariants = VariantProps<typeof theme>;
|
|
7
7
|
export type CheckboxGroupValue = AcceptableValue;
|
|
8
8
|
interface CheckboxGroupItemBase {
|
|
@@ -54,9 +54,9 @@ export interface CheckboxGroupProps<T extends CheckboxGroupItem[] = CheckboxGrou
|
|
|
54
54
|
orientation?: ThemeVariants['orientation'];
|
|
55
55
|
ui?: ComponentUIProps<typeof theme>;
|
|
56
56
|
}
|
|
57
|
-
export type CheckboxGroupEmits<T extends CheckboxGroupItem[] = CheckboxGroupItem[]> = CheckboxGroupRootEmits
|
|
57
|
+
export type CheckboxGroupEmits<T extends CheckboxGroupItem[] = CheckboxGroupItem[], VK extends GetItemKeys<T> = 'value'> = Omit<CheckboxGroupRootEmits, 'update:modelValue'> & {
|
|
58
58
|
change: [event: Event];
|
|
59
|
-
}
|
|
59
|
+
} & GetModelValueEmits<T, VK, true>;
|
|
60
60
|
export interface CheckboxGroupSlots<T extends CheckboxGroupItem[] = CheckboxGroupItem[]> {
|
|
61
61
|
legend: StaticSlot;
|
|
62
62
|
label: StaticSlot<{
|
|
@@ -75,14 +75,14 @@ export default _default;
|
|
|
75
75
|
declare const __VLS_export: <T extends CheckboxGroupItem[], VK extends GetItemKeys<T> = "value">(__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<{
|
|
76
76
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<CheckboxGroupProps<T, VK> & {
|
|
77
77
|
onChange?: ((event: Event) => any) | undefined;
|
|
78
|
-
"onUpdate:modelValue"?: ((value: T[
|
|
78
|
+
"onUpdate:modelValue"?: ((value: import("../types").GetItemValue<T, VK, import("../types").NestedItem<T>>[]) => any) | undefined;
|
|
79
79
|
}> & (typeof globalThis extends {
|
|
80
80
|
__VLS_PROPS_FALLBACK: infer P;
|
|
81
81
|
} ? P : {});
|
|
82
82
|
expose: (exposed: {}) => void;
|
|
83
83
|
attrs: any;
|
|
84
84
|
slots: CheckboxGroupSlots<CheckboxGroupItem[]>;
|
|
85
|
-
emit: ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T[
|
|
85
|
+
emit: ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: import("../types").GetItemValue<T, VK, import("../types").NestedItem<T>>[]) => void);
|
|
86
86
|
}>) => import("vue").VNode & {
|
|
87
87
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
88
88
|
};
|
|
@@ -55,13 +55,14 @@ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "defaultValue",
|
|
|
55
55
|
const { t } = useLocale();
|
|
56
56
|
const { id, name, size: formFieldSize, color, highlight, disabled, ariaAttrs, emitFormBlur, emitFormFocus, emitFormInput, emitFormChange } = useFormField(props);
|
|
57
57
|
const { size: fieldGroupSize, orientation } = useFieldGroup(props);
|
|
58
|
+
const size = computed(() => fieldGroupSize.value || formFieldSize.value);
|
|
58
59
|
const appConfig = useAppConfig();
|
|
59
60
|
const ui = computed(() => {
|
|
60
61
|
const styler = cv(merge(theme, appConfig.ui.inputNumber));
|
|
61
62
|
return styler({
|
|
62
63
|
...pick(props, ["variant", "orientation", "disabled"]),
|
|
63
64
|
color: color.value,
|
|
64
|
-
size:
|
|
65
|
+
size: size.value,
|
|
65
66
|
highlight: highlight.value,
|
|
66
67
|
fieldGroup: orientation.value,
|
|
67
68
|
increment: props.orientation === "vertical" ? !!props.increment || !!props.decrement : !!props.increment,
|
|
@@ -118,7 +119,7 @@ defineExpose({
|
|
|
118
119
|
<slot name="increment">
|
|
119
120
|
<Button
|
|
120
121
|
:icon="incrementIcon"
|
|
121
|
-
:size="
|
|
122
|
+
:size="size"
|
|
122
123
|
:color="color"
|
|
123
124
|
variant="link"
|
|
124
125
|
:aria-label="t('inputNumber.increment')"
|
|
@@ -133,7 +134,7 @@ defineExpose({
|
|
|
133
134
|
<slot name="decrement">
|
|
134
135
|
<Button
|
|
135
136
|
:icon="decrementIcon"
|
|
136
|
-
:size="
|
|
137
|
+
:size="size"
|
|
137
138
|
:color="color"
|
|
138
139
|
variant="link"
|
|
139
140
|
:aria-label="t('inputNumber.decrement')"
|
|
@@ -87,12 +87,13 @@ const appConfig = useAppConfig();
|
|
|
87
87
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, {
|
|
88
88
|
trailingIcon: appConfig.ui.icons.chevronDown
|
|
89
89
|
})));
|
|
90
|
+
const size = computed(() => fieldGroupSize.value || formFieldSize.value);
|
|
90
91
|
const ui = computed(() => {
|
|
91
92
|
const styler = cv(merge(theme, appConfig.ui.select));
|
|
92
93
|
return styler({
|
|
93
94
|
...pick(props, ["variant", "loading"]),
|
|
94
95
|
color: color.value,
|
|
95
|
-
size:
|
|
96
|
+
size: size.value,
|
|
96
97
|
highlight: highlight.value,
|
|
97
98
|
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
98
99
|
trailing: isTrailing.value || !!slots.trailing,
|
|
@@ -287,6 +288,7 @@ defineExpose({
|
|
|
287
288
|
<Button
|
|
288
289
|
as="span"
|
|
289
290
|
:icon="props.clearIcon || appConfig.ui.icons.close"
|
|
291
|
+
:size="size"
|
|
290
292
|
variant="link"
|
|
291
293
|
color="neutral"
|
|
292
294
|
tabindex="-1"
|
|
@@ -311,7 +313,7 @@ defineExpose({
|
|
|
311
313
|
<Input
|
|
312
314
|
autofocus
|
|
313
315
|
autocomplete="off"
|
|
314
|
-
:size="
|
|
316
|
+
:size="size"
|
|
315
317
|
v-bind="searchInputProps"
|
|
316
318
|
data-part="input"
|
|
317
319
|
:class="ui.input({ class: props.ui?.input })"
|
|
@@ -2,13 +2,14 @@ import { colors } from "@unocss/preset-wind4/colors";
|
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { defineNuxtPlugin, useAppConfig, useHead, useNuxtApp } from "#imports";
|
|
4
4
|
const themeShades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
5
|
+
const newline = "\n ";
|
|
5
6
|
function getColor(color, shade) {
|
|
6
7
|
if (color in colors && typeof colors[color] === "object" && shade in colors[color])
|
|
7
8
|
return colors[color][shade];
|
|
8
9
|
return "";
|
|
9
10
|
}
|
|
10
11
|
function generateShades(key, value) {
|
|
11
|
-
return themeShades.map((shade) => `--ui-color-${key}-${shade}: var(--colors-${value === "neutral" ? "tw-neutral" : value}-${shade}, ${getColor(value, shade)});`).join(
|
|
12
|
+
return themeShades.map((shade) => `--ui-color-${key}-${shade}: var(--colors-${value === "neutral" ? "tw-neutral" : value}-${shade}, ${getColor(value, shade)});`).join(newline);
|
|
12
13
|
}
|
|
13
14
|
function generateColor(key, shade) {
|
|
14
15
|
return `--ui-${key}: var(--ui-color-${key}-${shade});`;
|
|
@@ -18,17 +19,18 @@ export default defineNuxtPlugin(() => {
|
|
|
18
19
|
const nuxtApp = useNuxtApp();
|
|
19
20
|
const root = computed(() => {
|
|
20
21
|
const { neutral, ...colors2 } = appConfig.ui.colors;
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
22
|
+
return `@layer theme {
|
|
23
|
+
:root, host {
|
|
24
|
+
${Object.entries(appConfig.ui.colors).map(([key, value]) => generateShades(key, value)).join(newline)}
|
|
25
|
+
}
|
|
26
|
+
:root,
|
|
27
|
+
.light {
|
|
28
|
+
${Object.keys(colors2).map((key) => generateColor(key, 500)).join(newline)}
|
|
29
|
+
}
|
|
30
|
+
.dark {
|
|
31
|
+
${Object.keys(colors2).map((key) => generateColor(key, 400)).join(newline)}
|
|
32
|
+
}
|
|
33
|
+
}`;
|
|
32
34
|
});
|
|
33
35
|
const headData = {
|
|
34
36
|
style: [{
|
|
@@ -10,7 +10,7 @@ import { ct } from '@byyuurin/ui-kit';
|
|
|
10
10
|
import { defu } from 'defu';
|
|
11
11
|
|
|
12
12
|
const name = "@byyuurin/ui";
|
|
13
|
-
const version = "0.5.
|
|
13
|
+
const version = "0.5.3";
|
|
14
14
|
|
|
15
15
|
const accordion = ct({
|
|
16
16
|
parts: {
|
|
@@ -822,9 +822,9 @@ const calendar = (options) => ct({
|
|
|
822
822
|
const card = ct({
|
|
823
823
|
parts: {
|
|
824
824
|
root: "rounded divide-y overflow-hidden",
|
|
825
|
-
header: "flex flex-wrap items-center gap-1 p-4
|
|
826
|
-
body: "flex-1 overflow-y-auto p-4
|
|
827
|
-
footer: "flex items-center gap-1.5 p-4
|
|
825
|
+
header: "flex flex-wrap items-center gap-1 p-4",
|
|
826
|
+
body: "flex-1 overflow-y-auto p-4",
|
|
827
|
+
footer: "flex items-center gap-1.5 p-4",
|
|
828
828
|
title: "flex-grow text-xl text-highlighted font-semibold",
|
|
829
829
|
description: "w-full text-muted text-sm"
|
|
830
830
|
},
|
|
@@ -1322,9 +1322,9 @@ const drawer = ct({
|
|
|
1322
1322
|
parts: {
|
|
1323
1323
|
overlay: "fixed inset-0 bg-elevated/75",
|
|
1324
1324
|
content: "fixed bg-default divide-y divide-default flex flex-col focus:outline-none",
|
|
1325
|
-
header: "flex flex-wrap items-center gap-1 p-4
|
|
1326
|
-
body: "flex-1 overflow-y-auto p-4
|
|
1327
|
-
footer: "flex items-center gap-1 p-4
|
|
1325
|
+
header: "flex flex-wrap items-center gap-1 p-4",
|
|
1326
|
+
body: "flex-1 overflow-y-auto p-4",
|
|
1327
|
+
footer: "flex items-center gap-1 p-4",
|
|
1328
1328
|
title: "flex-grow text-xl text-highlighted font-semibold",
|
|
1329
1329
|
description: "w-full text-muted text-sm",
|
|
1330
1330
|
close: "ms-auto"
|
|
@@ -2387,9 +2387,9 @@ const modal = ct({
|
|
|
2387
2387
|
parts: {
|
|
2388
2388
|
overlay: "fixed inset-0 bg-elevated/75",
|
|
2389
2389
|
content: "fixed bg-default divide-y divide-default flex flex-col focus:outline-none",
|
|
2390
|
-
header: "flex flex-wrap items-center gap-1 p-4
|
|
2391
|
-
body: "flex-1 overflow-y-auto p-4
|
|
2392
|
-
footer: "flex items-center gap-1 p-4
|
|
2390
|
+
header: "flex flex-wrap items-center gap-1 p-4",
|
|
2391
|
+
body: "flex-1 overflow-y-auto p-4",
|
|
2392
|
+
footer: "flex items-center gap-1 p-4",
|
|
2393
2393
|
title: "flex-grow text-xl text-highlighted font-semibold",
|
|
2394
2394
|
description: "w-full text-muted text-sm",
|
|
2395
2395
|
close: "ms-auto"
|
package/dist/unplugin.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
import { join, normalize } from 'pathe';
|
|
4
4
|
import { createUnplugin } from 'unplugin';
|
|
5
|
-
import { g as getTemplates, n as name } from './shared/ui.
|
|
5
|
+
import { g as getTemplates, n as name } from './shared/ui.zcNpBAcn.mjs';
|
|
6
6
|
import { d as defaultOptions, r as resolveColors, g as getDefaultConfig } from './shared/ui.Dy7aH7sf.mjs';
|
|
7
7
|
import AutoImport from 'unplugin-auto-import';
|
|
8
8
|
import { globSync } from 'tinyglobby';
|
package/dist/vite.mjs
CHANGED