@kws3/ui 2.1.3 → 2.2.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.
- package/CHANGELOG.mdx +10 -0
- package/controls/NumberInput.svelte +10 -3
- package/forms/AutoComplete.svelte +8 -1
- package/forms/select/MultiSelect.svelte +7 -1
- package/forms/select/SearchableSelect.svelte +7 -0
- package/helpers/ScrollableList.svelte +19 -1
- package/package.json +2 -2
- package/styles/ActionSheet.scss +8 -1
- package/styles/CheckRadio.scss +8 -2
- package/types/index.d.ts +2 -0
- package/types/type-defs/index.d.ts +2 -0
package/CHANGELOG.mdx
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# 2.2.0
|
|
2
|
+
- Fix bug where `ScrollableList` component puts extra padding on top of list when fast scroll to top
|
|
3
|
+
- `ScrollableList` - Fix bug to reset internal positioning props when data changes
|
|
4
|
+
- fix Popperjs position strategy to work better on mobile by default, affects `SearchableSelect`, `MultiSelect` and `AutoComplete` components
|
|
5
|
+
- `ActionSheet` - Update styling to make it wokr better visually on desktop
|
|
6
|
+
|
|
7
|
+
# 2.1.4
|
|
8
|
+
- Fix bug where disabled `Checkbox` components wrongly appeared as if they were checked
|
|
9
|
+
- Allow adding CSS classes to the input field in `NumberInput` component
|
|
10
|
+
|
|
1
11
|
# 2.1.3
|
|
2
12
|
- `PasswordInput` - add support for field `autocomplete` and `required`
|
|
3
13
|
- `PasswordValidator` - fix `valid` field binding
|
|
@@ -14,6 +14,7 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
|
|
|
14
14
|
@param {boolean} [disabled=false] - Disables the NumberInput, Default: `false`
|
|
15
15
|
@param {boolean} [fullwidth=false] - Forces the NumberInput to occupy the full width of it's container, Default: `false`
|
|
16
16
|
@param {boolean} [typeable=true] - Allows typing the value into the input, Default: `true`
|
|
17
|
+
@param {string} [input_class=""] - Adds a css class to the input field, Default: `""`
|
|
17
18
|
@param {string} [minus_icon="minus"] - Name of the icon that is to be displayed in the minus button, Default: `"minus"`
|
|
18
19
|
@param {ColorOptions} [minus_icon_color=danger] - Color of the Minus Icon, Default: `danger`
|
|
19
20
|
@param {ColorOptions} [minus_button_color=] - Color of the Minus Button, Default: ``
|
|
@@ -35,8 +36,8 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
|
|
|
35
36
|
<input
|
|
36
37
|
{style}
|
|
37
38
|
data-testid="input"
|
|
38
|
-
class="input has-text-centered {klass} is-{size} is-{value <
|
|
39
|
-
|
|
39
|
+
class="input has-text-centered {klass} {input_class} is-{size} is-{value <
|
|
40
|
+
min || value > max
|
|
40
41
|
? 'danger'
|
|
41
42
|
: ''}"
|
|
42
43
|
type="number"
|
|
@@ -67,8 +68,10 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
|
|
|
67
68
|
</div>
|
|
68
69
|
<div class="control is-{fullwidth ? 'expanded' : 'narrow'}">
|
|
69
70
|
<input
|
|
71
|
+
style="z-index:1"
|
|
70
72
|
data-testid="input"
|
|
71
|
-
class="input has-text-centered is-{size} is-{value <
|
|
73
|
+
class="input has-text-centered {input_class} is-{size} is-{value <
|
|
74
|
+
min || value > max
|
|
72
75
|
? 'danger'
|
|
73
76
|
: ''}"
|
|
74
77
|
type="number"
|
|
@@ -172,6 +175,10 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
|
|
|
172
175
|
* Allows typing the value into the input
|
|
173
176
|
*/
|
|
174
177
|
typeable = true,
|
|
178
|
+
/**
|
|
179
|
+
* Adds a css class to the input field
|
|
180
|
+
*/
|
|
181
|
+
input_class = "",
|
|
175
182
|
/**
|
|
176
183
|
* Name of the icon that is to be displayed in the minus button
|
|
177
184
|
*/
|
|
@@ -139,6 +139,7 @@ Default value: `<span>{option.label}</span>`
|
|
|
139
139
|
/**
|
|
140
140
|
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
141
141
|
* @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
|
|
142
|
+
* @typedef {import('@kws3/ui/types').PopperStrategies} PopperStrategies
|
|
142
143
|
*/
|
|
143
144
|
|
|
144
145
|
/**
|
|
@@ -213,6 +214,12 @@ Default value: `<span>{option.label}</span>`
|
|
|
213
214
|
*/
|
|
214
215
|
export let disabled = false;
|
|
215
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Placement strategy used by Popperjs, see popperjs docs
|
|
219
|
+
* @type {PopperStrategies}
|
|
220
|
+
*/
|
|
221
|
+
export let popper_strategy = "absolute";
|
|
222
|
+
|
|
216
223
|
/**
|
|
217
224
|
* Where to render the dropdown list.
|
|
218
225
|
* Can be a DOM element or a `string` with the CSS selector of the element.
|
|
@@ -330,7 +337,7 @@ Default value: `<span>{option.label}</span>`
|
|
|
330
337
|
|
|
331
338
|
onMount(() => {
|
|
332
339
|
POPPER = createPopper(el, dropdown, {
|
|
333
|
-
strategy:
|
|
340
|
+
strategy: popper_strategy,
|
|
334
341
|
placement: "bottom-start",
|
|
335
342
|
// @ts-ignore
|
|
336
343
|
modifiers: [sameWidthPopperModifier],
|
|
@@ -202,6 +202,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
202
202
|
/**
|
|
203
203
|
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
204
204
|
* @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
|
|
205
|
+
* @typedef {import('@kws3/ui/types').PopperStrategies} PopperStrategies
|
|
205
206
|
*/
|
|
206
207
|
|
|
207
208
|
/**
|
|
@@ -292,6 +293,11 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
292
293
|
* Icon used to mark selected items in dropdown list
|
|
293
294
|
*/
|
|
294
295
|
export let selected_icon = "check";
|
|
296
|
+
/**
|
|
297
|
+
* Placement strategy used by Popperjs, see popperjs docs
|
|
298
|
+
* @type {PopperStrategies}
|
|
299
|
+
*/
|
|
300
|
+
export let popper_strategy = "absolute";
|
|
295
301
|
/**
|
|
296
302
|
* Shows only the number of items selected, instead of listing all the selected items in the input.
|
|
297
303
|
*/
|
|
@@ -524,7 +530,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
524
530
|
|
|
525
531
|
onMount(() => {
|
|
526
532
|
POPPER = createPopper(el, dropdown, {
|
|
527
|
-
strategy:
|
|
533
|
+
strategy: popper_strategy,
|
|
528
534
|
placement: "bottom-start",
|
|
529
535
|
// @ts-ignore
|
|
530
536
|
modifiers: [sameWidthPopperModifier],
|
|
@@ -62,6 +62,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
62
62
|
{remove_all_tip}
|
|
63
63
|
async_search_prompt={value ? "Backspace to clear" : async_search_prompt}
|
|
64
64
|
{no_options_msg}
|
|
65
|
+
{popper_strategy}
|
|
65
66
|
{dropdown_portal}
|
|
66
67
|
on:change={change}
|
|
67
68
|
on:blur={blur}
|
|
@@ -87,6 +88,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
87
88
|
/**
|
|
88
89
|
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
89
90
|
* @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
|
|
91
|
+
* @typedef {import('@kws3/ui/types').PopperStrategies} PopperStrategies
|
|
90
92
|
*/
|
|
91
93
|
|
|
92
94
|
/**
|
|
@@ -169,6 +171,11 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
169
171
|
* Tooltip text for the Clear selection button
|
|
170
172
|
*/
|
|
171
173
|
export let remove_all_tip = "Clear Selection";
|
|
174
|
+
/**
|
|
175
|
+
* Placement strategy used by Popperjs, see popperjs docs
|
|
176
|
+
* @type {PopperStrategies}
|
|
177
|
+
*/
|
|
178
|
+
export let popper_strategy = "absolute";
|
|
172
179
|
/**
|
|
173
180
|
* Where to render the dropdown list.
|
|
174
181
|
* Can be a DOM element or a `string` with the CSS selector of the element.
|
|
@@ -31,7 +31,9 @@ while more items are loading
|
|
|
31
31
|
on:resize={resize}>
|
|
32
32
|
<div
|
|
33
33
|
bind:this={contents}
|
|
34
|
-
style="padding-top: {
|
|
34
|
+
style="padding-top: {start === 0
|
|
35
|
+
? 0
|
|
36
|
+
: top}px; padding-bottom: {bottom}px;">
|
|
35
37
|
{#each visible as item (item.index)}
|
|
36
38
|
<div class="row">
|
|
37
39
|
<!--Default slot for list view items-->
|
|
@@ -142,6 +144,7 @@ while more items are loading
|
|
|
142
144
|
|
|
143
145
|
// whenever `items` changes, invalidate the current heightmap
|
|
144
146
|
$: items, viewport_height, item_height, mounted, refresh();
|
|
147
|
+
$: items, reset();
|
|
145
148
|
|
|
146
149
|
async function refresh() {
|
|
147
150
|
if (!mounted) return;
|
|
@@ -232,4 +235,19 @@ while more items are loading
|
|
|
232
235
|
rows = contents.getElementsByClassName("row");
|
|
233
236
|
mounted = true;
|
|
234
237
|
});
|
|
238
|
+
|
|
239
|
+
function reset() {
|
|
240
|
+
if (!mounted) return;
|
|
241
|
+
if (!items.length || items.length < items_count) {
|
|
242
|
+
item_height = null;
|
|
243
|
+
start = 0;
|
|
244
|
+
end = 0;
|
|
245
|
+
items_count = 0;
|
|
246
|
+
top = 0;
|
|
247
|
+
bottom = 0;
|
|
248
|
+
average_height;
|
|
249
|
+
padStart = 0;
|
|
250
|
+
padEnd = 0;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
235
253
|
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kws3/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "UI components for use with Svelte v3 applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"svelte": "index.js",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"typescript": "^5.0.4"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "c65de99beeacf8cd4eee98bcc5cf82319fe086bf"
|
|
39
39
|
}
|
package/styles/ActionSheet.scss
CHANGED
|
@@ -17,13 +17,20 @@ $kws-actionsheet-box-radius: $radius !default;
|
|
|
17
17
|
box-shadow: $kws-actionsheet-box-shadow;
|
|
18
18
|
position: fixed;
|
|
19
19
|
bottom: 0;
|
|
20
|
-
left: 0;
|
|
21
20
|
width: 100%;
|
|
22
21
|
max-height: 90%;
|
|
23
22
|
min-height: fit-content;
|
|
23
|
+
max-width: 650px;
|
|
24
|
+
margin: 0 auto;
|
|
24
25
|
background: $kws-actionsheet-background;
|
|
25
26
|
transition: all 0.3s;
|
|
26
27
|
z-index: 50;
|
|
27
28
|
padding: 1.25em 1.5em;
|
|
28
29
|
overflow-x: auto;
|
|
29
30
|
}
|
|
31
|
+
@include mobile {
|
|
32
|
+
.kws-action-sheet {
|
|
33
|
+
left: 0;
|
|
34
|
+
max-width: 100%;
|
|
35
|
+
}
|
|
36
|
+
}
|
package/styles/CheckRadio.scss
CHANGED
|
@@ -130,10 +130,16 @@ $kws-checkradio-focus-box-shadow-color: $input-focus-box-shadow-color !default;
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
input[type="checkbox"]:disabled + .kws-checkbox-label,
|
|
134
|
-
input[type="radio"]:disabled + .kws-checkbox-label,
|
|
135
133
|
input[type="checkbox"]:disabled ~ .icon,
|
|
136
134
|
input[type="radio"]:disabled ~ .icon {
|
|
135
|
+
opacity: 0;
|
|
136
|
+
cursor: not-allowed;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
input[type="checkbox"]:disabled + .kws-checkbox-label,
|
|
140
|
+
input[type="radio"]:disabled + .kws-checkbox-label,
|
|
141
|
+
input[type="checkbox"]:checked:disabled ~ .icon,
|
|
142
|
+
input[type="radio"]:checked:disabled ~ .icon {
|
|
137
143
|
opacity: 0.5;
|
|
138
144
|
cursor: not-allowed;
|
|
139
145
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
FontFamilies,
|
|
8
8
|
FloatiePositions,
|
|
9
9
|
TippyPositions,
|
|
10
|
+
PopperStrategies,
|
|
10
11
|
} from "./type-defs";
|
|
11
12
|
|
|
12
13
|
export type ColorOptions = (typeof Colors)[number];
|
|
@@ -17,6 +18,7 @@ export type FontFamilies = (typeof FontFamilies)[number];
|
|
|
17
18
|
export type Positions = (typeof Positions)[number];
|
|
18
19
|
export type TippyPositions = (typeof TippyPositions)[number];
|
|
19
20
|
export type FloatiePositions = (typeof FloatiePositions)[number];
|
|
21
|
+
export type PopperStrategies = (typeof PopperStrategies)[number];
|
|
20
22
|
|
|
21
23
|
export type FloatieType = {
|
|
22
24
|
create: (opts: object) => { props: object; destroy: () => void };
|