@kws3/ui 1.6.7 → 1.7.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 (50) hide show
  1. package/CHANGELOG.mdx +99 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1 -1
  4. package/buttons/SubmitButton.svelte +8 -8
  5. package/controls/Checkbox.svelte +5 -5
  6. package/controls/FileUpload.svelte +4 -4
  7. package/controls/NumberInput.svelte +2 -2
  8. package/controls/ToggleButtons.svelte +1 -1
  9. package/datagrid/DataSearch/DataSearch.svelte +7 -6
  10. package/datagrid/DataSearch/SearchFilter.svelte +25 -10
  11. package/datagrid/GridView/GridCell.svelte +1 -0
  12. package/datagrid/GridView/GridRow.svelte +1 -1
  13. package/datagrid/Pagination/Pagination.svelte +107 -47
  14. package/datagrid/TileView/TileViewItem.svelte +1 -0
  15. package/forms/MaskedInput.svelte +1 -1
  16. package/forms/PasswordValidator/validatePassword.js +2 -2
  17. package/forms/actions.js +2 -1
  18. package/forms/colorpicker/Colorpicker.js +18 -13
  19. package/forms/colorpicker/Colorpicker.svelte +2 -2
  20. package/forms/select/MultiSelect.svelte +11 -13
  21. package/helpers/Dialog/Dialog.svelte +13 -14
  22. package/helpers/Divider.svelte +55 -0
  23. package/helpers/FloatingUI/Floatie.svelte +11 -5
  24. package/helpers/FloatingUI/index.js +2 -2
  25. package/helpers/Icon.svelte +1 -1
  26. package/helpers/Loader.svelte +4 -4
  27. package/helpers/Message.svelte +4 -1
  28. package/helpers/Modal.svelte +10 -2
  29. package/helpers/Nl2br.svelte +1 -1
  30. package/helpers/Notification.svelte +1 -1
  31. package/helpers/Panel.svelte +3 -1
  32. package/helpers/Popover.svelte +5 -5
  33. package/helpers/Skeleton.svelte +66 -0
  34. package/helpers/Timeline/Timeline.svelte +28 -0
  35. package/helpers/Timeline/TimelineHeader.svelte +21 -0
  36. package/helpers/Timeline/TimelineItem.svelte +70 -0
  37. package/index.js +5 -0
  38. package/package.json +2 -2
  39. package/sliding-panes/SlidingPane.svelte +2 -2
  40. package/sliding-panes/SlidingPaneSet.svelte +12 -15
  41. package/styles/DataSort.scss +5 -0
  42. package/styles/Divider.scss +102 -0
  43. package/styles/Grid.scss +1 -0
  44. package/styles/Loader.scss +35 -34
  45. package/styles/Pagination.scss +1 -1
  46. package/styles/RangeSlider.scss +2 -1
  47. package/styles/Skeleton.scss +52 -0
  48. package/styles/Timeline.scss +165 -0
  49. package/utils/index.js +1 -1
  50. package/utils/keyboard-events.js +3 -3
@@ -2,21 +2,36 @@
2
2
  @component
3
3
 
4
4
 
5
- @param {object} [meta={}] - Contains the total, count, limit, offset values, Default: `{}`
5
+ @param {object} [meta={}] - Object containing `total`, `count`, `limit` and `offset` values
6
+
7
+ **DEPRECATED**: Use `total`, `count`, `limit` and `offset` props instead, Default: `{}`
8
+ @param {number} [limit=0] - How many items are meant to be per page, Default: `0`
9
+ @param {number} [count=0] - How many items are actually in this page, Default: `0`
10
+ @param {number} [total=0] - Total number of items available, Default: `0`
11
+ @param {number} [offset=0] - Offset of the first item in this page, Default: `0`
6
12
  @param {boolean} [showTotal=true] - Determines whether to show total or not, Default: `true`
7
13
  @param {boolean} [showCurrent=true] - Determines whether to show current page details, Default: `true`
