runeforge 0.0.55 → 0.0.56

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.
Files changed (54) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1342 -1342
  3. package/dist/components/Avatar.svelte +31 -31
  4. package/dist/components/IconRenderer.svelte +22 -22
  5. package/dist/components/Modal.svelte +75 -75
  6. package/dist/components/common/Header.svelte +40 -40
  7. package/dist/components/crud/EmbeddedField.svelte +175 -175
  8. package/dist/components/crud/Field.svelte +469 -376
  9. package/dist/components/crud/GenericCRUD.svelte +426 -426
  10. package/dist/components/crud/SearchInput.svelte +53 -53
  11. package/dist/components/crud/columns/Avatar.svelte +15 -15
  12. package/dist/components/crud/columns/Icon.svelte +8 -8
  13. package/dist/components/crud/views/Create.svelte +232 -232
  14. package/dist/components/crud/views/Read.svelte +124 -124
  15. package/dist/components/crud/views/Update.svelte +208 -208
  16. package/dist/components/crud/views/list/List.svelte +291 -291
  17. package/dist/components/crud/views/list/Modals.svelte +56 -56
  18. package/dist/components/crud/views/list/Table.svelte +176 -176
  19. package/dist/components/crud/views/list/Toolbar.svelte +341 -341
  20. package/dist/components/form/Button.svelte +27 -27
  21. package/dist/components/form/Label.svelte +37 -37
  22. package/dist/components/form/MultiSelect.svelte +248 -248
  23. package/dist/components/form/PasswordInput.svelte +68 -68
  24. package/dist/components/form/Required.svelte +1 -1
  25. package/dist/components/form/Select.svelte +209 -209
  26. package/dist/components/form/Tree.svelte +62 -62
  27. package/dist/components/form/TreeNode.svelte +66 -66
  28. package/dist/components/navigation/Breadcrumbs.svelte +111 -111
  29. package/dist/components/table/ColumnFilter.svelte +168 -168
  30. package/dist/components/table/PaginatedTable.svelte +536 -536
  31. package/dist/components/table/Paginator.svelte +113 -113
  32. package/dist/components/table/SortHeader.svelte +43 -43
  33. package/dist/components/table/TableBody.svelte +150 -150
  34. package/dist/components/table/TableHeader.svelte +88 -88
  35. package/dist/i18n/en.js +1 -0
  36. package/dist/i18n/es.js +1 -0
  37. package/dist/i18n/types.d.ts +1 -0
  38. package/dist/icons/defaults/Clear.svelte +6 -6
  39. package/dist/icons/defaults/Create.svelte +6 -6
  40. package/dist/icons/defaults/Delete.svelte +6 -6
  41. package/dist/icons/defaults/Download.svelte +7 -7
  42. package/dist/icons/defaults/Edit.svelte +7 -7
  43. package/dist/icons/defaults/Filter.svelte +6 -6
  44. package/dist/icons/defaults/FilterActive.svelte +6 -6
  45. package/dist/icons/defaults/Folder.svelte +6 -6
  46. package/dist/icons/defaults/Grip.svelte +7 -7
  47. package/dist/icons/defaults/Home.svelte +6 -6
  48. package/dist/icons/defaults/PasswordHide.svelte +9 -9
  49. package/dist/icons/defaults/PasswordShow.svelte +7 -7
  50. package/dist/icons/defaults/SortAsc.svelte +6 -6
  51. package/dist/icons/defaults/SortDesc.svelte +6 -6
  52. package/dist/icons/defaults/SortNone.svelte +6 -6
  53. package/dist/icons/defaults/View.svelte +7 -7
  54. package/package.json +1 -1
