svelte-select-5 6.0.0

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 (123) hide show
  1. package/.claude/settings.local.json +20 -0
  2. package/.prettierignore +2 -0
  3. package/.prettierrc +17 -0
  4. package/CHANGELOG.md +571 -0
  5. package/LICENSE +9 -0
  6. package/MIGRATION_GUIDE.md +98 -0
  7. package/README.md +316 -0
  8. package/docs/generate_theming_variables_md.cjs +53 -0
  9. package/docs/theming_variables.md +113 -0
  10. package/jsconfig.json +3 -0
  11. package/package.json +77 -0
  12. package/rollup.config.js +33 -0
  13. package/src/app.html +29 -0
  14. package/src/global.d.ts +1 -0
  15. package/src/lib/ChevronIcon.svelte +22 -0
  16. package/src/lib/ClearIcon.svelte +22 -0
  17. package/src/lib/LoadingIcon.svelte +33 -0
  18. package/src/lib/Select.svelte +1345 -0
  19. package/src/lib/filter.js +38 -0
  20. package/src/lib/get-items.js +25 -0
  21. package/src/lib/index.js +1 -0
  22. package/src/lib/tailwind.css +130 -0
  23. package/src/post-prepare.cjs +6 -0
  24. package/src/remove-styles.cjs +22 -0
  25. package/src/routes/+layout.js +1 -0
  26. package/src/routes/+layout.svelte +263 -0
  27. package/src/routes/+page.js +5 -0
  28. package/src/routes/+page.svelte +0 -0
  29. package/src/routes/examples/+page.svelte +84 -0
  30. package/src/routes/examples/advanced/create-item/+page.svelte +36 -0
  31. package/src/routes/examples/advanced/create-item-multiple/+page.svelte +38 -0
  32. package/src/routes/examples/advanced/floating-ui/+page.svelte +22 -0
  33. package/src/routes/examples/advanced/form-action/+page.server.js +10 -0
  34. package/src/routes/examples/advanced/form-action/+page.svelte +20 -0
  35. package/src/routes/examples/advanced/limit-multi-value/+page.svelte +31 -0
  36. package/src/routes/examples/advanced/long-item/+page.svelte +38 -0
  37. package/src/routes/examples/advanced/multi-item-checkboxes/+page.svelte +49 -0
  38. package/src/routes/examples/advanced/style-props/+page.svelte +14 -0
  39. package/src/routes/examples/advanced/virtual-list/+page.svelte +95 -0
  40. package/src/routes/examples/events/blur/+page.svelte +19 -0
  41. package/src/routes/examples/events/change/+page.svelte +16 -0
  42. package/src/routes/examples/events/clear/+page.svelte +18 -0
  43. package/src/routes/examples/events/error/+page.svelte +17 -0
  44. package/src/routes/examples/events/filter/+page.svelte +16 -0
  45. package/src/routes/examples/events/focus/+page.svelte +16 -0
  46. package/src/routes/examples/events/hoverItem/+page.svelte +16 -0
  47. package/src/routes/examples/events/input/+page.svelte +16 -0
  48. package/src/routes/examples/events/loaded/+page.svelte +23 -0
  49. package/src/routes/examples/props/class/+page.svelte +17 -0
  50. package/src/routes/examples/props/clearFilterTextOnBlur/+page.svelte +13 -0
  51. package/src/routes/examples/props/clearable/+page.svelte +13 -0
  52. package/src/routes/examples/props/closeListOnChange/+page.svelte +12 -0
  53. package/src/routes/examples/props/container-styles/+page.svelte +11 -0
  54. package/src/routes/examples/props/debounce-wait/+page.svelte +19 -0
  55. package/src/routes/examples/props/disabled/+page.svelte +15 -0
  56. package/src/routes/examples/props/filter-text/+page.svelte +14 -0
  57. package/src/routes/examples/props/floating-config/+page.svelte +42 -0
  58. package/src/routes/examples/props/focused/+page.svelte +16 -0
  59. package/src/routes/examples/props/group-header-selectable/+page.svelte +18 -0
  60. package/src/routes/examples/props/hide-empty-state/+page.svelte +8 -0
  61. package/src/routes/examples/props/id/+page.svelte +15 -0
  62. package/src/routes/examples/props/input-attributes/+page.svelte +11 -0
  63. package/src/routes/examples/props/item-id/+page.svelte +15 -0
  64. package/src/routes/examples/props/items/+page.svelte +15 -0
  65. package/src/routes/examples/props/just-value/+page.svelte +16 -0
  66. package/src/routes/examples/props/label/+page.svelte +15 -0
  67. package/src/routes/examples/props/list-auto-width/+page.svelte +21 -0
  68. package/src/routes/examples/props/list-offset/+page.svelte +21 -0
  69. package/src/routes/examples/props/list-open/+page.svelte +31 -0
  70. package/src/routes/examples/props/loadOptions/+page.svelte +16 -0
  71. package/src/routes/examples/props/loading/+page.svelte +15 -0
  72. package/src/routes/examples/props/multiFullItemClearable/+page.svelte +12 -0
  73. package/src/routes/examples/props/multiple/+page.svelte +12 -0
  74. package/src/routes/examples/props/name/+page.svelte +13 -0
  75. package/src/routes/examples/props/placeholder/+page.svelte +14 -0
  76. package/src/routes/examples/props/placeholder-always-show/+page.svelte +11 -0
  77. package/src/routes/examples/props/required/+page.svelte +14 -0
  78. package/src/routes/examples/props/searchable/+page.svelte +15 -0
  79. package/src/routes/examples/props/show-chevron/+page.svelte +15 -0
  80. package/src/routes/examples/props/value/+page.svelte +19 -0
  81. package/src/routes/examples/slots/chevron-icon/+page.svelte +16 -0
  82. package/src/routes/examples/slots/clear-icon/+page.svelte +21 -0
  83. package/src/routes/examples/slots/empty/+page.svelte +18 -0
  84. package/src/routes/examples/slots/input-hidden/+page.server.js +10 -0
  85. package/src/routes/examples/slots/input-hidden/+page.svelte +22 -0
  86. package/src/routes/examples/slots/item/+page.svelte +15 -0
  87. package/src/routes/examples/slots/list/+page.svelte +49 -0
  88. package/src/routes/examples/slots/list-append/+page.svelte +16 -0
  89. package/src/routes/examples/slots/list-prepend/+page.svelte +16 -0
  90. package/src/routes/examples/slots/loading-icon/+page.svelte +29 -0
  91. package/src/routes/examples/slots/multi-clear-icon/+page.svelte +16 -0
  92. package/src/routes/examples/slots/prepend/+page.svelte +22 -0
  93. package/src/routes/examples/slots/required/+page.svelte +31 -0
  94. package/src/routes/examples/slots/selection/+page.svelte +25 -0
  95. package/static/nav-icon.svg +2 -0
  96. package/static/svelte-select.png +0 -0
  97. package/svelte-select.png +0 -0
  98. package/svelte.config.js +10 -0
  99. package/tailwind.config.cjs +4 -0
  100. package/test/public/favicon.ico +0 -0
  101. package/test/public/index.html +15 -0
  102. package/test/src/ChevronSlotTest.svelte +19 -0
  103. package/test/src/ClearIconSlotTest.svelte +12 -0
  104. package/test/src/CustomItem.svelte +78 -0
  105. package/test/src/GroupHeaderNotSelectable.svelte +17 -0
  106. package/test/src/HoverItemIndexTest.svelte +21 -0
  107. package/test/src/InputHiddenSlotTest.svelte +12 -0
  108. package/test/src/ItemHeightTest.svelte +7 -0
  109. package/test/src/ItemSlotTest.svelte +11 -0
  110. package/test/src/ListSlotTest.svelte +14 -0
  111. package/test/src/LoadOptionsGroup.svelte +21 -0
  112. package/test/src/MultiItemColor.svelte +7 -0
  113. package/test/src/OuterListTest.svelte +16 -0
  114. package/test/src/PrependSlotTest.svelte +12 -0
  115. package/test/src/Select/ParentContainer.svelte +11 -0
  116. package/test/src/SelectionSlotMultipleTest.svelte +12 -0
  117. package/test/src/SelectionSlotTest.svelte +12 -0
  118. package/test/src/TestClearIcon.svelte +1 -0
  119. package/test/src/TestIcon.svelte +15 -0
  120. package/test/src/env.js +1 -0
  121. package/test/src/test-utils.js +124 -0
  122. package/test/src/tests.js +3745 -0
  123. package/vite.config.js +9 -0
