@streamscloud/kit 0.2.0 → 0.2.2
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/dist/styles/_input.scss +98 -0
- package/dist/styles/_mixins.scss +2 -2
- package/dist/styles/reset.css +1 -1
- package/dist/ui/color-picker/cmp.color-picker.svelte +3 -12
- package/dist/ui/color-picker/cmp.color-picker.svelte.d.ts +3 -9
- package/dist/ui/dialog/cmp.dialog.svelte +1 -1
- package/dist/ui/dropdown/cmp.dropdown-item.svelte +93 -0
- package/dist/ui/dropdown/cmp.dropdown-item.svelte.d.ts +32 -0
- package/dist/ui/dropdown/cmp.dropdown-panel.svelte +29 -0
- package/dist/ui/dropdown/cmp.dropdown-panel.svelte.d.ts +18 -0
- package/dist/ui/dropdown/cmp.dropdown.svelte +72 -7
- package/dist/ui/dropdown/cmp.dropdown.svelte.d.ts +3 -1
- package/dist/ui/dropdown/index.d.ts +2 -0
- package/dist/ui/dropdown/index.js +2 -0
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte +0 -5
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte.d.ts +2 -8
- package/dist/ui/emoji-picker/cmp.emoji-panel.svelte +186 -0
- package/dist/ui/emoji-picker/cmp.emoji-panel.svelte.d.ts +21 -0
- package/dist/ui/emoji-picker/cmp.emoji-picker.svelte +35 -0
- package/dist/ui/emoji-picker/cmp.emoji-picker.svelte.d.ts +15 -0
- package/dist/ui/emoji-picker/emoji-list.d.ts +2 -0
- package/dist/ui/emoji-picker/emoji-list.js +1754 -0
- package/dist/ui/emoji-picker/emoji-picker-localization.d.ts +5 -0
- package/dist/ui/emoji-picker/emoji-picker-localization.js +40 -0
- package/dist/ui/emoji-picker/index.d.ts +2 -0
- package/dist/ui/emoji-picker/index.js +2 -0
- package/dist/ui/emoji-picker/types.d.ts +8 -0
- package/dist/ui/emoji-picker/types.js +1 -0
- package/dist/ui/form-group/cmp.form-group-label.svelte.d.ts +1 -0
- package/dist/ui/form-group/cmp.form-group.svelte.d.ts +1 -0
- package/dist/ui/icon-text/cmp.icon-text.svelte +0 -9
- package/dist/ui/icon-text/cmp.icon-text.svelte.d.ts +4 -9
- package/dist/ui/inputs/index.d.ts +6 -0
- package/dist/ui/inputs/index.js +5 -0
- package/dist/ui/inputs/input/cmp.input-validatable.svelte +57 -0
- package/dist/ui/inputs/input/cmp.input-validatable.svelte.d.ts +56 -0
- package/dist/ui/inputs/input/cmp.input.svelte +235 -0
- package/dist/ui/inputs/input/cmp.input.svelte.d.ts +60 -0
- package/dist/ui/inputs/input/index.d.ts +2 -0
- package/dist/ui/inputs/input/index.js +2 -0
- package/dist/ui/inputs/input-emoji-picker/cmp.input-emoji-picker.svelte +44 -0
- package/dist/ui/inputs/input-emoji-picker/cmp.input-emoji-picker.svelte.d.ts +9 -0
- package/dist/ui/inputs/input-emoji-picker/index.d.ts +2 -0
- package/dist/ui/inputs/input-emoji-picker/index.js +2 -0
- package/dist/ui/inputs/input-emoji-picker/input-emoji-picker-container.d.ts +2 -0
- package/dist/ui/inputs/input-emoji-picker/input-emoji-picker-container.js +16 -0
- package/dist/ui/inputs/numeral-input/cmp.numeral-input-validatable.svelte +55 -0
- package/dist/ui/inputs/numeral-input/cmp.numeral-input-validatable.svelte.d.ts +62 -0
- package/dist/ui/inputs/numeral-input/cmp.numeral-input.svelte +248 -0
- package/dist/ui/inputs/numeral-input/cmp.numeral-input.svelte.d.ts +66 -0
- package/dist/ui/inputs/numeral-input/index.d.ts +2 -0
- package/dist/ui/inputs/numeral-input/index.js +2 -0
- package/dist/ui/inputs/pin-input/cmp.pin-input.svelte +58 -0
- package/dist/ui/inputs/pin-input/cmp.pin-input.svelte.d.ts +23 -0
- package/dist/ui/inputs/pin-input/index.d.ts +1 -0
- package/dist/ui/inputs/pin-input/index.js +1 -0
- package/dist/ui/inputs/pin-input/pin-input-generator.d.ts +27 -0
- package/dist/ui/inputs/pin-input/pin-input-generator.js +114 -0
- package/dist/ui/inputs/rich-text-input/cmp.rich-text-input.svelte +55 -0
- package/dist/ui/inputs/rich-text-input/cmp.rich-text-input.svelte.d.ts +43 -0
- package/dist/ui/inputs/rich-text-input/index.d.ts +2 -0
- package/dist/ui/inputs/rich-text-input/index.js +1 -0
- package/dist/ui/inputs/rich-text-input/rich-text-input-localization.d.ts +12 -0
- package/dist/ui/inputs/rich-text-input/rich-text-input-localization.js +48 -0
- package/dist/ui/inputs/rich-text-input/tinymce-input.svelte +250 -0
- package/dist/ui/inputs/rich-text-input/tinymce-input.svelte.d.ts +25 -0
- package/dist/ui/inputs/rich-text-input/tinymce.declarations.d.ts +7 -0
- package/dist/ui/inputs/rich-text-input/types.d.ts +4 -0
- package/dist/ui/inputs/rich-text-input/types.js +1 -0
- package/dist/ui/inputs/rich-text-input/validated-link-button.d.ts +3 -0
- package/dist/ui/inputs/rich-text-input/validated-link-button.js +78 -0
- package/dist/ui/inputs/textarea/cmp.textarea-validatable.svelte +35 -0
- package/dist/ui/inputs/textarea/cmp.textarea-validatable.svelte.d.ts +53 -0
- package/dist/ui/inputs/textarea/cmp.textarea.svelte +247 -0
- package/dist/ui/inputs/textarea/cmp.textarea.svelte.d.ts +57 -0
- package/dist/ui/inputs/textarea/index.d.ts +2 -0
- package/dist/ui/inputs/textarea/index.js +2 -0
- package/dist/ui/media-viewer-dialog/cmp.media-viewer-dialog.svelte.d.ts +2 -0
- package/dist/ui/media-viewer-dialog/index.d.ts +2 -1
- package/dist/ui/media-viewer-dialog/index.js +4 -2
- package/dist/ui/selects/_multiselect.scss +282 -0
- package/dist/ui/selects/_singleselect.scss +175 -0
- package/dist/ui/selects/cmp.multiselect.svelte +530 -0
- package/dist/ui/selects/cmp.multiselect.svelte.d.ts +85 -0
- package/dist/ui/selects/cmp.search-multiselect.svelte +532 -0
- package/dist/ui/selects/cmp.search-multiselect.svelte.d.ts +67 -0
- package/dist/ui/selects/cmp.singleselect.svelte +381 -0
- package/dist/ui/selects/cmp.singleselect.svelte.d.ts +78 -0
- package/dist/ui/selects/index.d.ts +5 -0
- package/dist/ui/selects/index.js +4 -0
- package/dist/ui/selects/select-localization.d.ts +6 -0
- package/dist/ui/selects/select-localization.js +27 -0
- package/dist/ui/selects/types.d.ts +29 -0
- package/dist/ui/selects/types.js +1 -0
- package/dist/ui/time-ago/cmp.time-ago.svelte +0 -6
- package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +2 -6
- package/dist/ui/validatable/_validatable.scss +34 -0
- package/dist/ui/validatable/cmp.validatable.svelte +57 -0
- package/dist/ui/validatable/cmp.validatable.svelte.d.ts +49 -0
- package/dist/ui/validatable/cmp.validation-error.svelte +52 -0
- package/dist/ui/validatable/cmp.validation-error.svelte.d.ts +42 -0
- package/dist/ui/validatable/index.d.ts +2 -0
- package/dist/ui/validatable/index.js +2 -0
- package/package.json +31 -5
- package/dist/ui/color-picker/cmp.input-stub.svelte +0 -98
- package/dist/ui/color-picker/cmp.input-stub.svelte.d.ts +0 -40
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
<script lang="ts" generics="T">import { Icon } from '../icon';
|
|
2
|
+
import { SelectLocalization } from './select-localization';
|
|
3
|
+
import IconAdd from '@fluentui/svg-icons/icons/add_16_filled.svg?raw';
|
|
4
|
+
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
5
|
+
import IconDismiss from '@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw';
|
|
6
|
+
import IconReorderDotsVertical from '@fluentui/svg-icons/icons/re_order_dots_vertical_20_regular.svg?raw';
|
|
7
|
+
import Fuse from 'fuse.js';
|
|
8
|
+
import { dndzone } from 'svelte-dnd-action';
|
|
9
|
+
import Select from 'svelte-select';
|
|
10
|
+
let { value = null, options = [], placeholder = '', disabled = false, loading = false, creatable = null, inlineSelection = false, hideEmptyState = false, showFullItem = false, reorderable = false, on, icon, chevronIcon } = $props();
|
|
11
|
+
const loc = new SelectLocalization();
|
|
12
|
+
let listOpen = $state(false);
|
|
13
|
+
let filterText = $state('');
|
|
14
|
+
const floatingConfig = { strategy: 'absolute' };
|
|
15
|
+
const flattenGroupedOptions = (opts) => {
|
|
16
|
+
const result = [];
|
|
17
|
+
for (const opt of opts) {
|
|
18
|
+
if ('options' in opt) {
|
|
19
|
+
for (const child of opt.options) {
|
|
20
|
+
result.push({ label: child.label, value: child.value, group: opt.label });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
result.push({ label: opt.label, value: opt.value });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
const flatOptions = $derived(flattenGroupedOptions(options));
|
|
30
|
+
let selectValue = $state([]);
|
|
31
|
+
$effect(() => {
|
|
32
|
+
if (!value) {
|
|
33
|
+
selectValue = [];
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
selectValue = value
|
|
37
|
+
.filter((v) => flatOptions.some((o) => o.value === v))
|
|
38
|
+
.map((v) => {
|
|
39
|
+
const existent = flatOptions.find((x) => x.value === v);
|
|
40
|
+
return {
|
|
41
|
+
id: typeof existent.value === 'string' ? existent.value : JSON.stringify(existent.value),
|
|
42
|
+
label: existent.label,
|
|
43
|
+
value: existent.value
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const generateOptions = () => {
|
|
49
|
+
return flatOptions.map((x) => ({
|
|
50
|
+
label: x.label,
|
|
51
|
+
value: x.value,
|
|
52
|
+
$isCreated: false,
|
|
53
|
+
group: x.group
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
let optionItems = $state([]);
|
|
57
|
+
$effect(() => {
|
|
58
|
+
let generated = generateOptions();
|
|
59
|
+
if (!listOpen) {
|
|
60
|
+
generated = generated.filter((x) => !x.$isCreated);
|
|
61
|
+
}
|
|
62
|
+
optionItems = generated;
|
|
63
|
+
});
|
|
64
|
+
const onSelectChange = (items) => {
|
|
65
|
+
const isExistentOption = (opt) => !opt.$isCreated;
|
|
66
|
+
const createdItem = items.find((x) => !isExistentOption(x));
|
|
67
|
+
if (createdItem?.$isCreated === true) {
|
|
68
|
+
on?.create?.(createdItem.value);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
on?.change?.(items.filter(isExistentOption).map((i) => i.value));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const itemFilter = (label, query) => {
|
|
75
|
+
if (!query) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
const fuse = new Fuse([label]);
|
|
79
|
+
const result = fuse.search(query);
|
|
80
|
+
return result.length > 0;
|
|
81
|
+
};
|
|
82
|
+
const onSelectFilter = (itemsFiltered) => {
|
|
83
|
+
if (!creatable || loading) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!creatable.validateFn(filterText)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (selectValue.some((x) => x.value === filterText)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const exactMatch = itemsFiltered.find((x) => x.label.toLowerCase() === filterText.toLowerCase());
|
|
93
|
+
if (!exactMatch) {
|
|
94
|
+
const isExistentOption = (opt) => opt.$isCreated === false;
|
|
95
|
+
const allExistingOptions = optionItems.filter(isExistentOption);
|
|
96
|
+
const newOption = { value: filterText, label: filterText, $isCreated: true };
|
|
97
|
+
optionItems = [
|
|
98
|
+
newOption,
|
|
99
|
+
...allExistingOptions.map((x) => ({
|
|
100
|
+
label: x.label,
|
|
101
|
+
value: x.value,
|
|
102
|
+
$isCreated: false,
|
|
103
|
+
group: flatOptions.find((f) => f.value === x.value)?.group
|
|
104
|
+
}))
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
else if (!exactMatch.$isCreated) {
|
|
108
|
+
if (optionItems.some((x) => x.$isCreated)) {
|
|
109
|
+
optionItems = optionItems.filter((x) => !x.$isCreated);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const onClear = (item) => {
|
|
114
|
+
const items = Array.isArray(item) ? item : [item];
|
|
115
|
+
const itemsRemaining = selectValue.filter((x) => !items.some((i) => i.value === x.value));
|
|
116
|
+
on?.change?.(itemsRemaining.map((x) => x.value));
|
|
117
|
+
};
|
|
118
|
+
const removeItem = (item) => {
|
|
119
|
+
const itemsRemaining = selectValue.filter((x) => x.value !== item.value);
|
|
120
|
+
on?.change?.(itemsRemaining.map((x) => x.value));
|
|
121
|
+
};
|
|
122
|
+
const flipDurationMs = 200;
|
|
123
|
+
const handleDndConsider = (e) => {
|
|
124
|
+
selectValue = e.detail.items;
|
|
125
|
+
};
|
|
126
|
+
const handleDndFinalize = (e) => {
|
|
127
|
+
selectValue = e.detail.items;
|
|
128
|
+
on?.change?.(selectValue.map((i) => i.value));
|
|
129
|
+
};
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<div
|
|
133
|
+
class="multiselect"
|
|
134
|
+
class:multiselect--disabled={disabled}
|
|
135
|
+
class:multiselect--loading={loading}
|
|
136
|
+
class:multiselect--inline={inlineSelection}
|
|
137
|
+
class:multiselect--inline-full-item={inlineSelection && showFullItem}
|
|
138
|
+
class:multiselect--list-hidden={hideEmptyState && !optionItems?.length}>
|
|
139
|
+
{#if !inlineSelection && selectValue.length > 0}
|
|
140
|
+
{#if reorderable}
|
|
141
|
+
<div
|
|
142
|
+
class="multiselect-tags"
|
|
143
|
+
use:dndzone={{
|
|
144
|
+
items: selectValue,
|
|
145
|
+
flipDurationMs,
|
|
146
|
+
dragDisabled: disabled || selectValue.length < 2,
|
|
147
|
+
type: 'multiselect-tags',
|
|
148
|
+
dropTargetStyle: {}
|
|
149
|
+
}}
|
|
150
|
+
onconsider={handleDndConsider}
|
|
151
|
+
onfinalize={handleDndFinalize}>
|
|
152
|
+
{#each selectValue as option (option.id)}
|
|
153
|
+
<div class="multiselect-tags__item" data-id={option.id}>
|
|
154
|
+
<span class="multiselect-tags__drag-handle" title="Drag to reorder">
|
|
155
|
+
<Icon src={IconReorderDotsVertical} />
|
|
156
|
+
</span>
|
|
157
|
+
<span class="multiselect-tags__item-text">
|
|
158
|
+
{option.label}
|
|
159
|
+
</span>
|
|
160
|
+
<button type="button" class="multiselect-tags__deselect" inert={disabled} onclick={() => removeItem(option)}>
|
|
161
|
+
<Icon src={IconDismiss} />
|
|
162
|
+
</button>
|
|
163
|
+
</div>
|
|
164
|
+
{/each}
|
|
165
|
+
</div>
|
|
166
|
+
{:else}
|
|
167
|
+
<div class="multiselect-tags">
|
|
168
|
+
{#each selectValue as option (option.value)}
|
|
169
|
+
<div class="multiselect-tags__item">
|
|
170
|
+
<span class="multiselect-tags__item-text">
|
|
171
|
+
{option.label}
|
|
172
|
+
</span>
|
|
173
|
+
<button type="button" class="multiselect-tags__deselect" inert={disabled} onclick={() => removeItem(option)}>
|
|
174
|
+
<Icon src={IconDismiss} />
|
|
175
|
+
</button>
|
|
176
|
+
</div>
|
|
177
|
+
{/each}
|
|
178
|
+
</div>
|
|
179
|
+
{/if}
|
|
180
|
+
{/if}
|
|
181
|
+
<Select
|
|
182
|
+
containerStyles="font-size: 1em;"
|
|
183
|
+
value={selectValue}
|
|
184
|
+
items={optionItems}
|
|
185
|
+
multiple={true}
|
|
186
|
+
disabled={disabled}
|
|
187
|
+
floatingConfig={floatingConfig}
|
|
188
|
+
placeholder={placeholder}
|
|
189
|
+
bind:loading={loading}
|
|
190
|
+
clearable={false}
|
|
191
|
+
bind:listOpen={listOpen}
|
|
192
|
+
listOffset={2}
|
|
193
|
+
showChevron={!loading}
|
|
194
|
+
placeholderAlwaysShow={!inlineSelection}
|
|
195
|
+
itemFilter={itemFilter}
|
|
196
|
+
hideEmptyState={hideEmptyState}
|
|
197
|
+
bind:filterText={filterText}
|
|
198
|
+
on:change={({ detail }) => onSelectChange(detail)}
|
|
199
|
+
on:filter={({ detail }) => onSelectFilter(detail)}
|
|
200
|
+
on:clear={({ detail }) => onClear(detail)}>
|
|
201
|
+
<div slot="item" let:item class="multiselect__option">
|
|
202
|
+
{#if item.$isCreated}
|
|
203
|
+
<Icon src={IconAdd} />
|
|
204
|
+
{/if}
|
|
205
|
+
{item.label}
|
|
206
|
+
</div>
|
|
207
|
+
<div class="multiselect__selection" slot="selection" let:selection>
|
|
208
|
+
<span class="multiselect__selection-text">
|
|
209
|
+
{selection.label}
|
|
210
|
+
</span>
|
|
211
|
+
</div>
|
|
212
|
+
<span slot="prepend" class="multiselect__icon multiselect__icon--prepend">
|
|
213
|
+
{#if icon}
|
|
214
|
+
{@render icon()}
|
|
215
|
+
{/if}
|
|
216
|
+
</span>
|
|
217
|
+
<span slot="chevron-icon" class="multiselect__icon">
|
|
218
|
+
{#if chevronIcon}
|
|
219
|
+
{@render chevronIcon()}
|
|
220
|
+
{:else}
|
|
221
|
+
<Icon src={IconChevronDown} />
|
|
222
|
+
{/if}
|
|
223
|
+
</span>
|
|
224
|
+
<span slot="multi-clear-icon" class="multiselect__icon">
|
|
225
|
+
<Icon src={IconDismiss} />
|
|
226
|
+
</span>
|
|
227
|
+
<svelte:fragment slot="empty">
|
|
228
|
+
<div class="multiselect__no-options">{loc.noMatch}</div>
|
|
229
|
+
</svelte:fragment>
|
|
230
|
+
</Select>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<!--
|
|
234
|
+
@component
|
|
235
|
+
Multi-value select dropdown built on svelte-select with fuzzy search. Supports external tags with optional drag-and-drop reordering, inline selection mode, and item creation.
|
|
236
|
+
|
|
237
|
+
### CSS Custom Properties
|
|
238
|
+
| Property | Description | Default |
|
|
239
|
+
|---|---|---|
|
|
240
|
+
| `--sc-kit--multiselect--root--font-size` | Root font size | `1rem` |
|
|
241
|
+
| `--sc-kit--multiselect--height` | Control height | `2em` |
|
|
242
|
+
| `--sc-kit--multiselect--width` | Control width | `100%` |
|
|
243
|
+
| `--sc-kit--multiselect--padding-block` | Vertical padding | `0.25em` |
|
|
244
|
+
| `--sc-kit--multiselect--padding-inline` | Horizontal padding | `0.5em` |
|
|
245
|
+
| `--sc-kit--multiselect--background` | Background color | `light-dark(white, gray-900)` |
|
|
246
|
+
| `--sc-kit--multiselect--background--disabled` | Disabled background | `light-dark(neutral-50, neutral-800)` |
|
|
247
|
+
| `--sc-kit--multiselect--border-color` | Border color | `light-dark(neutral-300, neutral-600)` |
|
|
248
|
+
| `--sc-kit--multiselect--border-radius` | Border radius | `0.25em` |
|
|
249
|
+
| `--sc-kit--multiselect--text--font-size` | Text font size | `0.875em` |
|
|
250
|
+
| `--sc-kit--multiselect--text--color` | Text color | `light-dark(gray-800, white)` |
|
|
251
|
+
| `--sc-kit--multiselect--placeholder--color` | Placeholder color | border-color |
|
|
252
|
+
| `--sc-kit--multiselect--icon--color` | Icon color | border-color |
|
|
253
|
+
| `--sc-kit--multiselect--chevron--pointer-events` | Chevron pointer events | `none` |
|
|
254
|
+
| `--sc-kit--multiselect--options--max-height` | Options list max height | `20em` |
|
|
255
|
+
| `--sc-kit--multiselect--item--active--background` | Active item background | `light-dark(neutral-50, neutral-700)` |
|
|
256
|
+
| `--sc-kit--multiselect--item--hover--background` | Item hover background | `light-dark(gray-100, gray-800)` |
|
|
257
|
+
| `--sc-kit--multiselect--group-header--color` | Group header color | placeholder-color |
|
|
258
|
+
| `--sc-kit--multiselect--group-header--font-weight` | Group header font weight | `500` |
|
|
259
|
+
| `--sc-kit--multiselect--group-item--padding-left` | Group item left padding | `1em` |
|
|
260
|
+
| `--sc-kit--multiselect--tag--background` | Tag background | background |
|
|
261
|
+
| `--sc-kit--multiselect--tag--border-color` | Tag border color | border-color |
|
|
262
|
+
| `--sc-kit--multiselect--tag--border-radius` | Tag border radius | border-radius |
|
|
263
|
+
| `--sc-kit--multiselect--tag--color` | Tag text color | text-color |
|
|
264
|
+
| `--sc-kit--multiselect--tag--font-size` | Tag font size | `text-font-size * 0.9` |
|
|
265
|
+
| `--sc-kit--multiselect--tag--padding-block` | Tag vertical padding | padding-block |
|
|
266
|
+
| `--sc-kit--multiselect--tag--padding-inline` | Tag horizontal padding | padding-inline |
|
|
267
|
+
| `--sc-kit--multiselect--inline--tag--background` | Inline mode tag background | `light-dark(neutral-100, neutral-700)` |
|
|
268
|
+
-->
|
|
269
|
+
|
|
270
|
+
<style>.multiselect {
|
|
271
|
+
--_multiselect--root--font-size: var(--sc-kit--multiselect--root--font-size, 1rem);
|
|
272
|
+
--_multiselect--height: var(--sc-kit--multiselect--height, 2em);
|
|
273
|
+
--_multiselect--width: var(--sc-kit--multiselect--width, 100%);
|
|
274
|
+
--_multiselect--background: var(--sc-kit--multiselect--background, light-dark(#ffffff, #1c1c1c));
|
|
275
|
+
--_multiselect--background--disabled: var(--sc-kit--multiselect--background--disabled, light-dark(#f9fafb, #1f2937));
|
|
276
|
+
--_multiselect--border-color: var(--sc-kit--multiselect--border-color, light-dark(#d1d5db, #4b5563));
|
|
277
|
+
--_multiselect--border-radius: var(--sc-kit--multiselect--border-radius, 0.25em);
|
|
278
|
+
--_multiselect--text--font-size: var(--sc-kit--multiselect--text--font-size, 0.875em);
|
|
279
|
+
--_multiselect--text--color: var(--sc-kit--multiselect--text--color, light-dark(#2e2e2e, #ffffff));
|
|
280
|
+
--_multiselect--placeholder--color: var(--sc-kit--multiselect--placeholder--color, var(--_multiselect--border-color));
|
|
281
|
+
--_multiselect--icon--color: var(--sc-kit--multiselect--icon--color, var(--_multiselect--border-color));
|
|
282
|
+
--_multiselect--padding-inline: var(--sc-kit--multiselect--padding-inline, 0.5em);
|
|
283
|
+
--_multiselect--padding-block: var(--sc-kit--multiselect--padding-block, 0.25em);
|
|
284
|
+
--_multiselect--options--max-height: var(--sc-kit--multiselect--options--max-height, 20em);
|
|
285
|
+
--_multiselect--item--hover--background: var(
|
|
286
|
+
--sc-kit--multiselect--item--hover--background,
|
|
287
|
+
light-dark(#f2f2f2, #2e2e2e)
|
|
288
|
+
);
|
|
289
|
+
--_multiselect--item--active--background: var(
|
|
290
|
+
--sc-kit--multiselect--item--active--background,
|
|
291
|
+
light-dark(#f9fafb, #374151)
|
|
292
|
+
);
|
|
293
|
+
--_multiselect--tag--color: var(--sc-kit--multiselect--tag--color, var(--_multiselect--text--color));
|
|
294
|
+
--_multiselect--tag--background: var(--sc-kit--multiselect--tag--background, var(--_multiselect--background));
|
|
295
|
+
--_multiselect--tag--border-color: var(--sc-kit--multiselect--tag--border-color, var(--_multiselect--border-color));
|
|
296
|
+
--_multiselect--tag--border-radius: var(--sc-kit--multiselect--tag--border-radius, var(--_multiselect--border-radius));
|
|
297
|
+
--_multiselect--tag--font-size: var(--sc-kit--multiselect--tag--font-size, calc(var(--_multiselect--text--font-size) * 0.9));
|
|
298
|
+
--_multiselect--tag--padding-inline: var(--sc-kit--multiselect--tag--padding-inline, var(--_multiselect--padding-inline));
|
|
299
|
+
--_multiselect--tag--padding-block: var(--sc-kit--multiselect--tag--padding-block, var(--_multiselect--padding-block));
|
|
300
|
+
--_multiselect--chevron--pointer-events: var(--sc-kit--multiselect--chevron--pointer-events, none);
|
|
301
|
+
--_multiselect--group-header--color: var(--sc-kit--multiselect--group-header--color, var(--_multiselect--placeholder--color));
|
|
302
|
+
--_multiselect--group-header--font-weight: var(--sc-kit--multiselect--group-header--font-weight, 500);
|
|
303
|
+
--_multiselect--group-item--padding-left: var(--sc-kit--multiselect--group-item--padding-left, 1em);
|
|
304
|
+
--_multiselect--inline--tag--background: var(
|
|
305
|
+
--sc-kit--multiselect--inline--tag--background,
|
|
306
|
+
light-dark(#f2f2f3, #374151)
|
|
307
|
+
);
|
|
308
|
+
--background: var(--_multiselect--background);
|
|
309
|
+
--border: 1px solid var(--_multiselect--border-color);
|
|
310
|
+
--border-focused: var(--border);
|
|
311
|
+
--border-hover: var(--border);
|
|
312
|
+
--border-radius: var(--_multiselect--border-radius);
|
|
313
|
+
--border-radius-focused: var(--border-radius);
|
|
314
|
+
--box-sizing: border-box;
|
|
315
|
+
--chevron-background: transparent;
|
|
316
|
+
--chevron-border: transparent;
|
|
317
|
+
--chevron-color: transparent;
|
|
318
|
+
--chevron-height: auto;
|
|
319
|
+
--chevron-pointer-events: var(--_multiselect--chevron--pointer-events);
|
|
320
|
+
--chevron-width: auto;
|
|
321
|
+
--disabled-background: var(--_multiselect--background--disabled);
|
|
322
|
+
--disabled-border-color: var(--_multiselect--border-color);
|
|
323
|
+
--disabled-color: var(--_multiselect--text--color);
|
|
324
|
+
--disabled-placeholder-color: var(--placeholder-color);
|
|
325
|
+
--disabled-placeholder-opacity: var(--placeholder-opacity);
|
|
326
|
+
--font-size: var(--_multiselect--text--font-size);
|
|
327
|
+
--height: var(--_multiselect--height);
|
|
328
|
+
--icons-color: var(--_multiselect--icon--color);
|
|
329
|
+
--indicators-bottom: auto;
|
|
330
|
+
--indicators-position: static;
|
|
331
|
+
--indicators-right: auto;
|
|
332
|
+
--indicators-top: auto;
|
|
333
|
+
--input--color: var(--_multiselect--text--color);
|
|
334
|
+
--input-left: 0;
|
|
335
|
+
--input-letter-spacing: 1;
|
|
336
|
+
--input-margin: 0;
|
|
337
|
+
--input-padding: 0 var(--_multiselect--padding-inline) 0 0;
|
|
338
|
+
--item-active-background: var(--_multiselect--item--active--background);
|
|
339
|
+
--item-color: var(--_multiselect--text--color);
|
|
340
|
+
--item-first-border-radius: 0;
|
|
341
|
+
--item-height: auto;
|
|
342
|
+
--item-hover-bg: var(--_multiselect--item--hover--background);
|
|
343
|
+
--item-hover-color: var(--_multiselect--text--color);
|
|
344
|
+
--item-is-active-bg: var(--_multiselect--item--active--background);
|
|
345
|
+
--item-is-active-color: var(--_multiselect--text--color);
|
|
346
|
+
--item-is-not-selectable-color: var(--_multiselect--group-header--color);
|
|
347
|
+
--item-line-height: 1;
|
|
348
|
+
--item-padding: var(--_multiselect--padding-block) var(--_multiselect--padding-inline);
|
|
349
|
+
--item-transition: auto;
|
|
350
|
+
--list-background: var(--background);
|
|
351
|
+
--list-border: var(--border);
|
|
352
|
+
--list-border-radius: var(--border-radius);
|
|
353
|
+
--list-max-height: var(--_multiselect--options--max-height);
|
|
354
|
+
--list-position: absolute;
|
|
355
|
+
--list-shadow: none;
|
|
356
|
+
--list-z-index: 2;
|
|
357
|
+
--loading--margin: 0;
|
|
358
|
+
--loading-color: var(--icons-color);
|
|
359
|
+
--loading-height: max-content;
|
|
360
|
+
--loading-width: max-content;
|
|
361
|
+
--margin: 0;
|
|
362
|
+
--max-height: var(--height);
|
|
363
|
+
--multi-item-active-outline: none;
|
|
364
|
+
--multi-item-bg: transparent;
|
|
365
|
+
--multi-item-border-radius: 0;
|
|
366
|
+
--multi-item-clear-icon-color: transparent;
|
|
367
|
+
--multi-item-color: transparent;
|
|
368
|
+
--multi-item-gap: 0;
|
|
369
|
+
--multi-item-height: 0;
|
|
370
|
+
--multi-item-margin: 0;
|
|
371
|
+
--multi-item-outline: none;
|
|
372
|
+
--multi-item-padding: 0;
|
|
373
|
+
--multi-max-width: 0;
|
|
374
|
+
--multi-select-input-margin: 0;
|
|
375
|
+
--multi-select-input-padding: 0;
|
|
376
|
+
--multi-select-padding: var(--_multiselect--padding-block) var(--_multiselect--padding-inline) var(--_multiselect--padding-block) 0;
|
|
377
|
+
--padding: 0;
|
|
378
|
+
--placeholder-color: var(--_multiselect--placeholder--color);
|
|
379
|
+
--placeholder-opacity: 0.8;
|
|
380
|
+
--selected-item-color: auto;
|
|
381
|
+
--selected-item-overflow: auto;
|
|
382
|
+
--selected-item-padding: auto;
|
|
383
|
+
--spinner-color: var(--icons-color);
|
|
384
|
+
--spinner-height: var(--_multiselect--text--font-size);
|
|
385
|
+
--spinner-width: var(--_multiselect--text--font-size);
|
|
386
|
+
--value-container-overflow: hidden;
|
|
387
|
+
--value-container-padding: 0 var(--_multiselect--padding-inline) 0 0;
|
|
388
|
+
--width: var(--_multiselect--width);
|
|
389
|
+
--group-title-color: var(--_multiselect--group-header--color);
|
|
390
|
+
--group-title-font-weight: var(--_multiselect--group-header--font-weight);
|
|
391
|
+
--group-title-font-size: var(--_multiselect--text--font-size);
|
|
392
|
+
--group-title-padding: var(--_multiselect--padding-block) var(--_multiselect--padding-inline);
|
|
393
|
+
--group-item-padding-left: var(--_multiselect--group-item--padding-left);
|
|
394
|
+
font-size: var(--_multiselect--root--font-size);
|
|
395
|
+
width: var(--_multiselect--width);
|
|
396
|
+
position: relative;
|
|
397
|
+
}
|
|
398
|
+
.multiselect__icon {
|
|
399
|
+
--sc-kit--icon--color: var(--_multiselect--icon--color);
|
|
400
|
+
--sc-kit--icon--size: 1.25em;
|
|
401
|
+
display: flex;
|
|
402
|
+
align-items: center;
|
|
403
|
+
}
|
|
404
|
+
.multiselect__icon--prepend {
|
|
405
|
+
padding: 0 var(--_multiselect--padding-inline);
|
|
406
|
+
}
|
|
407
|
+
:global(.multiselect__icon--prepend:not(:has(*))) {
|
|
408
|
+
padding-right: 0 !important;
|
|
409
|
+
}
|
|
410
|
+
.multiselect__option {
|
|
411
|
+
font-size: var(--_multiselect--text--font-size);
|
|
412
|
+
}
|
|
413
|
+
.multiselect__selection {
|
|
414
|
+
font-size: var(--_multiselect--tag--font-size);
|
|
415
|
+
width: 100%;
|
|
416
|
+
min-width: 100%;
|
|
417
|
+
max-width: 100%;
|
|
418
|
+
height: 100%;
|
|
419
|
+
min-height: 100%;
|
|
420
|
+
max-height: 100%;
|
|
421
|
+
display: flex;
|
|
422
|
+
align-items: center;
|
|
423
|
+
min-width: 0;
|
|
424
|
+
}
|
|
425
|
+
.multiselect__selection-text {
|
|
426
|
+
text-overflow: ellipsis;
|
|
427
|
+
max-width: 100%;
|
|
428
|
+
white-space: nowrap;
|
|
429
|
+
overflow: hidden;
|
|
430
|
+
}
|
|
431
|
+
.multiselect__no-options {
|
|
432
|
+
color: var(--_multiselect--placeholder--color);
|
|
433
|
+
padding: var(--_multiselect--padding-block) var(--_multiselect--padding-inline);
|
|
434
|
+
}
|
|
435
|
+
.multiselect--disabled {
|
|
436
|
+
cursor: default;
|
|
437
|
+
pointer-events: none;
|
|
438
|
+
}
|
|
439
|
+
.multiselect--loading {
|
|
440
|
+
pointer-events: none;
|
|
441
|
+
}
|
|
442
|
+
.multiselect--loading::after {
|
|
443
|
+
content: "";
|
|
444
|
+
position: absolute;
|
|
445
|
+
top: 0;
|
|
446
|
+
left: 0;
|
|
447
|
+
width: 100%;
|
|
448
|
+
height: 100%;
|
|
449
|
+
background: light-dark(hsl(0, 0%, 97%), hsl(0, 0%, 3%));
|
|
450
|
+
opacity: 0.5;
|
|
451
|
+
}
|
|
452
|
+
.multiselect :global(.value-container) {
|
|
453
|
+
gap: 0 !important;
|
|
454
|
+
}
|
|
455
|
+
.multiselect--inline {
|
|
456
|
+
--max-height: auto;
|
|
457
|
+
--multi-item-active-outline: none;
|
|
458
|
+
--multi-item-bg: var(--_multiselect--inline--tag--background);
|
|
459
|
+
--multi-item-border-radius: var(--_multiselect--border-radius);
|
|
460
|
+
--multi-item-clear-icon-color: var(--_multiselect--icon--color);
|
|
461
|
+
--multi-item-color: var(--_multiselect--text--color);
|
|
462
|
+
--multi-item-gap: var(--_multiselect--padding-inline);
|
|
463
|
+
--multi-item-height: calc(var(--_multiselect--height) - 2 * var(--_multiselect--padding-block));
|
|
464
|
+
--multi-item-margin: 0;
|
|
465
|
+
--multi-item-outline: 1px solid var(--_multiselect--border-color);
|
|
466
|
+
--multi-item-padding: var(--_multiselect--tag--padding-block) var(--_multiselect--tag--padding-inline);
|
|
467
|
+
--multi-max-width: 9.375em;
|
|
468
|
+
--multi-select-input-margin: 0;
|
|
469
|
+
--multi-select-input-padding: 0;
|
|
470
|
+
--multi-select-padding: var(--_multiselect--padding-block) var(--_multiselect--padding-inline) var(--_multiselect--padding-block) 0;
|
|
471
|
+
}
|
|
472
|
+
.multiselect--inline :global(.value-container) {
|
|
473
|
+
gap: 0.25em !important;
|
|
474
|
+
}
|
|
475
|
+
.multiselect--inline-full-item {
|
|
476
|
+
--multi-max-width: none;
|
|
477
|
+
}
|
|
478
|
+
.multiselect--list-hidden {
|
|
479
|
+
--list-border: none;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.multiselect-tags {
|
|
483
|
+
-webkit-user-drag: none;
|
|
484
|
+
user-select: none;
|
|
485
|
+
}
|
|
486
|
+
.multiselect-tags :global([contenteditable]) {
|
|
487
|
+
user-select: text;
|
|
488
|
+
}
|
|
489
|
+
.multiselect-tags {
|
|
490
|
+
display: flex;
|
|
491
|
+
flex-wrap: wrap;
|
|
492
|
+
gap: 0.25em;
|
|
493
|
+
margin-bottom: 0.25em;
|
|
494
|
+
min-width: 0;
|
|
495
|
+
width: 100%;
|
|
496
|
+
}
|
|
497
|
+
.multiselect-tags__item {
|
|
498
|
+
display: flex;
|
|
499
|
+
gap: 0.375em;
|
|
500
|
+
vertical-align: middle;
|
|
501
|
+
border: 1px solid var(--_multiselect--tag--border-color);
|
|
502
|
+
font-size: var(--_multiselect--tag--font-size);
|
|
503
|
+
padding: var(--_multiselect--tag--padding-block) var(--_multiselect--tag--padding-inline);
|
|
504
|
+
color: var(--_multiselect--tag--color);
|
|
505
|
+
background: var(--_multiselect--tag--background);
|
|
506
|
+
border-radius: var(--_multiselect--tag--border-radius);
|
|
507
|
+
max-width: 100%;
|
|
508
|
+
}
|
|
509
|
+
.multiselect-tags__item-text {
|
|
510
|
+
text-overflow: ellipsis;
|
|
511
|
+
max-width: 100%;
|
|
512
|
+
white-space: nowrap;
|
|
513
|
+
overflow: hidden;
|
|
514
|
+
}
|
|
515
|
+
.multiselect-tags__deselect {
|
|
516
|
+
--sc-kit--icon--color: var(--_multiselect--icon--color);
|
|
517
|
+
--sc-kit--icon--size: 1.25rem;
|
|
518
|
+
cursor: pointer;
|
|
519
|
+
display: flex;
|
|
520
|
+
align-items: center;
|
|
521
|
+
}
|
|
522
|
+
.multiselect-tags__drag-handle {
|
|
523
|
+
--sc-kit--icon--color: var(--_multiselect--icon--color);
|
|
524
|
+
--sc-kit--icon--size: 1rem;
|
|
525
|
+
cursor: grab;
|
|
526
|
+
display: flex;
|
|
527
|
+
align-items: center;
|
|
528
|
+
font-size: 0.7em;
|
|
529
|
+
user-select: none;
|
|
530
|
+
}</style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { SelectCreateItemSettings, SelectOption, SelectOptionGroup } from './types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
declare function $$render<T>(): {
|
|
4
|
+
props: {
|
|
5
|
+
value?: T[] | null;
|
|
6
|
+
options?: (SelectOption<T> | SelectOptionGroup<T>)[];
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
/** Settings for creating new items in the dropdown */
|
|
11
|
+
creatable?: SelectCreateItemSettings | null;
|
|
12
|
+
/** Show selected items as inline tags inside the control */
|
|
13
|
+
inlineSelection?: boolean;
|
|
14
|
+
/** Hide the dropdown when there are no matching options */
|
|
15
|
+
hideEmptyState?: boolean;
|
|
16
|
+
/** Do not truncate inline tag text */
|
|
17
|
+
showFullItem?: boolean;
|
|
18
|
+
/** Enable drag-and-drop reordering of external tags */
|
|
19
|
+
reorderable?: boolean;
|
|
20
|
+
on?: {
|
|
21
|
+
change?: (value: T[]) => void;
|
|
22
|
+
create?: (label: string) => void;
|
|
23
|
+
};
|
|
24
|
+
/** Left icon snippet */
|
|
25
|
+
icon?: Snippet;
|
|
26
|
+
/** Custom chevron icon snippet */
|
|
27
|
+
chevronIcon?: Snippet;
|
|
28
|
+
};
|
|
29
|
+
exports: {};
|
|
30
|
+
bindings: "";
|
|
31
|
+
slots: {};
|
|
32
|
+
events: {};
|
|
33
|
+
};
|
|
34
|
+
declare class __sveltets_Render<T> {
|
|
35
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
36
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
37
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
38
|
+
bindings(): "";
|
|
39
|
+
exports(): {};
|
|
40
|
+
}
|
|
41
|
+
interface $$IsomorphicComponent {
|
|
42
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
43
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
44
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
45
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
46
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Multi-value select dropdown built on svelte-select with fuzzy search. Supports external tags with optional drag-and-drop reordering, inline selection mode, and item creation.
|
|
50
|
+
*
|
|
51
|
+
* ### CSS Custom Properties
|
|
52
|
+
* | Property | Description | Default |
|
|
53
|
+
* |---|---|---|
|
|
54
|
+
* | `--sc-kit--multiselect--root--font-size` | Root font size | `1rem` |
|
|
55
|
+
* | `--sc-kit--multiselect--height` | Control height | `2em` |
|
|
56
|
+
* | `--sc-kit--multiselect--width` | Control width | `100%` |
|
|
57
|
+
* | `--sc-kit--multiselect--padding-block` | Vertical padding | `0.25em` |
|
|
58
|
+
* | `--sc-kit--multiselect--padding-inline` | Horizontal padding | `0.5em` |
|
|
59
|
+
* | `--sc-kit--multiselect--background` | Background color | `light-dark(white, gray-900)` |
|
|
60
|
+
* | `--sc-kit--multiselect--background--disabled` | Disabled background | `light-dark(neutral-50, neutral-800)` |
|
|
61
|
+
* | `--sc-kit--multiselect--border-color` | Border color | `light-dark(neutral-300, neutral-600)` |
|
|
62
|
+
* | `--sc-kit--multiselect--border-radius` | Border radius | `0.25em` |
|
|
63
|
+
* | `--sc-kit--multiselect--text--font-size` | Text font size | `0.875em` |
|
|
64
|
+
* | `--sc-kit--multiselect--text--color` | Text color | `light-dark(gray-800, white)` |
|
|
65
|
+
* | `--sc-kit--multiselect--placeholder--color` | Placeholder color | border-color |
|
|
66
|
+
* | `--sc-kit--multiselect--icon--color` | Icon color | border-color |
|
|
67
|
+
* | `--sc-kit--multiselect--chevron--pointer-events` | Chevron pointer events | `none` |
|
|
68
|
+
* | `--sc-kit--multiselect--options--max-height` | Options list max height | `20em` |
|
|
69
|
+
* | `--sc-kit--multiselect--item--active--background` | Active item background | `light-dark(neutral-50, neutral-700)` |
|
|
70
|
+
* | `--sc-kit--multiselect--item--hover--background` | Item hover background | `light-dark(gray-100, gray-800)` |
|
|
71
|
+
* | `--sc-kit--multiselect--group-header--color` | Group header color | placeholder-color |
|
|
72
|
+
* | `--sc-kit--multiselect--group-header--font-weight` | Group header font weight | `500` |
|
|
73
|
+
* | `--sc-kit--multiselect--group-item--padding-left` | Group item left padding | `1em` |
|
|
74
|
+
* | `--sc-kit--multiselect--tag--background` | Tag background | background |
|
|
75
|
+
* | `--sc-kit--multiselect--tag--border-color` | Tag border color | border-color |
|
|
76
|
+
* | `--sc-kit--multiselect--tag--border-radius` | Tag border radius | border-radius |
|
|
77
|
+
* | `--sc-kit--multiselect--tag--color` | Tag text color | text-color |
|
|
78
|
+
* | `--sc-kit--multiselect--tag--font-size` | Tag font size | `text-font-size * 0.9` |
|
|
79
|
+
* | `--sc-kit--multiselect--tag--padding-block` | Tag vertical padding | padding-block |
|
|
80
|
+
* | `--sc-kit--multiselect--tag--padding-inline` | Tag horizontal padding | padding-inline |
|
|
81
|
+
* | `--sc-kit--multiselect--inline--tag--background` | Inline mode tag background | `light-dark(neutral-100, neutral-700)` |
|
|
82
|
+
*/
|
|
83
|
+
declare const Cmp: $$IsomorphicComponent;
|
|
84
|
+
type Cmp<T> = InstanceType<typeof Cmp<T>>;
|
|
85
|
+
export default Cmp;
|