@byyuurin/ui 0.0.11 → 0.2.0

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 (297) hide show
  1. package/README.md +170 -58
  2. package/dist/module.d.mts +4 -13
  3. package/dist/module.json +4 -4
  4. package/dist/module.mjs +54 -20
  5. package/dist/runtime/components/Accordion.vue +28 -23
  6. package/dist/runtime/components/Accordion.vue.d.ts +51 -29
  7. package/dist/runtime/components/Alert.vue +47 -27
  8. package/dist/runtime/components/Alert.vue.d.ts +37 -25
  9. package/dist/runtime/components/App.vue +9 -8
  10. package/dist/runtime/components/App.vue.d.ts +22 -20
  11. package/dist/runtime/components/Avatar.vue +65 -21
  12. package/dist/runtime/components/Avatar.vue.d.ts +27 -13
  13. package/dist/runtime/components/AvatarGroup.vue +14 -10
  14. package/dist/runtime/components/AvatarGroup.vue.d.ts +12 -9
  15. package/dist/runtime/components/Badge.vue +64 -32
  16. package/dist/runtime/components/Badge.vue.d.ts +30 -29
  17. package/dist/runtime/components/Breadcrumb.vue +40 -22
  18. package/dist/runtime/components/Breadcrumb.vue.d.ts +48 -21
  19. package/dist/runtime/components/Button.vue +113 -52
  20. package/dist/runtime/components/Button.vue.d.ts +36 -20
  21. package/dist/runtime/components/Calendar.vue +50 -43
  22. package/dist/runtime/components/Calendar.vue.d.ts +58 -31
  23. package/dist/runtime/components/Card.vue +18 -14
  24. package/dist/runtime/components/Card.vue.d.ts +18 -14
  25. package/dist/runtime/components/Carousel.vue +99 -46
  26. package/dist/runtime/components/Carousel.vue.d.ts +46 -25
  27. package/dist/runtime/components/Checkbox.vue +60 -35
  28. package/dist/runtime/components/Checkbox.vue.d.ts +35 -28
  29. package/dist/runtime/components/CheckboxGroup.vue +131 -0
  30. package/dist/runtime/components/CheckboxGroup.vue.d.ts +89 -0
  31. package/dist/runtime/components/Chip.vue +35 -32
  32. package/dist/runtime/components/Chip.vue.d.ts +33 -15
  33. package/dist/runtime/components/Collapsible.vue +13 -9
  34. package/dist/runtime/components/Collapsible.vue.d.ts +16 -8
  35. package/dist/runtime/components/Drawer.vue +80 -70
  36. package/dist/runtime/components/Drawer.vue.d.ts +51 -28
  37. package/dist/runtime/components/DropdownMenu.vue +23 -16
  38. package/dist/runtime/components/DropdownMenu.vue.d.ts +77 -36
  39. package/dist/runtime/components/DropdownMenuContent.vue +136 -106
  40. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +38 -26
  41. package/dist/runtime/components/FieldGroup.vue +33 -0
  42. package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
  43. package/dist/runtime/components/Form.vue +172 -88
  44. package/dist/runtime/components/Form.vue.d.ts +69 -44
  45. package/dist/runtime/components/FormField.vue +108 -0
  46. package/dist/runtime/components/FormField.vue.d.ts +63 -0
  47. package/dist/runtime/components/Icon.vue +20 -0
  48. package/dist/runtime/components/Icon.vue.d.ts +9 -0
  49. package/dist/runtime/components/Input.vue +84 -79
  50. package/dist/runtime/components/Input.vue.d.ts +55 -43
  51. package/dist/runtime/components/InputNumber.vue +66 -52
  52. package/dist/runtime/components/InputNumber.vue.d.ts +50 -109
  53. package/dist/runtime/components/InputTags.vue +155 -0
  54. package/dist/runtime/components/InputTags.vue.d.ts +85 -0
  55. package/dist/runtime/components/Kbd.vue +11 -5
  56. package/dist/runtime/components/Kbd.vue.d.ts +17 -11
  57. package/dist/runtime/components/Link.vue +54 -197
  58. package/dist/runtime/components/Link.vue.d.ts +17 -17
  59. package/dist/runtime/components/LinkBase.vue +11 -33
  60. package/dist/runtime/components/LinkBase.vue.d.ts +8 -3
  61. package/dist/runtime/components/Marquee.vue +38 -0
  62. package/dist/runtime/components/Marquee.vue.d.ts +54 -0
  63. package/dist/runtime/components/Modal.vue +53 -39
  64. package/dist/runtime/components/Modal.vue.d.ts +64 -34
  65. package/dist/runtime/components/NavigationMenu.vue +345 -0
  66. package/dist/runtime/components/NavigationMenu.vue.d.ts +216 -0
  67. package/dist/runtime/components/OverlayProvider.vue +3 -3
  68. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -1
  69. package/dist/runtime/components/Pagination.vue +39 -47
  70. package/dist/runtime/components/Pagination.vue.d.ts +54 -31
  71. package/dist/runtime/components/PinInput.vue +46 -32
  72. package/dist/runtime/components/PinInput.vue.d.ts +40 -21
  73. package/dist/runtime/components/Popover.vue +33 -19
  74. package/dist/runtime/components/Popover.vue.d.ts +57 -32
  75. package/dist/runtime/components/Progress.vue +31 -26
  76. package/dist/runtime/components/Progress.vue.d.ts +32 -23
  77. package/dist/runtime/components/RadioGroup.vue +75 -48
  78. package/dist/runtime/components/RadioGroup.vue.d.ts +58 -36
  79. package/dist/runtime/components/ScrollArea.vue +33 -31
  80. package/dist/runtime/components/ScrollArea.vue.d.ts +9 -5
  81. package/dist/runtime/components/Select.vue +166 -76
  82. package/dist/runtime/components/Select.vue.d.ts +206 -65
  83. package/dist/runtime/components/Separator.vue +42 -16
  84. package/dist/runtime/components/Separator.vue.d.ts +35 -14
  85. package/dist/runtime/components/Skeleton.vue +18 -6
  86. package/dist/runtime/components/Skeleton.vue.d.ts +4 -4
  87. package/dist/runtime/components/Slider.vue +42 -24
  88. package/dist/runtime/components/Slider.vue.d.ts +43 -27
  89. package/dist/runtime/components/Switch.vue +40 -31
  90. package/dist/runtime/components/Switch.vue.d.ts +36 -27
  91. package/dist/runtime/components/Table.vue +329 -79
  92. package/dist/runtime/components/Table.vue.d.ts +152 -66
  93. package/dist/runtime/components/Tabs.vue +70 -23
  94. package/dist/runtime/components/Tabs.vue.d.ts +61 -29
  95. package/dist/runtime/components/Textarea.vue +102 -54
  96. package/dist/runtime/components/Textarea.vue.d.ts +57 -41
  97. package/dist/runtime/components/Timeline.vue +102 -0
  98. package/dist/runtime/components/Timeline.vue.d.ts +74 -0
  99. package/dist/runtime/components/Toast.vue +84 -38
  100. package/dist/runtime/components/Toast.vue.d.ts +48 -27
  101. package/dist/runtime/components/ToastProvider.vue +31 -22
  102. package/dist/runtime/components/ToastProvider.vue.d.ts +30 -17
  103. package/dist/runtime/components/Tooltip.vue +33 -21
  104. package/dist/runtime/components/Tooltip.vue.d.ts +37 -15
  105. package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
  106. package/dist/runtime/composables/defineShortcuts.js +129 -0
  107. package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
  108. package/dist/runtime/composables/useAvatarGroup.js +10 -3
  109. package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
  110. package/dist/runtime/composables/useComponentIcons.js +4 -4
  111. package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
  112. package/dist/runtime/composables/useFieldGroup.js +14 -0
  113. package/dist/runtime/composables/useFormField.d.ts +62 -0
  114. package/dist/runtime/composables/useFormField.js +99 -0
  115. package/dist/runtime/composables/useKbd.d.ts +3 -2
  116. package/dist/runtime/composables/useKbd.js +3 -2
  117. package/dist/runtime/composables/useLocale.d.ts +68 -5
  118. package/dist/runtime/composables/useLocale.js +11 -11
  119. package/dist/runtime/composables/useOverlay.d.ts +51 -15
  120. package/dist/runtime/composables/useOverlay.js +44 -30
  121. package/dist/runtime/composables/usePortal.d.ts +6 -0
  122. package/dist/runtime/composables/usePortal.js +17 -0
  123. package/dist/runtime/composables/useToast.d.ts +12 -5
  124. package/dist/runtime/composables/useToast.js +12 -7
  125. package/dist/runtime/locale/en.d.ts +30 -1
  126. package/dist/runtime/locale/en.js +2 -1
  127. package/dist/runtime/locale/index.d.ts +2 -2
  128. package/dist/runtime/locale/index.js +1 -1
  129. package/dist/runtime/locale/zh_tw.d.ts +31 -0
  130. package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
  131. package/dist/runtime/plugins/colors.d.ts +2 -0
  132. package/dist/runtime/plugins/colors.js +50 -0
  133. package/dist/runtime/types/app.config.d.ts +6 -0
  134. package/dist/runtime/types/form.d.ts +58 -17
  135. package/dist/runtime/types/form.js +11 -0
  136. package/dist/runtime/types/index.d.ts +56 -8
  137. package/dist/runtime/types/index.js +49 -1
  138. package/dist/runtime/types/input.d.ts +8 -0
  139. package/dist/runtime/types/locale.d.ts +5 -0
  140. package/dist/runtime/types/style.d.ts +33 -0
  141. package/dist/runtime/types/style.js +0 -0
  142. package/dist/runtime/types/unocss.d.ts +4 -0
  143. package/dist/runtime/types/utils.d.ts +41 -37
  144. package/dist/runtime/utils/form.d.ts +5 -1
  145. package/dist/runtime/utils/form.js +49 -0
  146. package/dist/runtime/utils/index.d.ts +10 -13
  147. package/dist/runtime/utils/index.js +41 -48
  148. package/dist/runtime/utils/link.d.ts +3 -2
  149. package/dist/runtime/utils/link.js +16 -2
  150. package/dist/runtime/utils/locale.d.ts +5 -0
  151. package/dist/runtime/utils/locale.js +10 -0
  152. package/dist/runtime/utils/style.d.ts +94 -0
  153. package/dist/runtime/utils/style.js +37 -0
  154. package/dist/runtime/vue/components/Icon.vue +15 -0
  155. package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
  156. package/dist/runtime/vue/components/Link.vue +163 -0
  157. package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
  158. package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
  159. package/dist/runtime/vue/composables/useAppConfig.js +4 -0
  160. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  161. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  162. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  163. package/dist/runtime/vue/plugins/head.js +9 -0
  164. package/dist/runtime/vue/stubs.d.ts +16 -1
  165. package/dist/runtime/vue/stubs.js +32 -1
  166. package/dist/setup.d.mts +13 -0
  167. package/dist/setup.mjs +12 -0
  168. package/dist/shared/ui.CzIlLITK.mjs +51 -0
  169. package/dist/shared/ui.DLOxhmP0.mjs +4242 -0
  170. package/dist/shared/ui.DpbffTXs.d.mts +84 -0
  171. package/dist/shared/ui.IulR-OYx.d.mts +64 -0
  172. package/dist/types.d.mts +3 -1
  173. package/dist/unocss.d.mts +12 -52
  174. package/dist/unocss.mjs +144 -254
  175. package/dist/unplugin.d.mts +13 -26
  176. package/dist/unplugin.mjs +193 -18
  177. package/dist/vite.d.mts +10 -1
  178. package/dist/vite.mjs +12 -3
  179. package/package.json +154 -87
  180. package/vue-plugin.d.ts +5 -0
  181. package/dist/module.d.ts +0 -13
  182. package/dist/module.mjs.map +0 -1
  183. package/dist/runtime/app/injections.d.ts +0 -9331
  184. package/dist/runtime/app/injections.js +0 -61
  185. package/dist/runtime/components/ButtonGroup.vue +0 -26
  186. package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -26
  187. package/dist/runtime/components/FormItem.vue +0 -90
  188. package/dist/runtime/components/FormItem.vue.d.ts +0 -60
  189. package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
  190. package/dist/runtime/composables/useButtonGroup.js +0 -9
  191. package/dist/runtime/composables/useFormItem.d.ts +0 -27
  192. package/dist/runtime/composables/useFormItem.js +0 -64
  193. package/dist/runtime/composables/useTheme.d.ts +0 -9
  194. package/dist/runtime/composables/useTheme.js +0 -23
  195. package/dist/runtime/index.d.ts +0 -44
  196. package/dist/runtime/index.js +0 -44
  197. package/dist/runtime/locale/zh-tw.d.ts +0 -2
  198. package/dist/runtime/theme/accordion.d.ts +0 -50
  199. package/dist/runtime/theme/accordion.js +0 -28
  200. package/dist/runtime/theme/alert.d.ts +0 -119
  201. package/dist/runtime/theme/alert.js +0 -47
  202. package/dist/runtime/theme/app.d.ts +0 -19
  203. package/dist/runtime/theme/app.js +0 -19
  204. package/dist/runtime/theme/avatar-group.d.ts +0 -46
  205. package/dist/runtime/theme/avatar-group.js +0 -32
  206. package/dist/runtime/theme/avatar.d.ts +0 -50
  207. package/dist/runtime/theme/avatar.js +0 -34
  208. package/dist/runtime/theme/badge.d.ts +0 -76
  209. package/dist/runtime/theme/badge.js +0 -92
  210. package/dist/runtime/theme/breadcrumb.d.ts +0 -61
  211. package/dist/runtime/theme/breadcrumb.js +0 -44
  212. package/dist/runtime/theme/button-group.d.ts +0 -60
  213. package/dist/runtime/theme/button-group.js +0 -42
  214. package/dist/runtime/theme/button.d.ts +0 -184
  215. package/dist/runtime/theme/button.js +0 -164
  216. package/dist/runtime/theme/calendar.d.ts +0 -58
  217. package/dist/runtime/theme/calendar.js +0 -86
  218. package/dist/runtime/theme/card.d.ts +0 -56
  219. package/dist/runtime/theme/card.js +0 -37
  220. package/dist/runtime/theme/carousel.d.ts +0 -107
  221. package/dist/runtime/theme/carousel.js +0 -43
  222. package/dist/runtime/theme/checkbox.d.ts +0 -82
  223. package/dist/runtime/theme/checkbox.js +0 -54
  224. package/dist/runtime/theme/chip.d.ts +0 -61
  225. package/dist/runtime/theme/chip.js +0 -66
  226. package/dist/runtime/theme/collapsible.d.ts +0 -32
  227. package/dist/runtime/theme/collapsible.js +0 -10
  228. package/dist/runtime/theme/drawer.d.ts +0 -142
  229. package/dist/runtime/theme/drawer.js +0 -113
  230. package/dist/runtime/theme/dropdown-menu.d.ts +0 -65
  231. package/dist/runtime/theme/dropdown-menu.js +0 -83
  232. package/dist/runtime/theme/form-item.d.ts +0 -70
  233. package/dist/runtime/theme/form-item.js +0 -34
  234. package/dist/runtime/theme/form.d.ts +0 -2
  235. package/dist/runtime/theme/form.js +0 -7
  236. package/dist/runtime/theme/index.d.ts +0 -41
  237. package/dist/runtime/theme/index.js +0 -41
  238. package/dist/runtime/theme/input-number.d.ts +0 -115
  239. package/dist/runtime/theme/input-number.js +0 -95
  240. package/dist/runtime/theme/input.d.ts +0 -172
  241. package/dist/runtime/theme/input.js +0 -151
  242. package/dist/runtime/theme/kbd.d.ts +0 -33
  243. package/dist/runtime/theme/kbd.js +0 -26
  244. package/dist/runtime/theme/link.d.ts +0 -38
  245. package/dist/runtime/theme/link.js +0 -26
  246. package/dist/runtime/theme/modal.d.ts +0 -42
  247. package/dist/runtime/theme/modal.js +0 -55
  248. package/dist/runtime/theme/pagination.d.ts +0 -74
  249. package/dist/runtime/theme/pagination.js +0 -17
  250. package/dist/runtime/theme/pinInput.d.ts +0 -94
  251. package/dist/runtime/theme/pinInput.js +0 -111
  252. package/dist/runtime/theme/popover.d.ts +0 -32
  253. package/dist/runtime/theme/popover.js +0 -13
  254. package/dist/runtime/theme/progress.d.ts +0 -180
  255. package/dist/runtime/theme/progress.js +0 -95
  256. package/dist/runtime/theme/radio-group.d.ts +0 -104
  257. package/dist/runtime/theme/radio-group.js +0 -61
  258. package/dist/runtime/theme/scroll-area.d.ts +0 -67
  259. package/dist/runtime/theme/scroll-area.js +0 -33
  260. package/dist/runtime/theme/select.d.ts +0 -186
  261. package/dist/runtime/theme/select.js +0 -173
  262. package/dist/runtime/theme/separator.d.ts +0 -74
  263. package/dist/runtime/theme/separator.js +0 -53
  264. package/dist/runtime/theme/skeleton.d.ts +0 -2
  265. package/dist/runtime/theme/skeleton.js +0 -7
  266. package/dist/runtime/theme/slider.d.ts +0 -70
  267. package/dist/runtime/theme/slider.js +0 -52
  268. package/dist/runtime/theme/switch.d.ts +0 -116
  269. package/dist/runtime/theme/switch.js +0 -78
  270. package/dist/runtime/theme/table.d.ts +0 -86
  271. package/dist/runtime/theme/table.js +0 -36
  272. package/dist/runtime/theme/tabs.d.ts +0 -129
  273. package/dist/runtime/theme/tabs.js +0 -146
  274. package/dist/runtime/theme/textarea.d.ts +0 -90
  275. package/dist/runtime/theme/textarea.js +0 -116
  276. package/dist/runtime/theme/toast-provider.d.ts +0 -116
  277. package/dist/runtime/theme/toast-provider.js +0 -97
  278. package/dist/runtime/theme/toast.d.ts +0 -83
  279. package/dist/runtime/theme/toast.js +0 -35
  280. package/dist/runtime/theme/tooltip.d.ts +0 -38
  281. package/dist/runtime/theme/tooltip.js +0 -11
  282. package/dist/runtime/types/components.d.ts +0 -42
  283. package/dist/runtime/utils/extend-theme.d.ts +0 -9
  284. package/dist/runtime/utils/extend-theme.js +0 -27
  285. package/dist/runtime/utils/styler.d.ts +0 -4
  286. package/dist/runtime/utils/styler.js +0 -10
  287. package/dist/runtime/utils/translator.d.ts +0 -18
  288. package/dist/runtime/utils/translator.js +0 -8
  289. package/dist/shared/ui.D1BTWZFB.mjs +0 -5
  290. package/dist/shared/ui.D1BTWZFB.mjs.map +0 -1
  291. package/dist/unocss.d.ts +0 -52
  292. package/dist/unocss.mjs.map +0 -1
  293. package/dist/unplugin.d.ts +0 -26
  294. package/dist/unplugin.mjs.map +0 -1
  295. package/dist/vite.d.ts +0 -9
  296. package/dist/vite.mjs.map +0 -1
  297. /package/dist/runtime/types/{components.js → input.js} +0 -0
