@14ch/svelte-ui 0.0.13 → 0.0.14
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/variables.scss +2 -2
- package/dist/components/Button.svelte +31 -5
- package/dist/components/Button.svelte.d.ts +5 -3
- package/dist/components/Checkbox.svelte +2 -3
- package/dist/components/Checkbox.svelte.d.ts +1 -1
- package/dist/components/CheckboxGroup.svelte +6 -3
- package/dist/components/CheckboxGroup.svelte.d.ts +1 -1
- package/dist/components/ColorPicker.svelte +4 -5
- package/dist/components/ColorPicker.svelte.d.ts +3 -3
- package/dist/components/Combobox.svelte +26 -7
- package/dist/components/Combobox.svelte.d.ts +1 -1
- package/dist/components/ConfirmDialog.svelte +3 -7
- package/dist/components/ConfirmDialog.svelte.d.ts +1 -1
- package/dist/components/Datepicker.svelte +88 -24
- package/dist/components/Datepicker.svelte.d.ts +4 -3
- package/dist/components/DatepickerCalendar.svelte +1 -1
- package/dist/components/DatepickerCalendar.svelte.d.ts +1 -1
- package/dist/components/Drawer.svelte +1 -1
- package/dist/components/Fab.svelte +28 -11
- package/dist/components/Fab.svelte.d.ts +8 -4
- package/dist/components/FileUploader.svelte +1 -1
- package/dist/components/FileUploader.svelte.d.ts +1 -1
- package/dist/components/IconButton.svelte +4 -3
- package/dist/components/IconButton.svelte.d.ts +4 -3
- package/dist/components/ImageUploader.svelte +1 -1
- package/dist/components/ImageUploader.svelte.d.ts +1 -1
- package/dist/components/Input.svelte +5 -3
- package/dist/components/Input.svelte.d.ts +4 -3
- package/dist/components/Popup.svelte +69 -82
- package/dist/components/Popup.svelte.d.ts +3 -3
- package/dist/components/PopupMenu.svelte +40 -56
- package/dist/components/PopupMenu.svelte.d.ts +3 -3
- package/dist/components/PopupMenuButton.svelte +10 -23
- package/dist/components/PopupMenuButton.svelte.d.ts +5 -4
- package/dist/components/Radio.svelte +1 -1
- package/dist/components/Radio.svelte.d.ts +1 -1
- package/dist/components/RadioGroup.svelte +1 -1
- package/dist/components/RadioGroup.svelte.d.ts +1 -1
- package/dist/components/SegmentedControl.svelte +1 -2
- package/dist/components/SegmentedControl.svelte.d.ts +1 -1
- package/dist/components/Select.svelte +1 -1
- package/dist/components/Select.svelte.d.ts +1 -1
- package/dist/components/Slider.svelte +2 -3
- package/dist/components/Slider.svelte.d.ts +1 -1
- package/dist/components/Snackbar.svelte +3 -2
- package/dist/components/Snackbar.svelte.d.ts +3 -2
- package/dist/components/SnackbarItem.svelte +4 -3
- package/dist/components/SnackbarItem.svelte.d.ts +4 -3
- package/dist/components/Switch.svelte +2 -4
- package/dist/components/Switch.svelte.d.ts +1 -1
- package/dist/components/TabItem.svelte +2 -2
- package/dist/components/Textarea.svelte +14 -12
- package/dist/components/Textarea.svelte.d.ts +4 -3
- package/dist/components/skeleton/SkeletonAvatar.svelte +22 -32
- package/dist/components/skeleton/SkeletonAvatar.svelte.d.ts +6 -2
- package/dist/components/skeleton/SkeletonButton.svelte +18 -16
- package/dist/components/skeleton/SkeletonButton.svelte.d.ts +5 -2
- package/dist/components/skeleton/SkeletonHeading.svelte +15 -18
- package/dist/components/skeleton/SkeletonHeading.svelte.d.ts +3 -2
- package/dist/components/skeleton/SkeletonMedia.svelte +29 -41
- package/dist/components/skeleton/SkeletonMedia.svelte.d.ts +8 -2
- package/dist/components/skeleton/SkeletonText.svelte +12 -14
- package/dist/components/skeleton/SkeletonText.svelte.d.ts +4 -2
- package/dist/i18n/index.d.ts +143 -5
- package/dist/i18n/index.js +20 -32
- package/dist/i18n/locales/de.d.ts +35 -0
- package/dist/i18n/locales/de.js +35 -0
- package/dist/i18n/locales/es.d.ts +35 -0
- package/dist/i18n/locales/es.js +35 -0
- package/dist/i18n/locales/fr.d.ts +35 -0
- package/dist/i18n/locales/fr.js +35 -0
- package/dist/i18n/locales/zh-cn.d.ts +35 -0
- package/dist/i18n/locales/zh-cn.js +35 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +1 -0
- package/dist/types/menuItem.d.ts +1 -1
- package/dist/types/propOptions.d.ts +54 -0
- package/dist/types/propOptions.js +5 -0
- package/dist/utils/popupManager.d.ts +26 -0
- package/dist/utils/popupManager.js +34 -0
- package/package.json +1 -1
- /package/dist/types/{eventHandlers.d.ts → callbackHandlers.d.ts} +0 -0
- /package/dist/types/{eventHandlers.js → callbackHandlers.js} +0 -0
|
@@ -8,36 +8,19 @@
|
|
|
8
8
|
import type { SvelteComponent } from 'svelte';
|
|
9
9
|
import { tick } from 'svelte';
|
|
10
10
|
import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
|
|
11
|
+
import type { PopupPosition } from '../types/propOptions';
|
|
11
12
|
|
|
12
13
|
// =========================================================================
|
|
13
14
|
// Props, States & Constants
|
|
14
15
|
// =========================================================================
|
|
15
16
|
export type PopupMenuProps = {
|
|
16
17
|
isOpen?: boolean;
|
|
17
|
-
anchorElement: HTMLElement;
|
|
18
|
-
position?:
|
|
19
|
-
| 'top'
|
|
20
|
-
| 'bottom'
|
|
21
|
-
| 'left'
|
|
22
|
-
| 'right'
|
|
23
|
-
| 'top-left'
|
|
24
|
-
| 'top-center'
|
|
25
|
-
| 'top-right'
|
|
26
|
-
| 'bottom-left'
|
|
27
|
-
| 'bottom-center'
|
|
28
|
-
| 'bottom-right'
|
|
29
|
-
| 'left-top'
|
|
30
|
-
| 'left-center'
|
|
31
|
-
| 'left-bottom'
|
|
32
|
-
| 'right-top'
|
|
33
|
-
| 'right-center'
|
|
34
|
-
| 'right-bottom'
|
|
35
|
-
| 'auto';
|
|
18
|
+
anchorElement: HTMLElement | null | undefined;
|
|
19
|
+
position?: PopupPosition;
|
|
36
20
|
menuItems: (MenuItem | 'separator')[];
|
|
37
21
|
id?: string;
|
|
38
22
|
ariaLabel?: string;
|
|
39
23
|
mobileFullscreen?: boolean;
|
|
40
|
-
mobileBehavior?: 'auto' | 'fullscreen' | 'popup';
|
|
41
24
|
iconFilled?: boolean;
|
|
42
25
|
iconWeight?: IconWeight;
|
|
43
26
|
iconGrade?: IconGrade;
|
|
@@ -61,7 +44,6 @@
|
|
|
61
44
|
// 状態/動作
|
|
62
45
|
isOpen = $bindable(false),
|
|
63
46
|
mobileFullscreen = true,
|
|
64
|
-
mobileBehavior = 'auto',
|
|
65
47
|
|
|
66
48
|
// アイコン関連
|
|
67
49
|
iconFilled = false,
|
|
@@ -85,7 +67,9 @@
|
|
|
85
67
|
// =========================================================================
|
|
86
68
|
const getMenuItemId = (index: number): string => `${menuId}-item-${index}`;
|
|
87
69
|
|
|
88
|
-
const executeMenuItem = (item: MenuItem) => {
|
|
70
|
+
const executeMenuItem = (item: MenuItem, event?: MouseEvent) => {
|
|
71
|
+
event?.stopPropagation();
|
|
72
|
+
event?.preventDefault();
|
|
89
73
|
if (item.callback) {
|
|
90
74
|
item.callback();
|
|
91
75
|
}
|
|
@@ -95,30 +79,40 @@
|
|
|
95
79
|
const handleKeyDown = async (event: KeyboardEvent) => {
|
|
96
80
|
switch (event.key) {
|
|
97
81
|
case 'ArrowDown':
|
|
82
|
+
case 'ArrowUp':
|
|
83
|
+
case 'Home':
|
|
84
|
+
case 'End':
|
|
85
|
+
case 'Enter':
|
|
86
|
+
case ' ':
|
|
87
|
+
case 'Escape':
|
|
98
88
|
event.preventDefault();
|
|
89
|
+
event.stopPropagation(); // PopupのhandleKeyDownに伝播させない
|
|
90
|
+
break;
|
|
91
|
+
case 'Tab':
|
|
92
|
+
event.stopPropagation(); // PopupのhandleKeyDownに伝播させない
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
switch (event.key) {
|
|
97
|
+
case 'ArrowDown':
|
|
99
98
|
moveToNextItem();
|
|
100
99
|
break;
|
|
101
100
|
case 'ArrowUp':
|
|
102
|
-
event.preventDefault();
|
|
103
101
|
moveToPreviousItem();
|
|
104
102
|
break;
|
|
105
103
|
case 'Home':
|
|
106
|
-
event.preventDefault();
|
|
107
104
|
moveToFirstItem();
|
|
108
105
|
break;
|
|
109
106
|
case 'End':
|
|
110
|
-
event.preventDefault();
|
|
111
107
|
moveToLastItem();
|
|
112
108
|
break;
|
|
113
109
|
case 'Enter':
|
|
114
110
|
case ' ':
|
|
115
|
-
event.preventDefault();
|
|
116
111
|
if (activeIndex >= 0 && activeIndex < actionableItems.length) {
|
|
117
112
|
executeMenuItem(actionableItems[activeIndex].item);
|
|
118
113
|
}
|
|
119
114
|
break;
|
|
120
115
|
case 'Escape':
|
|
121
|
-
event.preventDefault();
|
|
122
116
|
close();
|
|
123
117
|
break;
|
|
124
118
|
case 'Tab':
|
|
@@ -180,18 +174,16 @@
|
|
|
180
174
|
};
|
|
181
175
|
|
|
182
176
|
const handlePopupOpen = () => {
|
|
183
|
-
activeIndex =
|
|
177
|
+
activeIndex = -1; // 初期状態ではハイライトなし
|
|
184
178
|
tick().then(() => {
|
|
185
179
|
menuContainerRef?.focus();
|
|
186
180
|
});
|
|
187
181
|
|
|
188
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
189
182
|
announceMenuOpened();
|
|
190
183
|
};
|
|
191
184
|
|
|
192
185
|
const handlePopupClose = () => {
|
|
193
186
|
activeIndex = -1;
|
|
194
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
195
187
|
|
|
196
188
|
if (anchorElement) {
|
|
197
189
|
anchorElement.focus();
|
|
@@ -210,6 +202,13 @@
|
|
|
210
202
|
popupRef?.toggle();
|
|
211
203
|
};
|
|
212
204
|
|
|
205
|
+
const cancelParentEvent = (event: Event) => {
|
|
206
|
+
event.stopPropagation();
|
|
207
|
+
if (event.cancelable) {
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
213
212
|
// =========================================================================
|
|
214
213
|
// $derived
|
|
215
214
|
// =========================================================================
|
|
@@ -231,7 +230,6 @@
|
|
|
231
230
|
onClose={handlePopupClose}
|
|
232
231
|
role="menu"
|
|
233
232
|
{mobileFullscreen}
|
|
234
|
-
{mobileBehavior}
|
|
235
233
|
id={id ? `${id}-popup` : undefined}
|
|
236
234
|
>
|
|
237
235
|
<div
|
|
@@ -242,6 +240,8 @@
|
|
|
242
240
|
aria-activedescendant={activeIndex >= 0 ? getMenuItemId(activeIndex) : undefined}
|
|
243
241
|
tabindex="-1"
|
|
244
242
|
{id}
|
|
243
|
+
onclick={cancelParentEvent}
|
|
244
|
+
onkeydown={handleKeyDown}
|
|
245
245
|
>
|
|
246
246
|
<ul class="popup-menu__list" role="none">
|
|
247
247
|
{#each menuItems as item, index}
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
tabindex="-1"
|
|
262
262
|
aria-describedby={item.icon ? `${getMenuItemId(actionableIndex)}-icon` : undefined}
|
|
263
263
|
href={item.href}
|
|
264
|
-
onclick={() => executeMenuItem(item)}
|
|
264
|
+
onclick={(e) => executeMenuItem(item, e)}
|
|
265
265
|
onmouseenter={() => handleMouseEnter(actionableIndex)}
|
|
266
266
|
onfocus={() => handleFocus(actionableIndex)}
|
|
267
267
|
>
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
{item.icon}
|
|
279
279
|
</Icon>
|
|
280
280
|
{/if}
|
|
281
|
-
<span class="popup-menu__text">{item.
|
|
281
|
+
<span class="popup-menu__text">{item.label}</span>
|
|
282
282
|
</a>
|
|
283
283
|
{:else}
|
|
284
284
|
<button
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
role="menuitem"
|
|
290
290
|
tabindex="-1"
|
|
291
291
|
aria-describedby={item.icon ? `${getMenuItemId(actionableIndex)}-icon` : undefined}
|
|
292
|
-
onclick={() => executeMenuItem(item)}
|
|
292
|
+
onclick={(e) => executeMenuItem(item, e)}
|
|
293
293
|
onmouseenter={() => handleMouseEnter(actionableIndex)}
|
|
294
294
|
onfocus={() => handleFocus(actionableIndex)}
|
|
295
295
|
>
|
|
@@ -306,7 +306,7 @@
|
|
|
306
306
|
{item.icon}
|
|
307
307
|
</Icon>
|
|
308
308
|
{/if}
|
|
309
|
-
<span class="popup-menu__text">{item.
|
|
309
|
+
<span class="popup-menu__text">{item.label}</span>
|
|
310
310
|
</button>
|
|
311
311
|
{/if}
|
|
312
312
|
{/if}
|
|
@@ -316,7 +316,8 @@
|
|
|
316
316
|
</div>
|
|
317
317
|
</Popup>
|
|
318
318
|
|
|
319
|
-
<style
|
|
319
|
+
<style>@charset "UTF-8";
|
|
320
|
+
.popup-menu {
|
|
320
321
|
background-color: var(--svelte-ui-surface-color);
|
|
321
322
|
border-radius: 4px;
|
|
322
323
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
@@ -392,29 +393,12 @@
|
|
|
392
393
|
padding: 12px 16px;
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
|
-
/* Enhanced mobile menu
|
|
396
|
-
:global(.popup--
|
|
397
|
-
border-radius: 0;
|
|
398
|
-
box-shadow: none;
|
|
399
|
-
background: transparent;
|
|
400
|
-
width: 100%;
|
|
401
|
-
max-width: none;
|
|
402
|
-
min-width: auto;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
:global(.popup--mobile.popup--fullscreen) .popup-menu {
|
|
406
|
-
background: var(--svelte-ui-surface-color);
|
|
407
|
-
border-radius: var(--svelte-ui-popup-mobile-border-radius);
|
|
408
|
-
box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
409
|
-
margin: 0;
|
|
410
|
-
padding: 0;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
:global(.popup--mobile.popup--fullscreen) .popup-menu__list {
|
|
396
|
+
/* Enhanced mobile menu spacing (layoutはPopup側に任せる) */
|
|
397
|
+
:global(.popup--fullscreen) .popup-menu__list {
|
|
414
398
|
padding: 16px 0;
|
|
415
399
|
}
|
|
416
400
|
|
|
417
|
-
:global(.popup--
|
|
401
|
+
:global(.popup--fullscreen) .popup-menu__button {
|
|
418
402
|
padding: 16px 24px;
|
|
419
403
|
font-size: 1.1rem;
|
|
420
404
|
min-height: var(--svelte-ui-touch-target-lg);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { MenuItem } from '../types/menuItem';
|
|
2
2
|
import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
|
|
3
|
+
import type { PopupPosition } from '../types/propOptions';
|
|
3
4
|
export type PopupMenuProps = {
|
|
4
5
|
isOpen?: boolean;
|
|
5
|
-
anchorElement: HTMLElement;
|
|
6
|
-
position?:
|
|
6
|
+
anchorElement: HTMLElement | null | undefined;
|
|
7
|
+
position?: PopupPosition;
|
|
7
8
|
menuItems: (MenuItem | 'separator')[];
|
|
8
9
|
id?: string;
|
|
9
10
|
ariaLabel?: string;
|
|
10
11
|
mobileFullscreen?: boolean;
|
|
11
|
-
mobileBehavior?: 'auto' | 'fullscreen' | 'popup';
|
|
12
12
|
iconFilled?: boolean;
|
|
13
13
|
iconWeight?: IconWeight;
|
|
14
14
|
iconGrade?: IconGrade;
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
MouseHandler,
|
|
12
12
|
TouchHandler,
|
|
13
13
|
PointerHandler
|
|
14
|
-
} from '../types/
|
|
14
|
+
} from '../types/callbackHandlers';
|
|
15
|
+
import type { PopupPosition, ButtonVariant } from '../types/propOptions';
|
|
15
16
|
|
|
16
17
|
// =========================================================================
|
|
17
18
|
// Props, States & Constants
|
|
@@ -27,24 +28,8 @@
|
|
|
27
28
|
id?: string;
|
|
28
29
|
|
|
29
30
|
// スタイル/レイアウト
|
|
30
|
-
position?:
|
|
31
|
-
|
|
32
|
-
| 'bottom'
|
|
33
|
-
| 'left'
|
|
34
|
-
| 'right'
|
|
35
|
-
| 'top-left'
|
|
36
|
-
| 'top-center'
|
|
37
|
-
| 'top-right'
|
|
38
|
-
| 'bottom-left'
|
|
39
|
-
| 'bottom-center'
|
|
40
|
-
| 'bottom-right'
|
|
41
|
-
| 'left-top'
|
|
42
|
-
| 'left-center'
|
|
43
|
-
| 'left-bottom'
|
|
44
|
-
| 'right-top'
|
|
45
|
-
| 'right-center'
|
|
46
|
-
| 'right-bottom';
|
|
47
|
-
variant?: 'ghost' | 'filled' | 'outlined' | 'glass';
|
|
31
|
+
position?: PopupPosition;
|
|
32
|
+
variant?: ButtonVariant;
|
|
48
33
|
size?: number;
|
|
49
34
|
color?: string;
|
|
50
35
|
rounded?: boolean;
|
|
@@ -52,7 +37,7 @@
|
|
|
52
37
|
// 状態/動作
|
|
53
38
|
disabled?: boolean;
|
|
54
39
|
mobileFullscreen?: boolean;
|
|
55
|
-
|
|
40
|
+
cancelParentClick?: boolean;
|
|
56
41
|
|
|
57
42
|
// フォーカスイベント
|
|
58
43
|
onfocus?: FocusHandler;
|
|
@@ -111,7 +96,7 @@
|
|
|
111
96
|
// 状態/動作
|
|
112
97
|
disabled = false,
|
|
113
98
|
mobileFullscreen = true,
|
|
114
|
-
|
|
99
|
+
cancelParentClick = false,
|
|
115
100
|
|
|
116
101
|
// フォーカスイベント
|
|
117
102
|
onfocus = () => {}, // No params for type inference
|
|
@@ -159,7 +144,10 @@
|
|
|
159
144
|
// =========================================================================
|
|
160
145
|
const handleClick = (event: MouseEvent) => {
|
|
161
146
|
if (disabled) return;
|
|
162
|
-
|
|
147
|
+
if (cancelParentClick) {
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
}
|
|
163
151
|
onclick?.(event);
|
|
164
152
|
toggle();
|
|
165
153
|
};
|
|
@@ -350,7 +338,6 @@
|
|
|
350
338
|
{ariaLabel}
|
|
351
339
|
{position}
|
|
352
340
|
{mobileFullscreen}
|
|
353
|
-
{mobileBehavior}
|
|
354
341
|
id={id ? `${id}-menu` : undefined}
|
|
355
342
|
/>
|
|
356
343
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { MenuItem } from '../types/menuItem';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/
|
|
3
|
+
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/callbackHandlers';
|
|
4
|
+
import type { PopupPosition, ButtonVariant } from '../types/propOptions';
|
|
4
5
|
export type PopupMenuButtonProps = {
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
menuItems: (MenuItem | 'separator')[];
|
|
7
8
|
id?: string;
|
|
8
|
-
position?:
|
|
9
|
-
variant?:
|
|
9
|
+
position?: PopupPosition;
|
|
10
|
+
variant?: ButtonVariant;
|
|
10
11
|
size?: number;
|
|
11
12
|
color?: string;
|
|
12
13
|
rounded?: boolean;
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
mobileFullscreen?: boolean;
|
|
15
|
-
|
|
16
|
+
cancelParentClick?: boolean;
|
|
16
17
|
onfocus?: FocusHandler;
|
|
17
18
|
onblur?: FocusHandler;
|
|
18
19
|
onkeydown?: KeyboardHandler;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
TouchHandler,
|
|
11
11
|
PointerHandler,
|
|
12
12
|
BivariantValueHandler
|
|
13
|
-
} from '../types/
|
|
13
|
+
} from '../types/callbackHandlers';
|
|
14
14
|
import type { OptionValue } from '../types/options';
|
|
15
15
|
|
|
16
16
|
// =========================================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
-
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/
|
|
3
|
+
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/callbackHandlers';
|
|
4
4
|
import type { OptionValue } from '../types/options';
|
|
5
5
|
export type RadioProps = {
|
|
6
6
|
children?: Snippet;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Option, OptionValue } from '../types/options';
|
|
5
5
|
import Radio from './Radio.svelte';
|
|
6
6
|
import { getStyleFromNumber } from '../utils/style';
|
|
7
|
-
import type { BivariantValueHandler } from '../types/
|
|
7
|
+
import type { BivariantValueHandler } from '../types/callbackHandlers';
|
|
8
8
|
|
|
9
9
|
// =========================================================================
|
|
10
10
|
// Props, States & Constants
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Option, OptionValue } from '../types/options';
|
|
2
|
-
import type { BivariantValueHandler } from '../types/
|
|
2
|
+
import type { BivariantValueHandler } from '../types/callbackHandlers';
|
|
3
3
|
export type RadioGroupProps = {
|
|
4
4
|
name?: string;
|
|
5
5
|
options: Option[];
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
|
|
6
6
|
import type { SegmentedControlItem } from '../types/segmentedControlItem';
|
|
7
7
|
import type {
|
|
8
|
-
BivariantValueHandler,
|
|
9
8
|
FocusHandler,
|
|
10
9
|
KeyboardHandler,
|
|
11
10
|
MouseHandler,
|
|
12
11
|
TouchHandler,
|
|
13
12
|
PointerHandler
|
|
14
|
-
} from '../types/
|
|
13
|
+
} from '../types/callbackHandlers';
|
|
15
14
|
|
|
16
15
|
// =========================================================================
|
|
17
16
|
// Props, States & Constants
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
|
|
2
2
|
import type { SegmentedControlItem } from '../types/segmentedControlItem';
|
|
3
|
-
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/
|
|
3
|
+
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/callbackHandlers';
|
|
4
4
|
export type SegmentedControlProps = {
|
|
5
5
|
items: SegmentedControlItem[];
|
|
6
6
|
value: string;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
TouchHandler,
|
|
11
11
|
PointerHandler,
|
|
12
12
|
BivariantValueHandler
|
|
13
|
-
} from '../types/
|
|
13
|
+
} from '../types/callbackHandlers';
|
|
14
14
|
import type { Option } from '../types/options';
|
|
15
15
|
|
|
16
16
|
// =========================================================================
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLSelectAttributes } from 'svelte/elements';
|
|
2
|
-
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/
|
|
2
|
+
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler, BivariantValueHandler } from '../types/callbackHandlers';
|
|
3
3
|
import type { Option } from '../types/options';
|
|
4
4
|
export type SelectProps = {
|
|
5
5
|
name?: string;
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
KeyboardHandler,
|
|
9
9
|
MouseHandler,
|
|
10
10
|
TouchHandler,
|
|
11
|
-
PointerHandler
|
|
12
|
-
|
|
13
|
-
} from '../types/eventHandlers';
|
|
11
|
+
PointerHandler
|
|
12
|
+
} from '../types/callbackHandlers';
|
|
14
13
|
|
|
15
14
|
// =========================================================================
|
|
16
15
|
// Props, States & Constants
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
-
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/
|
|
2
|
+
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/callbackHandlers';
|
|
3
3
|
export type SliderProps = {
|
|
4
4
|
value: number;
|
|
5
5
|
name?: string;
|
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
import { onMount } from 'svelte';
|
|
5
5
|
import { snackbarManager, type SnackbarItem as SnackbarData } from '../utils/snackbar.svelte';
|
|
6
6
|
import SnackbarItem from './SnackbarItem.svelte';
|
|
7
|
+
import type { SnackbarPosition, SnackbarVariant } from '../types/propOptions';
|
|
7
8
|
|
|
8
9
|
// =========================================================================
|
|
9
10
|
// Props, States & Constants
|
|
10
11
|
// =========================================================================
|
|
11
12
|
export type SnackbarProps = {
|
|
12
13
|
// スタイル/レイアウト
|
|
13
|
-
position?:
|
|
14
|
+
position?: SnackbarPosition;
|
|
14
15
|
maxVisible?: number;
|
|
15
|
-
variant?:
|
|
16
|
+
variant?: SnackbarVariant;
|
|
16
17
|
|
|
17
18
|
// 状態/動作
|
|
18
19
|
duration?: number;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { SnackbarPosition, SnackbarVariant } from '../types/propOptions';
|
|
1
2
|
export type SnackbarProps = {
|
|
2
|
-
position?:
|
|
3
|
+
position?: SnackbarPosition;
|
|
3
4
|
maxVisible?: number;
|
|
4
|
-
variant?:
|
|
5
|
+
variant?: SnackbarVariant;
|
|
5
6
|
duration?: number;
|
|
6
7
|
};
|
|
7
8
|
declare const Snackbar: import("svelte").Component<SnackbarProps, {}, "">;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import { snackbar } from '../utils/snackbar.svelte';
|
|
7
7
|
import type { IconVariant } from '../types/icon';
|
|
8
|
+
import type { SnackbarType, SnackbarVariant, SnackbarPosition } from '../types/propOptions';
|
|
8
9
|
import Icon from './Icon.svelte';
|
|
9
10
|
import IconButton from './IconButton.svelte';
|
|
10
11
|
import Button from './Button.svelte';
|
|
@@ -18,15 +19,15 @@
|
|
|
18
19
|
|
|
19
20
|
// 基本プロパティ
|
|
20
21
|
message?: string;
|
|
21
|
-
type?:
|
|
22
|
+
type?: SnackbarType;
|
|
22
23
|
actionLabel?: string;
|
|
23
24
|
|
|
24
25
|
// HTML属性系
|
|
25
26
|
id: string;
|
|
26
27
|
|
|
27
28
|
// スタイル/レイアウト
|
|
28
|
-
variant?:
|
|
29
|
-
position?:
|
|
29
|
+
variant?: SnackbarVariant;
|
|
30
|
+
position?: SnackbarPosition;
|
|
30
31
|
color?: string;
|
|
31
32
|
textColor?: string;
|
|
32
33
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { IconVariant } from '../types/icon';
|
|
3
|
+
import type { SnackbarType, SnackbarVariant, SnackbarPosition } from '../types/propOptions';
|
|
3
4
|
export type SnackbarItemProps = {
|
|
4
5
|
children?: Snippet;
|
|
5
6
|
message?: string;
|
|
6
|
-
type?:
|
|
7
|
+
type?: SnackbarType;
|
|
7
8
|
actionLabel?: string;
|
|
8
9
|
id: string;
|
|
9
|
-
variant?:
|
|
10
|
-
position?:
|
|
10
|
+
variant?: SnackbarVariant;
|
|
11
|
+
position?: SnackbarPosition;
|
|
11
12
|
color?: string;
|
|
12
13
|
textColor?: string;
|
|
13
14
|
duration?: number;
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
KeyboardHandler,
|
|
9
9
|
MouseHandler,
|
|
10
10
|
TouchHandler,
|
|
11
|
-
PointerHandler
|
|
12
|
-
|
|
13
|
-
} from '../types/eventHandlers';
|
|
11
|
+
PointerHandler
|
|
12
|
+
} from '../types/callbackHandlers';
|
|
14
13
|
|
|
15
14
|
// =========================================================================
|
|
16
15
|
// Props, States & Constants
|
|
@@ -138,7 +137,6 @@
|
|
|
138
137
|
}: SwitchProps = $props();
|
|
139
138
|
|
|
140
139
|
let inputRef: HTMLInputElement | undefined = $state();
|
|
141
|
-
let errorId = `switch-error-${Math.random().toString(36).substring(2, 15)}`;
|
|
142
140
|
|
|
143
141
|
// =========================================================================
|
|
144
142
|
// Methods
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
-
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/
|
|
3
|
+
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/callbackHandlers';
|
|
4
4
|
export type SwitchProps = {
|
|
5
5
|
children?: Snippet;
|
|
6
6
|
value: boolean;
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
KeyboardHandler,
|
|
13
13
|
MouseHandler,
|
|
14
14
|
TouchHandler,
|
|
15
|
-
PointerHandler
|
|
16
|
-
|
|
17
|
-
} from '../types/
|
|
15
|
+
PointerHandler
|
|
16
|
+
} from '../types/callbackHandlers';
|
|
17
|
+
import type { FocusStyle } from '../types/propOptions';
|
|
18
18
|
|
|
19
19
|
// =========================================================================
|
|
20
20
|
// Props, States & Constants
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
export type TextareaProps = {
|
|
23
23
|
// 基本プロパティ
|
|
24
24
|
name?: string;
|
|
25
|
-
value: string;
|
|
25
|
+
value: string | null | undefined;
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
|
|
28
28
|
// HTML属性系
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
minHeight?: string | number | null;
|
|
41
41
|
maxHeight?: string | number | null;
|
|
42
42
|
inline?: boolean;
|
|
43
|
-
focusStyle?:
|
|
43
|
+
focusStyle?: FocusStyle;
|
|
44
44
|
fullWidth?: boolean;
|
|
45
45
|
fullHeight?: boolean;
|
|
46
46
|
width?: string | number | null;
|
|
@@ -339,13 +339,14 @@
|
|
|
339
339
|
|
|
340
340
|
// HTML表示用の値(autoResize時の高さ調整用)
|
|
341
341
|
const htmlValue = $derived.by(() => {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
const normalizedValue = value ?? '';
|
|
343
|
+
if (normalizedValue !== '') {
|
|
344
|
+
const converted = convertToHtml(normalizedValue);
|
|
345
|
+
const html = String(converted ?? '');
|
|
345
346
|
// 最後の行が空だったら空白を追加(高さ調整のため)
|
|
346
347
|
const lines = html.split('<br />');
|
|
347
348
|
if (lines.length > 0 && lines[lines.length - 1] === '') {
|
|
348
|
-
html
|
|
349
|
+
return html + ' ';
|
|
349
350
|
}
|
|
350
351
|
return html;
|
|
351
352
|
} else {
|
|
@@ -360,11 +361,12 @@
|
|
|
360
361
|
|
|
361
362
|
// URLをリンク化した表示用HTML(クリック検出用オーバーレイで使用)
|
|
362
363
|
const linkHtmlValue = $derived.by(() => {
|
|
363
|
-
|
|
364
|
+
const normalizedValue = value ?? '';
|
|
365
|
+
if (!linkify || normalizedValue === '') {
|
|
364
366
|
return '';
|
|
365
367
|
}
|
|
366
|
-
const result = convertToHtmlWithLink(
|
|
367
|
-
return
|
|
368
|
+
const result = convertToHtmlWithLink(normalizedValue);
|
|
369
|
+
return String(result ?? '');
|
|
368
370
|
});
|
|
369
371
|
</script>
|
|
370
372
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
2
2
|
import type { IconVariant } from '../types/icon';
|
|
3
|
-
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/
|
|
3
|
+
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/callbackHandlers';
|
|
4
|
+
import type { FocusStyle } from '../types/propOptions';
|
|
4
5
|
export type TextareaProps = {
|
|
5
6
|
name?: string;
|
|
6
|
-
value: string;
|
|
7
|
+
value: string | null | undefined;
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
id?: string | null;
|
|
9
10
|
tabindex?: number | null;
|
|
@@ -17,7 +18,7 @@ export type TextareaProps = {
|
|
|
17
18
|
minHeight?: string | number | null;
|
|
18
19
|
maxHeight?: string | number | null;
|
|
19
20
|
inline?: boolean;
|
|
20
|
-
focusStyle?:
|
|
21
|
+
focusStyle?: FocusStyle;
|
|
21
22
|
fullWidth?: boolean;
|
|
22
23
|
fullHeight?: boolean;
|
|
23
24
|
width?: string | number | null;
|