@14ch/svelte-ui 0.0.5 → 0.0.6

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.
@@ -72,7 +72,7 @@
72
72
  ...restProps
73
73
  }: {
74
74
  // 基本プロパティ
75
- value?: string;
75
+ value: string;
76
76
 
77
77
  // HTML属性系
78
78
  id?: string;
@@ -1,7 +1,7 @@
1
1
  import type { HTMLInputAttributes } from 'svelte/elements';
2
2
  import type { IconVariant } from '../types/icon';
3
3
  type $$ComponentProps = {
4
- value?: string;
4
+ value: string;
5
5
  id?: string;
6
6
  inputAttributes?: HTMLInputAttributes | undefined;
7
7
  customStyle?: string;
@@ -61,7 +61,7 @@
61
61
  onpointerleave = () => {} // No params for type inference
62
62
  }: {
63
63
  // 基本プロパティ
64
- value: FileList | undefined;
64
+ value: FileList | null | undefined;
65
65
  multiple?: boolean;
66
66
  maxFileSize?: number;
67
67
  placeholder?: string;
@@ -86,7 +86,7 @@
86
86
  removeFileAriaLabel?: string;
87
87
 
88
88
  // 入力イベント
89
- onchange?: (value: FileList | null) => void;
89
+ onchange?: (value: FileList | null | undefined) => void;
90
90
 
91
91
  // フォーカスイベント
92
92
  onfocus?: Function; // No params for type inference
@@ -187,7 +187,7 @@
187
187
  dt.items.add(value[i]);
188
188
  }
189
189
  }
190
- value = dt.files.length > 0 ? dt.files : undefined;
190
+ value = dt.files.length > 0 ? dt.files : null;
191
191
  };
192
192
 
