@14ch/svelte-ui 0.0.4 → 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.
package/README.md CHANGED
@@ -346,6 +346,12 @@ MIT License - see the [LICENSE](LICENSE) file for details.
346
346
 
347
347
  ## Changelog
348
348
 
349
+ ### v0.0.5
350
+
351
+ - Improved TabItem hover behavior: replaced background color with indicator bar opacity change
352
+ - TabItem now shows selected text color and indicator bar on hover for better visual feedback
353
+ - Breaking change: Replaced `variant` prop with `inline` prop in Combobox, Datepicker, and Select components
354
+
349
355
  ### v0.0.3
350
356
 
351
357
  - Improved text vertical alignment in Button, Fab, TabItem, Checkbox, and Radio components using `text-box-trim`
@@ -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;
@@ -24,11 +24,11 @@
24
24
 
25
25
  // スタイル/レイアウト
26
26
  customStyle = '',
27
- variant = 'default',
27
+ inline = false,
28
28
  focusStyle = 'outline',
29
29
  placeholder = '選択してください',
30
30
  fullWidth = false,
31
- minWidth = variant === 'inline' ? null : 120,
31
+ minWidth = inline ? null : 120,
32
32
  maxWidth = null,
33
33
  rounded = false,
34
34
 
@@ -92,7 +92,7 @@
92
92
 
93
93
  // スタイル/レイアウト
94
94
  customStyle?: string;
95
- variant?: 'default' | 'inline';
95
+ inline?: boolean;
96
96
  focusStyle?: 'background' | 'outline' | 'none';
97
97
  placeholder?: string;
98
98
  fullWidth?: boolean;
@@ -412,7 +412,7 @@
412
412
  {name}
413
413
  id={inputId}
414
414
  {customStyle}
415
- {variant}
415
+ {inline}
416
416
  {focusStyle}
417
417
  {placeholder}
418
418
  {fullWidth}
@@ -420,7 +420,7 @@
420
420
  {readonly}
421
421
  {required}
422
422
  {clearable}
423
- rightIcon={variant !== 'inline' ? 'arrow_drop_down' : undefined}
423
+ rightIcon={inline ? undefined : 'arrow_drop_down'}
424
424
  {tabindex}
425
425
  {maxlength}
426
426
  {rounded}
@@ -8,7 +8,7 @@ type $$ComponentProps = {
8
8
  tabindex?: number | null;
9
9
  maxlength?: number | null;
10
10
  customStyle?: string;
11
- variant?: 'default' | 'inline';
11
+ inline?: boolean;
12
12
  focusStyle?: 'background' | 'outline' | 'none';
13
13
  placeholder?: string;
14
14
  fullWidth?: boolean;
@@ -36,7 +36,7 @@
36
36
  inputAttributes,
37
37
 
38
38
  // スタイル/レイアウト
39
- variant = 'default',
39
+ inline = false,
40
40
  focusStyle = 'outline',
41
41
  fullWidth = false,
42
42
  rounded = false,
@@ -109,7 +109,7 @@
109
109
  inputAttributes?: HTMLInputAttributes | undefined;
110
110
 
111
111
  // スタイル/レイアウト
112
- variant?: 'default' | 'inline';
112
+ inline?: boolean;
113
113
  focusStyle?: 'background' | 'outline' | 'none';
114
114
  fullWidth?: boolean;
115
115
  rounded?: boolean;
@@ -502,7 +502,7 @@
502
502
  <Input
503
503
  bind:this={inputRef}
504
504
  value={displayValue}
505
- {variant}
505
+ {inline}
506
506
  {focusStyle}
507
507
  {fullWidth}
508
508
  {rounded}
@@ -17,7 +17,7 @@ type $$ComponentProps = {
17
17
  rangeSeparator?: string;
18
18
  id?: string;
19
19
  inputAttributes?: HTMLInputAttributes | undefined;
20
- variant?: 'default' | 'inline';
20
+ inline?: boolean;
21
21
  focusStyle?: 'background' | 'outline' | 'none';
22
22
  fullWidth?: boolean;
23
23
  rounded?: boolean;
@@ -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';
@@ -22,7 +22,7 @@
22
22
 
23
23
  // スタイル/レイアウト
24
24
  size = null,
25
- variant = 'default',
25
+ inline = false,
26
26
  focusStyle = 'outline',
27
27
  fullWidth = false,
28
28
  rounded = false,
@@ -84,7 +84,7 @@
84
84
 
85
85
  // スタイル/レイアウト
86
86
  size?: number | null;
87
- variant?: 'default' | 'inline';
87
+ inline?: boolean;
88
88
  focusStyle?: 'background' | 'outline' | 'none';
89
89
  fullWidth?: boolean;
90
90
  rounded?: boolean;
@@ -275,7 +275,7 @@
275
275
  <div
276
276
  class="select
277
277
  select--focus-{focusStyle}"
278
- class:select--inline={variant === 'inline'}
278
+ class:select--inline={inline}
279
279
  class:select--full-width={fullWidth}
280
280
  class:select--disabled={disabled}
281
281
  class:select--focused={isFocused}
@@ -9,7 +9,7 @@ type $$ComponentProps = {
9
9
  placeholder?: string;
10
10
  selectAttributes?: HTMLSelectAttributes | undefined;
11
11
  size?: number | null;
12
- variant?: 'default' | 'inline';
12
+ inline?: boolean;
13
13
  focusStyle?: 'background' | 'outline' | 'none';
14
14
  fullWidth?: boolean;
15
15
  rounded?: boolean;
@@ -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';
@@ -94,7 +94,10 @@
94
94
 
95
95
  @media (hover: hover) {
96
96
  .tab-item:hover:not(.tab-item--selected) {
97
- background-color: var(--svelte-ui-hover-overlay);
97
+ color: var(--svelte-ui-tab-item-selected-text-color);
98
+ }
99
+ .tab-item:hover:not(.tab-item--selected)::before {
100
+ opacity: 1;
98
101
  }
99
102
  }
100
103
  /* キーボードフォーカス時のみ枠線を表示 */
@@ -110,7 +113,10 @@
110
113
  outline-offset: var(--svelte-ui-focus-outline-offset-inner);
111
114
  }
112
115
  .tab-item:focus:not(.tab-item--selected) {
113
- background-color: var(--svelte-ui-hover-overlay);
116
+ color: var(--svelte-ui-tab-item-selected-text-color);
117
+ }
118
+ .tab-item:focus:not(.tab-item--selected)::before {
119
+ opacity: 1;
114
120
  }
115
121
  }
116
122
  /* 選択状態のインジケーター */
@@ -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) => '&nbsp;'.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.4",
5
+ "version": "0.0.6",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "svelte",