@14ch/svelte-ui 0.0.55 → 0.0.57
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/assets/styles/import.css +4 -4
- package/dist/assets/styles/variables.scss +4 -4
- package/dist/components/Button.svelte +30 -4
- package/dist/components/Button.svelte.d.ts +3 -2
- package/dist/components/Checkbox.svelte +32 -4
- package/dist/components/Checkbox.svelte.d.ts +2 -2
- package/dist/components/ColorPicker.svelte +41 -4
- package/dist/components/ColorPicker.svelte.d.ts +2 -2
- package/dist/components/Combobox.svelte +31 -4
- package/dist/components/Combobox.svelte.d.ts +2 -2
- package/dist/components/Datepicker.svelte +31 -4
- package/dist/components/Datepicker.svelte.d.ts +2 -2
- package/dist/components/Fab.svelte +28 -2
- package/dist/components/Fab.svelte.d.ts +1 -2
- package/dist/components/Icon.svelte +2 -4
- package/dist/components/Icon.svelte.d.ts +2 -2
- package/dist/components/IconButton.svelte +28 -4
- package/dist/components/IconButton.svelte.d.ts +1 -2
- package/dist/components/Input.svelte +43 -4
- package/dist/components/Input.svelte.d.ts +3 -2
- package/dist/components/Radio.svelte +32 -4
- package/dist/components/Radio.svelte.d.ts +2 -2
- package/dist/components/SegmentedControl.svelte +29 -4
- package/dist/components/SegmentedControl.svelte.d.ts +2 -2
- package/dist/components/Select.svelte +34 -4
- package/dist/components/Select.svelte.d.ts +2 -2
- package/dist/components/Slider.svelte +31 -4
- package/dist/components/Slider.svelte.d.ts +2 -2
- package/dist/components/SnackbarItem.svelte +1 -1
- package/dist/components/StepNav.svelte +29 -19
- package/dist/components/StepNav.svelte.d.ts +5 -1
- package/dist/components/Switch.svelte +32 -4
- package/dist/components/Switch.svelte.d.ts +2 -2
- package/dist/components/Textarea.svelte +38 -4
- package/dist/components/Textarea.svelte.d.ts +1 -2
- package/dist/i18n/index.d.ts +12 -12
- package/dist/i18n/locales/de.d.ts +2 -2
- package/dist/i18n/locales/de.js +2 -2
- package/dist/i18n/locales/en.d.ts +2 -2
- package/dist/i18n/locales/en.js +2 -2
- package/dist/i18n/locales/es.d.ts +2 -2
- package/dist/i18n/locales/es.js +2 -2
- package/dist/i18n/locales/fr.d.ts +2 -2
- package/dist/i18n/locales/fr.js +2 -2
- package/dist/i18n/locales/ja.d.ts +2 -2
- package/dist/i18n/locales/ja.js +2 -2
- package/dist/i18n/locales/zh-cn.d.ts +2 -2
- package/dist/i18n/locales/zh-cn.js +2 -2
- package/package.json +1 -1
|
@@ -16,11 +16,52 @@
|
|
|
16
16
|
BivariantValueHandler
|
|
17
17
|
} from '../types/callbackHandlers';
|
|
18
18
|
import type { FocusStyle } from '../types/propOptions';
|
|
19
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
19
20
|
|
|
20
21
|
// =========================================================================
|
|
21
22
|
// Props, States & Constants
|
|
22
23
|
// =========================================================================
|
|
23
|
-
export type InputProps =
|
|
24
|
+
export type InputProps = Omit<
|
|
25
|
+
HTMLInputAttributes,
|
|
26
|
+
// 独自の型で再定義するためベースの HTML 属性から除外
|
|
27
|
+
| 'value'
|
|
28
|
+
| 'type'
|
|
29
|
+
| 'id'
|
|
30
|
+
| 'tabindex'
|
|
31
|
+
| 'maxlength'
|
|
32
|
+
| 'pattern'
|
|
33
|
+
| 'min'
|
|
34
|
+
| 'max'
|
|
35
|
+
| 'step'
|
|
36
|
+
| 'autocomplete'
|
|
37
|
+
| 'spellcheck'
|
|
38
|
+
// 独自ハンドラ型(callbackHandlers)で再定義するイベント系
|
|
39
|
+
| 'onfocus'
|
|
40
|
+
| 'onblur'
|
|
41
|
+
| 'onkeydown'
|
|
42
|
+
| 'onkeyup'
|
|
43
|
+
| 'onclick'
|
|
44
|
+
| 'onmousedown'
|
|
45
|
+
| 'onmouseup'
|
|
46
|
+
| 'onmouseenter'
|
|
47
|
+
| 'onmouseleave'
|
|
48
|
+
| 'onmouseover'
|
|
49
|
+
| 'onmouseout'
|
|
50
|
+
| 'oncontextmenu'
|
|
51
|
+
| 'onauxclick'
|
|
52
|
+
| 'ontouchstart'
|
|
53
|
+
| 'ontouchend'
|
|
54
|
+
| 'ontouchmove'
|
|
55
|
+
| 'ontouchcancel'
|
|
56
|
+
| 'onpointerdown'
|
|
57
|
+
| 'onpointerup'
|
|
58
|
+
| 'onpointerenter'
|
|
59
|
+
| 'onpointerleave'
|
|
60
|
+
| 'onpointermove'
|
|
61
|
+
| 'onpointercancel'
|
|
62
|
+
| 'onchange'
|
|
63
|
+
| 'oninput'
|
|
64
|
+
> & {
|
|
24
65
|
// 基本プロパティ
|
|
25
66
|
name?: string;
|
|
26
67
|
value: string | number | null | undefined;
|
|
@@ -76,6 +117,7 @@
|
|
|
76
117
|
required?: boolean;
|
|
77
118
|
/** Shows a clear (×) button when the input has a value. @default false */
|
|
78
119
|
clearable?: boolean;
|
|
120
|
+
clearButtonAriaLabel?: string;
|
|
79
121
|
/** Converts URLs in the value to clickable links. Only for `type="text"` or `type="url"`. @default false */
|
|
80
122
|
linkify?: boolean;
|
|
81
123
|
/** Adds a show/hide password toggle button. Only for `type="password"`. @default false */
|
|
@@ -139,9 +181,6 @@
|
|
|
139
181
|
onLeftIconTouchEnd?: TouchHandler;
|
|
140
182
|
onRightIconTouchCancel?: TouchHandler;
|
|
141
183
|
onLeftIconTouchCancel?: TouchHandler;
|
|
142
|
-
|
|
143
|
-
// その他
|
|
144
|
-
[key: string]: any;
|
|
145
184
|
};
|
|
146
185
|
|
|
147
186
|
let {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
|
|
2
2
|
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/callbackHandlers';
|
|
3
3
|
import type { FocusStyle } from '../types/propOptions';
|
|
4
|
-
|
|
4
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
5
|
+
export type InputProps = Omit<HTMLInputAttributes, 'value' | 'type' | 'id' | 'tabindex' | 'maxlength' | 'pattern' | 'min' | 'max' | 'step' | 'autocomplete' | 'spellcheck' | 'onfocus' | 'onblur' | 'onkeydown' | 'onkeyup' | 'onclick' | 'onmousedown' | 'onmouseup' | 'onmouseenter' | 'onmouseleave' | 'onmouseover' | 'onmouseout' | 'oncontextmenu' | 'onauxclick' | 'ontouchstart' | 'ontouchend' | 'ontouchmove' | 'ontouchcancel' | 'onpointerdown' | 'onpointerup' | 'onpointerenter' | 'onpointerleave' | 'onpointermove' | 'onpointercancel' | 'onchange' | 'oninput'> & {
|
|
5
6
|
name?: string;
|
|
6
7
|
value: string | number | null | undefined;
|
|
7
8
|
id?: string | null;
|
|
@@ -49,6 +50,7 @@ export type InputProps = {
|
|
|
49
50
|
required?: boolean;
|
|
50
51
|
/** Shows a clear (×) button when the input has a value. @default false */
|
|
51
52
|
clearable?: boolean;
|
|
53
|
+
clearButtonAriaLabel?: string;
|
|
52
54
|
/** Converts URLs in the value to clickable links. Only for `type="text"` or `type="url"`. @default false */
|
|
53
55
|
linkify?: boolean;
|
|
54
56
|
/** Adds a show/hide password toggle button. Only for `type="password"`. @default false */
|
|
@@ -96,7 +98,6 @@ export type InputProps = {
|
|
|
96
98
|
onLeftIconTouchEnd?: TouchHandler;
|
|
97
99
|
onRightIconTouchCancel?: TouchHandler;
|
|
98
100
|
onLeftIconTouchCancel?: TouchHandler;
|
|
99
|
-
[key: string]: any;
|
|
100
101
|
};
|
|
101
102
|
declare const Input: import("svelte").Component<InputProps, {
|
|
102
103
|
focus: () => void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { type Snippet } from 'svelte';
|
|
5
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
5
6
|
import type {
|
|
6
7
|
FocusHandler,
|
|
7
8
|
KeyboardHandler,
|
|
@@ -16,7 +17,37 @@
|
|
|
16
17
|
// =========================================================================
|
|
17
18
|
// Props, States & Constants
|
|
18
19
|
// =========================================================================
|
|
19
|
-
export type RadioProps =
|
|
20
|
+
export type RadioProps = Omit<
|
|
21
|
+
HTMLInputAttributes,
|
|
22
|
+
// 独自型で再定義する props / イベントは除外して衝突を避ける
|
|
23
|
+
| 'children'
|
|
24
|
+
| 'value'
|
|
25
|
+
| 'size'
|
|
26
|
+
| 'onfocus'
|
|
27
|
+
| 'onblur'
|
|
28
|
+
| 'onkeydown'
|
|
29
|
+
| 'onkeyup'
|
|
30
|
+
| 'onclick'
|
|
31
|
+
| 'onmousedown'
|
|
32
|
+
| 'onmouseup'
|
|
33
|
+
| 'onmouseenter'
|
|
34
|
+
| 'onmouseleave'
|
|
35
|
+
| 'onmouseover'
|
|
36
|
+
| 'onmouseout'
|
|
37
|
+
| 'oncontextmenu'
|
|
38
|
+
| 'onauxclick'
|
|
39
|
+
| 'ontouchstart'
|
|
40
|
+
| 'ontouchend'
|
|
41
|
+
| 'ontouchmove'
|
|
42
|
+
| 'ontouchcancel'
|
|
43
|
+
| 'onpointerdown'
|
|
44
|
+
| 'onpointerup'
|
|
45
|
+
| 'onpointerenter'
|
|
46
|
+
| 'onpointerleave'
|
|
47
|
+
| 'onpointermove'
|
|
48
|
+
| 'onpointercancel'
|
|
49
|
+
| 'onchange'
|
|
50
|
+
> & {
|
|
20
51
|
// Snippet
|
|
21
52
|
/** Label content displayed next to the radio button. */
|
|
22
53
|
children?: Snippet;
|
|
@@ -85,9 +116,6 @@
|
|
|
85
116
|
|
|
86
117
|
// 入力イベント
|
|
87
118
|
onchange?: BivariantValueHandler<OptionValue>;
|
|
88
|
-
|
|
89
|
-
// その他
|
|
90
|
-
[key: string]: any;
|
|
91
119
|
};
|
|
92
120
|
|
|
93
121
|
let {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
3
|
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/callbackHandlers';
|
|
3
4
|
import type { OptionValue } from '../types/options';
|
|
4
5
|
import type { ComponentSize } from '../types/propOptions';
|
|
5
|
-
export type RadioProps = {
|
|
6
|
+
export type RadioProps = Omit<HTMLInputAttributes, 'children' | 'value' | 'size' | 'onfocus' | 'onblur' | 'onkeydown' | 'onkeyup' | 'onclick' | 'onmousedown' | 'onmouseup' | 'onmouseenter' | 'onmouseleave' | 'onmouseover' | 'onmouseout' | 'oncontextmenu' | 'onauxclick' | 'ontouchstart' | 'ontouchend' | 'ontouchmove' | 'ontouchcancel' | 'onpointerdown' | 'onpointerup' | 'onpointerenter' | 'onpointerleave' | 'onpointermove' | 'onpointercancel' | 'onchange'> & {
|
|
6
7
|
/** Label content displayed next to the radio button. */
|
|
7
8
|
children?: Snippet;
|
|
8
9
|
/** Radio group name. All radios in a group must share the same name. */
|
|
@@ -48,7 +49,6 @@ export type RadioProps = {
|
|
|
48
49
|
onpointermove?: PointerHandler;
|
|
49
50
|
onpointercancel?: PointerHandler;
|
|
50
51
|
onchange?: BivariantValueHandler<OptionValue>;
|
|
51
|
-
[key: string]: any;
|
|
52
52
|
};
|
|
53
53
|
declare const Radio: import("svelte").Component<RadioProps, {}, "currentValue">;
|
|
54
54
|
type Radio = ReturnType<typeof Radio>;
|
|
@@ -13,11 +13,39 @@
|
|
|
13
13
|
BivariantValueHandler
|
|
14
14
|
} from '../types/callbackHandlers';
|
|
15
15
|
import type { ComponentSize } from '../types/propOptions';
|
|
16
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
16
17
|
|
|
17
18
|
// =========================================================================
|
|
18
19
|
// Props, States & Constants
|
|
19
20
|
// =========================================================================
|
|
20
|
-
export type SegmentedControlProps =
|
|
21
|
+
export type SegmentedControlProps = Omit<
|
|
22
|
+
HTMLAttributes<HTMLDivElement>,
|
|
23
|
+
// 独自ハンドラ型(callbackHandlers)で再定義するイベント系は除外して衝突を避ける
|
|
24
|
+
| 'onchange'
|
|
25
|
+
| 'onfocus'
|
|
26
|
+
| 'onblur'
|
|
27
|
+
| 'onkeydown'
|
|
28
|
+
| 'onkeyup'
|
|
29
|
+
| 'onclick'
|
|
30
|
+
| 'onmousedown'
|
|
31
|
+
| 'onmouseup'
|
|
32
|
+
| 'onmouseenter'
|
|
33
|
+
| 'onmouseleave'
|
|
34
|
+
| 'onmouseover'
|
|
35
|
+
| 'onmouseout'
|
|
36
|
+
| 'oncontextmenu'
|
|
37
|
+
| 'onauxclick'
|
|
38
|
+
| 'ontouchstart'
|
|
39
|
+
| 'ontouchend'
|
|
40
|
+
| 'ontouchmove'
|
|
41
|
+
| 'ontouchcancel'
|
|
42
|
+
| 'onpointerdown'
|
|
43
|
+
| 'onpointerup'
|
|
44
|
+
| 'onpointerenter'
|
|
45
|
+
| 'onpointerleave'
|
|
46
|
+
| 'onpointermove'
|
|
47
|
+
| 'onpointercancel'
|
|
48
|
+
> & {
|
|
21
49
|
// 基本プロパティ
|
|
22
50
|
/** `{ label, value, icon?, disabled? }[]` */
|
|
23
51
|
items: SegmentedControlItem[];
|
|
@@ -87,9 +115,6 @@
|
|
|
87
115
|
onpointerleave?: PointerHandler;
|
|
88
116
|
onpointermove?: PointerHandler;
|
|
89
117
|
onpointercancel?: PointerHandler;
|
|
90
|
-
|
|
91
|
-
// その他
|
|
92
|
-
[key: string]: any;
|
|
93
118
|
};
|
|
94
119
|
|
|
95
120
|
let {
|
|
@@ -2,7 +2,8 @@ import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../typ
|
|
|
2
2
|
import type { SegmentedControlItem } from '../types/segmentedControlItem';
|
|
3
3
|
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/callbackHandlers';
|
|
4
4
|
import type { ComponentSize } from '../types/propOptions';
|
|
5
|
-
|
|
5
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
|
+
export type SegmentedControlProps = Omit<HTMLAttributes<HTMLDivElement>, 'onchange' | 'onfocus' | 'onblur' | 'onkeydown' | 'onkeyup' | 'onclick' | 'onmousedown' | 'onmouseup' | 'onmouseenter' | 'onmouseleave' | 'onmouseover' | 'onmouseout' | 'oncontextmenu' | 'onauxclick' | 'ontouchstart' | 'ontouchend' | 'ontouchmove' | 'ontouchcancel' | 'onpointerdown' | 'onpointerup' | 'onpointerenter' | 'onpointerleave' | 'onpointermove' | 'onpointercancel'> & {
|
|
6
7
|
/** `{ label, value, icon?, disabled? }[]` */
|
|
7
8
|
items: SegmentedControlItem[];
|
|
8
9
|
/** Currently selected value. Supports `bind:value`. */
|
|
@@ -49,7 +50,6 @@ export type SegmentedControlProps = {
|
|
|
49
50
|
onpointerleave?: PointerHandler;
|
|
50
51
|
onpointermove?: PointerHandler;
|
|
51
52
|
onpointercancel?: PointerHandler;
|
|
52
|
-
[key: string]: any;
|
|
53
53
|
};
|
|
54
54
|
declare const SegmentedControl: import("svelte").Component<SegmentedControlProps, {}, "value">;
|
|
55
55
|
type SegmentedControl = ReturnType<typeof SegmentedControl>;
|
|
@@ -12,11 +12,44 @@
|
|
|
12
12
|
BivariantValueHandler
|
|
13
13
|
} from '../types/callbackHandlers';
|
|
14
14
|
import type { Option } from '../types/options';
|
|
15
|
+
import type { HTMLSelectAttributes } from 'svelte/elements';
|
|
15
16
|
|
|
16
17
|
// =========================================================================
|
|
17
18
|
// Props, States & Constants
|
|
18
19
|
// =========================================================================
|
|
19
|
-
export type SelectProps =
|
|
20
|
+
export type SelectProps = Omit<
|
|
21
|
+
HTMLSelectAttributes,
|
|
22
|
+
// 独自の型で再定義するためベースの HTML 属性から除外
|
|
23
|
+
| 'value'
|
|
24
|
+
| 'id'
|
|
25
|
+
| 'tabindex'
|
|
26
|
+
| 'size'
|
|
27
|
+
// 独自ハンドラ型(callbackHandlers)で再定義するイベント系
|
|
28
|
+
| 'onfocus'
|
|
29
|
+
| 'onblur'
|
|
30
|
+
| 'onkeydown'
|
|
31
|
+
| 'onkeyup'
|
|
32
|
+
| 'onclick'
|
|
33
|
+
| 'onmousedown'
|
|
34
|
+
| 'onmouseup'
|
|
35
|
+
| 'onmouseenter'
|
|
36
|
+
| 'onmouseleave'
|
|
37
|
+
| 'onmouseover'
|
|
38
|
+
| 'onmouseout'
|
|
39
|
+
| 'oncontextmenu'
|
|
40
|
+
| 'onauxclick'
|
|
41
|
+
| 'ontouchstart'
|
|
42
|
+
| 'ontouchend'
|
|
43
|
+
| 'ontouchmove'
|
|
44
|
+
| 'ontouchcancel'
|
|
45
|
+
| 'onpointerdown'
|
|
46
|
+
| 'onpointerup'
|
|
47
|
+
| 'onpointerenter'
|
|
48
|
+
| 'onpointerleave'
|
|
49
|
+
| 'onpointermove'
|
|
50
|
+
| 'onpointercancel'
|
|
51
|
+
| 'onchange'
|
|
52
|
+
> & {
|
|
20
53
|
// 基本プロパティ
|
|
21
54
|
name?: string;
|
|
22
55
|
value: string | number | null | undefined;
|
|
@@ -78,9 +111,6 @@
|
|
|
78
111
|
|
|
79
112
|
// 入力イベント
|
|
80
113
|
onchange?: BivariantValueHandler<string | number | null | undefined>;
|
|
81
|
-
|
|
82
|
-
// その他
|
|
83
|
-
[key: string]: any;
|
|
84
114
|
};
|
|
85
115
|
|
|
86
116
|
let {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/callbackHandlers';
|
|
2
2
|
import type { Option } from '../types/options';
|
|
3
|
-
|
|
3
|
+
import type { HTMLSelectAttributes } from 'svelte/elements';
|
|
4
|
+
export type SelectProps = Omit<HTMLSelectAttributes, 'value' | 'id' | 'tabindex' | 'size' | 'onfocus' | 'onblur' | 'onkeydown' | 'onkeyup' | 'onclick' | 'onmousedown' | 'onmouseup' | 'onmouseenter' | 'onmouseleave' | 'onmouseover' | 'onmouseout' | 'oncontextmenu' | 'onauxclick' | 'ontouchstart' | 'ontouchend' | 'ontouchmove' | 'ontouchcancel' | 'onpointerdown' | 'onpointerup' | 'onpointerenter' | 'onpointerleave' | 'onpointermove' | 'onpointercancel' | 'onchange'> & {
|
|
4
5
|
name?: string;
|
|
5
6
|
value: string | number | null | undefined;
|
|
6
7
|
/** `{ label, value, disabled? }[]` */
|
|
@@ -44,7 +45,6 @@ export type SelectProps = {
|
|
|
44
45
|
onpointermove?: PointerHandler;
|
|
45
46
|
onpointercancel?: PointerHandler;
|
|
46
47
|
onchange?: BivariantValueHandler<string | number | null | undefined>;
|
|
47
|
-
[key: string]: any;
|
|
48
48
|
};
|
|
49
49
|
declare const Select: import("svelte").Component<SelectProps, {}, "value">;
|
|
50
50
|
type Select = ReturnType<typeof Select>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { getStyleFromNumber } from '../utils/style';
|
|
5
5
|
import { t } from '../i18n';
|
|
6
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
6
7
|
import type {
|
|
7
8
|
FocusHandler,
|
|
8
9
|
KeyboardHandler,
|
|
@@ -15,7 +16,36 @@
|
|
|
15
16
|
// =========================================================================
|
|
16
17
|
// Props, States & Constants
|
|
17
18
|
// =========================================================================
|
|
18
|
-
export type SliderProps =
|
|
19
|
+
export type SliderProps = Omit<
|
|
20
|
+
HTMLInputAttributes,
|
|
21
|
+
// 独自型で再定義する props / イベントは除外して衝突を避ける
|
|
22
|
+
| 'value'
|
|
23
|
+
| 'onfocus'
|
|
24
|
+
| 'onblur'
|
|
25
|
+
| 'onkeydown'
|
|
26
|
+
| 'onkeyup'
|
|
27
|
+
| 'onclick'
|
|
28
|
+
| 'onmousedown'
|
|
29
|
+
| 'onmouseup'
|
|
30
|
+
| 'onmouseenter'
|
|
31
|
+
| 'onmouseleave'
|
|
32
|
+
| 'onmouseover'
|
|
33
|
+
| 'onmouseout'
|
|
34
|
+
| 'oncontextmenu'
|
|
35
|
+
| 'onauxclick'
|
|
36
|
+
| 'ontouchstart'
|
|
37
|
+
| 'ontouchend'
|
|
38
|
+
| 'ontouchmove'
|
|
39
|
+
| 'ontouchcancel'
|
|
40
|
+
| 'onpointerdown'
|
|
41
|
+
| 'onpointerup'
|
|
42
|
+
| 'onpointerenter'
|
|
43
|
+
| 'onpointerleave'
|
|
44
|
+
| 'onpointermove'
|
|
45
|
+
| 'onpointercancel'
|
|
46
|
+
| 'onchange'
|
|
47
|
+
| 'oninput'
|
|
48
|
+
> & {
|
|
19
49
|
// 基本プロパティ
|
|
20
50
|
/** Supports `bind:value`. */
|
|
21
51
|
value: number;
|
|
@@ -78,9 +108,6 @@
|
|
|
78
108
|
// 入力イベント
|
|
79
109
|
onchange?: BivariantValueHandler<number>;
|
|
80
110
|
oninput?: BivariantValueHandler<number>;
|
|
81
|
-
|
|
82
|
-
// その他
|
|
83
|
-
[key: string]: any;
|
|
84
111
|
};
|
|
85
112
|
|
|
86
113
|
let {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
1
2
|
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/callbackHandlers';
|
|
2
|
-
export type SliderProps = {
|
|
3
|
+
export type SliderProps = Omit<HTMLInputAttributes, 'value' | 'onfocus' | 'onblur' | 'onkeydown' | 'onkeyup' | 'onclick' | 'onmousedown' | 'onmouseup' | 'onmouseenter' | 'onmouseleave' | 'onmouseover' | 'onmouseout' | 'oncontextmenu' | 'onauxclick' | 'ontouchstart' | 'ontouchend' | 'ontouchmove' | 'ontouchcancel' | 'onpointerdown' | 'onpointerup' | 'onpointerenter' | 'onpointerleave' | 'onpointermove' | 'onpointercancel' | 'onchange' | 'oninput'> & {
|
|
3
4
|
/** Supports `bind:value`. */
|
|
4
5
|
value: number;
|
|
5
6
|
name?: string;
|
|
@@ -44,7 +45,6 @@ export type SliderProps = {
|
|
|
44
45
|
onpointercancel?: PointerHandler;
|
|
45
46
|
onchange?: BivariantValueHandler<number>;
|
|
46
47
|
oninput?: BivariantValueHandler<number>;
|
|
47
|
-
[key: string]: any;
|
|
48
48
|
};
|
|
49
49
|
declare const Slider: import("svelte").Component<SliderProps, {}, "value">;
|
|
50
50
|
type Slider = ReturnType<typeof Slider>;
|
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
/**
|
|
31
31
|
* 到達済みの最遠ステップ(進捗軸)。未指定時は表示中ステップ位置。
|
|
32
32
|
* 数値なら 0 始まりのインデックス、文字列ならアイテムのユニークキー(`value`。省略時は配列 index の文字列)で指定する。URL方式でも `value` をキーに使う。
|
|
33
|
+
* `{ step, status }` を渡すと指したステップの状態を明示できる。`status: 'done'` なら当該ステップも完了表示(進行中なし)。数値/文字列のみ指定時は `'in-progress'` 扱い。
|
|
33
34
|
*/
|
|
34
|
-
progress?: number | string;
|
|
35
|
+
progress?: number | string | { step: number | string; status: 'in-progress' | 'done' };
|
|
35
36
|
|
|
36
37
|
// URL 方式(href 使用時)
|
|
37
38
|
/** 各 href のアクティブ判定に前置するパス。 */
|
|
@@ -171,11 +172,20 @@
|
|
|
171
172
|
return items.findIndex((item, index) => (item.value ?? String(index)) === value);
|
|
172
173
|
});
|
|
173
174
|
|
|
175
|
+
// progress の step 部分(オブジェクト形なら .step、それ以外は progress 自身)。
|
|
176
|
+
const progressStep = $derived(
|
|
177
|
+
typeof progress === 'object' && progress !== null ? progress.step : progress
|
|
178
|
+
);
|
|
179
|
+
// 指したステップの状態。オブジェクト形の status のみ 'done' になり得る。未指定は 'in-progress'。
|
|
180
|
+
const progressStepStatus = $derived<'in-progress' | 'done'>(
|
|
181
|
+
typeof progress === 'object' && progress !== null ? progress.status : 'in-progress'
|
|
182
|
+
);
|
|
183
|
+
|
|
174
184
|
// progress を数値インデックスへ解決する。文字列ならアイテムのユニークキー(value)で一致判定。未指定なら表示中位置。
|
|
175
185
|
const progressIndex = $derived.by(() => {
|
|
176
|
-
if (
|
|
177
|
-
if (typeof
|
|
178
|
-
return items.findIndex((item, index) => (item.value ?? String(index)) ===
|
|
186
|
+
if (progressStep == null) return activeIndex;
|
|
187
|
+
if (typeof progressStep === 'number') return progressStep;
|
|
188
|
+
return items.findIndex((item, index) => (item.value ?? String(index)) === progressStep);
|
|
179
189
|
});
|
|
180
190
|
|
|
181
191
|
const resolvedIconSize = $derived(
|
|
@@ -208,11 +218,11 @@
|
|
|
208
218
|
// =========================================================================
|
|
209
219
|
// Helpers
|
|
210
220
|
// =========================================================================
|
|
211
|
-
type StepStatus = '
|
|
221
|
+
type StepStatus = 'done' | 'in-progress' | 'upcoming';
|
|
212
222
|
|
|
213
223
|
const getStatus = (index: number): StepStatus => {
|
|
214
|
-
if (index < progressIndex) return '
|
|
215
|
-
if (index === progressIndex) return '
|
|
224
|
+
if (index < progressIndex) return 'done';
|
|
225
|
+
if (index === progressIndex) return progressStepStatus === 'done' ? 'done' : 'in-progress';
|
|
216
226
|
return 'upcoming';
|
|
217
227
|
};
|
|
218
228
|
|
|
@@ -239,10 +249,10 @@
|
|
|
239
249
|
const step = t('stepNav.step', { number: index + 1 });
|
|
240
250
|
const state = item.error
|
|
241
251
|
? t('stepNav.error')
|
|
242
|
-
: getStatus(index) === '
|
|
243
|
-
? t('stepNav.
|
|
244
|
-
: getStatus(index) === '
|
|
245
|
-
? t('stepNav.
|
|
252
|
+
: getStatus(index) === 'done'
|
|
253
|
+
? t('stepNav.done')
|
|
254
|
+
: getStatus(index) === 'in-progress'
|
|
255
|
+
? t('stepNav.inProgress')
|
|
246
256
|
: t('stepNav.upcoming');
|
|
247
257
|
return `${step}: ${state}`;
|
|
248
258
|
};
|
|
@@ -304,7 +314,7 @@
|
|
|
304
314
|
variant={iconVariant}
|
|
305
315
|
filled>error</Icon
|
|
306
316
|
>
|
|
307
|
-
{:else if status === '
|
|
317
|
+
{:else if status === 'done'}
|
|
308
318
|
<Icon size={resolvedIconSize} weight={iconWeight} grade={iconGrade} variant={iconVariant}
|
|
309
319
|
>check</Icon
|
|
310
320
|
>
|
|
@@ -393,7 +403,7 @@
|
|
|
393
403
|
{#if index < items.length - 1}
|
|
394
404
|
<span
|
|
395
405
|
class="step-nav__connector"
|
|
396
|
-
class:step-nav__connector--
|
|
406
|
+
class:step-nav__connector--done={index < progressIndex}
|
|
397
407
|
aria-hidden="true"
|
|
398
408
|
></span>
|
|
399
409
|
{/if}
|
|
@@ -499,15 +509,15 @@ button.step-nav__step {
|
|
|
499
509
|
border: var(--svelte-ui-step-nav-marker-border-width) solid var(--svelte-ui-step-nav-upcoming-marker-color);
|
|
500
510
|
}
|
|
501
511
|
|
|
502
|
-
/*
|
|
503
|
-
.step-nav__step--
|
|
512
|
+
/* in-progress: primary アウトライン + 番号 */
|
|
513
|
+
.step-nav__step--in-progress .step-nav__marker {
|
|
504
514
|
background: var(--svelte-ui-surface-color);
|
|
505
515
|
color: var(--internal-step-nav-accent, var(--svelte-ui-step-nav-accent-color));
|
|
506
516
|
border: var(--svelte-ui-step-nav-marker-border-width) solid var(--internal-step-nav-accent, var(--svelte-ui-step-nav-accent-color));
|
|
507
517
|
}
|
|
508
518
|
|
|
509
|
-
/*
|
|
510
|
-
.step-nav__step--
|
|
519
|
+
/* done: primary 塗り + check */
|
|
520
|
+
.step-nav__step--done .step-nav__marker {
|
|
511
521
|
background: var(--internal-step-nav-accent, var(--svelte-ui-step-nav-accent-color));
|
|
512
522
|
color: var(--svelte-ui-step-nav-marker-text-color);
|
|
513
523
|
border: var(--svelte-ui-step-nav-marker-border-width) solid var(--internal-step-nav-accent, var(--svelte-ui-step-nav-accent-color));
|
|
@@ -564,8 +574,8 @@ button.step-nav__step {
|
|
|
564
574
|
background: var(--svelte-ui-step-nav-connector-color);
|
|
565
575
|
}
|
|
566
576
|
|
|
567
|
-
.step-nav__connector--
|
|
568
|
-
background: var(--internal-step-nav-accent, var(--svelte-ui-step-nav-connector-
|
|
577
|
+
.step-nav__connector--done {
|
|
578
|
+
background: var(--internal-step-nav-accent, var(--svelte-ui-step-nav-connector-done-color));
|
|
569
579
|
}
|
|
570
580
|
|
|
571
581
|
/* ======================= 水平レイアウト ======================= */
|
|
@@ -12,8 +12,12 @@ export type StepNavProps = {
|
|
|
12
12
|
/**
|
|
13
13
|
* 到達済みの最遠ステップ(進捗軸)。未指定時は表示中ステップ位置。
|
|
14
14
|
* 数値なら 0 始まりのインデックス、文字列ならアイテムのユニークキー(`value`。省略時は配列 index の文字列)で指定する。URL方式でも `value` をキーに使う。
|
|
15
|
+
* `{ step, status }` を渡すと指したステップの状態を明示できる。`status: 'done'` なら当該ステップも完了表示(進行中なし)。数値/文字列のみ指定時は `'in-progress'` 扱い。
|
|
15
16
|
*/
|
|
16
|
-
progress?: number | string
|
|
17
|
+
progress?: number | string | {
|
|
18
|
+
step: number | string;
|
|
19
|
+
status: 'in-progress' | 'done';
|
|
20
|
+
};
|
|
17
21
|
/** 各 href のアクティブ判定に前置するパス。 */
|
|
18
22
|
pathPrefix?: string;
|
|
19
23
|
/** アクティブ判定をカスタムする関数。 */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
5
6
|
import type {
|
|
6
7
|
FocusHandler,
|
|
7
8
|
KeyboardHandler,
|
|
@@ -15,7 +16,37 @@
|
|
|
15
16
|
// =========================================================================
|
|
16
17
|
// Props, States & Constants
|
|
17
18
|
// =========================================================================
|
|
18
|
-
export type SwitchProps =
|
|
19
|
+
export type SwitchProps = Omit<
|
|
20
|
+
HTMLInputAttributes,
|
|
21
|
+
// 独自型で再定義する props / イベントは除外して衝突を避ける
|
|
22
|
+
| 'children'
|
|
23
|
+
| 'value'
|
|
24
|
+
| 'size'
|
|
25
|
+
| 'onfocus'
|
|
26
|
+
| 'onblur'
|
|
27
|
+
| 'onkeydown'
|
|
28
|
+
| 'onkeyup'
|
|
29
|
+
| 'onclick'
|
|
30
|
+
| 'onmousedown'
|
|
31
|
+
| 'onmouseup'
|
|
32
|
+
| 'onmouseenter'
|
|
33
|
+
| 'onmouseleave'
|
|
34
|
+
| 'onmouseover'
|
|
35
|
+
| 'onmouseout'
|
|
36
|
+
| 'oncontextmenu'
|
|
37
|
+
| 'onauxclick'
|
|
38
|
+
| 'ontouchstart'
|
|
39
|
+
| 'ontouchend'
|
|
40
|
+
| 'ontouchmove'
|
|
41
|
+
| 'ontouchcancel'
|
|
42
|
+
| 'onpointerdown'
|
|
43
|
+
| 'onpointerup'
|
|
44
|
+
| 'onpointerenter'
|
|
45
|
+
| 'onpointerleave'
|
|
46
|
+
| 'onpointermove'
|
|
47
|
+
| 'onpointercancel'
|
|
48
|
+
| 'onchange'
|
|
49
|
+
> & {
|
|
19
50
|
// Snippet
|
|
20
51
|
children?: Snippet;
|
|
21
52
|
|
|
@@ -77,9 +108,6 @@
|
|
|
77
108
|
|
|
78
109
|
// 入力イベント
|
|
79
110
|
onchange?: BivariantValueHandler<boolean>;
|
|
80
|
-
|
|
81
|
-
// その他
|
|
82
|
-
[key: string]: any;
|
|
83
111
|
};
|
|
84
112
|
|
|
85
113
|
let {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
3
|
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/callbackHandlers';
|
|
3
4
|
import type { ComponentSize } from '../types/propOptions';
|
|
4
|
-
export type SwitchProps = {
|
|
5
|
+
export type SwitchProps = Omit<HTMLInputAttributes, 'children' | 'value' | 'size' | 'onfocus' | 'onblur' | 'onkeydown' | 'onkeyup' | 'onclick' | 'onmousedown' | 'onmouseup' | 'onmouseenter' | 'onmouseleave' | 'onmouseover' | 'onmouseout' | 'oncontextmenu' | 'onauxclick' | 'ontouchstart' | 'ontouchend' | 'ontouchmove' | 'ontouchcancel' | 'onpointerdown' | 'onpointerup' | 'onpointerenter' | 'onpointerleave' | 'onpointermove' | 'onpointercancel' | 'onchange'> & {
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
/** Supports `bind:value`. */
|
|
7
8
|
value: boolean;
|
|
@@ -41,7 +42,6 @@ export type SwitchProps = {
|
|
|
41
42
|
onpointermove?: PointerHandler;
|
|
42
43
|
onpointercancel?: PointerHandler;
|
|
43
44
|
onchange?: BivariantValueHandler<boolean>;
|
|
44
|
-
[key: string]: any;
|
|
45
45
|
};
|
|
46
46
|
declare const Switch: import("svelte").Component<SwitchProps, {}, "value">;
|
|
47
47
|
type Switch = ReturnType<typeof Switch>;
|
|
@@ -20,7 +20,44 @@
|
|
|
20
20
|
// =========================================================================
|
|
21
21
|
// Props, States & Constants
|
|
22
22
|
// =========================================================================
|
|
23
|
-
export type TextareaProps =
|
|
23
|
+
export type TextareaProps = Omit<
|
|
24
|
+
HTMLTextareaAttributes,
|
|
25
|
+
// 独自の型で再定義するためベースの HTML 属性から除外
|
|
26
|
+
| 'value'
|
|
27
|
+
| 'id'
|
|
28
|
+
| 'tabindex'
|
|
29
|
+
| 'maxlength'
|
|
30
|
+
| 'autocomplete'
|
|
31
|
+
| 'wrap'
|
|
32
|
+
| 'spellcheck'
|
|
33
|
+
| 'autocapitalize'
|
|
34
|
+
// 独自ハンドラ型(callbackHandlers)で再定義するイベント系
|
|
35
|
+
| 'onfocus'
|
|
36
|
+
| 'onblur'
|
|
37
|
+
| 'onkeydown'
|
|
38
|
+
| 'onkeyup'
|
|
39
|
+
| 'onclick'
|
|
40
|
+
| 'onmousedown'
|
|
41
|
+
| 'onmouseup'
|
|
42
|
+
| 'onmouseenter'
|
|
43
|
+
| 'onmouseleave'
|
|
44
|
+
| 'onmouseover'
|
|
45
|
+
| 'onmouseout'
|
|
46
|
+
| 'oncontextmenu'
|
|
47
|
+
| 'onauxclick'
|
|
48
|
+
| 'ontouchstart'
|
|
49
|
+
| 'ontouchend'
|
|
50
|
+
| 'ontouchmove'
|
|
51
|
+
| 'ontouchcancel'
|
|
52
|
+
| 'onpointerdown'
|
|
53
|
+
| 'onpointerup'
|
|
54
|
+
| 'onpointerenter'
|
|
55
|
+
| 'onpointerleave'
|
|
56
|
+
| 'onpointermove'
|
|
57
|
+
| 'onpointercancel'
|
|
58
|
+
| 'onchange'
|
|
59
|
+
| 'oninput'
|
|
60
|
+
> & {
|
|
24
61
|
// 基本プロパティ
|
|
25
62
|
name?: string;
|
|
26
63
|
value: string | null | undefined;
|
|
@@ -112,9 +149,6 @@
|
|
|
112
149
|
// 入力イベント
|
|
113
150
|
onchange?: BivariantValueHandler<string>;
|
|
114
151
|
oninput?: BivariantValueHandler<string>;
|
|
115
|
-
|
|
116
|
-
// その他
|
|
117
|
-
[key: string]: any;
|
|
118
152
|
};
|
|
119
153
|
|
|
120
154
|
let {
|