@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.
Files changed (80) hide show
  1. package/CHANGELOG.mdx +76 -48
  2. package/buttons/ConfirmButton.svelte +11 -3
  3. package/buttons/DeleteButton.svelte +2 -3
  4. package/buttons/ProcessButton.svelte +3 -4
  5. package/buttons/SubmitButton.svelte +11 -3
  6. package/charts/AreaChart.svelte +1 -1
  7. package/charts/BarChart.svelte +1 -1
  8. package/charts/Chart.svelte +1 -0
  9. package/charts/DonutChart.svelte +1 -1
  10. package/charts/LineChart.svelte +1 -1
  11. package/charts/MixedChart.svelte +1 -1
  12. package/charts/PieChart.svelte +1 -1
  13. package/charts/RadialChart.svelte +1 -1
  14. package/charts/utils.js +1 -0
  15. package/controls/Checkbox.svelte +10 -4
  16. package/controls/FileUpload.svelte +14 -8
  17. package/controls/NumberInput.svelte +19 -10
  18. package/controls/Radio.svelte +8 -2
  19. package/controls/RangeSlider.svelte +8 -2
  20. package/controls/Toggle.svelte +9 -2
  21. package/controls/ToggleButtons.svelte +10 -3
  22. package/datagrid/DataSearch/DataSearch.svelte +1 -1
  23. package/datagrid/GridView/GridCell.svelte +3 -0
  24. package/datagrid/GridView/GridRow.svelte +15 -0
  25. package/datagrid/GridView/GridView.svelte +21 -3
  26. package/datagrid/Pagination/Pagination.svelte +3 -3
  27. package/datagrid/TileView/TileView.svelte +46 -5
  28. package/datagrid/TileView/TileViewItem.svelte +4 -0
  29. package/form/index.js +160 -0
  30. package/forms/AutoComplete.svelte +126 -76
  31. package/forms/Datepicker.svelte +22 -5
  32. package/forms/PasswordValidator/PasswordValidator.svelte +8 -8
  33. package/forms/PasswordValidator/validatePassword.js +13 -2
  34. package/forms/SearchInput.svelte +180 -0
  35. package/forms/Timepicker.svelte +69 -4
  36. package/forms/actions.js +21 -15
  37. package/forms/colorpicker/Colorpicker.js +28 -3
  38. package/forms/colorpicker/Colorpicker.svelte +2 -2
  39. package/forms/select/MultiSelect.svelte +103 -46
  40. package/forms/select/SearchableSelect.svelte +6 -5
  41. package/helpers/CardModal.svelte +2 -1
  42. package/helpers/ClipboardCopier.svelte +4 -1
  43. package/helpers/Dialog/Dialog.svelte +13 -8
  44. package/helpers/Dialog/index.js +6 -0
  45. package/helpers/Divider.svelte +2 -2
  46. package/helpers/FloatingUI/Floatie.svelte +6 -6
  47. package/helpers/FloatingUI/index.js +2 -1
  48. package/helpers/Icon.svelte +25 -9
  49. package/helpers/Loader.svelte +10 -3
  50. package/helpers/Message.svelte +2 -2
  51. package/helpers/Modal.svelte +2 -1
  52. package/helpers/Notification.svelte +1 -1
  53. package/helpers/Popover.svelte +4 -4
  54. package/helpers/ScrollableList.svelte +12 -8
  55. package/helpers/Skeleton.svelte +4 -1
  56. package/helpers/Timeline/Timeline.svelte +1 -1
  57. package/helpers/Timeline/TimelineItem.svelte +5 -5
  58. package/helpers/Tooltip.js +1 -1
  59. package/index.js +10 -4
  60. package/internal/fuzzy.js +116 -0
  61. package/internal/index.js +27 -0
  62. package/internal/scrollIntoActiveElement.js +22 -0
  63. package/keyboard/index.js +94 -0
  64. package/package.json +6 -4
  65. package/{utils/resizeObserver.js → resizeObserver/index.js} +0 -0
  66. package/search/index.js +52 -0
  67. package/settings.js +1 -1
  68. package/sliding-panes/SlidingPane.svelte +1 -4
  69. package/styles/AutoComplete.scss +2 -1
  70. package/styles/Datepicker.scss +1 -1
  71. package/styles/Grid.scss +14 -0
  72. package/styles/Select.scss +2 -1
  73. package/transitions/components/Scale.svelte +1 -0
  74. package/transitions/components/getEasing.js +18 -5
  75. package/types/ambient.d.ts +16 -0
  76. package/types/index.d.ts +46 -0
  77. package/types/type-defs/index.ts +14 -0
  78. package/utils/index.js +110 -9
  79. package/utils/fuzzysearch.js +0 -20
  80. package/utils/keyboard-events.js +0 -32