package/README.md CHANGED
@@ -12,104 +12,216 @@ https://byyuurin-ui.netlify.app/
12
12
 
13
13
  ## Installation
14
14
 
15
- ```ssh
16
- pnpm i -D unocss @unocss/reset @byyuurin/ui
15
+ ```bash [pnpm]
16
+ pnpm add @byyuurin/ui
17
17
  ```
18
18
 
19
- icons
19
+ ```bash [yarn]
20
+ yarn add @byyuurin/ui
21
+ ```
20
22
 
21
- ```ssh
22
- pnpm i -D @iconify-json/[the-collection-you-want]
23
+ ```bash [npm]
24
+ npm install @byyuurin/ui
23
25
  ```
24
26
 
25
- ## Setup
27
+ > [!WARNING]
28
+ > If you're using pnpm, ensure that you either set [`shamefully-hoist=true`](https://pnpm.io/settings#shamefully-hoist) in your `.npmrc` file or install `@byyuurin/ui-kit` in your project's root directory.
29
+
30
+ ### Nuxt
26
31
 
27
- ### UnoCSS
32
+ 1. Add the UI module in your `nuxt.config.ts`:
28
33
 
29
34
  ```ts
30
- // uno.config.ts
31
- import { preset as ui } from '@byyuurin/ui/unocss'
32
- import { defineConfig, presetIcons, presetWind3 } from 'unocss'
35
+ export default defineNuxtConfig({
36
+ modules: [
37
+ '@byyuurin/ui',
38
+ ],
39
+
40
+ ui: {
41
+ prefix: 'U',
42
+ colorMode: true,
43
+ theme: {
44
+ colors: ['primary', 'secondary', 'success', 'info', 'warning', 'error'],
45
+ transitions: true,
46
+ defaultVariants: {
47
+ color: 'primary',
48
+ size: 'md',
49
+ },
50
+ },
51
+ },
52
+ })
53
+ ```
54
+
55
+ 2. Add UnoCSS preset in your `uno.config.ts`:
56
+
57
+ ```ts
58
+ import { createUnoPreset } from '@byyuurin/ui/unocss'
59
+ import { defineConfig, presetWind4 } from 'unocss'
33
60
 
34
61
  export default defineConfig({
35
62
  presets: [
36
- presetWind3(),
37
- presetIcons({
38
- cdn: 'https://esm.sh/', // OR install @iconify-json/[the-collection-you-want]
39
- }),
40
- ui({
41
- radius: '0rem', // optional
42
- radiusBox: '0rem', // optional
43
- radiusButton: '0rem', // optional
44
- radiusCheckbox: '0rem', // optional
45
- radiusRadio: '0rem', // optional
46
- radiusSwitch: '0rem', // optional
47
- radiusTabs: '0rem', // optional
48
- cb: '#1f2937', // optional
49
- cp: '#1f2937', // optional
50
- cx: '#ffffff', // optional
63
+ presetWind4(),
64
+ createUnoPreset({
65
+ colors: ['primary', 'secondary', 'success', 'info', 'warning', 'error'],
51
66
  }),
52
67
  ],
53
68
  })
54
69
  ```
