@statistikzh/leu 0.5.0 → 0.6.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.
- package/.husky/commit-msg +0 -3
- package/.husky/pre-commit +0 -3
- package/CHANGELOG.md +48 -0
- package/dist/Accordion.d.ts +10 -9
- package/dist/Accordion.d.ts.map +1 -1
- package/dist/Accordion.js +12 -11
- package/dist/Breadcrumb.d.ts +4 -4
- package/dist/Breadcrumb.d.ts.map +1 -1
- package/dist/Breadcrumb.js +28 -26
- package/dist/{Button-da11d064.d.ts → Button-9692e403.d.ts} +10 -11
- package/dist/Button-9692e403.d.ts.map +1 -0
- package/dist/{Button-da11d064.js → Button-9692e403.js} +65 -62
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +3 -3
- package/dist/ButtonGroup.d.ts +2 -2
- package/dist/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup.js +3 -3
- package/dist/Checkbox.d.ts +4 -3
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +14 -19
- package/dist/CheckboxGroup.d.ts +2 -2
- package/dist/CheckboxGroup.d.ts.map +1 -1
- package/dist/CheckboxGroup.js +4 -6
- package/dist/Chip.d.ts +2 -2
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Chip.js +6 -13
- package/dist/ChipGroup.d.ts +9 -7
- package/dist/ChipGroup.d.ts.map +1 -1
- package/dist/ChipGroup.js +8 -5
- package/dist/ChipLink.d.ts +2 -1
- package/dist/ChipLink.d.ts.map +1 -1
- package/dist/ChipLink.js +4 -7
- package/dist/ChipRemovable.d.ts +0 -2
- package/dist/ChipRemovable.d.ts.map +1 -1
- package/dist/ChipRemovable.js +8 -11
- package/dist/ChipSelectable.d.ts +9 -1
- package/dist/ChipSelectable.d.ts.map +1 -1
- package/dist/ChipSelectable.js +12 -16
- package/dist/Dropdown.d.ts +9 -5
- package/dist/Dropdown.d.ts.map +1 -1
- package/dist/Dropdown.js +73 -32
- package/dist/Icon.d.ts +20 -0
- package/dist/Icon.d.ts.map +1 -0
- package/dist/{icon-03e86700.js → Icon.js} +61 -32
- package/dist/Input.d.ts +7 -16
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +24 -28
- package/dist/LeuElement-6de6f209.d.ts +7 -0
- package/dist/LeuElement-6de6f209.d.ts.map +1 -0
- package/dist/LeuElement-6de6f209.js +43 -0
- package/dist/Menu.d.ts +24 -2
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +120 -3
- package/dist/MenuItem.d.ts +28 -11
- package/dist/MenuItem.d.ts.map +1 -1
- package/dist/MenuItem.js +110 -63
- package/dist/Pagination.d.ts +10 -3
- package/dist/Pagination.d.ts.map +1 -1
- package/dist/Pagination.js +24 -21
- package/dist/Popup.d.ts +21 -3
- package/dist/Popup.d.ts.map +1 -1
- package/dist/Popup.js +44 -19
- package/dist/Radio.d.ts +4 -2
- package/dist/Radio.d.ts.map +1 -1
- package/dist/Radio.js +9 -16
- package/dist/RadioGroup.d.ts +2 -2
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +4 -6
- package/dist/ScrollTop.d.ts +2 -2
- package/dist/ScrollTop.d.ts.map +1 -1
- package/dist/ScrollTop.js +10 -8
- package/dist/Select.d.ts +75 -37
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +279 -183
- package/dist/Table.d.ts +2 -6
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +17 -18
- package/dist/VisuallyHidden.d.ts +2 -2
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +5 -7
- package/dist/{index.js.d.ts → index.d.ts} +3 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/{index.js.js → index.js} +5 -14
- package/dist/leu-accordion.d.ts.map +1 -1
- package/dist/leu-accordion.js +2 -3
- package/dist/leu-breadcrumb.d.ts.map +1 -1
- package/dist/leu-breadcrumb.js +4 -10
- package/dist/leu-button-group.d.ts.map +1 -1
- package/dist/leu-button-group.js +2 -3
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.d.ts.map +1 -1
- package/dist/leu-button.js +4 -5
- package/dist/leu-checkbox-group.d.ts.map +1 -1
- package/dist/leu-checkbox-group.js +2 -3
- package/dist/leu-checkbox.d.ts.map +1 -1
- package/dist/leu-checkbox.js +3 -4
- package/dist/leu-chip-group.d.ts.map +1 -1
- package/dist/leu-chip-group.js +2 -3
- package/dist/leu-chip-link.d.ts.map +1 -1
- package/dist/leu-chip-link.js +2 -3
- package/dist/leu-chip-removable.d.ts.map +1 -1
- package/dist/leu-chip-removable.js +3 -4
- package/dist/leu-chip-selectable.d.ts.map +1 -1
- package/dist/leu-chip-selectable.js +2 -3
- package/dist/leu-dropdown.d.ts.map +1 -1
- package/dist/leu-dropdown.js +5 -10
- package/dist/leu-icon.d.ts +3 -0
- package/dist/leu-icon.d.ts.map +1 -0
- package/dist/leu-icon.js +7 -0
- package/dist/leu-input.d.ts.map +1 -1
- package/dist/leu-input.js +3 -4
- package/dist/leu-menu-item.d.ts.map +1 -1
- package/dist/leu-menu-item.js +3 -5
- package/dist/leu-menu.d.ts.map +1 -1
- package/dist/leu-menu.js +5 -3
- package/dist/leu-pagination.d.ts.map +1 -1
- package/dist/leu-pagination.js +4 -7
- package/dist/leu-popup.d.ts.map +1 -1
- package/dist/leu-popup.js +2 -3
- package/dist/leu-radio-group.d.ts.map +1 -1
- package/dist/leu-radio-group.js +2 -3
- package/dist/leu-radio.d.ts.map +1 -1
- package/dist/leu-radio.js +2 -3
- package/dist/leu-scroll-top.d.ts.map +1 -1
- package/dist/leu-scroll-top.js +4 -6
- package/dist/leu-select.d.ts.map +1 -1
- package/dist/leu-select.js +5 -13
- package/dist/leu-table.d.ts.map +1 -1
- package/dist/leu-table.js +4 -8
- package/dist/leu-visually-hidden.d.ts.map +1 -1
- package/dist/leu-visually-hidden.js +2 -3
- package/dist/theme.css +2 -0
- package/dist/vscode.html-custom-data.json +616 -0
- package/dist/vue/index.d.ts +682 -0
- package/dist/web-types.json +1211 -0
- package/package.json +10 -13
- package/rollup.config.js +1 -1
- package/scripts/generate-component/templates/[Name].js +6 -3
- package/scripts/generate-component/templates/test/[name].test.js +1 -1
- package/src/components/accordion/Accordion.js +13 -10
- package/src/components/accordion/leu-accordion.js +1 -2
- package/src/components/breadcrumb/Breadcrumb.js +31 -18
- package/src/components/breadcrumb/leu-breadcrumb.js +1 -2
- package/src/components/button/Button.js +45 -71
- package/src/components/button/button.css +19 -4
- package/src/components/button/leu-button.js +1 -2
- package/src/components/button/stories/button.stories.js +60 -19
- package/src/components/button/test/button.test.js +26 -63
- package/src/components/button-group/ButtonGroup.js +4 -2
- package/src/components/button-group/leu-button-group.js +1 -2
- package/src/components/checkbox/Checkbox.js +17 -11
- package/src/components/checkbox/CheckboxGroup.js +6 -3
- package/src/components/checkbox/leu-checkbox-group.js +1 -2
- package/src/components/checkbox/leu-checkbox.js +1 -2
- package/src/components/checkbox/stories/checkbox-group.stories.js +10 -26
- package/src/components/checkbox/stories/checkbox.stories.js +2 -7
- package/src/components/checkbox/test/checkbox-group.test.js +6 -21
- package/src/components/checkbox/test/checkbox.test.js +1 -12
- package/src/components/chip/Chip.js +5 -4
- package/src/components/chip/ChipGroup.js +10 -4
- package/src/components/chip/ChipLink.js +3 -7
- package/src/components/chip/ChipRemovable.js +8 -11
- package/src/components/chip/ChipSelectable.js +11 -17
- package/src/components/chip/chip.css +3 -4
- package/src/components/chip/leu-chip-group.js +1 -2
- package/src/components/chip/leu-chip-link.js +1 -2
- package/src/components/chip/leu-chip-removable.js +1 -2
- package/src/components/chip/leu-chip-selectable.js +1 -2
- package/src/components/chip/stories/chip-link.stories.js +3 -5
- package/src/components/chip/stories/chip-removable.stories.js +3 -4
- package/src/components/chip/stories/chip-selectable.stories.js +2 -2
- package/src/components/chip/test/chip-group.test.js +15 -30
- package/src/components/chip/test/chip-link.test.js +2 -6
- package/src/components/chip/test/chip-removable.test.js +4 -10
- package/src/components/chip/test/chip-selectable.test.js +3 -5
- package/src/components/dropdown/Dropdown.js +80 -26
- package/src/components/dropdown/dropdown.css +4 -0
- package/src/components/dropdown/leu-dropdown.js +1 -2
- package/src/components/dropdown/stories/dropdown.stories.js +30 -7
- package/src/components/dropdown/test/dropdown.test.js +5 -5
- package/src/components/icon/Icon.js +55 -0
- package/src/components/icon/icon.css +6 -0
- package/src/components/icon/leu-icon.js +5 -0
- package/src/components/icon/{icon.js → paths.js} +4 -37
- package/src/components/icon/stories/icon.stories.js +47 -0
- package/src/components/icon/test/icon.test.js +23 -40
- package/src/components/input/Input.js +21 -23
- package/src/components/input/input.css +4 -2
- package/src/components/input/leu-input.js +1 -2
- package/src/components/input/stories/input.stories.js +2 -2
- package/src/components/input/test/input.test.js +2 -0
- package/src/components/menu/Menu.js +143 -2
- package/src/components/menu/MenuItem.js +104 -52
- package/src/components/menu/leu-menu-item.js +1 -2
- package/src/components/menu/leu-menu.js +1 -2
- package/src/components/menu/menu-item.css +11 -4
- package/src/components/menu/stories/menu-item.stories.js +15 -4
- package/src/components/menu/stories/menu.stories.js +34 -7
- package/src/components/menu/test/menu-item.test.js +88 -82
- package/src/components/menu/test/menu.test.js +101 -8
- package/src/components/pagination/Pagination.js +27 -18
- package/src/components/pagination/leu-pagination.js +1 -2
- package/src/components/popup/Popup.js +39 -16
- package/src/components/popup/leu-popup.js +1 -2
- package/src/components/popup/popup.css +1 -0
- package/src/components/radio/Radio.js +12 -7
- package/src/components/radio/RadioGroup.js +6 -3
- package/src/components/radio/leu-radio-group.js +1 -2
- package/src/components/radio/leu-radio.js +1 -2
- package/src/components/radio/stories/radio-group.stories.js +5 -19
- package/src/components/radio/stories/radio.stories.js +2 -7
- package/src/components/radio/test/radio-group.test.js +6 -9
- package/src/components/radio/test/radio.test.js +3 -13
- package/src/components/scroll-top/ScrollTop.js +15 -5
- package/src/components/scroll-top/leu-scroll-top.js +1 -2
- package/src/components/select/Select.js +279 -175
- package/src/components/select/leu-select.js +1 -2
- package/src/components/select/select.css +20 -12
- package/src/components/select/stories/select.stories.js +16 -2
- package/src/components/select/test/select.test.js +191 -37
- package/src/components/table/Table.js +15 -9
- package/src/components/table/leu-table.js +1 -2
- package/src/components/table/table.css +3 -1
- package/src/components/visually-hidden/VisuallyHidden.js +6 -2
- package/src/components/visually-hidden/leu-visually-hidden.js +1 -2
- package/src/lib/LeuElement.js +23 -0
- package/src/lib/a11y.js +26 -0
- package/src/styles/custom-properties.css +2 -0
- package/web-test-runner.config.mjs +2 -0
- package/dist/Button-da11d064.d.ts.map +0 -1
- package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +0 -3
- package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +0 -1
- package/dist/_rollupPluginBabelHelpers-20f659f4.js +0 -30
- package/dist/defineElement-40372b4b.d.ts +0 -9
- package/dist/defineElement-40372b4b.d.ts.map +0 -1
- package/dist/defineElement-40372b4b.js +0 -15
- package/dist/icon-03e86700.d.ts +0 -11
- package/dist/icon-03e86700.d.ts.map +0 -1
- package/dist/index.js.d.ts.map +0 -1
- package/src/lib/defineElement.js +0 -13
package/.husky/commit-msg
CHANGED
package/.husky/pre-commit
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.0](https://github.com/statistikZH/leu/compare/v0.5.1...v0.6.0) (2024-07-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **icon:** create an icon element ([0a8351c](https://github.com/statistikZH/leu/commit/0a8351c123c987572c2e187f492bf3a35ac53f27))
|
|
9
|
+
* **icon:** render a placeholder if the name of the icon is unknown or not set ([a7dae7c](https://github.com/statistikZH/leu/commit/a7dae7c318fd791ca1a0095487fe6ced64b51023))
|
|
10
|
+
* **menu-item:** implement getValue method ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
11
|
+
* **menu-item:** use hover and highlighted styling for focus too ([78c3e68](https://github.com/statistikZH/leu/commit/78c3e6898a5ec4e88a13e698aca6f6caef653645))
|
|
12
|
+
* **menu:** avoid captured key events from navigating the whole page ([#191](https://github.com/statistikZH/leu/issues/191)) ([c40fc4e](https://github.com/statistikZH/leu/commit/c40fc4e4efbeafe3f30469adec1033484112e0d6))
|
|
13
|
+
* **menu:** implement roving tab index ([78c3e68](https://github.com/statistikZH/leu/commit/78c3e6898a5ec4e88a13e698aca6f6caef653645))
|
|
14
|
+
* **menu:** move all focus handling to the menu component ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
15
|
+
* register dependency elements not before the dependent element ([4dfddcd](https://github.com/statistikZH/leu/commit/4dfddcd80e47bee5e047b3eee203d72e0e9d8fba))
|
|
16
|
+
* **select:** always close the popup when focus leaves the element ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
17
|
+
* **select:** set max height of the menu ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
18
|
+
* **select:** use arrow buttons to navigate to listbox from the text input field ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* buttons should inherit font-family ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
24
|
+
* **button:** set aria-expanded on the actual interactive element ([78c3e68](https://github.com/statistikZH/leu/commit/78c3e6898a5ec4e88a13e698aca6f6caef653645))
|
|
25
|
+
* **dropdown:** replace hardcoded icon with a slot ([#189](https://github.com/statistikZH/leu/issues/189)) ([8954616](https://github.com/statistikZH/leu/commit/895461661a6b31a08868c166f3ed9474baed9a79))
|
|
26
|
+
* **icon:** mark icon as presentational so it won't be announced by screen readers ([#186](https://github.com/statistikZH/leu/issues/186)) ([5d3d427](https://github.com/statistikZH/leu/commit/5d3d427c8c856a0b01f9dfc9568065e64f2653fa))
|
|
27
|
+
* **icon:** remove faulty paths ([0a8351c](https://github.com/statistikZH/leu/commit/0a8351c123c987572c2e187f492bf3a35ac53f27))
|
|
28
|
+
* **input:** avoid overlap by hiding the label ([#182](https://github.com/statistikZH/leu/issues/182)) ([d4edc51](https://github.com/statistikZH/leu/commit/d4edc51a812f27a35e8ed2cb86df872dd91d2874))
|
|
29
|
+
* **menu-item:** allow disabled menu items to still be focusable ([78c3e68](https://github.com/statistikZH/leu/commit/78c3e6898a5ec4e88a13e698aca6f6caef653645))
|
|
30
|
+
* **menu-item:** apply tab-index to the actual interactive element ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
31
|
+
* **menu-item:** only add aria attribute to the button element ([78c3e68](https://github.com/statistikZH/leu/commit/78c3e6898a5ec4e88a13e698aca6f6caef653645))
|
|
32
|
+
* **menu-item:** remove deprecated properties before and after ([78c3e68](https://github.com/statistikZH/leu/commit/78c3e6898a5ec4e88a13e698aca6f6caef653645))
|
|
33
|
+
* **menu-item:** use colors that are WCAG AA compliant ([5c59899](https://github.com/statistikZH/leu/commit/5c598990a40cd138bf47b1e0bf2c9026da1f4d87))
|
|
34
|
+
* **menu:** only add role when no role was defined before ([78c3e68](https://github.com/statistikZH/leu/commit/78c3e6898a5ec4e88a13e698aca6f6caef653645))
|
|
35
|
+
* **popup:** define a z-index value for the popup content ([#184](https://github.com/statistikZH/leu/issues/184)) ([72ec681](https://github.com/statistikZH/leu/commit/72ec68109589759b5887f159a4df42ee265b4b65))
|
|
36
|
+
* **popup:** reflect properties to attributes ([#200](https://github.com/statistikZH/leu/issues/200)) ([44aec79](https://github.com/statistikZH/leu/commit/44aec79a8e8456240771da214d45440cc31891d7))
|
|
37
|
+
* **radio:** remove label property as it is not used anymore ([e105a6e](https://github.com/statistikZH/leu/commit/e105a6eec33392d5bddf0d32e9881375576597d6))
|
|
38
|
+
* **select:** add background to apply button ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
39
|
+
* **select:** move leu-menu element into the shadow dom so the role is fully controlled ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
40
|
+
* **select:** only call focus if the element is available ([5c59899](https://github.com/statistikZH/leu/commit/5c598990a40cd138bf47b1e0bf2c9026da1f4d87))
|
|
41
|
+
* **select:** set correct aria attributes ([9846e87](https://github.com/statistikZH/leu/commit/9846e8709a81afce6074860fb597e42f394582d9))
|
|
42
|
+
|
|
43
|
+
## [0.5.1](https://github.com/statistikZH/leu/compare/v0.5.0...v0.5.1) (2024-05-23)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* **button:** truncate the label instead of wrapping it ([4118c0b](https://github.com/statistikZH/leu/commit/4118c0b117532615c5254d6849d8740ef43cb30f))
|
|
49
|
+
* **dropdown:** limit button width to allow the label to be truncated ([4118c0b](https://github.com/statistikZH/leu/commit/4118c0b117532615c5254d6849d8740ef43cb30f))
|
|
50
|
+
|
|
3
51
|
## [0.5.0](https://github.com/statistikZH/leu/compare/v0.4.0...v0.5.0) (2024-05-02)
|
|
4
52
|
|
|
5
53
|
|
package/dist/Accordion.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @tagname leu-accordion
|
|
3
3
|
* @slot content - The content of the accordion. No styles will be applied to the content.
|
|
4
|
-
* @prop {
|
|
5
|
-
* @prop {
|
|
6
|
-
* @prop {
|
|
7
|
-
* @prop {
|
|
8
|
-
* @attr {
|
|
9
|
-
* @attr {
|
|
4
|
+
* @prop {number} headingLevel - The heading level of the accordion title. Must be between 1 and 6.
|
|
5
|
+
* @prop {boolean} open - The expanded state of the accordion.
|
|
6
|
+
* @prop {string} label - The label (title) of the accordion.
|
|
7
|
+
* @prop {string} labelPrefix - The prefix of the accordion label. e.g. "01"
|
|
8
|
+
* @attr {number} heading-level - The heading level of the accordion title. Must be between 1 and 6.
|
|
9
|
+
* @attr {string} label-prefix - The prefix of the accordion label. e.g. "01"
|
|
10
10
|
*/
|
|
11
|
-
export class LeuAccordion extends
|
|
11
|
+
export class LeuAccordion extends LeuElement {
|
|
12
12
|
headingLevel: number;
|
|
13
13
|
open: boolean;
|
|
14
14
|
label: string;
|
|
15
|
+
labelPrefix: string;
|
|
15
16
|
/**
|
|
16
17
|
* Determines the heading tag of the accordion toggle.
|
|
17
18
|
* The headingLevel shouldn't be used directly to render the heading tag
|
|
18
19
|
* in order to avoid XSS issues.
|
|
19
|
-
* @returns {
|
|
20
|
+
* @returns {string} The heading tag of the accordion toggle.
|
|
20
21
|
* @internal
|
|
21
22
|
*/
|
|
22
23
|
_getHeadingTag(): string;
|
|
@@ -27,5 +28,5 @@ export class LeuAccordion extends LitElement {
|
|
|
27
28
|
_handleToggleClick(): void;
|
|
28
29
|
render(): import("lit-html").TemplateResult;
|
|
29
30
|
}
|
|
30
|
-
import {
|
|
31
|
+
import { L as LeuElement } from './LeuElement-6de6f209.js';
|
|
31
32
|
//# sourceMappingURL=Accordion.d.ts.map
|
package/dist/Accordion.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["Accordion.js"],"names":[],"mappings":"AA+JA;;;;;;;;;GASG;AACH;IAGI,qBAAqB;IACrB,cAAiB;IACjB,cAAe;
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["Accordion.js"],"names":[],"mappings":"AA+JA;;;;;;;;;GASG;AACH;IAGI,qBAAqB;IACrB,cAAiB;IACjB,cAAe;IACf,oBAAqB;IAGvB;;;;;;OAMG;IACH,kBAHa,MAAM,CASlB;IAED;;;OAGG;IACH,2BAEC;IACD,4CA2BC;CAEF;gCArOqD,0BAA0B"}
|
package/dist/Accordion.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as _defineProperty } from './
|
|
2
|
-
import { css,
|
|
1
|
+
import { _ as _defineProperty, L as LeuElement } from './LeuElement-6de6f209.js';
|
|
2
|
+
import { css, nothing } from 'lit';
|
|
3
3
|
import { html, unsafeStatic } from 'lit/static-html.js';
|
|
4
4
|
|
|
5
5
|
var css_248z = css`:host,
|
|
@@ -160,26 +160,27 @@ slot[name="content"] {
|
|
|
160
160
|
/**
|
|
161
161
|
* @tagname leu-accordion
|
|
162
162
|
* @slot content - The content of the accordion. No styles will be applied to the content.
|
|
163
|
-
* @prop {
|
|
164
|
-
* @prop {
|
|
165
|
-
* @prop {
|
|
166
|
-
* @prop {
|
|
167
|
-
* @attr {
|
|
168
|
-
* @attr {
|
|
163
|
+
* @prop {number} headingLevel - The heading level of the accordion title. Must be between 1 and 6.
|
|
164
|
+
* @prop {boolean} open - The expanded state of the accordion.
|
|
165
|
+
* @prop {string} label - The label (title) of the accordion.
|
|
166
|
+
* @prop {string} labelPrefix - The prefix of the accordion label. e.g. "01"
|
|
167
|
+
* @attr {number} heading-level - The heading level of the accordion title. Must be between 1 and 6.
|
|
168
|
+
* @attr {string} label-prefix - The prefix of the accordion label. e.g. "01"
|
|
169
169
|
*/
|
|
170
|
-
class LeuAccordion extends
|
|
170
|
+
class LeuAccordion extends LeuElement {
|
|
171
171
|
constructor() {
|
|
172
172
|
super();
|
|
173
173
|
this.headingLevel = 2;
|
|
174
174
|
this.open = false;
|
|
175
175
|
this.label = "";
|
|
176
|
+
this.labelPrefix = "";
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
/**
|
|
179
180
|
* Determines the heading tag of the accordion toggle.
|
|
180
181
|
* The headingLevel shouldn't be used directly to render the heading tag
|
|
181
182
|
* in order to avoid XSS issues.
|
|
182
|
-
* @returns {
|
|
183
|
+
* @returns {string} The heading tag of the accordion toggle.
|
|
183
184
|
* @internal
|
|
184
185
|
*/
|
|
185
186
|
_getHeadingTag() {
|
|
@@ -230,7 +231,7 @@ class LeuAccordion extends LitElement {
|
|
|
230
231
|
_defineProperty(LeuAccordion, "styles", css_248z);
|
|
231
232
|
/** @internal */
|
|
232
233
|
_defineProperty(LeuAccordion, "shadowRootOptions", {
|
|
233
|
-
...
|
|
234
|
+
...LeuElement.shadowRootOptions,
|
|
234
235
|
delegatesFocus: true
|
|
235
236
|
});
|
|
236
237
|
_defineProperty(LeuAccordion, "properties", {
|
package/dist/Breadcrumb.d.ts
CHANGED
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
*
|
|
29
29
|
*
|
|
30
30
|
* @prop {Array} items - Object array with { label, href }
|
|
31
|
-
* @prop {
|
|
31
|
+
* @prop {boolean} inverted - invert color on dark background
|
|
32
32
|
*
|
|
33
33
|
* @tagname leu-breadcrumb
|
|
34
34
|
*/
|
|
35
|
-
export class LeuBreadcrumb extends
|
|
35
|
+
export class LeuBreadcrumb extends LeuElement {
|
|
36
36
|
_lastContainerWidth: any;
|
|
37
37
|
_showBackOnly: boolean;
|
|
38
38
|
_isRecalculating: boolean;
|
|
39
39
|
_hiddenItems: number;
|
|
40
40
|
_isDropdownOpen: boolean;
|
|
41
41
|
items: any[];
|
|
42
|
-
/** @type {
|
|
42
|
+
/** @type {boolean} - will be used on dark Background */
|
|
43
43
|
inverted: boolean;
|
|
44
44
|
/** @internal */
|
|
45
45
|
_containerRef: import("lit-html/directives/ref.js").Ref<Element>;
|
|
@@ -64,6 +64,6 @@ export class LeuBreadcrumb extends LitElement {
|
|
|
64
64
|
renderDropdown(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
65
65
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
66
66
|
}
|
|
67
|
-
import {
|
|
67
|
+
import { L as LeuElement } from './LeuElement-6de6f209.js';
|
|
68
68
|
import { nothing } from 'lit';
|
|
69
69
|
//# sourceMappingURL=Breadcrumb.d.ts.map
|
package/dist/Breadcrumb.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["Breadcrumb.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["Breadcrumb.js"],"names":[],"mappings":"AAuHA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH;IAOM,yBAA+C;IAO7C,uBAAyB;IACzB,0BAA6B;IAY7B,qBAAqB;IASvB,yBAA4C;IAW9C,aAAe;IACf,wDAAwD;IACxD,UADW,OAAO,CACG;IAErB,gBAAgB;IAChB,iEAAgC;IAehC,+BAEQ;IAEV,qBAEC;IACD,+CAOC;IAOD,gBAAgB;IAChB,sBAEC;IAED,gBAAgB;IAChB,4BAEC;IACD;;;;;OAKG;IACH,eAFa,IAAI,CA4BhB;IACD;;;OAGG;IACH,wEAqCC;IACD,gEAmCC;CACF;gCAzWqD,0BAA0B;wBAC7C,KAAK"}
|
package/dist/Breadcrumb.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { _ as _defineProperty } from './
|
|
2
|
-
import { css,
|
|
1
|
+
import { _ as _defineProperty, L as LeuElement } from './LeuElement-6de6f209.js';
|
|
2
|
+
import { css, nothing, html } from 'lit';
|
|
3
3
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
-
import { I as Icon } from './icon-03e86700.js';
|
|
6
|
-
import './leu-menu.js';
|
|
7
|
-
import './leu-menu-item.js';
|
|
8
|
-
import './leu-popup.js';
|
|
9
|
-
import './leu-visually-hidden.js';
|
|
10
5
|
import { d as debounce } from './utils-65469421.js';
|
|
11
|
-
import './
|
|
12
|
-
import './Menu.js';
|
|
13
|
-
import './MenuItem.js';
|
|
14
|
-
import '
|
|
6
|
+
import { LeuIcon } from './Icon.js';
|
|
7
|
+
import { LeuMenu } from './Menu.js';
|
|
8
|
+
import { LeuMenuItem } from './MenuItem.js';
|
|
9
|
+
import { LeuPopup } from './Popup.js';
|
|
10
|
+
import { LeuVisuallyHidden } from './VisuallyHidden.js';
|
|
15
11
|
import 'lit/directives/if-defined.js';
|
|
16
|
-
import './Popup.js';
|
|
17
12
|
import '@floating-ui/dom';
|
|
18
|
-
import './VisuallyHidden.js';
|
|
19
13
|
|
|
20
14
|
var css_248z = css`:host,
|
|
21
15
|
:host * {
|
|
@@ -26,8 +20,6 @@ var css_248z = css`:host,
|
|
|
26
20
|
--breadcrumb-font-regular: var(--leu-font-family-regular);
|
|
27
21
|
--breadcrumb-font-black: var(--leu-font-family-black);
|
|
28
22
|
|
|
29
|
-
font-family: var(--leu-font-family-regular);
|
|
30
|
-
|
|
31
23
|
font-family: var(--breadcrumb-font-regular);
|
|
32
24
|
line-height: 1.5;
|
|
33
25
|
color: var(--leu-color-black-100);
|
|
@@ -155,11 +147,11 @@ var css_248z = css`:host,
|
|
|
155
147
|
*
|
|
156
148
|
*
|
|
157
149
|
* @prop {Array} items - Object array with { label, href }
|
|
158
|
-
* @prop {
|
|
150
|
+
* @prop {boolean} inverted - invert color on dark background
|
|
159
151
|
*
|
|
160
152
|
* @tagname leu-breadcrumb
|
|
161
153
|
*/
|
|
162
|
-
class LeuBreadcrumb extends
|
|
154
|
+
class LeuBreadcrumb extends LeuElement {
|
|
163
155
|
constructor() {
|
|
164
156
|
super();
|
|
165
157
|
/** @type {Array} */
|
|
@@ -207,7 +199,7 @@ class LeuBreadcrumb extends LitElement {
|
|
|
207
199
|
window.removeEventListener("click", this._closeDropdown);
|
|
208
200
|
});
|
|
209
201
|
this.items = [];
|
|
210
|
-
/** @type {
|
|
202
|
+
/** @type {boolean} - will be used on dark Background */
|
|
211
203
|
this.inverted = false;
|
|
212
204
|
|
|
213
205
|
/** @internal */
|
|
@@ -297,7 +289,9 @@ class LeuBreadcrumb extends LitElement {
|
|
|
297
289
|
if (this._dropdownItems.length === 0 && !this._isRecalculating) return nothing;
|
|
298
290
|
return html`
|
|
299
291
|
<li class="breadcrumbs__item" data-dropdown-toggle>
|
|
300
|
-
<span class="breadcrumbs__icon"
|
|
292
|
+
<span class="breadcrumbs__icon"
|
|
293
|
+
><leu-icon name="angleRight"></leu-icon
|
|
294
|
+
></span>
|
|
301
295
|
<leu-popup
|
|
302
296
|
?active=${this._isDropdownOpen}
|
|
303
297
|
placement="bottom-start"
|
|
@@ -318,10 +312,9 @@ class LeuBreadcrumb extends LitElement {
|
|
|
318
312
|
${html`
|
|
319
313
|
<leu-menu>
|
|
320
314
|
${this._dropdownItems.map(item => html`
|
|
321
|
-
<leu-menu-item
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
></leu-menu-item>
|
|
315
|
+
<leu-menu-item href=${item.href}
|
|
316
|
+
>${item.label}</leu-menu-item
|
|
317
|
+
>
|
|
325
318
|
`)}
|
|
326
319
|
</leu-menu>
|
|
327
320
|
`}
|
|
@@ -343,15 +336,17 @@ class LeuBreadcrumb extends LitElement {
|
|
|
343
336
|
<leu-visually-hidden><h2>Sie sind hier:</h2></leu-visually-hidden>
|
|
344
337
|
<ol class="breadcrumbs__list" ref=${ref(this._containerRef)}>
|
|
345
338
|
${showBackOnly ? html` <li class="breadcrumbs__item breadcrumbs__item--back">
|
|
346
|
-
<span class="breadcrumbs__icon"
|
|
339
|
+
<span class="breadcrumbs__icon"
|
|
340
|
+
><leu-icon name="arrowLeft"></leu-icon
|
|
341
|
+
></span>
|
|
347
342
|
<a class="breadcrumbs__link" href=${parentItem.href}
|
|
348
343
|
>${parentItem.label}</a
|
|
349
344
|
>
|
|
350
345
|
</li>` : this._listItems.map((item, index, list) => html`
|
|
351
346
|
<li class="breadcrumbs__item">
|
|
352
347
|
${index > 0 ? html`<span class="breadcrumbs__icon"
|
|
353
|
-
|
|
354
|
-
>` // First list item doesn't have an arrow
|
|
348
|
+
><leu-icon name="angleRight"></leu-icon
|
|
349
|
+
></span>` // First list item doesn't have an arrow
|
|
355
350
|
: nothing}
|
|
356
351
|
${index === list.length - 1 ? item.label // Last list item doesn't contain a link
|
|
357
352
|
: html`<a class="breadcrumbs__link" href=${item.href}
|
|
@@ -365,6 +360,13 @@ class LeuBreadcrumb extends LitElement {
|
|
|
365
360
|
`;
|
|
366
361
|
}
|
|
367
362
|
}
|
|
363
|
+
_defineProperty(LeuBreadcrumb, "dependencies", {
|
|
364
|
+
"leu-icon": LeuIcon,
|
|
365
|
+
"leu-menu": LeuMenu,
|
|
366
|
+
"leu-menu-item": LeuMenuItem,
|
|
367
|
+
"leu-popup": LeuPopup,
|
|
368
|
+
"leu-visually-hidden": LeuVisuallyHidden
|
|
369
|
+
});
|
|
368
370
|
_defineProperty(LeuBreadcrumb, "styles", css_248z);
|
|
369
371
|
_defineProperty(LeuBreadcrumb, "properties", {
|
|
370
372
|
items: {
|
|
@@ -37,19 +37,20 @@ declare class HasSlotController implements ReactiveController {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* @tagname leu-button
|
|
40
|
+
* @slot before - The icon to display before the label
|
|
41
|
+
* @slot after - The icon to display after the label
|
|
42
|
+
* @slot - The label of the button or the icon if no label is set
|
|
40
43
|
*/
|
|
41
|
-
declare class LeuButton extends
|
|
44
|
+
declare class LeuButton extends LeuElement {
|
|
42
45
|
label: any;
|
|
43
46
|
/** @type {string} */
|
|
44
|
-
icon: string;
|
|
45
|
-
/** @type {("before" | "after")} - Only taken into account if Label and no Icon is set */
|
|
46
|
-
iconPosition: ("before" | "after");
|
|
47
|
-
/** @type {string} */
|
|
48
47
|
size: string;
|
|
49
48
|
/** @type {string} */
|
|
50
49
|
variant: string;
|
|
51
50
|
/** @type {"button" | "submit" | "reset"} */
|
|
52
51
|
type: "button" | "submit" | "reset";
|
|
52
|
+
/** @type {string} */
|
|
53
|
+
componentRole: string;
|
|
53
54
|
/** @type {boolean} */
|
|
54
55
|
disabled: boolean;
|
|
55
56
|
/** @type {boolean} - Only taken into account if no Label and an Icon is set */
|
|
@@ -65,20 +66,18 @@ declare class LeuButton extends LitElement {
|
|
|
65
66
|
* @type {("true" | "false" | undefined)}
|
|
66
67
|
*/
|
|
67
68
|
expanded: ("true" | "false" | undefined);
|
|
68
|
-
getIconSize(): 16 | 24;
|
|
69
|
-
renderIconBefore(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
70
|
-
renderIconAfter(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
71
69
|
renderExpandingIcon(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
72
70
|
getAriaAttributes(): {
|
|
73
|
-
role:
|
|
71
|
+
role: string;
|
|
74
72
|
label: any;
|
|
75
73
|
};
|
|
74
|
+
hasTextContent(): boolean;
|
|
76
75
|
render(): import("lit-html").TemplateResult<1>;
|
|
77
76
|
}
|
|
78
77
|
declare const BUTTON_SIZES: string[];
|
|
79
78
|
declare const BUTTON_TYPES: string[];
|
|
80
79
|
declare const BUTTON_EXPANDED_OPTIONS: string[];
|
|
81
|
-
import {
|
|
80
|
+
import { L as LeuElement } from './LeuElement-6de6f209.js';
|
|
82
81
|
import { nothing } from 'lit';
|
|
83
82
|
export { BUTTON_VARIANTS as B, HasSlotController as H, LeuButton as L, BUTTON_SIZES as a, BUTTON_TYPES as b, BUTTON_EXPANDED_OPTIONS as c };
|
|
84
|
-
//# sourceMappingURL=Button-
|
|
83
|
+
//# sourceMappingURL=Button-9692e403.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button-9692e403.d.ts","sourceRoot":"","sources":["Button-9692e403.js"],"names":[],"mappings":";;;iCAaa,OAAO,KAAK,EAAE,kBAAkB;AAyW7C,wCAA0D;AAhX1D;;;GAGG;AAEH;;;;GAIG;AACH,2CAFgB,kBAAkB;IAGhC,uCAcC;IAHC,UAAgB;IAEhB,eAA0B;IAG5B;;;OAGG;IACH,uBAeC;IAED;;;;OAIG;IACH,qBAEC;IAED;;;OAGG;IACH,gCAEC;IACD,sBAEC;IACD,yBAEC;CACF;AAmTD;;;;;GAKG;AACH;IAQI,WAAiB;IACjB,qBAAqB;IACrB,MADW,MAAM,CACI;IACrB,qBAAqB;IACrB,SADW,MAAM,CACO;IACxB,4CAA4C;IAC5C,MADW,QAAQ,GAAG,QAAQ,GAAG,OAAO,CACpB;IAEpB,qBAAqB;IACrB,eADW,MAAM,CACa;IAE9B,sBAAsB;IACtB,UADW,OAAO,CACG;IACrB,+EAA+E;IAC/E,OADW,OAAO,CACA;IAClB,sBAAsB;IACtB,QADW,OAAO,CACC;IACnB,wDAAwD;IACxD,UADW,OAAO,CACG;IAErB,gGAAgG;IAChG,OADW,OAAO,CACA;IAElB;;;OAGG;IACH,UAFU,CAAC,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAEf;IAE3B,6EAOC;IACD;;;MAaC;IACD,0BAEC;IACD,+CAiCC;CACF;AA7GD,qCAA0C;AAE1C,qCAAmD;AAEnD,gDAAkD;gCA5XI,0BAA0B;wBAC7C,KAAK"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as _defineProperty } from './
|
|
2
|
-
import { css,
|
|
1
|
+
import { _ as _defineProperty, L as LeuElement } from './LeuElement-6de6f209.js';
|
|
2
|
+
import { css, html, nothing } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
-
import {
|
|
5
|
+
import { LeuIcon } from './Icon.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Thanks Shoelace!
|
|
@@ -76,6 +76,18 @@ class HasSlotController {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* All roles that are associated with a aria-checked attribute
|
|
81
|
+
* @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
82
|
+
*/
|
|
83
|
+
const ARIA_CHECKED_ROLES = ["checkbox", "menuitemcheckbox", "menuitemradio", "option", "radio", "switch"];
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* All roles that are associated with a aria-selected attribute
|
|
87
|
+
* @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected
|
|
88
|
+
*/
|
|
89
|
+
const ARIA_SELECTED_ROLES = ["gridcell", "option", "row", "tab", "columnheader", "rowheader", "treeitem"];
|
|
90
|
+
|
|
79
91
|
var css_248z = css`:host {
|
|
80
92
|
display: inline-block;
|
|
81
93
|
}
|
|
@@ -90,12 +102,21 @@ button {
|
|
|
90
102
|
cursor: pointer;
|
|
91
103
|
border: 1px solid transparent;
|
|
92
104
|
border-radius: 2px;
|
|
105
|
+
|
|
106
|
+
max-width: 100%;
|
|
93
107
|
display: flex;
|
|
94
108
|
align-items: center;
|
|
95
109
|
-moz-column-gap: 8px;
|
|
96
110
|
column-gap: 8px;
|
|
97
111
|
}
|
|
98
112
|
|
|
113
|
+
.content {
|
|
114
|
+
flex: 1 1 0;
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
text-overflow: ellipsis;
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
}
|
|
119
|
+
|
|
99
120
|
button.round {
|
|
100
121
|
border-radius: 50%;
|
|
101
122
|
}
|
|
@@ -127,7 +148,7 @@ button.regular {
|
|
|
127
148
|
line-height: 24px;
|
|
128
149
|
}
|
|
129
150
|
|
|
130
|
-
button.regular.icon {
|
|
151
|
+
button.regular.icon-only {
|
|
131
152
|
padding: 12px;
|
|
132
153
|
}
|
|
133
154
|
|
|
@@ -137,9 +158,11 @@ button.small {
|
|
|
137
158
|
padding: 6px 24px;
|
|
138
159
|
font-size: 14px;
|
|
139
160
|
line-height: 20px;
|
|
161
|
+
|
|
162
|
+
--leu-icon-size: 1rem;
|
|
140
163
|
}
|
|
141
164
|
|
|
142
|
-
button.small.icon {
|
|
165
|
+
button.small.icon-only {
|
|
143
166
|
padding: 8px;
|
|
144
167
|
}
|
|
145
168
|
|
|
@@ -198,6 +221,8 @@ button.secondary:disabled {
|
|
|
198
221
|
/* ghost */
|
|
199
222
|
|
|
200
223
|
button.ghost {
|
|
224
|
+
--leu-icon-size: 1rem;
|
|
225
|
+
|
|
201
226
|
background: transparent;
|
|
202
227
|
padding: 0 0.5rem;
|
|
203
228
|
color: var(--leu-color-black-60);
|
|
@@ -280,11 +305,13 @@ button.ghost.inverted:disabled {
|
|
|
280
305
|
|
|
281
306
|
/* icon-wrapper */
|
|
282
307
|
|
|
283
|
-
.icon-wrapper
|
|
308
|
+
.icon-wrapper leu-icon {
|
|
284
309
|
display: block;
|
|
285
310
|
}
|
|
286
311
|
|
|
287
|
-
.ghost
|
|
312
|
+
.ghost.icon-before .icon-wrapper--before,
|
|
313
|
+
.ghost.icon-after .icon-wrapper--after {
|
|
314
|
+
display: block;
|
|
288
315
|
padding: 0.5rem;
|
|
289
316
|
border-radius: 50%;
|
|
290
317
|
background: var(--leu-color-black-transp-10);
|
|
@@ -354,41 +381,31 @@ Object.freeze(BUTTON_TYPES);
|
|
|
354
381
|
const BUTTON_EXPANDED_OPTIONS = ["true", "false"];
|
|
355
382
|
Object.freeze(BUTTON_EXPANDED_OPTIONS);
|
|
356
383
|
|
|
357
|
-
/**
|
|
358
|
-
* All roles that are associated with a aria-checked attribute
|
|
359
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
360
|
-
*/
|
|
361
|
-
const ARIA_ROLES_CHECKED = ["checkbox", "menuitemcheckbox", "menuitemradio", "option", "radio", "switch"];
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* All roles that are associated with a aria-selected attribute
|
|
365
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected
|
|
366
|
-
*/
|
|
367
|
-
const ARIA_ROLES_SELECTED = ["gridcell", "option", "row", "tab", "columnheader", "rowheader", "treeitem"];
|
|
368
|
-
|
|
369
384
|
/**
|
|
370
385
|
* @tagname leu-button
|
|
386
|
+
* @slot before - The icon to display before the label
|
|
387
|
+
* @slot after - The icon to display after the label
|
|
388
|
+
* @slot - The label of the button or the icon if no label is set
|
|
371
389
|
*/
|
|
372
|
-
class LeuButton extends
|
|
390
|
+
class LeuButton extends LeuElement {
|
|
373
391
|
constructor() {
|
|
374
392
|
super();
|
|
375
393
|
/** @type {string} */
|
|
376
394
|
/**
|
|
377
395
|
* @internal
|
|
378
396
|
*/
|
|
379
|
-
_defineProperty(this, "hasSlotController", new HasSlotController(this, ["[default]"]));
|
|
397
|
+
_defineProperty(this, "hasSlotController", new HasSlotController(this, ["before", "after", "[default]"]));
|
|
380
398
|
this.label = null;
|
|
381
399
|
/** @type {string} */
|
|
382
|
-
this.icon = null;
|
|
383
|
-
/** @type {("before" | "after")} - Only taken into account if Label and no Icon is set */
|
|
384
|
-
this.iconPosition = "before";
|
|
385
|
-
/** @type {string} */
|
|
386
400
|
this.size = "regular";
|
|
387
401
|
/** @type {string} */
|
|
388
402
|
this.variant = "primary";
|
|
389
403
|
/** @type {"button" | "submit" | "reset"} */
|
|
390
404
|
this.type = "button";
|
|
391
405
|
|
|
406
|
+
/** @type {string} */
|
|
407
|
+
this.componentRole = undefined;
|
|
408
|
+
|
|
392
409
|
/** @type {boolean} */
|
|
393
410
|
this.disabled = false;
|
|
394
411
|
/** @type {boolean} - Only taken into account if no Label and an Icon is set */
|
|
@@ -407,29 +424,10 @@ class LeuButton extends LitElement {
|
|
|
407
424
|
*/
|
|
408
425
|
this.expanded = undefined;
|
|
409
426
|
}
|
|
410
|
-
getIconSize() {
|
|
411
|
-
return this.size === "small" || this.variant === "ghost" ? 16 : 24;
|
|
412
|
-
}
|
|
413
|
-
renderIconBefore() {
|
|
414
|
-
if (this.icon && this.iconPosition === "before") {
|
|
415
|
-
return html`<div class="icon-wrapper icon-wrapper--before">
|
|
416
|
-
${Icon(this.icon, this.getIconSize())}
|
|
417
|
-
</div>`;
|
|
418
|
-
}
|
|
419
|
-
return nothing;
|
|
420
|
-
}
|
|
421
|
-
renderIconAfter() {
|
|
422
|
-
if (this.icon && this.iconPosition === "after") {
|
|
423
|
-
return html`<div class="icon-wrapper icon-wrapper--after">
|
|
424
|
-
${Icon(this.icon, this.getIconSize())}
|
|
425
|
-
</div>`;
|
|
426
|
-
}
|
|
427
|
-
return nothing;
|
|
428
|
-
}
|
|
429
427
|
renderExpandingIcon() {
|
|
430
428
|
if (typeof this.expanded !== "undefined" && this.variant === "ghost") {
|
|
431
429
|
return html`<div class="icon-wrapper icon-wrapper--expanded">
|
|
432
|
-
|
|
430
|
+
<leu-icon name="angleDropDown" size="24"></leu-icon>
|
|
433
431
|
</div>`;
|
|
434
432
|
}
|
|
435
433
|
return nothing;
|
|
@@ -440,20 +438,28 @@ class LeuButton extends LitElement {
|
|
|
440
438
|
label: this.label
|
|
441
439
|
};
|
|
442
440
|
if (this.componentRole) {
|
|
443
|
-
if (
|
|
441
|
+
if (ARIA_CHECKED_ROLES.includes(this.componentRole)) {
|
|
444
442
|
attributes.checked = this.active ? "true" : "false";
|
|
445
|
-
} else if (
|
|
443
|
+
} else if (ARIA_SELECTED_ROLES.includes(this.componentRole)) {
|
|
446
444
|
attributes.selected = this.active ? "true" : "false";
|
|
447
445
|
}
|
|
448
446
|
}
|
|
449
447
|
return attributes;
|
|
450
448
|
}
|
|
449
|
+
hasTextContent() {
|
|
450
|
+
return Array.from(this.childNodes).some(node => node.nodeType === node.TEXT_NODE && node.textContent.trim() !== "");
|
|
451
|
+
}
|
|
451
452
|
render() {
|
|
452
|
-
const
|
|
453
|
+
const hasTextContent = this.hasTextContent();
|
|
454
|
+
const hasIconDefault = Boolean(this.querySelector("leu-icon"));
|
|
455
|
+
const hasIconBefore = this.hasSlotController.test("before");
|
|
456
|
+
const hasIconAfter = this.hasSlotController.test("after");
|
|
453
457
|
const aria = this.getAriaAttributes();
|
|
454
458
|
const cssClasses = {
|
|
455
|
-
icon:
|
|
456
|
-
|
|
459
|
+
"icon-only": hasIconDefault && !hasTextContent,
|
|
460
|
+
"icon-before": hasIconBefore,
|
|
461
|
+
"icon-after": hasIconAfter,
|
|
462
|
+
round: this.round,
|
|
457
463
|
active: this.active,
|
|
458
464
|
inverted: this.inverted,
|
|
459
465
|
[this.variant]: true,
|
|
@@ -464,24 +470,29 @@ class LeuButton extends LitElement {
|
|
|
464
470
|
aria-label=${ifDefined(aria.label)}
|
|
465
471
|
aria-selected=${ifDefined(aria.selected)}
|
|
466
472
|
aria-checked=${ifDefined(aria.checked)}
|
|
473
|
+
aria-expanded=${ifDefined(this.expanded)}
|
|
467
474
|
role=${ifDefined(aria.role)}
|
|
468
475
|
class=${classMap(cssClasses)}
|
|
469
476
|
?disabled=${this.disabled}
|
|
470
477
|
type=${this.type}
|
|
471
478
|
>
|
|
472
|
-
|
|
473
|
-
<slot></slot>
|
|
474
|
-
|
|
479
|
+
<slot name="before" class="icon-wrapper icon-wrapper--before"></slot>
|
|
480
|
+
<span class="content"><slot></slot></span>
|
|
481
|
+
<slot name="after" class="icon-wrapper icon-wrapper--after"></slot>
|
|
482
|
+
${this.renderExpandingIcon()}
|
|
475
483
|
</button>
|
|
476
484
|
`;
|
|
477
485
|
}
|
|
478
486
|
}
|
|
487
|
+
_defineProperty(LeuButton, "dependencies", {
|
|
488
|
+
"leu-icon": LeuIcon
|
|
489
|
+
});
|
|
479
490
|
_defineProperty(LeuButton, "styles", css_248z);
|
|
480
491
|
/**
|
|
481
492
|
* @internal
|
|
482
493
|
*/
|
|
483
494
|
_defineProperty(LeuButton, "shadowRootOptions", {
|
|
484
|
-
...
|
|
495
|
+
...LeuElement.shadowRootOptions,
|
|
485
496
|
delegatesFocus: true
|
|
486
497
|
});
|
|
487
498
|
_defineProperty(LeuButton, "properties", {
|
|
@@ -489,14 +500,6 @@ _defineProperty(LeuButton, "properties", {
|
|
|
489
500
|
type: String,
|
|
490
501
|
reflect: true
|
|
491
502
|
},
|
|
492
|
-
icon: {
|
|
493
|
-
type: String,
|
|
494
|
-
reflect: true
|
|
495
|
-
},
|
|
496
|
-
iconPosition: {
|
|
497
|
-
type: String,
|
|
498
|
-
reflect: true
|
|
499
|
-
},
|
|
500
503
|
size: {
|
|
501
504
|
type: String,
|
|
502
505
|
reflect: true
|
package/dist/Button.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { c as BUTTON_EXPANDED_OPTIONS, a as BUTTON_SIZES, b as BUTTON_TYPES, B as BUTTON_VARIANTS, L as LeuButton } from "./Button-
|
|
1
|
+
export { c as BUTTON_EXPANDED_OPTIONS, a as BUTTON_SIZES, b as BUTTON_TYPES, B as BUTTON_VARIANTS, L as LeuButton } from "./Button-9692e403.js";
|
|
2
2
|
//# sourceMappingURL=Button.d.ts.map
|
package/dist/Button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './LeuElement-6de6f209.js';
|
|
2
2
|
import 'lit';
|
|
3
3
|
import 'lit/directives/class-map.js';
|
|
4
4
|
import 'lit/directives/if-defined.js';
|
|
5
|
-
import './
|
|
6
|
-
export { c as BUTTON_EXPANDED_OPTIONS, a as BUTTON_SIZES, b as BUTTON_TYPES, B as BUTTON_VARIANTS, L as LeuButton } from './Button-
|
|
5
|
+
import './Icon.js';
|
|
6
|
+
export { c as BUTTON_EXPANDED_OPTIONS, a as BUTTON_SIZES, b as BUTTON_TYPES, B as BUTTON_VARIANTS, L as LeuButton } from './Button-9692e403.js';
|