@polymarbot/nuxt-layer-shadcn-ui 0.5.1 → 0.5.3
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.
- package/app/components/ui/Badge/index.vue +1 -1
- package/app/components/ui/Badge/types.ts +4 -2
- package/app/components/ui/Button/index.vue +9 -3
- package/app/components/ui/Button/types.ts +5 -3
- package/app/components/ui/DatePicker/index.stories.ts +39 -0
- package/app/components/ui/DatePicker/style.css +4 -1
- package/package.json +2 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { BadgeVariants } from '../../shadcn/badge'
|
|
2
2
|
|
|
3
|
-
export type BadgeVariant =
|
|
3
|
+
export type BadgeVariant = BadgeVariants['variant']
|
|
4
4
|
|
|
5
|
-
export interface BadgeProps
|
|
5
|
+
export interface BadgeProps {
|
|
6
|
+
variant?: BadgeVariant
|
|
7
|
+
}
|
|
@@ -4,9 +4,13 @@ import WebLink from '@polymarbot/nuxt-layer-shadcn-ui/app/components/ui/WebLink/
|
|
|
4
4
|
import type { ButtonProps } from './types'
|
|
5
5
|
|
|
6
6
|
const props = defineProps<ButtonProps>()
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const isTransparentHover = computed(() => props.variant === 'outline' || props.variant === 'ghost')
|
|
8
|
+
const mergedClass = computed(() => cn(
|
|
9
|
+
'cursor-pointer',
|
|
10
|
+
isTransparentHover.value && 'hover:bg-accent/50',
|
|
11
|
+
props.rounded && 'rounded-full',
|
|
12
|
+
props.class,
|
|
13
|
+
))
|
|
10
14
|
|
|
11
15
|
const isLink = computed(() => !!props.href || !!props.to)
|
|
12
16
|
const hasIcon = computed(() => !!$slots.icon || !!props.icon)
|
|
@@ -19,6 +23,8 @@ const $slots = defineSlots<{
|
|
|
19
23
|
|
|
20
24
|
<template>
|
|
21
25
|
<ShadcnButton
|
|
26
|
+
:variant="variant"
|
|
27
|
+
:size="size"
|
|
22
28
|
:class="mergedClass"
|
|
23
29
|
:asChild="isLink"
|
|
24
30
|
:type="isLink ? undefined : 'button'"
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ButtonVariants } from '../../shadcn/button'
|
|
2
2
|
import type { RouteLocationRaw } from 'vue-router'
|
|
3
3
|
|
|
4
|
-
export type ButtonVariant =
|
|
5
|
-
export type ButtonSize =
|
|
4
|
+
export type ButtonVariant = ButtonVariants['variant']
|
|
5
|
+
export type ButtonSize = ButtonVariants['size']
|
|
6
6
|
|
|
7
|
-
export interface ButtonProps
|
|
7
|
+
export interface ButtonProps {
|
|
8
|
+
variant?: ButtonVariant
|
|
9
|
+
size?: ButtonSize
|
|
8
10
|
loading?: boolean
|
|
9
11
|
disabled?: boolean
|
|
10
12
|
rounded?: boolean
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
2
|
import type { DatePickerType } from './types'
|
|
3
|
+
import Button from '../Button/index.vue'
|
|
4
|
+
import Modal from '../Modal/index.vue'
|
|
3
5
|
import DatePicker from './index.vue'
|
|
4
6
|
|
|
5
7
|
const types: DatePickerType[] = [ 'date', 'month', 'year' ]
|
|
@@ -220,3 +222,40 @@ export const Readonly: Story = {
|
|
|
220
222
|
`,
|
|
221
223
|
}),
|
|
222
224
|
}
|
|
225
|
+
|
|
226
|
+
export const InModal: Story = {
|
|
227
|
+
parameters: {
|
|
228
|
+
...noControls,
|
|
229
|
+
docs: {
|
|
230
|
+
description: {
|
|
231
|
+
story: 'The calendar menu is teleported to `<body>` and overrides `pointer-events: auto` to bypass the body pointer-events lock applied by reka-ui modal layers, so it stays interactive inside Modal / Dialog / Sheet / Drawer.',
|
|
232
|
+
},
|
|
233
|
+
source: {
|
|
234
|
+
code: `
|
|
235
|
+
<template>
|
|
236
|
+
<Modal v-model:visible="visible" title="Pick a date">
|
|
237
|
+
<DatePicker v-model="date" />
|
|
238
|
+
</Modal>
|
|
239
|
+
</template>
|
|
240
|
+
`.trim(),
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
render: () => ({
|
|
245
|
+
components: { DatePicker, Modal, Button },
|
|
246
|
+
setup () {
|
|
247
|
+
const visible = ref(false)
|
|
248
|
+
const date = ref<Date | string | null>(null)
|
|
249
|
+
return { visible, date }
|
|
250
|
+
},
|
|
251
|
+
template: `
|
|
252
|
+
<div>
|
|
253
|
+
<Button @click="visible = true">Open Modal</Button>
|
|
254
|
+
<Modal v-model:visible="visible" title="Pick a date" :hideFooter="true">
|
|
255
|
+
<DatePicker v-model="date" />
|
|
256
|
+
<div class="mt-4 text-sm text-muted-foreground">Value: {{ date }}</div>
|
|
257
|
+
</Modal>
|
|
258
|
+
</div>
|
|
259
|
+
`,
|
|
260
|
+
}),
|
|
261
|
+
}
|
|
@@ -80,9 +80,12 @@
|
|
|
80
80
|
margin: 4px 0;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/* Menu: shadow-md
|
|
83
|
+
/* Menu: shadow-md.
|
|
84
|
+
pointer-events override keeps the menu interactive when teleported into
|
|
85
|
+
<body> while a reka-ui modal (Dialog/Sheet/Drawer) locks body pointer-events. */
|
|
84
86
|
.dp__menu {
|
|
85
87
|
box-shadow:
|
|
86
88
|
0 4px 6px -1px rgb(0 0 0 / 0.1),
|
|
87
89
|
0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
90
|
+
pointer-events: auto;
|
|
88
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polymarbot/nuxt-layer-shadcn-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Nuxt layer providing shadcn-vue based UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"vue-i18n": "^11",
|
|
43
43
|
"vue-router": "^4 || ^5"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "79d1ad5f798390469ac3cdfa7aed7ddc530a6c1e"
|
|
46
46
|
}
|