package/CHANGELOG.mdx CHANGED
@@ -1,3 +1,31 @@
1
+ ## 2.0.0
2
+ - Add support for custom CSS classes for the table in `GridView` component
3
+ - Add support for displaying `GridView` table rows in a compact manner using `is_narrow` prop.
4
+ - Vertically center all rows by default in `GridView`.
5
+ - Add support for custom CSS classes for the wrapper in `TileView` component
6
+ - Add support for variable number of items per row in `TileView` component via `fluid_items_per_row` prop
7
+ - Fix keyboard scrolling issue on `AutoComplete`,`MultiSelect` and `SearchableSelect` component
8
+ - Fix `time_24hr` reactivity issue on `Timepicker`
9
+ - Expose `min_time`, `max_time` from `Timepicker`
10
+ - Expose `readonly` from `Datepicker` and `Timepicker` to prevent calendar opening on focus.
11
+ - New `SearchInput` component: search on multiple keys at the same time.
12
+ - Deprecated `@kws3/ui/utils/fuzzysearch` and `@kws3/ui/utils/some_module`.
13
+ - Expose factory function `makeSearchEngine` from `@kws3/ui/search`
14
+ - Expose `truncate`, `nl2br`, `cloneObject`, `rAF`, `debounce`, `capitaliseFirstLetter`, `createDate`, `currency`, `dateToOrdinal`, `randomIntegerFromInterval`, `randomPercent`, `fileDownloader` from `@kws3/ui/utils`.
15
+ - Expose keyboard events of `enter`, `tab`, `escape`, `space`, `leftarrow`, `rightarrow`, `downarrow`, `uparrow`, `backspace`, `del` from `@kws3/ui/keyboard`.
16
+ - Expose `hasResizeObserver`, `resizeObserver` from `@kws3/ui/resizeObserver`
17
+ - New utility `makeForms` exposed from `@kws3\ui\form`
18
+ - Add support for material symbols icon pack from https://fonts.google.com/icons
19
+ - Baby steps towards typings
20
+
21
+ ## 1.9.3
22
+ - Bug fix with fuzzy.js initial config hoisting
23
+
24
+ ## 1.9.2
25
+ - Bug fix with fuzzy.js and Vite prebundling
26
+ - Debounce fuzzy searches
27
+ - Expose `@kws3/ui/utils/fuzzysearch` as a reusable function
28
+
1
29
  ## 1.9.1
2
30
  - `SearchableSelect` and `MultiSelect`: match colors of dropdown area to theme color when dropdown area is inside a `Portal`
3
31
  - `AutoComplete`: match colors of dropdown area to theme color when dropdown area is inside a `Portal`
@@ -11,7 +39,7 @@
11
39
  - New `AutoComplete` component
12
40
  - Make options text size match the input `size` in `MultiSelect` and `SearchableSelect`.
13
41
  - Prevent default arrow up/down behaviour on `MultiSelect` and `SearchableSelect` when options dropdown is open.
14
-
42
+
15
43
  ## 1.8.3
16
44
  - Allow `clickableRows` and `bulk_actions` to work at the same time on `GridView`
17
45
  - Various bugfixes on `GridRow`
@@ -23,7 +51,7 @@
23
51
  - New `input_only`, `force_integer`, `style` and `class` props for `NumberInput`
24
52
  - Forward `focus`, `blur` input events for `NumberInput`
25
53
  - Use custom version of `fuzzysearch` for `SearchableSelect` and `MultiSelect`
