slim-select 2.8.2 → 2.9.1

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 (69) hide show
  1. package/.prettierignore +1 -0
  2. package/.prettierrc +4 -3
  3. package/README.md +5 -2
  4. package/dist/classes.d.ts +43 -0
  5. package/dist/helpers.d.ts +1 -1
  6. package/dist/index.d.ts +5 -2
  7. package/dist/render.d.ts +4 -44
  8. package/dist/select.d.ts +4 -2
  9. package/dist/settings.d.ts +2 -1
  10. package/dist/slimselect.cjs.js +248 -120
  11. package/dist/slimselect.css +1 -1
  12. package/dist/slimselect.css.map +1 -1
  13. package/dist/slimselect.es.js +248 -120
  14. package/dist/slimselect.global.js +248 -120
  15. package/dist/slimselect.js +248 -120
  16. package/dist/slimselect.min.js +1 -1
  17. package/dist/slimselect.umd.js +248 -120
  18. package/dist/slimselect.umd.min.js +1 -1
  19. package/dist/store.d.ts +4 -2
  20. package/index.html +1 -4
  21. package/jest.config.js +6 -0
  22. package/package.json +31 -40
  23. package/src/slim-select/classes.test.ts +72 -0
  24. package/src/slim-select/classes.ts +109 -0
  25. package/src/slim-select/helpers.test.ts +160 -0
  26. package/src/slim-select/helpers.ts +3 -12
  27. package/src/slim-select/index.test.ts +109 -16
  28. package/src/slim-select/index.ts +41 -12
  29. package/src/slim-select/render.test.ts +1169 -18
  30. package/src/slim-select/render.ts +78 -97
  31. package/src/slim-select/rollup.config.mjs +28 -28
  32. package/src/slim-select/select.test.ts +306 -156
  33. package/src/slim-select/select.ts +70 -21
  34. package/src/slim-select/settings.test.ts +272 -0
  35. package/src/slim-select/settings.ts +5 -1
  36. package/src/slim-select/slimselect.scss +7 -3
  37. package/src/slim-select/store.test.ts +986 -235
  38. package/src/slim-select/store.ts +70 -28
  39. package/src/{vue/slimselect.vue → slim-select/vue.vue} +19 -17
  40. package/tsconfig.json +2 -3
  41. package/{vite.config.ts → vite.config.mts} +11 -4
  42. package/src/react/.eslintignore +0 -2
  43. package/src/react/.eslintrc.cjs +0 -24
  44. package/src/react/index.html +0 -14
  45. package/src/react/jestconfig.json +0 -11
  46. package/src/react/package.json +0 -32
  47. package/src/react/src/frameworkpage.tsx +0 -133
  48. package/src/react/src/index.ts +0 -3
  49. package/src/react/src/slimselect.tsx +0 -148
  50. package/src/react/tests/slimselect.test.tsx +0 -52
  51. package/src/react/tsconfig.json +0 -37
  52. package/src/react/tsconfig.node.json +0 -10
  53. package/src/react/vite.config.ts +0 -55
  54. package/src/vue/README.md +0 -48
  55. package/src/vue/dist/slim-select/helpers.d.ts +0 -5
  56. package/src/vue/dist/slim-select/index.d.ts +0 -46
  57. package/src/vue/dist/slim-select/render.d.ts +0 -120
  58. package/src/vue/dist/slim-select/select.d.ts +0 -28
  59. package/src/vue/dist/slim-select/settings.d.ts +0 -34
  60. package/src/vue/dist/slim-select/store.d.ts +0 -80
  61. package/src/vue/dist/slimselectvue.es.js +0 -1978
  62. package/src/vue/dist/slimselectvue.global.js +0 -1981
  63. package/src/vue/dist/slimselectvue.ssr.js +0 -1980
  64. package/src/vue/dist/vue/hello.d.ts +0 -2
  65. package/src/vue/dist/vue/slimselect.vue.d.ts +0 -326
  66. package/src/vue/hello.ts +0 -5
  67. package/src/vue/package.json +0 -28
  68. package/src/vue/rollup.config.mjs +0 -44
  69. package/src/vue/tsconfig.json +0 -14
