@byyuurin/ui 0.0.4 → 0.0.5

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