55
70
 
56
- New Rules
71
+ > [!IMPORTANT]
72
+ > The preset colors configuration must be the same as your nuxt configuration
57
73
 
58
- - `ui-[color]`
59
- - `bg-soft-[color]`
60
- - `bg-soft-[color]/[mix-ratio]`
74
+ ### Vue
61
75
 
62
- ### Vite
76
+ 1. Create `ui.config.ts` file for unified management of UI settings:
63
77
 
64
78
  ```ts
65
- // vite.config.ts
79
+ // @unocss-include
80
+ import { setup } from '@byyuurin/ui/setup'
81
+
82
+ export default setup({
83
+ prefix: 'U',
84
+ autoImport: {
85
+ // ... unplugin-auto-import options
86
+ },
87
+ components: {
88
+ // ... unplugin-vue-components options
89
+ },
90
+ colorMode: true,
91
+ theme: {
92
+ colors: ['primary', 'secondary', 'success', 'info', 'warning', 'error'],
93
+ transitions: true,
94
+ defaultVariants: {
95
+ color: 'primary',
96
+ size: 'md',
97
+ },
98
+ },
99
+ ui: {
100
+ colors: {
101
+ primary: 'green',
102
+ secondary: 'blue',
103
+ success: 'green',
104
+ info: 'blue',
105
+ warning: 'yellow',
106
+ error: 'red',
107
+ neutral: 'slate',
108
+ },
109
+ icons: {
110
+ close: 'i-lucide-x',
111
+ loading: 'i-lucide-loader-circle',
112
+ check: 'i-lucide-check',
113
+ chevronUp: 'i-lucide-chevron-up',
114
+ chevronDown: 'i-lucide-chevron-down',
115
+ chevronLeft: 'i-lucide-chevron-left',
116
+ chevronRight: 'i-lucide-chevron-right',
117
+ chevronDoubleLeft: 'i-lucide-chevrons-left',
118
+ chevronDoubleRight: 'i-lucide-chevrons-right',
119
+ ellipsis: 'i-lucide-ellipsis',
120
+ plus: 'i-lucide-plus',
121
+ minus: 'i-lucide-minus',
122
+ external: 'i-lucide-arrow-up-right',
123
+ },
124
+ },
125
+ })
126
+ ```
127
+
128
+ > [!IMPORTANT]
129
+ > Add `// @unocss-include` to add ui.config.ts to unocss scan files
130
+
131
+ > [!NOTE]
132
+ > Internally relies on custom alias to resolve the theme types. If you're using TypeScript, you should add an alias to your tsconfig to enable auto-completion in your ui.config.ts.
133
+
134
+ ```jsonc
135
+ // tsconfig.node.json
66
136
 
67
- import UI from '@byyuurin/ui/vite'
68
- import Vue from '@vitejs/plugin-vue'
69
- import UnoCSS from 'unocss/vite'
137
+ {
138
+ "compilerOptions": {
139
+ "paths": {
140
+ "#build/*": ["./node_modules/.nuxt/*"]
141
+ }
142
+ }
143
+ }
144
+ ```
145
+
146
+ 2. Add the UI Vite plugin in your `vite.config.ts`:
147
+
148
+ ```ts
149
+ import ui from '@byyuurin/ui/vite' // <---
150
+ import vue from '@vitejs/plugin-vue'
151
+ import unocss from 'unocss/vite'
70
152
  import { defineConfig } from 'vite'
153
+ import uiConfig from './ui.config' // <---
71
154
 
72
155
  export default defineConfig({
73
156
  plugins: [
74
- UnoCSS(),
75
- Vue(),
76
- UI({
77
- prefix: 'U', // optional
78
- autoImport: {
79
- dts: 'src/typed-imports.d.ts',
80
- imports: ['vue'],
81
- },
82
- components: {
83
- dts: 'src/typed-components.d.ts',
157
+ unocss(),
158
+ vue(),
159
+ ui(uiConfig.vite), // <---
160
+ ],
161
+ })
162
+ ```
163
+
164
+ 3. Add UnoCSS preset in your `uno.config.ts`:
165
+
166
+ ```ts
167
+ import { createUnoPreset } from '@byyuurin/ui/unocss' // <---
168
+ import { defineConfig, presetWebFonts, presetWind4 } from 'unocss'
169
+ import uiConfig from './ui.config' // <---
170
+
171
+ export default defineConfig({
172
+ presets: [
173
+ presetWind4(),
174
+ createUnoPreset(uiConfig.uno), // <---
175
+ presetWebFonts({
176
+ fonts: {
177
+ sans: { provider: 'google', name: 'Public Sans', weights: [400, 500, 600, 700] },
84
178
  },
85
179
  }),
86
180
  ],
87
181
  })
88
182
  ```