26
-
54
+
27
55
  ## 1.8.1
28
56
  - New `ScrollableList` component
29
57
 
@@ -38,7 +66,7 @@
38
66
  - Added support for subscribing to chart events
39
67
  - Added support for distributed bar charts using new `distributed` prop on `BarChart` component
40
68
  - Added examples for leveraging advanced chart features
41
-
69
+
42
70
  ## 1.7.3
43
71
  - Fix docs for `Popover`
44
72
  - Increase performance for `SlidingPane` by using ResizeObserver when available
@@ -56,92 +84,92 @@
56
84
  - Added linting rules for ESLint. And corrected all resulting issues.
57
85
 
58
86
  ## 1.7.0
59
- - Ensure uniform usage of `$kws-theme-colors` across all components, this means `$kws-theme-colors` can be independent of the global `$colors` SCSS variable.
60
- - `DataSearch` component: Expand filters to fill area when main search input is not present.
61
- - `DataSort` component: Increase click area for activating dropdown, and provide visual segementation between label and dropdown.
62
- - New `Skeleton` component.
87
+ - Ensure uniform usage of `$kws-theme-colors` across all components, this means `$kws-theme-colors` can be independent of the global `$colors` SCSS variable.
88
+ - `DataSearch` component: Expand filters to fill area when main search input is not present.
89
+ - `DataSort` component: Increase click area for activating dropdown, and provide visual segementation between label and dropdown.
90
+ - New `Skeleton` component.
63
91
 
64
92
  ## 1.6.9
65
- - New `Timeline`, `TimelineItem` and `TimelineHeader` components.
93
+ - New `Timeline`, `TimelineItem` and `TimelineHeader` components.
66
94
 
67
95
  ## 1.6.8
68
- - Vertically align `is-icon` cells in `Grid`
96
+ - Vertically align `is-icon` cells in `Grid`
69
97
 
70
98
  ## 1.6.7
71
- - Added granular events `showing`, `shown`, `hiding` and `hidden` for `Popover`.
72
- - Added `is-checked` class on `Grid` when a row is checked using the multiselect checkboxes.
73
- - New colors for `is-checked` class on `Grid`
99
+ - Added granular events `showing`, `shown`, `hiding` and `hidden` for `Popover`.
100
+ - Added `is-checked` class on `Grid` when a row is checked using the multiselect checkboxes.
101
+ - New colors for `is-checked` class on `Grid`
74
102
 
75
103
  ## 1.6.6
76
- - Enhance `Popover` with native `show` `hide` `enable` `disable` methods
104
+ - Enhance `Popover` with native `show` `hide` `enable` `disable` methods
77
105
 
78
106
  ## 1.6.5
79
- - Filter fix on `DataSearch`
107
+ - Filter fix on `DataSearch`
80
108
 
81
109
  ## 1.6.4
82
- - Add support for `dropdown_portal` prop in `SearchableSelect`
110
+ - Add support for `dropdown_portal` prop in `SearchableSelect`
83
111
 
84
112
  ## 1.6.3
85
- - Prevent submit call on `MultiSelect` when `Enter` key is pressed while searching
86
- - Fix filter items going blank after search is initiated in `DataSearch`
113
+ - Prevent submit call on `MultiSelect` when `Enter` key is pressed while searching
114
+ - Fix filter items going blank after search is initiated in `DataSearch`
87
115
 
88
116
  ## 1.6.2
89
- - Add `dropdown_portal` prop on `MultiSelect` to allow rendering dropdown in alternative locations
117
+ - Add `dropdown_portal` prop on `MultiSelect` to allow rendering dropdown in alternative locations
90
118
 
91
119
  ## 1.6.1
92
- - New `Portal` component
93
- - Use `Portal` for `MultiSelect` and `SearchableSelect` components
120
+ - New `Portal` component
121
+ - Use `Portal` for `MultiSelect` and `SearchableSelect` components
94
122
 
95
123
  ## 1.6.0
