@byyuurin/ui 0.0.6 → 0.0.7

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 (143) hide show
  1. package/README.md +4 -5
  2. package/dist/module.cjs +5 -0
  3. package/dist/module.json +12 -0
  4. package/dist/{nuxt.mjs → module.mjs} +4 -4
  5. package/dist/module.mjs.map +1 -0
  6. package/dist/runtime/components/Accordion.vue +20 -31
  7. package/dist/runtime/components/Alert.vue +1 -1
  8. package/dist/runtime/components/Button.vue +10 -11
  9. package/dist/runtime/components/Card.vue +9 -6
  10. package/dist/runtime/components/Checkbox.vue +3 -3
  11. package/dist/runtime/components/Chip.vue +2 -2
  12. package/dist/runtime/components/Collapsible.vue +56 -0
  13. package/dist/runtime/components/Drawer.vue +4 -2
  14. package/dist/runtime/components/Input.vue +4 -4
  15. package/dist/runtime/components/InputNumber.vue +167 -0
  16. package/dist/runtime/components/Link.vue +301 -72
  17. package/dist/runtime/components/LinkBase.vue +88 -0
  18. package/dist/runtime/components/Modal.vue +0 -1
  19. package/dist/runtime/components/Select.vue +4 -4
  20. package/dist/runtime/components/Separator.vue +63 -0
  21. package/dist/runtime/components/Switch.vue +3 -3
  22. package/dist/runtime/components/Table.vue +292 -0
  23. package/dist/runtime/components/Tabs.vue +17 -17
  24. package/dist/runtime/components/Toast.vue +1 -1
  25. package/dist/runtime/components/Toaster.vue +1 -35
  26. package/dist/runtime/composables/useButtonGroup.d.ts +1 -1
  27. package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +1 -1
  28. package/dist/runtime/composables/{useComponentIcons.mjs → useComponentIcons.js} +1 -1
  29. package/dist/runtime/composables/useModal.d.ts +1 -1
  30. package/dist/runtime/composables/{useModal.mjs → useModal.js} +1 -1
  31. package/dist/runtime/composables/useTheme.d.ts +3 -3
  32. package/dist/runtime/composables/{useTheme.mjs → useTheme.js} +3 -3
  33. package/dist/runtime/composables/useToast.d.ts +1 -1
  34. package/dist/runtime/index.d.ts +34 -0
  35. package/dist/runtime/index.js +34 -0
  36. package/dist/runtime/theme/accordion.d.ts +8 -8
  37. package/dist/runtime/theme/{accordion.mjs → accordion.js} +2 -2
  38. package/dist/runtime/theme/alert.d.ts +2 -2
  39. package/dist/runtime/theme/{alert.mjs → alert.js} +4 -4
  40. package/dist/runtime/theme/app.d.ts +3 -0
  41. package/dist/runtime/theme/{app.mjs → app.js} +4 -1
  42. package/dist/runtime/theme/badge.d.ts +45 -21
  43. package/dist/runtime/theme/{badge.mjs → badge.js} +2 -2
  44. package/dist/runtime/theme/button-group.d.ts +2 -2
  45. package/dist/runtime/theme/button.d.ts +57 -111
  46. package/dist/runtime/theme/button.js +164 -0
  47. package/dist/runtime/theme/card.d.ts +38 -38
  48. package/dist/runtime/theme/card.js +37 -0
  49. package/dist/runtime/theme/carousel.d.ts +2 -2
  50. package/dist/runtime/theme/{carousel.mjs → carousel.js} +2 -2
  51. package/dist/runtime/theme/checkbox.d.ts +1 -1
  52. package/dist/runtime/theme/{checkbox.mjs → checkbox.js} +3 -3
  53. package/dist/runtime/theme/chip.d.ts +45 -12
  54. package/dist/runtime/theme/{chip.mjs → chip.js} +5 -7
  55. package/dist/runtime/theme/collapsible.d.ts +38 -0
  56. package/dist/runtime/theme/collapsible.js +10 -0
  57. package/dist/runtime/theme/drawer.d.ts +43 -43
  58. package/dist/runtime/theme/{drawer.mjs → drawer.js} +33 -22
  59. package/dist/runtime/theme/index.d.ts +31 -27
  60. package/dist/runtime/theme/index.js +31 -0
  61. package/dist/runtime/theme/input-number.d.ts +135 -0
  62. package/dist/runtime/theme/input-number.js +92 -0
  63. package/dist/runtime/theme/input.d.ts +71 -99
  64. package/dist/runtime/theme/{input.mjs → input.js} +14 -14
  65. package/dist/runtime/theme/link.d.ts +2 -2
  66. package/dist/runtime/theme/{link.mjs → link.js} +1 -1
  67. package/dist/runtime/theme/modal.d.ts +31 -8
  68. package/dist/runtime/theme/{modal.mjs → modal.js} +4 -9
  69. package/dist/runtime/theme/pagination.d.ts +17 -17
  70. package/dist/runtime/theme/pinInput.d.ts +42 -42
  71. package/dist/runtime/theme/{pinInput.mjs → pinInput.js} +10 -10
  72. package/dist/runtime/theme/popover.d.ts +8 -8
  73. package/dist/runtime/theme/{popover.mjs → popover.js} +1 -1
  74. package/dist/runtime/theme/radio-group.d.ts +1 -1
  75. package/dist/runtime/theme/{radio-group.mjs → radio-group.js} +1 -1
  76. package/dist/runtime/theme/scroll-area.d.ts +17 -17
  77. package/dist/runtime/theme/{scroll-area.mjs → scroll-area.js} +2 -2
  78. package/dist/runtime/theme/select.d.ts +84 -99
  79. package/dist/runtime/theme/{select.mjs → select.js} +17 -17
  80. package/dist/runtime/theme/separator.d.ts +95 -0
  81. package/dist/runtime/theme/separator.js +53 -0
  82. package/dist/runtime/theme/slider.d.ts +1 -1
  83. package/dist/runtime/theme/{slider.mjs → slider.js} +3 -3
  84. package/dist/runtime/theme/switch.d.ts +1 -1
  85. package/dist/runtime/theme/{switch.mjs → switch.js} +2 -2
  86. package/dist/runtime/theme/table.d.ts +89 -0
  87. package/dist/runtime/theme/table.js +35 -0
  88. package/dist/runtime/theme/tabs.d.ts +69 -52
  89. package/dist/runtime/theme/{tabs.mjs → tabs.js} +11 -11
  90. package/dist/runtime/theme/textarea.d.ts +43 -37
  91. package/dist/runtime/theme/{textarea.mjs → textarea.js} +10 -10
  92. package/dist/runtime/theme/toast.d.ts +2 -2
  93. package/dist/runtime/theme/{toast.mjs → toast.js} +1 -1
  94. package/dist/runtime/theme/toaster.d.ts +42 -27
  95. package/dist/runtime/theme/tooltip.d.ts +11 -11
  96. package/dist/runtime/theme/tooltip.js +11 -0
  97. package/dist/runtime/types/components.d.ts +31 -27
  98. package/dist/runtime/types/index.d.ts +4 -4
  99. package/dist/runtime/types/index.js +2 -0
  100. package/dist/runtime/types/utils.js +0 -0
  101. package/dist/runtime/utils/index.d.ts +3 -3
  102. package/dist/runtime/utils/{index.mjs → index.js} +3 -3
  103. package/dist/runtime/utils/link.d.ts +22 -7
  104. package/dist/runtime/utils/link.js +30 -0
  105. package/dist/runtime/utils/styler.d.ts +1 -1
  106. package/dist/runtime/vue/stubs.d.ts +9 -0
  107. package/dist/runtime/vue/stubs.js +16 -0
  108. package/dist/shared/{ui.D4zm1r0C.mjs → ui.d1728164.mjs} +1 -1
  109. package/dist/shared/ui.d1728164.mjs.map +1 -0
  110. package/dist/types.d.mts +1 -0
  111. package/dist/types.d.ts +1 -0
  112. package/dist/unocss.d.mts +6 -11
  113. package/dist/unocss.d.ts +6 -11
  114. package/dist/unocss.mjs +40 -21
  115. package/dist/unocss.mjs.map +1 -1
  116. package/dist/unplugin.mjs +37 -1
  117. package/dist/unplugin.mjs.map +1 -1
  118. package/dist/vite.d.mts +0 -1
  119. package/dist/vite.d.ts +0 -1
  120. package/dist/vite.mjs +3 -1
  121. package/dist/vite.mjs.map +1 -1
  122. package/package.json +37 -36
  123. package/dist/index.d.ts +0 -29
  124. package/dist/index.mjs +0 -29
  125. package/dist/nuxt.mjs.map +0 -1
  126. package/dist/runtime/theme/button.mjs +0 -148
  127. package/dist/runtime/theme/card.mjs +0 -14
  128. package/dist/runtime/theme/index.mjs +0 -27
  129. package/dist/runtime/theme/tooltip.mjs +0 -11
  130. package/dist/runtime/types/components.mjs +0 -27
  131. package/dist/runtime/types/index.mjs +0 -2
  132. package/dist/runtime/utils/link.mjs +0 -4
  133. package/dist/shared/ui.D4zm1r0C.mjs.map +0 -1
  134. /package/dist/{nuxt.d.mts → module.d.mts} +0 -0
  135. /package/dist/{nuxt.d.ts → module.d.ts} +0 -0
  136. /package/dist/runtime/composables/{defineInjection.mjs → defineInjection.js} +0 -0
  137. /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
  138. /package/dist/runtime/theme/{button-group.mjs → button-group.js} +0 -0
  139. /package/dist/runtime/theme/{pagination.mjs → pagination.js} +0 -0
  140. /package/dist/runtime/theme/{toaster.mjs → toaster.js} +0 -0
  141. /package/dist/runtime/types/{utils.mjs → components.js} +0 -0
  142. /package/dist/runtime/utils/{extend-theme.mjs → extend-theme.js} +0 -0
  143. /package/dist/runtime/utils/{styler.mjs → styler.js} +0 -0
