@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.
Files changed (142) hide show
  1. package/README.md +15 -24
  2. package/dist/index.d.ts +25 -2
  3. package/dist/index.mjs +25 -2
  4. package/dist/nuxt.d.mts +1 -1
  5. package/dist/nuxt.d.ts +1 -1
  6. package/dist/nuxt.mjs +14 -10
  7. package/dist/nuxt.mjs.map +1 -0
  8. package/dist/runtime/components/Accordion.vue +1 -1
  9. package/dist/runtime/components/Alert.vue +120 -0
  10. package/dist/runtime/components/App.vue +5 -1
  11. package/dist/runtime/components/Badge.vue +71 -0
  12. package/dist/runtime/components/Button.vue +3 -3
  13. package/dist/runtime/components/Card.vue +4 -4
  14. package/dist/runtime/components/Checkbox.vue +3 -6
  15. package/dist/runtime/components/Chip.vue +59 -0
  16. package/dist/runtime/components/Drawer.vue +2 -2
  17. package/dist/runtime/components/Input.vue +7 -2
  18. package/dist/runtime/components/Link.vue +1 -1
  19. package/dist/runtime/components/Modal.vue +2 -2
  20. package/dist/runtime/components/ModalProvider.vue +1 -1
  21. package/dist/runtime/components/PinInput.vue +86 -0
  22. package/dist/runtime/components/Popover.vue +1 -1
  23. package/dist/runtime/components/RadioGroup.vue +2 -8
  24. package/dist/runtime/components/ScrollArea.vue +72 -0
  25. package/dist/runtime/components/Select.vue +2 -1
  26. package/dist/runtime/components/Slider.vue +97 -0
  27. package/dist/runtime/components/Switch.vue +1 -2
  28. package/dist/runtime/components/Tabs.vue +6 -6
  29. package/dist/runtime/components/Textarea.vue +172 -0
  30. package/dist/runtime/components/Toast.vue +2 -2
  31. package/dist/runtime/components/Toaster.vue +2 -1
  32. package/dist/runtime/components/Tooltip.vue +1 -1
  33. package/dist/runtime/composables/defineInjection.d.ts +11 -0
  34. package/dist/runtime/composables/defineInjection.mjs +9 -0
  35. package/dist/runtime/composables/useModal.d.ts +1 -1
  36. package/dist/runtime/composables/useModal.mjs +3 -2
  37. package/dist/runtime/composables/useTheme.d.ts +3 -1
  38. package/dist/runtime/composables/useTheme.mjs +14 -6
  39. package/dist/runtime/theme/accordion.mjs +24 -21
  40. package/dist/runtime/theme/alert.d.ts +85 -0
  41. package/dist/runtime/theme/alert.mjs +47 -0
  42. package/dist/runtime/theme/app.mjs +1 -0
  43. package/dist/runtime/theme/badge.d.ts +79 -0
  44. package/dist/runtime/theme/badge.mjs +89 -0
  45. package/dist/runtime/theme/button.d.ts +4 -9
  46. package/dist/runtime/theme/button.mjs +130 -127
  47. package/dist/runtime/theme/card.d.ts +2 -2
  48. package/dist/runtime/theme/card.mjs +12 -9
  49. package/dist/runtime/theme/checkbox.d.ts +0 -12
  50. package/dist/runtime/theme/checkbox.mjs +45 -47
  51. package/dist/runtime/theme/chip.d.ts +56 -0
  52. package/dist/runtime/theme/chip.mjs +63 -0
  53. package/dist/runtime/theme/drawer.mjs +69 -66
  54. package/dist/runtime/theme/index.d.ts +7 -0
  55. package/dist/runtime/theme/index.mjs +7 -0
  56. package/dist/runtime/theme/input.d.ts +13 -5
  57. package/dist/runtime/theme/input.mjs +135 -122
  58. package/dist/runtime/theme/link.d.ts +1 -1
  59. package/dist/runtime/theme/link.mjs +23 -20
  60. package/dist/runtime/theme/modal.mjs +51 -48
  61. package/dist/runtime/theme/pinInput.d.ts +97 -0
  62. package/dist/runtime/theme/pinInput.mjs +108 -0
  63. package/dist/runtime/theme/popover.mjs +11 -8
  64. package/dist/runtime/theme/radioGroup.d.ts +0 -24
  65. package/dist/runtime/theme/radioGroup.mjs +50 -59
  66. package/dist/runtime/theme/scrollArea.d.ts +51 -0
  67. package/dist/runtime/theme/scrollArea.mjs +33 -0
  68. package/dist/runtime/theme/select.d.ts +5 -2
  69. package/dist/runtime/theme/select.mjs +156 -143
  70. package/dist/runtime/theme/slider.d.ts +73 -0
  71. package/dist/runtime/theme/slider.mjs +49 -0
  72. package/dist/runtime/theme/switch.d.ts +0 -12
  73. package/dist/runtime/theme/switch.mjs +66 -69
  74. package/dist/runtime/theme/tabs.d.ts +44 -13
  75. package/dist/runtime/theme/tabs.mjs +132 -106
  76. package/dist/runtime/theme/textarea.d.ts +93 -0
  77. package/dist/runtime/theme/textarea.mjs +113 -0
  78. package/dist/runtime/theme/toast.mjs +26 -23
  79. package/dist/runtime/theme/toaster.d.ts +2 -2
  80. package/dist/runtime/theme/toaster.mjs +84 -81
  81. package/dist/runtime/theme/tooltip.mjs +9 -6
  82. package/dist/runtime/types/components.d.ts +7 -0
  83. package/dist/runtime/types/index.d.ts +1 -3
  84. package/dist/runtime/utils/extend-theme.mjs +1 -1
  85. package/dist/runtime/utils/index.d.ts +0 -11
  86. package/dist/runtime/utils/index.mjs +0 -11
  87. package/dist/runtime/utils/link.d.ts +1 -1
  88. package/dist/shared/ui.CzDyI29e.mjs +8 -0
  89. package/dist/shared/ui.CzDyI29e.mjs.map +1 -0
  90. package/dist/unocss-preset.d.mts +15 -7
  91. package/dist/unocss-preset.d.ts +15 -7
  92. package/dist/unocss-preset.mjs +97 -384
  93. package/dist/unocss-preset.mjs.map +1 -0
  94. package/dist/unplugin.d.mts +25 -0
  95. package/dist/unplugin.d.ts +25 -0
  96. package/dist/unplugin.mjs +64 -0
  97. package/dist/unplugin.mjs.map +1 -0
  98. package/dist/vite.d.mts +9 -0
  99. package/dist/vite.d.ts +9 -0
  100. package/dist/vite.mjs +14 -0
  101. package/dist/vite.mjs.map +1 -0
  102. package/package.json +22 -14
  103. package/dist/index.cjs +0 -38
  104. package/dist/resolver.d.mts +0 -13
  105. package/dist/resolver.d.ts +0 -13
  106. package/dist/resolver.mjs +0 -21
  107. package/dist/runtime/components/index.cjs +0 -132
  108. package/dist/runtime/components/index.d.ts +0 -18
  109. package/dist/runtime/components/index.mjs +0 -18
  110. package/dist/runtime/composables/index.cjs +0 -33
  111. package/dist/runtime/composables/index.d.ts +0 -4
  112. package/dist/runtime/composables/index.mjs +0 -4
  113. package/dist/runtime/composables/useComponentIcons.cjs +0 -30
  114. package/dist/runtime/composables/useModal.cjs +0 -55
  115. package/dist/runtime/composables/useTheme.cjs +0 -30
  116. package/dist/runtime/composables/useToast.cjs +0 -51
  117. package/dist/runtime/theme/accordion.cjs +0 -27
  118. package/dist/runtime/theme/app.cjs +0 -15
  119. package/dist/runtime/theme/button.cjs +0 -127
  120. package/dist/runtime/theme/card.cjs +0 -17
  121. package/dist/runtime/theme/checkbox.cjs +0 -56
  122. package/dist/runtime/theme/drawer.cjs +0 -73
  123. package/dist/runtime/theme/index.cjs +0 -125
  124. package/dist/runtime/theme/input.cjs +0 -115
  125. package/dist/runtime/theme/link.cjs +0 -23
  126. package/dist/runtime/theme/modal.cjs +0 -55
  127. package/dist/runtime/theme/popover.cjs +0 -13
  128. package/dist/runtime/theme/radioGroup.cjs +0 -73
  129. package/dist/runtime/theme/select.cjs +0 -128
  130. package/dist/runtime/theme/switch.cjs +0 -73
  131. package/dist/runtime/theme/tabs.cjs +0 -105
  132. package/dist/runtime/theme/toast.cjs +0 -33
  133. package/dist/runtime/theme/toaster.cjs +0 -72
  134. package/dist/runtime/theme/tooltip.cjs +0 -14
  135. package/dist/runtime/types/components.cjs +0 -1
  136. package/dist/runtime/types/index.cjs +0 -27
  137. package/dist/runtime/types/utils.cjs +0 -1
  138. package/dist/runtime/utils/extend-theme.cjs +0 -24
  139. package/dist/runtime/utils/index.cjs +0 -119
  140. package/dist/runtime/utils/link.cjs +0 -10
  141. package/dist/runtime/utils/styler.cjs +0 -18
  142. 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 UIResolver from '@byyuurin/ui/resolver'
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
- VueComponents({
81
- dts: 'src/typed-components.d.ts',
82
- resolvers: [
83
- UIResolver({
84
- prefix: 'U', // optional
85
- }),
86
- ],
87
- }),
88
- AutoImport({
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
- ## Thanks
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 * from './runtime/components';
2
- export * from './runtime/composables';
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 * from "./runtime/components/index.mjs";
2
- export * from "./runtime/composables/index.mjs";
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
@@ -4,7 +4,7 @@ interface ModuleOptions {
4
4
  /**
5
5
  * prefix for components used in templates
6
6
  *
7
- * @default ""
7
+ * @default "U"
8
8
  */
9
9
  prefix?: string;
10
10
  }
package/dist/nuxt.d.ts CHANGED
@@ -4,7 +4,7 @@ interface ModuleOptions {
4
4
  /**
5
5
  * prefix for components used in templates
6
6
  *
7
- * @default ""
7
+ * @default "U"
8
8
  */
9
9
  prefix?: string;
10
10
  }
package/dist/nuxt.mjs CHANGED
@@ -1,5 +1,7 @@
1
- import { defineNuxtModule, useLogger, addComponent } from '@nuxt/kit';
2
- import { p as packageName, c as componentNames } from './shared/ui.CPXA9QoM.mjs';
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
- for (const component of componentNames) {
22
- addComponent({
23
- name: `${options.prefix}${component}`,
24
- export: component,
25
- filePath: packageName
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, useTheme } from '../composables'
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="slots.default || props.label"
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 || slots.title || props.title || slots.description || props.description"
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="slots.title || props.title"
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="slots.description || props.description"
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 || (props.title || slots.title) || (props.description || slots.description)"
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, useTheme } from '../composables'
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 :as="as" :class="style.root({ class: [props.class, props.ui?.root] })" :aria-disabled="props.disabled ? true : undefined">
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 || (props.title || slots.title) || (props.description || slots.description) || (props.close || slots.close)"
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">