@kws3/ui 2.0.4 → 2.1.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 (108) hide show
  1. package/CHANGELOG.mdx +13 -1
  2. package/buttons/ConfirmButton.svelte +7 -6
  3. package/buttons/DeleteButton.svelte +14 -8
  4. package/buttons/ProcessButton.svelte +15 -9
  5. package/buttons/SubmitButton.svelte +11 -8
  6. package/canvas/Canvas.svelte +263 -0
  7. package/canvas/ESignature.svelte +101 -0
  8. package/canvas/PenControls.svelte +234 -0
  9. package/canvas/PenInput.svelte +152 -0
  10. package/charts/AreaChart.svelte +2 -2
  11. package/charts/BarChart.svelte +2 -2
  12. package/charts/Chart.svelte +16 -12
  13. package/charts/DonutChart.svelte +2 -2
  14. package/charts/LineChart.svelte +2 -2
  15. package/charts/MixedChart.svelte +2 -2
  16. package/charts/PieChart.svelte +2 -2
  17. package/charts/RadialChart.svelte +2 -2
  18. package/charts/utils.d.ts +553 -0
  19. package/charts/utils.d.ts.map +1 -0
  20. package/charts/utils.js +27 -4
  21. package/controls/Checkbox.svelte +7 -6
  22. package/controls/FileUpload.svelte +5 -4
  23. package/controls/NumberInput.svelte +5 -5
  24. package/controls/Radio.svelte +2 -2
  25. package/controls/RangeSlider.svelte +4 -2
  26. package/controls/Toggle.svelte +2 -2
  27. package/controls/ToggleButtons.svelte +1 -1
  28. package/datagrid/GridView/GridRow.svelte +4 -4
  29. package/datagrid/GridView/GridView.svelte +7 -4
  30. package/datagrid/Pagination/Pagination.svelte +12 -11
  31. package/form/index.d.ts +15 -0
  32. package/form/index.d.ts.map +1 -0
  33. package/forms/AutoComplete.svelte +12 -6
  34. package/forms/Datepicker.svelte +4 -3
  35. package/forms/PasswordInput.svelte +224 -0
  36. package/forms/PasswordValidator/validatePassword.d.ts +5 -0
  37. package/forms/PasswordValidator/validatePassword.d.ts.map +1 -0
  38. package/forms/SearchInput.svelte +18 -7
  39. package/forms/Timepicker.svelte +9 -6
  40. package/forms/actions.d.ts +9 -0
  41. package/forms/actions.d.ts.map +1 -0
  42. package/forms/actions.js +6 -0
  43. package/forms/colorpicker/Colorpicker.d.ts +3 -0
  44. package/forms/colorpicker/Colorpicker.d.ts.map +1 -0
  45. package/forms/colorpicker/Colorpicker.js +12 -2
  46. package/forms/colorpicker/Colorpicker.svelte +10 -3
  47. package/forms/select/MultiSelect.svelte +14 -9
  48. package/forms/select/SearchableSelect.svelte +10 -5
  49. package/helpers/CardModal.svelte +7 -2
  50. package/helpers/ClipboardCopier.svelte +3 -3
  51. package/helpers/Dialog/Dialog.svelte +9 -7
  52. package/helpers/Dialog/index.d.ts +42 -0
  53. package/helpers/Dialog/index.d.ts.map +1 -0
  54. package/helpers/Dialog/index.js +58 -19
  55. package/helpers/Divider.svelte +10 -4
  56. package/helpers/FloatingUI/Floatie.svelte +1 -1
  57. package/helpers/FloatingUI/index.d.ts +51 -0
  58. package/helpers/FloatingUI/index.d.ts.map +1 -0
  59. package/helpers/FloatingUI/index.js +13 -0
  60. package/helpers/Icon.svelte +14 -7
  61. package/helpers/Loader.svelte +5 -5
  62. package/helpers/Message.svelte +11 -6
  63. package/helpers/Modal.svelte +7 -2
  64. package/helpers/Notification.svelte +6 -2
  65. package/helpers/Popover.svelte +13 -6
  66. package/helpers/Skeleton.svelte +3 -3
  67. package/helpers/Timeline/Timeline.svelte +1 -1
  68. package/helpers/Timeline/TimelineItem.svelte +8 -4
  69. package/helpers/Tooltip.d.ts +19 -0
  70. package/helpers/Tooltip.d.ts.map +1 -0
  71. package/helpers/Tooltip.js +14 -1
  72. package/index.d.ts +69 -0
  73. package/index.d.ts.map +1 -0
  74. package/index.js +7 -0
  75. package/internal/DrawingPad.d.ts +86 -0
  76. package/internal/DrawingPad.d.ts.map +1 -0
  77. package/internal/DrawingPad.js +306 -0
  78. package/internal/UndoManager.d.ts +17 -0
  79. package/internal/UndoManager.d.ts.map +1 -0
  80. package/internal/UndoManager.js +84 -0
  81. package/internal/fuzzy.d.ts +24 -0
  82. package/internal/fuzzy.d.ts.map +1 -0
  83. package/internal/index.d.ts +16 -0
  84. package/internal/index.d.ts.map +1 -0
  85. package/internal/index.js +5 -1
  86. package/internal/scrollIntoActiveElement.d.ts +2 -0
  87. package/internal/scrollIntoActiveElement.d.ts.map +1 -0
  88. package/keyboard/index.d.ts +30 -0
  89. package/keyboard/index.d.ts.map +1 -0
  90. package/keyboard/index.js +1 -1
  91. package/package.json +6 -3
  92. package/resizeObserver/index.d.ts +8 -0
  93. package/resizeObserver/index.d.ts.map +1 -0
  94. package/search/index.d.ts +17 -0
  95. package/search/index.d.ts.map +1 -0
  96. package/settings.d.ts +22 -0
  97. package/settings.d.ts.map +1 -0
  98. package/settings.js +6 -1
  99. package/styles/Canvas.scss +100 -0
  100. package/styles/RangeSlider.scss +12 -0
  101. package/transitions/components/getEasing.d.ts +2 -0
  102. package/transitions/components/getEasing.d.ts.map +1 -0
  103. package/tsconfig.json +33 -0
  104. package/types/index.d.ts +103 -9
  105. package/types/type-defs/index.d.ts +64 -0
  106. package/utils/index.d.ts +77 -0
  107. package/utils/index.d.ts.map +1 -0
  108. package/types/type-defs/index.ts +0 -14
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Colorpicker.d.ts","sourceRoot":"","sources":["Colorpicker.js"],"names":[],"mappings":""}
@@ -1,6 +1,16 @@
1
+ /**
2
+ *
3
+ * @param {window} win
4
+ * @param {document} doc
5
+ * @returns {any}
6
+ */
1
7
  function initialize(win, doc) {
2
- var CP,
3
- instance = "__instance__",
8
+ /**
9
+ * @type {any}
10
+ */
11
+ var CP;
12
+
13
+ var instance = "__instance__",
4
14
  first = "firstChild",
5
15
  scroll_left = "scrollLeft",
6
16
  scroll_top = "scrollTop",
@@ -9,7 +9,7 @@ This property can be bound to, to fetch the current colour, Default: `"000000"`
9
9
  @param {boolean} [readonly=false] - Enables read-only mode, Default: `false`
10
10
  @param {boolean} [mini=false] - Alternate mini colour picker without typeable input, Default: `false`
11
11
  @param {boolean} [disabled=false] - Disables the component, Default: `false`
12
- @param {''|'small'|'medium'|'large'} [size=""] - Size of the colour picker trigger, Default: `""`
12
+ @param {SizeOptions} [size=] - Size of the colour picker trigger, Default: ``
13
13
 
14
14
  ### Events
15
15
  - `change` - Triggered when color changes
@@ -36,7 +36,7 @@ This property can be bound to, to fetch the current colour, Default: `"000000"`
36
36
  on:focus={focused}
37
37
  {disabled}
38
38
  bind:value={color}
39
- use:colorpicker />
39
+ use:colorpicker={color} />
40
40
  {#if !mini}
41
41
  <Icon icon="hashtag" class="is-left" inner_style="color:#{color}" />
42
42
  {/if}
@@ -60,6 +60,10 @@ This property can be bound to, to fetch the current colour, Default: `"000000"`
60
60
  fire("change");
61
61
  }, 300);
