@byyuurin/ui 0.0.6 → 0.0.8

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 (198) 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} +8 -8
  5. package/dist/module.mjs.map +1 -0
  6. package/dist/runtime/app/injections.d.ts +16 -0
  7. package/dist/runtime/app/injections.js +31 -0
  8. package/dist/runtime/components/Accordion.vue +27 -38
  9. package/dist/runtime/components/Alert.vue +23 -16
  10. package/dist/runtime/components/App.vue +15 -15
  11. package/dist/runtime/components/Avatar.vue +73 -0
  12. package/dist/runtime/components/AvatarGroup.vue +90 -0
  13. package/dist/runtime/components/Badge.vue +15 -10
  14. package/dist/runtime/components/Breadcrumb.vue +105 -0
  15. package/dist/runtime/components/Button.vue +22 -23
  16. package/dist/runtime/components/ButtonGroup.vue +12 -10
  17. package/dist/runtime/components/Card.vue +16 -8
  18. package/dist/runtime/components/Carousel.vue +19 -12
  19. package/dist/runtime/components/Checkbox.vue +16 -12
  20. package/dist/runtime/components/Chip.vue +17 -12
  21. package/dist/runtime/components/Collapsible.vue +56 -0
  22. package/dist/runtime/components/Drawer.vue +18 -17
  23. package/dist/runtime/components/Input.vue +28 -28
  24. package/dist/runtime/components/InputNumber.vue +169 -0
  25. package/dist/runtime/components/Kbd.vue +51 -0
  26. package/dist/runtime/components/Link.vue +301 -72
  27. package/dist/runtime/components/LinkBase.vue +88 -0
  28. package/dist/runtime/components/Modal.vue +11 -9
  29. package/dist/runtime/components/ModalProvider.vue +2 -1
  30. package/dist/runtime/components/Pagination.vue +30 -30
  31. package/dist/runtime/components/PinInput.vue +7 -7
  32. package/dist/runtime/components/Popover.vue +7 -7
  33. package/dist/runtime/components/Progress.vue +165 -0
  34. package/dist/runtime/components/RadioGroup.vue +33 -29
  35. package/dist/runtime/components/Select.vue +40 -40
  36. package/dist/runtime/components/Separator.vue +63 -0
  37. package/dist/runtime/components/Skeleton.vue +33 -0
  38. package/dist/runtime/components/Slider.vue +6 -6
  39. package/dist/runtime/components/Switch.vue +14 -15
  40. package/dist/runtime/components/Table.vue +300 -0
  41. package/dist/runtime/components/Tabs.vue +25 -21
  42. package/dist/runtime/components/Textarea.vue +11 -11
  43. package/dist/runtime/components/Toast.vue +15 -14
  44. package/dist/runtime/components/Toaster.vue +5 -39
  45. package/dist/runtime/components/Tooltip.vue +7 -7
  46. package/dist/runtime/composables/useAvatarGroup.d.ts +4 -0
  47. package/dist/runtime/composables/useAvatarGroup.js +8 -0
  48. package/dist/runtime/composables/useButtonGroup.d.ts +4 -12
  49. package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +1 -6
  50. package/dist/runtime/composables/useComponentIcons.d.ts +9 -9
  51. package/dist/runtime/composables/useComponentIcons.js +24 -0
  52. package/dist/runtime/composables/useKbd.d.ts +35 -0
  53. package/dist/runtime/composables/useKbd.js +49 -0
  54. package/dist/runtime/composables/useLocale.d.ts +8 -0
  55. package/dist/runtime/composables/useLocale.js +22 -0
  56. package/dist/runtime/composables/useModal.d.ts +2 -7
  57. package/dist/runtime/composables/{useModal.mjs → useModal.js} +1 -6
  58. package/dist/runtime/composables/useTheme.d.ts +2 -6
  59. package/dist/runtime/composables/useTheme.js +16 -0
  60. package/dist/runtime/composables/useToast.d.ts +1 -1
  61. package/dist/runtime/index.d.ts +40 -0
  62. package/dist/runtime/index.js +40 -0
  63. package/dist/runtime/locale/en.d.ts +2 -0
  64. package/dist/runtime/locale/en.js +28 -0
  65. package/dist/runtime/locale/index.d.ts +2 -0
  66. package/dist/runtime/locale/index.js +2 -0
  67. package/dist/runtime/locale/zh-tw.d.ts +2 -0
  68. package/dist/runtime/locale/zh-tw.js +28 -0
  69. package/dist/runtime/theme/accordion.d.ts +5 -5
  70. package/dist/runtime/theme/{accordion.mjs → accordion.js} +2 -2
  71. package/dist/runtime/theme/alert.d.ts +2 -2
  72. package/dist/runtime/theme/{alert.mjs → alert.js} +4 -4
  73. package/dist/runtime/theme/app.d.ts +8 -5
  74. package/dist/runtime/theme/app.js +18 -0
  75. package/dist/runtime/theme/avatar-group.d.ts +52 -0
  76. package/dist/runtime/theme/avatar-group.js +32 -0
  77. package/dist/runtime/theme/avatar.d.ts +56 -0
  78. package/dist/runtime/theme/avatar.js +34 -0
  79. package/dist/runtime/theme/badge.d.ts +45 -21
  80. package/dist/runtime/theme/{badge.mjs → badge.js} +2 -2
  81. package/dist/runtime/theme/breadcrumb.d.ts +67 -0
  82. package/dist/runtime/theme/breadcrumb.js +44 -0
  83. package/dist/runtime/theme/button-group.d.ts +2 -2
  84. package/dist/runtime/theme/button.d.ts +61 -115
  85. package/dist/runtime/theme/button.js +164 -0
  86. package/dist/runtime/theme/card.d.ts +38 -38
  87. package/dist/runtime/theme/card.js +37 -0
  88. package/dist/runtime/theme/carousel.d.ts +2 -2
  89. package/dist/runtime/theme/{carousel.mjs → carousel.js} +2 -2
  90. package/dist/runtime/theme/checkbox.d.ts +1 -1
  91. package/dist/runtime/theme/{checkbox.mjs → checkbox.js} +3 -3
  92. package/dist/runtime/theme/chip.d.ts +47 -14
  93. package/dist/runtime/theme/{chip.mjs → chip.js} +7 -9
  94. package/dist/runtime/theme/collapsible.d.ts +38 -0
  95. package/dist/runtime/theme/collapsible.js +10 -0
  96. package/dist/runtime/theme/drawer.d.ts +43 -43
  97. package/dist/runtime/theme/{drawer.mjs → drawer.js} +33 -22
  98. package/dist/runtime/theme/index.d.ts +37 -27
  99. package/dist/runtime/theme/index.js +37 -0
  100. package/dist/runtime/theme/input-number.d.ts +141 -0
  101. package/dist/runtime/theme/input-number.js +95 -0
  102. package/dist/runtime/theme/input.d.ts +77 -105
  103. package/dist/runtime/theme/{input.mjs → input.js} +25 -25
  104. package/dist/runtime/theme/kbd.d.ts +39 -0
  105. package/dist/runtime/theme/kbd.js +26 -0
  106. package/dist/runtime/theme/link.d.ts +2 -2
  107. package/dist/runtime/theme/{link.mjs → link.js} +1 -1
  108. package/dist/runtime/theme/modal.d.ts +31 -8
  109. package/dist/runtime/theme/{modal.mjs → modal.js} +4 -9
  110. package/dist/runtime/theme/pagination.d.ts +17 -17
  111. package/dist/runtime/theme/pinInput.d.ts +42 -42
  112. package/dist/runtime/theme/{pinInput.mjs → pinInput.js} +10 -10
  113. package/dist/runtime/theme/popover.d.ts +8 -8
  114. package/dist/runtime/theme/{popover.mjs → popover.js} +1 -1
  115. package/dist/runtime/theme/progress.d.ts +122 -0
  116. package/dist/runtime/theme/progress.js +95 -0
  117. package/dist/runtime/theme/radio-group.d.ts +1 -1
  118. package/dist/runtime/theme/{radio-group.mjs → radio-group.js} +1 -1
  119. package/dist/runtime/theme/scroll-area.d.ts +17 -17
  120. package/dist/runtime/theme/{scroll-area.mjs → scroll-area.js} +2 -2
  121. package/dist/runtime/theme/select.d.ts +93 -108
  122. package/dist/runtime/theme/{select.mjs → select.js} +31 -31
  123. package/dist/runtime/theme/separator.d.ts +95 -0
  124. package/dist/runtime/theme/separator.js +53 -0
  125. package/dist/runtime/theme/skeleton.d.ts +8 -0
  126. package/dist/runtime/theme/skeleton.js +7 -0
  127. package/dist/runtime/theme/slider.d.ts +1 -1
  128. package/dist/runtime/theme/{slider.mjs → slider.js} +3 -3
  129. package/dist/runtime/theme/switch.d.ts +1 -1
  130. package/dist/runtime/theme/{switch.mjs → switch.js} +3 -3
  131. package/dist/runtime/theme/table.d.ts +89 -0
  132. package/dist/runtime/theme/table.js +35 -0
  133. package/dist/runtime/theme/tabs.d.ts +70 -53
  134. package/dist/runtime/theme/{tabs.mjs → tabs.js} +12 -12
  135. package/dist/runtime/theme/textarea.d.ts +43 -37
  136. package/dist/runtime/theme/{textarea.mjs → textarea.js} +10 -10
  137. package/dist/runtime/theme/toast.d.ts +2 -2
  138. package/dist/runtime/theme/{toast.mjs → toast.js} +3 -3
  139. package/dist/runtime/theme/toaster.d.ts +42 -27
  140. package/dist/runtime/theme/tooltip.d.ts +11 -11
  141. package/dist/runtime/theme/tooltip.js +11 -0
  142. package/dist/runtime/types/components.d.ts +37 -27
  143. package/dist/runtime/types/index.d.ts +5 -4
  144. package/dist/runtime/types/index.js +3 -0
  145. package/dist/runtime/types/locale.d.ts +23 -0
  146. package/dist/runtime/types/locale.js +0 -0
  147. package/dist/runtime/types/utils.d.ts +1 -1
  148. package/dist/runtime/types/utils.js +0 -0
  149. package/dist/runtime/utils/index.d.ts +9 -4
  150. package/dist/runtime/utils/{index.mjs → index.js} +9 -7
  151. package/dist/runtime/utils/link.d.ts +22 -7
  152. package/dist/runtime/utils/link.js +30 -0
  153. package/dist/runtime/utils/styler.d.ts +1 -1
  154. package/dist/runtime/utils/translator.d.ts +18 -0
  155. package/dist/runtime/utils/translator.js +8 -0
  156. package/dist/runtime/vue/stubs.d.ts +9 -0
  157. package/dist/runtime/vue/stubs.js +16 -0
  158. package/dist/shared/ui.ba24b380.mjs +4 -0
  159. package/dist/shared/ui.ba24b380.mjs.map +1 -0
  160. package/dist/types.d.mts +1 -0
  161. package/dist/types.d.ts +1 -0
  162. package/dist/unocss.d.mts +6 -11
  163. package/dist/unocss.d.ts +6 -11
  164. package/dist/unocss.mjs +40 -21
  165. package/dist/unocss.mjs.map +1 -1
  166. package/dist/unplugin.mjs +35 -8
  167. package/dist/unplugin.mjs.map +1 -1
  168. package/dist/vite.d.mts +0 -1
  169. package/dist/vite.d.ts +0 -1
  170. package/dist/vite.mjs +3 -1
  171. package/dist/vite.mjs.map +1 -1
  172. package/package.json +50 -38
  173. package/dist/index.d.ts +0 -29
  174. package/dist/index.mjs +0 -29
  175. package/dist/nuxt.mjs.map +0 -1
  176. package/dist/runtime/composables/useComponentIcons.mjs +0 -24
  177. package/dist/runtime/composables/useTheme.mjs +0 -26
  178. package/dist/runtime/theme/app.mjs +0 -15
  179. package/dist/runtime/theme/button.mjs +0 -148
  180. package/dist/runtime/theme/card.mjs +0 -14
  181. package/dist/runtime/theme/index.mjs +0 -27
  182. package/dist/runtime/theme/tooltip.mjs +0 -11
  183. package/dist/runtime/types/components.mjs +0 -27
  184. package/dist/runtime/types/index.mjs +0 -2
  185. package/dist/runtime/utils/link.mjs +0 -4
  186. package/dist/shared/ui.D4zm1r0C.mjs +0 -4
  187. package/dist/shared/ui.D4zm1r0C.mjs.map +0 -1
  188. /package/dist/{nuxt.d.mts → module.d.mts} +0 -0
  189. /package/dist/{nuxt.d.ts → module.d.ts} +0 -0
  190. /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
  191. /package/dist/runtime/theme/{button-group.mjs → button-group.js} +0 -0
  192. /package/dist/runtime/theme/{pagination.mjs → pagination.js} +0 -0
  193. /package/dist/runtime/theme/{toaster.mjs → toaster.js} +0 -0
  194. /package/dist/runtime/types/{utils.mjs → components.js} +0 -0
  195. /package/dist/runtime/utils/{extend-theme.mjs → extend-theme.js} +0 -0
  196. /package/dist/runtime/utils/{styler.mjs → styler.js} +0 -0
  197. /package/dist/runtime/{composables/defineInjection.d.ts → utils/vue.d.ts} +0 -0
  198. /package/dist/runtime/{composables/defineInjection.mjs → utils/vue.js} +0 -0
