@byyuurin/ui 0.0.10 → 0.1.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 (289) 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 +48 -72
  6. package/dist/runtime/components/Accordion.vue.d.ts +74 -0
  7. package/dist/runtime/components/Alert.vue +65 -83
  8. package/dist/runtime/components/Alert.vue.d.ts +71 -0
  9. package/dist/runtime/components/App.vue +28 -42
  10. package/dist/runtime/components/App.vue.d.ts +26 -0
  11. package/dist/runtime/components/Avatar.vue +82 -58
  12. package/dist/runtime/components/Avatar.vue.d.ts +39 -0
  13. package/dist/runtime/components/AvatarGroup.vue +43 -70
  14. package/dist/runtime/components/AvatarGroup.vue.d.ts +30 -0
  15. package/dist/runtime/components/Badge.vue +70 -64
  16. package/dist/runtime/components/Badge.vue.d.ts +45 -0
  17. package/dist/runtime/components/Breadcrumb.vue +56 -76
  18. package/dist/runtime/components/Breadcrumb.vue.d.ts +79 -0
  19. package/dist/runtime/components/Button.vue +150 -78
  20. package/dist/runtime/components/Button.vue.d.ts +45 -0
  21. package/dist/runtime/components/Calendar.vue +99 -125
  22. package/dist/runtime/components/Calendar.vue.d.ts +102 -0
  23. package/dist/runtime/components/Card.vue +33 -46
  24. package/dist/runtime/components/Card.vue.d.ts +34 -0
  25. package/dist/runtime/components/Carousel.vue +164 -237
  26. package/dist/runtime/components/Carousel.vue.d.ts +125 -0
  27. package/dist/runtime/components/Checkbox.vue +86 -88
  28. package/dist/runtime/components/Checkbox.vue.d.ts +63 -0
  29. package/dist/runtime/components/Chip.vue +44 -58
  30. package/dist/runtime/components/Chip.vue.d.ts +48 -0
  31. package/dist/runtime/components/Collapsible.vue +29 -33
  32. package/dist/runtime/components/Collapsible.vue.d.ts +34 -0
  33. package/dist/runtime/components/Drawer.vue +110 -150
  34. package/dist/runtime/components/Drawer.vue.d.ts +103 -0
  35. package/dist/runtime/components/DropdownMenu.vue +49 -120
  36. package/dist/runtime/components/DropdownMenu.vue.d.ts +140 -0
  37. package/dist/runtime/components/DropdownMenuContent.vue +177 -143
  38. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
  39. package/dist/runtime/components/FieldGroup.vue +33 -0
  40. package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
  41. package/dist/runtime/components/Form.vue +245 -275
  42. package/dist/runtime/components/Form.vue.d.ts +103 -0
  43. package/dist/runtime/components/FormField.vue +108 -0
  44. package/dist/runtime/components/FormField.vue.d.ts +63 -0
  45. package/dist/runtime/components/Icon.vue +20 -0
  46. package/dist/runtime/components/Icon.vue.d.ts +9 -0
  47. package/dist/runtime/components/Input.vue +125 -156
  48. package/dist/runtime/components/Input.vue.d.ts +76 -0
  49. package/dist/runtime/components/InputNumber.vue +103 -130
  50. package/dist/runtime/components/InputNumber.vue.d.ts +191 -0
  51. package/dist/runtime/components/Kbd.vue +24 -39
  52. package/dist/runtime/components/Kbd.vue.d.ts +34 -0
  53. package/dist/runtime/components/Link.vue +105 -337
  54. package/dist/runtime/components/Link.vue.d.ts +95 -0
  55. package/dist/runtime/components/LinkBase.vue +31 -71
  56. package/dist/runtime/components/LinkBase.vue.d.ts +33 -0
  57. package/dist/runtime/components/Modal.vue +82 -103
  58. package/dist/runtime/components/Modal.vue.d.ts +96 -0
  59. package/dist/runtime/components/NavigationMenu.vue +336 -0
  60. package/dist/runtime/components/NavigationMenu.vue.d.ts +181 -0
  61. package/dist/runtime/components/OverlayProvider.vue +12 -16
  62. package/dist/runtime/components/OverlayProvider.vue.d.ts +3 -0
  63. package/dist/runtime/components/Pagination.vue +65 -139
  64. package/dist/runtime/components/Pagination.vue.d.ts +116 -0
  65. package/dist/runtime/components/PinInput.vue +78 -73
  66. package/dist/runtime/components/PinInput.vue.d.ts +54 -0
  67. package/dist/runtime/components/Popover.vue +60 -75
  68. package/dist/runtime/components/Popover.vue.d.ts +70 -0
  69. package/dist/runtime/components/Progress.vue +79 -126
  70. package/dist/runtime/components/Progress.vue.d.ts +63 -0
  71. package/dist/runtime/components/RadioGroup.vue +109 -140
  72. package/dist/runtime/components/RadioGroup.vue.d.ts +96 -0
  73. package/dist/runtime/components/ScrollArea.vue +50 -48
  74. package/dist/runtime/components/ScrollArea.vue.d.ts +21 -0
  75. package/dist/runtime/components/Select.vue +221 -221
  76. package/dist/runtime/components/Select.vue.d.ts +260 -0
  77. package/dist/runtime/components/Separator.vue +55 -47
  78. package/dist/runtime/components/Separator.vue.d.ts +48 -0
  79. package/dist/runtime/components/Skeleton.vue +25 -22
  80. package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
  81. package/dist/runtime/components/Slider.vue +73 -77
  82. package/dist/runtime/components/Slider.vue.d.ts +52 -0
  83. package/dist/runtime/components/Switch.vue +66 -77
  84. package/dist/runtime/components/Switch.vue.d.ts +58 -0
  85. package/dist/runtime/components/Table.vue +357 -215
  86. package/dist/runtime/components/Table.vue.d.ts +234 -0
  87. package/dist/runtime/components/Tabs.vue +90 -88
  88. package/dist/runtime/components/Tabs.vue.d.ts +97 -0
  89. package/dist/runtime/components/Textarea.vue +147 -146
  90. package/dist/runtime/components/Textarea.vue.d.ts +76 -0
  91. package/dist/runtime/components/Toast.vue +108 -90
  92. package/dist/runtime/components/Toast.vue.d.ts +152 -0
  93. package/dist/runtime/components/ToastProvider.vue +82 -109
  94. package/dist/runtime/components/ToastProvider.vue.d.ts +51 -0
  95. package/dist/runtime/components/Tooltip.vue +54 -53
  96. package/dist/runtime/components/Tooltip.vue.d.ts +53 -0
  97. package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
  98. package/dist/runtime/composables/defineShortcuts.js +129 -0
  99. package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
  100. package/dist/runtime/composables/useAvatarGroup.js +10 -3
  101. package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
  102. package/dist/runtime/composables/useComponentIcons.js +4 -4
  103. package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
  104. package/dist/runtime/composables/useFieldGroup.js +14 -0
  105. package/dist/runtime/composables/useFormField.d.ts +62 -0
  106. package/dist/runtime/composables/useFormField.js +99 -0
  107. package/dist/runtime/composables/useKbd.d.ts +3 -2
  108. package/dist/runtime/composables/useKbd.js +3 -2
  109. package/dist/runtime/composables/useLocale.d.ts +68 -5
  110. package/dist/runtime/composables/useLocale.js +11 -11
  111. package/dist/runtime/composables/useOverlay.d.ts +51 -15
  112. package/dist/runtime/composables/useOverlay.js +44 -30
  113. package/dist/runtime/composables/usePortal.d.ts +6 -0
  114. package/dist/runtime/composables/usePortal.js +17 -0
  115. package/dist/runtime/composables/useToast.d.ts +12 -5
  116. package/dist/runtime/composables/useToast.js +12 -7
  117. package/dist/runtime/locale/en.d.ts +30 -1
  118. package/dist/runtime/locale/en.js +2 -1
  119. package/dist/runtime/locale/index.d.ts +2 -2
  120. package/dist/runtime/locale/index.js +1 -1
  121. package/dist/runtime/locale/zh_tw.d.ts +31 -0
  122. package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
  123. package/dist/runtime/plugins/colors.d.ts +2 -0
  124. package/dist/runtime/plugins/colors.js +50 -0
  125. package/dist/runtime/types/app.config.d.ts +6 -0
  126. package/dist/runtime/types/form.d.ts +58 -17
  127. package/dist/runtime/types/form.js +11 -0
  128. package/dist/runtime/types/index.d.ts +51 -8
  129. package/dist/runtime/types/index.js +45 -2
  130. package/dist/runtime/types/input.d.ts +8 -0
  131. package/dist/runtime/types/locale.d.ts +5 -0
  132. package/dist/runtime/types/style.d.ts +33 -0
  133. package/dist/runtime/types/style.js +0 -0
  134. package/dist/runtime/types/unocss.d.ts +4 -0
  135. package/dist/runtime/types/utils.d.ts +38 -37
  136. package/dist/runtime/utils/form.d.ts +5 -1
  137. package/dist/runtime/utils/form.js +49 -0
  138. package/dist/runtime/utils/index.d.ts +10 -13
  139. package/dist/runtime/utils/index.js +41 -48
  140. package/dist/runtime/utils/link.d.ts +5 -6
  141. package/dist/runtime/utils/link.js +16 -2
  142. package/dist/runtime/utils/locale.d.ts +5 -0
  143. package/dist/runtime/utils/locale.js +10 -0
  144. package/dist/runtime/utils/style.d.ts +94 -0
  145. package/dist/runtime/utils/style.js +37 -0
  146. package/dist/runtime/vue/components/Icon.vue +15 -0
  147. package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
  148. package/dist/runtime/vue/components/Link.vue +163 -0
  149. package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
  150. package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
  151. package/dist/runtime/vue/composables/useAppConfig.js +4 -0
  152. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  153. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  154. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  155. package/dist/runtime/vue/plugins/head.js +9 -0
  156. package/dist/runtime/vue/stubs.d.ts +16 -1
  157. package/dist/runtime/vue/stubs.js +32 -1
  158. package/dist/setup.d.mts +13 -0
  159. package/dist/setup.mjs +12 -0
  160. package/dist/shared/ui.CzIlLITK.mjs +51 -0
  161. package/dist/shared/ui.DSyJHSTk.mjs +3787 -0
  162. package/dist/shared/ui.DpbffTXs.d.mts +84 -0
  163. package/dist/shared/ui.IulR-OYx.d.mts +64 -0
  164. package/dist/types.d.mts +3 -1
  165. package/dist/unocss.d.mts +12 -52
  166. package/dist/unocss.mjs +144 -253
  167. package/dist/unplugin.d.mts +13 -26
  168. package/dist/unplugin.mjs +193 -18
  169. package/dist/vite.d.mts +10 -1
  170. package/dist/vite.mjs +12 -3
  171. package/package.json +156 -87
  172. package/vue-plugin.d.ts +5 -0
  173. package/dist/module.cjs +0 -5
  174. package/dist/module.d.ts +0 -13
  175. package/dist/module.mjs.map +0 -1
  176. package/dist/runtime/app/injections.d.ts +0 -9307
  177. package/dist/runtime/app/injections.js +0 -61
  178. package/dist/runtime/components/ButtonGroup.vue +0 -46
  179. package/dist/runtime/components/FormItem.vue +0 -129
  180. package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
  181. package/dist/runtime/composables/useButtonGroup.js +0 -9
  182. package/dist/runtime/composables/useFormItem.d.ts +0 -27
  183. package/dist/runtime/composables/useFormItem.js +0 -64
  184. package/dist/runtime/composables/useTheme.d.ts +0 -9
  185. package/dist/runtime/composables/useTheme.js +0 -23
  186. package/dist/runtime/index.d.ts +0 -44
  187. package/dist/runtime/index.js +0 -44
  188. package/dist/runtime/locale/zh-tw.d.ts +0 -2
  189. package/dist/runtime/theme/accordion.d.ts +0 -56
  190. package/dist/runtime/theme/accordion.js +0 -28
  191. package/dist/runtime/theme/alert.d.ts +0 -125
  192. package/dist/runtime/theme/alert.js +0 -47
  193. package/dist/runtime/theme/app.d.ts +0 -19
  194. package/dist/runtime/theme/app.js +0 -19
  195. package/dist/runtime/theme/avatar-group.d.ts +0 -52
  196. package/dist/runtime/theme/avatar-group.js +0 -32
  197. package/dist/runtime/theme/avatar.d.ts +0 -56
  198. package/dist/runtime/theme/avatar.js +0 -34
  199. package/dist/runtime/theme/badge.d.ts +0 -82
  200. package/dist/runtime/theme/badge.js +0 -92
  201. package/dist/runtime/theme/breadcrumb.d.ts +0 -67
  202. package/dist/runtime/theme/breadcrumb.js +0 -44
  203. package/dist/runtime/theme/button-group.d.ts +0 -66
  204. package/dist/runtime/theme/button-group.js +0 -42
  205. package/dist/runtime/theme/button.d.ts +0 -190
  206. package/dist/runtime/theme/button.js +0 -164
  207. package/dist/runtime/theme/calendar.d.ts +0 -56
  208. package/dist/runtime/theme/calendar.js +0 -69
  209. package/dist/runtime/theme/card.d.ts +0 -62
  210. package/dist/runtime/theme/card.js +0 -37
  211. package/dist/runtime/theme/carousel.d.ts +0 -113
  212. package/dist/runtime/theme/carousel.js +0 -43
  213. package/dist/runtime/theme/checkbox.d.ts +0 -88
  214. package/dist/runtime/theme/checkbox.js +0 -54
  215. package/dist/runtime/theme/chip.d.ts +0 -67
  216. package/dist/runtime/theme/chip.js +0 -66
  217. package/dist/runtime/theme/collapsible.d.ts +0 -38
  218. package/dist/runtime/theme/collapsible.js +0 -10
  219. package/dist/runtime/theme/drawer.d.ts +0 -148
  220. package/dist/runtime/theme/drawer.js +0 -113
  221. package/dist/runtime/theme/dropdown-menu.d.ts +0 -71
  222. package/dist/runtime/theme/dropdown-menu.js +0 -83
  223. package/dist/runtime/theme/form-item.d.ts +0 -76
  224. package/dist/runtime/theme/form-item.js +0 -34
  225. package/dist/runtime/theme/form.d.ts +0 -8
  226. package/dist/runtime/theme/form.js +0 -7
  227. package/dist/runtime/theme/index.d.ts +0 -41
  228. package/dist/runtime/theme/index.js +0 -41
  229. package/dist/runtime/theme/input-number.d.ts +0 -121
  230. package/dist/runtime/theme/input-number.js +0 -95
  231. package/dist/runtime/theme/input.d.ts +0 -178
  232. package/dist/runtime/theme/input.js +0 -151
  233. package/dist/runtime/theme/kbd.d.ts +0 -39
  234. package/dist/runtime/theme/kbd.js +0 -26
  235. package/dist/runtime/theme/link.d.ts +0 -44
  236. package/dist/runtime/theme/link.js +0 -26
  237. package/dist/runtime/theme/modal.d.ts +0 -48
  238. package/dist/runtime/theme/modal.js +0 -55
  239. package/dist/runtime/theme/pagination.d.ts +0 -80
  240. package/dist/runtime/theme/pagination.js +0 -17
  241. package/dist/runtime/theme/pinInput.d.ts +0 -100
  242. package/dist/runtime/theme/pinInput.js +0 -111
  243. package/dist/runtime/theme/popover.d.ts +0 -38
  244. package/dist/runtime/theme/popover.js +0 -13
  245. package/dist/runtime/theme/progress.d.ts +0 -186
  246. package/dist/runtime/theme/progress.js +0 -95
  247. package/dist/runtime/theme/radio-group.d.ts +0 -110
  248. package/dist/runtime/theme/radio-group.js +0 -61
  249. package/dist/runtime/theme/scroll-area.d.ts +0 -73
  250. package/dist/runtime/theme/scroll-area.js +0 -33
  251. package/dist/runtime/theme/select.d.ts +0 -192
  252. package/dist/runtime/theme/select.js +0 -173
  253. package/dist/runtime/theme/separator.d.ts +0 -80
  254. package/dist/runtime/theme/separator.js +0 -53
  255. package/dist/runtime/theme/skeleton.d.ts +0 -8
  256. package/dist/runtime/theme/skeleton.js +0 -7
  257. package/dist/runtime/theme/slider.d.ts +0 -76
  258. package/dist/runtime/theme/slider.js +0 -52
  259. package/dist/runtime/theme/switch.d.ts +0 -122
  260. package/dist/runtime/theme/switch.js +0 -78
  261. package/dist/runtime/theme/table.d.ts +0 -92
  262. package/dist/runtime/theme/table.js +0 -36
  263. package/dist/runtime/theme/tabs.d.ts +0 -135
  264. package/dist/runtime/theme/tabs.js +0 -146
  265. package/dist/runtime/theme/textarea.d.ts +0 -96
  266. package/dist/runtime/theme/textarea.js +0 -116
  267. package/dist/runtime/theme/toast-provider.d.ts +0 -122
  268. package/dist/runtime/theme/toast-provider.js +0 -97
  269. package/dist/runtime/theme/toast.d.ts +0 -89
  270. package/dist/runtime/theme/toast.js +0 -35
  271. package/dist/runtime/theme/tooltip.d.ts +0 -44
  272. package/dist/runtime/theme/tooltip.js +0 -11
  273. package/dist/runtime/types/components.d.ts +0 -42
  274. package/dist/runtime/utils/extend-theme.d.ts +0 -9
  275. package/dist/runtime/utils/extend-theme.js +0 -27
  276. package/dist/runtime/utils/styler.d.ts +0 -4
  277. package/dist/runtime/utils/styler.js +0 -10
  278. package/dist/runtime/utils/translator.d.ts +0 -18
  279. package/dist/runtime/utils/translator.js +0 -8
  280. package/dist/shared/ui.3e7fad19.mjs +0 -5
  281. package/dist/shared/ui.3e7fad19.mjs.map +0 -1
  282. package/dist/types.d.ts +0 -1
  283. package/dist/unocss.d.ts +0 -52
  284. package/dist/unocss.mjs.map +0 -1
  285. package/dist/unplugin.d.ts +0 -26
  286. package/dist/unplugin.mjs.map +0 -1
  287. package/dist/vite.d.ts +0 -9
  288. package/dist/vite.mjs.map +0 -1
  289. /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, presetUno } 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