package/README.md CHANGED
@@ -47,9 +47,8 @@ export default defineConfig({
47
47
  radiusSwitch: '0rem', // optional
48
48
  radiusTabs: '0rem', // optional
49
49
  cb: '#1f2937', // optional
50
- c1: '#ffffff', // optional
51
- c2: '#f2f2f2', // optional
52
- c3: '#e5e6e6', // optional
50
+ cp: '#1f2937', // optional
51
+ cx: '#ffffff', // optional
53
52
  }),
54
53
  ],
55
54
  })
@@ -58,8 +57,8 @@ export default defineConfig({
58
57
  New Rules
59
58
 
60
59
  - `ui-[color]`
61
- - `bg-solid-[color]`
62
- - `bg-solid-[color]/[opacity]`
60
+ - `bg-soft-[color]`
61
+ - `bg-soft-[color]/[mix-ratio]`
63
62
 
64
63
  ### Vite
65
64
 
@@ -0,0 +1,5 @@
1
+ module.exports = function(...args) {
2
+ return import('./module.mjs').then(m => m.default.call(this, ...args))
3
+ }
4
+ const _meta = module.exports.meta = require('./module.json')
5
+ module.exports.getMeta = () => Promise.resolve(_meta)
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@byyuurin/ui",
3
+ "configKey": "ui",
4
+ "compatibility": {
5
+ "nuxt": ">=3.13.1"
6
+ },
7
+ "version": "0.0.7",
8
+ "builder": {
9
+ "@nuxt/module-builder": "0.8.4",
10
+ "unbuild": "2.0.0"
11
+ }
12
+ }
@@ -1,7 +1,7 @@
1
1
  import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
- import { p as packageName } from './shared/ui.D4zm1r0C.mjs';
2
+ import { p as packageName } from './shared/ui.d1728164.mjs';
3
3
 
4
- const nuxt = defineNuxtModule({
4
+ const module = defineNuxtModule({
5
5
  meta: {
6
6
  name: packageName,
7
7
  configKey: "ui",
@@ -32,5 +32,5 @@ const nuxt = defineNuxtModule({
32
32
  }
33
33
  });
34
34
 
35
- export { nuxt as default };
36
- //# sourceMappingURL=nuxt.mjs.map
35
+ export { module as default };
36
+ //# sourceMappingURL=module.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import { addComponentsDir, addImportsDir, createResolver, defineNuxtModule, useLogger } from '@nuxt/kit'\nimport { packageName } from './shared'\n\nexport interface ModuleOptions {\n /**\n * prefix for components used in templates\n *\n * @default \"U\"\n */\n prefix?: string\n}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: packageName,\n configKey: 'ui',\n compatibility: {\n nuxt: '>=3.13.1',\n },\n },\n defaults: {\n prefix: 'U',\n },\n setup(options, nuxt) {\n const logger = useLogger(packageName)\n const { resolve } = createResolver(import.meta.url)\n\n // Make sure the UnoCSS Nuxt module is installed\n if (!nuxt.options.modules.includes('@unocss/nuxt')) {\n logger.error(`\\`${packageName}\\` requires the \\`@unocss/nuxt\\` module to be installed.`)\n return\n }\n\n nuxt.options.vite.optimizeDeps ??= {}\n nuxt.options.vite.optimizeDeps.include ??= []\n nuxt.options.vite.optimizeDeps.include.push(`${packageName}/unocss`)\n\n nuxt.options.alias['#ui'] = resolve('./runtime')\n\n addComponentsDir({\n path: resolve('./runtime/components'),\n prefix: options.prefix,\n pathPrefix: false,\n })\n\n addImportsDir(resolve('./runtime/composables'))\n },\n})\n"],"names":[],"mappings":";;;AAYA,eAAe,gBAAgC,CAAA;AAAA,EAC7C,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,WAAA;AAAA,IACN,SAAW,EAAA,IAAA;AAAA,IACX,aAAe,EAAA;AAAA,MACb,IAAM,EAAA,UAAA;AAAA,KACR;AAAA,GACF;AAAA,EACA,QAAU,EAAA;AAAA,IACR,MAAQ,EAAA,GAAA;AAAA,GACV;AAAA,EACA,KAAA,CAAM,SAAS,IAAM,EAAA;AACnB,IAAM,MAAA,MAAA,GAAS,UAAU,WAAW,CAAA,CAAA;AACpC,IAAA,MAAM,EAAE,OAAA,EAAY,GAAA,cAAA,CAAe,YAAY,GAAG,CAAA,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,CAAA;AACvF,MAAA,OAAA;AAAA,KACF;AAEA,IAAK,IAAA,CAAA,OAAA,CAAQ,IAAK,CAAA,YAAA,KAAiB,EAAC,CAAA;AACpC,IAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAK,YAAa,CAAA,OAAA,KAAY,EAAC,CAAA;AAC5C,IAAA,IAAA,CAAK,QAAQ,IAAK,CAAA,YAAA,CAAa,QAAQ,IAAK,CAAA,CAAA,EAAG,WAAW,CAAS,OAAA,CAAA,CAAA,CAAA;AAEnE,IAAA,IAAA,CAAK,OAAQ,CAAA,KAAA,CAAM,KAAK,CAAA,GAAI,QAAQ,WAAW,CAAA,CAAA;AAE/C,IAAiB,gBAAA,CAAA;AAAA,MACf,IAAA,EAAM,QAAQ,sBAAsB,CAAA;AAAA,MACpC,QAAQ,OAAQ,CAAA,MAAA;AAAA,MAChB,UAAY,EAAA,KAAA;AAAA,KACb,CAAA,CAAA;AAED,IAAc,aAAA,CAAA,OAAA,CAAQ,uBAAuB,CAAC,CAAA,CAAA;AAAA,GAChD;AACF,CAAC,CAAA;;;;"}
@@ -1,12 +1,12 @@
1
1
  <script lang="ts">
2
- import type { AccordionRootEmits, AccordionRootProps, PrimitiveProps } from 'reka-ui'
2
+ import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui'
3
3
  import type { accordion } from '../theme'
4
- import type { ComponentAttrs, DynamicSlots } from '../types'
4
+ import type { ComponentAttrs } from '../types'
5
5
 
6
6
  export interface AccordionItem {
7
7
  label?: string
8
8
  icon?: string
9
- trailingIcon?: string
9
+ suffixIcon?: string
10
10
  slot?: string
11
11
  content?: string
12
12
  /** A unique value for the accordion item. Defaults to the index. */
@@ -20,14 +20,19 @@ type SlotProps<T> = (props: { item: T, index: number, open: boolean }) => any
20
20
 
21
21
  export type AccordionSlots<T extends { slot?: string }> = {
22
22
  default?: SlotProps<T>
23
- icon?: SlotProps<T>
23
+ prefix?: SlotProps<T>
24
+ suffix?: SlotProps<T>
24
25
  content?: SlotProps<T>
25
26
  body?: SlotProps<T>
26
- } & DynamicSlots<T, SlotProps<T>>
27
+ } & Record<string, SlotProps<T>>
27
28
 
28
- export interface AccordionProps<T> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
29
- as?: PrimitiveProps['as']
29
+ export interface AccordionProps<T> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
30
30
  items?: T[]
31
+ /**
32
+ * The icon displayed on the right side of the trigger.
33
+ * @default app.icons.down
34
+ */
35
+ suffixIcon?: string
31
36
  labelKey?: string
32
37
  }
33
38
  </script>
@@ -44,11 +49,11 @@ const props = withDefaults(defineProps<AccordionProps<T>>(), {
44
49
  collapsible: true,
45
50
  unmountOnHide: true,
46
51
  labelKey: 'label',
47
- items: () => [],
48
52
  })
49
- const slots = defineSlots<AccordionSlots<T>>()
50
53
 
51
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'))
54
+ const emit = defineEmits<AccordionEmits>()
55
+ const slots = defineSlots<AccordionSlots<T>>()
56
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'), emit)
52
57
 
53
58
  const { theme, createStyler } = useTheme()
54
59
  const style = computed(() => {
@@ -69,16 +74,16 @@ const style = computed(() => {
69
74
  >
70
75
  <AccordionHeader :class="style.header({ class: props.ui?.header })">
71
76
  <AccordionTrigger :class="style.trigger({ class: props.ui?.trigger, disabled: item.disabled })">
72
- <slot name="icon" v-bind="{ item, index, open }">
73
- <i v-if="item.icon" :class="style.icon({ class: [item.icon, props.ui?.icon] })"></i>
77
+ <slot name="prefix" v-bind="{ item, index, open }">
78
+ <span v-if="item.icon" :class="style.prefixIcon({ class: [item.icon, props.ui?.prefixIcon] })"></span>
74
79
  </slot>
75
80
 
76
81
  <span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })">
77
82
  <slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
78
83
  </span>
79
84
 
80
- <slot name="trailing-icon" v-bind="{ item, index, open }">
81
- <i v-if="item.trailingIcon" :class="style.icon({ class: [item.trailingIcon, props.ui?.trailingIcon] })"></i>
85
+ <slot name="suffix" v-bind="{ item, index, open }">
86
+ <span :class="style.suffixIcon({ class: [item.suffixIcon || props.suffixIcon || theme.app.icons.down, props.ui?.suffixIcon] })"></span>
82
87
  </slot>
83
88
  </AccordionTrigger>
84
89
  </AccordionHeader>
@@ -100,21 +105,5 @@ const style = computed(() => {
100
105
  </template>
101
106
 
102
107
  <style>
103
- @keyframes accordion-up {
104
- from {
105
- height: var(--reka-accordion-content-height);
106
- }
107
- to {
108
- height: 0;
109
- }
110
- }
111
-
112
- @keyframes accordion-down {
113
- from {
114
- height: 0;
115
- }
116
- to {
117
- height: var(--reka-accordion-content-height);
118
- }
119
- }
108
+ @keyframes accordion-up{0%{height:var(--reka-accordion-content-height)}to{height:0}}@keyframes accordion-down{0%{height:0}to{height:var(--reka-accordion-content-height)}}
120
109
  </style>
@@ -74,7 +74,7 @@ const style = computed(() => {
74
74
  :class="style.root({ class: [props.class, props.ui?.root] })"
75
75
  >
76
76
  <slot name="prepend">
77
- <i v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></i>
77
+ <span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
78
78
  </slot>
79
79
 
80
80
  <div :class="style.wrapper({ class: props.ui?.wrapper })">
@@ -12,9 +12,8 @@ export interface ButtonSlots {
12
12
  }
13
13
 
14
14
  type ButtonVariants = VariantProps<typeof button>
15
- type UIOptions = ComponentAttrs<typeof button>['ui'] & LinkProps['ui']
16
15
 
17
- export interface ButtonProps extends Omit<ComponentAttrs<typeof button>, 'ui'>, UseComponentIconsProps, Omit<LinkProps, 'ui' | 'raw'> {
16
+ export interface ButtonProps extends ComponentAttrs<typeof button>, UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom'> {
18
17
  icon?: string
19
18
  label?: string
20
19
  variant?: ButtonVariants['variant']
@@ -22,11 +21,11 @@ export interface ButtonProps extends Omit<ComponentAttrs<typeof button>, 'ui'>,
22
21
  loading?: boolean
23
22
  active?: boolean
24
23
  disabled?: boolean
25
- ui?: UIOptions
26
24
  }
27
25
  </script>
28
26
 
29
27
  <script lang="ts" setup>
28
+ import { useForwardProps } from 'reka-ui'
30
29
  import { computed } from 'vue'
31
30
  import { useButtonGroup } from '../composables/useButtonGroup'
32
31
  import { useComponentIcons } from '../composables/useComponentIcons'
@@ -45,7 +44,7 @@ const { isPrefix, isSuffix, prefixIconName, suffixIconName } = useComponentIcons
45
44
  computed(() => ({ ...props, loading: props.loading })),
46
45
  )
47
46
 
48
- const linkProps = pickLinkProps(props)
47
+ const linkProps = useForwardProps(pickLinkProps(props))
49
48
 
50
49
  const { theme, createStyler } = useTheme()
51
50
 
@@ -59,8 +58,8 @@ const style = computed(() => {
59
58
  suffix: isSuffix.value,
60
59
  class: [
61
60
  props.class,
62
- props.active ? props.ui?.active : props.ui?.inactive,
63
- props.disabled ? props.ui?.disabled : undefined,
61
+ props.active ? props.activeClass : props.inactiveClass,
62
+ props.disabled ? props.disableClass : undefined,
64
63
  ],
65
64
  })
66
65
  })
@@ -71,14 +70,14 @@ const style = computed(() => {
71
70
  :class="style.base({ class: [props.class, props.ui?.base] })"
72
71
  :type="props.type"
73
72
  :disabled="props.disabled || props.loading"
74
- v-bind="omit(linkProps, ['type', 'disabled'])"
73
+ v-bind="omit(linkProps, ['type', 'disabled', 'activeClass', 'inactiveClass', 'disableClass'])"
75
74
  raw
76
75
  >
77
76
  <slot name="prefix">
78
- <i
77
+ <span
79
78
  v-if="isPrefix && prefixIconName"
80
79
  :class="style.prefixIcon({ class: [prefixIconName, props.ui?.prefixIcon] })"
81
- ></i>
80
+ ></span>
82
81
  </slot>
83
82
  <span
84
83
  v-if="props.label || slots.default"
@@ -87,10 +86,10 @@ const style = computed(() => {
87
86
  <slot>{{ label }}</slot>
88
87
  </span>
89
88
  <slot name="suffix">
90
- <i
89
+ <span
91
90
  v-if="isSuffix && suffixIconName"
92
91
  :class="style.suffixIcon({ class: [suffixIconName, props.ui?.suffixIcon] })"
93
- ></i>
92
+ ></span>
94
93
  </slot>
95
94
  </Link>
96
95
  </template>
@@ -1,14 +1,9 @@
1
1
  <script lang="ts">
2
+ import type { VariantProps } from '@byyuurin/ui-kit'
2
3
  import type { PrimitiveProps } from 'reka-ui'
3
4
  import type { card } from '../theme'
4
5
  import type { ComponentAttrs } from '../types'
5
6
 
6
- export interface CardProps extends ComponentAttrs<typeof card> {
7
- as?: PrimitiveProps['as']
8
- title?: string
9
- description?: string
10
- }
11
-
12
7
  export interface CardSlots {
13
8
  default?: (props?: {}) => any
14
9
  content?: (props?: {}) => any
@@ -17,6 +12,14 @@ export interface CardSlots {
17
12
  description?: (props?: any) => any
18
13
  footer?: (props?: {}) => any
19
14
  }
15
+
16
+ type CardVariants = VariantProps<typeof card>
17
+ export interface CardProps extends ComponentAttrs<typeof card> {
18
+ as?: PrimitiveProps['as']
19
+ variant?: CardVariants['variant']
20
+ title?: string
21
+ description?: string
22
+ }
20
23
  </script>
21
24
 
22
25
  <script setup lang="ts">
@@ -78,11 +78,11 @@ function onUpdate(value: any) {
78
78
  @update:model-value="onUpdate"
79
79
  >
80
80
  <CheckboxIndicator as-child force-mount>
81
- <i
81
+ <span
82
82
  v-if="modelValue === 'indeterminate'"
83
83
  :class="style.icon({ class: [props.indeterminateIcon || theme.app.icons.indeterminate, props.ui?.icon] })"
84
- ></i>
85
- <i v-else :class="style.icon({ class: [props.icon, theme.app.icons.check, props.ui?.icon] })"></i>
84
+ ></span>
85
+ <span v-else :class="style.icon({ class: [props.icon, theme.app.icons.check, props.ui?.icon] })"></span>
86
86
  </CheckboxIndicator>
87
87
  </CheckboxRoot>
88
88
  </div>
@@ -50,7 +50,7 @@ const style = computed(() => {
50
50
  <template>
51
51
  <Primitive :as="props.as" :class="style.base({ class: [props.class, props.ui?.base] })">
52
52
  <slot name="prefix">
53
- <i v-if="isPrefix && prefixIconName" :class="style.prefixIcon({ class: [prefixIconName, props.ui?.prefixIcon] })"></i>
53
+ <span v-if="isPrefix && prefixIconName" :class="style.prefixIcon({ class: [prefixIconName, props.ui?.prefixIcon] })"></span>
54
54
  </slot>
55
55
 
56
56
  <span v-if="props.label || slots.default" :class="style.label({ class: props.ui?.label })">
@@ -58,7 +58,7 @@ const style = computed(() => {
58
58
  </span>
59
59
 
60
60
  <slot name="suffix">
61
- <i v-if="isSuffix && suffixIconName" :class="style.suffixIcon({ class: [suffixIconName, props.ui?.suffixIcon] })"></i>
61
+ <span v-if="isSuffix && suffixIconName" :class="style.suffixIcon({ class: [suffixIconName, props.ui?.suffixIcon] })"></span>
62
62
  </slot>
63
63
  </Primitive>
64
64
  </template>
@@ -0,0 +1,56 @@
1
+ <script lang="ts">
2
+ import type { CollapsibleRootEmits, CollapsibleRootProps } from 'reka-ui'
3
+ import type { collapsible } from '../theme'
4
+ import type { ComponentAttrs } from '../types'
5
+
6
+ export interface CollapsibleProps extends ComponentAttrs<typeof collapsible>, Pick<CollapsibleRootProps, 'as' | 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
7
+ }
8
+
9
+ export interface CollapsibleEmits extends CollapsibleRootEmits {}
10
+
11
+ export interface CollapsibleSlots {
12
+ default?: (props: { open: boolean }) => any
13
+ content?: (props?: {}) => any
14
+ }
15
+ </script>
16
+
17
+ <script setup lang="ts">
18
+ import { reactivePick } from '@vueuse/core'
19
+ import { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, useForwardPropsEmits } from 'reka-ui'
20
+ import { computed } from 'vue'
21
+ import { useTheme } from '../composables/useTheme'
22
+
23
+ const props = withDefaults(defineProps<CollapsibleProps>(), {
24
+ unmountOnHide: true,
25
+ })
26
+ const emit = defineEmits<CollapsibleEmits>()
27
+ const slots = defineSlots<CollapsibleSlots>()
28
+
29
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'disabled', 'unmountOnHide'), emit)
30
+
31
+ const { theme, createStyler } = useTheme()
32
+ const style = computed(() => {
33
+ const styler = createStyler(theme.value.collapsible)
34
+ return styler(props)
35
+ })
36
+ </script>
37
+
38
+ <template>
39
+ <CollapsibleRoot
40
+ v-slot="{ open }"
41
+ v-bind="rootProps"
42
+ :class="style.root({ class: [props.class, props.ui?.root] })"
43
+ >
44
+ <CollapsibleTrigger v-if="slots.default" as-child>
45
+ <slot :open="open"></slot>
46
+ </CollapsibleTrigger>
47
+
48
+ <CollapsibleContent :class="style.content({ class: props.ui?.content })">
49
+ <slot name="content"></slot>
50
+ </CollapsibleContent>
51
+ </CollapsibleRoot>
52
+ </template>
53
+
54
+ <style>
55
+ @keyframes collapsible-up{0%{height:var(--reka-collapsible-content-height)}to{height:0}}@keyframes collapsible-down{0%{height:0}to{height:var(--reka-collapsible-content-height)}}
56
+ </style>
@@ -15,8 +15,10 @@ export interface DrawerProps extends ComponentAttrs<typeof drawer>, Pick<DrawerR
15
15
  * @default true
16
16
  */
17
17
  overlay?: boolean
18
- blur?: boolean
19
- full?: boolean
18
+ /**
19
+ * Whether to inset the drawer from the edges.
20
+ */
21
+ inset?: boolean
20
22
  /**
21
23
  * Render a handle on the drawer.
22
24
  * @default true
@@ -140,10 +140,10 @@ onMounted(() => {
140
140
  >
141
141
  <span v-if="isPrefix || slots.prefix" :class="style.prefix({ class: props.ui?.prefix })">
142
142
  <slot name="prefix">
143
- <i
143
+ <span
144
144
  v-if="isPrefix && prefixIconName"
145
145
  :class="style.prefixIcon({ class: [prefixIconName, props.ui?.prefixIcon] })"
146
- ></i>
146
+ ></span>
147
147
  </slot>
148
148
  </span>
149
149
 
@@ -168,10 +168,10 @@ onMounted(() => {
168
168
 
169
169
  <span v-if="isSuffix || slots.suffix" :class="style.suffix({ class: props.ui?.suffix })">
170
170
  <slot name="suffix">
171
- <i
171
+ <span
172
172
  v-if="isSuffix && suffixIconName"
173
173
  :class="style.suffixIcon({ class: [suffixIconName, props.ui?.suffixIcon] })"
174
- ></i>
174
+ ></span>
175
175
  </slot>
176
176
  </span>
177
177
  </Primitive>
@@ -0,0 +1,167 @@
1
+ <script lang="ts">
2
+ import type { VariantProps } from '@byyuurin/ui-kit'
3
+ import type { NumberFieldRootProps } from 'reka-ui'
4
+ import type { inputNumber } from '../theme'
5
+ import type { ButtonProps, ComponentAttrs } from '../types'
6
+
7
+ export interface InputNumberEmits {
8
+ (e: 'update:modelValue', payload: number): void
9
+ (e: 'blur', event: FocusEvent): void
10
+ (e: 'change', payload: Event): void
11
+ }
12
+
13
+ export interface InputNumberSlots {
14
+ increment?: (props?: {}) => any
15
+ decrement?: (props?: {}) => any
16
+ }
17
+
18
+ type InputNumberVariants = VariantProps<typeof inputNumber>
19
+
20
+ export interface InputNumberProps extends ComponentAttrs<typeof inputNumber>, Pick<NumberFieldRootProps, 'as' | 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions'> {
21
+ /** The placeholder text when the input is empty. */
22
+ placeholder?: string
23
+ variant?: InputNumberVariants['variant']
24
+ size?: InputNumberVariants['size']
25
+ underline?: boolean
26
+ /** Highlight the ring color like a focus state. */
27
+ highlight?: boolean
28
+ /**
29
+ * The orientation of the input menu.
30
+ * @default 'horizontal'
31
+ */
32
+ orientation?: InputNumberVariants['orientation']
33
+ /**
34
+ * Configure the increment button. The `color` and `size` are inherited.
35
+ * @default { variant: 'link' }
36
+ */
37
+ increment?: ButtonProps
38
+ /**
39
+ * The icon displayed to increment the value.
40
+ * @default app.icons.plus
41
+ */
42
+ incrementIcon?: string
43
+ /**
44
+ * Configure the decrement button. The `color` and `size` are inherited.
45
+ * @default { variant: 'link' }
46
+ */
47
+ decrement?: ButtonProps
48
+ /**
49
+ * The icon displayed to decrement the value.
50
+ * @default app.icons.minus
51
+ */
52
+ decrementIcon?: string
53
+ autofocus?: boolean
54
+ autofocusDelay?: number
55
+ /**
56
+ * The locale to use for formatting and parsing numbers.
57
+ */
58
+ locale?: string
59
+ }
60
+ </script>
61
+
62
+ <script setup lang="ts">
63
+ import { reactivePick } from '@vueuse/core'
64
+ import { NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldRoot, useForwardPropsEmits } from 'reka-ui'
65
+ import { computed, onMounted, ref } from 'vue'
66
+ import { useTheme } from '../composables/useTheme'
67
+ import Button from './Button.vue'
68
+
69
+ defineOptions({
70
+ inheritAttrs: false,
71
+ })
72
+
73
+ const props = withDefaults(defineProps<InputNumberProps>(), {
74
+ orientation: 'horizontal',
75
+ })
76
+
77
+ const emit = defineEmits<InputNumberEmits>()
78
+ defineSlots<InputNumberSlots>()
79
+
80
+ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'formatOptions'), emit)
81
+
82
+ const inputRef = ref<InstanceType<typeof NumberFieldInput> | null>(null)
83
+
84
+ const { theme, createStyler } = useTheme()
85
+ const incrementIcon = computed(() => props.incrementIcon || (props.orientation === 'horizontal' ? theme.value.app.icons.plus : theme.value.app.icons.up))
86
+ const decrementIcon = computed(() => props.decrementIcon || (props.orientation === 'horizontal' ? theme.value.app.icons.minus : theme.value.app.icons.down))
87
+
88
+ const style = computed(() => {
89
+ const styler = createStyler(theme.value.inputNumber)
90
+ return styler(props)
91
+ })
92
+
93
+ onMounted(() => {
94
+ setTimeout(() => {
95
+ autoFocus()
96
+ }, props.autofocusDelay)
97
+ })
98
+
99
+ defineExpose({
100
+ inputRef,
101
+ })
102
+
103
+ function autoFocus() {
104
+ if (props.autofocus)
105
+ inputRef.value?.$el?.focus()
106
+ }
107
+
108
+ function onUpdate(value: number) {
109
+ // @ts-expect-error - 'target' does not exist in type 'EventInit'
110
+ const event = new Event('change', { target: { value } })
111
+ emit('change', event)
112
+ }
113
+
114
+ function onBlur(event: FocusEvent) {
115
+ emit('blur', event)
116
+ }
117
+ </script>
118
+
119
+ <template>
120
+ <NumberFieldRoot
121
+ v-bind="rootProps"
122
+ :id="props.id"
123
+ :name="props.name"
124
+ :disabled="props.disabled"
125
+ :locale="props.locale"
126
+ :class="style.base({ class: [props.class, props.ui?.base] })"
127
+ :aria-disabled="props.disabled ? true : undefined"
128
+ @update:model-value="onUpdate"
129
+ >
130
+ <NumberFieldInput
131
+ v-bind="$attrs"
132
+ ref="inputRef"
133
+ :placeholder="props.placeholder"
134
+ :required="props.required"
135
+ :class="style.input({ class: props.ui?.input })"
136
+ @blur="onBlur"
137
+ />
138
+
139
+ <div :class="style.increment({ class: props.ui?.increment })">
140
+ <NumberFieldIncrement as-child :disabled="props.disabled">
141
+ <slot name="increment">
142
+ <Button
143
+ :icon="incrementIcon"
144
+ :size="props.size"
145
+ variant="link"
146
+ aria-label="increment"
147
+ v-bind="typeof props.increment === 'object' ? props.increment : undefined"
148
+ />
149
+ </slot>
150
+ </NumberFieldIncrement>
151
+ </div>
152
+
153
+ <div :class="style.decrement({ class: props.ui?.decrement })">
154
+ <NumberFieldDecrement as-child :disabled="props.disabled">
155
+ <slot name="decrement">
156
+ <Button
157
+ :icon="decrementIcon"
158
+ :size="props.size"
159
+ variant="link"
160
+ aria-label="decrement"
161
+ v-bind="typeof props.decrement === 'object' ? props.decrement : undefined"
162
+ />
163
+ </slot>
164
+ </NumberFieldDecrement>
165
+ </div>
166
+ </NumberFieldRoot>
167
+ </template>