@byyuurin/ui 0.0.7 → 0.0.8
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 +5 -5
- package/dist/module.mjs.map +1 -1
- package/dist/runtime/app/injections.d.ts +16 -0
- package/dist/runtime/app/injections.js +31 -0
- package/dist/runtime/components/Accordion.vue +20 -20
- package/dist/runtime/components/Alert.vue +22 -15
- package/dist/runtime/components/App.vue +15 -15
- package/dist/runtime/components/Avatar.vue +73 -0
- package/dist/runtime/components/AvatarGroup.vue +90 -0
- package/dist/runtime/components/Badge.vue +15 -10
- package/dist/runtime/components/Breadcrumb.vue +105 -0
- package/dist/runtime/components/Button.vue +13 -13
- package/dist/runtime/components/ButtonGroup.vue +12 -10
- package/dist/runtime/components/Card.vue +7 -2
- package/dist/runtime/components/Carousel.vue +19 -12
- package/dist/runtime/components/Checkbox.vue +13 -9
- package/dist/runtime/components/Chip.vue +17 -12
- package/dist/runtime/components/Collapsible.vue +3 -3
- package/dist/runtime/components/Drawer.vue +14 -15
- package/dist/runtime/components/Input.vue +24 -24
- package/dist/runtime/components/InputNumber.vue +7 -5
- package/dist/runtime/components/Kbd.vue +51 -0
- package/dist/runtime/components/Link.vue +10 -10
- package/dist/runtime/components/LinkBase.vue +1 -1
- package/dist/runtime/components/Modal.vue +11 -8
- package/dist/runtime/components/ModalProvider.vue +2 -1
- package/dist/runtime/components/Pagination.vue +30 -30
- package/dist/runtime/components/PinInput.vue +7 -7
- package/dist/runtime/components/Popover.vue +7 -7
- package/dist/runtime/components/Progress.vue +165 -0
- package/dist/runtime/components/RadioGroup.vue +33 -29
- package/dist/runtime/components/Select.vue +40 -40
- package/dist/runtime/components/Skeleton.vue +33 -0
- package/dist/runtime/components/Slider.vue +6 -6
- package/dist/runtime/components/Switch.vue +11 -12
- package/dist/runtime/components/Table.vue +19 -11
- package/dist/runtime/components/Tabs.vue +22 -18
- package/dist/runtime/components/Textarea.vue +11 -11
- package/dist/runtime/components/Toast.vue +14 -13
- package/dist/runtime/components/Toaster.vue +4 -4
- package/dist/runtime/components/Tooltip.vue +7 -7
- package/dist/runtime/composables/useAvatarGroup.d.ts +4 -0
- package/dist/runtime/composables/useAvatarGroup.js +8 -0
- package/dist/runtime/composables/useButtonGroup.d.ts +4 -12
- package/dist/runtime/composables/useButtonGroup.js +1 -6
- package/dist/runtime/composables/useComponentIcons.d.ts +9 -9
- package/dist/runtime/composables/useComponentIcons.js +11 -11
- package/dist/runtime/composables/useKbd.d.ts +35 -0
- package/dist/runtime/composables/useKbd.js +49 -0
- package/dist/runtime/composables/useLocale.d.ts +8 -0
- package/dist/runtime/composables/useLocale.js +22 -0
- package/dist/runtime/composables/useModal.d.ts +1 -6
- package/dist/runtime/composables/useModal.js +1 -6
- package/dist/runtime/composables/useTheme.d.ts +0 -4
- package/dist/runtime/composables/useTheme.js +2 -12
- package/dist/runtime/index.d.ts +6 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +28 -0
- package/dist/runtime/locale/index.d.ts +2 -0
- package/dist/runtime/locale/index.js +2 -0
- package/dist/runtime/locale/zh-tw.d.ts +2 -0
- package/dist/runtime/locale/zh-tw.js +28 -0
- package/dist/runtime/theme/accordion.d.ts +6 -6
- package/dist/runtime/theme/accordion.js +2 -2
- package/dist/runtime/theme/app.d.ts +6 -6
- package/dist/runtime/theme/app.js +7 -7
- package/dist/runtime/theme/avatar-group.d.ts +52 -0
- package/dist/runtime/theme/avatar-group.js +32 -0
- package/dist/runtime/theme/avatar.d.ts +56 -0
- package/dist/runtime/theme/avatar.js +34 -0
- package/dist/runtime/theme/breadcrumb.d.ts +67 -0
- package/dist/runtime/theme/breadcrumb.js +44 -0
- package/dist/runtime/theme/button.d.ts +8 -8
- package/dist/runtime/theme/button.js +9 -9
- package/dist/runtime/theme/chip.d.ts +4 -4
- package/dist/runtime/theme/chip.js +2 -2
- package/dist/runtime/theme/drawer.js +2 -2
- package/dist/runtime/theme/index.d.ts +6 -0
- package/dist/runtime/theme/index.js +6 -0
- package/dist/runtime/theme/input-number.d.ts +6 -0
- package/dist/runtime/theme/input-number.js +5 -2
- package/dist/runtime/theme/input.d.ts +12 -12
- package/dist/runtime/theme/input.js +12 -12
- package/dist/runtime/theme/kbd.d.ts +39 -0
- package/dist/runtime/theme/kbd.js +26 -0
- package/dist/runtime/theme/modal.js +2 -2
- package/dist/runtime/theme/popover.js +1 -1
- package/dist/runtime/theme/progress.d.ts +122 -0
- package/dist/runtime/theme/progress.js +95 -0
- package/dist/runtime/theme/select.d.ts +18 -18
- package/dist/runtime/theme/select.js +16 -16
- package/dist/runtime/theme/skeleton.d.ts +8 -0
- package/dist/runtime/theme/skeleton.js +7 -0
- package/dist/runtime/theme/switch.js +1 -1
- package/dist/runtime/theme/tabs.d.ts +2 -2
- package/dist/runtime/theme/tabs.js +1 -1
- package/dist/runtime/theme/toast.js +2 -2
- package/dist/runtime/theme/tooltip.js +1 -1
- package/dist/runtime/types/components.d.ts +6 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +23 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/utils.d.ts +1 -1
- package/dist/runtime/utils/index.d.ts +6 -1
- package/dist/runtime/utils/index.js +6 -4
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/utils/translator.d.ts +18 -0
- package/dist/runtime/utils/translator.js +8 -0
- package/dist/shared/ui.ba24b380.mjs +4 -0
- package/dist/shared/ui.ba24b380.mjs.map +1 -0
- package/dist/unplugin.mjs +3 -12
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +24 -13
- package/dist/shared/ui.d1728164.mjs +0 -4
- package/dist/shared/ui.d1728164.mjs.map +0 -1
- /package/dist/runtime/{composables/defineInjection.d.ts → utils/vue.d.ts} +0 -0
- /package/dist/runtime/{composables/defineInjection.js → utils/vue.js} +0 -0
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
-
import {
|
|
2
|
+
import { n as name } from './shared/ui.ba24b380.mjs';
|
|
3
3
|
|
|
4
4
|
const module = defineNuxtModule({
|
|
5
5
|
meta: {
|
|
6
|
-
name:
|
|
6
|
+
name: name,
|
|
7
7
|
configKey: "ui",
|
|
8
8
|
compatibility: {
|
|
9
9
|
nuxt: ">=3.13.1"
|
|
@@ -13,15 +13,15 @@ const module = defineNuxtModule({
|
|
|
13
13
|
prefix: "U"
|
|
14
14
|
},
|
|
15
15
|
setup(options, nuxt) {
|
|
16
|
-
const logger = useLogger(
|
|
16
|
+
const logger = useLogger(name);
|
|
17
17
|
const { resolve } = createResolver(import.meta.url);
|
|
18
18
|
if (!nuxt.options.modules.includes("@unocss/nuxt")) {
|
|
19
|
-
logger.error(`\`${
|
|
19
|
+
logger.error(`\`${name}\` requires the \`@unocss/nuxt\` module to be installed.`);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
nuxt.options.vite.optimizeDeps ??= {};
|
|
23
23
|
nuxt.options.vite.optimizeDeps.include ??= [];
|
|
24
|
-
nuxt.options.vite.optimizeDeps.include.push(`${
|
|
24
|
+
nuxt.options.vite.optimizeDeps.include.push(`${name}/unocss`);
|
|
25
25
|
nuxt.options.alias["#ui"] = resolve("./runtime");
|
|
26
26
|
addComponentsDir({
|
|
27
27
|
path: resolve("./runtime/components"),
|
package/dist/module.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import { addComponentsDir, addImportsDir, createResolver, defineNuxtModule, useLogger } from '@nuxt/kit'\nimport { packageName } from './shared'\n\nexport interface ModuleOptions {\n /**\n * prefix for components used in templates\n *\n * @default \"U\"\n */\n prefix?: string\n}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: packageName,\n configKey: 'ui',\n compatibility: {\n nuxt: '>=3.13.1',\n },\n },\n defaults: {\n prefix: 'U',\n },\n setup(options, nuxt) {\n const logger = useLogger(packageName)\n const { resolve } = createResolver(import.meta.url)\n\n // Make sure the UnoCSS Nuxt module is installed\n if (!nuxt.options.modules.includes('@unocss/nuxt')) {\n logger.error(`\\`${packageName}\\` requires the \\`@unocss/nuxt\\` module to be installed.`)\n return\n }\n\n nuxt.options.vite.optimizeDeps ??= {}\n nuxt.options.vite.optimizeDeps.include ??= []\n nuxt.options.vite.optimizeDeps.include.push(`${packageName}/unocss`)\n\n nuxt.options.alias['#ui'] = resolve('./runtime')\n\n addComponentsDir({\n path: resolve('./runtime/components'),\n prefix: options.prefix,\n pathPrefix: false,\n })\n\n addImportsDir(resolve('./runtime/composables'))\n },\n})\n"],"names":[],"mappings":";;;AAYA,eAAe,gBAAgC,CAAA;AAAA,EAC7C,IAAM,EAAA;AAAA,IACJ,IAAM,
|
|
1
|
+
{"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import { addComponentsDir, addImportsDir, createResolver, defineNuxtModule, useLogger } from '@nuxt/kit'\nimport { packageName } from './shared'\n\nexport interface ModuleOptions {\n /**\n * prefix for components used in templates\n *\n * @default \"U\"\n */\n prefix?: string\n}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: packageName,\n configKey: 'ui',\n compatibility: {\n nuxt: '>=3.13.1',\n },\n },\n defaults: {\n prefix: 'U',\n },\n setup(options, nuxt) {\n const logger = useLogger(packageName)\n const { resolve } = createResolver(import.meta.url)\n\n // Make sure the UnoCSS Nuxt module is installed\n if (!nuxt.options.modules.includes('@unocss/nuxt')) {\n logger.error(`\\`${packageName}\\` requires the \\`@unocss/nuxt\\` module to be installed.`)\n return\n }\n\n nuxt.options.vite.optimizeDeps ??= {}\n nuxt.options.vite.optimizeDeps.include ??= []\n nuxt.options.vite.optimizeDeps.include.push(`${packageName}/unocss`)\n\n nuxt.options.alias['#ui'] = resolve('./runtime')\n\n addComponentsDir({\n path: resolve('./runtime/components'),\n prefix: options.prefix,\n pathPrefix: false,\n })\n\n addImportsDir(resolve('./runtime/composables'))\n },\n})\n"],"names":["packageName"],"mappings":";;;AAYA,eAAe,gBAAgC,CAAA;AAAA,EAC7C,IAAM,EAAA;AAAA,IACJ,IAAM,EAAAA,IAAA;AAAA,IACN,SAAW,EAAA,IAAA;AAAA,IACX,aAAe,EAAA;AAAA,MACb,IAAM,EAAA,UAAA;AAAA,KACR;AAAA,GACF;AAAA,EACA,QAAU,EAAA;AAAA,IACR,MAAQ,EAAA,GAAA;AAAA,GACV;AAAA,EACA,KAAA,CAAM,SAAS,IAAM,EAAA;AACnB,IAAM,MAAA,MAAA,GAAS,UAAUA,IAAW,CAAA,CAAA;AACpC,IAAA,MAAM,EAAE,OAAA,EAAY,GAAA,cAAA,CAAe,YAAY,GAAG,CAAA,CAAA;AAGlD,IAAA,IAAI,CAAC,IAAK,CAAA,OAAA,CAAQ,OAAQ,CAAA,QAAA,CAAS,cAAc,CAAG,EAAA;AAClD,MAAO,MAAA,CAAA,KAAA,CAAM,CAAK,EAAA,EAAAA,IAAW,CAA0D,wDAAA,CAAA,CAAA,CAAA;AACvF,MAAA,OAAA;AAAA,KACF;AAEA,IAAK,IAAA,CAAA,OAAA,CAAQ,IAAK,CAAA,YAAA,KAAiB,EAAC,CAAA;AACpC,IAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAK,YAAa,CAAA,OAAA,KAAY,EAAC,CAAA;AAC5C,IAAA,IAAA,CAAK,QAAQ,IAAK,CAAA,YAAA,CAAa,QAAQ,IAAK,CAAA,CAAA,EAAGA,IAAW,CAAS,OAAA,CAAA,CAAA,CAAA;AAEnE,IAAA,IAAA,CAAK,OAAQ,CAAA,KAAA,CAAM,KAAK,CAAA,GAAI,QAAQ,WAAW,CAAA,CAAA;AAE/C,IAAiB,gBAAA,CAAA;AAAA,MACf,IAAA,EAAM,QAAQ,sBAAsB,CAAA;AAAA,MACpC,QAAQ,OAAQ,CAAA,MAAA;AAAA,MAChB,UAAY,EAAA,KAAA;AAAA,KACb,CAAA,CAAA;AAED,IAAc,aAAA,CAAA,OAAA,CAAQ,uBAAuB,CAAC,CAAA,CAAA;AAAA,GAChD;AACF,CAAC,CAAA;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { UserConfig } from '@unocss/core';
|
|
2
|
+
import type { Component, ComputedRef, MaybeRefOrGetter, ShallowRef } from 'vue';
|
|
3
|
+
import type { AvatarGroupProps, ButtonGroupProps, Messages, ModalProps } from '../types/index.js';
|
|
4
|
+
import type { Locale } from '../utils/index.js';
|
|
5
|
+
export type AvatarGroupProvideValue = Pick<AvatarGroupProps, 'size'>;
|
|
6
|
+
export declare const InjectionKeyAvatarGroup: import("vue").InjectionKey<ComputedRef<AvatarGroupProvideValue>>, injectAvatarGroup: () => ComputedRef<AvatarGroupProvideValue> | undefined, provideAvatarGroup: (value: ComputedRef<AvatarGroupProvideValue>) => void;
|
|
7
|
+
export type ButtonGroupProvideValue = Pick<ButtonGroupProps, 'size' | 'orientation'>;
|
|
8
|
+
export declare const InjectionKeyButtonGroup: import("vue").InjectionKey<ComputedRef<ButtonGroupProvideValue>>, injectButtonGroup: () => ComputedRef<ButtonGroupProvideValue> | undefined, provideButtonGroup: (value: ComputedRef<ButtonGroupProvideValue>) => void;
|
|
9
|
+
export declare const InjectionKeyLocaleContext: import("vue").InjectionKey<MaybeRefOrGetter<Locale<Messages> | undefined>>, injectLocaleContext: () => MaybeRefOrGetter<Locale<Messages> | undefined>, provideLocaleContext: (value: MaybeRefOrGetter<Locale<Messages> | undefined>) => void;
|
|
10
|
+
export interface ModalStateProvideValue {
|
|
11
|
+
component: Component | string;
|
|
12
|
+
props: ModalProps;
|
|
13
|
+
}
|
|
14
|
+
export declare const InjectionKeyModalState: import("vue").InjectionKey<ShallowRef<ModalStateProvideValue>>, injectModalState: () => ShallowRef<ModalStateProvideValue> | undefined, provideModalState: (value: ShallowRef<ModalStateProvideValue>) => void;
|
|
15
|
+
export declare const InjectionKeyThemeExtension: import("vue").InjectionKey<MaybeRefOrGetter<import("..").PartialTheme<typeof import("../theme")>>>, provideThemeExtension: (value: MaybeRefOrGetter<import("..").PartialTheme<typeof import("../theme")>>) => void, injectThemeExtension: () => MaybeRefOrGetter<import("..").PartialTheme<typeof import("../theme")>>;
|
|
16
|
+
export declare const InjectionKeyUnoConfig: import("vue").InjectionKey<MaybeRefOrGetter<UserConfig<object>>>, provideUnoConfig: (value: MaybeRefOrGetter<UserConfig<object>>) => void, injectUnoConfig: () => MaybeRefOrGetter<UserConfig<object>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineInjection } from "../utils/index.js";
|
|
2
|
+
export const {
|
|
3
|
+
InjectionKey: InjectionKeyAvatarGroup,
|
|
4
|
+
inject: injectAvatarGroup,
|
|
5
|
+
provide: provideAvatarGroup
|
|
6
|
+
} = defineInjection("ui.avatar-group");
|
|
7
|
+
export const {
|
|
8
|
+
InjectionKey: InjectionKeyButtonGroup,
|
|
9
|
+
inject: injectButtonGroup,
|
|
10
|
+
provide: provideButtonGroup
|
|
11
|
+
} = defineInjection("ui.button-group");
|
|
12
|
+
export const {
|
|
13
|
+
InjectionKey: InjectionKeyLocaleContext,
|
|
14
|
+
inject: injectLocaleContext,
|
|
15
|
+
provide: provideLocaleContext
|
|
16
|
+
} = defineInjection("ui.locale-context");
|
|
17
|
+
export const {
|
|
18
|
+
InjectionKey: InjectionKeyModalState,
|
|
19
|
+
inject: injectModalState,
|
|
20
|
+
provide: provideModalState
|
|
21
|
+
} = defineInjection("ui.modal");
|
|
22
|
+
export const {
|
|
23
|
+
InjectionKey: InjectionKeyThemeExtension,
|
|
24
|
+
provide: provideThemeExtension,
|
|
25
|
+
inject: injectThemeExtension
|
|
26
|
+
} = defineInjection("ui.theme-extension", {});
|
|
27
|
+
export const {
|
|
28
|
+
InjectionKey: InjectionKeyUnoConfig,
|
|
29
|
+
provide: provideUnoConfig,
|
|
30
|
+
inject: injectUnoConfig
|
|
31
|
+
} = defineInjection("ui.uno-config", {});
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui'
|
|
3
3
|
import type { accordion } from '../theme'
|
|
4
|
-
import type { ComponentAttrs } from '../types'
|
|
4
|
+
import type { ComponentAttrs, DynamicSlots } from '../types'
|
|
5
|
+
|
|
6
|
+
export interface AccordionEmits extends AccordionRootEmits {}
|
|
7
|
+
|
|
8
|
+
type SlotProps<T> = (props: { item: T, index: number, open: boolean }) => any
|
|
9
|
+
|
|
10
|
+
export type AccordionSlots<T extends { slot?: string }> = {
|
|
11
|
+
default?: SlotProps<T>
|
|
12
|
+
leading?: SlotProps<T>
|
|
13
|
+
trailing?: SlotProps<T>
|
|
14
|
+
content?: SlotProps<T>
|
|
15
|
+
body?: SlotProps<T>
|
|
16
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
5
17
|
|
|
6
18
|
export interface AccordionItem {
|
|
7
19
|
label?: string
|
|
8
20
|
icon?: string
|
|
9
|
-
|
|
21
|
+
trailingIcon?: string
|
|
10
22
|
slot?: string
|
|
11
23
|
content?: string
|
|
12
24
|
/** A unique value for the accordion item. Defaults to the index. */
|
|
@@ -14,25 +26,13 @@ export interface AccordionItem {
|
|
|
14
26
|
disabled?: boolean
|
|
15
27
|
}
|
|
16
28
|
|
|
17
|
-
export interface AccordionEmits extends AccordionRootEmits {}
|
|
18
|
-
|
|
19
|
-
type SlotProps<T> = (props: { item: T, index: number, open: boolean }) => any
|
|
20
|
-
|
|
21
|
-
export type AccordionSlots<T extends { slot?: string }> = {
|
|
22
|
-
default?: SlotProps<T>
|
|
23
|
-
prefix?: SlotProps<T>
|
|
24
|
-
suffix?: SlotProps<T>
|
|
25
|
-
content?: SlotProps<T>
|
|
26
|
-
body?: SlotProps<T>
|
|
27
|
-
} & Record<string, SlotProps<T>>
|
|
28
|
-
|
|
29
29
|
export interface AccordionProps<T> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
|
|
30
30
|
items?: T[]
|
|
31
31
|
/**
|
|
32
32
|
* The icon displayed on the right side of the trigger.
|
|
33
|
-
* @default app.icons.
|
|
33
|
+
* @default app.icons.chevronDown
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
trailingIcon?: string
|
|
36
36
|
labelKey?: string
|
|
37
37
|
}
|
|
38
38
|
</script>
|
|
@@ -74,16 +74,16 @@ const style = computed(() => {
|
|
|
74
74
|
>
|
|
75
75
|
<AccordionHeader :class="style.header({ class: props.ui?.header })">
|
|
76
76
|
<AccordionTrigger :class="style.trigger({ class: props.ui?.trigger, disabled: item.disabled })">
|
|
77
|
-
<slot name="
|
|
78
|
-
<span v-if="item.icon" :class="style.
|
|
77
|
+
<slot name="leading" v-bind="{ item, index, open }">
|
|
78
|
+
<span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })"></span>
|
|
79
79
|
</slot>
|
|
80
80
|
|
|
81
81
|
<span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })">
|
|
82
82
|
<slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
|
|
83
83
|
</span>
|
|
84
84
|
|
|
85
|
-
<slot name="
|
|
86
|
-
<span :class="style.
|
|
85
|
+
<slot name="trailing" v-bind="{ item, index, open }">
|
|
86
|
+
<span :class="style.trailingIcon({ class: [item.trailingIcon || props.trailingIcon || theme.app.icons.chevronDown, props.ui?.trailingIcon] })"></span>
|
|
87
87
|
</slot>
|
|
88
88
|
</AccordionTrigger>
|
|
89
89
|
</AccordionHeader>
|
|
@@ -4,9 +4,26 @@ import type { PrimitiveProps } from 'reka-ui'
|
|
|
4
4
|
import type { alert } from '../theme'
|
|
5
5
|
import type { ButtonProps, ComponentAttrs } from '../types'
|
|
6
6
|
|
|
7
|
+
export interface AlertEmits {
|
|
8
|
+
(event: 'update:open', value: boolean): void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AlertSlots {
|
|
12
|
+
leading?: (props?: {}) => any
|
|
13
|
+
title?: (props?: {}) => any
|
|
14
|
+
description?: (props?: {}) => any
|
|
15
|
+
actions?: (props?: {}) => any
|
|
16
|
+
close?: (props: { ui: ComponentAttrs<typeof alert>['ui'] }) => any
|
|
17
|
+
}
|
|
18
|
+
|
|
7
19
|
type AlertVariants = VariantProps<typeof alert>
|
|
8
20
|
|
|
9
|
-
export interface AlertProps extends ComponentAttrs<typeof alert
|
|
21
|
+
export interface AlertProps extends ComponentAttrs<typeof alert> {
|
|
22
|
+
/**
|
|
23
|
+
* The element or component this component should render as.
|
|
24
|
+
* @default "div"
|
|
25
|
+
*/
|
|
26
|
+
as?: PrimitiveProps['as']
|
|
10
27
|
title?: string
|
|
11
28
|
description?: string
|
|
12
29
|
icon?: string
|
|
@@ -29,23 +46,12 @@ export interface AlertProps extends ComponentAttrs<typeof alert>, Pick<Primitive
|
|
|
29
46
|
*/
|
|
30
47
|
closeIcon?: string
|
|
31
48
|
}
|
|
32
|
-
|
|
33
|
-
export interface AlertEmits {
|
|
34
|
-
(event: 'update:open', value: boolean): void
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface AlertSlots {
|
|
38
|
-
prepend?: (props?: {}) => any
|
|
39
|
-
title?: (props?: {}) => any
|
|
40
|
-
description?: (props?: {}) => any
|
|
41
|
-
actions?: (props?: {}) => any
|
|
42
|
-
close?: (props: { ui: ComponentAttrs<typeof alert>['ui'] }) => any
|
|
43
|
-
}
|
|
44
49
|
</script>
|
|
45
50
|
|
|
46
51
|
<script setup lang="ts">
|
|
47
52
|
import { Primitive } from 'reka-ui'
|
|
48
53
|
import { computed } from 'vue'
|
|
54
|
+
import { useLocale } from '../composables/useLocale'
|
|
49
55
|
import { useTheme } from '../composables/useTheme'
|
|
50
56
|
import Button from './Button.vue'
|
|
51
57
|
|
|
@@ -57,6 +63,7 @@ const props = withDefaults(defineProps<AlertProps>(), {
|
|
|
57
63
|
const emit = defineEmits<AlertEmits>()
|
|
58
64
|
const slots = defineSlots<AlertSlots>()
|
|
59
65
|
|
|
66
|
+
const { t } = useLocale()
|
|
60
67
|
const { theme, createStyler } = useTheme()
|
|
61
68
|
const style = computed(() => {
|
|
62
69
|
const styler = createStyler(theme.value.alert)
|
|
@@ -73,7 +80,7 @@ const style = computed(() => {
|
|
|
73
80
|
:data-orientation="props.orientation"
|
|
74
81
|
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
75
82
|
>
|
|
76
|
-
<slot name="
|
|
83
|
+
<slot name="leading">
|
|
77
84
|
<span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
|
|
78
85
|
</slot>
|
|
79
86
|
|
|
@@ -109,7 +116,7 @@ const style = computed(() => {
|
|
|
109
116
|
:icon="props.closeIcon || theme.app.icons.close"
|
|
110
117
|
size="md"
|
|
111
118
|
variant="link"
|
|
112
|
-
aria-label="
|
|
119
|
+
:aria-label="t('alert.close')"
|
|
113
120
|
v-bind="typeof props.close === 'object' ? props.close : undefined"
|
|
114
121
|
:class="style.close({ class: props.ui?.close })"
|
|
115
122
|
@click="emit('update:open', false)"
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { UserConfig } from '@unocss/core'
|
|
3
3
|
import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui'
|
|
4
|
-
import type { ThemeExtension, ToasterProps } from '../types'
|
|
4
|
+
import type { Messages, ThemeExtension, ToasterProps } from '../types'
|
|
5
|
+
import type { Locale } from '../utils'
|
|
6
|
+
|
|
7
|
+
export interface AppSlots {
|
|
8
|
+
default: (props?: {}) => any
|
|
9
|
+
}
|
|
5
10
|
|
|
6
11
|
export interface AppProps extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
|
|
7
12
|
unoConfig?: UserConfig
|
|
8
13
|
ui?: ThemeExtension
|
|
9
|
-
tooltip?: TooltipProviderProps
|
|
10
14
|
toaster?: ToasterProps
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export interface AppSlots {
|
|
14
|
-
default: (props?: Record<string, unknown>) => any
|
|
15
|
+
tooltip?: TooltipProviderProps
|
|
16
|
+
locale?: Locale<Messages>
|
|
15
17
|
}
|
|
16
18
|
</script>
|
|
17
19
|
|
|
18
20
|
<script setup lang="ts">
|
|
19
21
|
import { reactivePick } from '@vueuse/core'
|
|
20
22
|
import { ConfigProvider, TooltipProvider, useForwardProps } from 'reka-ui'
|
|
21
|
-
import {
|
|
22
|
-
import type {
|
|
23
|
-
import { provideModalState } from '../
|
|
24
|
-
import { provideThemeExtension, provideUnoConfig } from '../composables/useTheme'
|
|
23
|
+
import { shallowRef, toRef, useId } from 'vue'
|
|
24
|
+
import type { ModalStateProvideValue } from '../app/injections'
|
|
25
|
+
import { provideLocaleContext, provideModalState, provideThemeExtension, provideUnoConfig } from '../app/injections'
|
|
25
26
|
import ModalProvider from './ModalProvider.vue'
|
|
26
27
|
import Toaster from './Toaster.vue'
|
|
27
28
|
|
|
@@ -36,16 +37,15 @@ const configProviderProps = useForwardProps(reactivePick(props, 'scrollBody'))
|
|
|
36
37
|
const tooltipProps = toRef(() => props.tooltip)
|
|
37
38
|
const toasterProps = toRef(() => props.toaster)
|
|
38
39
|
|
|
39
|
-
const modalState = shallowRef<
|
|
40
|
+
const modalState = shallowRef<ModalStateProvideValue>({
|
|
40
41
|
component: 'div',
|
|
41
42
|
props: {},
|
|
42
43
|
})
|
|
43
44
|
|
|
44
|
-
const themeExtension = computed(() => props.ui)
|
|
45
|
-
|
|
46
45
|
provideModalState(modalState)
|
|
47
|
-
provideUnoConfig(props.unoConfig)
|
|
48
|
-
provideThemeExtension(
|
|
46
|
+
provideUnoConfig(() => props.unoConfig)
|
|
47
|
+
provideThemeExtension(() => props.ui)
|
|
48
|
+
provideLocaleContext(() => props.locale)
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<template>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
+
import type { AvatarRootProps } from 'reka-ui'
|
|
4
|
+
import type { avatar } from '../theme'
|
|
5
|
+
import type { ComponentAttrs } from '../types'
|
|
6
|
+
|
|
7
|
+
export interface AvatarSlots {
|
|
8
|
+
default?: (props?: {}) => any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type AvatarVariants = VariantProps<typeof avatar>
|
|
12
|
+
|
|
13
|
+
export interface AvatarProps extends ComponentAttrs<typeof avatar> {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @default "span"
|
|
17
|
+
*/
|
|
18
|
+
as?: AvatarRootProps['as']
|
|
19
|
+
src?: string
|
|
20
|
+
alt?: string
|
|
21
|
+
icon?: string
|
|
22
|
+
text?: string
|
|
23
|
+
size?: AvatarVariants['size']
|
|
24
|
+
style?: string | HTMLElement['style']
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { AvatarFallback, AvatarImage, AvatarRoot } from 'reka-ui'
|
|
30
|
+
import { computed, shallowRef, watch } from 'vue'
|
|
31
|
+
import { useAvatarGroup } from '../composables/useAvatarGroup'
|
|
32
|
+
import { useTheme } from '../composables/useTheme'
|
|
33
|
+
|
|
34
|
+
defineOptions({ inheritAttrs: false })
|
|
35
|
+
|
|
36
|
+
const props = withDefaults(defineProps<AvatarProps>(), {
|
|
37
|
+
src: '',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const { size } = useAvatarGroup(props)
|
|
41
|
+
const fallback = computed(() => props.text || (props.alt || '').split(' ').map((word) => word.charAt(0)).join('').slice(0, 2))
|
|
42
|
+
|
|
43
|
+
const { theme, createStyler } = useTheme()
|
|
44
|
+
const style = computed(() => {
|
|
45
|
+
const styler = createStyler(theme.value.avatar)
|
|
46
|
+
return styler({
|
|
47
|
+
...props,
|
|
48
|
+
size: size.value,
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const error = shallowRef(false)
|
|
53
|
+
|
|
54
|
+
watch(() => props.src, () => {
|
|
55
|
+
if (error.value)
|
|
56
|
+
error.value = false
|
|
57
|
+
})
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<AvatarRoot :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })" :style="props.style">
|
|
62
|
+
<AvatarImage
|
|
63
|
+
:src="props.src"
|
|
64
|
+
:alt="props.alt"
|
|
65
|
+
:class="style.image({ class: props.ui?.image })"
|
|
66
|
+
/>
|
|
67
|
+
|
|
68
|
+
<AvatarFallback as-child>
|
|
69
|
+
<span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
|
|
70
|
+
<span v-else :class="style.fallback({ class: props.ui?.fallback })">{{ fallback || ' ' }}</span>
|
|
71
|
+
</AvatarFallback>
|
|
72
|
+
</AvatarRoot>
|
|
73
|
+
</template>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
4
|
+
import type { avatarGroup } from '../theme'
|
|
5
|
+
import type { ComponentAttrs } from '../types'
|
|
6
|
+
|
|
7
|
+
export interface AvatarGroupSlots {
|
|
8
|
+
default?: (props?: {}) => any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type AvatarGroupVariants = VariantProps<typeof avatarGroup>
|
|
12
|
+
|
|
13
|
+
export interface AvatarGroupProps extends ComponentAttrs<typeof avatarGroup> {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @default "div"
|
|
17
|
+
*/
|
|
18
|
+
as?: PrimitiveProps['as']
|
|
19
|
+
size?: AvatarGroupVariants['size']
|
|
20
|
+
/**
|
|
21
|
+
* The maximum number of avatars to display.
|
|
22
|
+
*/
|
|
23
|
+
max?: number | string
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import { Primitive } from 'reka-ui'
|
|
29
|
+
import { computed } from 'vue'
|
|
30
|
+
import { provideAvatarGroup } from '../app/injections'
|
|
31
|
+
import { useTheme } from '../composables/useTheme'
|
|
32
|
+
import Avatar from './Avatar.vue'
|
|
33
|
+
|
|
34
|
+
const props = defineProps<AvatarGroupProps>()
|
|
35
|
+
const slots = defineSlots<AvatarGroupSlots>()
|
|
36
|
+
|
|
37
|
+
const max = computed(() => typeof props.max === 'string' ? Number.parseInt(props.max, 10) : props.max)
|
|
38
|
+
|
|
39
|
+
const children = computed(() => {
|
|
40
|
+
let nodes = slots.default?.()
|
|
41
|
+
|
|
42
|
+
if (Array.isArray(nodes) && nodes?.length) {
|
|
43
|
+
nodes = nodes.flatMap((child) => {
|
|
44
|
+
if (typeof child.type === 'symbol') {
|
|
45
|
+
// `v-if="false"` or commented node
|
|
46
|
+
if (typeof child.children === 'string')
|
|
47
|
+
return null
|
|
48
|
+
|
|
49
|
+
return child.children
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return child
|
|
53
|
+
}).filter(Boolean)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return nodes || []
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const visibleAvatars = computed(() => {
|
|
60
|
+
if (children.value.length === 0)
|
|
61
|
+
return []
|
|
62
|
+
|
|
63
|
+
if (!max.value || max.value <= 0)
|
|
64
|
+
return [...children.value].reverse()
|
|
65
|
+
|
|
66
|
+
return [...children.value].slice(0, max.value).reverse()
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const hiddenCount = computed(() => {
|
|
70
|
+
if (children.value.length === 0)
|
|
71
|
+
return 0
|
|
72
|
+
|
|
73
|
+
return children.value.length - visibleAvatars.value.length
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const { theme, createStyler } = useTheme()
|
|
77
|
+
const style = computed(() => {
|
|
78
|
+
const styler = createStyler(theme.value.avatarGroup)
|
|
79
|
+
return styler(props)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
provideAvatarGroup(computed(() => props))
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<template>
|
|
86
|
+
<Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
|
|
87
|
+
<Avatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="style.base({ class: props.ui?.base })" />
|
|
88
|
+
<component :is="avatar" v-for="(avatar, index) in visibleAvatars" :key="index" :class="style.base({ class: props.ui?.base })" />
|
|
89
|
+
</Primitive>
|
|
90
|
+
</template>
|
|
@@ -4,9 +4,23 @@ import type { PrimitiveProps } from 'reka-ui'
|
|
|
4
4
|
import type { badge } from '../theme'
|
|
5
5
|
import type { ComponentAttrs } from '../types'
|
|
6
6
|
|
|
7
|
+
export interface BadgeEmits {
|
|
8
|
+
(e: 'update:show', payload: boolean): void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface BadgeSlots {
|
|
12
|
+
default?: (props?: {}) => any
|
|
13
|
+
content?: (props?: {}) => any
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
type BadgeVariants = VariantProps<typeof badge>
|
|
8
17
|
|
|
9
|
-
export interface BadgeProps extends ComponentAttrs<typeof badge
|
|
18
|
+
export interface BadgeProps extends ComponentAttrs<typeof badge> {
|
|
19
|
+
/**
|
|
20
|
+
* The element or component this component should render as.
|
|
21
|
+
* @default "div"
|
|
22
|
+
*/
|
|
23
|
+
as?: PrimitiveProps['as']
|
|
10
24
|
text?: string | number
|
|
11
25
|
size?: BadgeVariants['size']
|
|
12
26
|
position?: BadgeVariants['position']
|
|
@@ -16,15 +30,6 @@ export interface BadgeProps extends ComponentAttrs<typeof badge>, Pick<Primitive
|
|
|
16
30
|
/** When `true`, render the badge relatively to the parent. */
|
|
17
31
|
standalone?: boolean
|
|
18
32
|
}
|
|
19
|
-
|
|
20
|
-
export interface BadgeEmits {
|
|
21
|
-
(e: 'update:show', payload: boolean): void
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface BadgeSlots {
|
|
25
|
-
default?: (props?: {}) => any
|
|
26
|
-
content?: (props?: {}) => any
|
|
27
|
-
}
|
|
28
33
|
</script>
|
|
29
34
|
|
|
30
35
|
<script setup lang="ts">
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
3
|
+
import type { breadcrumb } from '../theme'
|
|
4
|
+
import type { ComponentAttrs, DynamicSlots, LinkProps } from '../types'
|
|
5
|
+
|
|
6
|
+
type SlotProps<T> = (props: { item: T, index: number, active?: boolean }) => any
|
|
7
|
+
|
|
8
|
+
export type BreadcrumbSlots<T extends { slot?: string }> = {
|
|
9
|
+
'item'?: SlotProps<T>
|
|
10
|
+
'item-leading'?: SlotProps<T>
|
|
11
|
+
'item-label'?: SlotProps<T>
|
|
12
|
+
'item-trailing'?: SlotProps<T>
|
|
13
|
+
'separator'?: (props?: {}) => any
|
|
14
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
15
|
+
|
|
16
|
+
export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
17
|
+
label?: string
|
|
18
|
+
icon?: string
|
|
19
|
+
slot?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface BreadcrumbProps<T> extends ComponentAttrs<typeof breadcrumb> {
|
|
23
|
+
/**
|
|
24
|
+
* The element or component this component should render as.
|
|
25
|
+
* @default "nav"
|
|
26
|
+
*/
|
|
27
|
+
as?: PrimitiveProps['as']
|
|
28
|
+
dir?: 'rtl' | 'ltr'
|
|
29
|
+
items?: T[]
|
|
30
|
+
/**
|
|
31
|
+
* The icon to use as a separator.
|
|
32
|
+
* @default app.icons.chevronRight
|
|
33
|
+
*/
|
|
34
|
+
separatorIcon?: string
|
|
35
|
+
/**
|
|
36
|
+
* The key used to get the label from the item.
|
|
37
|
+
* @default "label"
|
|
38
|
+
*/
|
|
39
|
+
labelKey?: string
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts" generic="T extends BreadcrumbItem">
|
|
44
|
+
import { Primitive } from 'reka-ui'
|
|
45
|
+
import { computed } from 'vue'
|
|
46
|
+
import { useTheme } from '../composables/useTheme'
|
|
47
|
+
import { get, pickLinkProps } from '../utils'
|
|
48
|
+
import Link from './Link.vue'
|
|
49
|
+
import LinkBase from './LinkBase.vue'
|
|
50
|
+
|
|
51
|
+
const props = withDefaults(defineProps<BreadcrumbProps<T>>(), {
|
|
52
|
+
as: 'nav',
|
|
53
|
+
labelKey: 'label',
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const slots = defineSlots<BreadcrumbSlots<T>>()
|
|
57
|
+
|
|
58
|
+
const { theme, createStyler } = useTheme()
|
|
59
|
+
|
|
60
|
+
const separatorIcon = computed(() => props.separatorIcon || (props.dir === 'rtl' ? theme.value.app.icons.chevronLeft : theme.value.app.icons.chevronRight))
|
|
61
|
+
|
|
62
|
+
const style = computed(() => {
|
|
63
|
+
const styler = createStyler(theme.value.breadcrumb)
|
|
64
|
+
return styler(props)
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<Primitive :as="props.as" aria-label="breadcrumb" :class="style.root({ class: [props.class, props.ui?.root] })">
|
|
70
|
+
<ol :class="style.list({ class: props.ui?.list })">
|
|
71
|
+
<template v-for="(item, index) in props.items" :key="index">
|
|
72
|
+
<li :class="style.item({ class: props.ui?.item })">
|
|
73
|
+
<Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
74
|
+
<LinkBase
|
|
75
|
+
v-bind="slotProps"
|
|
76
|
+
as="span"
|
|
77
|
+
:aria-current="active && (index === items!.length - 1) ? 'page' : undefined"
|
|
78
|
+
:class="style.link({ class: props.ui?.link, active: index === items!.length - 1, disabled: item.disabled, to: !!item.to })"
|
|
79
|
+
>
|
|
80
|
+
<slot :name="item.slot || 'item'" :item="item" :index="index">
|
|
81
|
+
<slot :name="`${item.slot || 'item'}-leading`" :item="item" :active="index === items!.length - 1" :index="index">
|
|
82
|
+
<span v-if="item.icon" :class="style.linkLeadingIcon({ class: [item.icon, props.ui?.linkLeadingIcon] })"></span>
|
|
83
|
+
</slot>
|
|
84
|
+
|
|
85
|
+
<span v-if="get(item, props.labelKey) || slots[`${item.slot || 'item'}-label`]" :class="style.linkLabel({ class: props.ui?.linkLabel })">
|
|
86
|
+
<slot :name="`${item.slot || 'item'}-label`" :item="item" :active="index === items!.length - 1" :index="index">
|
|
87
|
+
{{ get(item, props.labelKey) }}
|
|
88
|
+
</slot>
|
|
89
|
+
</span>
|
|
90
|
+
|
|
91
|
+
<slot :name="`${item.slot || 'item'}-trailing`" :item="item" :active="index === items!.length - 1" :index="index"></slot>
|
|
92
|
+
</slot>
|
|
93
|
+
</LinkBase>
|
|
94
|
+
</Link>
|
|
95
|
+
</li>
|
|
96
|
+
|
|
97
|
+
<li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="style.separator({ class: props.ui?.separator })">
|
|
98
|
+
<slot name="separator">
|
|
99
|
+
<span :class="style.separatorIcon({ class: [separatorIcon, props.ui?.separatorIcon] })"></span>
|
|
100
|
+
</slot>
|
|
101
|
+
</li>
|
|
102
|
+
</template>
|
|
103
|
+
</ol>
|
|
104
|
+
</Primitive>
|
|
105
|
+
</template>
|