- presetUno(),
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.10",
3
+ "version": "0.1.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": "0.8.4",
10
- "unbuild": "2.0.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 { n as name, v as version } from './shared/ui.3e7fad19.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.DSyJHSTk.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,98 +1,74 @@
1
- <script lang="ts">
2
- import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui'
3
- import type { accordion } from '../theme'
4
- import type { ComponentAttrs, DynamicSlots } from '../types'
5
-
6
- export interface AccordionEmits extends AccordionRootEmits {}
7
-
8
- export interface AccordionItem {
9
- label?: string
10
- icon?: string
11
- trailingIcon?: string
12
- slot?: string
13
- content?: string
14
- /** A unique value for the accordion item. Defaults to the index. */
15
- value?: string
16
- disabled?: boolean
17
- [key: string]: any
18
- }
19
-
20
- type SlotProps<T extends AccordionItem> = (props: { item: T, index: number, open: boolean }) => any
21
-
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
-
30
- export interface AccordionProps<T extends AccordionItem = AccordionItem> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
31
- items?: T[]
32
- /**
33
- * The icon displayed on the right side of the trigger.
34
- * @default app.icons.chevronDown
35
- */
36
- trailingIcon?: string
37
- labelKey?: string
38
- }
1
+ <script>
2
+ import theme from "#build/ui/accordion";
39
3
  </script>