@@ -1,117 +1,346 @@
1
1
  <script lang="ts">
2
2
  import type { PrimitiveProps } from 'reka-ui'
3
+ import type { ButtonHTMLAttributes } from 'vue'
4
+ import type { RouteLocationRaw, RouterLinkProps } from 'vue-router'
3
5
  import type { link } from '../theme'
4
- import type { ComponentAttrs, HintString, MaybeArray } from '../types'
6
+ import type { ComponentAttrs } from '../types'
5
7
 
6
- export interface LinkProps extends Omit<ComponentAttrs<typeof link>, 'ui'> {
8
+ export interface LinkSlots {
9
+ default?: (props: { active: boolean }) => any
10
+ }
11
+
12
+ interface NuxtLinkProps extends Omit<RouterLinkProps, 'to'> {
13
+ /**
14
+ * Route Location the link should navigate to when clicked on.
15
+ */
16
+ to?: RouteLocationRaw // need to manually type to avoid breaking typedPages
17
+ /**
18
+ * An alias for `to`. If used with `to`, `href` will be ignored
19
+ */
20
+ href?: NuxtLinkProps['to']
21
+ /**
22
+ * Forces the link to be considered as external (true) or internal (false). This is helpful to handle edge-cases
23
+ */
24
+ external?: boolean
25
+ /**
26
+ * Where to display the linked URL, as the name for a browsing context.
27
+ */
28
+ target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null
29
+ /**
30
+ * A rel attribute value to apply on the link. Defaults to "noopener noreferrer" for external links.
31
+ */
32
+ rel?: 'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | (string & {}) | null
33
+ /**
34
+ * If set to true, no rel attribute will be added to the link
35
+ */
36
+ noRel?: boolean
37
+ /**
38
+ * A class to apply to links that have been prefetched.
39
+ */
40
+ prefetchedClass?: string
41
+ /**
42
+ * When enabled will prefetch middleware, layouts and payloads of links in the viewport.
43
+ */
44
+ prefetch?: boolean
45
+ /**
46
+ * Allows controlling when to prefetch links. By default, prefetch is triggered only on visibility.
47
+ */
48
+ prefetchOn?: 'visibility' | 'interaction' | Partial<{
49
+ visibility: boolean
50
+ interaction: boolean
51
+ }>
52
+ /**
53
+ * Escape hatch to disable `prefetch` attribute.
54
+ */
55
+ noPrefetch?: boolean
56
+ }
57
+
58
+ export interface LinkProps extends Omit<ComponentAttrs<typeof link>, 'ui'>, NuxtLinkProps {
59
+ /**
60
+ * The element or component this component should render as when not a link.
61
+ * @default "button"
62
+ */
7
63
  as?: PrimitiveProps['as']
8
- type?: string
9
- onClick?: MaybeArray<(e: MouseEvent) => void | Promise<void>>
64
+ /**
65
+ * The type of the button when not a link.
66
+ * @default "button"
67
+ */
68
+ type?: ButtonHTMLAttributes['type']
10
69
  label?: string
11
- href?: string
12
- navigate?: (e: MouseEvent) => void
13
- /** A rel attribute value to apply on the link. */
14
- rel?: HintString<'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc'> | null
15
- noRel?: boolean
16
- /** Where to display the linked URL, as the name for a browsing context. */
17
- target?: HintString<'_blank' | '_parent' | '_self' | '_top'> | null
18
- isExternal?: boolean
19
- underline?: boolean
20
- active?: boolean
21
70
  disabled?: boolean
71
+ /** Force the link to be active independent of the current route. */
72
+ active?: boolean
73
+ /** Will only be active if the current route is an exact match. */
74
+ exact?: boolean
75
+ /** Will only be active if the current route query is an exact match. */
76
+ exactQuery?: boolean | 'partial'
77
+ /** Will only be active if the current route hash is an exact match. */
78
+ exactHash?: boolean
79
+ /** The class to apply when the link is inactive. */
80
+ inactiveClass?: string
81
+ /** The class to apply when the link is disabled. */
82
+ disableClass?: string
83
+ custom?: boolean
84
+ underline?: boolean
22
85
  /** When `true`, only styles from `class`, `ui.active`, and `ui.inactive` will be applied. */
23
86
  raw?: boolean
24
- ui?: {
25
- active?: string
26
- inactive?: string
27
- disabled?: string
28
- }
29
87
  }
30
88
  </script>
31
89
 
32
90
  <script setup lang="ts">
33
- import { Primitive } from 'reka-ui'
34
- import { computed } from 'vue'
91
+ import { reactiveOmit } from '@vueuse/core'
92
+ import { diff, isEqual } from 'ohash/utils'
93
+ import { useForwardProps } from 'reka-ui'
94
+ import { hasProtocol } from 'ufo'
95
+ import { computed, getCurrentInstance, resolveComponent } from 'vue'
96
+ import { useNuxtApp, useRoute } from '#imports'
35
97
  import { useTheme } from '../composables/useTheme'
98
+ import LinkBase from './LinkBase.vue'
99
+
100
+ defineOptions({ inheritAttrs: false })
36
101
 
37
102
  const props = withDefaults(defineProps<LinkProps>(), {
38
103
  as: 'button',
39
104
  type: 'button',
40
105
  })
106
+ defineSlots<LinkSlots>()
107
+
108
+ // Check if vue-router is available by checking for the injection key
109
+ const hasRouter = computed(() => {
110
+ const app = getCurrentInstance()?.appContext.app
111
+ return !!(app?.config?.globalProperties?.$router)
112
+ })
113
+
114
+ const nuxtApp = useNuxtApp()
115
+ const hasNuxtLink = !!nuxtApp.$router
116
+
117
+ const linkComponent = computed(() => ({
118
+ NuxtLink: nuxtApp.$router ? resolveComponent('NuxtLink') : null,
119
+ RouterLink: hasRouter.value ? resolveComponent('RouterLink') : null,
120
+ }))
121
+
122
+ // Only try to get route if router exists
123
+ const route = computed(() => {
124
+ if (!hasRouter.value)
125
+ return null
41
126
 
42
- const linkProps = computed(() => {
43
- const { as, type, disabled, href, rel, target } = props
44
- const base = { as, rel, target }
45
-
46
- if (href) {
47
- return {
48
- ...base,
49
- 'as': 'a',
50
- 'href': disabled ? undefined : href,
51
- 'aria-disabled': disabled ? 'true' : undefined,
52
- 'role': disabled ? 'link' : undefined,
53
- 'tabindex': disabled ? -1 : undefined,
54
- }
127
+ try {
128
+ return useRoute()
55
129
  }
130
+ catch {
131
+ return null
132
+ }
133
+ })
134
+
135
+ const linkProps = useForwardProps(reactiveOmit(
136
+ props,
137
+ 'as',
138
+ 'type',
139
+ 'disabled',
140
+ 'active',
141
+ 'exact',
142
+ 'exactQuery',
143
+ 'exactHash',
144
+ 'activeClass',
145
+ 'inactiveClass',
146
+ 'raw',
147
+ 'class',
148
+ ...(hasNuxtLink ? [] : ['to'] as const),
149
+ ))
150
+
151
+ function isPartiallyEqual(item1: any, item2: any) {
152
+ const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
153
+ if (q.type === 'added')
154
+ filtered.add(q.key)
155
+
156
+ return filtered
157
+ }, new Set<string>())
56
158
 
57
- if (as === 'button')
58
- return { ...base, type, disabled }
159
+ const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)))
160
+ const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)))
59
161
 
