@statistikzh/leu 0.24.0 → 0.24.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.
Files changed (87) hide show
  1. package/.github/workflows/publish.yml +2 -2
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +15 -0
  4. package/dist/Accordion.js +1 -1
  5. package/dist/Button.js +1 -1
  6. package/dist/ButtonGroup.js +1 -1
  7. package/dist/ChartWrapper.js +1 -1
  8. package/dist/Checkbox.js +1 -1
  9. package/dist/CheckboxGroup.js +1 -1
  10. package/dist/Chip.js +1 -1
  11. package/dist/ChipGroup.js +1 -1
  12. package/dist/ChipLink.js +1 -1
  13. package/dist/ChipRemovable.js +1 -1
  14. package/dist/ChipSelectable.js +1 -1
  15. package/dist/Dialog.js +1 -1
  16. package/dist/Dropdown.js +1 -1
  17. package/dist/FileInput.js +1 -1
  18. package/dist/Icon.js +1 -1
  19. package/dist/Input.js +1 -1
  20. package/dist/{LeuElement-BfbOWTGZ.js → LeuElement-BfXSO7MN.js} +1 -1
  21. package/dist/Menu.js +1 -1
  22. package/dist/MenuItem.js +1 -1
  23. package/dist/Message.js +1 -1
  24. package/dist/Pagination.js +1 -1
  25. package/dist/Placeholder.js +1 -1
  26. package/dist/Popup.js +1 -1
  27. package/dist/ProgressBar.js +1 -1
  28. package/dist/Radio.js +1 -1
  29. package/dist/RadioGroup.js +1 -1
  30. package/dist/Range.d.ts +32 -20
  31. package/dist/Range.js +137 -72
  32. package/dist/ScrollTop.js +24 -31
  33. package/dist/Select.js +1 -1
  34. package/dist/Spinner.js +1 -1
  35. package/dist/Table.js +1 -1
  36. package/dist/Tag.js +1 -1
  37. package/dist/VisuallyHidden.js +1 -1
  38. package/dist/components/range/Range.d.ts +33 -20
  39. package/dist/components/range/Range.d.ts.map +1 -1
  40. package/dist/components/range/stories/range.stories.d.ts +1 -0
  41. package/dist/components/range/stories/range.stories.d.ts.map +1 -1
  42. package/dist/index.js +2 -1
  43. package/dist/leu-accordion.js +1 -1
  44. package/dist/leu-button-group.js +1 -1
  45. package/dist/leu-button.js +1 -1
  46. package/dist/leu-chart-wrapper.js +1 -1
  47. package/dist/leu-checkbox-group.js +1 -1
  48. package/dist/leu-checkbox.js +1 -1
  49. package/dist/leu-chip-group.js +1 -1
  50. package/dist/leu-chip-link.js +1 -1
  51. package/dist/leu-chip-removable.js +1 -1
  52. package/dist/leu-chip-selectable.js +1 -1
  53. package/dist/leu-dialog.js +1 -1
  54. package/dist/leu-dropdown.js +1 -1
  55. package/dist/leu-file-input.js +1 -1
  56. package/dist/leu-icon.js +1 -1
  57. package/dist/leu-input.js +1 -1
  58. package/dist/leu-menu-item.js +1 -1
  59. package/dist/leu-menu.js +1 -1
  60. package/dist/leu-message.js +1 -1
  61. package/dist/leu-pagination.js +1 -1
  62. package/dist/leu-placeholder.js +1 -1
  63. package/dist/leu-popup.js +1 -1
  64. package/dist/leu-progress-bar.js +1 -1
  65. package/dist/leu-radio-group.js +1 -1
  66. package/dist/leu-radio.js +1 -1
  67. package/dist/leu-range.js +3 -1
  68. package/dist/leu-scroll-top.js +2 -1
  69. package/dist/leu-select.js +1 -1
  70. package/dist/leu-spinner.js +1 -1
  71. package/dist/leu-table.js +1 -1
  72. package/dist/leu-tag.js +1 -1
  73. package/dist/leu-visually-hidden.js +1 -1
  74. package/dist/lib/utils.d.ts +10 -3
  75. package/dist/lib/utils.d.ts.map +1 -1
  76. package/dist/theme.css +1 -0
  77. package/dist/utils-DBGsNSJW.js +33 -0
  78. package/dist/vscode.html-custom-data.json +38 -34
  79. package/dist/vue/index.d.ts +51 -44
  80. package/dist/web-types.json +86 -80
  81. package/package.json +2 -3
  82. package/src/components/range/Range.ts +160 -87
  83. package/src/components/range/stories/range.stories.ts +3 -0
  84. package/src/components/range/test/range.test.ts +59 -0
  85. package/src/components/scroll-top/scroll-top.css +20 -4
  86. package/src/lib/utils.ts +13 -3
  87. package/src/styles/theme.css +1 -0