89
183
 
90
- ### Nuxt
184
+ 4. Add the UI Vue plugin in your `src/main.ts`
91
185
 
92
186
  ```ts
93
- // nuxt.config.ts
187
+ import 'uno.css'
94
188
 
95
- export default defineNuxtConfig({
96
- modules: [
97
- '@unocss/nuxt',
98
- '@byyuurin/ui/nuxt',
99
- ],
100
- css: [
101
- '@unocss/reset/tailwind.css',
102
- ],
103
- ui: {
104
- prefix: 'U', // optional
105
- },
189
+ import ui from '@byyuurin/ui/vue-plugin' // <---
190
+ import { createApp } from 'vue'
191
+ import { createRouter, createWebHistory } from 'vue-router'
192
+ import App from './App.vue'
193
+
194
+ const app = createApp(App)
195
+
196
+ const router = createRouter({
197
+ routes: [],
198
+ history: createWebHistory(),
106
199
  })
200
+
201
+ app.use(ui) // <----
202
+ app.use(router)
203
+
204
+ app.mount('#app')
205
+ ```
206
+
207
+ 5. Add the `isolate` class to your root container
208
+
209
+ ```html
210
+ <!doctype html>
211
+ <html lang="en">
212
+ <head>
213
+ ...
214
+ </head>
215
+ <body>
216
+ <div id="app" class="isolate"></div>
217
+ <script type="module" src="/src/main.ts"></script>
218
+ </body>
219
+ </html>
107
220
  ```
