@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.
- package/.github/workflows/publish.yml +2 -2
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/Accordion.js +1 -1
- package/dist/Button.js +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/ChartWrapper.js +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/CheckboxGroup.js +1 -1
- package/dist/Chip.js +1 -1
- package/dist/ChipGroup.js +1 -1
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/Dropdown.js +1 -1
- package/dist/FileInput.js +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.js +1 -1
- package/dist/{LeuElement-BfbOWTGZ.js → LeuElement-BfXSO7MN.js} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/Message.js +1 -1
- package/dist/Pagination.js +1 -1
- package/dist/Placeholder.js +1 -1
- package/dist/Popup.js +1 -1
- package/dist/ProgressBar.js +1 -1
- package/dist/Radio.js +1 -1
- package/dist/RadioGroup.js +1 -1
- package/dist/Range.d.ts +32 -20
- package/dist/Range.js +137 -72
- package/dist/ScrollTop.js +24 -31
- package/dist/Select.js +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.js +1 -1
- package/dist/Tag.js +1 -1
- package/dist/VisuallyHidden.js +1 -1
- package/dist/components/range/Range.d.ts +33 -20
- package/dist/components/range/Range.d.ts.map +1 -1
- package/dist/components/range/stories/range.stories.d.ts +1 -0
- package/dist/components/range/stories/range.stories.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.js +1 -1
- package/dist/leu-chart-wrapper.js +1 -1
- package/dist/leu-checkbox-group.js +1 -1
- package/dist/leu-checkbox.js +1 -1
- package/dist/leu-chip-group.js +1 -1
- package/dist/leu-chip-link.js +1 -1
- package/dist/leu-chip-removable.js +1 -1
- package/dist/leu-chip-selectable.js +1 -1
- package/dist/leu-dialog.js +1 -1
- package/dist/leu-dropdown.js +1 -1
- package/dist/leu-file-input.js +1 -1
- package/dist/leu-icon.js +1 -1
- package/dist/leu-input.js +1 -1
- package/dist/leu-menu-item.js +1 -1
- package/dist/leu-menu.js +1 -1
- package/dist/leu-message.js +1 -1
- package/dist/leu-pagination.js +1 -1
- package/dist/leu-placeholder.js +1 -1
- package/dist/leu-popup.js +1 -1
- package/dist/leu-progress-bar.js +1 -1
- package/dist/leu-radio-group.js +1 -1
- package/dist/leu-radio.js +1 -1
- package/dist/leu-range.js +3 -1
- package/dist/leu-scroll-top.js +2 -1
- package/dist/leu-select.js +1 -1
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.js +1 -1
- package/dist/leu-tag.js +1 -1
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/lib/utils.d.ts +10 -3
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/theme.css +1 -0
- package/dist/utils-DBGsNSJW.js +33 -0
- package/dist/vscode.html-custom-data.json +38 -34
- package/dist/vue/index.d.ts +51 -44
- package/dist/web-types.json +86 -80
- package/package.json +2 -3
- package/src/components/range/Range.ts +160 -87
- package/src/components/range/stories/range.stories.ts +3 -0
- package/src/components/range/test/range.test.ts +59 -0
- package/src/components/scroll-top/scroll-top.css +20 -4
- package/src/lib/utils.ts +13 -3
- 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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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:
|
|
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
|
-
|
|
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)
|
package/src/styles/theme.css
CHANGED
|
@@ -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";
|