8
14
  @param {boolean} [showPerPage=true] - Determines whether to show per page options, Default: `true`
9
15
  @param {number} [breakThreshold=10] - Limit the number of visible pages in pagination, Default: `10`
10
16
  @param {string} [entityName="entries"] - String to display total entries, Default: `"entries"`
11
- @param {string} [size="small"] - Size of the pagination, Default: `"small"`
17
+ @param {''|'small'|'medium'|'large'} [size="small"] - Size of the pagination elements, Default: `"small"`
12
18
  @param {boolean} [frame=false] - Determines whether to show pagination frame or not, Default: `false`
13
19
  @param {string} [iconRight="chevron-right"] - Right navigation icon, Default: `"chevron-right"`
14
20
  @param {string} [iconLeft="chevron-left"] - Left navigation icon, Default: `"chevron-left"`
15
- @param {array} [perPageOptions=[]] - Determines the number of rows displayed in a page., Default: `[]`
21
+ @param {array} [perPageOptions=[]] - Displays the options for how many items to show per page, Default: `[]`
22
+ @method `goto(targetPage)` - Go to an arbitrary page number
23
+ @method `prev()` - Go to the previous page
24
+ @method `next()` - Go to the next page
25
+ @method `first()` - Go to the first page
26
+ @method `last()` - Go to the last page
16
27
 
17
28
  ### Events
18
- - `setLimit` - Event used to set limit of pagination
19
- - `paginate` - Event triggered on paginate
29
+ - `setLimit` - Event used to set a new `limit`.
30
+
31
+ *Event Data:* `{currentPage, newLimit}`
32
+ - `paginate` - Event triggered on pagination change with new `offset` and current `limit` values.
33
+
34
+ *Event Data:* `{offset, limit}`
20
35
 
21
36
  -->
22
37
  <div
@@ -34,9 +49,7 @@
34
49
  <li>
35
50
  <button
36
51
  type="button"
37
- class="pagination-link {meta.limit == v
38
- ? 'is-current'
39
- : ''}"
52
+ class="pagination-link {_limit === v ? 'is-current' : ''}"
40
53
  on:click={() => setLimit(v)}>{k}</button>
41
54
  </li>
42
55
  {/each}