108
221
 
109
222
  ## Credits
110
223
 
111
224
  - [UnoCSS](https://github.com/unocss/unocss)
112
- - [daisyui](https://github.com/saadeghi/daisyui)
113
225
  - [@nuxt/ui](https://github.com/nuxt/ui)
114
226
  - [Reka UI](https://github.com/unovue/radix-vue)
115
227
  - [VueUse](https://github.com/vueuse/vueuse)
package/dist/module.d.mts CHANGED
@@ -1,13 +1,4 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
-
3
- interface ModuleOptions {
4
- /**
5
- * prefix for components used in templates
6
- *
7
- * @default "U"
8
- */
9
- prefix?: string;
10
- }
11
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
12
-
13
- export { type ModuleOptions, _default as default };
1
+ import '@nuxt/schema';
2
+ export { M as ModuleOptions, _ as default } from './shared/ui.IulR-OYx.mjs';
3
+ export * from '../dist/runtime/types/index.js';
4
+ import '@unocss/preset-wind4/colors';
package/dist/module.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@byyuurin/ui",
3
- "version": "0.0.11",
3
+ "version": "0.2.0",
4
4
  "configKey": "ui",
5
5
  "compatibility": {
6
- "nuxt": ">=3.13.1"
6
+ "nuxt": ">=3.16.2"
7
7
  },
8
8
  "builder": {
9
- "@nuxt/module-builder": "1.0.1",
10
- "unbuild": "3.5.0"
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "3.6.1"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -1,37 +1,71 @@
1
- import { defineNuxtModule, useLogger, createResolver, hasNuxtModule, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
- import { v as version, n as name } from './shared/ui.D1BTWZFB.mjs';
1
+ import { defineNuxtModule, createResolver, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
2
+ import { defu } from 'defu';
3
+ import { v as version, n as name, a as addTemplates } from './shared/ui.DLOxhmP0.mjs';
4
+ import { d as defaultOptions, r as resolveColors, g as getDefaultUIConfig } from './shared/ui.CzIlLITK.mjs';
5
+ import 'node:process';
6
+ import 'node:url';
7
+ import '@unocss/config';
8
+ import 'knitwork';
9
+ import 'scule';
10
+ import '@byyuurin/ui-kit';
11
+ import '../dist/runtime/utils/index.js';
3
12
 
4
13
  const module = defineNuxtModule({
5
14
  meta: {
6
- name: name,
7
- version: version,
15
+ name,
16
+ version,
8
17
  configKey: "ui",
9
18
  compatibility: {
10
- nuxt: ">=3.13.1"
19
+ nuxt: ">=3.16.2"
11
20
  }
12
21
  },
13
- defaults: {
14
- prefix: "U"
15
- },
16
- setup(options, nuxt) {
17
- const logger = useLogger(name);
22
+ defaults: defaultOptions,
23
+ async setup(options, nuxt) {
18
24
  const { resolve } = createResolver(import.meta.url);
19
- if (!hasNuxtModule("@unocss/nuxt")) {
20
- logger.error(`\`${name}\` requires the \`@unocss/nuxt\` module to be installed.`);
21
- return;
22
- }
23
- nuxt.options.vite.optimizeDeps ??= {};
24
- nuxt.options.vite.optimizeDeps.include ??= [];
25
- nuxt.options.vite.optimizeDeps.include.push(`${name}/unocss`);
25
+ options.theme ||= {};
26
+ options.theme.colors = resolveColors(options.theme.colors);
27
+ nuxt.options.ui = options;
26
28
  nuxt.options.alias["#ui"] = resolve("./runtime");
29
+ nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui || {}, getDefaultUIConfig(options.theme.colors));
30
+ nuxt.options.app.rootAttrs ||= {};
31
+ nuxt.options.app.rootAttrs.class = [nuxt.options.app.rootAttrs.class, "isolate"].filter(Boolean).join(" ");
32
+ async function registerModule(name2, key, options2) {
33
+ if (hasNuxtModule(name2))
34
+ nuxt.options[key] = defu(nuxt.options[key], options2);
35
+ else
36
+ await installModule(name2, defu(nuxt.options[key], options2));
37
+ }
38
+ await registerModule("@unocss/nuxt", "unocss", {
39
+ preflight: false,
40
+ wind3: false,
41
+ wind4: true,
42
+ mergeSelectors: false
43
+ });
44
+ await registerModule("@nuxt/icon", "icon", {
45
+ cssLayer: "components"
46
+ });
47
+ if (options.fonts) {
48
+ await registerModule("@nuxt/fonts", "fonts", {
49
+ defaults: {
50
+ weights: [400, 500, 600, 700]
51
+ }
52
+ });
53
+ }
54
+ if (options.colorMode) {
55
+ await registerModule("@nuxtjs/color-mode", "colorMode", {
56
+ classSuffix: "",
57
+ disableTransition: true
58
+ });
59
+ }
60
+ addPlugin({ src: resolve("./runtime/plugins/colors") });
27
61
  addComponentsDir({
28
62
  path: resolve("./runtime/components"),
29
- prefix: options.prefix,
30
- pathPrefix: false
63
+ pathPrefix: false,
64
+ prefix: options.prefix
31
65
  });
32
66
  addImportsDir(resolve("./runtime/composables"));
67
+ addTemplates(options, nuxt, resolve);
33
68
  }
34
69
  });
35
70
 
36
71
  export { module as default };
37
- //# sourceMappingURL=module.mjs.map
@@ -1,20 +1,22 @@
1
1
  <script>
2
-
2
+ import theme from "#build/ui/accordion";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
6
  import { reactivePick } from "@vueuse/core";
7
7
  import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, useForwardPropsEmits } from "reka-ui";
8
8
  import { computed } from "vue";
9
- import { useTheme } from "../composables/useTheme";
9
+ import { useAppConfig } from "#imports";
10
10
  import { get } from "../utils";
11
+ import { cv, merge } from "../utils/style";
12
+ import Icon from "./Icon.vue";
11
13
  const props = defineProps({
14
+ as: { type: null, required: false },
12
15
  items: { type: Array, required: false },
13
- trailingIcon: { type: String, required: false },
14
- labelKey: { type: String, required: false, default: "label" },
15
- class: { type: null, required: false },
16
+ trailingIcon: { type: [String, Object], required: false },
17
+ labelKey: { type: null, required: false, default: "label" },
16
18
  ui: { type: null, required: false },
17
- as: { type: null, required: false },
19
+ class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
18
20
  collapsible: { type: Boolean, required: false, default: true },
19
21
  defaultValue: { type: null, required: false },
20
22
  modelValue: { type: null, required: false },
@@ -24,46 +26,49 @@ const props = defineProps({
24
26
  });
25
27
  const emit = defineEmits(["update:modelValue"]);
26
28
  const slots = defineSlots();
27
- const rootProps = useForwardPropsEmits(reactivePick(props, "as", "collapsible", "defaultValue", "disabled", "modelValue", "type", "unmountOnHide"), emit);
28
- const { theme, generateStyle } = useTheme();
29
- const style = computed(() => generateStyle("accordion", props));
29
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "collapsible", "defaultValue", "disabled", "modelValue", "unmountOnHide"), emit);
30
+ const appConfig = useAppConfig();
31
+ const ui = computed(() => {
32
+ const styler = cv(merge(theme, appConfig.ui.accordion));
33
+ return styler(props);
34
+ });
30
35
  </script>
31
36
 
32
37
  <template>
33
- <AccordionRoot v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })" data-part="root">
38
+ <AccordionRoot v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
34
39
  <AccordionItem
35
40
  v-for="(item, index) in props.items"
36
41
  v-slot="{ open }"
37
42
  :key="index"
38
43
  :value="item.value || String(index)"
39
44
  :disabled="item.disabled"
40
- :class="style.item({ class: props.ui?.item })"
45
+ :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })"
41
46
  data-part="item"
42
47
  >
43
- <AccordionHeader :class="style.header({ class: props.ui?.header })" data-part="header">
44
- <AccordionTrigger :class="style.trigger({ class: props.ui?.trigger, disabled: item.disabled })" data-part="trigger">
45
- <slot name="leading" v-bind="{ item, index, open }">
46
- <span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })" data-part="leading-icon"></span>
48
+ <AccordionHeader as="div" :class="ui.header({ class: [props.ui?.header, item.ui?.header] })" data-part="header">
49
+ <AccordionTrigger :class="ui.trigger({ class: [props.ui?.trigger, item.ui?.trigger], disabled: item.disabled })" data-part="trigger">
50
+ <slot name="leading" v-bind="{ item, index, open, ui }">
51
+ <Icon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: [props.ui?.leadingIcon, item.ui?.leadingIcon] })" data-part="leadingIcon" />
47
52
  </slot>
