@soave/ui 0.2.2 → 0.3.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/components/Button.vue +36 -0
- package/dist/components/Card.vue +23 -0
- package/dist/components/Checkbox.vue +44 -0
- package/dist/components/Dialog.vue +99 -0
- package/dist/components/Input.vue +48 -0
- package/dist/components/RadioGroup.vue +35 -0
- package/dist/components/RadioItem.vue +55 -0
- package/dist/components/Select.vue +95 -0
- package/dist/components/SelectContent.vue +40 -0
- package/dist/components/SelectItem.vue +44 -0
- package/dist/components/SelectTrigger.vue +61 -0
- package/dist/components/Switch.vue +43 -0
- package/dist/components/Textarea.vue +55 -0
- package/dist/components/index.d.ts +13 -0
- package/dist/components/index.mjs +13 -0
- package/dist/composables/useButton.d.ts +2 -2
- package/dist/composables/useButton.mjs +14 -41
- package/dist/composables/useCard.d.ts +2 -2
- package/dist/composables/useCard.mjs +5 -18
- package/dist/composables/useCheckbox.d.ts +2 -1
- package/dist/composables/useCheckbox.mjs +11 -44
- package/dist/composables/useFileInput.d.ts +2 -0
- package/dist/composables/useFileInput.mjs +15 -30
- package/dist/composables/useInput.d.ts +2 -2
- package/dist/composables/useInput.mjs +12 -33
- package/dist/composables/useRadio.d.ts +2 -1
- package/dist/composables/useRadio.mjs +10 -42
- package/dist/composables/useSelect.d.ts +3 -0
- package/dist/composables/useSelect.mjs +20 -49
- package/dist/composables/useSwitch.d.ts +2 -1
- package/dist/composables/useSwitch.mjs +10 -43
- package/dist/composables/useTextarea.d.ts +2 -1
- package/dist/composables/useTextarea.mjs +12 -33
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types/button.d.ts +19 -5
- package/dist/types/card.d.ts +11 -2
- package/dist/types/checkbox.d.ts +15 -6
- package/dist/types/composables.d.ts +33 -5
- package/dist/types/file-input.d.ts +15 -5
- package/dist/types/input.d.ts +17 -6
- package/dist/types/radio.d.ts +14 -6
- package/dist/types/select.d.ts +25 -7
- package/dist/types/switch.d.ts +14 -5
- package/dist/types/textarea.d.ts +18 -7
- package/package.json +1 -9
- package/dist/components/ui/Alert.vue +0 -41
- package/dist/components/ui/AlertDescription.vue +0 -22
- package/dist/components/ui/AlertTitle.vue +0 -22
- package/dist/components/ui/Button.vue +0 -85
- package/dist/components/ui/Card.vue +0 -39
- package/dist/components/ui/CardContent.vue +0 -22
- package/dist/components/ui/CardDescription.vue +0 -22
- package/dist/components/ui/CardFooter.vue +0 -22
- package/dist/components/ui/CardHeader.vue +0 -22
- package/dist/components/ui/CardTitle.vue +0 -22
- package/dist/components/ui/Checkbox.vue +0 -94
- package/dist/components/ui/Dialog.vue +0 -110
- package/dist/components/ui/DialogDescription.vue +0 -22
- package/dist/components/ui/DialogFooter.vue +0 -22
- package/dist/components/ui/DialogHeader.vue +0 -22
- package/dist/components/ui/DialogTitle.vue +0 -22
- package/dist/components/ui/DropdownMenu.vue +0 -32
- package/dist/components/ui/DropdownMenuContent.vue +0 -69
- package/dist/components/ui/DropdownMenuItem.vue +0 -71
- package/dist/components/ui/DropdownMenuLabel.vue +0 -20
- package/dist/components/ui/DropdownMenuSeparator.vue +0 -16
- package/dist/components/ui/DropdownMenuTrigger.vue +0 -38
- package/dist/components/ui/FileInput.vue +0 -153
- package/dist/components/ui/FormError.vue +0 -20
- package/dist/components/ui/FormField.vue +0 -12
- package/dist/components/ui/FormInput.vue +0 -46
- package/dist/components/ui/FormLabel.vue +0 -19
- package/dist/components/ui/FormTextarea.vue +0 -39
- package/dist/components/ui/Input.vue +0 -72
- package/dist/components/ui/Popover.vue +0 -35
- package/dist/components/ui/PopoverContent.vue +0 -66
- package/dist/components/ui/PopoverTrigger.vue +0 -36
- package/dist/components/ui/RadioGroup.vue +0 -47
- package/dist/components/ui/RadioItem.vue +0 -62
- package/dist/components/ui/Select.vue +0 -62
- package/dist/components/ui/SelectContent.vue +0 -55
- package/dist/components/ui/SelectItem.vue +0 -55
- package/dist/components/ui/SelectTrigger.vue +0 -70
- package/dist/components/ui/SelectValue.vue +0 -27
- package/dist/components/ui/Sheet.vue +0 -148
- package/dist/components/ui/SheetDescription.vue +0 -22
- package/dist/components/ui/SheetFooter.vue +0 -22
- package/dist/components/ui/SheetHeader.vue +0 -22
- package/dist/components/ui/SheetTitle.vue +0 -22
- package/dist/components/ui/Switch.vue +0 -63
- package/dist/components/ui/Textarea.vue +0 -73
- package/dist/components/ui/Toast.vue +0 -116
- package/dist/components/ui/Toaster.vue +0 -76
- package/dist/components/ui/Tooltip.vue +0 -41
- package/dist/components/ui/TooltipContent.vue +0 -71
- package/dist/components/ui/TooltipTrigger.vue +0 -39
- package/dist/components/ui/UIProvider.vue +0 -23
- package/dist/components/ui/index.d.ts +0 -52
- package/dist/components/ui/index.mjs +0 -52
|
@@ -2,6 +2,7 @@ import { type Ref } from "vue";
|
|
|
2
2
|
import type { TextareaProps, TextareaReturn } from "../types/textarea";
|
|
3
3
|
/**
|
|
4
4
|
* Textareaコンポーネントのロジックを提供するComposable
|
|
5
|
-
*
|
|
5
|
+
* 状態とARIA属性のみを返す(スタイル情報なし)
|
|
6
|
+
* スタイルは StyleAdapter または外部のスタイルパッケージが担当
|
|
6
7
|
*/
|
|
7
8
|
export declare const useTextarea: (props: Ref<TextareaProps>) => TextareaReturn;
|
|
@@ -1,35 +1,17 @@
|
|
|
1
|
-
import { computed, ref } from "vue";
|
|
2
|
-
import { cn } from "../utils/cn.mjs";
|
|
1
|
+
import { computed, ref, readonly } from "vue";
|
|
3
2
|
export const useTextarea = (props) => {
|
|
4
3
|
const is_focused = ref(false);
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
horizontal: "resize-x",
|
|
13
|
-
both: "resize"
|
|
14
|
-
};
|
|
15
|
-
return resize_map[props.value.resize ?? "vertical"];
|
|
16
|
-
});
|
|
17
|
-
const base_classes = computed(
|
|
18
|
-
() => cn(
|
|
19
|
-
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2",
|
|
20
|
-
"text-sm ring-offset-background",
|
|
21
|
-
"placeholder:text-muted-foreground",
|
|
22
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
23
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
24
|
-
resize_classes.value,
|
|
25
|
-
has_error.value && "border-destructive focus-visible:ring-destructive",
|
|
26
|
-
is_readonly.value && "bg-muted"
|
|
27
|
-
)
|
|
28
|
-
);
|
|
4
|
+
const state = computed(() => ({
|
|
5
|
+
size: props.value.size ?? "md",
|
|
6
|
+
disabled: props.value.disabled ?? false,
|
|
7
|
+
readonly: props.value.readonly ?? false,
|
|
8
|
+
has_error: !!props.value.error,
|
|
9
|
+
resize: props.value.resize ?? "vertical"
|
|
10
|
+
}));
|
|
29
11
|
const aria_attributes = computed(() => ({
|
|
30
|
-
"aria-invalid":
|
|
12
|
+
"aria-invalid": state.value.has_error || void 0,
|
|
31
13
|
"aria-describedby": props.value.error_id,
|
|
32
|
-
"aria-readonly":
|
|
14
|
+
"aria-readonly": state.value.readonly || void 0
|
|
33
15
|
}));
|
|
34
16
|
const handleFocus = () => {
|
|
35
17
|
is_focused.value = true;
|
|
@@ -38,12 +20,9 @@ export const useTextarea = (props) => {
|
|
|
38
20
|
is_focused.value = false;
|
|
39
21
|
};
|
|
40
22
|
return {
|
|
41
|
-
|
|
23
|
+
state: readonly(state),
|
|
42
24
|
is_focused,
|
|
43
|
-
|
|
44
|
-
is_disabled,
|
|
45
|
-
is_readonly,
|
|
46
|
-
aria_attributes,
|
|
25
|
+
aria_attributes: readonly(aria_attributes),
|
|
47
26
|
handleFocus,
|
|
48
27
|
handleBlur
|
|
49
28
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
package/dist/types/button.d.ts
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import type { ComputedRef } from "vue";
|
|
1
|
+
import type { ComputedRef, DeepReadonly } from "vue";
|
|
2
2
|
export type ButtonVariant = "primary" | "secondary" | "ghost" | "outline" | "destructive";
|
|
3
3
|
export type ButtonSize = "sm" | "md" | "lg";
|
|
4
|
+
export type ButtonType = "button" | "submit" | "reset";
|
|
4
5
|
export interface ButtonProps {
|
|
5
6
|
variant?: ButtonVariant;
|
|
6
7
|
size?: ButtonSize;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
loading?: boolean;
|
|
10
|
+
type?: ButtonType;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* ボタンの状態(StyleAdapterに渡す用)
|
|
14
|
+
*/
|
|
15
|
+
export interface ButtonState {
|
|
16
|
+
variant: ButtonVariant;
|
|
17
|
+
size: ButtonSize;
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
loading: boolean;
|
|
20
|
+
type: ButtonType;
|
|
9
21
|
}
|
|
10
22
|
export interface ButtonAriaAttributes {
|
|
11
23
|
"aria-disabled"?: boolean;
|
|
12
24
|
"aria-busy"?: boolean;
|
|
13
25
|
role: "button";
|
|
26
|
+
type: ButtonType;
|
|
14
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* useButton の戻り値(ヘッドレス - スタイル情報なし)
|
|
30
|
+
*/
|
|
15
31
|
export interface ButtonReturn {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
is_loading: ComputedRef<boolean>;
|
|
19
|
-
aria_attributes: ComputedRef<ButtonAriaAttributes>;
|
|
32
|
+
state: DeepReadonly<ComputedRef<ButtonState>>;
|
|
33
|
+
aria_attributes: DeepReadonly<ComputedRef<ButtonAriaAttributes>>;
|
|
20
34
|
}
|
package/dist/types/card.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import type { ComputedRef } from "vue";
|
|
1
|
+
import type { ComputedRef, DeepReadonly } from "vue";
|
|
2
2
|
export type CardPadding = "sm" | "md" | "lg" | "none";
|
|
3
3
|
export interface CardProps {
|
|
4
4
|
padding?: CardPadding;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* カードの状態(StyleAdapterに渡す用)
|
|
8
|
+
*/
|
|
9
|
+
export interface CardState {
|
|
10
|
+
padding: CardPadding;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* useCard の戻り値(ヘッドレス - スタイル情報なし)
|
|
14
|
+
*/
|
|
6
15
|
export interface CardReturn {
|
|
7
|
-
|
|
16
|
+
state: DeepReadonly<ComputedRef<CardState>>;
|
|
8
17
|
}
|
|
9
18
|
export interface CardHeaderProps {
|
|
10
19
|
class?: string;
|
package/dist/types/checkbox.d.ts
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import type { ComputedRef } from "vue";
|
|
1
|
+
import type { ComputedRef, DeepReadonly } from "vue";
|
|
2
2
|
export type CheckboxSize = "sm" | "md" | "lg";
|
|
3
3
|
export interface CheckboxProps {
|
|
4
4
|
size?: CheckboxSize;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
indeterminate?: boolean;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* チェックボックスの状態(StyleAdapterに渡す用)
|
|
10
|
+
*/
|
|
11
|
+
export interface CheckboxState {
|
|
12
|
+
size: CheckboxSize;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
indeterminate: boolean;
|
|
15
|
+
checked: boolean;
|
|
16
|
+
}
|
|
8
17
|
export interface CheckboxAriaAttributes {
|
|
9
18
|
role: "checkbox";
|
|
10
19
|
"aria-checked": boolean | "mixed";
|
|
11
20
|
"aria-disabled"?: boolean;
|
|
12
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* useCheckbox の戻り値(ヘッドレス - スタイル情報なし)
|
|
24
|
+
*/
|
|
13
25
|
export interface CheckboxReturn {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
is_disabled: ComputedRef<boolean>;
|
|
17
|
-
is_indeterminate: ComputedRef<boolean>;
|
|
18
|
-
aria_attributes: ComputedRef<CheckboxAriaAttributes>;
|
|
26
|
+
state: DeepReadonly<ComputedRef<CheckboxState>>;
|
|
27
|
+
aria_attributes: DeepReadonly<ComputedRef<CheckboxAriaAttributes>>;
|
|
19
28
|
}
|
|
@@ -13,15 +13,17 @@ export interface ButtonState extends ComponentState {
|
|
|
13
13
|
size: "sm" | "md" | "lg";
|
|
14
14
|
disabled: boolean;
|
|
15
15
|
loading: boolean;
|
|
16
|
+
type: "button" | "submit" | "reset";
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Input の状態
|
|
19
20
|
*/
|
|
20
21
|
export interface InputState extends ComponentState {
|
|
22
|
+
type: "text" | "email" | "password" | "number" | "tel" | "url" | "search";
|
|
21
23
|
size: "sm" | "md" | "lg";
|
|
22
24
|
disabled: boolean;
|
|
23
25
|
readonly: boolean;
|
|
24
|
-
|
|
26
|
+
has_error: boolean;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Dialog の状態
|
|
@@ -39,6 +41,7 @@ export interface CardState extends ComponentState {
|
|
|
39
41
|
* Checkbox の状態
|
|
40
42
|
*/
|
|
41
43
|
export interface CheckboxState extends ComponentState {
|
|
44
|
+
size: "sm" | "md" | "lg";
|
|
42
45
|
checked: boolean;
|
|
43
46
|
disabled: boolean;
|
|
44
47
|
indeterminate: boolean;
|
|
@@ -46,7 +49,8 @@ export interface CheckboxState extends ComponentState {
|
|
|
46
49
|
/**
|
|
47
50
|
* Radio の状態
|
|
48
51
|
*/
|
|
49
|
-
export interface
|
|
52
|
+
export interface RadioItemState extends ComponentState {
|
|
53
|
+
size: "sm" | "md" | "lg";
|
|
50
54
|
checked: boolean;
|
|
51
55
|
disabled: boolean;
|
|
52
56
|
}
|
|
@@ -54,6 +58,7 @@ export interface RadioState extends ComponentState {
|
|
|
54
58
|
* Switch の状態
|
|
55
59
|
*/
|
|
56
60
|
export interface SwitchState extends ComponentState {
|
|
61
|
+
size: "sm" | "md" | "lg";
|
|
57
62
|
checked: boolean;
|
|
58
63
|
disabled: boolean;
|
|
59
64
|
}
|
|
@@ -64,16 +69,39 @@ export interface TextareaState extends ComponentState {
|
|
|
64
69
|
size: "sm" | "md" | "lg";
|
|
65
70
|
disabled: boolean;
|
|
66
71
|
readonly: boolean;
|
|
67
|
-
|
|
72
|
+
has_error: boolean;
|
|
73
|
+
resize: "none" | "vertical" | "horizontal" | "both";
|
|
68
74
|
}
|
|
69
75
|
/**
|
|
70
|
-
* Select の状態
|
|
76
|
+
* Select Trigger の状態
|
|
71
77
|
*/
|
|
72
|
-
export interface
|
|
78
|
+
export interface SelectTriggerState extends ComponentState {
|
|
73
79
|
size: "sm" | "md" | "lg";
|
|
74
80
|
disabled: boolean;
|
|
75
81
|
is_open: boolean;
|
|
76
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Select Content の状態
|
|
85
|
+
*/
|
|
86
|
+
export interface SelectContentState extends ComponentState {
|
|
87
|
+
is_open: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Select Item の状態
|
|
91
|
+
*/
|
|
92
|
+
export interface SelectItemState extends ComponentState {
|
|
93
|
+
selected: boolean;
|
|
94
|
+
disabled: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* FileInput の状態
|
|
98
|
+
*/
|
|
99
|
+
export interface FileInputState extends ComponentState {
|
|
100
|
+
disabled: boolean;
|
|
101
|
+
is_dragging: boolean;
|
|
102
|
+
has_error: boolean;
|
|
103
|
+
has_files: boolean;
|
|
104
|
+
}
|
|
77
105
|
/**
|
|
78
106
|
* Toast の状態
|
|
79
107
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedRef, Ref } from "vue";
|
|
1
|
+
import type { ComputedRef, Ref, DeepReadonly } from "vue";
|
|
2
2
|
export interface FileInputProps {
|
|
3
3
|
accept?: string;
|
|
4
4
|
multiple?: boolean;
|
|
@@ -13,18 +13,28 @@ export interface FileInfo {
|
|
|
13
13
|
type: string;
|
|
14
14
|
preview_url: string | null;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* ファイル入力の状態(StyleAdapterに渡す用)
|
|
18
|
+
*/
|
|
19
|
+
export interface FileInputState {
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
is_dragging: boolean;
|
|
22
|
+
has_error: boolean;
|
|
23
|
+
has_files: boolean;
|
|
24
|
+
}
|
|
16
25
|
export interface FileInputAriaAttributes {
|
|
17
26
|
"aria-disabled"?: boolean;
|
|
18
27
|
"aria-invalid"?: boolean;
|
|
19
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* useFileInput の戻り値(ヘッドレス - スタイル情報なし)
|
|
31
|
+
*/
|
|
20
32
|
export interface FileInputReturn {
|
|
21
|
-
|
|
22
|
-
dropzone_classes: ComputedRef<string>;
|
|
23
|
-
is_disabled: ComputedRef<boolean>;
|
|
33
|
+
state: DeepReadonly<ComputedRef<FileInputState>>;
|
|
24
34
|
is_dragging: Ref<boolean>;
|
|
25
35
|
files: Ref<FileInfo[]>;
|
|
26
36
|
error: Ref<string | null>;
|
|
27
|
-
aria_attributes: ComputedRef<FileInputAriaAttributes
|
|
37
|
+
aria_attributes: DeepReadonly<ComputedRef<FileInputAriaAttributes>>;
|
|
28
38
|
handleFiles: (file_list: FileList | null) => void;
|
|
29
39
|
handleDragEnter: (event: DragEvent) => void;
|
|
30
40
|
handleDragLeave: (event: DragEvent) => void;
|
package/dist/types/input.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedRef, Ref } from "vue";
|
|
1
|
+
import type { ComputedRef, Ref, DeepReadonly } from "vue";
|
|
2
2
|
export type InputSize = "sm" | "md" | "lg";
|
|
3
3
|
export type InputType = "text" | "email" | "password" | "number" | "tel" | "url" | "search";
|
|
4
4
|
export interface InputProps {
|
|
@@ -9,19 +9,30 @@ export interface InputProps {
|
|
|
9
9
|
readonly?: boolean;
|
|
10
10
|
error?: string;
|
|
11
11
|
error_id?: string;
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 入力の状態(StyleAdapterに渡す用)
|
|
16
|
+
*/
|
|
17
|
+
export interface InputState {
|
|
18
|
+
type: InputType;
|
|
19
|
+
size: InputSize;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
readonly: boolean;
|
|
22
|
+
has_error: boolean;
|
|
12
23
|
}
|
|
13
24
|
export interface InputAriaAttributes {
|
|
14
25
|
"aria-invalid"?: boolean;
|
|
15
26
|
"aria-describedby"?: string;
|
|
16
27
|
"aria-readonly"?: boolean;
|
|
17
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* useInput の戻り値(ヘッドレス - スタイル情報なし)
|
|
31
|
+
*/
|
|
18
32
|
export interface InputReturn {
|
|
19
|
-
|
|
33
|
+
state: DeepReadonly<ComputedRef<InputState>>;
|
|
20
34
|
is_focused: Ref<boolean>;
|
|
21
|
-
|
|
22
|
-
is_disabled: ComputedRef<boolean>;
|
|
23
|
-
is_readonly: ComputedRef<boolean>;
|
|
24
|
-
aria_attributes: ComputedRef<InputAriaAttributes>;
|
|
35
|
+
aria_attributes: DeepReadonly<ComputedRef<InputAriaAttributes>>;
|
|
25
36
|
handleFocus: () => void;
|
|
26
37
|
handleBlur: () => void;
|
|
27
38
|
}
|
package/dist/types/radio.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedRef, InjectionKey, Ref } from "vue";
|
|
1
|
+
import type { ComputedRef, InjectionKey, Ref, DeepReadonly } from "vue";
|
|
2
2
|
export type RadioSize = "sm" | "md" | "lg";
|
|
3
3
|
export interface RadioGroupProps {
|
|
4
4
|
disabled?: boolean;
|
|
@@ -19,15 +19,23 @@ export interface RadioGroupContext {
|
|
|
19
19
|
updateValue: (value: string) => void;
|
|
20
20
|
}
|
|
21
21
|
export declare const RADIO_GROUP_KEY: InjectionKey<RadioGroupContext>;
|
|
22
|
+
/**
|
|
23
|
+
* ラジオボタンの状態(StyleAdapterに渡す用)
|
|
24
|
+
*/
|
|
25
|
+
export interface RadioItemState {
|
|
26
|
+
size: RadioSize;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
checked: boolean;
|
|
29
|
+
}
|
|
22
30
|
export interface RadioAriaAttributes {
|
|
23
31
|
role: "radio";
|
|
24
32
|
"aria-checked": boolean;
|
|
25
33
|
"aria-disabled"?: boolean;
|
|
26
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* useRadioItem の戻り値(ヘッドレス - スタイル情報なし)
|
|
37
|
+
*/
|
|
27
38
|
export interface RadioItemReturn {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
is_checked: ComputedRef<boolean>;
|
|
31
|
-
is_disabled: ComputedRef<boolean>;
|
|
32
|
-
aria_attributes: ComputedRef<RadioAriaAttributes>;
|
|
39
|
+
state: DeepReadonly<ComputedRef<RadioItemState>>;
|
|
40
|
+
aria_attributes: DeepReadonly<ComputedRef<RadioAriaAttributes>>;
|
|
33
41
|
}
|
package/dist/types/select.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedRef, InjectionKey, Ref } from "vue";
|
|
1
|
+
import type { ComputedRef, InjectionKey, Ref, DeepReadonly } from "vue";
|
|
2
2
|
export type SelectSize = "sm" | "md" | "lg";
|
|
3
3
|
export interface SelectProps {
|
|
4
4
|
size?: SelectSize;
|
|
@@ -43,15 +43,33 @@ export interface SelectContext {
|
|
|
43
43
|
setTriggerRef: (element: HTMLElement | null) => void;
|
|
44
44
|
}
|
|
45
45
|
export declare const SELECT_KEY: InjectionKey<SelectContext>;
|
|
46
|
+
/**
|
|
47
|
+
* セレクトトリガーの状態(StyleAdapterに渡す用)
|
|
48
|
+
*/
|
|
49
|
+
export interface SelectTriggerState {
|
|
50
|
+
size: SelectSize;
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
is_open: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* セレクトコンテンツの状態(StyleAdapterに渡す用)
|
|
56
|
+
*/
|
|
57
|
+
export interface SelectContentState {
|
|
58
|
+
is_open: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* セレクトアイテムの状態(StyleAdapterに渡す用)
|
|
62
|
+
*/
|
|
63
|
+
export interface SelectItemState {
|
|
64
|
+
selected: boolean;
|
|
65
|
+
disabled: boolean;
|
|
66
|
+
}
|
|
46
67
|
export interface SelectTriggerReturn {
|
|
47
|
-
|
|
48
|
-
is_disabled: ComputedRef<boolean>;
|
|
68
|
+
state: DeepReadonly<ComputedRef<SelectTriggerState>>;
|
|
49
69
|
}
|
|
50
70
|
export interface SelectContentReturn {
|
|
51
|
-
|
|
71
|
+
state: DeepReadonly<ComputedRef<SelectContentState>>;
|
|
52
72
|
}
|
|
53
73
|
export interface SelectItemReturn {
|
|
54
|
-
|
|
55
|
-
is_selected: ComputedRef<boolean>;
|
|
56
|
-
is_disabled: ComputedRef<boolean>;
|
|
74
|
+
state: DeepReadonly<ComputedRef<SelectItemState>>;
|
|
57
75
|
}
|
package/dist/types/switch.d.ts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import type { ComputedRef } from "vue";
|
|
1
|
+
import type { ComputedRef, DeepReadonly } from "vue";
|
|
2
2
|
export type SwitchSize = "sm" | "md" | "lg";
|
|
3
3
|
export interface SwitchProps {
|
|
4
4
|
size?: SwitchSize;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* スイッチの状態(StyleAdapterに渡す用)
|
|
9
|
+
*/
|
|
10
|
+
export interface SwitchState {
|
|
11
|
+
size: SwitchSize;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
checked: boolean;
|
|
14
|
+
}
|
|
7
15
|
export interface SwitchAriaAttributes {
|
|
8
16
|
role: "switch";
|
|
9
17
|
"aria-checked": boolean;
|
|
10
18
|
"aria-disabled"?: boolean;
|
|
11
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* useSwitch の戻り値(ヘッドレス - スタイル情報なし)
|
|
22
|
+
*/
|
|
12
23
|
export interface SwitchReturn {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
is_disabled: ComputedRef<boolean>;
|
|
16
|
-
aria_attributes: ComputedRef<SwitchAriaAttributes>;
|
|
24
|
+
state: DeepReadonly<ComputedRef<SwitchState>>;
|
|
25
|
+
aria_attributes: DeepReadonly<ComputedRef<SwitchAriaAttributes>>;
|
|
17
26
|
}
|
package/dist/types/textarea.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ComputedRef, Ref } from "vue";
|
|
1
|
+
import type { ComputedRef, Ref, DeepReadonly } from "vue";
|
|
2
2
|
export type TextareaSize = "sm" | "md" | "lg";
|
|
3
|
+
export type TextareaResize = "none" | "vertical" | "horizontal" | "both";
|
|
3
4
|
export interface TextareaProps {
|
|
4
5
|
size?: TextareaSize;
|
|
5
6
|
placeholder?: string;
|
|
@@ -8,20 +9,30 @@ export interface TextareaProps {
|
|
|
8
9
|
error?: string;
|
|
9
10
|
error_id?: string;
|
|
10
11
|
rows?: number;
|
|
11
|
-
resize?:
|
|
12
|
+
resize?: TextareaResize;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* テキストエリアの状態(StyleAdapterに渡す用)
|
|
16
|
+
*/
|
|
17
|
+
export interface TextareaState {
|
|
18
|
+
size: TextareaSize;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
readonly: boolean;
|
|
21
|
+
has_error: boolean;
|
|
22
|
+
resize: TextareaResize;
|
|
12
23
|
}
|
|
13
24
|
export interface TextareaAriaAttributes {
|
|
14
25
|
"aria-invalid"?: boolean;
|
|
15
26
|
"aria-describedby"?: string;
|
|
16
27
|
"aria-readonly"?: boolean;
|
|
17
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* useTextarea の戻り値(ヘッドレス - スタイル情報なし)
|
|
31
|
+
*/
|
|
18
32
|
export interface TextareaReturn {
|
|
19
|
-
|
|
33
|
+
state: DeepReadonly<ComputedRef<TextareaState>>;
|
|
20
34
|
is_focused: Ref<boolean>;
|
|
21
|
-
|
|
22
|
-
is_disabled: ComputedRef<boolean>;
|
|
23
|
-
is_readonly: ComputedRef<boolean>;
|
|
24
|
-
aria_attributes: ComputedRef<TextareaAriaAttributes>;
|
|
35
|
+
aria_attributes: DeepReadonly<ComputedRef<TextareaAriaAttributes>>;
|
|
25
36
|
handleFocus: () => void;
|
|
26
37
|
handleBlur: () => void;
|
|
27
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soave/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "soave UI - Composable-First UI Framework for Vue 3 / Nuxt 4",
|
|
5
5
|
"author": "Arata Ouchi (Original SIN Architecture)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,17 +22,9 @@
|
|
|
22
22
|
"import": "./dist/composables/index.mjs",
|
|
23
23
|
"types": "./dist/composables/index.d.ts"
|
|
24
24
|
},
|
|
25
|
-
"./components": {
|
|
26
|
-
"import": "./dist/components/ui/index.mjs",
|
|
27
|
-
"types": "./dist/components/ui/index.d.ts"
|
|
28
|
-
},
|
|
29
25
|
"./adapters": {
|
|
30
26
|
"import": "./dist/adapters/index.mjs",
|
|
31
27
|
"types": "./dist/adapters/index.d.ts"
|
|
32
|
-
},
|
|
33
|
-
"./styles/css-variables.css": {
|
|
34
|
-
"import": "./dist/styles/css-variables.css",
|
|
35
|
-
"default": "./dist/styles/css-variables.css"
|
|
36
28
|
}
|
|
37
29
|
},
|
|
38
30
|
"files": [
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
role="alert"
|
|
4
|
-
:class="[computed_classes, props.class]"
|
|
5
|
-
>
|
|
6
|
-
<slot />
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { computed } from "vue"
|
|
12
|
-
import { useUI, useStyleAdapter } from "../../composables/useUIConfig"
|
|
13
|
-
import type { AlertVariant } from "../../types/alert"
|
|
14
|
-
import type { AlertState } from "../../types/composables"
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
variant?: AlertVariant
|
|
18
|
-
class?: string
|
|
19
|
-
unstyled?: boolean
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
23
|
-
unstyled: false
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
const ui_config = useUI("alert")
|
|
27
|
-
const style_adapter = useStyleAdapter()
|
|
28
|
-
|
|
29
|
-
// StyleAdapterからクラスを取得
|
|
30
|
-
const computed_classes = computed(() => {
|
|
31
|
-
if (props.unstyled) {
|
|
32
|
-
return ""
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const state: AlertState = {
|
|
36
|
-
variant: props.variant ?? ui_config.default_variant
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return style_adapter.getClasses("alert", state)
|
|
40
|
-
})
|
|
41
|
-
</script>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="[computed_classes, props.class]">
|
|
3
|
-
<slot />
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { computed } from "vue"
|
|
9
|
-
import { useStyleAdapter } from "../../composables"
|
|
10
|
-
import type { AlertDescriptionProps } from "../../types/alert"
|
|
11
|
-
|
|
12
|
-
const props = withDefaults(defineProps<AlertDescriptionProps>(), {
|
|
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("alert-description", {})
|
|
21
|
-
})
|
|
22
|
-
</script>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<h5 :class="[computed_classes, props.class]">
|
|
3
|
-
<slot />
|
|
4
|
-
</h5>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { computed } from "vue"
|
|
9
|
-
import { useStyleAdapter } from "../../composables"
|
|
10
|
-
import type { AlertTitleProps } from "../../types/alert"
|
|
11
|
-
|
|
12
|
-
const props = withDefaults(defineProps<AlertTitleProps>(), {
|
|
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("alert-title", {})
|
|
21
|
-
})
|
|
22
|
-
</script>
|