@@ -49,9 +62,8 @@
49
62
  {#if showTotal}
50
63
  <strong>Total {totalItems} {entityName}</strong>
51
64
  {:else if showCurrent}
52
- {#if meta.total > 0}Showing {meta.offset * 1 + 1} to {meta.offset *
53
- 1 +
54
- meta.count * 1}{/if}
65
+ {#if _total > 0}Showing {_offset * 1 + 1} to {_offset * 1 +
66
+ _count * 1}{/if}
55
67
  {/if}
56
68
  </div>
57
69
  {/if}
@@ -59,14 +71,14 @@
59
71
 
60
72
  {#if showCurrent && showTotal && !showPerPage}
61
73
  <div class="level-item pagination-showing">
62
- {#if meta.total > 0}
63
- Showing {meta.offset * 1 + 1} to {meta.offset * 1 + meta.count * 1}
74
+ {#if _total > 0}
75
+ Showing {_offset * 1 + 1} to {_offset * 1 + _count * 1}
64
76
  {/if}
65
77
  </div>
66
78
  {:else if showPerPage && showCurrent}
67
79
  <div class="level-item pagination-showing">
68
- {#if meta.total > 0}
69
- Showing {meta.offset * 1 + 1} to {meta.offset * 1 + meta.count * 1}
80
+ {#if _total > 0}
81
+ Showing {_offset * 1 + 1} to {_offset * 1 + _count * 1}
70
82
  {#if showTotal}
71
83
  |&nbsp;
72
84
  {/if}
@@ -82,25 +94,25 @@
82
94
  {/if}
83
95
 
84
96
  <div class="level-right">
85
- {#if meta.total > 0}
97
+ {#if _total > 0}
86
98
  <nav class="pagination is-centered {size ? 'is-' + size : ''}">
87
99
  <button
88
100
  type="button"
89
101
  on:click={prev}
90
- class="pagination-previous {meta.offset == 0 ? 'is-disabled' : ''}">
91
- <Icon {size} icon={iconLeft} />
102
+ class="pagination-previous {_offset === 0 ? 'is-disabled' : ''}">
103
+ <Icon icon={iconLeft} />
92
104
  </button>
93
105
  <button
94
106
  type="button"
95
107
  on:click={next}
96
- class="pagination-next {currentPage + 1 == totalPages
108
+ class="pagination-next {currentPage + 1 === totalPages
97
109
  ? 'is-disabled'
98
110
  : ''}">
99
- <Icon {size} icon={iconRight} />
111
+ <Icon icon={iconRight} />
100
112
  </button>
101
113
  <ul class="pagination-list" data-cy="pagination-list">
102
114
  {#each pages as page}
103
- {#if page.p == "sep"}
115
+ {#if page.p === "sep"}
104
116
  <li>
105
117
  <span class="pagination-ellipsis">&hellip;</span>
106
118
  </li>
@@ -108,7 +120,7 @@
108
120
  <li>
109
121
  <button
110
122
  type="button"
111
- class="pagination-link {page.p == currentPage
123
+ class="pagination-link {page.p === currentPage
112
124
  ? 'is-current'
113
125
  : ''}"
114
126
  on:click={() => goto(page.p + 1)}>{page.p + 1}</button>
@@ -129,15 +141,32 @@
129
141
  const fire = createEventDispatcher();
130
142
 
131
143
  /**
132
- * Contains the total, count, limit, offset values
144
+ * Object containing `total`, `count`, `limit` and `offset` values
145
+ *
146
+ * **DEPRECATED**: Use `total`, `count`, `limit` and `offset` props instead
133
147
  */
134
148
  export let meta = {
135
149
  limit: 0,
136
150
  total: 0,
137
151
  count: 0,
138
152
  offset: 0,
139
- status: "",
140
153
  },
154
+ /**
155
+ * How many items are meant to be per page
156
+ */
157
+ limit = 0,
158
+ /**
159
+ * How many items are actually in this page
160
+ */
161
+ count = 0,
162
+ /**
163
+ * Total number of items available
164
+ */
165
+ total = 0,
166
+ /**
167
+ * Offset of the first item in this page
168
+ */
169
+ offset = 0,
141
170
  /**
142
171
  * Determines whether to show total or not
143
172
  */
@@ -159,7 +188,8 @@
159
188
  */
160
189
  entityName = "entries",
161
190
  /**
162
- * Size of the pagination
191
+ * Size of the pagination elements
192
+ * @type {''|'small'|'medium'|'large'}
163
193
  */
164
194
  size = "small",
165
195
  /**
@@ -175,15 +205,20 @@
175
205
  */
176
206
  iconLeft = "chevron-left",
177
207
  /**
178
- * Determines the number of rows displayed in a page.
208
+ * Displays the options for how many items to show per page
179
209
  */
180
210
  perPageOptions = [20, 50, 100, 150, 200, 250];
181
211
 
182
212
  let pages = [],
183
213
  _perPageOptions = 0;
184
214
 
215
+ $: _total = total || meta.total || 0;
216
+ $: _count = count || meta.count || 0;
217
+ $: _offset = offset || meta.offset || 0;
218
+ $: _limit = limit || meta.limit || 0;
219
+
185
220
  $: {
186
- let max = meta.total,
221
+ let max = _total,
187
222
  ppo = perPageOptions || [],
188
223
  ppmax = Math.max(...ppo),
189
224
  ret = {};
@@ -204,9 +239,9 @@
204
239
  _perPageOptions = ret;
205
240
  }
206
241
 
207
- $: totalItems = meta && meta.total ? meta.total : 0;
208
- $: currentPage = Math.floor(meta.offset / meta.limit);
209
- $: totalPages = Math.ceil(meta.total / (meta.limit || 1));
242
+ $: totalItems = meta && _total ? _total : 0;
243
+ $: currentPage = Math.floor(_offset / _limit);
244
+ $: totalPages = Math.ceil(_total / (_limit || 1));
210
245
  $: totalPages, currentPage, breakThreshold, calculatePages();
211
246
 
212
247
  function calculatePages() {
@@ -221,12 +256,12 @@
221
256
  ret.push({ p: i });
222
257
  } else if (i > total - 4) {
223
258
  ret.push({ p: i });
224
- } else if (i == Math.floor(total / 2)) {
259
+ } else if (i === Math.floor(total / 2)) {
225
260
  ret.push({ p: i });
226
261
  } else if (
227
- i == currentPage ||
228
- i == currentPage - 1 ||
229
- i == currentPage + 1
262
+ i === currentPage ||
263
+ i === currentPage - 1 ||
264
+ i === currentPage + 1
230
265
  ) {
231
266
  ret.push({ p: i });
232
267
  }
@@ -240,7 +275,7 @@
240
275
  if (total > breakThreshold) {
241
276
  for (var j = 0; j < ret.length; j++) {
242
277
  var page = ret[j].p;
243
- if (page != _prev + 1 && page != 0) {
278
+ if (page !== _prev + 1 && page !== 0) {
244
279
  items.push({ p: "sep" });
245
280
  }
246
281
  items.push(ret[j]);
@@ -255,31 +290,56 @@
255
290
 
256
291
  function setLimit(limit) {
257
292
  /**
258
- * Event used to set limit of pagination
293
+ * Event used to set a new `limit`.
294
+ *
295
+ * *Event Data:* `{currentPage, newLimit}`
259
296
  */
260
297
  fire("setLimit", { currentPage, newLimit: limit });
261
298
  }
262
- function goto(pagenum) {
263
- let limit = meta.limit,
264
- i = pagenum - 1,
265
- offset = limit * i;
266
- if (offset >= 0 && offset != meta.offset && offset < meta.total) {
299
+
300
+ /**
301
+ * Go to an arbitrary page number
302
+ * @param {int} targetPage
303
+ */
304
+ export function goto(targetPage) {
305
+ let limit = _limit,
306
+ i = targetPage - 1,
307
+ __offset = limit * i;
308
+ if (__offset >= 0 && __offset !== _offset && __offset < _total) {
267
309
  /**
268
- * Event triggered on paginate
310
+ * Event triggered on pagination change with new `offset` and current `limit` values.
311
+ *
312
+ * *Event Data:* `{offset, limit}`
269
313
  */
270
- fire("paginate", { offset, limit });
314
+ fire("paginate", { offset: __offset, limit });
271
315
  }
272
316
  }
273
- function prev() {
317
+
318
+ /**
319
+ * Go to the previous page
320
+ */
321
+ export function prev() {
274
322
  goto(currentPage);
275
323
  }
276
- function next() {
324
+
325
+ /**
326
+ * Go to the next page
327
+ */
328
+ export function next() {
277
329
  goto(currentPage + 2);
278
330
  }
279
- function first() {
331
+
332
+ /**
333
+ * Go to the first page
334
+ */
335
+ export function first() {
280
336
  goto(1);
281
337
  }
282
- function last() {
338
+
339
+ /**
340
+ * Go to the last page
341
+ */
342
+ export function last() {
283
343
  goto(totalPages);
284
344
  }
285
345
  </script>
@@ -22,6 +22,7 @@
22
22
  {#each column_keys as column}
23
23
  {#if isVisible(column)}
24
24
  <div class={classNames(column, row)} style={styles(column, row)}>
25
+ <!-- eslint-disable-next-line @ota-meshi/svelte/no-at-html-tags -->
25
26
  {@html transforms(column, row)}
26
27
  </div>
27
28
  {/if}
@@ -32,7 +32,7 @@ Requires `guide` to be `true`, Default: `false`
32
32
  bind:this={inputElement} />
33
33
 
34
34
  <script>
35
- import { onMount, tick } from "svelte";
35
+ import { onMount } from "svelte";
36
36
  import {
37
37
  createTextMaskInputElement,
38
38
  conformToMask,
@@ -7,7 +7,7 @@ export default function (password, options) {
7
7
  result.items = (options || []).slice().map((_opt) => {
8
8
  const opt = Object.assign({}, _opt);
9
9
  if (opt && opt.active) {
10
- if (opt.name == "kws_pv_min_length") {
10
+ if (opt.name === "kws_pv_min_length") {
11
11
  if (password && password.length >= opt.value) {
12
12
  opt.passed = true;
13
13
  }
@@ -24,7 +24,7 @@ export default function (password, options) {
24
24
  });
25
25
 
26
26
  result.overall =
27
- result.items.filter((el) => el.passed).length == result.items.length;
27
+ result.items.filter((el) => el.passed).length === result.items.length;
28
28
 
29
29
  return result;
30
30
  }
package/forms/actions.js CHANGED
@@ -3,6 +3,7 @@ import flatpickr from "flatpickr";
3
3
  function createFlatpickrAction(defaultOpts, hooks) {
4
4
  return function (
5
5
  node,
6
+ // eslint-disable-next-line no-unused-vars
6
7
  { opts, value, placeholder, klass, style, disabled, color }
7
8
  ) {
8
9
  const _opts = {};
@@ -50,7 +51,7 @@ function createFlatpickrAction(defaultOpts, hooks) {
50
51
  function applyColorClass(instance, color) {
51
52
  let contains = false;
52
53
  instance.calendarContainer.classList.forEach((c) => {
53
- if (c.charAt(3).toLowerCase() == "is-") {
54
+ if (c.charAt(3).toLowerCase() === "is-") {
54
55
  contains = c;
55
56
  }
56
57
  });
@@ -255,7 +255,9 @@ export default (function (win, doc) {
255
255
 
256
256
  // get mouse/finger coordinate
257
257
  function point(el, e) {
258
+ // eslint-disable-next-line no-extra-boolean-cast
258
259
  var x = !!e.touches ? e.touches[0].pageX : e.pageX,
260
+ // eslint-disable-next-line no-extra-boolean-cast
259
261
  y = !!e.touches ? e.touches[0].pageY : e.pageY,
260
262
  left = offset(el).l,
261
263
  top = offset(el).t;
@@ -396,18 +398,21 @@ export default (function (win, doc) {
396
398
  H_point_H = size(H_point).h,
397
399
  SV_point_W = SV_point_size.w,
398
400
  SV_point_H = SV_point_size.h;
401
+
402
+ function click(e) {
403
+ var t = e.target,
404
+ is_target = t === target || closest(t, target) === target;
405
+ if (is_target) {
406
+ create();
407
+ } else {
408
+ $.exit();
409
+ }
410
+ trigger(is_target ? "enter" : "exit", [$]);
411
+ }
412
+
399
413
  if (first) {
400
414
  picker.style.left = picker.style.top = "-9999px";
401
- function click(e) {
402
- var t = e.target,
403
- is_target = t === target || closest(t, target) === target;
404
- if (is_target) {
405
- create();
406
- } else {
407
- $.exit();
408
- }
409
- trigger(is_target ? "enter" : "exit", [$]);
410
- }
415
+
411
416
  if (events !== false) {
412
417
  on(events, target, click);
413
418
  }
@@ -430,7 +435,7 @@ export default (function (win, doc) {
430
435
  SV_point.style.right = SV_W - SV_point_W / 2 - SV_W * +HSV[1] + "px";
431
436
  SV_point.style.top = SV_H - SV_point_H / 2 - SV_H * +HSV[2] + "px";
432
437
  };
433
- $.exit = function (e) {
438
+ $.exit = function () {
434
439
  if (visible()) {
435
440
  visible().removeChild(picker);
436
441
  $.visible = false;
@@ -443,8 +448,8 @@ export default (function (win, doc) {
443
448
  return $;
444
449
  };
445
450
  function color(e) {
446
- var a = HSV2RGB(HSV),
447
- b = HSV2RGB([HSV[0], 1, 1]);
451
+ //var a = HSV2RGB(HSV),
452
+ var b = HSV2RGB([HSV[0], 1, 1]);
448
453
  SV.style.backgroundColor = "rgb(" + b.join(",") + ")";
449
454
  set_data(HSV);
450
455
  prevent(e);
@@ -116,7 +116,7 @@ This property can be bound to, to fetch the current colour, Default: `"000000"`
116
116
  e && e.target && e.target.select();
117
117
  }
118
118
 
119
- function onDragOver(e) {
119
+ function onDragOver() {
120
120
  if (!readonly && !disabled) {
121
121
  dragover = true;
122
122
  }
@@ -131,7 +131,7 @@ This property can be bound to, to fetch the current colour, Default: `"000000"`
131
131
  return false;
132
132
  }
133
133
 
134
- function onDragLeave(e) {
134
+ function onDragLeave() {
135
135
  if (!readonly && !disabled) {
136
136
  dragover = false;
137
137
  }
@@ -22,9 +22,7 @@ this property of each object will be returned as the value, Default: `"id"`
22
22
  @param {boolean} [readonly=false] - Marks component as read-only, Default: `false`
23
23
  @param {boolean} [disabled=false] - Disables the component, Default: `false`
24
24
  @param {string} [selected_icon="check"] - Icon used to mark selected items in dropdown list, Default: `"check"`
25
- @param {boolean} [summary_mode=false] - When activated, it will show the number of selected items.
26
-
27
- Instead of listing all the selected items inside the input., Default: `false`
25
+ @param {boolean} [summary_mode=false] - Shows only the number of items selected, instead of listing all the selected items in the input., Default: `false`
28
26
  @param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
29
27
  @param {string} [remove_btn_tip="Remove"] - Tooltip text for Remove Item button. This `string` will precede the selected Item Name in the tooltip., Default: `"Remove"`
30
28
  @param {string} [remove_all_tip="Remove all"] - Tooltip text for the Clear All button, Default: `"Remove all"`
@@ -66,7 +64,7 @@ Default value: `<span>{option[search_key] || option}</span>`
66
64
  </li>
67
65
  <li
68
66
  class="tag is-{size} summary-text is-{color || 'primary'} is-light">
69
- Item{selectedOptions.length == 1 ? "" : "s"} selected
67
+ Item{selectedOptions.length === 1 ? "" : "s"} selected
70
68
  </li>
71
69
  {:else}
72
70
  {#each selectedOptions as tag}
@@ -225,9 +223,7 @@ Default value: `<span>{option[search_key] || option}</span>`
225
223
  */
226
224
  export let selected_icon = "check";
227
225
  /**
228
- * When activated, it will show the number of selected items.
229
- *
230
- * Instead of listing all the selected items inside the input.
226
+ * Shows only the number of items selected, instead of listing all the selected items in the input.
231
227
  */
232
228
  export let summary_mode = false;
233
229
  /**
@@ -298,9 +294,10 @@ Default value: `<span>{option[search_key] || option}</span>`
298
294
  $: _placeholder = hasValue ? "" : placeholder;
299
295
 
300
296
  //ensure search_key and value_key are no empty strings
301
- $: used_search_key = search_key && search_key != "" ? search_key : "name";
302
- $: used_value_key = value_key && value_key != "" ? value_key : "id";
297
+ $: used_search_key = search_key && search_key !== "" ? search_key : "name";
298
+ $: used_value_key = value_key && value_key !== "" ? value_key : "id";
303
299
 
300
+ // eslint-disable-next-line no-redeclare
304
301
  $: shouldShowClearAll = hasValue;
305
302
 
306
303
  $: options, normaliseOptions();
@@ -322,7 +319,7 @@ Default value: `<span>{option[search_key] || option}</span>`
322
319
  //TODO: optimise isSelected function
323
320
  $: isSelected = (option) => {
324
321
  if (single) return matchesValue(value, option);
325
- if (!(value && value.length > 0) || value == "") return false;
322
+ if (!(value && value.length > 0) || value === "") return false;
326
323
  // nothing is selected if `value` is the empty array or string
327
324
  else return value.some((v) => matchesValue(v, option));
328
325
  };
@@ -384,13 +381,13 @@ Default value: `<span>{option[search_key] || option}</span>`
384
381
  function fillSelectedOptions() {
385
382
  if (single) {
386
383
  selectedOptions = normalisedOptions.filter(
387
- (v) => `${v[used_value_key]}` == `${value}`
384
+ (v) => `${v[used_value_key]}` === `${value}`
388
385
  );
389
386
  setSingleVisibleValue();
390
387
  } else {
391
388
  selectedOptions = normalisedOptions
392
389
  .filter(
393
- (v) => value && value.some((vl) => `${v[used_value_key]}` == `${vl}`)
390
+ (v) => value && value.some((vl) => `${v[used_value_key]}` === `${vl}`)
394
391
  )
395
392
  .sort(
396
393
  (a, b) =>
@@ -440,7 +437,8 @@ Default value: `<span>{option[search_key] || option}</span>`
440
437
  if (!isAlreadySelected && !single && (max === null || value.length < max)) {
441
438
  //attach to value array while filtering out invalid values
442
439
  value = [...value, token[used_value_key]].filter((v) => {
443
- return normalisedOptions.filter((nv) => nv[used_value_key] == v).length;
440
+ return normalisedOptions.filter((nv) => nv[used_value_key] === v)
441
+ .length;
444
442
  });
445
443
  searchText = ""; // reset search string on selection
446
444
 
@@ -30,15 +30,16 @@ For internal use only - not part of config object, Default: `""`
30
30
  <CardModal title={titleToUse} {size} {is_active} closable={false}>
31
31
  <div slot="default">
32
32
  <div class="columns is-vcentered is-mobile">
33
- {#if icon && icon != ""}
33
+ {#if icon && icon !== ""}
34
34
  <div class="column is-narrow">
35
35
  <Icon {icon} size={icon_size} color={icon_color} />
36
36
  </div>
37
37
  {/if}
38
38
  <div class="column">
39
39
  <div>
40
+ <!-- eslint-disable-next-line @ota-meshi/svelte/no-at-html-tags -->
40
41
  <span class="is-block">{@html _text}</span>
41
- {#if _type == "prompt"}
42
+ {#if _type === "prompt"}
42
43
  <div class="field" style="margin-top:0.5rem;">
43
44
  <div class="control">
44
45
  <input
@@ -50,7 +51,7 @@ For internal use only - not part of config object, Default: `""`
50
51
  </div>
51
52
  </div>
52
53
  {/if}
53
- {#if help_text && help_text != ""}
54
+ {#if help_text && help_text !== ""}
54
55
  <span class="help">{help_text}</span>
55
56
  {/if}
56
57
  </div>
@@ -59,20 +60,24 @@ For internal use only - not part of config object, Default: `""`
59
60
  </div>
60
61
  <div slot="footer" style="width:100%">
61
62
  <div class="field is-grouped is-grouped-right">
62
- {#if _type != "alert"}
63
+ {#if _type !== "alert"}
63
64
  <div class="control">
64
- <button on:click={cancel} class="button is-{cancel_button_color}"
65
- >{#if cancel_button_icon != ""}<Icon
65
+ <button
66
+ type="button"
67
+ on:click={cancel}
68
+ class="button is-{cancel_button_color}"
69
+ >{#if cancel_button_icon !== ""}<Icon
66
70
  icon={cancel_button_icon}
67
71
  size="small" />{/if}<span>{cancel_button_text}</span></button>
68
72
  </div>
69
73
  {/if}
70
74
  <div class="control">
71
75
  <button
76
+ type="button"
72
77
  bind:this={ok_button}
73
78
  on:click={ok}
74
79
  class="button is-{ok_button_color}"
75
- >{#if ok_button_icon != ""}<Icon
80
+ >{#if ok_button_icon !== ""}<Icon
76
81
  icon={ok_button_icon}
77
82
  size="small" />{/if}<span>{ok_button_text}</span></button>
78
83
  </div>
@@ -170,7 +175,7 @@ For internal use only - not part of config object, Default: `""`
170
175
  input_box,
171
176
  ok_button;
172
177
 
173
- $: titleToUse = title != "" ? title : capitaliseFirstLetter(_type);
178
+ $: titleToUse = title !== "" ? title : capitaliseFirstLetter(_type);
174
179
 
175
180
  /**
176
181
  * Determines the type of Dialog.
@@ -204,13 +209,10 @@ For internal use only - not part of config object, Default: `""`
204
209
  switch (_type) {
205
210
  case "alert":
206
211
  return;
207
- break;
208
212
  case "confirm":
209
213
  return true;
210
- break;
211
214
  case "prompt":
212
215
  return input_value;
213
- break;
214
216
  }
215
217
  }
216
218
 
@@ -218,13 +220,10 @@ For internal use only - not part of config object, Default: `""`
218
220
  switch (_type) {
219
221
  case "alert":
220
222
  return;
221
- break;
222
223
  case "confirm":
223
224
  return false;
224
- break;
225
225
  case "prompt":
226
226
  return null;
227
- break;
228
227
  }
229
228
  }
230
229
 
@@ -0,0 +1,55 @@
1
+ <!--
2
+ @component
3
+
4
+
5
+ @param {'' | 'warning' | 'info' | 'danger' | 'primary' | 'success' | 'link' | 'dark' | 'light'} [color=""] - Color of the Divider lines, Default: `""`
6
+ @param {boolean} [light=false] - Whether to display a lighter variant of the `color`, Default: `false`
7
+ @param {boolean} [vertical=false] - Whether to orient the Divider vertically. Vertical Divider take up the height of their parent., Default: `false`
8
+ @param {'center' | 'left' | 'right' | 'top' | 'bottom'} [alignment="center"] - Alignment of the Divider text. `top`/`left` and `bottom`/`right` are analogous for vertical Dividers, Default: `"center"`
9
+ @param {string} [style=""] - Inline CSS styles for the Divider, Default: `""`
10
+ @param {string} [class=""] - CSS class for Divider, Default: `""`
11
+
12
+ ### Slots
13
+ - `<slot name="default" />` - Default slot for text inside Divider
14
+
15
+ -->
16
+
17
+ <div
18
+ class:is-vertical={vertical}
19
+ class:is-light={light}
20
+ class="kws-divider is-{alignment} is-{color} {klass}"
21
+ {style}>
22
+ <!--Default slot for text inside Divider--><slot />
23
+ </div>
24
+
25
+ <script>
26
+ /**
27
+ * Color of the Divider lines
28
+ * @type {'' | 'warning' | 'info' | 'danger' | 'primary' | 'success' | 'link' | 'dark' | 'light'}
29
+ */
30
+ export let color = "",
31
+ /**
32
+ * Whether to display a lighter variant of the `color`
33
+ */
34
+ light = false,
35
+ /**
36
+ * Whether to orient the Divider vertically. Vertical Divider take up the height of their parent.
37
+ */
38
+ vertical = false,
39
+ /**
40
+ * Alignment of the Divider text. `top`/`left` and `bottom`/`right` are analogous for vertical Dividers
41
+ * @type {'center' | 'left' | 'right' | 'top' | 'bottom'}
42
+ */
43
+ alignment = "center",
44
+ /**
45
+ * Inline CSS styles for the Divider
46
+ */
47
+ style = "";
48
+
49
+ /**
50
+ * CSS class for Divider
51
+ * @type {string}
52
+ */
53
+ let klass = "";
54
+ export { klass as class };
55
+ </script>