@14ch/svelte-ui 0.0.38 → 0.0.39

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.
@@ -14,9 +14,8 @@
14
14
  // =========================================================================
15
15
  export type MultiSelectProps = {
16
16
  // 基本プロパティ
17
- name?: string;
18
- /** Selected values array. Supports `bind:values`. */
19
- values: OptionValue[];
17
+ /** Selected values array. Supports `bind:value`. */
18
+ value: OptionValue[];
20
19
  /** `{ label, value, disabled? }[]` */
21
20
  options: Option[];
22
21
 
@@ -49,8 +48,7 @@
49
48
  };
50
49
 
51
50
  let {
52
- name,
53
- values = $bindable([]),
51
+ value = $bindable([]),
54
52
  options = [],
55
53
 
56
54
  id = `multi-select-${Math.random().toString(36).substring(2, 15)}`,
@@ -85,19 +83,19 @@
85
83
  const listboxId = $derived(`${id}-listbox`);
86
84
 
87
85
  const selectedLabels = $derived(
88
- options.filter((o) => values.includes(o.value)).map((o) => o.label)
86
+ options.filter((o) => value.includes(o.value)).map((o) => o.label)
89
87
  );
90
88
 
91
89
  // =========================================================================
92
90
  // Methods
93
91
  // =========================================================================
94
92
  const toggleOption = (optionValue: OptionValue) => {
95
- if (values.includes(optionValue)) {
96
- values = values.filter((v) => v !== optionValue);
93
+ if (value.includes(optionValue)) {
94
+ value = value.filter((v) => v !== optionValue);
97
95
  } else {
98
- values = [...values, optionValue];
96
+ value = [...value, optionValue];
99
97
  }
100
- onchange(values);
98
+ onchange(value);
101
99
  };
102
100
 
103
101
  const handleTriggerClick = () => {
@@ -196,7 +194,7 @@
196
194
  {#each options as option, i (option.value)}
197
195
  <li role="presentation" class="multi-select__item">
198
196
  <Checkbox
199
- value={values.includes(option.value)}
197
+ value={value.includes(option.value)}
200
198
  disabled={option.disabled}
201
199
  fullWidth
202
200
  customStyle="padding: 8px 12px"
@@ -2,9 +2,8 @@ import type { Option, OptionValue } from '../types/options';
2
2
  import type { BivariantValueHandler, FocusHandler } from '../types/callbackHandlers';
3
3
  import type { PopupPosition } from '../types/propOptions';
4
4
  export type MultiSelectProps = {
5
- name?: string;
6
- /** Selected values array. Supports `bind:values`. */
7
- values: OptionValue[];
5
+ /** Selected values array. Supports `bind:value`. */
6
+ value: OptionValue[];
8
7
  /** `{ label, value, disabled? }[]` */
9
8
  options: Option[];
10
9
  id?: string | null;
@@ -25,6 +24,6 @@ export type MultiSelectProps = {
25
24
  onblur?: FocusHandler;
26
25
  onchange?: BivariantValueHandler<OptionValue[]>;
27
26
  };
28
- declare const MultiSelect: import("svelte").Component<MultiSelectProps, {}, "values">;
27
+ declare const MultiSelect: import("svelte").Component<MultiSelectProps, {}, "value">;
29
28
  type MultiSelect = ReturnType<typeof MultiSelect>;
30
29
  export default MultiSelect;
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.38",
5
+ "version": "0.0.39",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "svelte",