62
62
 
63
+ /**
64
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
65
+ */
66
+
63
67
  /**
64
68
  * Current selected colour (hex format only)
65
69
  *
@@ -84,13 +88,16 @@ This property can be bound to, to fetch the current colour, Default: `"000000"`
84
88
  disabled = false,
85
89
  /**
86
90
  * Size of the colour picker trigger
87
- * @type {import('@kws3/ui/types').SizeOptions}
91
+ * @type {SizeOptions}
88
92
  */
89
93
  size = "";
90
94
 
91
95
  let dragover = false,
92
96
  _colorpicker;
93
97
 
98
+ /**
99
+ * @type {import("svelte/action").Action}
100
+ */
94
101
  function colorpicker(node) {
95
102
  _colorpicker = new ColorPicker(node);
96
103
 
@@ -5,7 +5,7 @@
5
5
  @param {Array|?string} [value=undefined] - Value of the Input
6
6
 
7
7
  This property can be bound to, to fetch the current value, Default: `undefined`
8
- @param {object} [max=null] - Maximum number of selectable items from dropdown list.
8
+ @param {?number} [max=null] - Maximum number of selectable items from dropdown list.
9
9
 
10
10
  Accepts a `null` value for unlimited selected items.
11
11
  Or a number value, Default: `null`
@@ -22,9 +22,10 @@ Only send this prop if you want to fetch `options` asynchronously.
22
22
  `options` prop will be ignored if this prop is set., Default: `null`
23
23
  @param {string|'fuzzy'|'strict'} [search_strategy="fuzzy"] - Filtered options to be displayed strictly based on search text or perform a fuzzy match.
24
24
  Fuzzy match will not work if `search` function is set, as the backend service is meant to do the matching., Default: `"fuzzy"`
25
- @param {number} [scoreThreshold=3] - Score threshold for fuzzy search strategy, setting high score gives more fuzzy matches., Default: `3`
26
- @param {string|''|'small'|'medium'|'large'} [size=""] - Size of the input, Default: `""`
27
- @param {string|''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [color=""] - Color of the input, Default: `""`
25
+ @param {number} [score_threshold=3] - Score threshold for fuzzy search strategy, setting high score gives more fuzzy matches., Default: `3`
26
+ @param {number} [scoreThreshold=undefined] - (deprecated) Score threshold for fuzzy search strategy, setting high score gives more fuzzy matches., Default: `undefined`
27
+ @param {SizeOptions} [size=] - Size of the input, Default: ``
28
+ @param {ColorOptions} [color=] - Color of the input, Default: ``
28
29
  @param {string} [style=""] - Inline CSS for input container, Default: `""`
29
30
  @param {boolean} [readonly=false] - Marks component as read-only, Default: `false`
30
31
  @param {boolean} [disabled=false] - Disables the component, Default: `false`
@@ -70,8 +71,7 @@ Default value: `<span>{option[search_key] || option}</span>`
70
71
  <li class="tag summary-count is-{size} is-{color || 'primary'}">
71
72
  {selectedOptions.length}
72
73
  </li>
73
- <li
74
- class="tag is-{size} summary-text is-{color || 'primary'} is-light">
74
+ <li class="tag is-{size} summary-text is-{color || 'primary'} is-light">
75
75
  Item{selectedOptions.length === 1 ? "" : "s"} selected
76
76
  </li>
77
77
  {:else}
@@ -260,15 +260,20 @@ Default value: `<span>{option[search_key] || option}</span>`
260
260
  * Score threshold for fuzzy search strategy, setting high score gives more fuzzy matches.
261
261
  * @type {number}
262
262
  */
263
- export let scoreThreshold = 3;
263
+ export let score_threshold = 3;
264
+ /**
265
+ * (deprecated) Score threshold for fuzzy search strategy, setting high score gives more fuzzy matches.
266
+ * @type {number}
267
+ */
268
+ export let scoreThreshold = score_threshold;
264
269
  /**
265
270
  * Size of the input
266
- * @type {import('@kws3/ui/types').SizeOptions}
271
+ * @type {SizeOptions}
267
272
  */
268
273
  export let size = "";
269
274
  /**
270
275
  * Color of the input
271
- * @type {import('@kws3/ui/types').ColorOptions}
276
+ * @type {ColorOptions}
272
277
  */
273
278
  export let color = "";
274
279
  /**
@@ -12,15 +12,15 @@ 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 {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: `""`
15
+ @param {SizeOptions} [size=] - Size of the input, Default: ``
16
+ @param {ColorOptions} [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
20
20
 
21
21
  Only send this prop if you want to fetch `options` asynchronously.
22
22
  `options` prop will be ignored if this prop is set., Default: `null`
23
- @param {'fuzzy'|'strict'} [search_strategy="fuzzy"] - Filtered options to be displayed strictly based on search text or perform a fuzzy match.
23
+ @param {string|'fuzzy'|'strict'} [search_strategy="fuzzy"] - Filtered options to be displayed strictly based on search text or perform a fuzzy match.
24
24
  Fuzzy match will not work if `search` function is set, as the backend service is meant to do the matching., Default: `"fuzzy"`
25
25
  @param {boolean} [disabled=false] - Disables the component, Default: `false`
26
26
  @param {string} [selected_icon="check"] - Icon used to mark selected items in dropdown list, Default: `"check"`
@@ -84,6 +84,11 @@ Default value: `<span>{option[search_key] || option}</span>`
84
84
 
85
85
  const rootContainerId = "kws-overlay-root";
86
86
 
87
+ /**
88
+ * @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
89
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
90
+ */
91
+
87
92
  /**
88
93
  * Value of the Input
89
94
  *
@@ -113,12 +118,12 @@ Default value: `<span>{option[search_key] || option}</span>`
113
118
  export let value_key = "id";
114
119
  /**
115
120
  * Size of the input
116
- * @type {import('@kws3/ui/types').SizeOptions}
121
+ * @type {SizeOptions}
117
122
  */
118
123
  export let size = "";
119
124
  /**
120
125
  * Color of the input
121
- * @type {import('@kws3/ui/types').ColorOptions}
126
+ * @type {ColorOptions}
122
127
  */
123
128
  export let color = "";
124
129
  /**
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  @param {string} [title=""] - Title of the modal, Default: `""`
6
- @param {'small'|'medium'|'large'} [size="small"] - Size of the modal, Default: `"small"`
6
+ @param {SizeOptions} [size=small] - Size of the modal, Default: `small`
7
7
  @param {boolean} [is_active=false] - Determines whether modal is displayed or not, Default: `false`
8
8
  @param {boolean} [closable=true] - If this is set to false, the modal cannot be closed using the UI
9
9
 
@@ -110,6 +110,11 @@ Only visible when the
110
110
  <script>
111
111
  import { fade, scale } from "svelte/transition";
112
112
  import { hasTransitions } from "../settings";
113
+
114
+ /**
115
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
116
+ */
117
+
113
118
  /**
114
119
  * Title of the modal
115
120
  * @type {string}
@@ -117,7 +122,7 @@ Only visible when the
117
122
  export let title = "",
118
123
  /**
119
124
  * Size of the modal
120
- * @type {import('@kws3/ui/types').SizeOptions}
125
+ * @type {SizeOptions}
121
126
  */
122
127
  size = "small",
123
128
  /**
@@ -8,9 +8,9 @@
8
8
  @param {string} [copied_icon="check"] - Icon displayed on successful copy operation, Default: `"check"`
9
9
  @param {string} [copy=""] - Text to be copied into clipboard, Default: `""`
10
10
  @param {boolean} [copied=false] - Determines if the copy operation has taken place, Default: `false`
11
- @param {''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [copied_icon_color="success"] - Colour of the `copied_icon` after a succesful copy operation
11
+ @param {ColorOptions} [copied_icon_color=success] - Colour of the `copied_icon` after a succesful copy operation
12
12
 
13
- If `''` is selected, Icon will not change colour after copying, Default: `"success"`
13
+ If `''` is selected, Icon will not change colour after copying, Default: `success`
14
14
  @param {string} [class=""] - CSS classes for the whole component, Default: `""`
15
15
 
16
16
  ### Slots
@@ -73,7 +73,7 @@ If `''` is selected, Icon will not change colour after copying, Default: `"succe
73
73
  *
74
74
  * If `''` is selected, Icon will not change colour after copying
75
75
  *
76
- * @type {import('@kws3/ui/types').ColorOptions}
76
+ * @type {ColorOptions}
77
77
  */
78
78
  copied_icon_color = "success";
79
79
 
@@ -2,18 +2,19 @@
2
2
  @component
3
3
 
4
4
 
5
- @param {string} [title=""] - Title text of the Dialog box, Default: `""`
5
+ @param {string} [title=""] - Title text of the Dialog box.
6
+ Will default to `Alert`, `Confirm` or `Prompt` depending on the dialog type, Default: `""`
6
7
  @param {string} [help_text=""] - Additional text to provide further context to the user, Default: `""`
7
- @param {'small'|'medium'|'large'} [size="small"] - Size of the Dialog box, Default: `"small"`
8
+ @param {SizeOptions} [size=small] - Size of the Dialog box, Default: `small`
8
9
  @param {string} [input_value=""] - Default value inside text input displayed on `prompt()` Dialogs, Default: `""`
9
10
  @param {string} [icon=""] - Icon in the Dialog box, Default: `""`
10
- @param {'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [icon_color="primary"] - Color of the Icon in the Dialog box, Default: `"primary"`
11
- @param {'small'|'medium'|'large'} [icon_size=""] - Size of the Icon in the Dialog box, Default: `""`
11
+ @param {ColorOptions} [icon_color=primary] - Color of the Icon in the Dialog box, Default: `primary`
12
+ @param {SizeOptions} [icon_size=] - Size of the Icon in the Dialog box, Default: ``
12
13
  @param {string} [ok_button_text="Ok"] - Text to be displayed in the OK button, Default: `"Ok"`
13
- @param {'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [ok_button_color="primary"] - Color of OK button, Default: `"primary"`
14
+ @param {ColorOptions} [ok_button_color=primary] - Color of OK button, Default: `primary`
14
15
  @param {string} [ok_button_icon="check"] - Icon in the OK button, Default: `"check"`
15
16
  @param {string} [cancel_button_text="Cancel"] - Text to be displayed in the Cancel button, Default: `"Cancel"`
16
- @param {''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [cancel_button_color=""] - Color of Cancel button, Default: `""`
17
+ @param {ColorOptions} [cancel_button_color=] - Color of Cancel button, Default: ``
17
18
  @param {string} [cancel_button_icon="ban"] - Icon in the Cancel button, Default: `"ban"`
18
19
  @param {string} [_type=""] - Determines the type of Dialog.
19
20
 
@@ -99,7 +100,8 @@ For internal use only - not part of config object, Default: `""`
99
100
  */
100
101
 
101
102
  /**
102
- * Title text of the Dialog box
103
+ * Title text of the Dialog box.
104
+ * Will default to `Alert`, `Confirm` or `Prompt` depending on the dialog type
103
105
  * @type {string}
104
106
  */
105
107
  export let title = "",
@@ -0,0 +1,42 @@
1
+ /**
2
+ *
3
+ * @param {string} msg
4
+ * @param {DialogProps} [props={}]
5
+ */
6
+ export function alert(msg: string, props?: DialogProps): Promise<any>;
7
+ /**
8
+ *
9
+ * @param {string} msg
10
+ * @param {DialogProps} [props={}]
11
+ */
12
+ export function prompt(msg: string, props?: DialogProps): Promise<any>;
13
+ /**
14
+ *
15
+ * @param {string} msg
16
+ * @param {DialogProps} [props={}]
17
+ */
18
+ export function confirm(msg: string, props?: DialogProps): Promise<any>;
19
+ declare const _default: Dialog;
20
+ export default _default;
21
+ export type DialogProps = import('@kws3/ui/types').DialogProps;
22
+ declare class Dialog {
23
+ /**
24
+ *
25
+ * @param {string} msg
26
+ * @param {DialogProps} [props={}]
27
+ */
28
+ alert(msg: string, props?: DialogProps): Promise<any>;
29
+ /**
30
+ *
31
+ * @param {string} msg
32
+ * @param {DialogProps} [props={}]
33
+ */
34
+ prompt(msg: string, props?: DialogProps): Promise<any>;
35
+ /**
36
+ *
37
+ * @param {string} msg
38
+ * @param {DialogProps} [props={}]
39
+ */
40
+ confirm(msg: string, props?: DialogProps): Promise<any>;
41
+ }
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA4DA;;;;GAIG;AACH,2BAHW,MAAM,UACN,WAAW,gBAKrB;AAED;;;;GAIG;AACH,4BAHW,MAAM,UACN,WAAW,gBAKrB;AAED;;;;GAIG;AACH,6BAHW,MAAM,UACN,WAAW,gBAKrB;;;0BArFY,OAAO,gBAAgB,EAAE,WAAW;AA2BjD;IACE;;;;OAIG;IAEH,WAJW,MAAM,UACN,WAAW,gBAKrB;IAED;;;;OAIG;IACH,YAHW,MAAM,UACN,WAAW,gBAIrB;IAED;;;;OAIG;IACH,aAHW,MAAM,UACN,WAAW,gBAIrB;CACF"}
@@ -1,11 +1,15 @@
1
- import Dialog from "./Dialog.svelte";
1
+ import { default as _Dialog } from "./Dialog.svelte";
2
+
3
+ /**
4
+ * @typedef {import('@kws3/ui/types').DialogProps} DialogProps
5
+ */
2
6
 
3
7
  function createDialog(msg, props) {
4
8
  props = Object.assign(props, { _text: msg });
5
9
 
6
10
  const promise = new Promise((fulfil) => {
7
11
  //@ts-ignore
8
- const dialog = new Dialog({
12
+ const dialog = new _Dialog({
9
13
  target: document.body,
10
14
  props,
11
15
  intro: true,
@@ -24,29 +28,64 @@ function createDialog(msg, props) {
24
28
  return promise;
25
29
  }
26
30
 
31
+ class Dialog {
32
+ /**
33
+ *
34
+ * @param {string} msg
35
+ * @param {DialogProps} [props={}]
36
+ */
37
+
38
+ alert(msg, props = {}) {
39
+ return createDialog(msg, { ...props, _type: "alert" });
40
+ }
41
+
42
+ /**
43
+ *
44
+ * @param {string} msg
45
+ * @param {DialogProps} [props={}]
46
+ */
47
+ prompt(msg, props) {
48
+ return createDialog(msg, { ...props, _type: "prompt" });
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @param {string} msg
54
+ * @param {DialogProps} [props={}]
55
+ */
56
+ confirm(msg, props) {
57
+ return createDialog(msg, { ...props, _type: "confirm" });
58
+ }
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @param {string} msg
64
+ * @param {DialogProps} [props={}]
65
+ */
27
66
  export function alert(msg, props) {
28
- props = props || {};
29
- props._type = "alert";
30
- return createDialog(msg, props);
67
+ let dialog = new Dialog();
68
+ return dialog.alert(msg, props);
31
69
  }
32
70
 
71
+ /**
72
+ *
73
+ * @param {string} msg
74
+ * @param {DialogProps} [props={}]
75
+ */
33
76
  export function prompt(msg, props) {
34
- props = props || {};
35
- props._type = "prompt";
36
- return createDialog(msg, props);
77
+ let dialog = new Dialog();
78
+ return dialog.prompt(msg, props);
37
79
  }
38
80
 
81
+ /**
82
+ *
83
+ * @param {string} msg
84
+ * @param {DialogProps} [props={}]
85
+ */
39
86
  export function confirm(msg, props) {
40
- props = props || {};
41
- props._type = "confirm";
42
- return createDialog(msg, props);
87
+ let dialog = new Dialog();
88
+ return dialog.confirm(msg, props);
43
89
  }
44
90
 
45
- //@ts-ignore
46
- Dialog.alert = alert;
47
- //@ts-ignore
48
- Dialog.confirm = confirm;
49
- //@ts-ignore
50
- Dialog.prompt = prompt;
51
-
52
- export default Dialog;
91
+ export default new Dialog();
@@ -2,10 +2,10 @@
2
2
  @component
3
3
 
4
4
 
5
- @param {'' | 'warning' | 'info' | 'danger' | 'primary' | 'success' | 'link' | 'dark' | 'light'} [color=""] - Color of the Divider lines, Default: `""`
5
+ @param {ColorOptions} [color=] - Color of the Divider lines, Default: ``
6
6
  @param {boolean} [light=false] - Whether to display a lighter variant of the `color`, Default: `false`
7
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"`
8
+ @param {Exclude<Positions, 'start'|'end'>} [alignment=center] - Alignment of the Divider text. `top`/`left` and `bottom`/`right` are analogous for vertical Dividers, Default: `center`
9
9
  @param {string} [style=""] - Inline CSS styles for the Divider, Default: `""`
10
10
  @param {string} [class=""] - CSS class for Divider, Default: `""`
11
11
 
@@ -23,9 +23,15 @@
23
23
  </div>
24
24
 
25
25
  <script>
26
+ /**
27
+ * @typedef {import('@kws3/ui/types').ColorOptions} ColorOptions
28
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
29
+ * @typedef {import('@kws3/ui/types').Positions} Positions
30
+ */
31
+
26
32
  /**
27
33
  * Color of the Divider lines
28
- * @type {import('@kws3/ui/types').ColorOptions}
34
+ * @type {ColorOptions}
29
35
  */
30
36
  export let color = "",
31
37
  /**
@@ -38,7 +44,7 @@
38
44
  vertical = false,
39
45
  /**
40
46
  * Alignment of the Divider text. `top`/`left` and `bottom`/`right` are analogous for vertical Dividers
41
- * @type {string|'center' | 'left' | 'right' | 'top' | 'bottom'}
47
+ * @type {Exclude<Positions, 'start'|'end'>}
42
48
  */
43
49
  alignment = "center",
44
50
  /**
@@ -6,7 +6,7 @@
6
6
  @param {string} [message=""] - Message in the notification, Default: `""`
7
7
  @param {'notification'|'snackbar'|'toast'} [variant="notification"] - variation of floating UI, Default: `"notification"`
8
8
  @param {number} [duration=3000] - Duration of the notification, Default: `3000`
9
- @param {''|'primary'|'success'|'warning'|'info'|'danger'|'dark'|'light'} [color="primary"] - Toast notification background color, Default: `"primary"`
9
+ @param {ColorOptions} [color=primary] - Toast notification background color, Default: `primary`
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`
@@ -0,0 +1,51 @@
1
+ export namespace FloatiesStore {
2
+ export { create };
3
+ export { remove };
4
+ export { subscribe };
5
+ }
6
+ /**
7
+ * @typedef {import("@kws3/ui/types").FloatieType} FloatieType
8
+ */
9
+ /**
10
+ * @type {FloatieType}
11
+ */
12
+ export const Notifications: FloatieType;
13
+ /**
14
+ * @type {FloatieType}
15
+ */
16
+ export const Toasts: FloatieType;
17
+ /**
18
+ * @type {FloatieType}
19
+ */
20
+ export const Snackbars: FloatieType;
21
+ export type FloatieType = import("@kws3/ui/types").FloatieType;
22
+ declare function create(newItem: any): {
23
+ props: any;
24
+ destroy: () => void;
25
+ };
26
+ declare function remove(props: any): void;
27
+ declare const subscribe: (this: void, run: import("svelte/store").Subscriber<{
28
+ top: {
29
+ notification: any[];
30
+ snackbar: any[];
31
+ toast: any[];
32
+ };
33
+ bottom: {
34
+ notification: any[];
35
+ snackbar: any[];
36
+ toast: any[];
37
+ };
38
+ }>, invalidate?: (value?: {
39
+ top: {
40
+ notification: any[];
41
+ snackbar: any[];
42
+ toast: any[];
43
+ };
44
+ bottom: {
45
+ notification: any[];
46
+ snackbar: any[];
47
+ toast: any[];
48
+ };
49
+ }) => void) => import("svelte/store").Unsubscriber;
50
+ export {};
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;AA4GA;;GAEG;AAEH;;GAEG;AACH,4BAFU,WAAW,CAgBnB;AAEF;;GAEG;AACH,qBAFU,WAAW,CAiBnB;AAEF;;GAEG;AACH,wBAFU,WAAW,CAiBnB;0BA5DW,OAAO,gBAAgB,EAAE,WAAW;AAxD/C;;;EA6BC;AAED,0CAYC"}
@@ -106,6 +106,13 @@ const buildInitialiser = (defaultOpts, mandatoryOpts) => {
106
106
  };
107
107
  };
108
108
 
109
+ /**
110
+ * @typedef {import("@kws3/ui/types").FloatieType} FloatieType
111
+ */
112
+
113
+ /**
114
+ * @type {FloatieType}
115
+ */
109
116
  export const Notifications = {
110
117
  create: buildInitialiser(
111
118
  {
@@ -122,6 +129,9 @@ export const Notifications = {
122
129
  remove: FloatiesStore.remove,
123
130
  };
124
131
 
132
+ /**
133
+ * @type {FloatieType}
134
+ */
125
135
  export const Toasts = {
126
136
  create: buildInitialiser(
127
137
  {
@@ -139,6 +149,9 @@ export const Toasts = {
139
149
  remove: FloatiesStore.remove,
140
150
  };
141
151
 
152
+ /**
153
+ * @type {FloatieType}
154
+ */
142
155
  export const Snackbars = {
143
156
  create: buildInitialiser(
144
157
  {
@@ -2,12 +2,12 @@
2
2
  @component
3
3
 
4
4
 
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: `""`
5
+ @param {SizeOptions} [size=] - Size of the Icon, Default: ``
6
+ @param {ExtendedColorOptions} [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 {string|''|'fa'|'lar'|'las'|'gg'|'unicons'|'material'} [family=""] - Icon family, can be modified globally in framework settings
8
+ @param {FontFamilies} [family=] - Icon family, can be modified globally in framework settings
9
9
 
10
- Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
10
+ Ultimately defaults to `fa`, if family is not set anywhere, Default: ``
11
11
  @param {string} [style=""] - Inline CSS for icon container, Default: `""`
12
12
  @param {string} [inner_class=""] - CSS classes for icon, Default: `""`
13
13
  @param {string} [inner_style=""] - Inline CSS for icon, Default: `""`
@@ -65,14 +65,21 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
65
65
  <script>
66
66
  import { defaultIconFamily } from "../settings";
67
67
 
68
+ /**
69
+ * @typedef {import('@kws3/ui/types').ExtendedColorOptions} ExtendedColorOptions
70
+ * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
71
+ * @typedef {import('@kws3/ui/types').FontFamilies} FontFamilies
72
+ *
73
+ */
74
+
68
75
  /**
69
76
  * Size of the Icon
70
- * @type {import('@kws3/ui/types').SizeOptions}
77
+ * @type {SizeOptions}
71
78
  */
72
79
  export let size = "",
73
80
  /**
74
81
  * Color of the Icon
75
- * @type {import('@kws3/ui/types').ColorOptions | 'grey'}
82
+ * @type {ExtendedColorOptions}
76
83
  */
77
84
  color = "",
78
85
  /**
@@ -83,7 +90,7 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: `""`
83
90
  * Icon family, can be modified globally in framework settings
84
91
  *
85
92
  * Ultimately defaults to `fa`, if family is not set anywhere
86
- * @type {string|''|'fa'|'lar'|'las'|'gg'|'unicons'|'material'}
93
+ * @type {FontFamilies}
87
94
  */
88
95
  family = "",
89
96
  /**
@@ -2,9 +2,9 @@
2
2
  @component
3
3
 
4
4
 
5
- @param {'grey' | 'light' | 'warning' | 'info' | 'danger' | 'primary' | 'success'} [spinner_color="grey"] - Color of the Spinner, Default: `"grey"`
6
- @param {'small'|'medium'|'large'} [spinner_size="medium"] - Size of the Spinner, Default: `"medium"`
7
- @param {'transparent' | 'warning' | 'info' | 'danger' | 'primary' | 'success' | 'link'} [background_color="transparent"] - Backgound color of the Spinner container, Default: `"transparent"`
5
+ @param {ExtendedColorOptions} [spinner_color=grey] - Color of the Spinner, Default: `grey`
6
+ @param {SizeOptions} [spinner_size=medium] - Size of the Spinner, Default: `medium`
7
+ @param {BGColorOptions} [background_color=transparent] - Backgound color of the Spinner container, Default: `transparent`
8
8
  @param {string} [background_size="medium"] - Size of the Spinner container. It can also accept css units
9
9
 
10
10
  **Examples:** `small` | `medium` | `large` | `halfheight` | `fullheight` | `10px` | `5rem` | `100vh`, Default: `"medium"`
@@ -33,7 +33,7 @@ The overlay is absolutely positioned. Ensure that the parent container is relati
33
33
  <script>
34
34
  /**
35
35
 
36
- * @typedef {import('@kws3/ui/types').SpinnerColorOptions} SpinnerColorOptions
36
+ * @typedef {import('@kws3/ui/types').ExtendedColorOptions} ExtendedColorOptions
37
37
  * @typedef {import('@kws3/ui/types').SizeOptions} SizeOptions
38
38
  * @typedef {import('@kws3/ui/types').BGColorOptions} BGColorOptions
39
39
  *
@@ -41,7 +41,7 @@ The overlay is absolutely positioned. Ensure that the parent container is relati
41
41
  /**
42
42
  * Color of the Spinner
43
43
  * @link https://bulma.io/documentation/helpers/color-helpers/
44
- * @type {SpinnerColorOptions}
44
+ * @type {ExtendedColorOptions}
45
45
  */
46
46
  export let spinner_color = "grey",
47
47
  /**