96
- - Fix `DataSearch` responsiveness for mobile
97
- - Fix `Pagination` CSS for mobile
98
- - Fix `DataSort` responsiveness for mobile
99
- - Fix functionality of `DataSearch`
124
+ - Fix `DataSearch` responsiveness for mobile
125
+ - Fix `Pagination` CSS for mobile
126
+ - Fix `DataSort` responsiveness for mobile
127
+ - Fix functionality of `DataSearch`
100
128
 
101
129
  ## 1.5.9
102
- - Fix `z-index` issue with `SearchableSelect`
130
+ - Fix `z-index` issue with `SearchableSelect`
103
131
 
104
132
  ## 1.5.8
105
- - Showing `undefined` on total in `Pagination`
133
+ - Showing `undefined` on total in `Pagination`
106
134
 
107
135
  ## 1.5.7
108
- - Width calculation on `DataSearch`
109
- - More `text` validation `Nl2br`
136
+ - Width calculation on `DataSearch`
137
+ - More `text` validation `Nl2br`
110
138
 
111
139
  ## 1.5.6
112
- - Fix attribute of `MultiSelect`
113
- - Fix `text` checking on `Nl2br`
140
+ - Fix attribute of `MultiSelect`
141
+ - Fix `text` checking on `Nl2br`
114
142
 
115
143
  ## 1.5.5
116
- - Added `BarChart`
117
- - Added `LineChart`
118
- - Added `AreaChart`
119
- - Added `RadialChart`
120
- - Support `sparklines` in `Charts`
121
- - Add `yAxisOptions` and `horizontal` bar for `Charts`
122
- - Fix attribute of `ConfirmButton`
123
- - Fix error Handling in `MixedChart`
144
+ - Added `BarChart`
145
+ - Added `LineChart`
146
+ - Added `AreaChart`
147
+ - Added `RadialChart`
148
+ - Support `sparklines` in `Charts`
149
+ - Add `yAxisOptions` and `horizontal` bar for `Charts`
150
+ - Fix attribute of `ConfirmButton`
151
+ - Fix error Handling in `MixedChart`
124
152
 
125
153
  ## 1.5.1
126
- - Chart bugfixes
127
- - Fix attribute of `NumberInput` for UI testing
154
+ - Chart bugfixes
155
+ - Fix attribute of `NumberInput` for UI testing
128
156
 
129
157
  ## 1.5.0
130
- - Added `DonutChart`
131
- - Added `MixedChart`
132
- - Added `PieChart`
158
+ - Added `DonutChart`
159
+ - Added `MixedChart`
160
+ - Added `PieChart`
133
161
 
134
162
  ## 1.4.7
135
- - Fix value mismatch on `NumberInput`
163
+ - Fix value mismatch on `NumberInput`
136
164
 
137
165
  ## 1.4.6
138
- - Fix Typing bug on `NumberInput`
166
+ - Fix Typing bug on `NumberInput`
139
167
 
140
168
  ## 1.4.5
141
- - Fix **on:change** event on `NumberInput`
169
+ - Fix **on:change** event on `NumberInput`
142
170
 
143
171
  ## 1.4.4
144
- - import `Floatie`, `FloatingUIOutput`, `FloatiesStore` from `@kws3/ui` for `FloatingUIOutput`
172
+ - import `Floatie`, `FloatingUIOutput`, `FloatiesStore` from `@kws3/ui` for `FloatingUIOutput`
145
173
 
146
174
  ## 1.4.3
147
- - Rename `completion_timeout` to `error_timeout` in `Buttons`
175
+ - Rename `completion_timeout` to `error_timeout` in `Buttons`
@@ -1,7 +1,6 @@
1
1
  <!--
2
2
  @component
3
3
 
4
-
5
4
  @param {string} [button_class=""] - CSS classes for the Confirm button, Default: `""`
6
5
  @param {string} [text=""] - Button text, Default: `""`
7
6
  @param {''|'small'|'medium'|'large'} [size=""] - Size of the Button, Default: `""`
@@ -82,6 +81,11 @@
82
81
 
83
82
  const fire = createEventDispatcher();
84
83
 
84
+ /**
85
+ * @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
86
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
87
+ */
88
+
85
89
  /**
86
90
  * CSS classes for the Confirm button
87
91
  */