60
- return base
162
+ return isEqual(item1Filtered, item2Filtered)
163
+ }
164
+
165
+ const isExternalLink = computed(() => {
166
+ if (!props.to)
167
+ return false
168
+
169
+ return typeof props.to === 'string' && hasProtocol(props.to, { acceptRelative: true })
61
170
  })
62
171
 
63
- const { theme, createStyler } = useTheme()
172
+ function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
173
+ if (props.active !== undefined)
174
+ return props.active
64
175
 
65
- const style = computed(() => {
66
- if (props.raw)
67
- return props.class
176
+ if (props.exactQuery === 'partial') {
177
+ if (!isPartiallyEqual(linkRoute?.query, route.value?.query))
178
+ return false
179
+ }
180
+ else if (props.exactQuery === true && !isEqual(linkRoute?.query, route.value?.query)) {
181
+ return false
182
+ }
183
+
184
+ if (props.exactHash && linkRoute?.hash !== route.value?.hash)
185
+ return false
186
+
187
+ if (props.exact && isExactActive)
188
+ return true
68
189
 
190
+ if (!props.exact && isActive)
191
+ return true
192
+
193
+ return false
194
+ }
195
+
196
+ const { theme, createStyler } = useTheme()
197
+
198
+ function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
69
199
  const { link } = theme.value
200
+ const active = isLinkActive({ route, isActive, isExactActive })
201
+
202
+ if (props.raw)
203
+ return [props.class, active ? props.activeClass : props.inactiveClass]
70
204
 
71
205
  const styler = createStyler({
72
206
  ...link,
73
207
  variants: {
74
208
  ...link.variants,
75
209
  active: {
76
- true: [link.variants.active.true, props.ui?.active],
77
- false: [link.variants.active.false, props.ui?.inactive],
210
+ true: [link.variants.active.true, props.activeClass],
211
+ false: [link.variants.active.false, props.inactiveClass],
78
212
  },
79
213
  disabled: {
80
- true: [link.variants.disabled.true, props.ui?.disabled],
214
+ true: [link.variants.disabled.true, props.disableClass],
81
215
  },
82
216
  },
83
217
  })
84
- return styler(props)
85
- })
86
-
87
- function handleClick(e: MouseEvent) {
88
- if (props.disabled) {
89
- e.stopPropagation()
90
- e.preventDefault()
91
- return
92
- }
93
-
94
- if (props.onClick) {
95
- const handlers = Array.isArray(props.onClick) ? props.onClick : [props.onClick]
96
- for (const handler of handlers)
97
- handler(e)
98
- }
99
218
 
100
- if (props.href && props.navigate && !props.isExternal)
101
- props.navigate(e)
219
+ return styler({ ...props, active })
102
220
  }