@@ -166,4 +166,63 @@ describe("LeuRange", () => {
166
166
  const input = el.shadowRoot?.querySelector("input")
167
167
  expect(input).to.have.attribute("disabled")
168
168
  })
169
+
170
+ it("clamps and rounds when value is set", async () => {
171
+ const el = await defaultFixture({ min: 0, max: 10, step: 3 })
172
+
173
+ el.value = "8"
174
+ await el.updateComplete
175
+
176
+ expect(el.value).to.equal("9")
177
+ })
178
+
179
+ it("re-normalizes when min/max/step changes", async () => {
180
+ const el = await defaultFixture({ min: 0, max: 10, step: 2 })
181
+
182
+ el.value = "9"
183
+ await el.updateComplete
184
+
185
+ expect(el.value).to.equal("10")
186
+
187
+ el.max = 6
188
+ await el.updateComplete
189
+
190
+ expect(el.value).to.equal("6")
191
+ })
192
+
193
+ it("sets the second handle to min when multiple and a single value is provided", async () => {
194
+ const el = await defaultFixture({
195
+ multiple: true,
196
+ min: 10,
197
+ max: 100,
198
+ value: 20,
199
+ })
200
+
201
+ expect(el.value).to.equal("10,20")
202
+
203
+ el.value = "30"
204
+ await el.updateComplete
205
+ expect(el.value).to.equal("10,30")
206
+
207
+ el.value = "30, 40"
208
+ await el.updateComplete
209
+ expect(el.value).to.equal("30,40")
210
+ })
211
+
212
+ it("re-normalizes both values when multiple and min/max/step changes", async () => {
213
+ const el = await defaultFixture({
214
+ multiple: true,
215
+ min: 0,
216
+ max: 10,
217
+ step: 2,
218
+ value: "3,7",
219
+ })
220
+
221
+ expect(el.value).to.equal("4,8")
222
+
223
+ el.max = 6
224
+ await el.updateComplete
225
+
226
+ expect(el.value).to.equal("4,6")
227
+ })
169
228
  })
@@ -1,14 +1,30 @@
1
+ @import url("../../styles/custom-media.css");
2
+
1
3
  .scroll-top {
2
4
  overflow: hidden;
3
5
  position: fixed;
4
- right: 1.5rem;
5
- z-index: 1099;
6
- bottom: 8.125rem;
6
+ z-index: var(--leu-z-index-scroll-top);
7
+
8
+ --_space: 1.5rem;
9
+ right: var(--_space);
10
+ bottom: var(--_space);
7
11
 
8
12
  /* show */
9
- height: 50px;
13
+ height: 3rem;
10
14
  pointer-events: auto;
11
15
  transition: height, bottom 0.9s, 0.6s ease;
16
+
17
+ @media (--viewport-regular) {
18
+ --_space: 2rem;
19
+ }
20
+
21
+ @media (--viewport-large) {
22
+ --_space: 2.5rem;
23
+ }
24
+
25
+ @media (--viewport-xlarge) {
26
+ --_space: 3rem;
27
+ }
12
28
  }
13
29
 
14
30
  .hide {
package/src/lib/utils.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * @param {Number} timeout - Default is 500 ms
5
5
  * @returns {Function} - Your function wrapped in a timeout function
6
6
  */
7
- const debounce = function debounce(func, timeout = 500) {
7
+ export const debounce = function debounce(func, timeout = 500) {
8
8
  let timer = null
9
9
  return (...args) => {
10
10
  clearTimeout(timer)
@@ -20,7 +20,7 @@ const debounce = function debounce(func, timeout = 500) {
20
20
  * @param {Number} timeout - Default is 500 ms
21
21
  * @returns {Function} - Your function wrapped in a timeout function
22
22
  */
23
- const throttle = function throttle(func, timeout = 500) {
23
+ export const throttle = function throttle(func, timeout = 500) {
24
24
  let timer = null
25
25
  return (...args) => {
26
26
  if (timer === null) {
@@ -32,4 +32,14 @@ const throttle = function throttle(func, timeout = 500) {
32
32
  }
33
33
  }
34
34
 
35
- export { debounce, throttle }
35
+ /**
36
+ * Clamp a number between a minimum and maximum value.
37
+ */
38
+ export const clamp = (value: number, min: number, max: number) =>
39
+ Math.min(Math.max(value, min), max)
40
+
41
+ /**
42
+ * Check if a value is a finite number.
43
+ */
44
+ export const isNumber = (value: unknown): value is number =>
45
+ typeof value === "number" && Number.isFinite(value)
@@ -57,6 +57,7 @@
57
57
  --leu-box-shadow-long: 0px 0px 80px var(--leu-color-black-transp-20);
58
58
 
59
59
  --leu-z-index-popup: 100;
60
+ --leu-z-index-scroll-top: 1099;
60
61
 
61
62
  @leu-font-styles './font-definitions.json';
62
63
  --leu-t-font-feature-settings: "ss07", "ss08", "cv03", "cv04", "cv10";