40
4
 
41
- <script setup lang="ts" generic="T extends AccordionItem">
42
- import { reactivePick } from '@vueuse/core'
43
- import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, useForwardPropsEmits } from 'reka-ui'
44
- import { computed } from 'vue'
45
- import { useTheme } from '../composables/useTheme'
46
- import { get } from '../utils'
47
-
48
- const props = withDefaults(defineProps<AccordionProps<T>>(), {
49
- type: 'single',
50
- collapsible: true,
51
- unmountOnHide: true,
52
- labelKey: 'label',
53
- })
54
-
55
- const emit = defineEmits<AccordionEmits>()
56
- const slots = defineSlots<AccordionSlots<T>>()
57
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'), emit)
58
-
59
- const { theme, generateStyle } = useTheme()
60
- const style = computed(() => generateStyle('accordion', props))
5
+ <script setup>
6
+ import { reactivePick } from "@vueuse/core";
7
+ import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, useForwardPropsEmits } from "reka-ui";
8
+ import { computed } from "vue";
9
+ import { useAppConfig } from "#imports";
10
+ import { get } from "../utils";
11
+ import { cv, merge } from "../utils/style";
12
+ import Icon from "./Icon.vue";
13
+ const props = defineProps({
14
+ as: { type: null, required: false },
15
+ items: { type: Array, required: false },
16
+ trailingIcon: { type: [String, Object], required: false },
17
+ labelKey: { type: null, required: false, default: "label" },
18
+ ui: { type: null, required: false },
19
+ class: { type: [Object, String, Number, Boolean, null, Array], required: false, skipCheck: true },
20
+ collapsible: { type: Boolean, required: false, default: true },
21
+ defaultValue: { type: null, required: false },
22
+ modelValue: { type: null, required: false },
23
+ type: { type: String, required: false, default: "single" },
24
+ disabled: { type: Boolean, required: false },
25
+ unmountOnHide: { type: Boolean, required: false, default: true }
26
+ });
27
+ const emit = defineEmits(["update:modelValue"]);
28
+ const slots = defineSlots();
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
+ });
61
35
  </script>
