@14ch/svelte-ui 0.0.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/README.md +359 -0
- package/dist/assets/styles/README.md +144 -0
- package/dist/assets/styles/core.scss +61 -0
- package/dist/assets/styles/import.scss +11 -0
- package/dist/assets/styles/optional/fonts.scss +23 -0
- package/dist/assets/styles/optional/reset.scss +230 -0
- package/dist/assets/styles/variables.scss +805 -0
- package/dist/components/Button.svelte +574 -0
- package/dist/components/Button.svelte.d.ts +56 -0
- package/dist/components/COMPONENT_DESIGN_GUIDELINES.md +127 -0
- package/dist/components/Checkbox.svelte +523 -0
- package/dist/components/Checkbox.svelte.d.ts +42 -0
- package/dist/components/CheckboxGroup.svelte +82 -0
- package/dist/components/CheckboxGroup.svelte.d.ts +13 -0
- package/dist/components/ColorPicker.svelte +496 -0
- package/dist/components/ColorPicker.svelte.d.ts +45 -0
- package/dist/components/Combobox.svelte +576 -0
- package/dist/components/Combobox.svelte.d.ts +52 -0
- package/dist/components/ConfirmDialog.svelte +116 -0
- package/dist/components/ConfirmDialog.svelte.d.ts +20 -0
- package/dist/components/Datepicker.svelte +578 -0
- package/dist/components/Datepicker.svelte.d.ts +72 -0
- package/dist/components/DatepickerCalendar.svelte +925 -0
- package/dist/components/DatepickerCalendar.svelte.d.ts +31 -0
- package/dist/components/Dialog.svelte +245 -0
- package/dist/components/Dialog.svelte.d.ts +38 -0
- package/dist/components/Drawer.svelte +383 -0
- package/dist/components/Drawer.svelte.d.ts +39 -0
- package/dist/components/Fab.svelte +486 -0
- package/dist/components/Fab.svelte.d.ts +51 -0
- package/dist/components/FileUploader.svelte +456 -0
- package/dist/components/FileUploader.svelte.d.ts +36 -0
- package/dist/components/Icon.svelte +167 -0
- package/dist/components/Icon.svelte.d.ts +21 -0
- package/dist/components/IconButton.svelte +557 -0
- package/dist/components/IconButton.svelte.d.ts +60 -0
- package/dist/components/ImageUploader.svelte +516 -0
- package/dist/components/ImageUploader.svelte.d.ts +37 -0
- package/dist/components/ImageUploaderPreview.svelte +157 -0
- package/dist/components/ImageUploaderPreview.svelte.d.ts +13 -0
- package/dist/components/Input.svelte +885 -0
- package/dist/components/Input.svelte.d.ts +75 -0
- package/dist/components/LoadingSpinner.svelte +116 -0
- package/dist/components/LoadingSpinner.svelte.d.ts +10 -0
- package/dist/components/Modal.svelte +313 -0
- package/dist/components/Modal.svelte.d.ts +34 -0
- package/dist/components/Pagination.svelte +276 -0
- package/dist/components/Pagination.svelte.d.ts +14 -0
- package/dist/components/Popup.svelte +676 -0
- package/dist/components/Popup.svelte.d.ts +40 -0
- package/dist/components/PopupMenu.svelte +421 -0
- package/dist/components/PopupMenu.svelte.d.ts +24 -0
- package/dist/components/PopupMenuButton.svelte +365 -0
- package/dist/components/PopupMenuButton.svelte.d.ts +42 -0
- package/dist/components/Radio.svelte +548 -0
- package/dist/components/Radio.svelte.d.ts +42 -0
- package/dist/components/RadioGroup.svelte +74 -0
- package/dist/components/RadioGroup.svelte.d.ts +14 -0
- package/dist/components/Select.svelte +479 -0
- package/dist/components/Select.svelte.d.ts +47 -0
- package/dist/components/Slider.svelte +473 -0
- package/dist/components/Slider.svelte.d.ts +46 -0
- package/dist/components/Snackbar.svelte +124 -0
- package/dist/components/Snackbar.svelte.d.ts +9 -0
- package/dist/components/SnackbarItem.svelte +423 -0
- package/dist/components/SnackbarItem.svelte.d.ts +21 -0
- package/dist/components/Switch.svelte +454 -0
- package/dist/components/Switch.svelte.d.ts +40 -0
- package/dist/components/Tab.svelte +193 -0
- package/dist/components/Tab.svelte.d.ts +14 -0
- package/dist/components/TabItem.svelte +140 -0
- package/dist/components/TabItem.svelte.d.ts +17 -0
- package/dist/components/Textarea.svelte +702 -0
- package/dist/components/Textarea.svelte.d.ts +64 -0
- package/dist/components/skeleton/Skeleton.svelte +235 -0
- package/dist/components/skeleton/Skeleton.svelte.d.ts +13 -0
- package/dist/components/skeleton/SkeletonAvatar.svelte +97 -0
- package/dist/components/skeleton/SkeletonAvatar.svelte.d.ts +8 -0
- package/dist/components/skeleton/SkeletonBox.svelte +105 -0
- package/dist/components/skeleton/SkeletonBox.svelte.d.ts +12 -0
- package/dist/components/skeleton/SkeletonButton.svelte +71 -0
- package/dist/components/skeleton/SkeletonButton.svelte.d.ts +8 -0
- package/dist/components/skeleton/SkeletonHeading.svelte +49 -0
- package/dist/components/skeleton/SkeletonHeading.svelte.d.ts +8 -0
- package/dist/components/skeleton/SkeletonMedia.svelte +115 -0
- package/dist/components/skeleton/SkeletonMedia.svelte.d.ts +9 -0
- package/dist/components/skeleton/SkeletonText.svelte +75 -0
- package/dist/components/skeleton/SkeletonText.svelte.d.ts +8 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +43 -0
- package/dist/types/icon.d.ts +4 -0
- package/dist/types/icon.js +2 -0
- package/dist/types/menuItem.d.ts +8 -0
- package/dist/types/menuItem.js +1 -0
- package/dist/types/options.d.ts +6 -0
- package/dist/types/options.js +4 -0
- package/dist/types/skeleton.d.ts +77 -0
- package/dist/types/skeleton.js +19 -0
- package/dist/utils/accessibility.d.ts +48 -0
- package/dist/utils/accessibility.js +87 -0
- package/dist/utils/formatText.d.ts +4 -0
- package/dist/utils/formatText.js +44 -0
- package/dist/utils/mobile.d.ts +9 -0
- package/dist/utils/mobile.js +47 -0
- package/dist/utils/snackbar.svelte.d.ts +51 -0
- package/dist/utils/snackbar.svelte.js +107 -0
- package/dist/utils/style.d.ts +17 -0
- package/dist/utils/style.js +22 -0
- package/package.json +102 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
<!-- Select.svelte -->
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import Icon from './Icon.svelte';
|
|
5
|
+
import type { HTMLSelectAttributes } from 'svelte/elements';
|
|
6
|
+
import type { Option } from '../types/options';
|
|
7
|
+
|
|
8
|
+
// =========================================================================
|
|
9
|
+
// Props, States & Constants
|
|
10
|
+
// =========================================================================
|
|
11
|
+
let {
|
|
12
|
+
// 基本プロパティ
|
|
13
|
+
name,
|
|
14
|
+
value = $bindable(),
|
|
15
|
+
options = [],
|
|
16
|
+
|
|
17
|
+
// HTML属性系
|
|
18
|
+
id = `select-${Math.random().toString(36).substring(2, 15)}`,
|
|
19
|
+
tabindex = null,
|
|
20
|
+
placeholder = '',
|
|
21
|
+
selectAttributes,
|
|
22
|
+
|
|
23
|
+
// スタイル/レイアウト
|
|
24
|
+
size = null,
|
|
25
|
+
variant = 'default',
|
|
26
|
+
focusStyle = 'outline',
|
|
27
|
+
fullWidth = false,
|
|
28
|
+
rounded = false,
|
|
29
|
+
customStyle = '',
|
|
30
|
+
|
|
31
|
+
// 状態/動作
|
|
32
|
+
disabled = false,
|
|
33
|
+
required = false,
|
|
34
|
+
|
|
35
|
+
// フォーカスイベント
|
|
36
|
+
onfocus = () => {}, // No params for type inference
|
|
37
|
+
onblur = () => {}, // No params for type inference
|
|
38
|
+
|
|
39
|
+
// キーボードイベント
|
|
40
|
+
onkeydown = () => {}, // No params for type inference
|
|
41
|
+
onkeyup = () => {}, // No params for type inference
|
|
42
|
+
|
|
43
|
+
// マウスイベント
|
|
44
|
+
onclick = () => {}, // No params for type inference
|
|
45
|
+
onmousedown = () => {}, // No params for type inference
|
|
46
|
+
onmouseup = () => {}, // No params for type inference
|
|
47
|
+
onmouseenter = () => {}, // No params for type inference
|
|
48
|
+
onmouseleave = () => {}, // No params for type inference
|
|
49
|
+
onmouseover = () => {}, // No params for type inference
|
|
50
|
+
onmouseout = () => {}, // No params for type inference
|
|
51
|
+
oncontextmenu = () => {}, // No params for type inference
|
|
52
|
+
onauxclick = () => {}, // No params for type inference
|
|
53
|
+
|
|
54
|
+
// タッチイベント
|
|
55
|
+
ontouchstart = () => {}, // No params for type inference
|
|
56
|
+
ontouchend = () => {}, // No params for type inference
|
|
57
|
+
ontouchmove = () => {}, // No params for type inference
|
|
58
|
+
ontouchcancel = () => {}, // No params for type inference
|
|
59
|
+
|
|
60
|
+
// ポインターイベント
|
|
61
|
+
onpointerdown = () => {}, // No params for type inference
|
|
62
|
+
onpointerup = () => {}, // No params for type inference
|
|
63
|
+
onpointerenter = () => {}, // No params for type inference
|
|
64
|
+
onpointerleave = () => {}, // No params for type inference
|
|
65
|
+
onpointermove = () => {}, // No params for type inference
|
|
66
|
+
onpointercancel = () => {}, // No params for type inference
|
|
67
|
+
|
|
68
|
+
// 入力イベント
|
|
69
|
+
onchange = () => {}, // No params for type inference
|
|
70
|
+
|
|
71
|
+
// その他
|
|
72
|
+
...restProps
|
|
73
|
+
}: {
|
|
74
|
+
// 基本プロパティ
|
|
75
|
+
name?: string;
|
|
76
|
+
value: string | number | null | undefined;
|
|
77
|
+
options: Option[];
|
|
78
|
+
|
|
79
|
+
// HTML属性系
|
|
80
|
+
id?: string | null;
|
|
81
|
+
tabindex?: number | null;
|
|
82
|
+
placeholder?: string;
|
|
83
|
+
selectAttributes?: HTMLSelectAttributes | undefined;
|
|
84
|
+
|
|
85
|
+
// スタイル/レイアウト
|
|
86
|
+
size?: number | null;
|
|
87
|
+
variant?: 'default' | 'inline';
|
|
88
|
+
focusStyle?: 'background' | 'outline' | 'none';
|
|
89
|
+
fullWidth?: boolean;
|
|
90
|
+
rounded?: boolean;
|
|
91
|
+
customStyle?: string;
|
|
92
|
+
|
|
93
|
+
// 状態/動作
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
required?: boolean;
|
|
96
|
+
|
|
97
|
+
// フォーカスイベント
|
|
98
|
+
onfocus?: Function; // No params for type inference
|
|
99
|
+
onblur?: Function; // No params for type inference
|
|
100
|
+
|
|
101
|
+
// キーボードイベント
|
|
102
|
+
onkeydown?: Function; // No params for type inference
|
|
103
|
+
onkeyup?: Function; // No params for type inference
|
|
104
|
+
|
|
105
|
+
// マウスイベント
|
|
106
|
+
onclick?: Function; // No params for type inference
|
|
107
|
+
onmousedown?: Function; // No params for type inference
|
|
108
|
+
onmouseup?: Function; // No params for type inference
|
|
109
|
+
onmouseenter?: Function; // No params for type inference
|
|
110
|
+
onmouseleave?: Function; // No params for type inference
|
|
111
|
+
onmouseover?: Function; // No params for type inference
|
|
112
|
+
onmouseout?: Function; // No params for type inference
|
|
113
|
+
oncontextmenu?: Function; // No params for type inference
|
|
114
|
+
onauxclick?: Function; // No params for type inference
|
|
115
|
+
|
|
116
|
+
// タッチイベント
|
|
117
|
+
ontouchstart?: Function; // No params for type inference
|
|
118
|
+
ontouchend?: Function; // No params for type inference
|
|
119
|
+
ontouchmove?: Function; // No params for type inference
|
|
120
|
+
ontouchcancel?: Function; // No params for type inference
|
|
121
|
+
|
|
122
|
+
// ポインターイベント
|
|
123
|
+
onpointerdown?: Function; // No params for type inference
|
|
124
|
+
onpointerup?: Function; // No params for type inference
|
|
125
|
+
onpointerenter?: Function; // No params for type inference
|
|
126
|
+
onpointerleave?: Function; // No params for type inference
|
|
127
|
+
onpointermove?: Function; // No params for type inference
|
|
128
|
+
onpointercancel?: Function; // No params for type inference
|
|
129
|
+
|
|
130
|
+
// 入力イベント
|
|
131
|
+
onchange?: (value: any) => void;
|
|
132
|
+
|
|
133
|
+
// その他
|
|
134
|
+
[key: string]: any;
|
|
135
|
+
} = $props();
|
|
136
|
+
|
|
137
|
+
let isFocused: boolean = $state(false);
|
|
138
|
+
let selectRef = $state<HTMLSelectElement>();
|
|
139
|
+
|
|
140
|
+
// =========================================================================
|
|
141
|
+
|
|
142
|
+
// Methods
|
|
143
|
+
// =========================================================================
|
|
144
|
+
|
|
145
|
+
const handleFocus = (event: FocusEvent) => {
|
|
146
|
+
if (disabled) return;
|
|
147
|
+
isFocused = true;
|
|
148
|
+
onfocus?.(event);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const handleBlur = (event: FocusEvent) => {
|
|
152
|
+
if (disabled) return;
|
|
153
|
+
isFocused = false;
|
|
154
|
+
onblur?.(event);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const handleKeydown = (event: KeyboardEvent) => {
|
|
158
|
+
if (disabled) return;
|
|
159
|
+
onkeydown?.(event);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const handleKeyup = (event: KeyboardEvent) => {
|
|
163
|
+
if (disabled) return;
|
|
164
|
+
onkeyup?.(event);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// マウスイベント
|
|
168
|
+
const handleClick = (event: MouseEvent) => {
|
|
169
|
+
if (disabled) return;
|
|
170
|
+
onclick?.(event);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const handleMouseDown = (event: MouseEvent) => {
|
|
174
|
+
if (disabled) return;
|
|
175
|
+
onmousedown?.(event);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const handleMouseUp = (event: MouseEvent) => {
|
|
179
|
+
if (disabled) return;
|
|
180
|
+
onmouseup?.(event);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const handleMouseEnter = (event: MouseEvent) => {
|
|
184
|
+
if (disabled) return;
|
|
185
|
+
onmouseenter?.(event);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const handleMouseLeave = (event: MouseEvent) => {
|
|
189
|
+
if (disabled) return;
|
|
190
|
+
onmouseleave?.(event);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const handleMouseOver = (event: MouseEvent) => {
|
|
194
|
+
if (disabled) return;
|
|
195
|
+
onmouseover?.(event);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const handleMouseOut = (event: MouseEvent) => {
|
|
199
|
+
if (disabled) return;
|
|
200
|
+
onmouseout?.(event);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const handleContextMenu = (event: MouseEvent) => {
|
|
204
|
+
if (disabled) return;
|
|
205
|
+
oncontextmenu?.(event);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const handleAuxClick = (event: MouseEvent) => {
|
|
209
|
+
if (disabled) return;
|
|
210
|
+
onauxclick?.(event);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// タッチイベント
|
|
214
|
+
const handleTouchStart = (event: TouchEvent) => {
|
|
215
|
+
if (disabled) return;
|
|
216
|
+
ontouchstart?.(event);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const handleTouchEnd = (event: TouchEvent) => {
|
|
220
|
+
if (disabled) return;
|
|
221
|
+
ontouchend?.(event);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const handleTouchMove = (event: TouchEvent) => {
|
|
225
|
+
if (disabled) return;
|
|
226
|
+
ontouchmove?.(event);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const handleTouchCancel = (event: TouchEvent) => {
|
|
230
|
+
if (disabled) return;
|
|
231
|
+
ontouchcancel?.(event);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// ポインターイベント
|
|
235
|
+
const handlePointerDown = (event: PointerEvent) => {
|
|
236
|
+
if (disabled) return;
|
|
237
|
+
onpointerdown?.(event);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const handlePointerUp = (event: PointerEvent) => {
|
|
241
|
+
if (disabled) return;
|
|
242
|
+
onpointerup?.(event);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const handlePointerEnter = (event: PointerEvent) => {
|
|
246
|
+
if (disabled) return;
|
|
247
|
+
onpointerenter?.(event);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const handlePointerLeave = (event: PointerEvent) => {
|
|
251
|
+
if (disabled) return;
|
|
252
|
+
onpointerleave?.(event);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const handlePointerMove = (event: PointerEvent) => {
|
|
256
|
+
if (disabled) return;
|
|
257
|
+
onpointermove?.(event);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const handlePointerCancel = (event: PointerEvent) => {
|
|
261
|
+
if (disabled) return;
|
|
262
|
+
onpointercancel?.(event);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// 選択イベント
|
|
266
|
+
const handleChange = () => {
|
|
267
|
+
onchange?.(value);
|
|
268
|
+
// 選択完了後にフォーカスを解除
|
|
269
|
+
if (selectRef) {
|
|
270
|
+
selectRef.blur();
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
</script>
|
|
274
|
+
|
|
275
|
+
<div
|
|
276
|
+
class="select
|
|
277
|
+
select--focus-{focusStyle}"
|
|
278
|
+
class:select--inline={variant === 'inline'}
|
|
279
|
+
class:select--full-width={fullWidth}
|
|
280
|
+
class:select--disabled={disabled}
|
|
281
|
+
class:select--focused={isFocused}
|
|
282
|
+
class:select--rounded={rounded}
|
|
283
|
+
data-testid="select"
|
|
284
|
+
>
|
|
285
|
+
<select
|
|
286
|
+
bind:this={selectRef}
|
|
287
|
+
{id}
|
|
288
|
+
{name}
|
|
289
|
+
bind:value
|
|
290
|
+
{disabled}
|
|
291
|
+
{required}
|
|
292
|
+
{tabindex}
|
|
293
|
+
{size}
|
|
294
|
+
style={customStyle}
|
|
295
|
+
onfocus={handleFocus}
|
|
296
|
+
onblur={handleBlur}
|
|
297
|
+
onkeydown={handleKeydown}
|
|
298
|
+
onkeyup={handleKeyup}
|
|
299
|
+
onclick={handleClick}
|
|
300
|
+
onmousedown={handleMouseDown}
|
|
301
|
+
onmouseup={handleMouseUp}
|
|
302
|
+
onmouseenter={handleMouseEnter}
|
|
303
|
+
onmouseleave={handleMouseLeave}
|
|
304
|
+
onmouseover={handleMouseOver}
|
|
305
|
+
onmouseout={handleMouseOut}
|
|
306
|
+
oncontextmenu={handleContextMenu}
|
|
307
|
+
onauxclick={handleAuxClick}
|
|
308
|
+
ontouchstart={handleTouchStart}
|
|
309
|
+
ontouchend={handleTouchEnd}
|
|
310
|
+
ontouchmove={handleTouchMove}
|
|
311
|
+
ontouchcancel={handleTouchCancel}
|
|
312
|
+
onpointerdown={handlePointerDown}
|
|
313
|
+
onpointerup={handlePointerUp}
|
|
314
|
+
onpointerenter={handlePointerEnter}
|
|
315
|
+
onpointerleave={handlePointerLeave}
|
|
316
|
+
onpointermove={handlePointerMove}
|
|
317
|
+
onpointercancel={handlePointerCancel}
|
|
318
|
+
onchange={handleChange}
|
|
319
|
+
{...selectAttributes}
|
|
320
|
+
{...restProps}
|
|
321
|
+
>
|
|
322
|
+
<!-- プレースホルダーオプション -->
|
|
323
|
+
{#if placeholder}
|
|
324
|
+
<option value="" disabled selected={value === undefined || value === null}>
|
|
325
|
+
{placeholder}
|
|
326
|
+
</option>
|
|
327
|
+
{/if}
|
|
328
|
+
<!-- 通常のオプション -->
|
|
329
|
+
{#each options as option (option.value)}
|
|
330
|
+
<option value={option.value} disabled={option.disabled}>
|
|
331
|
+
{option.label}
|
|
332
|
+
</option>
|
|
333
|
+
{/each}
|
|
334
|
+
</select>
|
|
335
|
+
<!-- ドロップダウンアイコン -->
|
|
336
|
+
<div class="select__dropdown-icon" aria-hidden="true">
|
|
337
|
+
<Icon>arrow_drop_down</Icon>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
<style>
|
|
342
|
+
/* =============================================
|
|
343
|
+
* 基本構造・レイアウト
|
|
344
|
+
* ============================================= */
|
|
345
|
+
.select {
|
|
346
|
+
display: inline-block;
|
|
347
|
+
position: relative;
|
|
348
|
+
width: auto;
|
|
349
|
+
max-width: 100%;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/* =============================================
|
|
353
|
+
* 基本コンポーネント
|
|
354
|
+
* ============================================= */
|
|
355
|
+
select {
|
|
356
|
+
width: 100%;
|
|
357
|
+
min-height: var(--svelte-ui-select-height);
|
|
358
|
+
padding: var(--svelte-ui-select-padding);
|
|
359
|
+
padding-right: var(--svelte-ui-select-icon-space);
|
|
360
|
+
background: transparent;
|
|
361
|
+
border: none;
|
|
362
|
+
border-radius: 0;
|
|
363
|
+
font-size: inherit;
|
|
364
|
+
font-weight: inherit;
|
|
365
|
+
color: inherit;
|
|
366
|
+
line-height: inherit;
|
|
367
|
+
text-align: inherit;
|
|
368
|
+
-webkit-appearance: none;
|
|
369
|
+
-moz-appearance: none;
|
|
370
|
+
appearance: none;
|
|
371
|
+
|
|
372
|
+
&:focus,
|
|
373
|
+
&:focus-visible {
|
|
374
|
+
outline: var(--svelte-ui-focus-outline-inner);
|
|
375
|
+
outline-offset: var(--svelte-ui-focus-outline-offset-inner);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.select__dropdown-icon {
|
|
380
|
+
display: flex;
|
|
381
|
+
justify-content: center;
|
|
382
|
+
align-items: center;
|
|
383
|
+
position: absolute;
|
|
384
|
+
top: 50%;
|
|
385
|
+
right: 4px;
|
|
386
|
+
width: 32px;
|
|
387
|
+
height: 32px;
|
|
388
|
+
transform: translateY(-50%);
|
|
389
|
+
font-size: var(--svelte-ui-select-dropdown-icon-size);
|
|
390
|
+
color: var(--svelte-ui-select-dropdown-icon-color);
|
|
391
|
+
pointer-events: none;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/* =============================================
|
|
395
|
+
* レイアウトバリエーション
|
|
396
|
+
* ============================================= */
|
|
397
|
+
.select--full-width {
|
|
398
|
+
width: 100%;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/* =============================================
|
|
402
|
+
* プレースホルダー・オプション表示
|
|
403
|
+
* ============================================= */
|
|
404
|
+
option[value=''] {
|
|
405
|
+
color: var(--svelte-ui-select-placeholder-color);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/* =============================================
|
|
409
|
+
* フォーカス効果バリエーション
|
|
410
|
+
* ============================================= */
|
|
411
|
+
.select--focus-outline select:focus {
|
|
412
|
+
outline: var(--svelte-ui-focus-outline-inner);
|
|
413
|
+
outline-offset: var(--svelte-ui-focus-outline-offset-inner);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.select--focus-background select:focus {
|
|
417
|
+
background: var(--svelte-ui-hover-overlay);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/* =============================================
|
|
421
|
+
* 状態管理(disabled, readonly等)
|
|
422
|
+
* ============================================= */
|
|
423
|
+
.select--disabled {
|
|
424
|
+
opacity: var(--svelte-ui-input-disabled-opacity);
|
|
425
|
+
pointer-events: none;
|
|
426
|
+
|
|
427
|
+
.select__dropdown-icon {
|
|
428
|
+
opacity: var(--svelte-ui-button-disabled-opacity);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
select:disabled {
|
|
433
|
+
opacity: var(--svelte-ui-button-disabled-opacity);
|
|
434
|
+
cursor: not-allowed;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/* =============================================
|
|
438
|
+
* デザインバリアント:default
|
|
439
|
+
* ============================================= */
|
|
440
|
+
.select:not(.select--inline) {
|
|
441
|
+
select {
|
|
442
|
+
min-height: var(--svelte-ui-select-height);
|
|
443
|
+
background-color: var(--svelte-ui-select-bg);
|
|
444
|
+
box-shadow: 0 0 0 var(--svelte-ui-border-width) inset var(--svelte-ui-select-border-color);
|
|
445
|
+
border: none;
|
|
446
|
+
border-radius: var(--svelte-ui-select-border-radius);
|
|
447
|
+
font-size: 1rem;
|
|
448
|
+
color: var(--svelte-ui-select-text-color);
|
|
449
|
+
line-height: var(--svelte-ui-select-height);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/* =============================================
|
|
454
|
+
* デザインバリアント:inline
|
|
455
|
+
* ============================================= */
|
|
456
|
+
.select.select--inline {
|
|
457
|
+
select {
|
|
458
|
+
padding: inherit;
|
|
459
|
+
padding-right: var(--svelte-ui-input-icon-space-inline);
|
|
460
|
+
background: transparent;
|
|
461
|
+
border: none;
|
|
462
|
+
border-radius: 0;
|
|
463
|
+
color: inherit;
|
|
464
|
+
min-height: auto;
|
|
465
|
+
line-height: inherit;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.select__dropdown-icon {
|
|
469
|
+
right: 0;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/* =============================================
|
|
474
|
+
* デザインバリアント:rounded
|
|
475
|
+
* ============================================= */
|
|
476
|
+
.select--rounded:not(.select--inline) select {
|
|
477
|
+
border-radius: var(--svelte-ui-select-border-radius-rounded);
|
|
478
|
+
}
|
|
479
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HTMLSelectAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Option } from '../types/options';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
name?: string;
|
|
5
|
+
value: string | number | null | undefined;
|
|
6
|
+
options: Option[];
|
|
7
|
+
id?: string | null;
|
|
8
|
+
tabindex?: number | null;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
selectAttributes?: HTMLSelectAttributes | undefined;
|
|
11
|
+
size?: number | null;
|
|
12
|
+
variant?: 'default' | 'inline';
|
|
13
|
+
focusStyle?: 'background' | 'outline' | 'none';
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
rounded?: boolean;
|
|
16
|
+
customStyle?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
onfocus?: Function;
|
|
20
|
+
onblur?: Function;
|
|
21
|
+
onkeydown?: Function;
|
|
22
|
+
onkeyup?: Function;
|
|
23
|
+
onclick?: Function;
|
|
24
|
+
onmousedown?: Function;
|
|
25
|
+
onmouseup?: Function;
|
|
26
|
+
onmouseenter?: Function;
|
|
27
|
+
onmouseleave?: Function;
|
|
28
|
+
onmouseover?: Function;
|
|
29
|
+
onmouseout?: Function;
|
|
30
|
+
oncontextmenu?: Function;
|
|
31
|
+
onauxclick?: Function;
|
|
32
|
+
ontouchstart?: Function;
|
|
33
|
+
ontouchend?: Function;
|
|
34
|
+
ontouchmove?: Function;
|
|
35
|
+
ontouchcancel?: Function;
|
|
36
|
+
onpointerdown?: Function;
|
|
37
|
+
onpointerup?: Function;
|
|
38
|
+
onpointerenter?: Function;
|
|
39
|
+
onpointerleave?: Function;
|
|
40
|
+
onpointermove?: Function;
|
|
41
|
+
onpointercancel?: Function;
|
|
42
|
+
onchange?: (value: any) => void;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
declare const Select: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
46
|
+
type Select = ReturnType<typeof Select>;
|
|
47
|
+
export default Select;
|