@@ -92,7 +96,7 @@
92
96
  text = "",
93
97
  /**
94
98
  * Size of the Button
95
- * @type {''|'small'|'medium'|'large'}
99
+ * @type {SizeOptions}
96
100
  */
97
101
  size = "",
98
102
  /**
@@ -101,7 +105,7 @@
101
105
  icon = "check",
102
106
  /**
103
107
  * Color of the Button
104
- * @type {''|'dark' | 'light' | 'warning' | 'info' | 'danger' | 'primary' | 'success'}
108
+ * @type {ColorOptions}
105
109
  */
106
110
  color = "primary",
107
111
  /**
@@ -154,6 +158,10 @@
154
158
  let confirm = false;
155
159
 
156
160
  $: main_color = "is-" + color;
161
+ /**
162
+ * Icon Size
163
+ * @type {SizeOptions}
164
+ */
157
165
  $: icon_size = "small";
158
166
  $: _confirm = should_confirm && confirm;
159
167
 
@@ -1,7 +1,6 @@
1
1
  <!--
2
2
  @component
3
3
 
4
-
5
4
  @param {string} [button_class=""] - CSS classes for the Delete button, Default: `""`
6
5
  @param {string} [text="Delete"] - Button text, Default: `"Delete"`
7
6
  @param {''|'small'|'medium'|'large'} [size=""] - Size of the Button, Default: `""`
@@ -70,7 +69,7 @@
70
69
  text = "Delete",
71
70
  /**
72
71
  * Size of the Button
73
- * @type {''|'small'|'medium'|'large'}
72
+ * @type {import('@kws3/ui/types').SizeOptions}
74
73
  */
75
74
  size = "",
76
75
  /**
@@ -79,7 +78,7 @@
79
78
  icon = "minus-circle",
80
79
  /**
81
80
  * Color of the Button
82
- * @type {''|'dark' | 'light' | 'warning' | 'info' | 'danger' | 'primary' | 'success'}
81
+ * @type {import('@kws3/ui/types').ColorOptions}
83
82
  */
84
83
  color = "danger",
85
84
  /**
@@ -1,7 +1,6 @@
1
1
  <!--
2
2
  @component
3
3
 
4
-
5
4
  @param {string} [button_class=""] - CSS classes for the Process button, Default: `""`
6
5
  @param {string} [text="Click Me"] - Button text, Default: `"Click Me"`
7
6
  @param {''|'small'|'medium'|'large'} [size=""] - Size of the Button, Default: `""`
@@ -71,7 +70,7 @@
71
70
  text = "Click Me",
72
71
  /**
73
72
  * Size of the Button
74
- * @type {''|'small'|'medium'|'large'}
73
+ * @type {import('@kws3/ui/types').SizeOptions}
75
74
  */
76
75
  size = "",
77
76
  /**
@@ -80,7 +79,7 @@
80
79
  icon = "check",
81
80
  /**
82
81
  * Color of the Button
83
- * @type {''|'dark' | 'light' | 'warning' | 'info' | 'danger' | 'primary' | 'success'}
82
+ * @type {import('@kws3/ui/types').ColorOptions}
84
83
  */
85
84
  color = "primary",
86
85
  /**
@@ -98,7 +97,7 @@
98
97
  /**
99
98
  * Context property
100
99
  */
101
- context = null,
100
+ context = "",
102
101
  /**
103
102
  * Removes text, and text space in the button
104
103
  */
@@ -1,7 +1,6 @@
1
1
  <!--
2
2
  @component
3
3
 
4
-
5
4
  @param {''|'small'|'medium'|'large'} [size=""] - Size of the Button, Default: `""`
6
5
  @param {''|'primary'|'warning'|'info'|'danger'|'dark'|'light'} [color="primary"] - Color of the Button, Default: `"primary"`
7
6
  @param {string} [text="Save Changes"] - Button text, Default: `"Save Changes"`
@@ -53,14 +52,19 @@
53
52
 
54
53
  const fire = createEventDispatcher();
55
54
 