@@ -1,27 +1,27 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import type { HTMLButtonAttributes } from 'svelte/elements';
4
-
5
- let {
6
- type = 'button',
7
- disabled = false,
8
- btn = true,
9
- variant,
10
- class: additionalClass,
11
- children,
12
- ...rest
13
- }: {
14
- btn?: boolean;
15
- variant?: string;
16
- children?: Snippet;
17
- } & HTMLButtonAttributes = $props();
18
- </script>
19
-
20
- <button
21
- {type}
22
- class={[btn && 'btn', variant && `btn-${variant}`, additionalClass]}
23
- {disabled}
24
- {...rest}
25
- >
26
- {#if children}{@render children()}{/if}
27
- </button>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLButtonAttributes } from 'svelte/elements';
4
+
5
+ let {
6
+ type = 'button',
7
+ disabled = false,
8
+ btn = true,
9
+ variant,
10
+ class: additionalClass,
11
+ children,
12
+ ...rest
13
+ }: {
14
+ btn?: boolean;
15
+ variant?: string;
16
+ children?: Snippet;
17
+ } & HTMLButtonAttributes = $props();
18
+ </script>
19
+
20
+ <button
21
+ {type}
22
+ class={[btn && 'btn', variant && `btn-${variant}`, additionalClass]}
23
+ {disabled}
24
+ {...rest}
25
+ >
26
+ {#if children}{@render children()}{/if}
27
+ </button>
@@ -1,37 +1,37 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import type { ClassValue } from 'svelte/elements';
4
- import Required from './Required.svelte';
5
-
6
- let {
7
- text,
8
- for: labelFor,
9
- capitalize = false,
10
- required = false,
11
- ariaLabel,
12
- class: additionalClass,
13
- children,
14
- }: {
15
- text?: string;
16
- for?: string;
17
- capitalize?: boolean;
18
- required?: boolean;
19
- ariaLabel?: string;
20
- class?: ClassValue;
21
- children?: Snippet;
22
- } = $props();
23
-
24
- const derivedAriaLabel = $derived(ariaLabel ?? text);
25
- const labelClasses = 'text-sm font-medium text-base-content/60';
26
- const derivedClasses = $derived(additionalClass ?? labelClasses);
27
- </script>
28
-
29
- <label
30
- class={[derivedClasses, capitalize && 'capitalize']}
31
- for={labelFor}
32
- aria-label={derivedAriaLabel}
33
- >
34
- {#if text}{text}{/if}
35
- {#if required}<Required />{/if}
36
- {#if children}{@render children()}{/if}
37
- </label>
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
4
+ import Required from './Required.svelte';
5
+
6
+ let {
7
+ text,
8
+ for: labelFor,
9
+ capitalize = false,
10
+ required = false,
11
+ ariaLabel,
12
+ class: additionalClass,
13
+ children,
14
+ }: {
15
+ text?: string;
16
+ for?: string;
17
+ capitalize?: boolean;
18
+ required?: boolean;
19
+ ariaLabel?: string;
20
+ class?: ClassValue;
21
+ children?: Snippet;
22
+ } = $props();
23
+
24
+ const derivedAriaLabel = $derived(ariaLabel ?? text);
25
+ const labelClasses = 'text-sm font-medium text-base-content/60';
26
+ const derivedClasses = $derived(additionalClass ?? labelClasses);
27
+ </script>
28
+
29
+ <label
30
+ class={[derivedClasses, capitalize && 'capitalize']}
31
+ for={labelFor}
32
+ aria-label={derivedAriaLabel}
33
+ >
34
+ {#if text}{text}{/if}
35
+ {#if required}<Required />{/if}
36
+ {#if children}{@render children()}{/if}
37
+ </label>
@@ -1,248 +1,248 @@
1
- <script lang="ts">
2
- import { SvelteMap } from 'svelte/reactivity';
3
- import { getStrings } from '../../i18n/context.js';
4
- import { getIconSet } from '../../icons/context.js';
5
- import { defaultIconSet } from '../../icons/sets/default.js';
6
- import Button from './Button.svelte';
7
- import type { SearchResolver, SelectOption } from '../../types/attribute.js';
8
-
9
- const strings = getStrings();
10
- const icons = $derived(getIconSet() ?? defaultIconSet);
11
-
12
- let {
13
- name,
14
- id,
15
- value = $bindable([]),
16
- options = [],
17
- search: searchFn,
18
- searchDebounceMs = 300,
19
- placeholder = strings.selectPlaceholder,
20
- error = '',
21
- disabled = false,
22
- // When passed, the dropdown's top row selects every option instead of
23
- // clearing the selection (labelled `strings.selectAll` instead of
24
- // `placeholder`) — clearing moves to the trigger's own × button instead.
25
- // Left unset, existing callers keep today's behavior unchanged: top row
26
- // clears, no × button.
27
- onSelectAll
28
- }: {
29
- name?: string;
30
- id?: string;
31
- value?: string[];
32
- options?: SelectOption[];
33
- search?: SearchResolver;
34
- searchDebounceMs?: number;
35
- placeholder?: string;
36
- error?: string;
37
- disabled?: boolean;
38
- onSelectAll?: () => void;
39
- } = $props();
40
-
41
- const popId = $props.id();
42
- const anchorName = `--multiselect-anchor-${popId}`;
43
-
44
- let query = $state('');
45
- let open = $state(false);
46
- let containerEl: HTMLElement | undefined = $state();
47
- let popoverEl: HTMLElement | undefined = $state();
48
- let inputEl: HTMLInputElement | undefined = $state();
49
-
50
- let remoteResults = $state<SelectOption[] | null>(null);
51
- let searching = $state(false);
52
- const pickedLabels = new SvelteMap<string, string>();
53
-
54
- let searchToken = 0;
55
- $effect(() => {
56
- if (!searchFn) return;
57
- const q = query.trim();
58
- if (!q) {
59
- remoteResults = null;
60
- searching = false;
61
- return;
62
- }
63
- const token = ++searchToken;
64
- searching = true;
65
- const timer = setTimeout(() => {
66
- searchFn(q).then((results) => {
67
- if (token !== searchToken) return; // stale response, a newer query took over
68
- remoteResults = results;
69
- searching = false;
70
- });
71
- }, searchDebounceMs);
72
- return () => clearTimeout(timer);
73
- });
74
-
75
- const filtered = $derived(
76
- searchFn
77
- ? (remoteResults ?? options)
78
- : query.trim()
79
- ? options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase()))
80
- : options
81
- );
82
-
83
- const selectedLabels = $derived(
84
- value.map((v) => options.find((o) => o.value === v)?.label ?? pickedLabels.get(v) ?? v)
85
- );
86
- const buttonLabel = $derived(
87
- value.length === 0 ? placeholder : strings.selectedCount(value.length)
88
- );
89
-
90
- function toggle(option: SelectOption) {
91
- if (value.includes(option.value)) {
92
- value = value.filter((v) => v !== option.value);
93
- } else {
94
- value = [...value, option.value];
95
- pickedLabels.set(option.value, option.label);
96
- }
97
- }
98
-
99
- function openPopover() {
100
- open = true;
101
- query = '';
102
- popoverEl?.showPopover();
103
- }
104
-
105
- function clear() {
106
- value = [];
107
- pickedLabels.clear();
108
- query = '';
109
- }
110
-
111
- function onToggle(e: Event) {
112
- if ((e as ToggleEvent).newState === 'closed') {
113
- open = false;
114
- query = '';
115
- }
116
- }
117
-
118
- // Escape can be pressed while an option button has focus (not just the
119
- // text input), so this is wired at the container level rather than on
120
- // the input alone — otherwise picking an option and then hitting Escape
121
- // would leave the popover open with nothing listening for the key.
122
- function onKeydown(e: KeyboardEvent) {
123
- if (e.key === 'Enter' && e.target === inputEl) {
124
- // The trigger used to be a plain button, so Enter never submitted the
125
- // surrounding form. Now that it's a text input, guard against that.
126
- e.preventDefault();
127
- } else if (e.key === 'Escape') {
128
- // Also suppress the browser's native "revert to last value" behavior
129
- // for text inputs on Escape, which would otherwise race our own
130
- // close-and-restore-label update and blank the field.
131
- e.preventDefault();
132
- popoverEl?.hidePopover();
133
- }
134
- }
135
-
136
- const hasSelection = $derived(value.length > 0);
137
-
138
- function clearFromTrigger(e: MouseEvent) {
139
- // Stop the click from also reaching the input underneath (they're
140
- // overlapping siblings, not nested) so clearing doesn't focus/open the
141
- // dropdown at the same time.
142
- e.preventDefault();
143
- e.stopPropagation();
144
- clear();
145
- }
146
-
147
- // The trigger is a text input now, not a button, so it can't rely on the
148
- // native `popovertarget` invoker exclusion to survive its own opening
149
- // click (that relationship only applies to button-like elements — for a
150
- // text input, the click that focuses it and opens the popover would
151
- // immediately light-dismiss it again). `popover="manual"` opts out of
152
- // that dismiss behavior entirely; this handler reimplements "close when
153
- // focus leaves the widget" instead.
154
- function onFocusOut(e: FocusEvent) {
155
- const next = e.relatedTarget as Node | null;
156
- if (!next || !containerEl?.contains(next)) {
157
- popoverEl?.hidePopover();
158
- }
159
- }
160
- </script>
161
-
162
- <!--
163
- The keydown/focusout handlers here are event delegation for the input and
164
- popover option buttons below, not interaction with this div itself — every
165
- actually-interactive element inside already has correct native semantics.
166
- -->
167
- <!-- svelte-ignore a11y_no_static_element_interactions -->
168
- <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
169
- <div class="relative w-full" bind:this={containerEl} onfocusout={onFocusOut} onkeydown={onKeydown}>
170
- {#if name}
171
- <input type="hidden" {name} value={JSON.stringify(value)} />
172
- {/if}
173
-
174
- <div class="relative">
175
- <input
176
- bind:this={inputEl}
177
- {id}
178
- type="text"
179
- class="input input-bordered w-full font-normal"
180
- class:input-error={!!error}
181
- class:opacity-40={value.length === 0 && !open}
182
- class:pr-8={hasSelection}
183
- {disabled}
184
- {placeholder}
185
- value={open ? query : buttonLabel}
186
- oninput={(e) => (query = e.currentTarget.value)}
187
- onfocus={openPopover}
188
- style="anchor-name:{anchorName}"
189
- title={selectedLabels.join(', ')}
190
- autocomplete="off"
191
- />
192
-
193
- {#if hasSelection && !disabled}
194
- {@const Icon = icons.clear}
195
- <Button
196
- variant="ghost"
197
- class="btn-xs btn-square btn-circle absolute top-1/2 right-6 -translate-y-1/2"
198
- aria-label={strings.selectClear}
199
- title={strings.selectClear}
200
- onclick={clearFromTrigger}
201
- >
202
- <Icon class="size-3" />
203
- </Button>
204
- {/if}
205
- </div>
206
-
207
- <div
208
- popover="manual"
209
- id={popId}
210
- bind:this={popoverEl}
211
- style="position-anchor:{anchorName}; width:anchor-size(width); position-try-fallbacks:flip-block;"
212
- class="dropdown mt-1 rounded-box border border-base-content/10 bg-base-100 shadow-lg"
213
- ontoggle={onToggle}
214
- >
215
- <ul class="max-h-48 overflow-y-auto p-1">
216
- <li>
217
- <button
218
- type="button"
219
- class="w-full rounded-btn px-3 py-2 text-left text-sm text-base-content/40 hover:bg-base-200"
220
- onclick={onSelectAll ?? clear}
221
- >
222
- {onSelectAll ? strings.selectAll : placeholder}
223
- </button>
224
- </li>
225
- {#if searching}
226
- <li class="px-3 py-2 text-sm text-base-content/40">{strings.selectSearching}</li>
227
- {/if}
228
- {#each filtered as option (option.value)}
229
- {@const checked = value.includes(option.value)}
230
- <li>
231
- <button
232
- type="button"
233
- class="flex w-full items-center gap-2 rounded-btn px-3 py-2 text-left text-sm hover:bg-base-200"
234
- class:bg-primary={checked}
235
- class:text-primary-content={checked}
236
- onclick={() => toggle(option)}
237
- >
238
- <input type="checkbox" class="checkbox checkbox-sm" {checked} tabindex="-1" readonly />
239
- {option.label}
240
- </button>
241
- </li>
242
- {/each}
243
- {#if !searching && filtered.length === 0}
244
- <li class="px-3 py-2 text-sm text-base-content/40">{strings.selectNoResults}</li>
245
- {/if}
246
- </ul>
247
- </div>
248
- </div>
1
+ <script lang="ts">
2
+ import { SvelteMap } from 'svelte/reactivity';
3
+ import { getStrings } from '../../i18n/context.js';
4
+ import { getIconSet } from '../../icons/context.js';
5
+ import { defaultIconSet } from '../../icons/sets/default.js';
6
+ import Button from './Button.svelte';
7
+ import type { SearchResolver, SelectOption } from '../../types/attribute.js';
8
+
9
+ const strings = getStrings();
10
+ const icons = $derived(getIconSet() ?? defaultIconSet);
11
+
12
+ let {
13
+ name,
14
+ id,
15
+ value = $bindable([]),
16
+ options = [],
17
+ search: searchFn,
18
+ searchDebounceMs = 300,
19
+ placeholder = strings.selectPlaceholder,
20
+ error = '',
21
+ disabled = false,
22
+ // When passed, the dropdown's top row selects every option instead of
23
+ // clearing the selection (labelled `strings.selectAll` instead of
24
+ // `placeholder`) — clearing moves to the trigger's own × button instead.
25
+ // Left unset, existing callers keep today's behavior unchanged: top row
26
+ // clears, no × button.
27
+ onSelectAll
28
+ }: {
29
+ name?: string;
30
+ id?: string;
31
+ value?: string[];
32
+ options?: SelectOption[];
33
+ search?: SearchResolver;
34
+ searchDebounceMs?: number;
35
+ placeholder?: string;
36
+ error?: string;
37
+ disabled?: boolean;
38
+ onSelectAll?: () => void;
39
+ } = $props();
40
+
41
+ const popId = $props.id();
42
+ const anchorName = `--multiselect-anchor-${popId}`;
43
+
44
+ let query = $state('');
45
+ let open = $state(false);
46
+ let containerEl: HTMLElement | undefined = $state();
47
+ let popoverEl: HTMLElement | undefined = $state();
48
+ let inputEl: HTMLInputElement | undefined = $state();
49
+
50
+ let remoteResults = $state<SelectOption[] | null>(null);
51
+ let searching = $state(false);
52
+ const pickedLabels = new SvelteMap<string, string>();
53
+
54
+ let searchToken = 0;
55
+ $effect(() => {
56
+ if (!searchFn) return;
57
+ const q = query.trim();
58
+ if (!q) {
59
+ remoteResults = null;
60
+ searching = false;
61
+ return;
62
+ }
63
+ const token = ++searchToken;
64
+ searching = true;
65
+ const timer = setTimeout(() => {
66
+ searchFn(q).then((results) => {
67
+ if (token !== searchToken) return; // stale response, a newer query took over
68
+ remoteResults = results;
69
+ searching = false;
70
+ });
71
+ }, searchDebounceMs);
72
+ return () => clearTimeout(timer);
73
+ });
74
+
75
+ const filtered = $derived(
76
+ searchFn
77
+ ? (remoteResults ?? options)
78
+ : query.trim()
79
+ ? options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase()))
80
+ : options
81
+ );
82
+
83
+ const selectedLabels = $derived(
84
+ value.map((v) => options.find((o) => o.value === v)?.label ?? pickedLabels.get(v) ?? v)
85
+ );
86
+ const buttonLabel = $derived(
87
+ value.length === 0 ? placeholder : strings.selectedCount(value.length)
88
+ );
89
+
90
+ function toggle(option: SelectOption) {
91
+ if (value.includes(option.value)) {
92
+ value = value.filter((v) => v !== option.value);
93
+ } else {
94
+ value = [...value, option.value];
95
+ pickedLabels.set(option.value, option.label);
96
+ }
97
+ }
98
+
99
+ function openPopover() {
100
+ open = true;
101
+ query = '';
102
+ popoverEl?.showPopover();
103
+ }
104
+
105
+ function clear() {
106
+ value = [];
107
+ pickedLabels.clear();
108
+ query = '';
109
+ }
110
+
111
+ function onToggle(e: Event) {
112
+ if ((e as ToggleEvent).newState === 'closed') {
113
+ open = false;
114
+ query = '';
115
+ }
116
+ }
117
+
118
+ // Escape can be pressed while an option button has focus (not just the
119
+ // text input), so this is wired at the container level rather than on
120
+ // the input alone — otherwise picking an option and then hitting Escape
121
+ // would leave the popover open with nothing listening for the key.
122
+ function onKeydown(e: KeyboardEvent) {
123
+ if (e.key === 'Enter' && e.target === inputEl) {
124
+ // The trigger used to be a plain button, so Enter never submitted the
125
+ // surrounding form. Now that it's a text input, guard against that.
126
+ e.preventDefault();
127
+ } else if (e.key === 'Escape') {
128
+ // Also suppress the browser's native "revert to last value" behavior
129
+ // for text inputs on Escape, which would otherwise race our own
130
+ // close-and-restore-label update and blank the field.
131
+ e.preventDefault();
132
+ popoverEl?.hidePopover();
133
+ }
134
+ }
135
+
136
+ const hasSelection = $derived(value.length > 0);
137
+
138
+ function clearFromTrigger(e: MouseEvent) {
139
+ // Stop the click from also reaching the input underneath (they're
140
+ // overlapping siblings, not nested) so clearing doesn't focus/open the
141
+ // dropdown at the same time.
142
+ e.preventDefault();
143
+ e.stopPropagation();
144
+ clear();
145
+ }
146
+
147
+ // The trigger is a text input now, not a button, so it can't rely on the
148
+ // native `popovertarget` invoker exclusion to survive its own opening
149
+ // click (that relationship only applies to button-like elements — for a
150
+ // text input, the click that focuses it and opens the popover would
151
+ // immediately light-dismiss it again). `popover="manual"` opts out of
152
+ // that dismiss behavior entirely; this handler reimplements "close when
153
+ // focus leaves the widget" instead.
154
+ function onFocusOut(e: FocusEvent) {
155
+ const next = e.relatedTarget as Node | null;
156
+ if (!next || !containerEl?.contains(next)) {
157
+ popoverEl?.hidePopover();
158
+ }
159
+ }
160
+ </script>
161
+
162
+ <!--
163
+ The keydown/focusout handlers here are event delegation for the input and
164
+ popover option buttons below, not interaction with this div itself — every
165
+ actually-interactive element inside already has correct native semantics.
166
+ -->
167
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
168
+ <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
169
+ <div class="relative w-full" bind:this={containerEl} onfocusout={onFocusOut} onkeydown={onKeydown}>
170
+ {#if name}
171
+ <input type="hidden" {name} value={JSON.stringify(value)} />
172
+ {/if}
173
+
174
+ <div class="relative">
175
+ <input
176
+ bind:this={inputEl}
177
+ {id}
178
+ type="text"
179
+ class="input input-bordered w-full font-normal"
180
+ class:input-error={!!error}
181
+ class:opacity-40={value.length === 0 && !open}
182
+ class:pr-8={hasSelection}
183
+ {disabled}
184
+ {placeholder}
185
+ value={open ? query : buttonLabel}
186
+ oninput={(e) => (query = e.currentTarget.value)}
187
+ onfocus={openPopover}
188
+ style="anchor-name:{anchorName}"
189
+ title={selectedLabels.join(', ')}
190
+ autocomplete="off"
191
+ />
192
+
193
+ {#if hasSelection && !disabled}
194
+ {@const Icon = icons.clear}
195
+ <Button
196
+ variant="ghost"
197
+ class="btn-xs btn-square btn-circle absolute top-1/2 right-6 -translate-y-1/2"
198
+ aria-label={strings.selectClear}
199
+ title={strings.selectClear}
200
+ onclick={clearFromTrigger}
201
+ >
202
+ <Icon class="size-3" />
203
+ </Button>
204
+ {/if}
205
+ </div>
206
+
207
+ <div
208
+ popover="manual"
209
+ id={popId}
210
+ bind:this={popoverEl}
211
+ style="position-anchor:{anchorName}; width:anchor-size(width); position-try-fallbacks:flip-block;"
212
+ class="dropdown mt-1 rounded-box border border-base-content/10 bg-base-100 shadow-lg"
213
+ ontoggle={onToggle}
214
+ >
215
+ <ul class="max-h-48 overflow-y-auto p-1">
216
+ <li>
217
+ <button
218
+ type="button"
219
+ class="w-full rounded-btn px-3 py-2 text-left text-sm text-base-content/40 hover:bg-base-200"
220
+ onclick={onSelectAll ?? clear}
221
+ >
222
+ {onSelectAll ? strings.selectAll : placeholder}
223
+ </button>
224
+ </li>
225
+ {#if searching}
226
+ <li class="px-3 py-2 text-sm text-base-content/40">{strings.selectSearching}</li>
227
+ {/if}
228
+ {#each filtered as option (option.value)}
229
+ {@const checked = value.includes(option.value)}
230
+ <li>
231
+ <button
232
+ type="button"
233
+ class="flex w-full items-center gap-2 rounded-btn px-3 py-2 text-left text-sm hover:bg-base-200"
234
+ class:bg-primary={checked}
235
+ class:text-primary-content={checked}
236
+ onclick={() => toggle(option)}
237
+ >
238
+ <input type="checkbox" class="checkbox checkbox-sm" {checked} tabindex="-1" readonly />
239
+ {option.label}
240
+ </button>
241
+ </li>
242
+ {/each}
243
+ {#if !searching && filtered.length === 0}
244
+ <li class="px-3 py-2 text-sm text-base-content/40">{strings.selectNoResults}</li>
245
+ {/if}
246
+ </ul>
247
+ </div>
248
+ </div>