48
53
 
49
- <span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })" data-part="label">
54
+ <span v-if="get(item, props.labelKey) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })" data-part="label">
50
55
  <slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
51
56
  </span>
52
57
 
53
- <slot name="trailing" v-bind="{ item, index, open }">
54
- <span :class="style.trailingIcon({ class: [item.trailingIcon || props.trailingIcon || theme.app.icons.chevronDown, props.ui?.trailingIcon] })" data-part="trailing-icon"></span>
58
+ <slot name="trailing" v-bind="{ item, index, open, ui }">
59
+ <Icon :name="item.trailingIcon || props.trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.trailingIcon({ class: [props.ui?.trailingIcon, item.ui?.trailingIcon] })" data-part="trailingIcon" />
55
60
  </slot>
56
61
  </AccordionTrigger>
57
62
  </AccordionHeader>
58
63
 
59
64
  <AccordionContent
60
- v-if="item.content || slots.content || item.slot && slots[item.slot] || slots.body || item.slot && slots[`${item.slot}-body`]"
61
- :class="style.content({ class: props.ui?.content })"
65
+ v-if="item.content || !!slots.content || item.slot && slots[item.slot] || !!slots.body || item.slot && slots[`${item.slot}-body`]"
66
+ :class="ui.content({ class: [props.ui?.content, item.ui?.content] })"
62
67
  data-part="content"