103
221
  </script>
104
222
 
105
223
  <template>
106
- <Primitive
107
- v-bind="linkProps"
108
- :rel="props.rel"
109
- :target="props.target"
110
- :class="style"
111
- @click="handleClick"
112
- >
113
- <slot :active="props.active">
114
- {{ props.label }}
115
- </slot>
116
- </Primitive>
224
+ <template v-if="hasRouter">
225
+ <component
226
+ :is="linkComponent.NuxtLink"
227
+ v-if="hasNuxtLink"
228
+ v-slot="{ href, navigate, route: linkRoute, rel, target, isExternal, isActive, isExactActive }"
229
+ v-bind="linkProps"
230
+ :href="to ? undefined : href"
231
+ custom
232
+ >
233
+ <template v-if="custom">
234
+ <slot
235
+ v-bind="{
236
+ ...$attrs,
237
+ as,
238
+ type,
239
+ disabled,
240
+ href,
241
+ navigate,
242
+ rel,
243
+ target,
244
+ isExternal,
245
+ active: isLinkActive({ route: linkRoute, isActive, isExactActive }),
246
+ }"
247
+ >
248
+ {{ props.label }}
249
+ </slot>
250
+ </template>
251
+ <LinkBase
252
+ v-else
253
+ v-bind="{
254
+ ...$attrs,
255
+ as,
256
+ type,
257
+ disabled,
258
+ href,
259
+ navigate,
260
+ rel,
261
+ target,
262
+ isExternal,
263
+ }"
264
+ :class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
265
+ >
266
+ <slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })">
267
+ {{ props.label }}
268
+ </slot>
269
+ </LinkBase>
270
+ </component>
271
+ <component
272
+ :is="linkComponent.RouterLink"
273
+ v-else
274
+ v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }"
275
+ v-bind="linkProps"
276
+ :to="to || '#'"
277
+ custom
278
+ >
279
+ <template v-if="custom">
280
+ <slot
281
+ v-bind="{
282
+ ...$attrs,
283
+ as,
284
+ type,
285
+ disabled,
286
+ href: to ? href : undefined,
287
+ navigate,
288
+ active: isLinkActive({ route: linkRoute, isActive, isExactActive }),
289
+ }"
290
+ >
291
+ {{ props.label }}
292
+ </slot>
293
+ </template>
294
+ <LinkBase
295
+ v-else
296
+ v-bind="{
297
+ ...$attrs,
298
+ as,
299
+ type,
300
+ disabled,
301
+ href: to ? href : undefined,
302
+ navigate,
303
+ }"
304
+ :class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
305
+ >
306
+ <slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })">
307
+ {{ props.label }}
308
+ </slot>
309
+ </LinkBase>
310
+ </component>
311
+ </template>
312
+ <template v-else>
313
+ <template v-if="props.custom">
314
+ <slot
315
+ v-bind="{
316
+ ...$attrs,
317
+ as,
318
+ type,
319
+ disabled,
320
+ href: to || href,
321
+ target: isExternalLink ? '_blank' : target || undefined,
322
+ active: false,
323
+ }"
324
+ >
325
+ {{ props.label }}
326
+ </slot>
327
+ </template>
328
+ <LinkBase
329
+ v-else
330
+ v-bind="{
331
+ ...$attrs,
332
+ as,
333
+ type,
334
+ disabled,
335
+ href: ((to || href) as string),
336
+ target: isExternalLink ? '_blank' : target || undefined,
337
+ }"
338
+ :is-external="isExternalLink"
339
+ :class="resolveLinkClass()"
340
+ >
341
+ <slot :active="false">
342
+ {{ props.label }}
343
+ </slot>
344
+ </LinkBase>
345
+ </template>
117
346
  </template>
