@byyuurin/ui 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +8 -7
- package/dist/module.mjs.map +1 -1
- package/dist/runtime/app/injections.d.ts +11 -0
- package/dist/runtime/app/injections.js +26 -0
- package/dist/runtime/components/Accordion.vue +28 -26
- package/dist/runtime/components/Alert.vue +27 -23
- package/dist/runtime/components/App.vue +21 -26
- package/dist/runtime/components/Avatar.vue +70 -0
- package/dist/runtime/components/AvatarGroup.vue +87 -0
- package/dist/runtime/components/Badge.vue +17 -15
- package/dist/runtime/components/Breadcrumb.vue +108 -0
- package/dist/runtime/components/Button.vue +15 -16
- package/dist/runtime/components/ButtonGroup.vue +14 -15
- package/dist/runtime/components/Calendar.vue +176 -0
- package/dist/runtime/components/Card.vue +9 -7
- package/dist/runtime/components/Carousel.vue +22 -22
- package/dist/runtime/components/Checkbox.vue +15 -14
- package/dist/runtime/components/Chip.vue +23 -21
- package/dist/runtime/components/Collapsible.vue +5 -8
- package/dist/runtime/components/Drawer.vue +91 -49
- package/dist/runtime/components/Input.vue +33 -36
- package/dist/runtime/components/InputNumber.vue +9 -10
- package/dist/runtime/components/Kbd.vue +47 -0
- package/dist/runtime/components/Link.vue +15 -12
- package/dist/runtime/components/LinkBase.vue +1 -1
- package/dist/runtime/components/Modal.vue +31 -19
- package/dist/runtime/components/OverlayProvider.vue +29 -0
- package/dist/runtime/components/Pagination.vue +60 -53
- package/dist/runtime/components/PinInput.vue +9 -12
- package/dist/runtime/components/Popover.vue +9 -12
- package/dist/runtime/components/Progress.vue +162 -0
- package/dist/runtime/components/RadioGroup.vue +38 -35
- package/dist/runtime/components/ScrollArea.vue +2 -6
- package/dist/runtime/components/Select.vue +48 -51
- package/dist/runtime/components/Separator.vue +2 -6
- package/dist/runtime/components/Skeleton.vue +30 -0
- package/dist/runtime/components/Slider.vue +8 -11
- package/dist/runtime/components/Switch.vue +17 -17
- package/dist/runtime/components/Table.vue +21 -16
- package/dist/runtime/components/Tabs.vue +24 -23
- package/dist/runtime/components/Textarea.vue +13 -16
- package/dist/runtime/components/Toast.vue +21 -24
- package/dist/runtime/components/{Toaster.vue → ToastProvider.vue} +22 -20
- package/dist/runtime/components/Tooltip.vue +9 -12
- 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/useOverlay.d.ts +29 -0
- package/dist/runtime/composables/useOverlay.js +69 -0
- package/dist/runtime/composables/useTheme.d.ts +6 -6
- package/dist/runtime/composables/useTheme.js +11 -15
- package/dist/runtime/composables/useToast.d.ts +4 -20
- package/dist/runtime/composables/useToast.js +6 -5
- package/dist/runtime/index.d.ts +9 -2
- package/dist/runtime/index.js +9 -2
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +34 -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 +34 -0
- package/dist/runtime/theme/accordion.d.ts +6 -6
- package/dist/runtime/theme/accordion.js +5 -5
- package/dist/runtime/theme/alert.js +3 -3
- 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 +22 -22
- package/dist/runtime/theme/calendar.d.ts +56 -0
- package/dist/runtime/theme/calendar.js +69 -0
- package/dist/runtime/theme/card.js +6 -6
- package/dist/runtime/theme/carousel.js +1 -1
- package/dist/runtime/theme/checkbox.js +5 -5
- package/dist/runtime/theme/chip.d.ts +4 -4
- package/dist/runtime/theme/chip.js +5 -5
- package/dist/runtime/theme/drawer.d.ts +24 -21
- package/dist/runtime/theme/drawer.js +47 -20
- package/dist/runtime/theme/index.d.ts +8 -1
- package/dist/runtime/theme/index.js +8 -1
- package/dist/runtime/theme/input-number.d.ts +6 -0
- package/dist/runtime/theme/input-number.js +6 -3
- package/dist/runtime/theme/input.d.ts +12 -12
- package/dist/runtime/theme/input.js +26 -26
- package/dist/runtime/theme/kbd.d.ts +39 -0
- package/dist/runtime/theme/kbd.js +26 -0
- package/dist/runtime/theme/link.d.ts +1 -1
- package/dist/runtime/theme/link.js +3 -3
- package/dist/runtime/theme/modal.js +5 -5
- package/dist/runtime/theme/pagination.d.ts +27 -3
- package/dist/runtime/theme/pagination.js +6 -2
- package/dist/runtime/theme/pinInput.js +13 -13
- 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/radio-group.d.ts +2 -2
- package/dist/runtime/theme/radio-group.js +7 -7
- package/dist/runtime/theme/select.d.ts +18 -18
- package/dist/runtime/theme/select.js +34 -34
- package/dist/runtime/theme/separator.js +1 -1
- package/dist/runtime/theme/skeleton.d.ts +8 -0
- package/dist/runtime/theme/skeleton.js +7 -0
- package/dist/runtime/theme/slider.js +1 -1
- package/dist/runtime/theme/switch.js +6 -6
- package/dist/runtime/theme/table.js +7 -7
- package/dist/runtime/theme/tabs.d.ts +2 -2
- package/dist/runtime/theme/tabs.js +11 -11
- package/dist/runtime/theme/textarea.js +13 -13
- package/dist/runtime/theme/toast.js +6 -6
- package/dist/runtime/theme/tooltip.js +1 -1
- package/dist/runtime/types/components.d.ts +9 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +29 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/utils.d.ts +5 -3
- 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.1a1f119c.mjs +5 -0
- package/dist/shared/ui.1a1f119c.mjs.map +1 -0
- package/dist/unocss.mjs +19 -14
- package/dist/unocss.mjs.map +1 -1
- package/dist/unplugin.mjs +3 -12
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +30 -19
- package/dist/runtime/components/ModalProvider.vue +0 -10
- package/dist/runtime/composables/useModal.d.ts +0 -15
- package/dist/runtime/composables/useModal.js +0 -52
- package/dist/shared/ui.d1728164.mjs +0 -4
- package/dist/shared/ui.d1728164.mjs.map +0 -1
- /package/dist/runtime/theme/{toaster.d.ts → toast-provider.d.ts} +0 -0
- /package/dist/runtime/theme/{toaster.js → toast-provider.js} +0 -0
- /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,10 @@
|
|
|
1
|
-
import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
-
import {
|
|
1
|
+
import { defineNuxtModule, useLogger, createResolver, hasNuxtModule, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
+
import { n as name, v as version } from './shared/ui.1a1f119c.mjs';
|
|
3
3
|
|
|
4
4
|
const module = defineNuxtModule({
|
|
5
5
|
meta: {
|
|
6
|
-
name:
|
|
6
|
+
name: name,
|
|
7
|
+
version: version,
|
|
7
8
|
configKey: "ui",
|
|
8
9
|
compatibility: {
|
|
9
10
|
nuxt: ">=3.13.1"
|
|
@@ -13,15 +14,15 @@ const module = defineNuxtModule({
|
|
|
13
14
|
prefix: "U"
|
|
14
15
|
},
|
|
15
16
|
setup(options, nuxt) {
|
|
16
|
-
const logger = useLogger(
|
|
17
|
+
const logger = useLogger(name);
|
|
17
18
|
const { resolve } = createResolver(import.meta.url);
|
|
18
|
-
if (!
|
|
19
|
-
logger.error(`\`${
|
|
19
|
+
if (!hasNuxtModule("@unocss/nuxt")) {
|
|
20
|
+
logger.error(`\`${name}\` requires the \`@unocss/nuxt\` module to be installed.`);
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
23
|
nuxt.options.vite.optimizeDeps ??= {};
|
|
23
24
|
nuxt.options.vite.optimizeDeps.include ??= [];
|
|
24
|
-
nuxt.options.vite.optimizeDeps.include.push(`${
|
|
25
|
+
nuxt.options.vite.optimizeDeps.include.push(`${name}/unocss`);
|
|
25
26
|
nuxt.options.alias["#ui"] = resolve("./runtime");
|
|
26
27
|
addComponentsDir({
|
|
27
28
|
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 (!
|
|
1
|
+
{"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import { addComponentsDir, addImportsDir, createResolver, defineNuxtModule, hasNuxtModule, useLogger } from '@nuxt/kit'\nimport { packageName, packageVersion } 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 version: packageVersion,\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 (!hasNuxtModule('@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","packageVersion"],"mappings":";;;AAYA,eAAe,gBAAgC,CAAA;AAAA,EAC7C,IAAM,EAAA;AAAA,IACJ,IAAM,EAAAA,IAAA;AAAA,IACN,OAAS,EAAAC,OAAA;AAAA,IACT,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,UAAUD,IAAW,CAAA,CAAA;AACpC,IAAA,MAAM,EAAE,OAAA,EAAY,GAAA,cAAA,CAAe,YAAY,GAAG,CAAA,CAAA;AAGlD,IAAI,IAAA,CAAC,aAAc,CAAA,cAAc,CAAG,EAAA;AAClC,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,11 @@
|
|
|
1
|
+
import type { UserConfig } from '@unocss/core';
|
|
2
|
+
import type { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import type { AvatarGroupProps, ButtonGroupProps, Messages } 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 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")>>;
|
|
11
|
+
export declare const InjectionKeyUnoConfig: import("vue").InjectionKey<MaybeRefOrGetter<UserConfig<object>>>, provideUnoConfig: (value: MaybeRefOrGetter<UserConfig<object>>) => void, injectUnoConfig: () => MaybeRefOrGetter<UserConfig<object>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
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: InjectionKeyThemeExtension,
|
|
19
|
+
provide: provideThemeExtension,
|
|
20
|
+
inject: injectThemeExtension
|
|
21
|
+
} = defineInjection("ui.theme-extension", {});
|
|
22
|
+
export const {
|
|
23
|
+
InjectionKey: InjectionKeyUnoConfig,
|
|
24
|
+
provide: provideUnoConfig,
|
|
25
|
+
inject: injectUnoConfig
|
|
26
|
+
} = defineInjection("ui.uno-config", {});
|
|
@@ -3,10 +3,27 @@ import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui'
|
|
|
3
3
|
import type { accordion } from '../theme'
|
|
4
4
|
import type { ComponentAttrs } from '../types'
|
|
5
5
|
|
|
6
|
+
export interface AccordionEmits extends AccordionRootEmits {}
|
|
7
|
+
|
|
8
|
+
type SlotProps<T> = (props: { item: T, index: number, open: boolean }) => any
|
|
9
|
+
|
|
10
|
+
type DynamicSlots<T extends { slot?: string }, SlotProps, Slot = T['slot']> =
|
|
11
|
+
Slot extends string
|
|
12
|
+
? Record<Slot | `${Slot}-body`, SlotProps>
|
|
13
|
+
: Record<string, never>
|
|
14
|
+
|
|
15
|
+
export type AccordionSlots<T extends { slot?: string }> = {
|
|
16
|
+
default?: SlotProps<T>
|
|
17
|
+
leading?: SlotProps<T>
|
|
18
|
+
trailing?: SlotProps<T>
|
|
19
|
+
content?: SlotProps<T>
|
|
20
|
+
body?: SlotProps<T>
|
|
21
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
22
|
+
|
|
6
23
|
export interface AccordionItem {
|
|
7
24
|
label?: string
|
|
8
25
|
icon?: string
|
|
9
|
-
|
|
26
|
+
trailingIcon?: string
|
|
10
27
|
slot?: string
|
|
11
28
|
content?: string
|
|
12
29
|
/** A unique value for the accordion item. Defaults to the index. */
|
|
@@ -14,25 +31,13 @@ export interface AccordionItem {
|
|
|
14
31
|
disabled?: boolean
|
|
15
32
|
}
|
|
16
33
|
|
|
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
34
|
export interface AccordionProps<T> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
|
|
30
35
|
items?: T[]
|
|
31
36
|
/**
|
|
32
37
|
* The icon displayed on the right side of the trigger.
|
|
33
|
-
* @default app.icons.
|
|
38
|
+
* @default app.icons.chevronDown
|
|
34
39
|
*/
|
|
35
|
-
|
|
40
|
+
trailingIcon?: string
|
|
36
41
|
labelKey?: string
|
|
37
42
|
}
|
|
38
43
|
</script>
|
|
@@ -55,11 +60,8 @@ const emit = defineEmits<AccordionEmits>()
|
|
|
55
60
|
const slots = defineSlots<AccordionSlots<T>>()
|
|
56
61
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'), emit)
|
|
57
62
|
|
|
58
|
-
const { theme,
|
|
59
|
-
const style = computed(() =>
|
|
60
|
-
const styler = createStyler(theme.value.accordion)
|
|
61
|
-
return styler(props)
|
|
62
|
-
})
|
|
63
|
+
const { theme, generateStyle } = useTheme()
|
|
64
|
+
const style = computed(() => generateStyle('accordion', props))
|
|
63
65
|
</script>
|
|
64
66
|
|
|
65
67
|
<template>
|
|
@@ -74,27 +76,27 @@ const style = computed(() => {
|
|
|
74
76
|
>
|
|
75
77
|
<AccordionHeader :class="style.header({ class: props.ui?.header })">
|
|
76
78
|
<AccordionTrigger :class="style.trigger({ class: props.ui?.trigger, disabled: item.disabled })">
|
|
77
|
-
<slot name="
|
|
78
|
-
<span v-if="item.icon" :class="style.
|
|
79
|
+
<slot name="leading" v-bind="{ item, index, open }">
|
|
80
|
+
<span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })"></span>
|
|
79
81
|
</slot>
|
|
80
82
|
|
|
81
83
|
<span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })">
|
|
82
84
|
<slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
|
|
83
85
|
</span>
|
|
84
86
|
|
|
85
|
-
<slot name="
|
|
86
|
-
<span :class="style.
|
|
87
|
+
<slot name="trailing" v-bind="{ item, index, open }">
|
|
88
|
+
<span :class="style.trailingIcon({ class: [item.trailingIcon || props.trailingIcon || theme.app.icons.chevronDown, props.ui?.trailingIcon] })"></span>
|
|
87
89
|
</slot>
|
|
88
90
|
</AccordionTrigger>
|
|
89
91
|
</AccordionHeader>
|
|
90
92
|
|
|
91
93
|
<AccordionContent
|
|
92
|
-
v-if="item.content || slots.content || (item.slot && slots[item.slot]) || slots.body || (slots[`${item.slot}-body`])"
|
|
94
|
+
v-if="item.content || slots.content || (item.slot && slots[item.slot]) || slots.body || (item.slot && slots[`${item.slot}-body`])"
|
|
93
95
|
:class="style.content({ class: props.ui?.content })"
|
|
94
96
|
>
|
|
95
97
|
<slot :name="item.slot || 'content'" v-bind="{ item, index, open }">
|
|
96
98
|
<div :class="style.body({ class: props.ui?.body })">
|
|
97
|
-
<slot :name="item.slot ? item.slot : 'body'" v-bind="{ item, index, open }">
|
|
99
|
+
<slot :name="item.slot ? `${item.slot}-body` : 'body'" v-bind="{ item, index, open }">
|
|
98
100
|
{{ item.content }}
|
|
99
101
|
</slot>
|
|
100
102
|
</div>
|
|
@@ -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,14 +63,12 @@ const props = withDefaults(defineProps<AlertProps>(), {
|
|
|
57
63
|
const emit = defineEmits<AlertEmits>()
|
|
58
64
|
const slots = defineSlots<AlertSlots>()
|
|
59
65
|
|
|
60
|
-
const {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})
|
|
67
|
-
})
|
|
66
|
+
const { t } = useLocale()
|
|
67
|
+
const { theme, generateStyle } = useTheme()
|
|
68
|
+
const style = computed(() => generateStyle('alert', {
|
|
69
|
+
...props,
|
|
70
|
+
title: !!props.title || !!slots.title,
|
|
71
|
+
}))
|
|
68
72
|
</script>
|
|
69
73
|
|
|
70
74
|
<template>
|
|
@@ -73,7 +77,7 @@ const style = computed(() => {
|
|
|
73
77
|
:data-orientation="props.orientation"
|
|
74
78
|
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
75
79
|
>
|
|
76
|
-
<slot name="
|
|
80
|
+
<slot name="leading">
|
|
77
81
|
<span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
|
|
78
82
|
</slot>
|
|
79
83
|
|
|
@@ -109,7 +113,7 @@ const style = computed(() => {
|
|
|
109
113
|
:icon="props.closeIcon || theme.app.icons.close"
|
|
110
114
|
size="md"
|
|
111
115
|
variant="link"
|
|
112
|
-
aria-label="
|
|
116
|
+
:aria-label="t('alert.close')"
|
|
113
117
|
v-bind="typeof props.close === 'object' ? props.close : undefined"
|
|
114
118
|
:class="style.close({ class: props.ui?.close })"
|
|
115
119
|
@click="emit('update:open', false)"
|
|
@@ -1,29 +1,29 @@
|
|
|
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,
|
|
4
|
+
import type { Messages, ThemeExtension, ToastProviderProps } 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
|
|
14
|
+
toaster?: ToastProviderProps
|
|
9
15
|
tooltip?: TooltipProviderProps
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface AppSlots {
|
|
14
|
-
default: (props?: Record<string, unknown>) => any
|
|
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
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import ModalProvider from './ModalProvider.vue'
|
|
26
|
-
import Toaster from './Toaster.vue'
|
|
23
|
+
import { toRef, useId } from 'vue'
|
|
24
|
+
import { provideLocaleContext, provideThemeExtension, provideUnoConfig } from '../app/injections'
|
|
25
|
+
import OverlayProvider from './OverlayProvider.vue'
|
|
26
|
+
import ToastProvider from './ToastProvider.vue'
|
|
27
27
|
|
|
28
28
|
const props = withDefaults(defineProps<AppProps>(), {
|
|
29
29
|
unoConfig: () => ({}),
|
|
@@ -34,28 +34,23 @@ defineSlots<AppSlots>()
|
|
|
34
34
|
|
|
35
35
|
const configProviderProps = useForwardProps(reactivePick(props, 'scrollBody'))
|
|
36
36
|
const tooltipProps = toRef(() => props.tooltip)
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const modalState = shallowRef<ModalState>({
|
|
40
|
-
component: 'div',
|
|
41
|
-
props: {},
|
|
42
|
-
})
|
|
37
|
+
const toastProviderProps = toRef(() => props.toaster)
|
|
43
38
|
|
|
44
|
-
|
|
39
|
+
provideUnoConfig(() => props.unoConfig)
|
|
40
|
+
provideThemeExtension(() => props.ui)
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
provideThemeExtension(themeExtension)
|
|
42
|
+
const locale = toRef(() => props.locale)
|
|
43
|
+
provideLocaleContext(locale)
|
|
49
44
|
</script>
|
|
50
45
|
|
|
51
46
|
<template>
|
|
52
|
-
<ConfigProvider :use-id="useId" v-bind="configProviderProps">
|
|
47
|
+
<ConfigProvider :use-id="useId" :dir="locale?.dir" :locale="locale?.code" v-bind="configProviderProps">
|
|
53
48
|
<TooltipProvider v-bind="tooltipProps">
|
|
54
|
-
<
|
|
49
|
+
<ToastProvider v-if="props.toaster !== null" v-bind="toastProviderProps">
|
|
55
50
|
<slot></slot>
|
|
56
|
-
</
|
|
51
|
+
</ToastProvider>
|
|
57
52
|
<slot v-else></slot>
|
|
58
53
|
</TooltipProvider>
|
|
59
|
-
<
|
|
54
|
+
<OverlayProvider />
|
|
60
55
|
</ConfigProvider>
|
|
61
56
|
</template>
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { generateStyle } = useTheme()
|
|
44
|
+
const style = computed(() => generateStyle('avatar', {
|
|
45
|
+
...props,
|
|
46
|
+
size: size.value,
|
|
47
|
+
}))
|
|
48
|
+
|
|
49
|
+
const error = shallowRef(false)
|
|
50
|
+
|
|
51
|
+
watch(() => props.src, () => {
|
|
52
|
+
if (error.value)
|
|
53
|
+
error.value = false
|
|
54
|
+
})
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<AvatarRoot :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })" :style="props.style">
|
|
59
|
+
<AvatarImage
|
|
60
|
+
:src="props.src"
|
|
61
|
+
:alt="props.alt"
|
|
62
|
+
:class="style.image({ class: props.ui?.image })"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<AvatarFallback as-child>
|
|
66
|
+
<span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
|
|
67
|
+
<span v-else :class="style.fallback({ class: props.ui?.fallback })">{{ fallback || ' ' }}</span>
|
|
68
|
+
</AvatarFallback>
|
|
69
|
+
</AvatarRoot>
|
|
70
|
+
</template>
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { generateStyle } = useTheme()
|
|
77
|
+
const style = computed(() => generateStyle('avatarGroup', props))
|
|
78
|
+
|
|
79
|
+
provideAvatarGroup(computed(() => props))
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<template>
|
|
83
|
+
<Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
|
|
84
|
+
<Avatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="style.base({ class: props.ui?.base })" />
|
|
85
|
+
<component :is="avatar" v-for="(avatar, index) in visibleAvatars" :key="index" :class="style.base({ class: props.ui?.base })" />
|
|
86
|
+
</Primitive>
|
|
87
|
+
</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">
|
|
@@ -45,11 +50,8 @@ defineSlots<BadgeSlots>()
|
|
|
45
50
|
|
|
46
51
|
const show = defineModel<boolean>('show', { default: true })
|
|
47
52
|
|
|
48
|
-
const {
|
|
49
|
-
const style = computed(() =>
|
|
50
|
-
const styler = createStyler(theme.value.badge)
|
|
51
|
-
return styler(props)
|
|
52
|
-
})
|
|
53
|
+
const { generateStyle } = useTheme()
|
|
54
|
+
const style = computed(() => generateStyle('badge', props))
|
|
53
55
|
</script>
|
|
54
56
|
|
|
55
57
|
<template>
|