@kws3/ui 2.2.0 → 2.2.2

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 CHANGED
@@ -1,3 +1,12 @@
1
+ # 2.2.2
2
+ - `ScrollableList` - fix jumping issue when edge of scrollable regions are reached
3
+
4
+ # 2.2.1
5
+ - `Icon` fix icon sizes when line-awesome icons are loaded
6
+ - `Icon` fix material icons when icon family is set globally
7
+ - `Icon` add support for adding custom icon families
8
+ - `Chart` fix, ensure ApexCharts is loaded before trying to initialise it
9
+
1
10
  # 2.2.0
2
11
  - Fix bug where `ScrollableList` component puts extra padding on top of list when fast scroll to top
3
12
  - `ScrollableList` - Fix bug to reset internal positioning props when data changes
@@ -9,11 +9,14 @@
9
9
  @param {string} [background_image=""] - Background image for the canvas, Default: `""`
10
10
  @param {boolean} [readonly=false] - Determines whether canvas is readonly or not, Default: `false`
11
11
  @param {boolean} [disabled=false] - Determines whether canvas is disabled or not, Default: `false`
12
- @param {string} [expand_from="center"] - The direction to which the canvas should expand, Default: `"center"`
13
- @param {string} [expand_to="center"] - The direction to which the canvas should expand, Default: `"center"`
14
- @param {number} [expand_scale=50] - Transform scale of the canvas on expansion, Default: `50`
15
- @param {array} [actions=[]] - `CONST` List of actions toolbar, Default: `[]`
12
+ @param {string} [expand_from="center"] - The direction from which the canvas should expand.
13
+ 'top', 'bottom', 'left', 'right', 'center' and also 'n%', Default: `"center"`
14
+ @param {string} [expand_to="center"] - The direction to which the canvas should expand.
15
+ 'top', 'bottom', 'left', 'right', 'center' and also 'n%', Default: `"center"`
16
+ @param {number} [expand_scale=50] - Transform scale of the canvas on expansion
17
+ value in percentage %, Default: `50`
16
18
  @param {Extract<Positions, 'start'|'center'|'end'>} [control_position=center] - Default position of controls, Default: `center`
19
+ @param {array} [actions=[]] - List of actions toolbar, Default: `[]`
17
20
 
18
21
  -->
19
22
  <Canvas
@@ -91,11 +94,7 @@
91
94
  /**
92
95
  * List of actions toolbar
93
96
  */
94
- actions = [
95
- "undo",
96
- "redo",
97
- "reset",
98
- ];
97
+ actions = ["undo", "redo", "reset"];
99
98
 
100
- let tools = { Pen };
99
+ let tools = { Pen };
101
100
  </script>
@@ -116,6 +116,13 @@ This is to prevent unnecessary event subscriptions., Default: `[]`
116
116
  };
117
117
 
