@kws3/ui 1.9.1 → 2.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.
- package/CHANGELOG.mdx +76 -48
- package/buttons/ConfirmButton.svelte +11 -3
- package/buttons/DeleteButton.svelte +2 -3
- package/buttons/ProcessButton.svelte +3 -4
- package/buttons/SubmitButton.svelte +11 -3
- package/charts/AreaChart.svelte +1 -1
- package/charts/BarChart.svelte +1 -1
- package/charts/Chart.svelte +1 -0
- package/charts/DonutChart.svelte +1 -1
- package/charts/LineChart.svelte +1 -1
- package/charts/MixedChart.svelte +1 -1
- package/charts/PieChart.svelte +1 -1
- package/charts/RadialChart.svelte +1 -1
- package/charts/utils.js +1 -0
- package/controls/Checkbox.svelte +10 -4
- package/controls/FileUpload.svelte +14 -8
- package/controls/NumberInput.svelte +19 -10
- package/controls/Radio.svelte +8 -2
- package/controls/RangeSlider.svelte +8 -2
- package/controls/Toggle.svelte +9 -2
- package/controls/ToggleButtons.svelte +10 -3
- package/datagrid/DataSearch/DataSearch.svelte +1 -1
- package/datagrid/GridView/GridCell.svelte +3 -0
- package/datagrid/GridView/GridRow.svelte +15 -0
- package/datagrid/GridView/GridView.svelte +21 -3
- package/datagrid/Pagination/Pagination.svelte +3 -3
- package/datagrid/TileView/TileView.svelte +46 -5
- package/datagrid/TileView/TileViewItem.svelte +4 -0
- package/form/index.js +160 -0
- package/forms/AutoComplete.svelte +126 -76
- package/forms/Datepicker.svelte +22 -5
- package/forms/PasswordValidator/PasswordValidator.svelte +8 -8
- package/forms/PasswordValidator/validatePassword.js +13 -2
- package/forms/SearchInput.svelte +180 -0
- package/forms/Timepicker.svelte +69 -4
- package/forms/actions.js +21 -15
- package/forms/colorpicker/Colorpicker.js +28 -3
- package/forms/colorpicker/Colorpicker.svelte +2 -2
- package/forms/select/MultiSelect.svelte +103 -46
- package/forms/select/SearchableSelect.svelte +6 -5
- package/helpers/CardModal.svelte +2 -1
- package/helpers/ClipboardCopier.svelte +4 -1
- package/helpers/Dialog/Dialog.svelte +13 -8
- package/helpers/Dialog/index.js +6 -0
- package/helpers/Divider.svelte +2 -2
- package/helpers/FloatingUI/Floatie.svelte +6 -6
- package/helpers/FloatingUI/index.js +2 -1
- package/helpers/Icon.svelte +25 -9
- package/helpers/Loader.svelte +10 -3
- package/helpers/Message.svelte +2 -2
- package/helpers/Modal.svelte +2 -1
- package/helpers/Notification.svelte +1 -1
- package/helpers/Popover.svelte +4 -4
- package/helpers/ScrollableList.svelte +12 -8
- package/helpers/Skeleton.svelte +4 -1
- package/helpers/Timeline/Timeline.svelte +1 -1
- package/helpers/Timeline/TimelineItem.svelte +5 -5
- package/helpers/Tooltip.js +1 -1
- package/index.js +10 -4
- package/internal/fuzzy.js +116 -0
- package/internal/index.js +27 -0
- package/internal/scrollIntoActiveElement.js +22 -0
- package/keyboard/index.js +94 -0
- package/package.json +6 -4
- package/{utils/resizeObserver.js → resizeObserver/index.js} +0 -0
- package/search/index.js +52 -0
- package/settings.js +1 -1
- package/sliding-panes/SlidingPane.svelte +1 -4
- package/styles/AutoComplete.scss +2 -1
- package/styles/Datepicker.scss +1 -1
- package/styles/Grid.scss +14 -0
- package/styles/Select.scss +2 -1
- package/transitions/components/Scale.svelte +1 -0
- package/transitions/components/getEasing.js +18 -5
- package/types/ambient.d.ts +16 -0
- package/types/index.d.ts +46 -0
- package/types/type-defs/index.ts +14 -0
- package/utils/index.js +110 -9
- package/utils/fuzzysearch.js +0 -20
- package/utils/keyboard-events.js +0 -32
|
@@ -12,8 +12,8 @@ Used to populate the list of options in the dropdown, Default: `[]`
|
|
|
12
12
|
this property of each object will be searched, Default: `"name"`
|
|
13
13
|
@param {string} [value_key="id"] - If `options` is an array of objects,
|
|
14
14
|
this property of each object will be returned as the value, Default: `"id"`
|
|
15
|
-
@param {''|'small'|'medium'|'large'} [size=""] - Size of the input, Default: `""`
|
|
16
|
-
@param {''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [color=""] - Color of the input, Default: `""`
|
|
15
|
+
@param {string|''|'small'|'medium'|'large'} [size=""] - Size of the input, Default: `""`
|
|
16
|
+
@param {string|''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [color=""] - Color of the input, Default: `""`
|
|
17
17
|
@param {string} [style=""] - Inline CSS for input container, Default: `""`
|
|
18
18
|
@param {boolean} [readonly=false] - Marks component as read-only, Default: `false`
|
|
19
19
|
@param {function|null} [search=null] - Async function to fetch options
|
|
@@ -88,6 +88,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
88
88
|
* Value of the Input
|
|
89
89
|
*
|
|
90
90
|
* This property can be bound to, to fetch the current value
|
|
91
|
+
* @type {object}
|
|
91
92
|
*/
|
|
92
93
|
export let value = null;
|
|
93
94
|
/**
|
|
@@ -112,12 +113,12 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
112
113
|
export let value_key = "id";
|
|
113
114
|
/**
|
|
114
115
|
* Size of the input
|
|
115
|
-
* @type {''
|
|
116
|
+
* @type {import('@kws3/ui/types').SizeOptions}
|
|
116
117
|
*/
|
|
117
118
|
export let size = "";
|
|
118
119
|
/**
|
|
119
120
|
* Color of the input
|
|
120
|
-
* @type {''
|
|
121
|
+
* @type {import('@kws3/ui/types').ColorOptions}
|
|
121
122
|
*/
|
|
122
123
|
export let color = "";
|
|
123
124
|
/**
|
|
@@ -140,7 +141,7 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
140
141
|
/**
|
|
141
142
|
* Filtered options to be displayed strictly based on search text or perform a fuzzy match.
|
|
142
143
|
* Fuzzy match will not work if `search` function is set, as the backend service is meant to do the matching.
|
|
143
|
-
* @type {'fuzzy'|'strict'}
|
|
144
|
+
* @type {string|'fuzzy'|'strict'}
|
|
144
145
|
*/
|
|
145
146
|
export let search_strategy = "fuzzy";
|
|
146
147
|
/**
|
package/helpers/CardModal.svelte
CHANGED
|
@@ -37,6 +37,7 @@ Only visible when the
|
|
|
37
37
|
<div
|
|
38
38
|
transition:scale={{
|
|
39
39
|
duration: transitionDuration,
|
|
40
|
+
// @ts-ignore
|
|
40
41
|
from: 0.8,
|
|
41
42
|
to: 1,
|
|
42
43
|
delay: transitionDelay,
|
|
@@ -116,7 +117,7 @@ Only visible when the
|
|
|
116
117
|
export let title = "",
|
|
117
118
|
/**
|
|
118
119
|
* Size of the modal
|
|
119
|
-
* @type {'
|
|
120
|
+
* @type {import('@kws3/ui/types').SizeOptions}
|
|
120
121
|
*/
|
|
121
122
|
size = "small",
|
|
122
123
|
/**
|
|
@@ -41,6 +41,9 @@ If `''` is selected, Icon will not change colour after copying, Default: `"succe
|
|
|
41
41
|
import { tick } from "svelte";
|
|
42
42
|
import { Icon } from "@kws3/ui";
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
46
|
+
*/
|
|
44
47
|
/**
|
|
45
48
|
* Default tooltip text
|
|
46
49
|
*/
|
|
@@ -70,7 +73,7 @@ If `''` is selected, Icon will not change colour after copying, Default: `"succe
|
|
|
70
73
|
*
|
|
71
74
|
* If `''` is selected, Icon will not change colour after copying
|
|
72
75
|
*
|
|
73
|
-
* @type {''
|
|
76
|
+
* @type {import('@kws3/ui/types').ColorOptions}
|
|
74
77
|
*/
|
|
75
78
|
copied_icon_color = "success";
|
|
76
79
|
|
|
@@ -87,12 +87,17 @@ For internal use only - not part of config object, Default: `""`
|
|
|
87
87
|
|
|
88
88
|
<script>
|
|
89
89
|
import { tick, onMount, createEventDispatcher } from "svelte";
|
|
90
|
-
import { Icon } from "@kws3/ui";
|
|
91
|
-
import {
|
|
92
|
-
import { isEnterKey, isEscKey
|
|
90
|
+
import { Icon, CardModal } from "@kws3/ui";
|
|
91
|
+
import { capitaliseFirstLetter } from "@kws3/ui/utils";
|
|
92
|
+
import { isEnterKey, isEscKey } from "../../internal";
|
|
93
93
|
|
|
94
94
|
const fire = createEventDispatcher();
|
|
95
95
|
|
|
96
|
+
/**
|
|
97
|
+
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
98
|
+
* @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
|
|
99
|
+
*/
|
|
100
|
+
|
|
96
101
|
/**
|
|
97
102
|
* Title text of the Dialog box
|
|
98
103
|
* @type {string}
|
|
@@ -104,7 +109,7 @@ For internal use only - not part of config object, Default: `""`
|
|
|
104
109
|
help_text = "",
|
|
105
110
|
/**
|
|
106
111
|
* Size of the Dialog box
|
|
107
|
-
* @type {
|
|
112
|
+
* @type {SizeOptions}
|
|
108
113
|
*/
|
|
109
114
|
size = "small",
|
|
110
115
|
/**
|
|
@@ -118,12 +123,12 @@ For internal use only - not part of config object, Default: `""`
|
|
|
118
123
|
icon = "",
|
|
119
124
|
/**
|
|
120
125
|
* Color of the Icon in the Dialog box
|
|
121
|
-
* @type {
|
|
126
|
+
* @type {ColorOptions}
|
|
122
127
|
*/
|
|
123
128
|
icon_color = "primary",
|
|
124
129
|
/**
|
|
125
130
|
* Size of the Icon in the Dialog box
|
|
126
|
-
* @type {
|
|
131
|
+
* @type {SizeOptions}
|
|
127
132
|
*/
|
|
128
133
|
icon_size = "",
|
|
129
134
|
/**
|
|
@@ -132,7 +137,7 @@ For internal use only - not part of config object, Default: `""`
|
|
|
132
137
|
ok_button_text = "Ok",
|
|
133
138
|
/**
|
|
134
139
|
* Color of OK button
|
|
135
|
-
* @type {
|
|
140
|
+
* @type {ColorOptions} ok_button_color
|
|
136
141
|
*/
|
|
137
142
|
ok_button_color = "primary",
|
|
138
143
|
/**
|
|
@@ -146,7 +151,7 @@ For internal use only - not part of config object, Default: `""`
|
|
|
146
151
|
cancel_button_text = "Cancel",
|
|
147
152
|
/**
|
|
148
153
|
* Color of Cancel button
|
|
149
|
-
* @type {
|
|
154
|
+
* @type {ColorOptions}
|
|
150
155
|
*/
|
|
151
156
|
cancel_button_color = "",
|
|
152
157
|
/**
|
package/helpers/Dialog/index.js
CHANGED
|
@@ -4,16 +4,19 @@ function createDialog(msg, props) {
|
|
|
4
4
|
props = Object.assign(props, { _text: msg });
|
|
5
5
|
|
|
6
6
|
const promise = new Promise((fulfil) => {
|
|
7
|
+
//@ts-ignore
|
|
7
8
|
const dialog = new Dialog({
|
|
8
9
|
target: document.body,
|
|
9
10
|
props,
|
|
10
11
|
intro: true,
|
|
11
12
|
});
|
|
12
13
|
|
|
14
|
+
//@ts-ignore
|
|
13
15
|
dialog.$on("_done", ({ detail }) => {
|
|
14
16
|
fulfil(detail);
|
|
15
17
|
//Does not outro out because of
|
|
16
18
|
//https://github.com/sveltejs/svelte/issues/4056
|
|
19
|
+
//@ts-ignore
|
|
17
20
|
dialog.$destroy();
|
|
18
21
|
});
|
|
19
22
|
});
|
|
@@ -39,8 +42,11 @@ export function confirm(msg, props) {
|
|
|
39
42
|
return createDialog(msg, props);
|
|
40
43
|
}
|
|
41
44
|
|
|
45
|
+
//@ts-ignore
|
|
42
46
|
Dialog.alert = alert;
|
|
47
|
+
//@ts-ignore
|
|
43
48
|
Dialog.confirm = confirm;
|
|
49
|
+
//@ts-ignore
|
|
44
50
|
Dialog.prompt = prompt;
|
|
45
51
|
|
|
46
52
|
export default Dialog;
|
package/helpers/Divider.svelte
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<script>
|
|
26
26
|
/**
|
|
27
27
|
* Color of the Divider lines
|
|
28
|
-
* @type {''
|
|
28
|
+
* @type {import('@kws3/ui/types').ColorOptions}
|
|
29
29
|
*/
|
|
30
30
|
export let color = "",
|
|
31
31
|
/**
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
vertical = false,
|
|
39
39
|
/**
|
|
40
40
|
* Alignment of the Divider text. `top`/`left` and `bottom`/`right` are analogous for vertical Dividers
|
|
41
|
-
* @type {'center' | 'left' | 'right' | 'top' | 'bottom'}
|
|
41
|
+
* @type {string|'center' | 'left' | 'right' | 'top' | 'bottom'}
|
|
42
42
|
*/
|
|
43
43
|
alignment = "center",
|
|
44
44
|
/**
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
@param {boolean} [light=false] - Inverted colors for notification box and contents, Default: `false`
|
|
11
11
|
@param {boolean} [dismissable=true] - Determines if notification is dismissable, Default: `true`
|
|
12
12
|
@param {boolean} [persistent=false] - A persistent notification without duration, stays till dismissed, Default: `false`
|
|
13
|
-
@param {string} [context=""] - Context value, Default: `""`
|
|
14
13
|
@param {object} [component=null] - Custom component, Default: `null`
|
|
15
14
|
@param {function} [beforeClose(props)] - Callback function call before close event
|
|
16
15
|
@param {function} [afterClose(props)] - Callback function call after close event
|
|
@@ -66,6 +65,10 @@
|
|
|
66
65
|
|
|
67
66
|
const fire = createEventDispatcher();
|
|
68
67
|
|
|
68
|
+
/**
|
|
69
|
+
* @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
|
|
70
|
+
*/
|
|
71
|
+
|
|
69
72
|
/**
|
|
70
73
|
* Title/Heading of the notification
|
|
71
74
|
*/
|
|
@@ -85,7 +88,7 @@
|
|
|
85
88
|
duration = 3000,
|
|
86
89
|
/**
|
|
87
90
|
* Toast notification background color
|
|
88
|
-
* @type {
|
|
91
|
+
* @type {ColorOptions}
|
|
89
92
|
*/
|
|
90
93
|
color = "primary",
|
|
91
94
|
/**
|
|
@@ -100,10 +103,6 @@
|
|
|
100
103
|
* A persistent notification without duration, stays till dismissed
|
|
101
104
|
*/
|
|
102
105
|
persistent = false,
|
|
103
|
-
/**
|
|
104
|
-
* Context value
|
|
105
|
-
*/
|
|
106
|
-
context = "",
|
|
107
106
|
/**
|
|
108
107
|
* Custom component
|
|
109
108
|
*/
|
|
@@ -131,6 +130,7 @@
|
|
|
131
130
|
let defaults = { text: "Ok", color: "", click: () => {} },
|
|
132
131
|
obj = b;
|
|
133
132
|
if (typeof b == "string") {
|
|
133
|
+
// @ts-ignore
|
|
134
134
|
obj = { text: b };
|
|
135
135
|
}
|
|
136
136
|
return Object.assign({}, defaults, obj);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import FloatingUIOutput from "./FloatingUIOutput.svelte";
|
|
2
2
|
import { writable, get } from "svelte/store";
|
|
3
3
|
import {
|
|
4
4
|
defaultToastPlacement,
|
|
@@ -19,6 +19,7 @@ function ensureOutputIsOnPage() {
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
//@ts-ignore
|
|
22
23
|
OUTPUT_IS_ON_PAGE = new FloatingUIOutput({
|
|
23
24
|
target: document.body,
|
|
24
25
|
});
|
package/helpers/Icon.svelte
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
@component
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
@param {''|'small'|'medium'|'large'} [size=""] - Size of the Icon, Default: `""`
|
|
6
|
-
@param {''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [color=""] - Color of the Icon, Default: `""`
|
|
5
|
+
@param {string|''|'small'|'medium'|'large'} [size=""] - Size of the Icon, Default: `""`
|
|
6
|
+
@param {string|''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [color=""] - Color of the Icon, Default: `""`
|
|
7
7
|
@param {string} [icon=""] - The name of the icon that is to be displayed, from the relevant icon family, Default: `""`
|
|
8
|
-
@param {''|'fa'|'lar'|'las'|'gg'|'unicons'} [family=""] - Icon family, can be modified globally in framework settings
|
|
8
|
+
@param {string|''|'fa'|'lar'|'las'|'gg'|'unicons'|'material'} [family=""] - Icon family, can be modified globally in framework settings
|
|
9
9
|
|
|
10
10
|
Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
|
|
11
11
|
@param {string} [style=""] - Inline CSS for icon container, Default: `""`
|
|
@@ -18,7 +18,7 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
|
|
|
18
18
|
<span class="icon is-{size} has-text-{color} {klass}" {style}>
|
|
19
19
|
<i
|
|
20
20
|
class="icon-i {familyClass}{icon} {internal_size} {inner_class}"
|
|
21
|
-
style={inner_style}
|
|
21
|
+
style={inner_style}>{inner_icon}</i>
|
|
22
22
|
</span>
|
|
23
23
|
|
|
24
24
|
<style>
|
|
@@ -47,6 +47,19 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
|
|
|
47
47
|
.icon .uil.fa-3x {
|
|
48
48
|
font-size: 3em;
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
.icon .material-icons {
|
|
52
|
+
font-size: 1.25em;
|
|
53
|
+
}
|
|
54
|
+
.icon .material-icons.fa-lg {
|
|
55
|
+
font-size: 1.5em;
|
|
56
|
+
}
|
|
57
|
+
.icon .material-icons.fa-2x {
|
|
58
|
+
font-size: 2em;
|
|
59
|
+
}
|
|
60
|
+
.icon .material-icons.fa-3x {
|
|
61
|
+
font-size: 3em;
|
|
62
|
+
}
|
|
50
63
|
</style>
|
|
51
64
|
|
|
52
65
|
<script>
|
|
@@ -54,12 +67,12 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
|
|
|
54
67
|
|
|
55
68
|
/**
|
|
56
69
|
* Size of the Icon
|
|
57
|
-
* @type {''
|
|
70
|
+
* @type {import('@kws3/ui/types').SizeOptions}
|
|
58
71
|
*/
|
|
59
72
|
export let size = "",
|
|
60
73
|
/**
|
|
61
74
|
* Color of the Icon
|
|
62
|
-
* @type {''|'
|
|
75
|
+
* @type {import('@kws3/ui/types').ColorOptions | 'grey'}
|
|
63
76
|
*/
|
|
64
77
|
color = "",
|
|
65
78
|
/**
|
|
@@ -70,7 +83,7 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
|
|
|
70
83
|
* Icon family, can be modified globally in framework settings
|
|
71
84
|
*
|
|
72
85
|
* Ultimately defaults to `fa`, if family is not set anywhere
|
|
73
|
-
* @type {''|'fa'|'lar'|'las'|'gg'|'unicons'}
|
|
86
|
+
* @type {string|''|'fa'|'lar'|'las'|'gg'|'unicons'|'material'}
|
|
74
87
|
*/
|
|
75
88
|
family = "",
|
|
76
89
|
/**
|
|
@@ -97,9 +110,9 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
|
|
|
97
110
|
internal_size,
|
|
98
111
|
usedFamily;
|
|
99
112
|
|
|
113
|
+
$: inner_icon = family === "material" ? icon : "";
|
|
100
114
|
$: {
|
|
101
|
-
usedFamily =
|
|
102
|
-
family && family !== "" ? family : globalFamily ? globalFamily : "fa";
|
|
115
|
+
usedFamily = family !== "" ? family : globalFamily ? globalFamily : "fa";
|
|
103
116
|
|
|
104
117
|
switch (usedFamily) {
|
|
105
118
|
case "lar":
|
|
@@ -117,6 +130,9 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
|
|
|
117
130
|
case "unicons":
|
|
118
131
|
familyClass = "uil uil-";
|
|
119
132
|
break;
|
|
133
|
+
case "material":
|
|
134
|
+
familyClass = "material-icons material-symbols-outlined ";
|
|
135
|
+
break;
|
|
120
136
|
default:
|
|
121
137
|
familyClass = "fa fa-";
|
|
122
138
|
break;
|
package/helpers/Loader.svelte
CHANGED
|
@@ -31,20 +31,27 @@ The overlay is absolutely positioned. Ensure that the parent container is relati
|
|
|
31
31
|
</div>
|
|
32
32
|
|
|
33
33
|
<script>
|
|
34
|
+
/**
|
|
35
|
+
|
|
36
|
+
* @typedef {import('@kws3/ui/types').SpinnerColorOptions} SpinnerColorOptions
|
|
37
|
+
* @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
|
|
38
|
+
* @typedef {import('@kws3/ui/types').BGColorOptions} BGColorOptions
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
34
41
|
/**
|
|
35
42
|
* Color of the Spinner
|
|
36
43
|
* @link https://bulma.io/documentation/helpers/color-helpers/
|
|
37
|
-
* @type {
|
|
44
|
+
* @type {SpinnerColorOptions}
|
|
38
45
|
*/
|
|
39
46
|
export let spinner_color = "grey",
|
|
40
47
|
/**
|
|
41
48
|
* Size of the Spinner
|
|
42
|
-
* @type {
|
|
49
|
+
* @type {SizeOptions}
|
|
43
50
|
*/
|
|
44
51
|
spinner_size = "medium",
|
|
45
52
|
/**
|
|
46
53
|
* Backgound color of the Spinner container
|
|
47
|
-
* @type {
|
|
54
|
+
* @type {BGColorOptions}
|
|
48
55
|
*/
|
|
49
56
|
background_color = "transparent",
|
|
50
57
|
/**
|
package/helpers/Message.svelte
CHANGED
|
@@ -70,12 +70,12 @@ The parent can then decide what to do with the component
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Size of the Message
|
|
73
|
-
* @type {''
|
|
73
|
+
* @type {import('@kws3/ui/types').SizeOptions}
|
|
74
74
|
*/
|
|
75
75
|
export let size = "",
|
|
76
76
|
/**
|
|
77
77
|
* Color of the Message box
|
|
78
|
-
* @type {''|'
|
|
78
|
+
* @type {import('@kws3/ui/types').ColorOptions | 'grey'}
|
|
79
79
|
*/
|
|
80
80
|
color = "info",
|
|
81
81
|
/**
|
package/helpers/Modal.svelte
CHANGED
|
@@ -29,6 +29,7 @@ Only programmatic closing is possible, Default: `true`
|
|
|
29
29
|
<div
|
|
30
30
|
transition:scale={{
|
|
31
31
|
duration: transitionDuration,
|
|
32
|
+
// @ts-ignore
|
|
32
33
|
from: 0.8,
|
|
33
34
|
to: 1,
|
|
34
35
|
delay: transitionDelay,
|
|
@@ -75,7 +76,7 @@ Only programmatic closing is possible, Default: `true`
|
|
|
75
76
|
import { hasTransitions } from "../settings";
|
|
76
77
|
/**
|
|
77
78
|
* Size of the modal
|
|
78
|
-
* @type {'
|
|
79
|
+
* @type {import('@kws3/ui/types').SizeOptions}
|
|
79
80
|
*/
|
|
80
81
|
export let size = "small",
|
|
81
82
|
/**
|
|
@@ -35,7 +35,7 @@ The parent can then decide what to do with the component
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Color of the Notification box
|
|
38
|
-
* @type {''
|
|
38
|
+
* @type {import('@kws3/ui/types').ColorOptions}
|
|
39
39
|
*/
|
|
40
40
|
export let color = "info";
|
|
41
41
|
|
package/helpers/Popover.svelte
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
@param {string} [icon="info-circle"] - Icon used when default slot has no content, Default: `"info-circle"`
|
|
6
|
-
@param {''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [icon_color="primary"] - Colour of the trigger icon displayed when default slot has no content, Default: `"primary"`
|
|
7
|
-
@param {''|'small'|'medium'|'large'} [icon_size="small"] - Size of the trigger icon displayed when default slot has no content, Default: `"small"`
|
|
6
|
+
@param {string|''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [icon_color="primary"] - Colour of the trigger icon displayed when default slot has no content, Default: `"primary"`
|
|
7
|
+
@param {string|''|'small'|'medium'|'large'} [icon_size="small"] - Size of the trigger icon displayed when default slot has no content, Default: `"small"`
|
|
8
8
|
@param {string} [trigger="click"] - Determines the events that cause the Popover to show. Multiple event names are separated by spaces.
|
|
9
9
|
|
|
10
10
|
**Examples:** `click`, `mouseenter`, `mouseenter focus`
|
|
@@ -85,12 +85,12 @@ It can be any CSS value associated with `max-width` property, including `"none"`
|
|
|
85
85
|
export let icon = "info-circle";
|
|
86
86
|
/**
|
|
87
87
|
* Colour of the trigger icon displayed when default slot has no content
|
|
88
|
-
* @type {''|'
|
|
88
|
+
* @type {import('@kws3/ui/types').ColorOptions | 'grey'}
|
|
89
89
|
*/
|
|
90
90
|
export let icon_color = "primary";
|
|
91
91
|
/**
|
|
92
92
|
* Size of the trigger icon displayed when default slot has no content
|
|
93
|
-
* @type {''
|
|
93
|
+
* @type {import('@kws3/ui/types').SizeOptions}
|
|
94
94
|
*/
|
|
95
95
|
export let icon_size = "small";
|
|
96
96
|
/**
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
@param {number} [start=0] - First item index rendered inside viewport - readonly, Default: `0`
|
|
9
9
|
@param {number} [end=0] - Last item index rendered inside viewport - readonly, Default: `0`
|
|
10
10
|
@param {number} [end_threshold=10] - `end` event will be fired when the list reaches this many items before the end of the list., Default: `10`
|
|
11
|
+
@param {number} [padding_threshold=5] - render 'n' number of items on outside the viewport (top and bottom) to avoid visible glitches on scrolling., Default: `5`
|
|
11
12
|
@param {string} [style=""] - Inline CSS for scroller container, Default: `""`
|
|
12
13
|
@param {string} [class=""] - CSS classes for scroller container, Default: `""`
|
|
13
14
|
|
|
@@ -77,10 +78,7 @@ while more items are loading
|
|
|
77
78
|
<script>
|
|
78
79
|
import { onMount, tick } from "svelte";
|
|
79
80
|
import { createEventDispatcher } from "svelte";
|
|
80
|
-
import {
|
|
81
|
-
resizeObserver,
|
|
82
|
-
hasResizeObserver,
|
|
83
|
-
} from "@kws3/ui/utils/resizeObserver";
|
|
81
|
+
import { resizeObserver, hasResizeObserver } from "@kws3/ui/resizeObserver";
|
|
84
82
|
|
|
85
83
|
const fire = createEventDispatcher();
|
|
86
84
|
/**
|
|
@@ -108,6 +106,10 @@ while more items are loading
|
|
|
108
106
|
* `end` event will be fired when the list reaches this many items before the end of the list.
|
|
109
107
|
*/
|
|
110
108
|
end_threshold = 10,
|
|
109
|
+
/**
|
|
110
|
+
* render 'n' number of items on outside the viewport (top and bottom) to avoid visible glitches on scrolling.
|
|
111
|
+
*/
|
|
112
|
+
padding_threshold = 5,
|
|
111
113
|
/**
|
|
112
114
|
* Inline CSS for scroller container
|
|
113
115
|
*/
|
|
@@ -132,9 +134,11 @@ while more items are loading
|
|
|
132
134
|
average_height,
|
|
133
135
|
items_count = 0;
|
|
134
136
|
|
|
135
|
-
$:
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
$: padStart = start > padding_threshold ? start - padding_threshold : start;
|
|
138
|
+
$: padEnd = end + padding_threshold;
|
|
139
|
+
$: visible = items
|
|
140
|
+
.slice(padStart, padEnd)
|
|
141
|
+
.map((data, i) => ({ index: i + padStart, data }));
|
|
138
142
|
|
|
139
143
|
// whenever `items` changes, invalidate the current heightmap
|
|
140
144
|
$: items, viewport_height, item_height, mounted, refresh();
|
|
@@ -176,7 +180,7 @@ while more items are loading
|
|
|
176
180
|
const row_height = height_map[i] || average_height;
|
|
177
181
|
if (y + row_height > scrollTop) {
|
|
178
182
|
start = i;
|
|
179
|
-
top = y;
|
|
183
|
+
top = y - row_height * padding_threshold;
|
|
180
184
|
break;
|
|
181
185
|
}
|
|
182
186
|
y += row_height;
|
package/helpers/Skeleton.svelte
CHANGED
|
@@ -25,6 +25,9 @@ If this is set to `true`, the `radius` property will be ignored., Default: `fals
|
|
|
25
25
|
{/each}
|
|
26
26
|
|
|
27
27
|
<script>
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {import('@kws3/ui/types').BGColorOptions} BGColorOptions
|
|
30
|
+
*/
|
|
28
31
|
export let /**
|
|
29
32
|
* Number of lines of text to display.
|
|
30
33
|
*/
|
|
@@ -51,7 +54,7 @@ If this is set to `true`, the `radius` property will be ignored., Default: `fals
|
|
|
51
54
|
circle = false,
|
|
52
55
|
/**
|
|
53
56
|
* Color of the Skeleton lines
|
|
54
|
-
* @type {
|
|
57
|
+
* @type {BGColorOptions}
|
|
55
58
|
*/
|
|
56
59
|
color = "";
|
|
57
60
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
@param {''|'dark' | 'light' | 'warning' | 'info' | 'danger' | 'primary' | 'success'} [color="primary"] - Color of marker and border, Default: `"primary"`
|
|
6
|
-
@param {string} [marker_icon="
|
|
7
|
-
@param {string} [marker_image="
|
|
6
|
+
@param {string} [marker_icon=""] - Any icon name accepted by the Icon component, icon will be placed inside the marker, Default: `"null"`
|
|
7
|
+
@param {string} [marker_image=""] - Any image URL, the image will be placed inside the marker, Default: `"null"`
|
|
8
8
|
@param {string} [class=""] - CSS classes for the TimelineItem container, Default: `""`
|
|
9
9
|
|
|
10
10
|
### Slots
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Color of marker and border
|
|
51
|
-
* @type {''
|
|
51
|
+
* @type {import('@kws3/ui/types').ColorOptions}
|
|
52
52
|
*/
|
|
53
53
|
export let color = "primary";
|
|
54
54
|
/**
|
|
55
55
|
* Any icon name accepted by the Icon component, icon will be placed inside the marker
|
|
56
56
|
* @type {string}
|
|
57
57
|
*/
|
|
58
|
-
export let marker_icon =
|
|
58
|
+
export let marker_icon = "";
|
|
59
59
|
/**
|
|
60
60
|
* Any image URL, the image will be placed inside the marker
|
|
61
61
|
* @type {string}
|
|
62
62
|
*/
|
|
63
|
-
export let marker_image =
|
|
63
|
+
export let marker_image = "";
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* CSS classes for the TimelineItem container
|
package/helpers/Tooltip.js
CHANGED
|
@@ -5,7 +5,7 @@ import tippy, { delegate } from "tippy.js";
|
|
|
5
5
|
* @param {string} container - CSS selector of container
|
|
6
6
|
* @param {object} opts - tooltip options
|
|
7
7
|
*/
|
|
8
|
-
export function activateTooltips(container, opts) {
|
|
8
|
+
export function activateTooltips(container, opts = {}) {
|
|
9
9
|
let _opts = Object.assign(
|
|
10
10
|
{
|
|
11
11
|
target: "[data-tooltip]",
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { applySettings } from "./settings";
|
|
1
|
+
export { applySettings } from "./settings.js";
|
|
2
2
|
|
|
3
|
-
export { activateTooltips, tooltip, popover } from "./helpers/Tooltip";
|
|
3
|
+
export { activateTooltips, tooltip, popover } from "./helpers/Tooltip.js";
|
|
4
4
|
export { default as Popover } from "./helpers/Popover.svelte";
|
|
5
5
|
export { default as Icon } from "./helpers/Icon.svelte";
|
|
6
6
|
export { default as Message } from "./helpers/Message.svelte";
|
|
@@ -18,13 +18,18 @@ export { default as TimelineHeader } from "./helpers/Timeline/TimelineHeader.sve
|
|
|
18
18
|
export { default as Nl2br } from "./helpers/Nl2br.svelte";
|
|
19
19
|
export { default as ClipboardCopier } from "./helpers/ClipboardCopier.svelte";
|
|
20
20
|
export { default as ScrollableList } from "./helpers/ScrollableList.svelte";
|
|
21
|
-
export {
|
|
21
|
+
export {
|
|
22
|
+
alert,
|
|
23
|
+
confirm,
|
|
24
|
+
prompt,
|
|
25
|
+
default as Dialog,
|
|
26
|
+
} from "./helpers/Dialog/index.js";
|
|
22
27
|
export {
|
|
23
28
|
Notifications,
|
|
24
29
|
Toasts,
|
|
25
30
|
Snackbars,
|
|
26
31
|
FloatiesStore,
|
|
27
|
-
} from "./helpers/FloatingUI";
|
|
32
|
+
} from "./helpers/FloatingUI/index.js";
|
|
28
33
|
export { default as FloatingUIOutput } from "./helpers/FloatingUI/FloatingUIOutput.svelte";
|
|
29
34
|
export { default as Floatie } from "./helpers/FloatingUI/Floatie.svelte";
|
|
30
35
|
export { portal } from "svelte-portal";
|
|
@@ -56,6 +61,7 @@ export { default as MaskedInput } from "./forms/MaskedInput.svelte";
|
|
|
56
61
|
export { default as Colorpicker } from "./forms/colorpicker/Colorpicker.svelte";
|
|
57
62
|
export { default as Datepicker } from "./forms/Datepicker.svelte";
|
|
58
63
|
export { default as Timepicker } from "./forms/Timepicker.svelte";
|
|
64
|
+
export { default as SearchInput } from "./forms/SearchInput.svelte";
|
|
59
65
|
export { datepicker as DatepickerAction } from "./forms/actions.js";
|
|
60
66
|
export { timepicker as TimepickerAction } from "./forms/actions.js";
|
|
61
67
|
export { default as PasswordValidator } from "./forms/PasswordValidator/PasswordValidator.svelte";
|