62
36
 
63
37
  <template>
64
- <AccordionRoot v-bind="rootProps" :class="style.root({ class: [props.class, props.ui?.root] })">
38
+ <AccordionRoot v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })" data-part="root">
65
39
  <AccordionItem
66
40
  v-for="(item, index) in props.items"
67
41
  v-slot="{ open }"
68
42
  :key="index"
69
43
  :value="item.value || String(index)"
70
44
  :disabled="item.disabled"
71
- :class="style.item({ class: props.ui?.item })"
45
+ :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })"
46
+ data-part="item"
72
47
  >
73
- <AccordionHeader :class="style.header({ class: props.ui?.header })">
74
- <AccordionTrigger :class="style.trigger({ class: props.ui?.trigger, disabled: item.disabled })">
75
- <slot name="leading" v-bind="{ item, index, open }">
76
- <span v-if="item.icon" :class="style.leadingIcon({ class: [item.icon, props.ui?.leadingIcon] })"></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="leading-icon" />
77
52
  </slot>
78
53
 
79
- <span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })">
54
+ <span v-if="get(item, props.labelKey) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })" data-part="label">
80
55
  <slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
81
56
  </span>
82
57
 
83
- <slot name="trailing" v-bind="{ item, index, open }">
84
- <span :class="style.trailingIcon({ class: [item.trailingIcon || props.trailingIcon || theme.app.icons.chevronDown, props.ui?.trailingIcon] })"></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="trailing-icon" />
85
60
  </slot>