55
+ /**
56
+ * @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
57
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
58
+ */
59
+
56
60
  /**
57
61
  * Size of the Button
58
- * @type {''|'small'|'medium'|'large'}
62
+ * @type {SizeOptions}
59
63
  */
60
64
  export let size = "",
61
65
  /**
62
66
  * Color of the Button
63
- * @type {''|'primary'|'warning'|'info'|'danger'|'dark'|'light'}
67
+ * @type {Exclude<ColorOptions , 'success'>}
64
68
  */
65
69
  color = "primary",
66
70
  /**
@@ -174,5 +178,9 @@
174
178
  }
175
179
 
176
180
  $: err_text = error_text === "" ? text : error_text;
181
+ /**
182
+ * Icon Size
183
+ * @type {SizeOptions}
184
+ */
177
185
  $: icon_size = size === "large" ? "" : "small";
178
186
  </script>
@@ -115,7 +115,7 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
115
115
  * Send an array of colors to override the default colors, or do not send anything to use the default colors
116
116
  * @type {array}
117
117
  */
118
- colors = null,
118
+ colors = [],
119
119
  /**
120
120
  * String array of event names that will be captured and fired as svelte events.
121
121
  * This is to prevent unnecessary event subscriptions.
@@ -135,7 +135,7 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
135
135
  * Send an array of colors to override the default colors, or do not send anything to use the default colors
136
136
  * @type {array}
137
137
  */
138
- colors = null,
138
+ colors = [],
139
139
  /**
140
140
  * String array of event names that will be captured and fired as svelte events.
141
141
  * This is to prevent unnecessary event subscriptions.
@@ -140,6 +140,7 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
140
140
 
141
141
  if (canvas) {
142
142
  chart = new ApexCharts(canvas, config);
143
+ //@ts-ignore
143
144
  chart.render();
144
145
  }
145
146
  };
@@ -105,7 +105,7 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
105
105
  * Send an array of colors to override the default colors, or do not send anything to use the default colors
106
106
  * @type {array}
107
107
  */
108
- colors = null,
108
+ colors = [],
109
109
  /**
110
110
  * String array of event names that will be captured and fired as svelte events.
111
111
  * This is to prevent unnecessary event subscriptions.
@@ -115,7 +115,7 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
115
115
  * Send an array of colors to override the default colors, or do not send anything to use the default colors
116
116
  * @type {array}
117
117
  */
118
- colors = null,
118
+ colors = [],
119
119
  /**
120
120
  * String array of event names that will be captured and fired as svelte events.
121
121
  * This is to prevent unnecessary event subscriptions.
@@ -120,7 +120,7 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
120
120
  * Send an array of colors to override the default colors, or do not send anything to use the default colors
121
121
  * @type {array}
122
122
  */
123
- colors = null,
123
+ colors = [],
124
124
  /**
125
125
  * String array of event names that will be captured and fired as svelte events.
126
126
  * This is to prevent unnecessary event subscriptions.
@@ -105,7 +105,7 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
105
105
  * Send an array of colors to override the default colors, or do not send anything to use the default colors
106
106
  * @type {array}
107
107
  */
108
- colors = null,
108
+ colors = [],
109
109
  /**
110
110
  * String array of event names that will be captured and fired as svelte events.
111
111
  * This is to prevent unnecessary event subscriptions.
@@ -115,7 +115,7 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
115
115
  * Send an array of colors to override the default colors, or do not send anything to use the default colors
116
116
  * @type {array}
117
117
  */
118
- colors = null,
118
+ colors = [],
119
119
  /**
120
120
  * String array of event names that will be captured and fired as svelte events.
121
121
  * This is to prevent unnecessary event subscriptions.
package/charts/utils.js CHANGED
@@ -9,6 +9,7 @@ const themeColors = [
9
9
  "#77ED11",
10
10
  ];
11
11
 
12
+ //@ts-ignore
12
13
  export const merge = ApexCharts.merge;
13
14
 
14
15
  export function pieChartOptions(labels, is_sparkline) {
@@ -46,14 +46,20 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `"null"`
46
46
  <script>
47
47
  import { Icon } from "@kws3/ui";
48
48
 
49
+ /**
50
+ *
51
+ * @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
52
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
53
+ *
54
+ */
49
55
  /**
50
56
  * Size of the Checkbox
51
- * @type {''|'small'|'medium'|'large'}
57
+ * @type {SizeOptions}
52
58
  */