@@ -0,0 +1,88 @@
1
+ <script lang="ts">
2
+ import type { PrimitiveProps } from 'reka-ui'
3
+
4
+ export interface LinkBaseProps {
5
+ /**
6
+ * The element or component this component should render as.
7
+ * @default "button"
8
+ */
9
+ as?: PrimitiveProps['as']
10
+ type?: string
11
+ disabled?: boolean
12
+ onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>
13
+ href?: string
14
+ navigate?: (e: MouseEvent) => void
15
+ rel?: string
16
+ target?: string
17
+ isExternal?: boolean
18
+ }
19
+ </script>
20
+
21
+ <script setup lang="ts">
22
+ import { Primitive } from 'reka-ui'
23
+ import { computed } from 'vue'
24
+
25
+ const props = withDefaults(defineProps<LinkBaseProps>(), {
26
+ as: 'button',
27
+ type: 'button',
28
+ })
29
+
30
+ const wrapperProps = computed(() => {
31
+ const { href, rel, target, disabled } = props
32
+
33
+ const baseProps = {
34
+ rel,
35
+ target,
36
+ }
37
+
38
+ if (props.href) {
39
+ return {
40
+ ...baseProps,
41
+ 'as': 'a',
42
+ 'href': disabled ? undefined : href,
43
+ 'aria-disabled': disabled ? 'true' : undefined,
44
+ 'role': disabled ? 'link' : undefined,
45
+ 'tabindex': disabled ? -1 : undefined,
46
+ }
47
+ }
48
+
49
+ if (props.as === 'button') {
50
+ return {
51
+ ...baseProps,
52
+ as: props.as,
53
+ type: props.type,
54
+ disabled,
55
+ }
56
+ }
57
+
58
+ return {
59
+ ...baseProps,
60
+ as: props.as,
61
+ }
62
+ })
63
+
64
+ function onClickWrapper(e: MouseEvent) {
65
+ if (props.disabled) {
66
+ e.stopPropagation()
67
+ e.preventDefault()
68
+ return
69
+ }
70
+
71
+ if (props.onClick) {
72
+ for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick])
73
+ onClick(e)
74
+ }
75
+
76
+ if (props.href && props.navigate && !props.isExternal)
77
+ props.navigate(e)
78
+ }
79
+ </script>
80
+
81
+ <template>
82
+ <Primitive
83
+ v-bind="wrapperProps"
84
+ @click="onClickWrapper"
85
+ >
86
+ <slot></slot>
87
+ </Primitive>
88
+ </template>
@@ -8,13 +8,13 @@ export interface ModalEmits extends DialogRootEmits {}
8
8
 
