@statistikzh/leu 0.21.1 → 0.22.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.
- package/.github/workflows/release-please.yml +1 -2
- package/.nvmrc +1 -1
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +16 -0
- package/README.md +15 -10
- package/dist/Accordion.js +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/ChartWrapper.js +1 -1
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/CheckboxGroup.js +1 -1
- package/dist/Chip.d.ts +1 -7
- package/dist/Chip.js +7 -5
- package/dist/ChipGroup.d.ts +17 -36
- package/dist/ChipGroup.js +35 -33
- package/dist/ChipLink.d.ts +5 -21
- package/dist/ChipLink.js +14 -15
- package/dist/ChipRemovable.d.ts +4 -15
- package/dist/ChipRemovable.js +7 -9
- package/dist/ChipSelectable.d.ts +14 -37
- package/dist/ChipSelectable.js +24 -28
- package/dist/Dialog.d.ts +7 -18
- package/dist/Dialog.js +15 -18
- package/dist/Dropdown.d.ts +16 -24
- package/dist/Dropdown.js +23 -21
- package/dist/FileInput.d.ts +2 -1
- package/dist/FileInput.js +19 -5
- package/dist/Icon.d-itcQ94ym.d.ts +151 -0
- package/dist/Icon.d.ts +4 -156
- package/dist/Icon.js +1 -4
- package/dist/Input.d.ts +73 -141
- package/dist/Input.js +91 -88
- package/dist/{LeuElement-BLUQU9Eu.js → LeuElement-DfsEye-A.js} +1 -1
- package/dist/Menu.d.ts +2 -8
- package/dist/Menu.js +7 -9
- package/dist/MenuItem.d.ts +31 -59
- package/dist/MenuItem.js +30 -33
- package/dist/Message.d.ts +1 -1
- package/dist/Message.js +1 -1
- package/dist/Pagination.d.ts +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 +22 -65
- package/dist/Range.js +36 -37
- package/dist/ScrollTop.d.ts +5 -7
- package/dist/ScrollTop.js +10 -15
- package/dist/Select.d.ts +2 -1
- package/dist/Select.js +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.d.ts +1 -1
- package/dist/Table.js +1 -1
- package/dist/Tag.js +1 -1
- package/dist/VisuallyHidden.js +1 -1
- package/dist/components/chart-wrapper/leu-chart-wrapper.d.ts +5 -0
- package/dist/components/chart-wrapper/leu-chart-wrapper.d.ts.map +1 -1
- package/dist/components/chip/Chip.d.ts +1 -7
- package/dist/components/chip/Chip.d.ts.map +1 -1
- package/dist/components/chip/ChipGroup.d.ts +15 -35
- package/dist/components/chip/ChipGroup.d.ts.map +1 -1
- package/dist/components/chip/ChipLink.d.ts +4 -20
- package/dist/components/chip/ChipLink.d.ts.map +1 -1
- package/dist/components/chip/ChipRemovable.d.ts +3 -14
- package/dist/components/chip/ChipRemovable.d.ts.map +1 -1
- package/dist/components/chip/ChipSelectable.d.ts +13 -36
- package/dist/components/chip/ChipSelectable.d.ts.map +1 -1
- package/dist/components/chip/stories/chip-group.stories.d.ts +1 -1
- package/dist/components/chip/stories/chip-group.stories.d.ts.map +1 -1
- package/dist/components/chip/stories/chip-link.stories.d.ts.map +1 -1
- package/dist/components/chip/stories/chip-selectable.stories.d.ts.map +1 -1
- package/dist/components/dialog/Dialog.d.ts +5 -17
- package/dist/components/dialog/Dialog.d.ts.map +1 -1
- package/dist/components/dropdown/Dropdown.d.ts +14 -23
- package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/stories/dropdown.stories.d.ts.map +1 -1
- package/dist/components/file-input/FileInput.d.ts +1 -0
- package/dist/components/file-input/FileInput.d.ts.map +1 -1
- package/dist/components/file-input/leu-file-input.d.ts +5 -0
- package/dist/components/file-input/leu-file-input.d.ts.map +1 -1
- package/dist/components/file-input/stories/file-input.stories.d.ts +4 -0
- package/dist/components/file-input/stories/file-input.stories.d.ts.map +1 -1
- package/dist/components/icon/Icon.d.ts +0 -6
- package/dist/components/icon/Icon.d.ts.map +1 -1
- package/dist/components/input/Input.d.ts +73 -140
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/menu/Menu.d.ts +1 -7
- package/dist/components/menu/Menu.d.ts.map +1 -1
- package/dist/components/menu/MenuItem.d.ts +30 -57
- package/dist/components/menu/MenuItem.d.ts.map +1 -1
- package/dist/components/message/leu-message.d.ts +5 -0
- package/dist/components/message/leu-message.d.ts.map +1 -1
- package/dist/components/placeholder/leu-placeholder.d.ts +5 -0
- package/dist/components/placeholder/leu-placeholder.d.ts.map +1 -1
- package/dist/components/progress-bar/leu-progress-bar.d.ts +5 -0
- package/dist/components/progress-bar/leu-progress-bar.d.ts.map +1 -1
- package/dist/components/range/Range.d.ts +22 -65
- package/dist/components/range/Range.d.ts.map +1 -1
- package/dist/components/scroll-top/ScrollTop.d.ts +4 -6
- package/dist/components/scroll-top/ScrollTop.d.ts.map +1 -1
- package/dist/components/tag/leu-tag.d.ts +5 -0
- package/dist/components/tag/leu-tag.d.ts.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -4
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.js +1 -1
- package/dist/leu-chart-wrapper.d.ts +10 -1
- package/dist/leu-chart-wrapper.js +1 -1
- package/dist/leu-checkbox-group.js +1 -1
- package/dist/leu-checkbox.d.ts +1 -1
- package/dist/leu-checkbox.js +1 -1
- package/dist/leu-chip-group.d.ts +2 -0
- package/dist/leu-chip-group.js +5 -1
- package/dist/leu-chip-link.js +3 -1
- package/dist/leu-chip-removable.d.ts +1 -1
- package/dist/leu-chip-removable.js +3 -3
- package/dist/leu-chip-selectable.js +3 -1
- package/dist/leu-dialog.d.ts +2 -1
- package/dist/leu-dialog.js +3 -3
- package/dist/leu-dropdown.d.ts +2 -1
- package/dist/leu-dropdown.js +3 -3
- package/dist/leu-file-input.d.ts +11 -2
- package/dist/leu-file-input.js +11 -4
- package/dist/leu-icon.d.ts +1 -1
- package/dist/leu-icon.js +1 -1
- package/dist/leu-input.d.ts +2 -1
- package/dist/leu-input.js +3 -3
- package/dist/leu-menu-item.d.ts +2 -2
- package/dist/leu-menu-item.js +3 -3
- package/dist/leu-menu.d.ts +1 -1
- package/dist/leu-menu.js +3 -3
- package/dist/leu-message.d.ts +11 -2
- package/dist/leu-message.js +1 -1
- package/dist/leu-pagination.d.ts +1 -1
- package/dist/leu-pagination.js +1 -1
- package/dist/leu-placeholder.d.ts +10 -1
- package/dist/leu-placeholder.js +1 -1
- package/dist/leu-popup.js +1 -1
- package/dist/leu-progress-bar.d.ts +10 -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.d.ts +1 -1
- package/dist/leu-scroll-top.js +3 -3
- package/dist/leu-select.d.ts +2 -1
- package/dist/leu-select.js +1 -1
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.d.ts +1 -1
- package/dist/leu-table.js +1 -1
- package/dist/leu-tag.d.ts +10 -1
- package/dist/leu-tag.js +1 -1
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/vscode.html-custom-data.json +115 -111
- package/dist/vue/index.d.ts +116 -131
- package/dist/web-types.json +303 -303
- package/package.json +1 -1
- package/scripts/generate-component/templates/[namespace]-[name].ts +6 -0
- package/src/components/chart-wrapper/leu-chart-wrapper.ts +6 -0
- package/src/components/chip/Chip.ts +3 -9
- package/src/components/chip/ChipGroup.ts +26 -39
- package/src/components/chip/ChipLink.ts +7 -18
- package/src/components/chip/ChipRemovable.ts +4 -11
- package/src/components/chip/ChipSelectable.ts +21 -35
- package/src/components/chip/stories/chip-group.stories.ts +4 -7
- package/src/components/chip/stories/chip-link.stories.ts +2 -4
- package/src/components/chip/stories/chip-selectable.stories.ts +4 -6
- package/src/components/chip/test/chip-group.test.ts +34 -31
- package/src/components/dialog/Dialog.ts +9 -22
- package/src/components/dropdown/Dropdown.ts +20 -24
- package/src/components/dropdown/stories/dropdown.stories.ts +6 -2
- package/src/components/dropdown/test/dropdown.test.ts +14 -2
- package/src/components/file-input/FileInput.ts +12 -1
- package/src/components/file-input/leu-file-input.ts +6 -0
- package/src/components/file-input/stories/file-input.stories.ts +7 -0
- package/src/components/icon/Icon.ts +0 -4
- package/src/components/input/Input.ts +108 -105
- package/src/components/menu/Menu.ts +3 -12
- package/src/components/menu/MenuItem.ts +37 -41
- package/src/components/message/leu-message.ts +6 -0
- package/src/components/placeholder/leu-placeholder.ts +6 -0
- package/src/components/progress-bar/leu-progress-bar.ts +6 -0
- package/src/components/range/Range.ts +51 -59
- package/src/components/scroll-top/ScrollTop.ts +8 -15
- package/src/components/tag/leu-tag.ts +6 -0
- package/src/index.ts +11 -0
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import { html, nothing } from "lit"
|
|
1
|
+
import { html, nothing, TemplateResult } from "lit"
|
|
2
2
|
import { ifDefined } from "lit/directives/if-defined.js"
|
|
3
|
+
import { property } from "lit/decorators.js"
|
|
3
4
|
|
|
4
5
|
import { LeuElement } from "../../lib/LeuElement.js"
|
|
5
6
|
import { LeuIcon } from "../icon/Icon.js"
|
|
6
7
|
|
|
7
8
|
import styles from "./menu-item.css"
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
type MenuItemRole =
|
|
11
|
+
| "menuitem"
|
|
12
|
+
| "menuitemcheckbox"
|
|
13
|
+
| "menuitemradio"
|
|
14
|
+
| "option"
|
|
15
|
+
| "none"
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* @tagname leu-menu-item
|
|
15
19
|
* @slot - The label of the menu item
|
|
16
|
-
* @property {boolean} active - Defines if the item is selected or checked
|
|
17
|
-
* @property {boolean} multipleSelection - If the item is part of a multiple selection. Renders a checkmark before the label when active
|
|
18
|
-
* @property {boolean} disabled - Disables the underlying button or link
|
|
19
|
-
* @property {string} value - The value of the item. It must not contain commas. See `getValue()`
|
|
20
|
-
* @property {string} href - The href of the underlying link
|
|
21
|
-
* @property {boolean} tabbable - If the item should be focusable. Will be reflected as `tabindex` to the underlying button or link
|
|
22
|
-
* @property {MenuItemRole} componentRole - The role of the item. This will be reflected as `role` to the underlying button or link. Default is `'menuitem'.`
|
|
23
20
|
*/
|
|
24
21
|
export class LeuMenuItem extends LeuElement {
|
|
25
22
|
static dependencies = {
|
|
@@ -36,33 +33,33 @@ export class LeuMenuItem extends LeuElement {
|
|
|
36
33
|
delegatesFocus: true,
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
type: Boolean,
|
|
43
|
-
reflect: true,
|
|
44
|
-
attr: "multiple-selection",
|
|
45
|
-
},
|
|
46
|
-
disabled: { type: Boolean, reflect: true },
|
|
47
|
-
tabbable: { type: Boolean, reflect: true },
|
|
48
|
-
href: { type: String, reflect: true },
|
|
49
|
-
value: { type: String, reflect: true },
|
|
50
|
-
componentRole: { type: String, reflect: true },
|
|
51
|
-
}
|
|
36
|
+
/** Defines if the item is selected or checked */
|
|
37
|
+
@property({ type: Boolean, reflect: true })
|
|
38
|
+
active: boolean = false
|
|
52
39
|
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
/** If the item is part of a multiple selection. Renders a checkmark before the label when active */
|
|
41
|
+
@property({ type: Boolean, reflect: true })
|
|
42
|
+
multipleSelection: boolean = false
|
|
55
43
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.value = undefined
|
|
60
|
-
this.href = undefined
|
|
61
|
-
this.tabbable = undefined
|
|
44
|
+
/** Disables the underlying button or link */
|
|
45
|
+
@property({ type: Boolean, reflect: true })
|
|
46
|
+
disabled: boolean = false
|
|
62
47
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
/** If the item should be focusable. Will be reflected as `tabindex` to the underlying button or link */
|
|
49
|
+
@property({ type: Boolean, reflect: true })
|
|
50
|
+
tabbable: boolean
|
|
51
|
+
|
|
52
|
+
/** The href of the underlying link */
|
|
53
|
+
@property({ type: String, reflect: true })
|
|
54
|
+
href: string
|
|
55
|
+
|
|
56
|
+
/** The value of the item. It must not contain commas. See `getValue()` */
|
|
57
|
+
@property({ type: String, reflect: true })
|
|
58
|
+
value: string
|
|
59
|
+
|
|
60
|
+
/** The role of the item. This will be reflected as `role` to the underlying button or link. Default is `'menuitem'.` */
|
|
61
|
+
@property({ type: String, reflect: true })
|
|
62
|
+
componentRole: MenuItemRole = "menuitem"
|
|
66
63
|
|
|
67
64
|
connectedCallback() {
|
|
68
65
|
super.connectedCallback()
|
|
@@ -74,7 +71,7 @@ export class LeuMenuItem extends LeuElement {
|
|
|
74
71
|
this.removeEventListener("click", this._handleClick, true)
|
|
75
72
|
}
|
|
76
73
|
|
|
77
|
-
_handleClick(event) {
|
|
74
|
+
protected _handleClick(event: MouseEvent) {
|
|
78
75
|
if (this.disabled) {
|
|
79
76
|
event.stopPropagation()
|
|
80
77
|
event.preventDefault()
|
|
@@ -83,13 +80,12 @@ export class LeuMenuItem extends LeuElement {
|
|
|
83
80
|
|
|
84
81
|
/**
|
|
85
82
|
* Returns the value of the item. If `value` is not set, it will return the inner text
|
|
86
|
-
* @returns {string}
|
|
87
83
|
*/
|
|
88
84
|
getValue() {
|
|
89
85
|
return this.value || this.textContent.trim()
|
|
90
86
|
}
|
|
91
87
|
|
|
92
|
-
_getAria() {
|
|
88
|
+
protected _getAria() {
|
|
93
89
|
const commonAttributes = {
|
|
94
90
|
disabled: this.disabled,
|
|
95
91
|
}
|
|
@@ -110,7 +106,7 @@ export class LeuMenuItem extends LeuElement {
|
|
|
110
106
|
}
|
|
111
107
|
}
|
|
112
108
|
|
|
113
|
-
_getTabIndex() {
|
|
109
|
+
protected _getTabIndex() {
|
|
114
110
|
if (typeof this.tabbable === "boolean") {
|
|
115
111
|
return this.tabbable ? 0 : -1
|
|
116
112
|
}
|
|
@@ -118,7 +114,7 @@ export class LeuMenuItem extends LeuElement {
|
|
|
118
114
|
return undefined
|
|
119
115
|
}
|
|
120
116
|
|
|
121
|
-
_renderLink(content) {
|
|
117
|
+
protected _renderLink(content: TemplateResult) {
|
|
122
118
|
const aria = this._getAria()
|
|
123
119
|
|
|
124
120
|
return html`<a
|
|
@@ -133,7 +129,7 @@ export class LeuMenuItem extends LeuElement {
|
|
|
133
129
|
>`
|
|
134
130
|
}
|
|
135
131
|
|
|
136
|
-
_renderButton(content) {
|
|
132
|
+
protected _renderButton(content: TemplateResult) {
|
|
137
133
|
const aria = this._getAria()
|
|
138
134
|
|
|
139
135
|
return html`<button
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { html } from "lit"
|
|
2
2
|
|
|
3
|
+
import { property } from "lit/decorators.js"
|
|
3
4
|
import styles from "./range.css"
|
|
4
5
|
import { LeuElement } from "../../lib/LeuElement.js"
|
|
5
6
|
|
|
@@ -25,34 +26,41 @@ export class LeuRange extends LeuElement {
|
|
|
25
26
|
delegatesFocus: true,
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
min: { type: Number, reflect: true },
|
|
31
|
-
max: { type: Number, reflect: true },
|
|
32
|
-
step: { type: Number, reflect: true },
|
|
33
|
-
name: { type: String, reflect: true },
|
|
34
|
-
label: { type: String, reflect: true },
|
|
35
|
-
disabled: { type: Boolean, reflect: true },
|
|
36
|
-
multiple: { type: Boolean, reflect: true },
|
|
37
|
-
}
|
|
29
|
+
@property({ converter: defaultValueConverter, attribute: "value" })
|
|
30
|
+
defaultValue = [50]
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
@property({ type: Number, reflect: true })
|
|
33
|
+
min: number = 0
|
|
34
|
+
|
|
35
|
+
@property({ type: Number, reflect: true })
|
|
36
|
+
max: number = 100
|
|
37
|
+
|
|
38
|
+
@property({ type: Number, reflect: true })
|
|
39
|
+
step: number = 1
|
|
40
|
+
|
|
41
|
+
@property({ type: String, reflect: true })
|
|
42
|
+
name: string = ""
|
|
43
|
+
|
|
44
|
+
@property({ type: String, reflect: true })
|
|
45
|
+
label: string = ""
|
|
46
|
+
|
|
47
|
+
@property({ type: Boolean, reflect: true })
|
|
48
|
+
disabled: boolean = false
|
|
49
|
+
|
|
50
|
+
@property({ type: Boolean, reflect: true })
|
|
51
|
+
multiple: boolean = false
|
|
50
52
|
|
|
51
53
|
updated() {
|
|
52
54
|
this._updateStyles()
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
protected get _inputs() {
|
|
58
|
+
return Array.from(
|
|
59
|
+
this.shadowRoot.querySelectorAll<HTMLInputElement>("input"),
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
protected _updateStyles() {
|
|
56
64
|
const normalizedRange = this._getNormalizedRange()
|
|
57
65
|
this.style.setProperty("--low", normalizedRange[0].toString())
|
|
58
66
|
this.style.setProperty("--high", normalizedRange[1].toString())
|
|
@@ -62,8 +70,9 @@ export class LeuRange extends LeuElement {
|
|
|
62
70
|
: [this._getBaseInput()]
|
|
63
71
|
|
|
64
72
|
inputs.forEach((input) => {
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
const output = this.shadowRoot.querySelector<HTMLOutputElement>(
|
|
74
|
+
`.output[for=${input.id}]`,
|
|
75
|
+
)
|
|
67
76
|
const normalizedValue = this._getNormalizedValue(input.valueAsNumber)
|
|
68
77
|
output.style.setProperty("--value", normalizedValue.toString())
|
|
69
78
|
output.value = input.value
|
|
@@ -71,19 +80,18 @@ export class LeuRange extends LeuElement {
|
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
get value() {
|
|
74
|
-
|
|
75
|
-
return inputs.map((input) => input.value).join(",")
|
|
83
|
+
return this._inputs.map((input) => input.value).join(",")
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
/**
|
|
79
87
|
* Sets the value of the underlying input element(s).
|
|
80
88
|
* The value has to be an array if "multiple" range is used.
|
|
81
89
|
* Otherwise it has to be a string.
|
|
82
|
-
* @param {string | Array} value
|
|
83
90
|
*/
|
|
84
|
-
set value(value) {
|
|
91
|
+
set value(value: string | Array<string>) {
|
|
85
92
|
if (this.multiple && Array.isArray(value)) {
|
|
86
|
-
const inputs =
|
|
93
|
+
const inputs = this._inputs
|
|
94
|
+
|
|
87
95
|
value.forEach((v, i) => {
|
|
88
96
|
inputs[i].value = v
|
|
89
97
|
})
|
|
@@ -95,13 +103,11 @@ export class LeuRange extends LeuElement {
|
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
get valueAsArray() {
|
|
98
|
-
return
|
|
99
|
-
(input) => input.valueAsNumber,
|
|
100
|
-
)
|
|
106
|
+
return this._inputs.map((input) => input.valueAsNumber)
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
get valueLow() {
|
|
104
|
-
const inputs =
|
|
110
|
+
const inputs = this._inputs
|
|
105
111
|
|
|
106
112
|
if (this.multiple) {
|
|
107
113
|
return inputs.map((input) => input.valueAsNumber).sort((a, b) => a - b)[0]
|
|
@@ -111,7 +117,7 @@ export class LeuRange extends LeuElement {
|
|
|
111
117
|
}
|
|
112
118
|
|
|
113
119
|
get valueHigh() {
|
|
114
|
-
const inputs =
|
|
120
|
+
const inputs = this._inputs
|
|
115
121
|
|
|
116
122
|
if (this.multiple) {
|
|
117
123
|
return inputs.map((input) => input.valueAsNumber).sort((a, b) => a - b)[1]
|
|
@@ -120,39 +126,26 @@ export class LeuRange extends LeuElement {
|
|
|
120
126
|
return inputs[0].value
|
|
121
127
|
}
|
|
122
128
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
*/
|
|
126
|
-
_getBaseInput() {
|
|
127
|
-
return this.shadowRoot.querySelector(".range--base")
|
|
129
|
+
protected _getBaseInput() {
|
|
130
|
+
return this.shadowRoot.querySelector<HTMLInputElement>(".range--base")
|
|
128
131
|
}
|
|
129
132
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*/
|
|
133
|
-
_getGhostInput() {
|
|
134
|
-
return this.shadowRoot.querySelector(".range--ghost")
|
|
133
|
+
protected _getGhostInput() {
|
|
134
|
+
return this.shadowRoot.querySelector<HTMLInputElement>(".range--ghost")
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
*/
|
|
142
|
-
_handleInput(_index, _e) {
|
|
137
|
+
protected _handleInput(
|
|
138
|
+
_index: number,
|
|
139
|
+
_e: InputEvent & { target: HTMLInputElement },
|
|
140
|
+
) {
|
|
143
141
|
this._updateStyles()
|
|
144
142
|
}
|
|
145
143
|
|
|
146
|
-
|
|
147
|
-
*
|
|
148
|
-
* @param {number} value
|
|
149
|
-
* @returns {number}
|
|
150
|
-
*/
|
|
151
|
-
_getNormalizedValue(value) {
|
|
144
|
+
protected _getNormalizedValue(value: number) {
|
|
152
145
|
return (value - this.min) / (this.max - this.min)
|
|
153
146
|
}
|
|
154
147
|
|
|
155
|
-
_getNormalizedRange() {
|
|
148
|
+
protected _getNormalizedRange() {
|
|
156
149
|
if (this.multiple) {
|
|
157
150
|
return this.valueAsArray
|
|
158
151
|
.map((value) => this._getNormalizedValue(value))
|
|
@@ -165,9 +158,8 @@ export class LeuRange extends LeuElement {
|
|
|
165
158
|
/**
|
|
166
159
|
* Determine if the "click" (pointer event) is closer the
|
|
167
160
|
* the value of the other input element. Swap the values if this is the case.
|
|
168
|
-
* @param {PointerEvent & {target: HTMLInputElement}} e
|
|
169
161
|
*/
|
|
170
|
-
_handlePointerDown(e) {
|
|
162
|
+
protected _handlePointerDown(e: PointerEvent & { target: HTMLInputElement }) {
|
|
171
163
|
const clickValue =
|
|
172
164
|
this.min + ((this.max - this.min) * e.offsetX) / this.offsetWidth
|
|
173
165
|
const middleValue = (this.valueAsArray[0] + this.valueAsArray[1]) / 2
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { html } from "lit"
|
|
2
2
|
import { classMap } from "lit/directives/class-map.js"
|
|
3
|
+
import { state } from "lit/decorators.js"
|
|
3
4
|
|
|
4
5
|
import { LeuElement } from "../../lib/LeuElement.js"
|
|
5
6
|
import { LeuButton } from "../button/Button.js"
|
|
@@ -20,22 +21,14 @@ export class LeuScrollTop extends LeuElement {
|
|
|
20
21
|
|
|
21
22
|
static styles = [LeuElement.styles, styles]
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
24
|
+
@state()
|
|
25
|
+
protected _showButton: boolean = false
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this._showButton = false
|
|
33
|
-
/** @internal */
|
|
34
|
-
this._scrollDown = false
|
|
35
|
-
|
|
36
|
-
/** @internal */
|
|
37
|
-
this._scrollListener = undefined
|
|
38
|
-
}
|
|
27
|
+
protected _prevYPos: number = 0
|
|
28
|
+
|
|
29
|
+
protected _scrollDown: boolean = false
|
|
30
|
+
|
|
31
|
+
protected _scrollListener: EventListener
|
|
39
32
|
|
|
40
33
|
scroll = () => {
|
|
41
34
|
const delta = window.scrollY - this._prevYPos
|
package/src/index.ts
CHANGED
|
@@ -5,14 +5,25 @@ export * from "./components/chart-wrapper/ChartWrapper.js"
|
|
|
5
5
|
export * from "./components/checkbox/Checkbox.js"
|
|
6
6
|
export * from "./components/checkbox/CheckboxGroup.js"
|
|
7
7
|
export * from "./components/chip/exports.js"
|
|
8
|
+
export * from "./components/dialog/Dialog.js"
|
|
8
9
|
export * from "./components/dropdown/Dropdown.js"
|
|
10
|
+
export * from "./components/file-input/FileInput.js"
|
|
11
|
+
export * from "./components/icon/Icon.js"
|
|
9
12
|
export * from "./components/input/Input.js"
|
|
10
13
|
export * from "./components/menu/Menu.js"
|
|
11
14
|
export * from "./components/menu/MenuItem.js"
|
|
15
|
+
export * from "./components/message/Message.js"
|
|
12
16
|
export * from "./components/pagination/Pagination.js"
|
|
17
|
+
export * from "./components/placeholder/Placeholder.js"
|
|
13
18
|
export * from "./components/popup/Popup.js"
|
|
19
|
+
export * from "./components/progress-bar/ProgressBar.js"
|
|
14
20
|
export * from "./components/radio/Radio.js"
|
|
15
21
|
export * from "./components/radio/RadioGroup.js"
|
|
22
|
+
export * from "./components/range/Range.js"
|
|
23
|
+
export * from "./components/scroll-top/ScrollTop.js"
|
|
16
24
|
export * from "./components/select/Select.js"
|
|
25
|
+
export * from "./components/spinner/Spinner.js"
|
|
17
26
|
export * from "./components/table/Table.js"
|
|
27
|
+
export * from "./components/tag/Tag.js"
|
|
28
|
+
export * from "./components/visually-hidden/VisuallyHidden.js"
|
|
18
29
|
export * from "./lib/LeuElement.js"
|