@soave/ui 0.1.0 → 0.2.1
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/dist/adapters/css-variables.d.ts +2 -0
- package/dist/adapters/css-variables.mjs +228 -0
- package/dist/adapters/headless.d.ts +7 -0
- package/dist/adapters/headless.mjs +7 -0
- package/dist/adapters/index.d.ts +5 -0
- package/dist/adapters/index.mjs +11 -0
- package/dist/adapters/tailwind.d.ts +2 -0
- package/dist/adapters/tailwind.mjs +443 -0
- package/dist/adapters/types.d.ts +38 -0
- package/dist/adapters/types.mjs +10 -0
- package/dist/build.config.mjs +1 -1
- package/dist/components/ui/Alert.vue +18 -16
- package/dist/components/ui/AlertDescription.vue +13 -3
- package/dist/components/ui/AlertTitle.vue +13 -3
- package/dist/components/ui/Button.vue +30 -4
- package/dist/components/ui/Card.vue +27 -3
- package/dist/components/ui/CardContent.vue +13 -3
- package/dist/components/ui/CardDescription.vue +13 -3
- package/dist/components/ui/CardFooter.vue +13 -3
- package/dist/components/ui/CardHeader.vue +13 -3
- package/dist/components/ui/CardTitle.vue +13 -3
- package/dist/components/ui/Checkbox.vue +23 -2
- package/dist/components/ui/Dialog.vue +34 -17
- package/dist/components/ui/DialogDescription.vue +13 -3
- package/dist/components/ui/DialogFooter.vue +13 -3
- package/dist/components/ui/DialogHeader.vue +13 -3
- package/dist/components/ui/DialogTitle.vue +13 -3
- package/dist/components/ui/DropdownMenu.vue +4 -5
- package/dist/components/ui/DropdownMenuContent.vue +17 -14
- package/dist/components/ui/DropdownMenuItem.vue +12 -18
- package/dist/components/ui/DropdownMenuTrigger.vue +1 -1
- package/dist/components/ui/Input.vue +26 -3
- package/dist/components/ui/Popover.vue +4 -5
- package/dist/components/ui/PopoverContent.vue +17 -13
- package/dist/components/ui/PopoverTrigger.vue +1 -1
- package/dist/components/ui/RadioGroup.vue +12 -7
- package/dist/components/ui/RadioItem.vue +31 -10
- package/dist/components/ui/Select.vue +8 -1
- package/dist/components/ui/SelectContent.vue +31 -5
- package/dist/components/ui/SelectItem.vue +20 -16
- package/dist/components/ui/SelectTrigger.vue +39 -7
- package/dist/components/ui/SelectValue.vue +13 -2
- package/dist/components/ui/Sheet.vue +34 -26
- package/dist/components/ui/SheetDescription.vue +13 -6
- package/dist/components/ui/SheetFooter.vue +13 -6
- package/dist/components/ui/SheetHeader.vue +13 -6
- package/dist/components/ui/SheetTitle.vue +13 -6
- package/dist/components/ui/Switch.vue +23 -3
- package/dist/components/ui/Textarea.vue +26 -3
- package/dist/components/ui/Toast.vue +38 -29
- package/dist/components/ui/Toaster.vue +12 -16
- package/dist/components/ui/TooltipContent.vue +18 -15
- package/dist/components/ui/UIProvider.vue +6 -2
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/index.mjs +1 -1
- package/dist/composables/useUIConfig.d.ts +16 -5
- package/dist/composables/useUIConfig.mjs +26 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/styles/css-variables.css +1 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/index.mjs +1 -0
- package/dist/types/alert.d.ts +2 -0
- package/dist/types/card.d.ts +5 -0
- package/dist/types/composables.d.ts +122 -0
- package/dist/types/composables.mjs +0 -0
- package/dist/types/config.d.ts +8 -0
- package/dist/types/dialog.d.ts +12 -1
- package/dist/types/dialog.mjs +1 -0
- package/dist/types/dropdown.d.ts +11 -0
- package/dist/types/dropdown.mjs +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/popover.d.ts +9 -0
- package/dist/types/popover.mjs +1 -0
- package/dist/types/radio.d.ts +4 -0
- package/dist/types/select.d.ts +21 -0
- package/dist/types/sheet.d.ts +21 -0
- package/dist/types/sheet.mjs +1 -0
- package/dist/types/toast.d.ts +2 -0
- package/dist/types/tooltip.d.ts +6 -0
- package/package.json +9 -1
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import { toRef } from "vue"
|
|
8
|
+
import { toRef, computed } from "vue"
|
|
9
9
|
import { useCard } from "../../composables/useCard"
|
|
10
|
+
import { useStyleAdapter, useUI } from "../../composables/useUIConfig"
|
|
10
11
|
import type { CardProps } from "../../types/card"
|
|
12
|
+
import type { CardState } from "../../types/composables"
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
interface CardComponentProps extends CardProps {
|
|
15
|
+
class?: string
|
|
16
|
+
unstyled?: boolean
|
|
17
|
+
}
|
|
13
18
|
|
|
19
|
+
const props = withDefaults(defineProps<CardComponentProps>(), {
|
|
20
|
+
unstyled: false
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const ui_config = useUI("card")
|
|
24
|
+
const style_adapter = useStyleAdapter()
|
|
14
25
|
const composable = useCard(toRef(() => props))
|
|
26
|
+
|
|
27
|
+
// StyleAdapterからクラスを取得
|
|
28
|
+
const computed_classes = computed(() => {
|
|
29
|
+
if (props.unstyled) {
|
|
30
|
+
return ""
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const state: CardState = {
|
|
34
|
+
padding: props.padding ?? ui_config.default_padding
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return style_adapter.getClasses("card", state)
|
|
38
|
+
})
|
|
15
39
|
</script>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { CardContentProps } from "../../types/card"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<CardContentProps>()
|
|
12
|
+
const props = withDefaults(defineProps<CardContentProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("card-content", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<p :class="
|
|
2
|
+
<p :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</p>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { CardDescriptionProps } from "../../types/card"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<CardDescriptionProps>()
|
|
12
|
+
const props = withDefaults(defineProps<CardDescriptionProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("card-description", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { CardFooterProps } from "../../types/card"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<CardFooterProps>()
|
|
12
|
+
const props = withDefaults(defineProps<CardFooterProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("card-footer", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { CardHeaderProps } from "../../types/card"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<CardHeaderProps>()
|
|
12
|
+
const props = withDefaults(defineProps<CardHeaderProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("card-header", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<h3 :class="
|
|
2
|
+
<h3 :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</h3>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { CardTitleProps } from "../../types/card"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<CardTitleProps>()
|
|
12
|
+
const props = withDefaults(defineProps<CardTitleProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("card-title", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
3
|
type="button"
|
|
4
|
-
:class="
|
|
4
|
+
:class="[computed_classes, props.class]"
|
|
5
5
|
:disabled="composable.is_disabled.value"
|
|
6
6
|
:data-state="dataState"
|
|
7
7
|
v-bind="composable.aria_attributes.value"
|
|
@@ -41,25 +41,46 @@
|
|
|
41
41
|
<script setup lang="ts">
|
|
42
42
|
import { computed, toRef } from "vue"
|
|
43
43
|
import { useCheckbox } from "../../composables/useCheckbox"
|
|
44
|
+
import { useStyleAdapter } from "../../composables/useUIConfig"
|
|
44
45
|
import type { CheckboxProps } from "../../types/checkbox"
|
|
46
|
+
import type { CheckboxState } from "../../types/composables"
|
|
45
47
|
|
|
46
48
|
interface Props extends CheckboxProps {
|
|
47
49
|
modelValue?: boolean
|
|
50
|
+
class?: string
|
|
51
|
+
unstyled?: boolean
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
const props = withDefaults(defineProps<Props>(), {
|
|
51
55
|
modelValue: false,
|
|
52
56
|
disabled: false,
|
|
53
|
-
indeterminate: false
|
|
57
|
+
indeterminate: false,
|
|
58
|
+
unstyled: false
|
|
54
59
|
})
|
|
55
60
|
|
|
56
61
|
const emit = defineEmits<{
|
|
57
62
|
"update:modelValue": [value: boolean]
|
|
58
63
|
}>()
|
|
59
64
|
|
|
65
|
+
const style_adapter = useStyleAdapter()
|
|
60
66
|
const checked = toRef(() => props.modelValue)
|
|
61
67
|
const composable = useCheckbox(toRef(() => props), checked)
|
|
62
68
|
|
|
69
|
+
// StyleAdapterからクラスを取得
|
|
70
|
+
const computed_classes = computed(() => {
|
|
71
|
+
if (props.unstyled) {
|
|
72
|
+
return ""
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const state: CheckboxState = {
|
|
76
|
+
checked: props.modelValue,
|
|
77
|
+
disabled: composable.is_disabled.value,
|
|
78
|
+
indeterminate: composable.is_indeterminate.value
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return style_adapter.getClasses("checkbox", state)
|
|
82
|
+
})
|
|
83
|
+
|
|
63
84
|
const dataState = computed(() => {
|
|
64
85
|
if (props.indeterminate) return "indeterminate"
|
|
65
86
|
return props.modelValue ? "checked" : "unchecked"
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
class="fixed inset-0 z-50 flex items-center justify-center"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
class="
|
|
9
|
+
:class="overlay_classes"
|
|
10
10
|
@click="handleOverlayClick"
|
|
11
11
|
/>
|
|
12
12
|
<div
|
|
13
|
-
class="
|
|
13
|
+
:class="[computed_classes, props.class]"
|
|
14
14
|
role="dialog"
|
|
15
15
|
aria-modal="true"
|
|
16
16
|
>
|
|
17
17
|
<slot />
|
|
18
18
|
<button
|
|
19
19
|
v-if="show_close_button"
|
|
20
|
-
class="
|
|
20
|
+
:class="close_button_classes"
|
|
21
21
|
@click="close"
|
|
22
22
|
>
|
|
23
23
|
<svg
|
|
@@ -44,24 +44,29 @@
|
|
|
44
44
|
</template>
|
|
45
45
|
|
|
46
46
|
<script setup lang="ts">
|
|
47
|
-
import { computed, provide
|
|
47
|
+
import { computed, provide } from "vue"
|
|
48
|
+
import { useStyleAdapter } from "../../composables"
|
|
49
|
+
import type { DialogProps } from "../../types/dialog"
|
|
50
|
+
import { DIALOG_KEY } from "../../types/dialog"
|
|
51
|
+
import type { DialogState } from "../../types/composables"
|
|
48
52
|
|
|
49
|
-
interface
|
|
50
|
-
|
|
51
|
-
modal?: boolean
|
|
52
|
-
showCloseButton?: boolean
|
|
53
|
+
interface DialogComponentProps extends DialogProps {
|
|
54
|
+
class?: string
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
const props = withDefaults(defineProps<
|
|
57
|
+
const props = withDefaults(defineProps<DialogComponentProps>(), {
|
|
56
58
|
open: false,
|
|
57
59
|
modal: true,
|
|
58
|
-
showCloseButton: true
|
|
60
|
+
showCloseButton: true,
|
|
61
|
+
unstyled: false
|
|
59
62
|
})
|
|
60
63
|
|
|
61
64
|
const emit = defineEmits<{
|
|
62
65
|
"update:open": [value: boolean]
|
|
63
66
|
}>()
|
|
64
67
|
|
|
68
|
+
const style_adapter = useStyleAdapter()
|
|
69
|
+
|
|
65
70
|
const is_open = computed({
|
|
66
71
|
get: () => props.open,
|
|
67
72
|
set: (value) => emit("update:open", value)
|
|
@@ -69,6 +74,24 @@ const is_open = computed({
|
|
|
69
74
|
|
|
70
75
|
const show_close_button = computed(() => props.showCloseButton)
|
|
71
76
|
|
|
77
|
+
const computed_classes = computed(() => {
|
|
78
|
+
if (props.unstyled) return ""
|
|
79
|
+
const state: DialogState = {
|
|
80
|
+
is_open: is_open.value
|
|
81
|
+
}
|
|
82
|
+
return style_adapter.getClasses("dialog", state)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const overlay_classes = computed(() => {
|
|
86
|
+
if (props.unstyled) return ""
|
|
87
|
+
return style_adapter.getClasses("dialog-overlay", {})
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const close_button_classes = computed(() => {
|
|
91
|
+
if (props.unstyled) return ""
|
|
92
|
+
return style_adapter.getClasses("dialog-close", {})
|
|
93
|
+
})
|
|
94
|
+
|
|
72
95
|
const close = () => {
|
|
73
96
|
is_open.value = false
|
|
74
97
|
}
|
|
@@ -79,13 +102,7 @@ const handleOverlayClick = () => {
|
|
|
79
102
|
}
|
|
80
103
|
}
|
|
81
104
|
|
|
82
|
-
|
|
83
|
-
close: () => void
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export const DialogKey: InjectionKey<DialogContext> = Symbol("dialog")
|
|
87
|
-
|
|
88
|
-
provide(DialogKey, { close })
|
|
105
|
+
provide(DIALOG_KEY, { close })
|
|
89
106
|
</script>
|
|
90
107
|
|
|
91
108
|
<style scoped>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<p :class="
|
|
2
|
+
<p :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</p>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { DialogDescriptionProps } from "../../types/dialog"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<DialogDescriptionProps>()
|
|
12
|
+
const props = withDefaults(defineProps<DialogDescriptionProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("dialog-description", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { DialogFooterProps } from "../../types/dialog"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<DialogFooterProps>()
|
|
12
|
+
const props = withDefaults(defineProps<DialogFooterProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("dialog-footer", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { DialogHeaderProps } from "../../types/dialog"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<DialogHeaderProps>()
|
|
12
|
+
const props = withDefaults(defineProps<DialogHeaderProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("dialog-header", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<h2 :class="
|
|
2
|
+
<h2 :class="[computed_classes, props.class]">
|
|
3
3
|
<slot />
|
|
4
4
|
</h2>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import {
|
|
8
|
+
import { computed } from "vue"
|
|
9
|
+
import { useStyleAdapter } from "../../composables"
|
|
9
10
|
import type { DialogTitleProps } from "../../types/dialog"
|
|
10
11
|
|
|
11
|
-
const props = defineProps<DialogTitleProps>()
|
|
12
|
+
const props = withDefaults(defineProps<DialogTitleProps>(), {
|
|
13
|
+
unstyled: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const style_adapter = useStyleAdapter()
|
|
17
|
+
|
|
18
|
+
const computed_classes = computed(() => {
|
|
19
|
+
if (props.unstyled) return ""
|
|
20
|
+
return style_adapter.getClasses("dialog-title", {})
|
|
21
|
+
})
|
|
12
22
|
</script>
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
import { provide, ref, type
|
|
9
|
-
import { useDropdown
|
|
8
|
+
import { provide, ref, type Ref } from "vue"
|
|
9
|
+
import { useDropdown } from "../../composables/useDropdown"
|
|
10
10
|
import type { DropdownSide, DropdownAlign } from "../../types/dropdown"
|
|
11
|
+
import { DROPDOWN_CONTEXT_KEY } from "../../types/dropdown"
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
interface Props {
|
|
13
14
|
side?: DropdownSide
|
|
14
15
|
align?: DropdownAlign
|
|
15
16
|
class?: string
|
|
@@ -20,8 +21,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
20
21
|
align: "start"
|
|
21
22
|
})
|
|
22
23
|
|
|
23
|
-
export const DROPDOWN_CONTEXT_KEY: InjectionKey<UseDropdownReturn> = Symbol("dropdown-context")
|
|
24
|
-
|
|
25
24
|
const dropdown_props = ref({
|
|
26
25
|
side: props.side,
|
|
27
26
|
align: props.align
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
role="menu"
|
|
8
8
|
:aria-labelledby="`${dropdown_id}-trigger`"
|
|
9
9
|
:style="position_styles"
|
|
10
|
-
:class="
|
|
10
|
+
:class="[computed_classes, props.class]"
|
|
11
11
|
tabindex="-1"
|
|
12
12
|
@keydown="handleContentKeyDown"
|
|
13
13
|
>
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
|
-
import { inject, ref, watchEffect, nextTick, watch } from "vue"
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
20
|
+
import { inject, ref, computed, watchEffect, nextTick, watch } from "vue"
|
|
21
|
+
import { useStyleAdapter } from "../../composables"
|
|
22
|
+
import type { DropdownContentProps } from "../../types/dropdown"
|
|
23
|
+
import { DROPDOWN_CONTEXT_KEY } from "../../types/dropdown"
|
|
24
|
+
import type { DropdownState } from "../../types/composables"
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const props = defineProps<Props>()
|
|
26
|
+
const props = withDefaults(defineProps<DropdownContentProps>(), {
|
|
27
|
+
unstyled: false
|
|
28
|
+
})
|
|
29
29
|
|
|
30
30
|
const context = inject(DROPDOWN_CONTEXT_KEY)
|
|
31
31
|
|
|
@@ -41,6 +41,7 @@ const {
|
|
|
41
41
|
handleContentKeyDown
|
|
42
42
|
} = context
|
|
43
43
|
|
|
44
|
+
const style_adapter = useStyleAdapter()
|
|
44
45
|
const content_element = ref<HTMLElement | null>(null)
|
|
45
46
|
|
|
46
47
|
watchEffect(() => {
|
|
@@ -54,11 +55,13 @@ watch(is_open, async (open) => {
|
|
|
54
55
|
}
|
|
55
56
|
})
|
|
56
57
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const computed_classes = computed(() => {
|
|
59
|
+
if (props.unstyled) return ""
|
|
60
|
+
const state: DropdownState = {
|
|
61
|
+
is_open: is_open.value
|
|
62
|
+
}
|
|
63
|
+
return style_adapter.getClasses("dropdown", state)
|
|
64
|
+
})
|
|
62
65
|
</script>
|
|
63
66
|
|
|
64
67
|
<style scoped>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div
|
|
3
3
|
role="menuitem"
|
|
4
4
|
:tabindex="disabled ? -1 : 0"
|
|
5
|
-
:class="
|
|
5
|
+
:class="[computed_classes, props.class]"
|
|
6
6
|
:aria-disabled="disabled"
|
|
7
7
|
:data-highlighted="is_active ? '' : undefined"
|
|
8
8
|
:data-disabled="disabled ? '' : undefined"
|
|
@@ -17,18 +17,14 @@
|
|
|
17
17
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
19
|
import { inject, computed, onMounted } from "vue"
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { useStyleAdapter } from "../../composables"
|
|
21
|
+
import type { DropdownItemProps } from "../../types/dropdown"
|
|
22
|
+
import { DROPDOWN_CONTEXT_KEY } from "../../types/dropdown"
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
disabled?: boolean
|
|
25
|
-
destructive?: boolean
|
|
26
|
-
class?: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
24
|
+
const props = withDefaults(defineProps<DropdownItemProps>(), {
|
|
30
25
|
disabled: false,
|
|
31
|
-
destructive: false
|
|
26
|
+
destructive: false,
|
|
27
|
+
unstyled: false
|
|
32
28
|
})
|
|
33
29
|
|
|
34
30
|
const emit = defineEmits<{
|
|
@@ -42,6 +38,7 @@ if (!context) {
|
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
const { active_item_index, close, registerItem, setActiveItem } = context
|
|
41
|
+
const style_adapter = useStyleAdapter()
|
|
45
42
|
|
|
46
43
|
let item_index = -1
|
|
47
44
|
|
|
@@ -67,11 +64,8 @@ const handleMouseEnter = (): void => {
|
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
75
|
-
props.destructive && "text-destructive focus:text-destructive"
|
|
76
|
-
))
|
|
67
|
+
const computed_classes = computed(() => {
|
|
68
|
+
if (props.unstyled) return ""
|
|
69
|
+
return style_adapter.getClasses("dropdown-item", {})
|
|
70
|
+
})
|
|
77
71
|
</script>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<input
|
|
3
3
|
:id="id"
|
|
4
4
|
:type="type"
|
|
5
|
-
:class="
|
|
5
|
+
:class="[computed_classes, props.class]"
|
|
6
6
|
:disabled="composable.is_disabled.value"
|
|
7
7
|
:readonly="composable.is_readonly.value"
|
|
8
8
|
:placeholder="placeholder"
|
|
@@ -15,19 +15,24 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script setup lang="ts">
|
|
18
|
-
import { toRef } from "vue"
|
|
18
|
+
import { toRef, computed } from "vue"
|
|
19
19
|
import { useInput } from "../../composables/useInput"
|
|
20
|
+
import { useStyleAdapter, useUI } from "../../composables/useUIConfig"
|
|
20
21
|
import type { InputProps, InputType } from "../../types/input"
|
|
22
|
+
import type { InputState } from "../../types/composables"
|
|
21
23
|
|
|
22
24
|
interface Props extends InputProps {
|
|
23
25
|
id?: string
|
|
24
26
|
modelValue?: string | number
|
|
27
|
+
class?: string
|
|
28
|
+
unstyled?: boolean
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
const props = withDefaults(defineProps<Props>(), {
|
|
28
32
|
type: "text" as InputType,
|
|
29
33
|
disabled: false,
|
|
30
|
-
readonly: false
|
|
34
|
+
readonly: false,
|
|
35
|
+
unstyled: false
|
|
31
36
|
})
|
|
32
37
|
|
|
33
38
|
const emit = defineEmits<{
|
|
@@ -35,8 +40,26 @@ const emit = defineEmits<{
|
|
|
35
40
|
blur: [event: FocusEvent]
|
|
36
41
|
}>()
|
|
37
42
|
|
|
43
|
+
const ui_config = useUI("input")
|
|
44
|
+
const style_adapter = useStyleAdapter()
|
|
38
45
|
const composable = useInput(toRef(() => props))
|
|
39
46
|
|
|
47
|
+
// StyleAdapterからクラスを取得
|
|
48
|
+
const computed_classes = computed(() => {
|
|
49
|
+
if (props.unstyled) {
|
|
50
|
+
return ""
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const state: InputState = {
|
|
54
|
+
size: props.size ?? ui_config.default_size,
|
|
55
|
+
disabled: composable.is_disabled.value,
|
|
56
|
+
readonly: composable.is_readonly.value,
|
|
57
|
+
error: props.error
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return style_adapter.getClasses("input", state)
|
|
61
|
+
})
|
|
62
|
+
|
|
40
63
|
const handleInput = (event: Event) => {
|
|
41
64
|
const target = event.target as HTMLInputElement
|
|
42
65
|
emit("update:modelValue", target.value)
|