9
9
  export interface ModalSlots {
10
10
  default?: (props: { open: boolean }) => any
11
- content?: (props?: any) => any
12
- header?: (props?: any) => any
13
- title?: (props?: any) => any
14
- description?: (props?: any) => any
15
- close?: (props?: any) => any
16
- body?: (props?: any) => any
17
- footer?: (props?: any) => any
11
+ content?: (props?: {}) => any
12
+ header?: (props?: {}) => any
13
+ title?: (props?: {}) => any
14
+ description?: (props?: {}) => any
15
+ close?: (props?: {}) => any
16
+ body?: (props?: {}) => any
17
+ footer?: (props?: {}) => any
18
18
  }
19
19
 
20
20
  type ModalVariants = VariantProps<typeof modal>
@@ -28,7 +28,6 @@ export interface ModalProps extends ComponentAttrs<typeof modal>, DialogRootProp
28
28
  portal?: boolean
29
29
  /** @default true */
30
30
  overlay?: boolean
31
- blur?: boolean
32
31
  /** @default true */
33
32
  transition?: boolean
34
33
  /**
@@ -37,7 +36,7 @@ export interface ModalProps extends ComponentAttrs<typeof modal>, DialogRootProp
37
36
  */
38
37
  dismissible?: boolean
39
38
  close?: ButtonProps | boolean