118
118
  const init = () => {
119
+ if (!ApexCharts) {
120
+ // `init()` was probably called from reactive functions instead of `onMount`.
121
+ // All those calls can be ignored, because when `onMount` calls it,
122
+ // it will have the latest data and config
123
+ return;
124
+ }
125
+
119
126
  chart && chart.destroy();
120
127
 
121
128
  if (typeof window !== "undefined") {
@@ -22,6 +22,7 @@ Fuzzy match will not work if `search` function is set, as the backend service is
22
22
  @param {string} [style=""] - Inline CSS for input container, Default: `""`
23
23
  @param {boolean} [readonly=false] - Marks component as read-only, Default: `false`
24
24
  @param {boolean} [disabled=false] - Disables the component, Default: `false`
25
+ @param {PopperStrategies} [popper_strategy=absolute] - Placement strategy used by Popperjs, see popperjs docs, Default: `absolute`
25
26
  @param {HTMLElement|string} [dropdown_portal=undefined] - Where to render the dropdown list.
26
27
  Can be a DOM element or a `string` with the CSS selector of the element.
27
28
 
@@ -30,6 +30,7 @@ Fuzzy match will not work if `search` function is set, as the backend service is
30
30
  @param {boolean} [readonly=false] - Marks component as read-only, Default: `false`
31
31
  @param {boolean} [disabled=false] - Disables the component, Default: `false`
32
32
  @param {string} [selected_icon="check"] - Icon used to mark selected items in dropdown list, Default: `"check"`
33
+ @param {PopperStrategies} [popper_strategy=absolute] - Placement strategy used by Popperjs, see popperjs docs, Default: `absolute`
33
34
  @param {boolean} [summary_mode=false] - Shows only the number of items selected, instead of listing all the selected items in the input., Default: `false`
34
35
  @param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
35
36
  @param {string} [async_search_prompt="Start typing to search..."] - Message to display in dropdown when async search can be performed, Default: `"Start typing to search..."`
@@ -27,6 +27,7 @@ Fuzzy match will not work if `search` function is set, as the backend service is
27
27
  @param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
28
28
  @param {string} [async_search_prompt="Start typing to search..."] - Message to display in dropdown when async search can be performed, Default: `"Start typing to search..."`
29
29
  @param {string} [remove_all_tip="Clear Selection"] - Tooltip text for the Clear selection button, Default: `"Clear Selection"`
30
+ @param {PopperStrategies} [popper_strategy=absolute] - Placement strategy used by Popperjs, see popperjs docs, Default: `absolute`
30
31
  @param {HTMLElement|string} [dropdown_portal=undefined] - Where to render the dropdown list.
31
32
  Can be a DOM element or a `string` with the CSS selector of the element.
32
33
 
@@ -22,6 +22,17 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: ``
22
22
  </span>
23
23
 
24
24
  <style>
25
+ .fa-lg {
26
+ font-size: 1.33333333em;
27
+ line-height: 0.75em;
28
+ vertical-align: -15%;
29
+ }
30
+ .fa-2x {
31
+ font-size: 2em;
32
+ }
33
+ .fa-3x {
34
+ font-size: 3em;
35
+ }
25
36
  .icon .gg {
26
37
  transform: scale(0.75);
27
38
  }
@@ -117,7 +128,7 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: ``
117
128
  internal_size,
118
129
  usedFamily;
119
130
 
120
- $: inner_icon = family === "material" ? icon : "";
131
+ $: inner_icon = usedFamily === "material" ? icon : "";
121
132
  $: {
122
133
  usedFamily = family !== "" ? family : globalFamily ? globalFamily : "fa";
123
134
 
@@ -140,9 +151,12 @@ Ultimately defaults to `fa`, if family is not set anywhere, Default: ``
140
151
  case "material":
141
152
  familyClass = "material-icons material-symbols-outlined ";
142
153
  break;
143
- default:
154
+ case "fa":
144
155
  familyClass = "fa fa-";
145
156
  break;
157
+ default:
158
+ familyClass = usedFamily + "-";
159
+ break;
146
160
  }
147
161
  }
148
162
 
@@ -54,7 +54,9 @@ while more items are loading
54
54
  bind:offsetHeight={viewport_height}>
55
55
  <div
56
56
  bind:this={contents}
57
- style="padding-top: {top}px; padding-bottom: {bottom}px;">
57
+ style="padding-top: {start === 0
58
+ ? 0
59
+ : top}px; padding-bottom: {bottom}px;">
58
60
  {#each visible as item (item.index)}
59
61
  <div class="row">
60
62
  <!--Default slot for list view items-->
@@ -148,7 +150,7 @@ while more items are loading
148
150
 
149
151
  async function refresh() {
150
152
  if (!mounted) return;
151
- const scrollTop = viewport.scrollTop;
153
+ const { scrollTop } = viewport;
152
154
  await tick(); // wait until the DOM is up to date
153
155
  let content_height = top - scrollTop;
154
156
  let i = start;
@@ -172,7 +174,7 @@ while more items are loading
172
174
  }
173
175
 
174
176
  async function handle_scroll() {
175
- const scrollTop = viewport.scrollTop;
177
+ const { scrollTop } = viewport;
176
178
  const old_start = start;
177
179
  for (let v = 0; v < rows.length; v += 1) {
178
180
  height_map[start + v] = item_height || rows[v].offsetHeight;
@@ -183,7 +185,10 @@ while more items are loading
183
185
  const row_height = height_map[i] || average_height;
184
186
  if (y + row_height > scrollTop) {
185
187
  start = i;
186
- top = y - row_height * padding_threshold;
188
+ top =
189
+ y > row_height * padding_threshold
190
+ ? y - row_height * padding_threshold
191
+ : y;
187
192
  break;
188
193
  }
189
194
  y += row_height;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kws3/ui",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "UI components for use with Svelte v3 applications.",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "typescript": "^5.0.4"
37
37
  },
38
- "gitHead": "c65de99beeacf8cd4eee98bcc5cf82319fe086bf"
38
+ "gitHead": "a4a85bf945292245105ccbe4057943bcea1e080f"
39
39
  }
package/types/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export type ColorOptions = (typeof Colors)[number];
14
14
  export type SizeOptions = (typeof Sizes)[number];
15
15
  export type ExtendedColorOptions = (typeof ExtendedColors)[number];
16
16
  export type BGColorOptions = (typeof BGColors)[number];
17
- export type FontFamilies = (typeof FontFamilies)[number];
17
+ export type FontFamilies = (typeof FontFamilies)[number] | String;
18
18
  export type Positions = (typeof Positions)[number];
19
19
  export type TippyPositions = (typeof TippyPositions)[number];
20
20
  export type FloatiePositions = (typeof FloatiePositions)[number];