@byyuurin/ui 0.0.3 → 0.0.5
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 +15 -24
- package/dist/index.d.ts +25 -2
- package/dist/index.mjs +25 -2
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.mjs +14 -10
- package/dist/nuxt.mjs.map +1 -0
- package/dist/runtime/components/Accordion.vue +1 -1
- package/dist/runtime/components/Alert.vue +120 -0
- package/dist/runtime/components/App.vue +5 -1
- package/dist/runtime/components/Badge.vue +71 -0
- package/dist/runtime/components/Button.vue +3 -3
- package/dist/runtime/components/Card.vue +4 -4
- package/dist/runtime/components/Checkbox.vue +3 -6
- package/dist/runtime/components/Chip.vue +59 -0
- package/dist/runtime/components/Drawer.vue +2 -2
- package/dist/runtime/components/Input.vue +7 -2
- package/dist/runtime/components/Link.vue +1 -1
- package/dist/runtime/components/Modal.vue +2 -2
- package/dist/runtime/components/ModalProvider.vue +1 -1
- package/dist/runtime/components/PinInput.vue +86 -0
- package/dist/runtime/components/Popover.vue +1 -1
- package/dist/runtime/components/RadioGroup.vue +2 -8
- package/dist/runtime/components/ScrollArea.vue +72 -0
- package/dist/runtime/components/Select.vue +2 -1
- package/dist/runtime/components/Slider.vue +97 -0
- package/dist/runtime/components/Switch.vue +1 -2
- package/dist/runtime/components/Tabs.vue +6 -6
- package/dist/runtime/components/Textarea.vue +172 -0
- package/dist/runtime/components/Toast.vue +2 -2
- package/dist/runtime/components/Toaster.vue +2 -1
- package/dist/runtime/components/Tooltip.vue +1 -1
- package/dist/runtime/composables/defineInjection.d.ts +11 -0
- package/dist/runtime/composables/defineInjection.mjs +9 -0
- package/dist/runtime/composables/useModal.d.ts +1 -1
- package/dist/runtime/composables/useModal.mjs +3 -2
- package/dist/runtime/composables/useTheme.d.ts +3 -1
- package/dist/runtime/composables/useTheme.mjs +14 -6
- package/dist/runtime/theme/accordion.mjs +24 -21
- package/dist/runtime/theme/alert.d.ts +85 -0
- package/dist/runtime/theme/alert.mjs +47 -0
- package/dist/runtime/theme/app.mjs +1 -0
- package/dist/runtime/theme/badge.d.ts +79 -0
- package/dist/runtime/theme/badge.mjs +89 -0
- package/dist/runtime/theme/button.d.ts +4 -9
- package/dist/runtime/theme/button.mjs +130 -127
- package/dist/runtime/theme/card.d.ts +2 -2
- package/dist/runtime/theme/card.mjs +12 -9
- package/dist/runtime/theme/checkbox.d.ts +0 -12
- package/dist/runtime/theme/checkbox.mjs +45 -47
- package/dist/runtime/theme/chip.d.ts +56 -0
- package/dist/runtime/theme/chip.mjs +63 -0
- package/dist/runtime/theme/drawer.mjs +69 -66
- package/dist/runtime/theme/index.d.ts +7 -0
- package/dist/runtime/theme/index.mjs +7 -0
- package/dist/runtime/theme/input.d.ts +13 -5
- package/dist/runtime/theme/input.mjs +135 -122
- package/dist/runtime/theme/link.d.ts +1 -1
- package/dist/runtime/theme/link.mjs +23 -20
- package/dist/runtime/theme/modal.mjs +51 -48
- package/dist/runtime/theme/pinInput.d.ts +97 -0
- package/dist/runtime/theme/pinInput.mjs +108 -0
- package/dist/runtime/theme/popover.mjs +11 -8
- package/dist/runtime/theme/radioGroup.d.ts +0 -24
- package/dist/runtime/theme/radioGroup.mjs +50 -59
- package/dist/runtime/theme/scrollArea.d.ts +51 -0
- package/dist/runtime/theme/scrollArea.mjs +33 -0
- package/dist/runtime/theme/select.d.ts +5 -2
- package/dist/runtime/theme/select.mjs +156 -143
- package/dist/runtime/theme/slider.d.ts +73 -0
- package/dist/runtime/theme/slider.mjs +49 -0
- package/dist/runtime/theme/switch.d.ts +0 -12
- package/dist/runtime/theme/switch.mjs +66 -69
- package/dist/runtime/theme/tabs.d.ts +44 -13
- package/dist/runtime/theme/tabs.mjs +132 -106
- package/dist/runtime/theme/textarea.d.ts +93 -0
- package/dist/runtime/theme/textarea.mjs +113 -0
- package/dist/runtime/theme/toast.mjs +26 -23
- package/dist/runtime/theme/toaster.d.ts +2 -2
- package/dist/runtime/theme/toaster.mjs +84 -81
- package/dist/runtime/theme/tooltip.mjs +9 -6
- package/dist/runtime/types/components.d.ts +7 -0
- package/dist/runtime/types/index.d.ts +1 -3
- package/dist/runtime/utils/extend-theme.mjs +1 -1
- package/dist/runtime/utils/index.d.ts +0 -11
- package/dist/runtime/utils/index.mjs +0 -11
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/shared/ui.CzDyI29e.mjs +8 -0
- package/dist/shared/ui.CzDyI29e.mjs.map +1 -0
- package/dist/unocss-preset.d.mts +15 -7
- package/dist/unocss-preset.d.ts +15 -7
- package/dist/unocss-preset.mjs +97 -384
- package/dist/unocss-preset.mjs.map +1 -0
- package/dist/unplugin.d.mts +25 -0
- package/dist/unplugin.d.ts +25 -0
- package/dist/unplugin.mjs +64 -0
- package/dist/unplugin.mjs.map +1 -0
- package/dist/vite.d.mts +9 -0
- package/dist/vite.d.ts +9 -0
- package/dist/vite.mjs +14 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +22 -14
- package/dist/index.cjs +0 -38
- package/dist/resolver.d.mts +0 -13
- package/dist/resolver.d.ts +0 -13
- package/dist/resolver.mjs +0 -21
- package/dist/runtime/components/index.cjs +0 -132
- package/dist/runtime/components/index.d.ts +0 -18
- package/dist/runtime/components/index.mjs +0 -18
- package/dist/runtime/composables/index.cjs +0 -33
- package/dist/runtime/composables/index.d.ts +0 -4
- package/dist/runtime/composables/index.mjs +0 -4
- package/dist/runtime/composables/useComponentIcons.cjs +0 -30
- package/dist/runtime/composables/useModal.cjs +0 -55
- package/dist/runtime/composables/useTheme.cjs +0 -30
- package/dist/runtime/composables/useToast.cjs +0 -51
- package/dist/runtime/theme/accordion.cjs +0 -27
- package/dist/runtime/theme/app.cjs +0 -15
- package/dist/runtime/theme/button.cjs +0 -127
- package/dist/runtime/theme/card.cjs +0 -17
- package/dist/runtime/theme/checkbox.cjs +0 -56
- package/dist/runtime/theme/drawer.cjs +0 -73
- package/dist/runtime/theme/index.cjs +0 -125
- package/dist/runtime/theme/input.cjs +0 -115
- package/dist/runtime/theme/link.cjs +0 -23
- package/dist/runtime/theme/modal.cjs +0 -55
- package/dist/runtime/theme/popover.cjs +0 -13
- package/dist/runtime/theme/radioGroup.cjs +0 -73
- package/dist/runtime/theme/select.cjs +0 -128
- package/dist/runtime/theme/switch.cjs +0 -73
- package/dist/runtime/theme/tabs.cjs +0 -105
- package/dist/runtime/theme/toast.cjs +0 -33
- package/dist/runtime/theme/toaster.cjs +0 -72
- package/dist/runtime/theme/tooltip.cjs +0 -14
- package/dist/runtime/types/components.cjs +0 -1
- package/dist/runtime/types/index.cjs +0 -27
- package/dist/runtime/types/utils.cjs +0 -1
- package/dist/runtime/utils/extend-theme.cjs +0 -24
- package/dist/runtime/utils/index.cjs +0 -119
- package/dist/runtime/utils/link.cjs +0 -10
- package/dist/runtime/utils/styler.cjs +0 -18
- package/dist/shared/ui.CPXA9QoM.mjs +0 -23
package/README.md
CHANGED
|
@@ -50,14 +50,6 @@ export default defineConfig({
|
|
|
50
50
|
c3: '#e5e6e6', // optional
|
|
51
51
|
}),
|
|
52
52
|
],
|
|
53
|
-
content: {
|
|
54
|
-
pipeline: {
|
|
55
|
-
include: [
|
|
56
|
-
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
|
|
57
|
-
/\/(?:theme).*\.(ts|m?js)($|\?)/,
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
53
|
})
|
|
62
54
|
```
|
|
63
55
|
|
|
@@ -66,28 +58,25 @@ export default defineConfig({
|
|
|
66
58
|
```ts
|
|
67
59
|
// vite.config.ts
|
|
68
60
|
|
|
69
|
-
import
|
|
61
|
+
import UI from '@byyuurin/ui/vite'
|
|
70
62
|
import Vue from '@vitejs/plugin-vue'
|
|
71
63
|
import UnoCSS from 'unocss/vite'
|
|
72
|
-
import AutoImport from 'unplugin-auto-import/vite'
|
|
73
|
-
import VueComponents from 'unplugin-vue-components/vite'
|
|
74
64
|
import { defineConfig } from 'vite'
|
|
65
|
+
import Inspect from 'vite-plugin-inspect'
|
|
75
66
|
|
|
76
67
|
export default defineConfig({
|
|
77
68
|
plugins: [
|
|
78
69
|
UnoCSS(),
|
|
79
70
|
Vue(),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
dts: 'src/typed-imports.d.ts',
|
|
90
|
-
imports: ['vue'],
|
|
71
|
+
UI({
|
|
72
|
+
prefix: 'U', // optional
|
|
73
|
+
autoImport: {
|
|
74
|
+
dts: 'src/typed-imports.d.ts',
|
|
75
|
+
imports: ['vue'],
|
|
76
|
+
},
|
|
77
|
+
components: {
|
|
78
|
+
dts: 'src/typed-components.d.ts',
|
|
79
|
+
},
|
|
91
80
|
}),
|
|
92
81
|
],
|
|
93
82
|
})
|
|
@@ -107,16 +96,18 @@ export default defineNuxtConfig({
|
|
|
107
96
|
'@unocss/reset/tailwind.css',
|
|
108
97
|
],
|
|
109
98
|
ui: {
|
|
110
|
-
prefix: 'U',
|
|
99
|
+
prefix: 'U', // optional
|
|
111
100
|
},
|
|
112
101
|
})
|
|
113
102
|
```
|
|
114
103
|
|
|
115
|
-
##
|
|
104
|
+
## Credits
|
|
116
105
|
|
|
117
106
|
- [UnoCSS](https://github.com/unocss/unocss)
|
|
118
107
|
- [daisyui](https://github.com/saadeghi/daisyui)
|
|
119
108
|
- [@nuxt/ui](https://github.com/nuxt/ui)
|
|
109
|
+
- [Reka UI](https://github.com/unovue/radix-vue)
|
|
110
|
+
- [VueUse](https://github.com/vueuse/vueuse)
|
|
120
111
|
|
|
121
112
|
## License
|
|
122
113
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { default as Accordion } from './runtime/components/Accordion.vue';
|
|
2
|
+
export { default as Alert } from './runtime/components/Alert.vue';
|
|
3
|
+
export { default as App } from './runtime/components/App.vue';
|
|
4
|
+
export { default as Badge } from './runtime/components/Badge.vue';
|
|
5
|
+
export { default as Button } from './runtime/components/Button.vue';
|
|
6
|
+
export { default as Card } from './runtime/components/Card.vue';
|
|
7
|
+
export { default as Checkbox } from './runtime/components/Checkbox.vue';
|
|
8
|
+
export { default as Chip } from './runtime/components/Chip.vue';
|
|
9
|
+
export { default as Drawer } from './runtime/components/Drawer.vue';
|
|
10
|
+
export { default as Input } from './runtime/components/Input.vue';
|
|
11
|
+
export { default as Link } from './runtime/components/Link.vue';
|
|
12
|
+
export { default as Modal } from './runtime/components/Modal.vue';
|
|
13
|
+
export { default as ModalProvider } from './runtime/components/ModalProvider.vue';
|
|
14
|
+
export { default as PinInput } from './runtime/components/PinInput.vue';
|
|
15
|
+
export { default as Popover } from './runtime/components/Popover.vue';
|
|
16
|
+
export { default as RadioGroup } from './runtime/components/RadioGroup.vue';
|
|
17
|
+
export { default as ScrollArea } from './runtime/components/ScrollArea.vue';
|
|
18
|
+
export { default as Select } from './runtime/components/Select.vue';
|
|
19
|
+
export { default as Slider } from './runtime/components/Slider.vue';
|
|
20
|
+
export { default as Switch } from './runtime/components/Switch.vue';
|
|
21
|
+
export { default as Tabs } from './runtime/components/Tabs.vue';
|
|
22
|
+
export { default as Textarea } from './runtime/components/Textarea.vue';
|
|
23
|
+
export { default as Toast } from './runtime/components/Toast.vue';
|
|
24
|
+
export { default as Toaster } from './runtime/components/Toaster.vue';
|
|
25
|
+
export { default as Tooltip } from './runtime/components/Tooltip.vue';
|
|
3
26
|
export * from './runtime/types';
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { default as Accordion } from "./runtime/components/Accordion.vue";
|
|
2
|
+
export { default as Alert } from "./runtime/components/Alert.vue";
|
|
3
|
+
export { default as App } from "./runtime/components/App.vue";
|
|
4
|
+
export { default as Badge } from "./runtime/components/Badge.vue";
|
|
5
|
+
export { default as Button } from "./runtime/components/Button.vue";
|
|
6
|
+
export { default as Card } from "./runtime/components/Card.vue";
|
|
7
|
+
export { default as Checkbox } from "./runtime/components/Checkbox.vue";
|
|
8
|
+
export { default as Chip } from "./runtime/components/Chip.vue";
|
|
9
|
+
export { default as Drawer } from "./runtime/components/Drawer.vue";
|
|
10
|
+
export { default as Input } from "./runtime/components/Input.vue";
|
|
11
|
+
export { default as Link } from "./runtime/components/Link.vue";
|
|
12
|
+
export { default as Modal } from "./runtime/components/Modal.vue";
|
|
13
|
+
export { default as ModalProvider } from "./runtime/components/ModalProvider.vue";
|
|
14
|
+
export { default as PinInput } from "./runtime/components/PinInput.vue";
|
|
15
|
+
export { default as Popover } from "./runtime/components/Popover.vue";
|
|
16
|
+
export { default as RadioGroup } from "./runtime/components/RadioGroup.vue";
|
|
17
|
+
export { default as ScrollArea } from "./runtime/components/ScrollArea.vue";
|
|
18
|
+
export { default as Select } from "./runtime/components/Select.vue";
|
|
19
|
+
export { default as Slider } from "./runtime/components/Slider.vue";
|
|
20
|
+
export { default as Switch } from "./runtime/components/Switch.vue";
|
|
21
|
+
export { default as Tabs } from "./runtime/components/Tabs.vue";
|
|
22
|
+
export { default as Textarea } from "./runtime/components/Textarea.vue";
|
|
23
|
+
export { default as Toast } from "./runtime/components/Toast.vue";
|
|
24
|
+
export { default as Toaster } from "./runtime/components/Toaster.vue";
|
|
25
|
+
export { default as Tooltip } from "./runtime/components/Tooltip.vue";
|
|
3
26
|
export * from "./runtime/types/index.mjs";
|
package/dist/nuxt.d.mts
CHANGED
package/dist/nuxt.d.ts
CHANGED
package/dist/nuxt.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { defineNuxtModule, useLogger,
|
|
2
|
-
import { p as packageName
|
|
1
|
+
import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
+
import { p as packageName } from './shared/ui.CzDyI29e.mjs';
|
|
3
|
+
import 'node:url';
|
|
4
|
+
import 'pathe';
|
|
3
5
|
|
|
4
6
|
const nuxt = defineNuxtModule({
|
|
5
7
|
meta: {
|
|
@@ -10,22 +12,24 @@ const nuxt = defineNuxtModule({
|
|
|
10
12
|
}
|
|
11
13
|
},
|
|
12
14
|
defaults: {
|
|
13
|
-
prefix: ""
|
|
15
|
+
prefix: "U"
|
|
14
16
|
},
|
|
15
17
|
setup(options, nuxt) {
|
|
16
18
|
const logger = useLogger(packageName);
|
|
19
|
+
const { resolve } = createResolver(import.meta.url);
|
|
17
20
|
if (!nuxt.options.modules.includes("@unocss/nuxt")) {
|
|
18
21
|
logger.error(`\`${packageName}\` requires the \`@unocss/nuxt\` module to be installed.`);
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
nuxt.options.alias["#ui"] = resolve("./runtime");
|
|
25
|
+
addComponentsDir({
|
|
26
|
+
path: resolve("./runtime/components"),
|
|
27
|
+
prefix: options.prefix,
|
|
28
|
+
pathPrefix: false
|
|
29
|
+
});
|
|
30
|
+
addImportsDir(resolve("./runtime/composables"));
|
|
28
31
|
}
|
|
29
32
|
});
|
|
30
33
|
|
|
31
34
|
export { nuxt as default };
|
|
35
|
+
//# sourceMappingURL=nuxt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nuxt.mjs","sources":["../src/nuxt.ts"],"sourcesContent":["import { addComponentsDir, addImportsDir, createResolver, defineNuxtModule, useLogger } from '@nuxt/kit'\r\nimport type {} from '@nuxt/schema' // Mandatory to avoid a bug when building\r\nimport { packageName } from './internal/shared'\r\n\r\nexport interface ModuleOptions {\r\n /**\r\n * prefix for components used in templates\r\n *\r\n * @default \"U\"\r\n */\r\n prefix?: string\r\n}\r\n\r\nexport default defineNuxtModule<ModuleOptions>({\r\n meta: {\r\n name: packageName,\r\n configKey: 'ui',\r\n compatibility: {\r\n nuxt: '>=3.13.1',\r\n },\r\n },\r\n defaults: {\r\n prefix: 'U',\r\n },\r\n setup(options, nuxt) {\r\n const logger = useLogger(packageName)\r\n const { resolve } = createResolver(import.meta.url)\r\n\r\n // Make sure the UnoCSS Nuxt module is installed\r\n if (!nuxt.options.modules.includes('@unocss/nuxt')) {\r\n logger.error(`\\`${packageName}\\` requires the \\`@unocss/nuxt\\` module to be installed.`)\r\n return\r\n }\r\n\r\n nuxt.options.alias['#ui'] = resolve('./runtime')\r\n\r\n addComponentsDir({\r\n path: resolve('./runtime/components'),\r\n prefix: options.prefix,\r\n pathPrefix: false,\r\n })\r\n\r\n addImportsDir(resolve('./runtime/composables'))\r\n },\r\n})\r\n"],"names":[],"mappings":";;;;;AAaA,aAAe,gBAAgC,CAAA;AAAA,EAC7C,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,WAAA;AAAA,IACN,SAAW,EAAA,IAAA;AAAA,IACX,aAAe,EAAA;AAAA,MACb,IAAM,EAAA;AAAA;AACR,GACF;AAAA,EACA,QAAU,EAAA;AAAA,IACR,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,KAAA,CAAM,SAAS,IAAM,EAAA;AACnB,IAAM,MAAA,MAAA,GAAS,UAAU,WAAW,CAAA;AACpC,IAAA,MAAM,EAAE,OAAA,EAAY,GAAA,cAAA,CAAe,YAAY,GAAG,CAAA;AAGlD,IAAA,IAAI,CAAC,IAAK,CAAA,OAAA,CAAQ,OAAQ,CAAA,QAAA,CAAS,cAAc,CAAG,EAAA;AAClD,MAAO,MAAA,CAAA,KAAA,CAAM,CAAK,EAAA,EAAA,WAAW,CAA0D,wDAAA,CAAA,CAAA;AACvF,MAAA;AAAA;AAGF,IAAA,IAAA,CAAK,OAAQ,CAAA,KAAA,CAAM,KAAK,CAAA,GAAI,QAAQ,WAAW,CAAA;AAE/C,IAAiB,gBAAA,CAAA;AAAA,MACf,IAAA,EAAM,QAAQ,sBAAsB,CAAA;AAAA,MACpC,QAAQ,OAAQ,CAAA,MAAA;AAAA,MAChB,UAAY,EAAA;AAAA,KACb,CAAA;AAED,IAAc,aAAA,CAAA,OAAA,CAAQ,uBAAuB,CAAC,CAAA;AAAA;AAElD,CAAC,CAAA;;;;"}
|
|
@@ -36,7 +36,7 @@ export interface AccordionProps<T> extends ComponentAttrs<typeof accordion>, Pic
|
|
|
36
36
|
import { reactivePick } from '@vueuse/core'
|
|
37
37
|
import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, useForwardPropsEmits } from 'reka-ui'
|
|
38
38
|
import { computed } from 'vue'
|
|
39
|
-
import { useTheme } from '../composables'
|
|
39
|
+
import { useTheme } from '../composables/useTheme'
|
|
40
40
|
import { get } from '../utils'
|
|
41
41
|
|
|
42
42
|
const props = withDefaults(defineProps<AccordionProps<T>>(), {
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
4
|
+
import type { alert } from '../theme'
|
|
5
|
+
import type { ButtonProps, ComponentAttrs } from '../types'
|
|
6
|
+
|
|
7
|
+
type AlertVariants = VariantProps<typeof alert>
|
|
8
|
+
|
|
9
|
+
export interface AlertProps extends ComponentAttrs<typeof alert>, Pick<PrimitiveProps, 'as'> {
|
|
10
|
+
title?: string
|
|
11
|
+
description?: string
|
|
12
|
+
icon?: string
|
|
13
|
+
variant?: AlertVariants['variant']
|
|
14
|
+
orientation?: AlertVariants['orientation']
|
|
15
|
+
/**
|
|
16
|
+
* Display a list of actions:
|
|
17
|
+
* - under the title and description when orientation is `vertical`
|
|
18
|
+
* - next to the close button when orientation is `horizontal`
|
|
19
|
+
*/
|
|
20
|
+
actions?: ButtonProps[]
|
|
21
|
+
/**
|
|
22
|
+
* Display a close button to dismiss the alert.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
close?: ButtonProps | boolean
|
|
26
|
+
/**
|
|
27
|
+
* The icon displayed in the close button.
|
|
28
|
+
* @default app.icons.close
|
|
29
|
+
*/
|
|
30
|
+
closeIcon?: string
|
|
31
|
+
}
|
|
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
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { Primitive } from 'reka-ui'
|
|
48
|
+
import { computed } from 'vue'
|
|
49
|
+
import { useTheme } from '../composables/useTheme'
|
|
50
|
+
import Button from './Button.vue'
|
|
51
|
+
|
|
52
|
+
const props = withDefaults(defineProps<AlertProps>(), {
|
|
53
|
+
variant: 'solid',
|
|
54
|
+
orientation: 'vertical',
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const emit = defineEmits<AlertEmits>()
|
|
58
|
+
const slots = defineSlots<AlertSlots>()
|
|
59
|
+
|
|
60
|
+
const { theme, createStyler } = useTheme()
|
|
61
|
+
const style = computed(() => {
|
|
62
|
+
const styler = createStyler(theme.value.alert)
|
|
63
|
+
return styler({
|
|
64
|
+
...props,
|
|
65
|
+
title: !!props.title || !!slots.title,
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<template>
|
|
71
|
+
<Primitive
|
|
72
|
+
:as="props.as"
|
|
73
|
+
:data-orientation="props.orientation"
|
|
74
|
+
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
75
|
+
>
|
|
76
|
+
<slot name="prepend">
|
|
77
|
+
<i v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></i>
|
|
78
|
+
</slot>
|
|
79
|
+
|
|
80
|
+
<div :class="style.wrapper({ class: props.ui?.wrapper })">
|
|
81
|
+
<div v-if="props.title || slots.title" :class="style.title({ class: props.ui?.title })">
|
|
82
|
+
<slot name="title">
|
|
83
|
+
{{ props.title }}
|
|
84
|
+
</slot>
|
|
85
|
+
</div>
|
|
86
|
+
<div v-if="props.description || slots.description" :class="style.description({ class: props.ui?.description })">
|
|
87
|
+
<slot name="description">
|
|
88
|
+
{{ props.description }}
|
|
89
|
+
</slot>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div v-if="props.orientation === 'vertical' && props.actions?.length" :class="style.actions({ class: props.ui?.actions })">
|
|
93
|
+
<slot name="actions">
|
|
94
|
+
<Button v-for="(action, index) in props.actions" :key="index" size="xs" v-bind="action" />
|
|
95
|
+
</slot>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<div v-if="(props.orientation === 'horizontal' && props.actions?.length) || props.close" :class="style.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
|
|
100
|
+
<template v-if="props.orientation === 'horizontal' && props.actions?.length">
|
|
101
|
+
<slot name="actions">
|
|
102
|
+
<Button v-for="(action, index) in props.actions" :key="index" size="xs" v-bind="action" />
|
|
103
|
+
</slot>
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<slot name="close" :ui="props.ui">
|
|
107
|
+
<Button
|
|
108
|
+
v-if="props.close"
|
|
109
|
+
:icon="props.closeIcon || theme.app.icons.close"
|
|
110
|
+
size="md"
|
|
111
|
+
variant="link"
|
|
112
|
+
aria-label="Close"
|
|
113
|
+
v-bind="typeof props.close === 'object' ? props.close : undefined"
|
|
114
|
+
:class="style.close({ class: props.ui?.close })"
|
|
115
|
+
@click="emit('update:open', false)"
|
|
116
|
+
/>
|
|
117
|
+
</slot>
|
|
118
|
+
</div>
|
|
119
|
+
</Primitive>
|
|
120
|
+
</template>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui'
|
|
3
|
+
import type { UserConfig } from 'unocss'
|
|
3
4
|
import type { ThemeExtension, ToasterProps } from '../types'
|
|
4
5
|
|
|
5
6
|
export interface AppProps extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
|
|
7
|
+
unoConfig?: UserConfig
|
|
6
8
|
ui?: ThemeExtension
|
|
7
9
|
tooltip?: TooltipProviderProps
|
|
8
10
|
toaster?: ToasterProps
|
|
@@ -19,11 +21,12 @@ import { ConfigProvider, TooltipProvider, useForwardProps } from 'reka-ui'
|
|
|
19
21
|
import { computed, shallowRef, toRef, useId } from 'vue'
|
|
20
22
|
import type { ModalState } from '../composables/useModal'
|
|
21
23
|
import { provideModalState } from '../composables/useModal'
|
|
22
|
-
import { provideThemeExtension } from '../composables/useTheme'
|
|
24
|
+
import { provideThemeExtension, provideUnoConfig } from '../composables/useTheme'
|
|
23
25
|
import ModalProvider from './ModalProvider.vue'
|
|
24
26
|
import Toaster from './Toaster.vue'
|
|
25
27
|
|
|
26
28
|
const props = withDefaults(defineProps<AppProps>(), {
|
|
29
|
+
unoConfig: () => ({}),
|
|
27
30
|
ui: () => ({}),
|
|
28
31
|
})
|
|
29
32
|
|
|
@@ -41,6 +44,7 @@ const modalState = shallowRef<ModalState>({
|
|
|
41
44
|
const themeExtension = computed(() => props.ui)
|
|
42
45
|
|
|
43
46
|
provideModalState(modalState)
|
|
47
|
+
provideUnoConfig(props.unoConfig)
|
|
44
48
|
provideThemeExtension(themeExtension)
|
|
45
49
|
</script>
|
|
46
50
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
4
|
+
import type { badge } from '../theme'
|
|
5
|
+
import type { ComponentAttrs } from '../types'
|
|
6
|
+
|
|
7
|
+
type BadgeVariants = VariantProps<typeof badge>
|
|
8
|
+
|
|
9
|
+
export interface BadgeProps extends ComponentAttrs<typeof badge>, Pick<PrimitiveProps, 'as'> {
|
|
10
|
+
text?: string | number
|
|
11
|
+
size?: BadgeVariants['size']
|
|
12
|
+
position?: BadgeVariants['position']
|
|
13
|
+
show?: boolean
|
|
14
|
+
/** When `true`, keep the badge inside the component for rounded elements. */
|
|
15
|
+
inset?: boolean
|
|
16
|
+
/** When `true`, render the badge relatively to the parent. */
|
|
17
|
+
standalone?: boolean
|
|
18
|
+
}
|
|
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
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import { Primitive, Slot } from 'reka-ui'
|
|
32
|
+
import { computed } from 'vue'
|
|
33
|
+
import { useTheme } from '../composables/useTheme'
|
|
34
|
+
|
|
35
|
+
defineOptions({
|
|
36
|
+
inheritAttrs: false,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const props = withDefaults(defineProps<BadgeProps>(), {
|
|
40
|
+
size: 'md',
|
|
41
|
+
position: 'top-right',
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
defineEmits<BadgeEmits>()
|
|
45
|
+
defineSlots<BadgeSlots>()
|
|
46
|
+
|
|
47
|
+
const show = defineModel<boolean>('show', { default: true })
|
|
48
|
+
|
|
49
|
+
const { theme, createStyler } = useTheme()
|
|
50
|
+
const style = computed(() => {
|
|
51
|
+
const styler = createStyler(theme.value.badge)
|
|
52
|
+
return styler(props)
|
|
53
|
+
})
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<Primitive
|
|
58
|
+
:as="props.as"
|
|
59
|
+
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
60
|
+
>
|
|
61
|
+
<Slot v-bind="$attrs">
|
|
62
|
+
<slot></slot>
|
|
63
|
+
</Slot>
|
|
64
|
+
|
|
65
|
+
<span v-if="show" :class="style.base({ class: props.ui?.base })">
|
|
66
|
+
<slot name="content">
|
|
67
|
+
{{ props.text }}
|
|
68
|
+
</slot>
|
|
69
|
+
</span>
|
|
70
|
+
</Primitive>
|
|
71
|
+
</template>
|
|
@@ -19,7 +19,6 @@ export interface ButtonProps extends Omit<ComponentAttrs<typeof button>, 'ui'>,
|
|
|
19
19
|
label?: string
|
|
20
20
|
variant?: ButtonVariants['variant']
|
|
21
21
|
size?: ButtonVariants['size']
|
|
22
|
-
round?: boolean
|
|
23
22
|
loading?: boolean
|
|
24
23
|
active?: boolean
|
|
25
24
|
disabled?: boolean
|
|
@@ -29,7 +28,8 @@ export interface ButtonProps extends Omit<ComponentAttrs<typeof button>, 'ui'>,
|
|
|
29
28
|
|
|
30
29
|
<script lang="ts" setup>
|
|
31
30
|
import { computed } from 'vue'
|
|
32
|
-
import { useComponentIcons
|
|
31
|
+
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
32
|
+
import { useTheme } from '../composables/useTheme'
|
|
33
33
|
import { omit, pickLinkProps } from '../utils'
|
|
34
34
|
import Link from './Link.vue'
|
|
35
35
|
|
|
@@ -78,7 +78,7 @@ const style = computed(() => {
|
|
|
78
78
|
></i>
|
|
79
79
|
</slot>
|
|
80
80
|
<span
|
|
81
|
-
v-if="
|
|
81
|
+
v-if="props.label || slots.default"
|
|
82
82
|
:class="style.label({ class: props.ui?.label })"
|
|
83
83
|
>
|
|
84
84
|
<slot>{{ label }}</slot>
|
|
@@ -22,7 +22,7 @@ export interface CardSlots {
|
|
|
22
22
|
<script setup lang="ts">
|
|
23
23
|
import { Primitive } from 'reka-ui'
|
|
24
24
|
import { computed } from 'vue'
|
|
25
|
-
import { useTheme } from '../composables'
|
|
25
|
+
import { useTheme } from '../composables/useTheme'
|
|
26
26
|
|
|
27
27
|
const props = withDefaults(defineProps<CardProps>(), {})
|
|
28
28
|
const slots = defineSlots<CardSlots>()
|
|
@@ -38,12 +38,12 @@ const style = computed(() => {
|
|
|
38
38
|
<Primitive :as="props.as" :class="style.root({ class: [props.class, props.ui?.root] })">
|
|
39
39
|
<slot name="content">
|
|
40
40
|
<div
|
|
41
|
-
v-if="slots.header ||
|
|
41
|
+
v-if="slots.header || props.title || slots.title || props.description || slots.description "
|
|
42
42
|
:class="style.header({ class: props.ui?.header })"
|
|
43
43
|
>
|
|
44
44
|
<slot name="header">
|
|
45
45
|
<Primitive
|
|
46
|
-
v-if="
|
|
46
|
+
v-if="props.title || slots.title"
|
|
47
47
|
:as="slots.title ? undefined : 'h2'"
|
|
48
48
|
:class="style.title({ class: props.ui?.title })"
|
|
49
49
|
>
|
|
@@ -52,7 +52,7 @@ const style = computed(() => {
|
|
|
52
52
|
</slot>
|
|
53
53
|
</Primitive>
|
|
54
54
|
<Primitive
|
|
55
|
-
v-if="
|
|
55
|
+
v-if="props.description || slots.description"
|
|
56
56
|
:as="slots.description ? undefined : 'p'"
|
|
57
57
|
:as-child="!!slots.description"
|
|
58
58
|
:class="style.description({ class: props.ui?.description })"
|
|
@@ -37,7 +37,7 @@ export interface CheckboxSlots {
|
|
|
37
37
|
import { reactivePick } from '@vueuse/core'
|
|
38
38
|
import { CheckboxIndicator, CheckboxRoot, Label, Primitive, useForwardProps } from 'reka-ui'
|
|
39
39
|
import { computed, useId } from 'vue'
|
|
40
|
-
import { useTheme } from '../composables'
|
|
40
|
+
import { useTheme } from '../composables/useTheme'
|
|
41
41
|
|
|
42
42
|
const props = withDefaults(defineProps<CheckboxProps>(), {
|
|
43
43
|
size: 'md',
|
|
@@ -55,10 +55,7 @@ const id = props.id ?? useId()
|
|
|
55
55
|
const { theme, createStyler } = useTheme()
|
|
56
56
|
const style = computed(() => {
|
|
57
57
|
const styler = createStyler(theme.value.checkbox)
|
|
58
|
-
return styler(
|
|
59
|
-
...props,
|
|
60
|
-
checked: Boolean(innerValue.value ?? props.defaultValue),
|
|
61
|
-
})
|
|
58
|
+
return styler(props)
|
|
62
59
|
})
|
|
63
60
|
|
|
64
61
|
function onUpdate(value: any) {
|
|
@@ -81,7 +78,7 @@ function onUpdate(value: any) {
|
|
|
81
78
|
:class="style.base({ class: props.ui?.base })"
|
|
82
79
|
@update:model-value="onUpdate"
|
|
83
80
|
>
|
|
84
|
-
<CheckboxIndicator as-child>
|
|
81
|
+
<CheckboxIndicator as-child force-mount>
|
|
85
82
|
<i
|
|
86
83
|
v-if="modelValue === 'indeterminate'"
|
|
87
84
|
:class="style.icon({ class: [props.indeterminateIcon || theme.app.icons.indeterminate, props.ui?.icon] })"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
4
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
5
|
+
import type { chip } from '../theme'
|
|
6
|
+
import type { ComponentAttrs } from '../types'
|
|
7
|
+
|
|
8
|
+
type ChipVariants = VariantProps<typeof chip>
|
|
9
|
+
|
|
10
|
+
export interface ChipProps extends ComponentAttrs<typeof chip>, Pick<PrimitiveProps, 'as'>, Omit<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
|
|
11
|
+
variant?: ChipVariants['variant']
|
|
12
|
+
size?: ChipVariants['size']
|
|
13
|
+
label?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ChipSlots {
|
|
17
|
+
prefix?: (props?: {}) => any
|
|
18
|
+
default?: (props?: {}) => any
|
|
19
|
+
suffix?: (props?: {}) => any
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { Primitive } from 'reka-ui'
|
|
25
|
+
import { computed } from 'vue'
|
|
26
|
+
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
27
|
+
import { useTheme } from '../composables/useTheme'
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(defineProps<ChipProps>(), {
|
|
30
|
+
variant: 'solid',
|
|
31
|
+
size: 'md',
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const slots = defineSlots<ChipSlots>()
|
|
35
|
+
|
|
36
|
+
const { isPrefix, prefixIconName, isSuffix, suffixIconName } = useComponentIcons(props)
|
|
37
|
+
|
|
38
|
+
const { theme, createStyler } = useTheme()
|
|
39
|
+
const style = computed(() => {
|
|
40
|
+
const styler = createStyler(theme.value.chip)
|
|
41
|
+
return styler(props)
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<Primitive :as="props.as" :class="style.base({ class: [props.class, props.ui?.base] })">
|
|
47
|
+
<slot name="prefix">
|
|
48
|
+
<i v-if="isPrefix && prefixIconName" :class="style.prefixIcon({ class: [prefixIconName, props.ui?.prefixIcon] })"></i>
|
|
49
|
+
</slot>
|
|
50
|
+
|
|
51
|
+
<span v-if="props.label || slots.default" :class="style.label({ class: props.ui?.label })">
|
|
52
|
+
<slot>{{ props.label }}</slot>
|
|
53
|
+
</span>
|
|
54
|
+
|
|
55
|
+
<slot name="suffix">
|
|
56
|
+
<i v-if="isSuffix && suffixIconName" :class="style.suffixIcon({ class: [suffixIconName, props.ui?.suffixIcon] })"></i>
|
|
57
|
+
</slot>
|
|
58
|
+
</Primitive>
|
|
59
|
+
</template>
|
|
@@ -53,7 +53,7 @@ import { reactivePick } from '@vueuse/core'
|
|
|
53
53
|
import { useForwardPropsEmits } from 'reka-ui'
|
|
54
54
|
import { DrawerContent, DrawerDescription, DrawerOverlay, DrawerPortal, DrawerRoot, DrawerTitle, DrawerTrigger } from 'vaul-vue'
|
|
55
55
|
import { computed, toRef } from 'vue'
|
|
56
|
-
import { useTheme } from '../composables'
|
|
56
|
+
import { useTheme } from '../composables/useTheme'
|
|
57
57
|
|
|
58
58
|
const props = withDefaults(defineProps<DrawerProps>(), {
|
|
59
59
|
direction: 'bottom',
|
|
@@ -94,7 +94,7 @@ const style = computed(() => {
|
|
|
94
94
|
<slot name="content">
|
|
95
95
|
<div :class="style.container({ class: props.ui?.container })">
|
|
96
96
|
<div
|
|
97
|
-
v-if="slots.header ||
|
|
97
|
+
v-if="slots.header || props.title || slots.title || props.description || slots.description"
|
|
98
98
|
:class="style.header({ class: props.ui?.header })"
|
|
99
99
|
>
|
|
100
100
|
<slot name="header">
|
|
@@ -46,7 +46,8 @@ export interface InputSlots {
|
|
|
46
46
|
<script setup lang="ts">
|
|
47
47
|
import { Primitive } from 'reka-ui'
|
|
48
48
|
import { computed, onMounted, ref } from 'vue'
|
|
49
|
-
import { useComponentIcons
|
|
49
|
+
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
50
|
+
import { useTheme } from '../composables/useTheme'
|
|
50
51
|
import { looseToNumber } from '../utils'
|
|
51
52
|
|
|
52
53
|
defineOptions({
|
|
@@ -128,7 +129,11 @@ onMounted(() => {
|
|
|
128
129
|
</script>
|
|
129
130
|
|
|
130
131
|
<template>
|
|
131
|
-
<Primitive
|
|
132
|
+
<Primitive
|
|
133
|
+
:as="as"
|
|
134
|
+
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
135
|
+
:aria-disabled="props.disabled ? true : undefined"
|
|
136
|
+
>
|
|
132
137
|
<span v-if="isPrefix || slots.prefix" :class="style.prefix({ class: props.ui?.prefix })">
|
|
133
138
|
<slot name="prefix">
|
|
134
139
|
<i
|
|
@@ -32,7 +32,7 @@ export interface LinkProps extends Omit<ComponentAttrs<typeof link>, 'ui'> {
|
|
|
32
32
|
<script setup lang="ts">
|
|
33
33
|
import { Primitive } from 'reka-ui'
|
|
34
34
|
import { computed } from 'vue'
|
|
35
|
-
import { useTheme } from '../composables'
|
|
35
|
+
import { useTheme } from '../composables/useTheme'
|
|
36
36
|
|
|
37
37
|
const props = withDefaults(defineProps<LinkProps>(), {
|
|
38
38
|
as: 'button',
|
|
@@ -46,7 +46,7 @@ export interface ModalProps extends ComponentAttrs<typeof modal>, DialogRootProp
|
|
|
46
46
|
import { reactivePick } from '@vueuse/core'
|
|
47
47
|
import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, useForwardPropsEmits } from 'reka-ui'
|
|
48
48
|
import { computed, toRef } from 'vue'
|
|
49
|
-
import { useTheme } from '../composables'
|
|
49
|
+
import { useTheme } from '../composables/useTheme'
|
|
50
50
|
import UButton from './Button.vue'
|
|
51
51
|
|
|
52
52
|
const props = withDefaults(defineProps<ModalProps>(), {
|
|
@@ -95,7 +95,7 @@ const style = computed(() => {
|
|
|
95
95
|
<DialogContent :class="style.content({ class: props.ui?.content })" v-bind="contentProps" v-on="contentEvents">
|
|
96
96
|
<slot name="content">
|
|
97
97
|
<div
|
|
98
|
-
v-if="slots.header ||
|
|
98
|
+
v-if="slots.header || props.title || slots.title || props.description || slots.description || props.close || slots.close"
|
|
99
99
|
:class="style.header({ class: props.ui?.header })"
|
|
100
100
|
>
|
|
101
101
|
<slot name="header">
|