@kws3/ui 2.1.4 → 2.2.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.
- package/CHANGELOG.mdx +14 -1
- package/canvas/ESignature.svelte +9 -10
- package/charts/Chart.svelte +7 -0
- package/forms/AutoComplete.svelte +9 -1
- package/forms/select/MultiSelect.svelte +8 -1
- package/forms/select/SearchableSelect.svelte +8 -0
- package/helpers/Icon.svelte +16 -2
- package/helpers/ScrollableList.svelte +19 -1
- package/package.json +2 -2
- package/styles/ActionSheet.scss +8 -1
- package/types/index.d.ts +3 -1
- package/types/type-defs/index.d.ts +2 -0
package/CHANGELOG.mdx
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
# 2.2.1
|
|
2
|
+
- `Icon` fix icon sizes when line-awesome icons are loaded
|
|
3
|
+
- `Icon` fix material icons when icon family is set globally
|
|
4
|
+
- `Icon` add support for adding custom icon families
|
|
5
|
+
- `Chart` fix, ensure ApexCharts is loaded before trying to initialise it
|
|
6
|
+
|
|
7
|
+
# 2.2.0
|
|
8
|
+
- Fix bug where `ScrollableList` component puts extra padding on top of list when fast scroll to top
|
|
9
|
+
- `ScrollableList` - Fix bug to reset internal positioning props when data changes
|
|
10
|
+
- fix Popperjs position strategy to work better on mobile by default, affects `SearchableSelect`, `MultiSelect` and `AutoComplete` components
|
|
11
|
+
- `ActionSheet` - Update styling to make it wokr better visually on desktop
|
|
12
|
+
|
|
1
13
|
# 2.1.4
|
|
2
|
-
- Fix bug where disabled Checkbox components wrongly appeared as if they were checked
|
|
14
|
+
- Fix bug where disabled `Checkbox` components wrongly appeared as if they were checked
|
|
15
|
+
- Allow adding CSS classes to the input field in `NumberInput` component
|
|
3
16
|
|
|
4
17
|
# 2.1.3
|
|
5
18
|
- `PasswordInput` - add support for field `autocomplete` and `required`
|
package/canvas/ESignature.svelte
CHANGED
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
@param {string} [background_image=""] - Background image for the canvas, Default: `""`
|
|
10
10
|
@param {boolean} [readonly=false] - Determines whether canvas is readonly or not, Default: `false`
|
|
11
11
|
@param {boolean} [disabled=false] - Determines whether canvas is disabled or not, Default: `false`
|
|
12
|
-
@param {string} [expand_from="center"] - The direction
|
|
13
|
-
|
|
14
|
-
@param {
|
|
15
|
-
|
|
12
|
+
@param {string} [expand_from="center"] - The direction from which the canvas should expand.
|
|
13
|
+
'top', 'bottom', 'left', 'right', 'center' and also 'n%', Default: `"center"`
|
|
14
|
+
@param {string} [expand_to="center"] - The direction to which the canvas should expand.
|
|
15
|
+
'top', 'bottom', 'left', 'right', 'center' and also 'n%', Default: `"center"`
|
|
16
|
+
@param {number} [expand_scale=50] - Transform scale of the canvas on expansion
|
|
17
|
+
value in percentage %, Default: `50`
|
|
16
18
|
@param {Extract<Positions, 'start'|'center'|'end'>} [control_position=center] - Default position of controls, Default: `center`
|
|
19
|
+
@param {array} [actions=[]] - List of actions toolbar, Default: `[]`
|
|
17
20
|
|
|
18
21
|
-->
|
|
19
22
|
<Canvas
|
|
@@ -91,11 +94,7 @@
|
|
|
91
94
|
/**
|
|
92
95
|
* List of actions toolbar
|
|
93
96
|
*/
|
|
94
|
-
actions = [
|
|
95
|
-
"undo",
|
|
96
|
-
"redo",
|
|
97
|
-
"reset",
|
|
98
|
-
];
|
|
97
|
+
actions = ["undo", "redo", "reset"];
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
let tools = { Pen };
|
|
101
100
|
</script>
|
package/charts/Chart.svelte
CHANGED
|
@@ -116,6 +116,13 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
const init = () => {
|
|
119
|
+
if (!ApexCharts) {
|
|
120
|
+
// `init()` was probably called from reactive functions instead of `onMount`.
|
|
121
|
+
// All those calls can be ignored, because when `onMount` calls it,
|
|
122
|
+
// it will have the latest data and config
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
119
126
|
chart && chart.destroy();
|
|
120
127
|
|
|
121
128
|
if (typeof window !== "undefined") {
|
|
@@ -22,6 +22,7 @@ Fuzzy match will not work if `search` function is set, as the backend service is
|
|
|
22
22
|
@param {string} [style=""] - Inline CSS for input container, Default: `""`
|
|
23
23
|
@param {boolean} [readonly=false] - Marks component as read-only, Default: `false`
|
|
24
24
|
@param {boolean} [disabled=false] - Disables the component, Default: `false`
|
|
25
|
+
@param {PopperStrategies} [popper_strategy=absolute] - Placement strategy used by Popperjs, see popperjs docs, Default: `absolute`
|
|
25
26
|
@param {HTMLElement|string} [dropdown_portal=undefined] - Where to render the dropdown list.
|
|
26
27
|
Can be a DOM element or a `string` with the CSS selector of the element.
|
|
27
28
|
|
|
@@ -139,6 +140,7 @@ Default value: `<span>{option.label}</span>`
|
|
|
139
140
|
/**
|
|
140
141
|
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
141
142
|
* @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
|
|
143
|
+
* @typedef {import('@kws3/ui/types').PopperStrategies} PopperStrategies
|
|
142
144
|
*/
|
|
143
145
|
|
|
144
146
|
/**
|
|
@@ -213,6 +215,12 @@ Default value: `<span>{option.label}</span>`
|
|
|
213
215
|
*/
|
|
214
216
|
export let disabled = false;
|
|
215
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Placement strategy used by Popperjs, see popperjs docs
|
|
220
|
+
* @type {PopperStrategies}
|
|
221
|
+
*/
|
|
222
|
+
export let popper_strategy = "absolute";
|
|
223
|
+
|
|
216
224
|
/**
|
|
217
225
|
* Where to render the dropdown list.
|
|
218
226
|
* Can be a DOM element or a `string` with the CSS selector of the element.
|
|
@@ -330,7 +338,7 @@ Default value: `<span>{option.label}</span>`
|
|
|
330
338
|
|
|
331
339
|
onMount(() => {
|
|
332
340
|
POPPER = createPopper(el, dropdown, {
|
|
333
|
-
strategy:
|
|
341
|
+
strategy: popper_strategy,
|
|
334
342
|
placement: "bottom-start",
|
|
335
343
|
// @ts-ignore
|
|
336
344
|
modifiers: [sameWidthPopperModifier],
|
|
@@ -30,6 +30,7 @@ Fuzzy match will not work if `search` function is set, as the backend service is
|
|
|
30
30
|
@param {boolean} [readonly=false] - Marks component as read-only, Default: `false`
|
|
31
31
|
@param {boolean} [disabled=false] - Disables the component, Default: `false`
|
|
32
32
|
@param {string} [selected_icon="check"] - Icon used to mark selected items in dropdown list, Default: `"check"`
|
|
33
|
+
@param {PopperStrategies} [popper_strategy=absolute] - Placement strategy used by Popperjs, see popperjs docs, Default: `absolute`
|
|
33
34
|
@param {boolean} [summary_mode=false] - Shows only the number of items selected, instead of listing all the selected items in the input., Default: `false`
|
|
34
35
|
@param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
|
|
35
36
|
@param {string} [async_search_prompt="Start typing to search..."] - Message to display in dropdown when async search can be performed, Default: `"Start typing to search..."`
|
|
@@ -202,6 +203,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
202
203
|
/**
|
|
203
204
|
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
204
205
|
* @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
|
|
206
|
+
* @typedef {import('@kws3/ui/types').PopperStrategies} PopperStrategies
|
|
205
207
|
*/
|
|
206
208
|
|
|
207
209
|
/**
|
|
@@ -292,6 +294,11 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
292
294
|
* Icon used to mark selected items in dropdown list
|
|
293
295
|
*/
|
|
294
296
|
export let selected_icon = "check";
|
|
297
|
+
/**
|
|
298
|
+
* Placement strategy used by Popperjs, see popperjs docs
|
|
299
|
+
* @type {PopperStrategies}
|
|
300
|
+
*/
|
|
301
|
+
export let popper_strategy = "absolute";
|
|
295
302
|
/**
|
|
296
303
|
* Shows only the number of items selected, instead of listing all the selected items in the input.
|
|
297
304
|
*/
|
|
@@ -524,7 +531,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
524
531
|
|
|
525
532
|
onMount(() => {
|
|
526
533
|
POPPER = createPopper(el, dropdown, {
|
|
527
|
-
strategy:
|
|
534
|
+
strategy: popper_strategy,
|
|
528
535
|
placement: "bottom-start",
|
|
529
536
|
// @ts-ignore
|
|
530
537
|
modifiers: [sameWidthPopperModifier],
|
|
@@ -27,6 +27,7 @@ Fuzzy match will not work if `search` function is set, as the backend service is
|
|
|
27
27
|
@param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
|
|
28
28
|
@param {string} [async_search_prompt="Start typing to search..."] - Message to display in dropdown when async search can be performed, Default: `"Start typing to search..."`
|
|
29
29
|
@param {string} [remove_all_tip="Clear Selection"] - Tooltip text for the Clear selection button, Default: `"Clear Selection"`
|
|
30
|
+
@param {PopperStrategies} [popper_strategy=absolute] - Placement strategy used by Popperjs, see popperjs docs, Default: `absolute`
|
|
30
31
|
@param {HTMLElement|string} [dropdown_portal=undefined] - Where to render the dropdown list.
|
|
31
32
|
Can be a DOM element or a `string` with the CSS selector of the element.
|
|
32
33
|
|
|
@@ -62,6 +63,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
62
63
|
{remove_all_tip}
|
|
63
64
|
async_search_prompt={value ? "Backspace to clear" : async_search_prompt}
|
|
64
65
|
{no_options_msg}
|
|
66
|
+
{popper_strategy}
|
|
65
67
|
{dropdown_portal}
|
|
66
68
|
on:change={change}
|
|
67
69
|
on:blur={blur}
|
|
@@ -87,6 +89,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
87
89
|
/**
|
|
88
90
|
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
89
91
|
* @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
|
|
92
|
+
* @typedef {import('@kws3/ui/types').PopperStrategies} PopperStrategies
|
|
90
93
|
*/
|
|
91
94
|
|
|
92
95
|
/**
|
|
@@ -169,6 +172,11 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
169
172
|
* Tooltip text for the Clear selection button
|
|
170
173
|
*/
|
|
171
174
|
export let remove_all_tip = "Clear Selection";
|
|
175
|
+
/**
|
|
176
|
+
* Placement strategy used by Popperjs, see popperjs docs
|
|
177
|
+
* @type {PopperStrategies}
|
|
178
|
+
*/
|
|
179
|
+
export let popper_strategy = "absolute";
|
|
172
180
|
/**
|
|
173
181
|
* Where to render the dropdown list.
|
|
174
182
|
* Can be a DOM element or a `string` with the CSS selector of the element.
|
package/helpers/Icon.svelte
CHANGED
|
@@ -22,6 +22,17 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: ``
|
|
|
22
22
|
</span>
|
|
23
23
|
|
|
24
24
|
<style>
|
|
25
|
+
.fa-lg {
|
|
26
|
+
font-size: 1.33333333em;
|
|
27
|
+
line-height: 0.75em;
|
|
28
|
+
vertical-align: -15%;
|
|
29
|
+
}
|
|
30
|
+
.fa-2x {
|
|
31
|
+
font-size: 2em;
|
|
32
|
+
}
|
|
33
|
+
.fa-3x {
|
|
34
|
+
font-size: 3em;
|
|
35
|
+
}
|
|
25
36
|
.icon .gg {
|
|
26
37
|
transform: scale(0.75);
|
|
27
38
|
}
|
|
@@ -117,7 +128,7 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: ``
|
|
|
117
128
|
internal_size,
|
|
118
129
|
usedFamily;
|
|
119
130
|
|
|
120
|
-
$: inner_icon =
|
|
131
|
+
$: inner_icon = usedFamily === "material" ? icon : "";
|
|
121
132
|
$: {
|
|
122
133
|
usedFamily = family !== "" ? family : globalFamily ? globalFamily : "fa";
|
|
123
134
|
|
|
@@ -140,9 +151,12 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: ``
|
|
|
140
151
|
case "material":
|
|
141
152
|
familyClass = "material-icons material-symbols-outlined ";
|
|
142
153
|
break;
|
|
143
|
-
|
|
154
|
+
case "fa":
|
|
144
155
|
familyClass = "fa fa-";
|
|
145
156
|
break;
|
|
157
|
+
default:
|
|
158
|
+
familyClass = usedFamily + "-";
|
|
159
|
+
break;
|
|
146
160
|
}
|
|
147
161
|
}
|
|
148
162
|
|
|
@@ -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.1
|
|
3
|
+
"version": "2.2.1",
|
|
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": "e4e822a3de295420c1f1cdd832a1fca80b94683f"
|
|
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/types/index.d.ts
CHANGED
|
@@ -7,16 +7,18 @@ 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];
|
|
13
14
|
export type SizeOptions = (typeof Sizes)[number];
|
|
14
15
|
export type ExtendedColorOptions = (typeof ExtendedColors)[number];
|
|
15
16
|
export type BGColorOptions = (typeof BGColors)[number];
|
|
16
|
-
export type FontFamilies = (typeof FontFamilies)[number];
|
|
17
|
+
export type FontFamilies = (typeof FontFamilies)[number] | String;
|
|
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 };
|