40
- /** @default `app.icons.close` */
39
+ /** @default app.icons.close */
41
40
  closeIcon?: string
42
41
  }
43
42
  </script>
@@ -46,6 +45,7 @@ export interface ModalProps extends ComponentAttrs<typeof modal>, DialogRootProp
46
45
  import { reactivePick } from '@vueuse/core'
47
46
  import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, useForwardPropsEmits } from 'reka-ui'
48
47
  import { computed, toRef } from 'vue'
48
+ import { useLocale } from '../composables/useLocale'
49
49
  import { useTheme } from '../composables/useTheme'
50
50
  import Button from './Button.vue'
51
51
 
@@ -72,6 +72,7 @@ const contentEvents = computed(() => {
72
72
  }
73
73
  })
74
74
 
75
+ const { t } = useLocale()
75
76
  const { theme, createStyler } = useTheme()
76
77
  const style = computed(() => {
77
78
  const styler = createStyler(theme.value.modal)
@@ -115,6 +116,7 @@ const style = computed(() => {
115
116
  :icon="props.closeIcon || theme.app.icons.close"
116
117
  v-bind="typeof props.close === 'boolean' ? {} : props.close"
117
118
  :class="style.close({ class: props.ui?.close })"
119
+ :aria-label="t('modal.close')"
118
120
  />
119
121
  </slot>
120
122
  </DialogClose>
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { injectModalState, useModal } from '../composables/useModal'
2
+ import { injectModalState } from '../app/injections'
3
+ import { useModal } from '../composables/useModal'
3
4
 
4
5
  const modalState = injectModalState()
5
6
  const { isOpen } = useModal()
@@ -3,6 +3,27 @@ import type { PaginationRootEmits, PaginationRootProps } from 'reka-ui'
3
3
  import type { pagination } from '../theme'
4
4
  import type { ButtonProps, ComponentAttrs } from '../types'
5
5
 
6
+ export interface PaginationEmits extends PaginationRootEmits {}
7
+
8
+ export interface PaginationSlots {
9
+ first?: (props?: {}) => any
10
+ prev?: (props?: {}) => any
11
+ next?: (props?: {}) => any
12
+ last?: (props?: {}) => any
13
+ ellipsis?: (props?: {}) => any
14
+ item?: (props: {
15
+ page: number
16
+ pageCount: number
17
+ item: {
18
+ type: 'ellipsis'
19
+ } | {
20
+ type: 'page'
21
+ value: number
22
+ }
23
+ index: number
24
+ }) => any
25
+ }
26
+
6
27
  export interface PaginationProps extends ComponentAttrs<typeof pagination>, Pick<PaginationRootProps, 'as' | 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'> {
7
28
  /**
8
29
  * The icon to use for the first page control.
@@ -16,12 +37,12 @@ export interface PaginationProps extends ComponentAttrs<typeof pagination>, Pick
16
37
  lastIcon?: string
17
38
  /**
18
39
  * The icon to use for the previous page control.
19
- * @default app.icons.arrowLeft
40
+ * @default app.icons.chevronLeft
20
41
  */
21
42
  prevIcon?: string
22
43
  /**
23
44
  * The icon to use for the next page control.
24
- * @default app.icons.arrowRight
45
+ * @default app.icons.chevronRight
25
46
  */
26
47
  nextIcon?: string
27
48
  /**
@@ -31,17 +52,17 @@ export interface PaginationProps extends ComponentAttrs<typeof pagination>, Pick
31
52
  ellipsisIcon?: string
32
53
  /**
33
54
  * The size of the pagination controls.
34
- * @default 'md'
55
+ * @default "md"
35
56
  */
36
57
  size?: ButtonProps['size']
37
58
  /**
38
59
  * The variant of the pagination controls.
39
- * @default 'outline'
60
+ * @default "outline"
40
61
  */
41
62
  variant?: ButtonProps['variant']
42
63
  /**
43
64
  * The variant of the active pagination control.
44
- * @default 'solid'
65
+ * @default "solid"
45
66
  */
46
67
  activeVariant?: ButtonProps['variant']
47
68
  /**
@@ -50,27 +71,6 @@ export interface PaginationProps extends ComponentAttrs<typeof pagination>, Pick
50
71
  */
51
72
  showControls?: boolean
52
73
  }
53
-
54
- export interface PaginationEmits extends PaginationRootEmits {}
55
-
56
- export interface PaginationSlots {
57
- first?: (props?: {}) => any
58
- prev?: (props?: {}) => any
59
- next?: (props?: {}) => any
60
- last?: (props?: {}) => any
61
- ellipsis?: (props?: {}) => any
62
- item?: (props: {
63
- page: number
64
- pageCount: number
65
- item: {
66
- type: 'ellipsis'
67
- } | {
68
- type: 'page'
69
- value: number
70
- }
71
- index: number
72
- }) => any
73
- }
74
74
  </script>
75
75
 
76
76
  <script setup lang="ts">
@@ -97,10 +97,10 @@ const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultPage',
97
97
 
98
98
  const { theme, createStyler } = useTheme()
99
99
 
100
- const firstIcon = computed(() => props.firstIcon || theme.value.app.icons.doubleLeft)
101
- const prevIcon = computed(() => props.prevIcon || theme.value.app.icons.arrowLeft)
102
- const nextIcon = computed(() => props.nextIcon || theme.value.app.icons.arrowRight)
103
- const lastIcon = computed(() => props.lastIcon || theme.value.app.icons.doubleRight)
100
+ const firstIcon = computed(() => props.firstIcon || theme.value.app.icons.chevronDoubleLeft)
101
+ const prevIcon = computed(() => props.prevIcon || theme.value.app.icons.chevronLeft)
102
+ const nextIcon = computed(() => props.nextIcon || theme.value.app.icons.chevronRight)
103
+ const lastIcon = computed(() => props.lastIcon || theme.value.app.icons.chevronDoubleRight)
104
104
  const ellipsisIcon = computed(() => props.ellipsisIcon || theme.value.app.icons.ellipsis)
105
105
 
106
106
  const style = computed(() => {