193
193
  const validateFile = (file: File): boolean => {
@@ -240,7 +240,7 @@
240
240
  export const reset = () => {
241
241
  if (fileInputRef) {
242
242
  fileInputRef.value = '';
243
- value = undefined;
243
+ value = null;
244
244
  errorMessage = '';
245
245
  }
246
246
  };
@@ -1,6 +1,6 @@
1
1
  import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
2
2
  type $$ComponentProps = {
3
- value: FileList | undefined;
3
+ value: FileList | null | undefined;
4
4
  multiple?: boolean;
5
5
  maxFileSize?: number;
6
6
  placeholder?: string;
@@ -17,7 +17,7 @@ type $$ComponentProps = {
17
17
  iconOpticalSize?: IconOpticalSize;
18
18
  iconVariant?: IconVariant;
19
19
  removeFileAriaLabel?: string;
20
- onchange?: (value: FileList | null) => void;
20
+ onchange?: (value: FileList | null | undefined) => void;
21
21
  onfocus?: Function;
22
22
  onblur?: Function;
23
23
  onkeydown?: Function;
@@ -66,7 +66,7 @@
66
66
  onpointerleave = () => {} // No params for type inference
67
67
  }: {
68
68
  // 基本プロパティ
69
- value: FileList | undefined;
69
+ value: FileList | null | undefined;
70
70
  multiple?: boolean;
71
71
  maxFileSize?: number;
72
72
  placeholder?: string;
@@ -93,7 +93,7 @@
93
93
  removeFileAriaLabel?: string;
94
94
 
95
95
  // 入力イベント
96
- onchange?: (value: FileList | null) => void;
96
+ onchange?: (value: FileList | null | undefined) => void;
97
97
 
98
98
  // フォーカスイベント
99
99
  onfocus?: Function; // No params for type inference
@@ -295,7 +295,7 @@
295
295
  export const reset = () => {
296
296
  if (fileInputRef) {
297
297
  fileInputRef.value = '';
298
- value = undefined;
298
+ value = null;
299
299
  errorMessage = '';
300
300
  cleanupObjectUrls();
301
301
  }
@@ -1,6 +1,6 @@
1
1
  import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
2
2
  type $$ComponentProps = {
3
- value: FileList | undefined;
3
+ value: FileList | null | undefined;
4
4
  multiple?: boolean;
5
5
  maxFileSize?: number;
6
6
  placeholder?: string;
@@ -19,7 +19,7 @@ type $$ComponentProps = {
19
19
  iconOpticalSize?: IconOpticalSize;
20
20
  iconVariant?: IconVariant;
21
21
  removeFileAriaLabel?: string;
22
- onchange?: (value: FileList | null) => void;
22
+ onchange?: (value: FileList | null | undefined) => void;
23
23
  onfocus?: Function;
24
24
  onblur?: Function;
25
25
  onkeydown?: Function;
@@ -28,6 +28,7 @@
28
28
  step = null,
29
29
  size = null,
30
30
  autocomplete = null,
31
+ spellcheck = null,
31
32
  inputAttributes,
32
33
 
33
34
  // スタイル/レイアウト
@@ -109,7 +110,7 @@
109
110
  }: {
110
111
  // 基本プロパティ
111
112
  name?: string;
112
- value: string | number | undefined;
113
+ value: string | number;
113
114
 
114
115
  // HTML属性系
115
116
  id?: string | null;
@@ -122,6 +123,7 @@
122
123
  step?: number | null;
123
124
  size?: number | null;
124
125
  autocomplete?: HTMLInputElement['autocomplete'] | null;
126
+ spellcheck?: boolean | null;
125
127
  inputAttributes?: HTMLInputAttributes | undefined;
126
128
 
127
129
  // スタイル/レイアウト
@@ -212,8 +214,8 @@
212
214
  const clear = (): void => {
213
215
  if (disabled || readonly) return;
214
216
  ref?.focus();
215
- onchange?.(undefined);
216
- value = undefined;
217
+ value = '';
218
+ onchange?.('');
217
219
  };
218
220
 
219
221
  export const focus = () => {
@@ -368,7 +370,6 @@
368
370
  // $derived
369
371
  // =========================================================================
370
372
  const getDisplayValue = (): string => {
371
- if (value === undefined) return '';
372
373
  if (type === 'number' && typeof value === 'number') {
373
374
  return value.toLocaleString();
374
375
  }
@@ -425,6 +426,7 @@
425
426
  {required}
426
427
  {tabindex}
427
428
  {size}
429
+ {spellcheck}
428
430
  onchange={handleChange}
429
431
  oninput={handleInput}
430
432
  onfocus={handleFocus}
@@ -2,7 +2,7 @@ import type { HTMLInputAttributes } from 'svelte/elements';
2
2
  import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
3
3
  type $$ComponentProps = {
4
4
  name?: string;
5
- value: string | number | undefined;
5
+ value: string | number;
6
6
  id?: string | null;
7
7
  type?: 'text' | 'password' | 'email' | 'tel' | 'url' | 'number';
8
8
  tabindex?: number | null;
@@ -13,6 +13,7 @@ type $$ComponentProps = {
13
13
  step?: number | null;
14
14
  size?: number | null;
15
15
  autocomplete?: HTMLInputElement['autocomplete'] | null;
16
+ spellcheck?: boolean | null;
16
17
  inputAttributes?: HTMLInputAttributes | undefined;
17
18
  inline?: boolean;
18
19
  focusStyle?: 'background' | 'outline' | 'none';
@@ -71,7 +71,7 @@
71
71
  ...restProps
72
72
  }: {
73
73
  // 基本プロパティ
74
- value?: number;
74
+ value: number;
75
75
  name?: string;
76
76
  id?: string;
77
77
 
@@ -1,6 +1,6 @@
1
1
  import type { HTMLInputAttributes } from 'svelte/elements';
2
2
  type $$ComponentProps = {
3
- value?: number;
3
+ value: number;
4
4
  name?: string;
5
5
  id?: string;
6
6
  min?: number;
@@ -71,7 +71,7 @@
71
71
  children?: Snippet;
72
72
 
73
73
  // 基本プロパティ
74
- value?: boolean;
74
+ value: boolean;
75
75
 
76
76
  // HTML属性系
77
77
  id?: string;
@@ -2,7 +2,7 @@ import type { Snippet } from 'svelte';
2
2
  import type { HTMLInputAttributes } from 'svelte/elements';
3
3
  type $$ComponentProps = {
4
4
  children?: Snippet;
5
- value?: boolean;
5
+ value: boolean;
6
6
  id?: string;
7
7
  inputAttributes?: HTMLInputAttributes | undefined;
8
8
  size?: 'small' | 'medium' | 'large';
@@ -91,7 +91,7 @@
91
91
  }: {
92
92
  // 基本プロパティ
93
93
  name?: string;
94
- value: string | undefined;
94
+ value: string;
95
95
  placeholder?: string;
96
96
 
97
97
  // HTML属性系
@@ -177,9 +177,9 @@
177
177
 
178
178
  const clear = (): void => {
179
179
  if (disabled || readonly) return;
180
- value = undefined;
180
+ value = '';
181
181
  ref?.focus();
182
- onchange?.(value);
182
+ onchange?.('');
183
183
  };
184
184
 
185
185
  // 外部からフォーカスを当てる(キャレットを先頭に移動)
@@ -334,7 +334,7 @@
334
334
 
335
335
  // HTML表示用の値(autoResize時の高さ調整用)
336
336
  const htmlValue = $derived.by(() => {
337
- if (typeof value === 'string' && value !== '') {
337
+ if (value !== '') {
338
338
  let html = value
339
339
  .replace(/ +/g, (match) => ' '.repeat(match.length))
340
340
  .replace(/\n/g, '<br />');
@@ -345,7 +345,7 @@
345
345
  }
346
346
  return html;
347
347
  } else {
348
- return value ?? '';
348
+ return '';
349
349
  }
350
350
  });
351
351
  </script>
@@ -2,7 +2,7 @@ import type { HTMLTextareaAttributes } from 'svelte/elements';
2
2
  import type { IconVariant } from '../types/icon';
3
3
  type $$ComponentProps = {
4
4
  name?: string;
5
- value: string | undefined;
5
+ value: string;
6
6
  placeholder?: string;
7
7
  id?: string | null;
8
8
  tabindex?: number | null;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@14ch/svelte-ui",
3
3
  "description": "Modern Svelte UI components library with TypeScript support",
4
4
  "private": false,
5
- "version": "0.0.5",
5
+ "version": "0.0.6",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "svelte",