86
61
  </AccordionTrigger>
87
62
  </AccordionHeader>
88
63
 
89
64
  <AccordionContent
90
- v-if="item.content || slots.content || (item.slot && slots[item.slot as keyof AccordionSlots<T>]) || slots.body || (item.slot && slots[`${item.slot}-body` as keyof AccordionSlots<T>])"
91
- :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] })"
67
+ data-part="content"
92
68
  >
93
- <slot :name="((item.slot || 'content') as keyof AccordionSlots<T>)" v-bind="{ item, index, open }">
94
- <div :class="style.body({ class: props.ui?.body })">
95
- <slot :name="((item.slot ? `${item.slot}-body` : 'body') as keyof AccordionSlots<T>)" 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">
96
72
  {{ item.content }}
97
73
  </slot>
98
74
  </div>
@@ -0,0 +1,74 @@
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 {
6
+ label?: string;
7
+ icon?: IconProps['name'];
8
+ trailingIcon?: IconProps['name'];
9
+ slot?: string;
10
+ content?: string;
11
+ /** A unique value for the accordion item. Defaults to the index. */
12
+ value?: string;
13
+ disabled?: boolean;
14
+ ui?: Pick<ComponentUIProps<typeof theme>, 'item' | 'header' | 'trigger' | 'leadingIcon' | 'label' | 'trailingIcon' | 'content' | 'body'>;
15
+ [key: string]: any;
16
+ }
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'];
23
+ items?: T[];
24
+ /**
25
+ * The icon displayed on the right side of the trigger.
26
+ * @default app.icons.chevronDown
27
+ */
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
+ }
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;
64
+ attrs: any;
65
+ slots: AccordionSlots<T>;
66
+ emit: (evt: "update:modelValue", value: string | string[] | undefined) => void;
67
+ }>) => import("vue").VNode & {
68
+ __ctx?: Awaited<typeof __VLS_setup>;
69
+ };
70
+ declare const _default: typeof __VLS_export;
71
+ export default _default;
72
+ type __VLS_PrettifyLocal<T> = {
73
+ [K in keyof T as K]: T[K];
74
+ } & {};