package/README.md ADDED
@@ -0,0 +1,316 @@
1
+ # svelte-select-5
2
+
3
+ A select/autocomplete/typeahead component for **Svelte 5**.
4
+
5
+ This is a fork of [svelte-select](https://github.com/rob-balfre/svelte-select) with full Svelte 5 support.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install svelte-select-5
11
+ ```
12
+
13
+ ## Svelte 5 Migration
14
+
15
+ This fork has been fully migrated to Svelte 5:
16
+ - Uses Svelte 5 runes (`$state`, `$derived`, `$effect`, `$props`, `$bindable`)
17
+ - Slots replaced with snippets (e.g., `slot="clear-icon"` → `{#snippet clearIcon()}`)
18
+ - Events use callback props (e.g., `on:select` → `onselect`)
19
+
20
+ See [CHANGELOG.md](./CHANGELOG.md) for breaking changes.
21
+
22
+
23
+ ## Upgrading Svelte Select
24
+ See [migration guide](/MIGRATION_GUIDE.md) if upgrading
25
+
26
+
27
+ ## Rollup and low/no-build setups
28
+
29
+ List position and floating is powered by `floating-ui`, see their [package-entry-points](https://github.com/floating-ui/floating-ui#package-entry-points) docs if you encounter build errors.
30
+
31
+
32
+
33
+ ## Props
34
+
35
+ | Prop | Type | Default | Description |
36
+ | ---------------------- | --------- | --------------- | -------------------------------------------------------------- |
37
+ | items | `any[]` | `[]` | Array of items available to display / filter |
38
+ | value | `any` | `null` | Selected value(s) |
39
+ | justValue | `any` | `null` | **READ-ONLY** Selected value(s) excluding container object |
40
+ | itemId | `string` | `value` | Override default identifier |
41
+ | label | `string` | `label` | Override default label |
42
+ | id | `string` | `null` | id attr for input field |
43
+ | filterText | `string` | `''` | Text to filter `items` by |
44
+ | placeholder | `string` | `Please select` | Placeholder text |
45
+ | hideEmptyState | `boolean` | `false` | When no items hide list |
46
+ | listOpen | `boolean` | `false` | Open/close list |
47
+ | class | `string` | `''` | container classes |
48
+ | containerStyles | `string` | `''` | Add inline styles to container |
49
+ | clearable | `boolean` | `true` | Enable clearing of value(s) |
50
+ | disabled | `boolean` | `false` | Disable select |
51
+ | multiple | `boolean` | `false` | Enable multi-select |
52
+ | searchable | `boolean` | `true` | If `false` search/filtering is disabled |
53
+ | groupHeaderSelectable | `boolean` | `false` | Enable selectable group headers |
54
+ | focused | `boolean` | `false` | Controls input focus |
55
+ | listAutoWidth | `boolean` | `true` | If `false` will ignore width of select |
56
+ | showChevron | `boolean` | `false` | Show chevron |
57
+ | inputAttributes | `object` | `{}` | Pass in HTML attributes to Select's input |
58
+ | placeholderAlwaysShow | `boolean` | `false` | When `multiple` placeholder text will always show |
59
+ | loading | `boolean` | `false` | Shows `loading-icon`. `loadOptions` will override this |
60
+ | listOffset | `number` | `5` | `px` space between select and list |
61
+ | debounceWait | `number` | `300` | `milliseconds` debounce wait |
62
+ | floatingConfig | `object` | `{}` | [Floating UI Config](https://floating-ui.com/) |
63
+ | hasError | `boolean` | `false` | If `true` sets error class and styles |
64
+ | name | `string` | `null` | Name attribute of hidden input, helpful for form actions |
65
+ | required | `boolean` | `false` | If `Select` is within a `<form>` will restrict form submission |
66
+ | multiFullItemClearable | `boolean` | `false` | When `multiple` selected items will clear on click |
67
+ | closeListOnChange | `boolean` | `true` | After `on:change` list will close |
68
+ | clearFilterTextOnBlur | `boolean` | `true` | If `false`, `filterText` value is preserved on:blur |
69
+
70
+
71
+ ## Named slots
72
+
73
+ ```svelte
74
+ <Select>
75
+ <div slot="prepend" />
76
+ <div slot="selection" let:selection let:index /> <!-- index only available when multiple -->
77
+ <div slot="clear-icon" />
78
+ <div slot="multi-clear-icon" />
79
+ <div slot="loading-icon" />
80
+ <div slot="chevron-icon" />
81
+ <div slot="list-prepend" />
82
+ <div slot="list" let:filteredItems />
83
+ <div slot="list-append" />
84
+ <div slot="item" let:item let:index />
85
+ <div slot="input-hidden" let:value />
86
+ <div slot="required" let:value />
87
+ <!-- Remember you can also use `svelte:fragment` to avoid a container DOM element. -->
88
+ <svelte:fragment slot="empty" />
89
+ </Select>
90
+ ```
91
+
92
+
93
+ ## Events
94
+
95
+ | Event Name | Callback | Description |
96
+ | ---------- | ----------------- | -------------------------------------------------------------------------- |
97
+ | change | { detail } | fires when the user selects an option |
98
+ | input | { detail } | fires when the value has been changed |
99
+ | focus | { detail } | fires when select > input on:focus |
100
+ | blur | { detail } | fires when select > input on:blur |
101
+ | clear | { detail } | fires when clear is invoked or item is removed (by user) from multi select |
102
+ | loaded | { options } | fires when `loadOptions` resolves |
103
+ | error | { type, details } | fires when error is caught |
104
+ | filter | { detail } | fires when `listOpen: true` and items are filtered |
105
+ | hoverItem | { detail } | fires when hoverItemIndex changes |
106
+
107
+
108
+ ### Items
109
+
110
+ `items` can be simple arrays or collections.
111
+
112
+ ```html
113
+ <script>
114
+ import Select from 'svelte-select';
115
+
116
+ let simple = ['one', 'two', 'three'];
117
+
118
+ let collection = [
119
+ { value: 1, label: 'one' },
120
+ { value: 2, label: 'two' },
121
+ { value: 3, label: 'three' },
122
+ ];
123
+ </script>
124
+
125
+ <Select items={simple} />
126
+
127
+ <Select items={collection} />
128
+ ```
129
+
130
+ They can also be grouped and include non-selectable items.
131
+
132
+ ```html
133
+ <script>
134
+ import Select from 'svelte-select';
135
+
136
+ const items = [
137
+ {value: 'chocolate', label: 'Chocolate', group: 'Sweet'},
138
+ {value: 'pizza', label: 'Pizza', group: 'Savory'},
139
+ {value: 'cake', label: 'Cake', group: 'Sweet', selectable: false},
140
+ {value: 'chips', label: 'Chips', group: 'Savory'},
141
+ {value: 'ice-cream', label: 'Ice Cream', group: 'Sweet'}
142
+ ];
143
+
144
+ const groupBy = (item) => item.group;
145
+ </script>
146
+
147
+ <Select {items} {groupBy} />
148
+ ```
149
+
150
+ You can also use custom collections.
151
+
152
+ ```html
153
+ <script>
154
+ import Select from 'svelte-select';
155
+
156
+ const itemId = 'id';
157
+ const label = 'title';
158
+
159
+ const items = [
160
+ {id: 0, title: 'Foo'},
161
+ {id: 1, title: 'Bar'},
162
+ ];
163
+ </script>
164
+
165
+ <Select {itemId} {label} {items} />
166
+ ```
167
+
168
+ ### Async Items
169
+
170
+ To load items asynchronously then `loadOptions` is the simplest solution. Supply a function that returns a `Promise` that resolves with a list of items. `loadOptions` has debounce baked in and fires each time `filterText` is updated.
171
+
172
+ ```html
173
+ <script>
174
+ import Select from 'svelte-select';
175
+
176
+ import { someApiCall } from './services';
177
+
178
+ async function examplePromise(filterText) {
179
+ // Put your async code here...
180
+ // For example call an API using filterText as your search params
181
+ // When your API responds resolve your Promise
182
+ let res = await someApiCall(filterText);
183
+ return res;
184
+ }
185
+ </script>
186
+
187
+ <Select loadOptions={examplePromise} />
188
+ ```
189
+
190
+
191
+ ### Advanced List Positioning / Floating
192
+
193
+ `svelte-select` uses [floating-ui](https://floating-ui.com/) to control the list floating. See their docs and pass in your config via the `floatingConfig` prop.
194
+
195
+ ```html
196
+ <script>
197
+ import Select from 'svelte-select';
198
+
199
+ let floatingConfig = {
200
+ strategy: 'fixed'
201
+ }
202
+ </script>
203
+
204
+ <Select {floatingConfig} />
205
+ ```
206
+
207
+ ### Exposed methods
208
+ These internal functions are exposed to override if needed. Look through the test file (test/src/index.js) for examples.
209
+
210
+ ```js
211
+ export let itemFilter = (label, filterText, option) => label.toLowerCase().includes(filterText.toLowerCase());
212
+ ```
213
+
214
+ ```js
215
+ export let groupBy = undefined;
216
+ ```
217
+
218
+ ```js
219
+ export let groupFilter = groups => groups;
220
+ ```
221
+
222
+ ```js
223
+ export let createGroupHeaderItem = groupValue => {
224
+ return {
225
+ value: groupValue,
226
+ label: groupValue
227
+ };
228
+ };
229
+ ```
230
+
231
+ ```js
232
+ export function handleClear() {
233
+ value = undefined;
234
+ listOpen = false;
235
+ dispatch("clear", value);
236
+ handleFocus();
237
+ }
238
+ ```
239
+
240
+ ```js
241
+ export let loadOptions = undefined; // if used must return a Promise that updates 'items'
242
+ /* Return an object with { cancelled: true } to keep the loading state as active. */
243
+ ```
244
+
245
+ ```js
246
+ export const getFilteredItems = () => {
247
+ return filteredItems;
248
+ };
249
+ ```
250
+
251
+ ```js
252
+ export let debounce = (fn, wait = 1) => {
253
+ clearTimeout(timeout);
254
+ timeout = setTimeout(fn, wait);
255
+ };
256
+ ```
257
+
258
+ Override core functionality at your own risk! See ([get-items.js](/src/lib/get-items.js) & [filter.js](/src/lib/filter.js))
259
+
260
+ ```js
261
+ // core replaceable methods...
262
+ <Select
263
+ filter={...}
264
+ getItems={...}
265
+ />
266
+ ```
267
+
268
+ ## A11y (Accessibility)
269
+
270
+ Override these methods to change the `aria-context` and `aria-selection` text.
271
+
272
+ ```js
273
+ export let ariaValues = (values) => {
274
+ return `Option ${values}, selected.`;
275
+ }
276
+
277
+ export let ariaListOpen = (label, count) => {
278
+ return `You are currently focused on option ${label}. There are ${count} results available.`;
279
+ }
280
+
281
+ export let ariaFocused = () => {
282
+ return `Select is focused, type to refine list, press down to open the menu.`;
283
+ }
284
+ ```
285
+
286
+ ## CSS custom properties (variables)
287
+
288
+ You can style a component by overriding [the available CSS custom properties](/docs/theming_variables.md).
289
+
290
+ ```html
291
+ <script>
292
+ import Select from 'svelte-select';
293
+ </script>
294
+
295
+ <Select --border-radius= "10px" --placeholder-color="blue" />
296
+ ```
297
+
298
+ You can also use the `inputStyles` prop to write in any override styles needed for the input.
299
+
300
+ ```html
301
+ <script>
302
+ import Select from 'svelte-select';
303
+
304
+ const items = ['One', 'Two', 'Three'];
305
+ </script>
306
+
307
+ <Select {items} inputStyles="box-sizing: border-box;"></Select>
308
+ ```
309
+
310
+ ### 🧪 Experimental: Replace styles (Tailwind, Bootstrap, Bulma etc)
311
+ If you'd like to supply your own styles use: `import Select from 'svelte-select/no-styles/Select.svelte'`. Then somewhere in your code or build pipeline add your own. There is a tailwind stylesheet via `import 'svelte-select/tailwind.css'`. It uses `@extend` so PostCSS is required.
312
+
313
+
314
+ ## License
315
+
316
+ [LIL](LICENSE)
@@ -0,0 +1,53 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ const { find } = require("find-in-files");
5
+
6
+ const VARIABLE_USAGE_PATTERN = "var\\(--([A-Za-z\\-_]*)";
7
+ const SOURCE_FOLDER = path.join(__dirname, "..", "src/lib");
8
+
9
+ const DOC_FILE_PATH = path.join(__dirname, "theming_variables.md");
10
+ const VARIABLE_SECTION_PATTERN = /(<!-- List start -->)(.|\n)*(<!-- List end -->)/gm;
11
+
12
+ (async () => {
13
+ const searchResults = await find(
14
+ VARIABLE_USAGE_PATTERN,
15
+ SOURCE_FOLDER,
16
+ ".svelte"
17
+ );
18
+ const justTheMatchedParts = Object.keys(searchResults).reduce(
19
+ (accumulator, nextKey) => [
20
+ ...accumulator,
21
+ ...searchResults[nextKey].matches
22
+ ],
23
+ []
24
+ );
25
+ const uniqueMatches = [...new Set(justTheMatchedParts).values()];
26
+ uniqueMatches.sort();
27
+ const matchesAsMarkdownListItems = uniqueMatches.map(b =>
28
+ b.replace(/var\((--[A-Za-z\-_]*)/, "- `$1`")
29
+ );
30
+
31
+ const START_TAG_CAPTURE_GROUP = "$1";
32
+ const END_TAG_CAPTURE_GROUP = "$3";
33
+ const newDependencySectionAsRegexReplaceExpression = [
34
+ START_TAG_CAPTURE_GROUP,
35
+ ...matchesAsMarkdownListItems,
36
+ END_TAG_CAPTURE_GROUP
37
+ ].join("\n");
38
+ const oldContent = fs.readFileSync(DOC_FILE_PATH).toString();
39
+ const oldFileDoesNotContainSection =
40
+ oldContent.search(VARIABLE_SECTION_PATTERN) === -1;
41
+ if (oldFileDoesNotContainSection) {
42
+ console.error(`Could not find variable section in ${DOC_FILE_PATH}`);
43
+ process.exit(1);
44
+ }
45
+ fs.writeFileSync(
46
+ DOC_FILE_PATH,
47
+ oldContent.replace(
48
+ VARIABLE_SECTION_PATTERN,
49
+ newDependencySectionAsRegexReplaceExpression
50
+ )
51
+ );
52
+ console.log(`Successfully wrote to ${DOC_FILE_PATH}`);
53
+ })();
@@ -0,0 +1,113 @@
1
+ # Theming variables
2
+
3
+ Override the following CSS custom properties (variables) to style svelte-select components.
4
+
5
+ <!-- List start -->
6
+ - `--background`
7
+ - `--border`
8
+ - `--border-focused`
9
+ - `--border-hover`
10
+ - `--border-radius`
11
+ - `--border-radius-focused`
12
+ - `--box-sizing`
13
+ - `--chevron-background`
14
+ - `--chevron-border`
15
+ - `--chevron-color`
16
+ - `--chevron-height`
17
+ - `--chevron-icon-colour`
18
+ - `--chevron-icon-width`
19
+ - `--chevron-pointer-events`
20
+ - `--chevron-width`
21
+ - `--clear-icon-color`
22
+ - `--clear-icon-width`
23
+ - `--clear-select-color`
24
+ - `--clear-select-focus-outline`
25
+ - `--clear-select-height`
26
+ - `--clear-select-margin`
27
+ - `--clear-select-width`
28
+ - `--disabled-background`
29
+ - `--disabled-border-color`
30
+ - `--disabled-color`
31
+ - `--disabled-placeholder-color`
32
+ - `--disabled-placeholder-opacity`
33
+ - `--error-background`
34
+ - `--error-border`
35
+ - `--font-size`
36
+ - `--group-item-padding-left`
37
+ - `--group-title-border-color`
38
+ - `--group-title-border-style`
39
+ - `--group-title-border-width`
40
+ - `--group-title-color`
41
+ - `--group-title-font-size`
42
+ - `--group-title-font-weight`
43
+ - `--group-title-padding`
44
+ - `--group-title-text-transform`
45
+ - `--height`
46
+ - `--icons-color`
47
+ - `--indicators-bottom`
48
+ - `--indicators-position`
49
+ - `--indicators-right`
50
+ - `--indicators-top`
51
+ - `--input-color`
52
+ - `--input-left`
53
+ - `--input-letter-spacing`
54
+ - `--input-margin`
55
+ - `--input-padding`
56
+ - `--internal-padding`
57
+ - `--item-active-background`
58
+ - `--item-color`
59
+ - `--item-first-border-radius`
60
+ - `--item-height`
61
+ - `--item-hover-bg`
62
+ - `--item-hover-color`
63
+ - `--item-is-active-bg`
64
+ - `--item-is-active-color`
65
+ - `--item-is-not-selectable-color`
66
+ - `--item-line-height`
67
+ - `--item-padding`
68
+ - `--item-transition`
69
+ - `--list-background`
70
+ - `--list-border`
71
+ - `--list-border-radius`
72
+ - `--list-empty-color`
73
+ - `--list-empty-padding`
74
+ - `--list-empty-text-align`
75
+ - `--list-max-height`
76
+ - `--list-position`
77
+ - `--list-shadow`
78
+ - `--list-z-index`
79
+ - `--loading--margin`
80
+ - `--loading-color`
81
+ - `--loading-height`
82
+ - `--loading-width`
83
+ - `--margin`
84
+ - `--max-height`
85
+ - `--multi-item-active-outline`
86
+ - `--multi-item-bg`
87
+ - `--multi-item-border-radius`
88
+ - `--multi-item-clear-icon-color`
89
+ - `--multi-item-color`
90
+ - `--multi-item-disabled-hover-bg`
91
+ - `--multi-item-disabled-hover-color`
92
+ - `--multi-item-gap`
93
+ - `--multi-item-height`
94
+ - `--multi-item-margin`
95
+ - `--multi-item-outline`
96
+ - `--multi-item-padding`
97
+ - `--multi-max-width`
98
+ - `--multi-select-input-margin`
99
+ - `--multi-select-input-padding`
100
+ - `--multi-select-padding`
101
+ - `--padding`
102
+ - `--placeholder-color`
103
+ - `--placeholder-opacity`
104
+ - `--selected-item-color`
105
+ - `--selected-item-overflow`
106
+ - `--selected-item-padding`
107
+ - `--spinner-color`
108
+ - `--spinner-height`
109
+ - `--spinner-width`
110
+ - `--value-container-overflow`
111
+ - `--value-container-padding`
112
+ - `--width`
113
+ <!-- List end -->
package/jsconfig.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "./.svelte-kit/tsconfig.json"
3
+ }
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "svelte-select-5",
3
+ "version": "6.0.0",
4
+ "repository": "https://github.com/Dbone29/svelte-select-5.git",
5
+ "description": "A <Select> component for Svelte 5 apps (fork of svelte-select)",
6
+ "scripts": {
7
+ "dev": "vite dev",
8
+ "build": "vite build",
9
+ "preview": "vite preview",
10
+ "test": "npm run test:dev & npm run test:browser",
11
+ "test:dev": "rollup -cw",
12
+ "test:browser": "sirv test/public -p 3000 --dev --open",
13
+ "gen:docs": "node docs/generate_theming_variables_md.cjs",
14
+ "preprepare": "node src/remove-styles.cjs",
15
+ "prepare": "svelte-package",
16
+ "postprepare": "node src/post-prepare.cjs && npm run gen:docs",
17
+ "release": "release-it"
18
+ },
19
+ "devDependencies": {
20
+ "@rollup/plugin-alias": "^5.0.0",
21
+ "@rollup/plugin-node-resolve": "^15.0.0",
22
+ "@rollup/plugin-replace": "^5.0.0",
23
+ "@sveltejs/adapter-auto": "^3.0.0",
24
+ "@sveltejs/adapter-static": "^3.0.0",
25
+ "@sveltejs/kit": "^2.0.0",
26
+ "@sveltejs/package": "^2.0.0",
27
+ "@sveltejs/vite-plugin-svelte": "^4.0.0",
28
+ "autoprefixer": "^10.4.14",
29
+ "cross-env": "^7.0.3",
30
+ "find-in-files": "^0.5.0",
31
+ "fuse.js": "^6.6.2",
32
+ "prettier": "^3.0.0",
33
+ "prettier-plugin-svelte": "^3.0.0",
34
+ "release-it": "^17.0.0",
35
+ "rollup": "^4.0.0",
36
+ "rollup-plugin-cleaner": "^1.0.0",
37
+ "rollup-plugin-css-only": "^4.3.0",
38
+ "rollup-plugin-svelte": "^7.2.0",
39
+ "sirv-cli": "^2.0.2",
40
+ "svelte": "^5.0.0",
41
+ "svelte-check": "^4.0.0",
42
+ "svelte-highlight": "^7.7.0",
43
+ "svelte-tiny-virtual-list": "^2.0.5",
44
+ "tape-modern": "^1.1.2",
45
+ "typescript": "^5.0.0",
46
+ "vite": "^5.0.0"
47
+ },
48
+ "author": "Robert Balfré <rob.balfre@gmail.com> (https://github.com/rob-balfre)",
49
+ "license": "ISC",
50
+ "keywords": [
51
+ "svelte"
52
+ ],
53
+ "release-it": {
54
+ "hooks": {
55
+ "after:bump": "npm run prepare"
56
+ },
57
+ "github": {
58
+ "release": false
59
+ },
60
+ "npm": {
61
+ "publishPath": "./package"
62
+ }
63
+ },
64
+ "type": "module",
65
+ "exports": {
66
+ ".": {
67
+ "svelte": "./index.js",
68
+ "types": "./index.d.ts"
69
+ }
70
+ },
71
+ "peerDependencies": {
72
+ "svelte": "^5.0.0"
73
+ },
74
+ "dependencies": {
75
+ "svelte-floating-ui": "^1.5.9"
76
+ }
77
+ }
@@ -0,0 +1,33 @@
1
+ import svelte from 'rollup-plugin-svelte';
2
+ import resolve from '@rollup/plugin-node-resolve';
3
+ import css from 'rollup-plugin-css-only';
4
+ import replace from '@rollup/plugin-replace';
5
+
6
+ export default [
7
+ {
8
+ input: 'test/src/tests.js',
9
+ output: {
10
+ dir: './test/public',
11
+ inlineDynamicImports: true,
12
+ },
13
+ plugins: [
14
+ svelte({
15
+ emitCss: false,
16
+ compilerOptions: {
17
+ accessors: true,
18
+ dev: true,
19
+ },
20
+ }),
21
+ css(),
22
+ resolve({
23
+ browser: true,
24
+ exportConditions: ['svelte', 'development'],
25
+ dedupe: ['svelte'],
26
+ }),
27
+ replace({
28
+ preventAssignment: true,
29
+ 'process.env.NODE_ENV': JSON.stringify('development'),
30
+ }),
31
+ ],
32
+ },
33
+ ];
package/src/app.html ADDED
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="text-gray-500 antialiased bg-white">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="/svelte-select.png" />
6
+
7
+ <style>
8
+
9
+ @import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600&display=swap');
10
+
11
+ html,body {
12
+ padding: 0;
13
+ margin: 0;
14
+ font-family: 'Source Sans Pro', sans-serif;
15
+ }
16
+
17
+ * {
18
+ box-sizing: border-box;
19
+ }
20
+ </style>
21
+
22
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
23
+
24
+ %sveltekit.head%
25
+ </head>
26
+ <body class="container mx-auto">
27
+ <div id="svelte">%sveltekit.body%</div>
28
+ </body>
29
+ </html>
@@ -0,0 +1 @@
1
+ /// <reference types="@sveltejs/kit" />
@@ -0,0 +1,22 @@
1
+ <svg
2
+ width="100%"
3
+ height="100%"
4
+ viewBox="0 0 20 20"
5
+ focusable="false"
6
+ aria-hidden="true">
7
+ <path
8
+ fill="currentColor"
9
+ d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747
10
+ 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0
11
+ 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502
12
+ 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0
13
+ 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" />
14
+ </svg>
15
+
16
+ <style>
17
+ svg {
18
+ width: var(--chevron-icon-width, 20px);
19
+ height: var(--chevron-icon-width, 20px);
20
+ color: var(--chevron-icon-colour, currentColor);
21
+ }
22
+ </style>
@@ -0,0 +1,22 @@
1
+ <svg
2
+ width="100%"
3
+ height="100%"
4
+ viewBox="-2 -2 50 50"
5
+ focusable="false"
6
+ aria-hidden="true"
7
+ role="presentation"
8
+ >
9
+ <path
10
+ fill="currentColor"
11
+ d="M34.923,37.251L24,26.328L13.077,37.251L9.436,33.61l10.923-10.923L9.436,11.765l3.641-3.641L24,19.047L34.923,8.124
12
+ l3.641,3.641L27.641,22.688L38.564,33.61L34.923,37.251z"
13
+ />
14
+ </svg>
15
+
16
+ <style>
17
+ svg {
18
+ width: var(--clear-icon-width, 20px);
19
+ height: var(--clear-icon-width, 20px);
20
+ color: var(--clear-icon-color, currentColor);
21
+ }
22
+ </style>