@@ -1,2 +0,0 @@
1
- declare const hello = "hello world";
2
- export default hello;
@@ -1,326 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { PropType } from 'vue';
4
- import SlimSelect, { Events } from '../slim-select';
5
- import { DataArrayPartial, Option } from '../slim-select/store';
6
- declare const _default: import("vue").DefineComponent<{
7
- modelValue: {
8
- type: PropType<string | string[] | undefined>;
9
- };
10
- multiple: {
11
- type: BooleanConstructor;
12
- default: boolean;
13
- };
14
- data: {
15
- type: PropType<DataArrayPartial>;
16
- };
17
- settings: {
18
- type: PropType<Partial<import("../slim-select/settings").default>>;
19
- };
20
- events: {
21
- type: PropType<Events>;
22
- };
23
- }, unknown, {
24
- slim: SlimSelect | null;
25
- }, {
26
- value: {
27
- get(): string | string[];
28
- set(value: string | string[]): void;
29
- };
30
- }, {
31
- getSlimSelect(): {
32
- selectEl: HTMLSelectElement;
33
- settings: {
34
- id: string;
35
- style: string;
36
- class: string[];
37
- isMultiple: boolean;
38
- isOpen: boolean;
39
- isFullOpen: boolean;
40
- intervalMove: {
41
- ref: () => NodeJS.Timeout;
42
- unref: () => NodeJS.Timeout;
43
- hasRef: () => boolean;
44
- refresh: () => NodeJS.Timeout;
45
- [Symbol.toPrimitive]: () => number;
46
- [Symbol.dispose]: () => void;
47
- } | null;
48
- disabled: boolean;
49
- alwaysOpen: boolean;
50
- showSearch: boolean;
51
- ariaLabel: string;
52
- searchPlaceholder: string;
53
- searchText: string;
54
- searchingText: string;
55
- searchHighlight: boolean;
56
- closeOnSelect: boolean;
57
- contentLocation: HTMLElement;
58
- contentPosition: "relative" | "absolute";
59
- openPosition: "auto" | "up" | "down";
60
- placeholderText: string;
61
- allowDeselect: boolean;
62
- hideSelected: boolean;
63
- keepOrder: boolean;
64
- showOptionTooltips: boolean;
65
- minSelected: number;
66
- maxSelected: number;
67
- timeoutDelay: number;
68
- maxValuesShown: number;
69
- maxValuesMessage: string;
70
- };
71
- select: {
72
- select: HTMLSelectElement;
73
- onValueChange?: ((value: string[]) => void) | undefined;
74
- onClassChange?: ((classes: string[]) => void) | undefined;
75
- onDisabledChange?: ((disabled: boolean) => void) | undefined;
76
- onOptionsChange?: ((data: DataArrayPartial) => void) | undefined;
77
- listen: boolean;
78
- enable: () => void;
79
- disable: () => void;
80
- hideUI: () => void;
81
- showUI: () => void;
82
- changeListen: (listen: boolean) => void;
83
- valueChange: (ev: Event) => boolean;
84
- getData: () => DataArrayPartial;
85
- getDataFromOptgroup: (optgroup: HTMLOptGroupElement) => import("../slim-select/store").OptgroupOptional;
86
- getDataFromOption: (option: HTMLOptionElement) => Option;
87
- getSelectedValues: () => string[];
88
- setSelected: (value: string[]) => void;
89
- updateSelect: (id?: string | undefined, style?: string | undefined, classes?: string[] | undefined) => void;
90
- updateOptions: (data: import("../slim-select/store").DataArray) => void;
91
- createOptgroup: (optgroup: import("../slim-select/store").Optgroup) => HTMLOptGroupElement;
92
- createOption: (info: Option) => HTMLOptionElement;
93
- destroy: () => void;
94
- };
95
- store: {
96
- validateDataArray: (data: DataArrayPartial | import("../slim-select/store").DataArray) => Error | null;
97
- validateOption: (option: import("../slim-select/store").OptionOptional | Option) => Error | null;
98
- partialToFullData: (data: DataArrayPartial) => import("../slim-select/store").DataArray;
99
- setData: (data: DataArrayPartial | import("../slim-select/store").DataArray) => void;
100
- getData: () => import("../slim-select/store").DataArray;
101
- getDataOptions: () => Option[];
102
- addOption: (option: import("../slim-select/store").OptionOptional) => void;
103
- setSelectedBy: (selectedType: "id" | "value", selectedValues: string[]) => void;
104
- getSelected: () => string[];
105
- getSelectedOptions: () => Option[];
106
- getSelectedIDs: () => string[];
107
- getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null;
108
- getOptionByID: (id: string) => Option | null;
109
- getSelectType: () => string;
110
- getFirstOption: () => Option | null;
111
- search: (search: string, searchFilter: (opt: Option, search: string) => boolean) => import("../slim-select/store").DataArray;
112
- filter: (filter: ((opt: Option) => boolean) | null, includeOptgroup: boolean) => import("../slim-select/store").DataArray;
113
- };
114
- render: {
115
- settings: {
116
- id: string;
117
- style: string;
118
- class: string[];
119
- isMultiple: boolean;
120
- isOpen: boolean;
121
- isFullOpen: boolean;
122
- intervalMove: {
123
- ref: () => NodeJS.Timeout;
124
- unref: () => NodeJS.Timeout;
125
- hasRef: () => boolean;
126
- refresh: () => NodeJS.Timeout;
127
- [Symbol.toPrimitive]: () => number;
128
- [Symbol.dispose]: () => void;
129
- } | null;
130
- disabled: boolean;
131
- alwaysOpen: boolean;
132
- showSearch: boolean;
133
- ariaLabel: string;
134
- searchPlaceholder: string;
135
- searchText: string;
136
- searchingText: string;
137
- searchHighlight: boolean;
138
- closeOnSelect: boolean;
139
- contentLocation: HTMLElement;
140
- contentPosition: "relative" | "absolute";
141
- openPosition: "auto" | "up" | "down";
142
- placeholderText: string;
143
- allowDeselect: boolean;
144
- hideSelected: boolean;
145
- keepOrder: boolean;
146
- showOptionTooltips: boolean;
147
- minSelected: number;
148
- maxSelected: number;
149
- timeoutDelay: number;
150
- maxValuesShown: number;
151
- maxValuesMessage: string;
152
- };
153
- store: {
154
- validateDataArray: (data: DataArrayPartial | import("../slim-select/store").DataArray) => Error | null;
155
- validateOption: (option: import("../slim-select/store").OptionOptional | Option) => Error | null;
156
- partialToFullData: (data: DataArrayPartial) => import("../slim-select/store").DataArray;
157
- setData: (data: DataArrayPartial | import("../slim-select/store").DataArray) => void;
158
- getData: () => import("../slim-select/store").DataArray;
159
- getDataOptions: () => Option[];
160
- addOption: (option: import("../slim-select/store").OptionOptional) => void;
161
- setSelectedBy: (selectedType: "id" | "value", selectedValues: string[]) => void;
162
- getSelected: () => string[];
163
- getSelectedOptions: () => Option[];
164
- getSelectedIDs: () => string[];
165
- getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null;
166
- getOptionByID: (id: string) => Option | null;
167
- getSelectType: () => string;
168
- getFirstOption: () => Option | null;
169
- search: (search: string, searchFilter: (opt: Option, search: string) => boolean) => import("../slim-select/store").DataArray;
170
- filter: (filter: ((opt: Option) => boolean) | null, includeOptgroup: boolean) => import("../slim-select/store").DataArray;
171
- };
172
- callbacks: {
173
- open: () => void;
174
- close: () => void;
175
- addable?: ((value: string) => string | false | import("../slim-select/store").OptionOptional | Promise<string | import("../slim-select/store").OptionOptional> | null | undefined) | undefined;
176
- setSelected: (value: string | string[], runAfterChange: boolean) => void;
177
- addOption: (option: Option) => void;
178
- search: (search: string) => void;
179
- beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined;
180
- afterChange?: ((newVal: Option[]) => void) | undefined;
181
- };
182
- main: {
183
- main: HTMLDivElement;
184
- values: HTMLDivElement;
185
- deselect: {
186
- main: HTMLDivElement;
187
- svg: SVGSVGElement;
188
- path: SVGPathElement;
189
- };
190
- arrow: {
191
- main: SVGSVGElement;
192
- path: SVGPathElement;
193
- };
194
- };
195
- content: {
196
- main: HTMLDivElement;
197
- search: {
198
- main: HTMLDivElement;
199
- input: HTMLInputElement;
200
- addable?: {
201
- main: HTMLDivElement;
202
- svg: SVGSVGElement;
203
- path: SVGPathElement;
204
- } | undefined;
205
- };
206
- list: HTMLDivElement;
207
- };
208
- classes: {
209
- main: string;
210
- placeholder: string;
211
- values: string;
212
- single: string;
213
- max: string;
214
- value: string;
215
- valueText: string;
216
- valueDelete: string;
217
- valueOut: string;
218
- deselect: string;
219
- deselectPath: string;
220
- arrow: string;
221
- arrowClose: string;
222
- arrowOpen: string;
223
- content: string;
224
- openAbove: string;
225
- openBelow: string;
226
- search: string;
227
- searchHighlighter: string;
228
- searching: string;
229
- addable: string;
230
- addablePath: string;
231
- list: string;
232
- optgroup: string;
233
- optgroupLabel: string;
234
- optgroupLabelText: string;
235
- optgroupActions: string;
236
- optgroupSelectAll: string;
237
- optgroupSelectAllBox: string;
238
- optgroupSelectAllCheck: string;
239
- optgroupClosable: string;
240
- option: string;
241
- optionDelete: string;
242
- highlighted: string;
243
- open: string;
244
- close: string;
245
- selected: string;
246
- error: string;
247
- disabled: string;
248
- hide: string;
249
- };
250
- enable: () => void;
251
- disable: () => void;
252
- open: () => void;
253
- close: () => void;
254
- updateClassStyles: () => void;
255
- updateAriaAttributes: () => void;
256
- mainDiv: () => import("../slim-select/render").Main;
257
- mainFocus: (eventType: string | null) => void;
258
- placeholder: () => HTMLDivElement;
259
- renderValues: () => void;
260
- multipleValue: (option: Option) => HTMLDivElement;
261
- contentDiv: () => import("../slim-select/render").Content;
262
- moveContent: () => void;
263
- searchDiv: () => import("../slim-select/render").Search;
264
- searchFocus: () => void;
265
- getOptions: (notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean) => HTMLDivElement[];
266
- highlight: (dir: "up" | "down") => void;
267
- listDiv: () => HTMLDivElement;
268
- renderError: (error: string) => void;
269
- renderSearching: () => void;
270
- renderOptions: (data: import("../slim-select/store").DataArray) => void;
271
- option: (option: Option) => HTMLDivElement;
272
- destroy: () => void;
273
- moveContentAbove: () => void;
274
- moveContentBelow: () => void;
275
- ensureElementInView: (container: HTMLElement, element: HTMLElement) => void;
276
- putContent: () => "up" | "down";
277
- updateDeselectAll: () => void;
278
- };
279
- events: {
280
- search?: ((searchValue: string, currentData: import("../slim-select/store").DataArray) => DataArrayPartial | Promise<DataArrayPartial>) | undefined;
281
- searchFilter?: ((option: Option, search: string) => boolean) | undefined;
282
- addable?: ((value: string) => string | false | import("../slim-select/store").OptionOptional | Promise<string | import("../slim-select/store").OptionOptional> | null | undefined) | undefined;
283
- beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined;
284
- afterChange?: ((newVal: Option[]) => void) | undefined;
285
- beforeOpen?: (() => void) | undefined;
286
- afterOpen?: (() => void) | undefined;
287
- beforeClose?: (() => void) | undefined;
288
- afterClose?: (() => void) | undefined;
289
- error?: ((err: Error) => void) | undefined;
290
- };
291
- enable: () => void;
292
- disable: () => void;
293
- getData: () => import("../slim-select/store").DataArray;
294
- setData: (data: DataArrayPartial) => void;
295
- getSelected: () => string[];
296
- setSelected: (value: string | string[], runAfterChange?: boolean) => void;
297
- addOption: (option: import("../slim-select/store").OptionOptional) => void;
298
- open: () => void;
299
- close: (eventType?: string | null) => void;
300
- search: (value: string) => void;
301
- destroy: () => void;
302
- } | null;
303
- getCleanValue(val: string | string[] | undefined): string | string[];
304
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
305
- modelValue: {
306
- type: PropType<string | string[] | undefined>;
307
- };
308
- multiple: {
309
- type: BooleanConstructor;
310
- default: boolean;
311
- };
312
- data: {
313
- type: PropType<DataArrayPartial>;
314
- };
315
- settings: {
316
- type: PropType<Partial<import("../slim-select/settings").default>>;
317
- };
318
- events: {
319
- type: PropType<Events>;
320
- };
321
- }>> & {
322
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
323
- }, {
324
- multiple: boolean;
325
- }, {}>;
326
- export default _default;
package/src/vue/hello.ts DELETED
@@ -1,5 +0,0 @@
1
- // This is only here to make the tsconfig.json happy
2
- // It didnt like there were no .ts files in the src/vue folder
3
-
4
- const hello = 'hello world'
5
- export default hello
@@ -1,28 +0,0 @@
1
- {
2
- "name": "@slim-select/vue",
3
- "private": false,
4
- "version": "1.6.0",
5
- "description": "Vue integration",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/brianvoe/slim-select.git"
9
- },
10
- "keywords": [
11
- "vue"
12
- ],
13
- "author": "Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",
14
- "homepage": "https://slimselectjs.com/frameworks#vue",
15
- "license": "MIT",
16
- "bugs": {
17
- "url": "https://github.com/brianvoe/slim-select/issues"
18
- },
19
- "type": "module",
20
- "main": "dist/slimselectvue.ssr.js",
21
- "browser": "dist/slimselect.global.js",
22
- "module": "dist/slimselectvue.es.js",
23
- "types": "dist/vue/slimselect.vue.d.ts",
24
- "scripts": {
25
- "build": "rollup -c rollup.config.mjs",
26
- "test": "echo \"Error: no test specified\" && exit 1"
27
- }
28
- }
@@ -1,44 +0,0 @@
1
- import vue from 'rollup-plugin-vue'
2
- import resolve from '@rollup/plugin-node-resolve'
3
- import typescript from 'rollup-plugin-typescript2'
4
-
5
- export default [
6
- // ESM build to be used with webpack/rollup.
7
- {
8
- input: './slimselect.vue',
9
- output: {
10
- format: 'es',
11
- file: './dist/slimselectvue.es.js',
12
- },
13
- external: ['vue', 'slim-select'],
14
- plugins: [resolve(), typescript({ clean: true }), vue()],
15
- },
16
-
17
- // SSR build.
18
- {
19
- input: './slimselect.vue',
20
- output: {
21
- exports: 'auto',
22
- format: 'cjs',
23
- file: './dist/slimselectvue.ssr.js',
24
- },
25
- external: ['vue', 'slim-select'],
26
- plugins: [resolve(), typescript({ clean: true }), vue({ template: { optimizeSSR: true } })],
27
- },
28
-
29
- // Browser build.
30
- {
31
- input: './slimselect.vue',
32
- output: {
33
- name: 'SlimSelectVue',
34
- format: 'iife',
35
- file: './dist/slimselectvue.global.js',
36
- globals: {
37
- vue: 'vue',
38
- 'slim-select': 'slim-select',
39
- },
40
- },
41
- external: ['vue', 'slim-select'],
42
- plugins: [resolve(), typescript({ clean: true }), vue()],
43
- },
44
- ]
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2016",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "strict": true /* Enable all strict type-checking options. */,
7
- "declaration": true /* Generates corresponding '.d.ts' file. */,
8
- "outDir": "./dist", // Output to dist folder
9
- "removeComments": true /* Do not emit comments to output. */,
10
- "importHelpers": true /* Import emit helpers from 'tslib'. */
11
- },
12
- "include": ["./*.ts", "./*.vue"],
13
- "exclude": ["../slim-select/*"]
14
- }