53
59
  export let size = "",
54
60
  /**
55
61
  * Colour of the Checkbox
56
- * @type {''|'primary'|'warning'|'info'|'danger'|'dark'|'light'}
62
+ * @type {Exclude<ColorOptions, 'success'>}
57
63
  */
58
64
  color = "",
59
65
  /**
@@ -100,9 +106,9 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `"null"`
100
106
  *
101
107
  * Ultimately defaults to `fa`, if family is not set anywhere
102
108
  *
103
- * @type {''|'fa'|'lar'|'las'|'gg'|'unicons'}
109
+ * @type {string|''|'fa'|'lar'|'las'|'gg'|'unicons'|'material'}
104
110
  */
105
- icon_family = null;
111
+ icon_family = "";
106
112
 
107
113
  /**
108
114
  * CSS classes of the Checkbox
@@ -37,9 +37,9 @@ The following functions are returned in `event.detail`:
37
37
  {#if _is_uploading}
38
38
  <span class="loader" />
39
39
  {:else if _is_finished}
40
- <Icon size="" icon="check-circle" fa_class="fa-lg" />
40
+ <Icon size="" icon="check-circle" class="fa-lg" />
41
41
  {:else}
42
- <Icon size="" icon="upload" fa_class="fa-lg" />
42
+ <Icon size="" icon="upload" class="fa-lg" />
43
43
  {/if}
44
44
  </div>
45
45
  <div class="file">
@@ -88,6 +88,12 @@ The following functions are returned in `event.detail`:
88
88
  import { onMount, createEventDispatcher } from "svelte";
89
89
  import { Icon } from "@kws3/ui";
90
90
 
91
+ /**
92
+ *
93
+ * @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
94
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
95
+ *
96
+ */
91
97
  const fire = createEventDispatcher();
92
98
 
93
99
  /**
@@ -106,7 +112,7 @@ The following functions are returned in `event.detail`:
106
112
  info = "",
107
113
  /**
108
114
  * Color of the information text
109
- * @type {''|'grey'|'primary'|'warning'|'success'|'info'|'danger'|'dark'|'light'}
115
+ * @type {ColorOptions | 'grey'}
110
116
  */
111
117
  info_color = "grey",
112
118
  /**
@@ -124,12 +130,12 @@ The following functions are returned in `event.detail`:
124
130
  disabled = false,
125
131
  /**
126
132
  * Size of the File Input
127
- * @type {''|'small'|'medium'|'large'}
133
+ * @type {SizeOptions}
128
134
  */
129
135
  size = "",
130
136
  /**
131
137
  * Color of the File Input
132
- * @type {''|'primary'|'warning'|'success'|'info'|'danger'|'dark'|'light'}
138
+ * @type {ColorOptions}
133
139
  */
134
140
  color = "";
135
141
 
@@ -157,13 +163,13 @@ The following functions are returned in `event.detail`:
157
163
  return "N/A";
158
164
  }
159
165
  if (n > 1073741824) {
160
- return Math.round(n / 1073741824, 1) + " GB";
166
+ return Math.round(n / 1073741824) + " GB";
161
167
  }
162
168
  if (n > 1048576) {
163
- return Math.round(n / 1048576, 1) + " MB";
169
+ return Math.round(n / 1048576) + " MB";
164
170
  }
165
171
  if (n > 1024) {
166
- return Math.round(n / 1024, 1) + " KB";
172
+ return Math.round(n / 1024) + " KB";
167
173
  }
168
174
  return n + " b";
169
175
  }
@@ -40,8 +40,8 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
40
40
  ? 'danger'
41
41
  : ''}"
42
42
  type="number"
43
- min
44
- max
43
+ {min}
44
+ {max}
45
45
  {step}
46
46
  {disabled}
47
47
  readonly={!typeable}