63
68
  >
64
- <slot :name="item.slot || 'content'" v-bind="{ item, index, open }">
65
- <div :class="style.body({ class: props.ui?.body })" data-part="body">
66
- <slot :name="item.slot ? `${item.slot}-body` : 'body'" v-bind="{ item, index, open }">
69
+ <slot :name="item.slot || 'content'" :item="item" :index="index" :open="open" :ui="ui">
70
+ <div :class="ui.body({ class: [props.ui?.body, item.ui?.body] })" data-part="body">
71
+ <slot :name="item.slot ? `${item.slot}-body` : 'body'" :item="item" :index="index" :open="open" :ui="ui">
67
72
  {{ item.content }}
68
73
  </slot>
69
74
  </div>
@@ -1,52 +1,74 @@
1
- import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui';
2
- import type { accordion } from '../theme/index.js';
3
- import type { ComponentAttrs, DynamicSlots } from '../types/index.js';
4
- export interface AccordionEmits extends AccordionRootEmits {
5
- }
6
- export interface AccordionItem {
1
+ import type { AccordionRootEmits, AccordionRootProps, PrimitiveProps } from 'reka-ui';
2
+ import theme from '#build/ui/accordion';
3
+ import type { ComponentBaseProps, ComponentStyler, ComponentUIProps, IconProps } from '../types';
4
+ import type { DynamicSlots, GetItemKeys, StaticSlot } from '../types/utils';
5
+ export interface AccordionItem extends ComponentBaseProps {
7
6
  label?: string;
8
- icon?: string;
9
- trailingIcon?: string;
7
+ icon?: IconProps['name'];
8
+ trailingIcon?: IconProps['name'];
10
9
  slot?: string;
11
10
  content?: string;
12
11
  /** A unique value for the accordion item. Defaults to the index. */
13
12
  value?: string;
14
13
  disabled?: boolean;
14
+ ui?: Pick<ComponentUIProps<typeof theme>, 'item' | 'header' | 'trigger' | 'leadingIcon' | 'label' | 'trailingIcon' | 'content' | 'body'>;
15
15
  [key: string]: any;
16
16
  }
17
- type SlotProps<T extends AccordionItem> = (props: {
18
- item: T;
19
- index: number;
20
- open: boolean;
21
- }) => any;
22
- export type AccordionSlots<T extends AccordionItem = AccordionItem> = {
23
- default?: SlotProps<T>;
24
- leading?: SlotProps<T>;
25
- trailing?: SlotProps<T>;
26
- content?: SlotProps<T>;
27
- body?: SlotProps<T>;
28
- } & DynamicSlots<T, 'body', SlotProps<T>>;
29
- export interface AccordionProps<T extends AccordionItem = AccordionItem> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
17
+ export interface AccordionProps<T extends AccordionItem = AccordionItem> extends ComponentBaseProps, Pick<AccordionRootProps, 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
18
+ /**
19
+ * The element or component this component should render as.
20
+ * @default "div"
21
+ */
22
+ as?: PrimitiveProps['as'];
30
23
  items?: T[];
31
24
  /**
32
25
  * The icon displayed on the right side of the trigger.
33
26
  * @default app.icons.chevronDown
34
27
  */
35
- trailingIcon?: string;
36
- labelKey?: string;
28
+ trailingIcon?: IconProps['name'];
29
+ /**
30
+ * The key used to get the label from the item.
31
+ * @default "label"
32
+ */
33
+ labelKey?: GetItemKeys<T>;
34
+ ui?: ComponentUIProps<typeof theme>;
35
+ }
36
+ export interface AccordionEmits extends AccordionRootEmits {
37
37
  }