@@ -72,8 +72,8 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
72
72
  ? 'danger'
73
73
  : ''}"
74
74
  type="number"
75
- min
76
- max
75
+ {min}
76
+ {max}
77
77
  {step}
78
78
  {disabled}
79
79
  readonly={!typeable}
@@ -124,11 +124,17 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
124
124
  import { onMount, createEventDispatcher } from "svelte";
125
125
  import { Icon } from "@kws3/ui";
126
126
 
127
+ /**
128
+ *
129
+ * @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
130
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
131
+ *
132
+ */
127
133
  const fire = createEventDispatcher();
128
134
 
129
135
  /**
130
136
  * Size of the component
131
- * @type {''|'small'|'medium'|'large'}
137
+ * @type {SizeOptions}
132
138
  */
133
139
  export let size = "",
134
140
  /**
@@ -137,6 +143,7 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
137
143
  * This property can be bound to, to fetch the current value
138
144
  *
139
145
  * This will be overridden if `min` is higher, or `max` is lower
146
+ * @type {number}
140
147
  */
141
148
  value = 0,
142
149
  /**
@@ -145,10 +152,12 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
145
152
  step = 1,
146
153
  /**
147
154
  * Minumum permitted value
155
+ * @type {number}
148
156
  */
149
157
  min = 0,
150
158
  /**
151
159
  * Maximum permitted value
160
+ * @type {number}
152
161
  */
153
162
  max = 100,
154
163
  /**
@@ -169,12 +178,12 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
169
178
  minus_icon = "minus",
170
179
  /**
171
180
  * Color of the Minus Icon
172
- * @type {''|'success'|'primary'|'warning'|'info'|'danger'|'dark'|'light'}
181
+ * @type {ColorOptions}
173
182
  */
174
183
  minus_icon_color = "danger",
175
184
  /**
176
185
  * Color of the Minus Button
177
- * @type {''|'success'|'primary'|'warning'|'info'|'danger'|'dark'|'light'}
186
+ * @type {ColorOptions}
178
187
  */
179
188
  minus_button_color = "",
180
189
  /**
@@ -183,12 +192,12 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
183
192
  plus_icon = "plus",
184
193
  /**
185
194
  * Color of the Plus Icon
186
- * @type {''|'success'|'primary'|'warning'|'info'|'danger'|'dark'|'light'}
195
+ * @type {ColorOptions}
187
196
  */
188
197
  plus_icon_color = "success",
189
198
  /**
190
199
  * Color of the Plus Button
191
- * @type {''|'success'|'primary'|'warning'|'info'|'danger'|'dark'|'light'}
200
+ * @type {ColorOptions}
192
201
  */
193
202
  plus_button_color = "",
194
203
  /**
@@ -231,7 +240,7 @@ This will be overridden if `min` is higher, or `max` is lower, Default: `0`
231
240
  const count = (i) => () => {
232
241
  if (typeof value == "undefined" || value === null) value = min;
233
242
  value = Number(value) + i * step;
234
- if (step % 1 !== 0) value = value.toFixed(1);
243
+ if (step % 1 !== 0) value = Number(value.toFixed(1));
235
244
  };
236
245
 
237
246
  function validateInput() {
@@ -38,6 +38,12 @@ See: https://svelte.dev/docs#bind_group, Default: `null`
38
38
  </label>
39
39
 
40
40
  <script>
41
+ /**
42
+ *
43
+ * @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
44
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
45
+ *
46
+ */
41
47
  /**
42
48
  * Value of radio button
43
49
  */
@@ -52,12 +58,12 @@ See: https://svelte.dev/docs#bind_group, Default: `null`
52
58
  label_style = "",
53
59
  /**
54
60
  * Size of the Radio Button
55
- * @type {''|'small'|'medium'|'large'}
61
+ * @type {SizeOptions}
56
62
  */
57
63
  size = "",
58
64
  /**
59
65
  * Color of the Radio button when selected
60
- * @type {''|'primary'|'warning'|'success'|'info'|'danger'|'dark'|'light'}
66
+ * @type {ColorOptions}
61
67
  */
62
68
  color = "",
63
69
  /**