38
- declare const _default: <T extends AccordionItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
39
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
40
- readonly "onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
41
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & AccordionProps<T> & Partial<{}>> & import("vue").PublicProps;
42
- expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
38
+ type SlotProps<T extends AccordionItem> = StaticSlot<{
39
+ item: T;
40
+ index: number;
41
+ open: boolean;
42
+ ui: ComponentStyler<typeof theme>;
43
+ }>;
44
+ export type AccordionSlots<T extends AccordionItem = AccordionItem> = {
45
+ default: StaticSlot<{
46
+ item: T;
47
+ index: number;
48
+ open: boolean;
49
+ }>;
50
+ leading: SlotProps<T>;
51
+ trailing: SlotProps<T>;
52
+ content: SlotProps<T>;
53
+ body: SlotProps<T>;
54
+ } & DynamicSlots<T, 'body', {
55
+ index: number;
56
+ open: boolean;
57
+ ui: ComponentStyler<typeof theme>;
58
+ }>;
59
+ declare const __VLS_export: <T extends AccordionItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
60
+ props: __VLS_PrettifyLocal<AccordionProps<T> & {
61
+ "onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
62
+ }> & import("vue").PublicProps;
63
+ expose: (exposed: {}) => void;
43
64
  attrs: any;
44
65
  slots: AccordionSlots<T>;
45
66
  emit: (evt: "update:modelValue", value: string | string[] | undefined) => void;
46
67
  }>) => import("vue").VNode & {
47
68
  __ctx?: Awaited<typeof __VLS_setup>;
48
69
  };
70
+ declare const _default: typeof __VLS_export;
49
71
  export default _default;
50
72
  type __VLS_PrettifyLocal<T> = {
51
- [K in keyof T]: T[K];
73
+ [K in keyof T as K]: T[K];
52
74
  } & {};