@statistikzh/leu 0.3.0 → 0.5.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/.github/workflows/deploy-github-pages.yaml +33 -0
- package/.storybook/main.js +27 -1
- package/.storybook/manager-head.html +1 -0
- package/.storybook/manager.js +9 -0
- package/.storybook/preview-head.html +1 -1
- package/.storybook/preview.js +59 -6
- package/.storybook/static/logo.svg +19 -0
- package/.storybook/theme.js +7 -0
- package/CHANGELOG.md +54 -0
- package/README.md +1 -1
- package/custom-elements-manifest.config.js +46 -0
- package/dist/Accordion.d.ts +31 -0
- package/dist/Accordion.d.ts.map +1 -0
- package/dist/Accordion.js +257 -0
- package/dist/Breadcrumb.d.ts +69 -0
- package/dist/Breadcrumb.d.ts.map +1 -0
- package/dist/Breadcrumb.js +392 -0
- package/dist/Button-da11d064.d.ts +84 -0
- package/dist/Button-da11d064.d.ts.map +1 -0
- package/dist/Button-da11d064.js +542 -0
- package/dist/Button.d.ts +2 -0
- package/dist/Button.d.ts.map +1 -0
- package/dist/Button.js +6 -423
- package/dist/ButtonGroup.d.ts +24 -0
- package/dist/ButtonGroup.d.ts.map +1 -0
- package/dist/ButtonGroup.js +72 -43
- package/dist/Checkbox.d.ts +13 -0
- package/dist/Checkbox.d.ts.map +1 -0
- package/dist/Checkbox.js +101 -84
- package/dist/CheckboxGroup.d.ts +13 -0
- package/dist/CheckboxGroup.d.ts.map +1 -0
- package/dist/CheckboxGroup.js +41 -37
- package/dist/Chip.d.ts +5 -0
- package/dist/Chip.d.ts.map +1 -0
- package/dist/{Chip-5f70d04f.js → Chip.js} +21 -6
- package/dist/ChipGroup.d.ts +28 -0
- package/dist/ChipGroup.d.ts.map +1 -0
- package/dist/ChipGroup.js +64 -10
- package/dist/ChipLink.d.ts +15 -0
- package/dist/ChipLink.d.ts.map +1 -0
- package/dist/ChipLink.js +4 -7
- package/dist/ChipRemovable.d.ts +13 -0
- package/dist/ChipRemovable.d.ts.map +1 -0
- package/dist/ChipRemovable.js +5 -8
- package/dist/ChipSelectable.d.ts +22 -0
- package/dist/ChipSelectable.d.ts.map +1 -0
- package/dist/ChipSelectable.js +8 -11
- package/dist/Dropdown.d.ts +15 -0
- package/dist/Dropdown.d.ts.map +1 -0
- package/dist/Dropdown.js +73 -26
- package/dist/Input.d.ts +154 -0
- package/dist/Input.d.ts.map +1 -0
- package/dist/Input.js +42 -35
- package/dist/Menu.d.ts +8 -0
- package/dist/Menu.d.ts.map +1 -0
- package/dist/Menu.js +2 -5
- package/dist/MenuItem.d.ts +21 -0
- package/dist/MenuItem.d.ts.map +1 -0
- package/dist/MenuItem.js +32 -17
- package/dist/Pagination.d.ts +27 -0
- package/dist/Pagination.d.ts.map +1 -0
- package/dist/Pagination.js +121 -89
- package/dist/Popup.d.ts +18 -0
- package/dist/Popup.d.ts.map +1 -0
- package/dist/Popup.js +215 -0
- package/dist/Radio.d.ts +12 -0
- package/dist/Radio.d.ts.map +1 -0
- package/dist/Radio.js +9 -8
- package/dist/RadioGroup.d.ts +20 -0
- package/dist/RadioGroup.d.ts.map +1 -0
- package/dist/RadioGroup.js +41 -39
- package/dist/ScrollTop.d.ts +19 -0
- package/dist/ScrollTop.d.ts.map +1 -0
- package/dist/ScrollTop.js +122 -0
- package/dist/Select.d.ts +98 -0
- package/dist/Select.d.ts.map +1 -0
- package/dist/Select.js +79 -122
- package/dist/Table.d.ts +48 -0
- package/dist/Table.d.ts.map +1 -0
- package/dist/Table.js +141 -121
- package/dist/VisuallyHidden.d.ts +8 -0
- package/dist/VisuallyHidden.d.ts.map +1 -0
- package/dist/VisuallyHidden.js +28 -0
- package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +3 -0
- package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +1 -0
- package/dist/{defineElement-ba770aed.js → _rollupPluginBabelHelpers-20f659f4.js} +1 -15
- package/dist/defineElement-40372b4b.d.ts +9 -0
- package/dist/defineElement-40372b4b.d.ts.map +1 -0
- package/dist/defineElement-40372b4b.js +15 -0
- package/dist/icon-03e86700.d.ts +11 -0
- package/dist/icon-03e86700.d.ts.map +1 -0
- package/dist/index.js.d.ts +21 -0
- package/dist/index.js.d.ts.map +1 -0
- package/dist/index.js.js +42 -0
- package/dist/leu-accordion.d.ts +3 -0
- package/dist/leu-accordion.d.ts.map +1 -0
- package/dist/leu-accordion.js +9 -0
- package/dist/leu-breadcrumb.d.ts +3 -0
- package/dist/leu-breadcrumb.d.ts.map +1 -0
- package/dist/leu-breadcrumb.js +23 -0
- package/dist/leu-button-group.d.ts +3 -0
- package/dist/leu-button-group.d.ts.map +1 -0
- package/dist/leu-button-group.js +6 -6
- package/dist/leu-button.d.ts +3 -0
- package/dist/leu-button.d.ts.map +1 -0
- package/dist/leu-button.js +7 -3
- package/dist/leu-checkbox-group.d.ts +3 -0
- package/dist/leu-checkbox-group.d.ts.map +1 -0
- package/dist/leu-checkbox-group.js +6 -3
- package/dist/leu-checkbox.d.ts +3 -0
- package/dist/leu-checkbox.d.ts.map +1 -0
- package/dist/leu-checkbox.js +6 -3
- package/dist/leu-chip-group.d.ts +3 -0
- package/dist/leu-chip-group.d.ts.map +1 -0
- package/dist/leu-chip-group.js +7 -3
- package/dist/leu-chip-link.d.ts +3 -0
- package/dist/leu-chip-link.d.ts.map +1 -0
- package/dist/leu-chip-link.js +7 -4
- package/dist/leu-chip-removable.d.ts +3 -0
- package/dist/leu-chip-removable.d.ts.map +1 -0
- package/dist/leu-chip-removable.js +7 -4
- package/dist/leu-chip-selectable.d.ts +3 -0
- package/dist/leu-chip-selectable.d.ts.map +1 -0
- package/dist/leu-chip-selectable.js +7 -4
- package/dist/leu-dropdown.d.ts +3 -0
- package/dist/leu-dropdown.d.ts.map +1 -0
- package/dist/leu-dropdown.js +15 -4
- package/dist/leu-input.d.ts +3 -0
- package/dist/leu-input.d.ts.map +1 -0
- package/dist/leu-input.js +7 -3
- package/dist/leu-menu-item.d.ts +3 -0
- package/dist/leu-menu-item.d.ts.map +1 -0
- package/dist/leu-menu-item.js +8 -3
- package/dist/leu-menu.d.ts +3 -0
- package/dist/leu-menu.d.ts.map +1 -0
- package/dist/leu-menu.js +6 -3
- package/dist/leu-pagination.d.ts +3 -0
- package/dist/leu-pagination.d.ts.map +1 -0
- package/dist/leu-pagination.js +12 -4
- package/dist/leu-popup.d.ts +3 -0
- package/dist/leu-popup.d.ts.map +1 -0
- package/dist/leu-popup.js +9 -0
- package/dist/leu-radio-group.d.ts +3 -0
- package/dist/leu-radio-group.d.ts.map +1 -0
- package/dist/leu-radio-group.js +6 -3
- package/dist/leu-radio.d.ts +3 -0
- package/dist/leu-radio.d.ts.map +1 -0
- package/dist/leu-radio.js +6 -3
- package/dist/leu-scroll-top.d.ts +3 -0
- package/dist/leu-scroll-top.d.ts.map +1 -0
- package/dist/leu-scroll-top.js +14 -0
- package/dist/leu-select.d.ts +3 -0
- package/dist/leu-select.d.ts.map +1 -0
- package/dist/leu-select.js +16 -4
- package/dist/leu-table.d.ts +3 -0
- package/dist/leu-table.d.ts.map +1 -0
- package/dist/leu-table.js +13 -4
- package/dist/leu-visually-hidden.d.ts +3 -0
- package/dist/leu-visually-hidden.d.ts.map +1 -0
- package/dist/leu-visually-hidden.js +8 -0
- package/dist/theme.css +386 -2
- package/dist/utils-65469421.d.ts +16 -0
- package/dist/utils-65469421.d.ts.map +1 -0
- package/dist/utils-65469421.js +35 -0
- package/index.js +3 -0
- package/package.json +47 -17
- package/postcss.config.cjs +2 -0
- package/rollup.config.js +21 -40
- package/scripts/generate-component/templates/[Name].js +0 -5
- package/scripts/generate-component/templates/[name].css +3 -3
- package/scripts/generate-component/templates/[namespace]-[name].js +5 -2
- package/scripts/postcss-leu-font-styles.cjs +160 -0
- package/src/components/accordion/Accordion.js +0 -6
- package/src/components/accordion/accordion.css +2 -2
- package/src/components/accordion/leu-accordion.js +5 -2
- package/src/components/accordion/stories/accordion.stories.js +8 -4
- package/src/components/accordion/test/accordion.test.js +95 -3
- package/src/components/breadcrumb/Breadcrumb.js +311 -0
- package/src/components/breadcrumb/breadcrumb.css +103 -0
- package/src/components/breadcrumb/leu-breadcrumb.js +6 -0
- package/src/components/breadcrumb/stories/breadcrumb.stories.js +73 -0
- package/src/components/breadcrumb/test/breadcrumb.test.js +141 -0
- package/src/components/button/Button.js +76 -20
- package/src/components/button/button.css +13 -5
- package/src/components/button/leu-button.js +5 -2
- package/src/components/button/stories/button.stories.js +79 -105
- package/src/components/button/test/button.test.js +184 -3
- package/src/components/button-group/ButtonGroup.js +76 -40
- package/src/components/button-group/leu-button-group.js +5 -2
- package/src/components/button-group/stories/button-group.stories.js +19 -6
- package/src/components/button-group/test/button-group.test.js +87 -4
- package/src/components/checkbox/Checkbox.js +6 -85
- package/src/components/checkbox/CheckboxGroup.js +8 -38
- package/src/components/checkbox/checkbox-group.css +29 -0
- package/src/components/checkbox/checkbox.css +76 -0
- package/src/components/checkbox/leu-checkbox-group.js +5 -2
- package/src/components/checkbox/leu-checkbox.js +5 -2
- package/src/components/checkbox/stories/checkbox-group.stories.js +44 -21
- package/src/components/checkbox/stories/checkbox.stories.js +7 -1
- package/src/components/checkbox/test/checkbox-group.test.js +124 -0
- package/src/components/checkbox/test/checkbox.test.js +72 -59
- package/src/components/chip/Chip.js +1 -0
- package/src/components/chip/ChipGroup.js +42 -7
- package/src/components/chip/ChipLink.js +1 -6
- package/src/components/chip/ChipRemovable.js +2 -7
- package/src/components/chip/ChipSelectable.js +5 -10
- package/src/components/chip/chip-group.css +12 -2
- package/src/components/chip/chip.css +14 -3
- package/src/components/chip/exports.js +4 -10
- package/src/components/chip/leu-chip-group.js +5 -2
- package/src/components/chip/leu-chip-link.js +5 -2
- package/src/components/chip/leu-chip-removable.js +5 -2
- package/src/components/chip/leu-chip-selectable.js +5 -2
- package/src/components/chip/stories/chip-group.stories.js +110 -44
- package/src/components/chip/stories/chip-link.stories.js +16 -4
- package/src/components/chip/stories/chip-removable.stories.js +15 -4
- package/src/components/chip/stories/chip-selectable.stories.js +13 -3
- package/src/components/chip/test/chip-group.test.js +124 -0
- package/src/components/chip/test/chip-link.test.js +58 -0
- package/src/components/chip/test/chip-removable.test.js +79 -0
- package/src/components/chip/test/chip-selectable.test.js +95 -0
- package/src/components/chip/test/chip.test.js +1 -1
- package/src/components/dropdown/Dropdown.js +72 -24
- package/src/components/dropdown/dropdown.css +1 -2
- package/src/components/dropdown/leu-dropdown.js +5 -2
- package/src/components/dropdown/stories/dropdown.stories.js +11 -5
- package/src/components/dropdown/test/dropdown.test.js +6 -6
- package/src/components/icon/icon.js +1 -1
- package/src/components/icon/test/icon.test.js +66 -0
- package/src/components/input/Input.js +25 -28
- package/src/components/input/input.css +11 -8
- package/src/components/input/leu-input.js +5 -2
- package/src/components/input/stories/input.stories.js +21 -2
- package/src/components/input/test/input.test.js +432 -4
- package/src/components/menu/Menu.js +0 -5
- package/src/components/menu/MenuItem.js +20 -13
- package/src/components/menu/leu-menu-item.js +5 -2
- package/src/components/menu/leu-menu.js +5 -2
- package/src/components/menu/menu-item.css +7 -4
- package/src/components/menu/stories/menu-item.stories.js +13 -4
- package/src/components/menu/stories/menu.stories.js +11 -5
- package/src/components/menu/test/menu-item.test.js +180 -0
- package/src/components/menu/test/menu.test.js +10 -2
- package/src/components/pagination/Pagination.js +118 -99
- package/src/components/pagination/leu-pagination.js +5 -2
- package/src/components/pagination/pagination.css +6 -1
- package/src/components/pagination/stories/pagination.stories.js +30 -9
- package/src/components/pagination/test/pagination.test.js +191 -5
- package/src/components/popup/Popup.js +200 -0
- package/src/components/popup/leu-popup.js +6 -0
- package/src/components/popup/popup.css +27 -0
- package/src/components/popup/stories/popup.stories.js +58 -0
- package/src/components/popup/test/popup.test.js +29 -0
- package/src/components/radio/Radio.js +2 -6
- package/src/components/radio/RadioGroup.js +6 -38
- package/src/components/radio/leu-radio-group.js +5 -2
- package/src/components/radio/leu-radio.js +5 -2
- package/src/components/radio/radio-group.css +29 -0
- package/src/components/radio/radio.css +1 -1
- package/src/components/radio/stories/radio-group.stories.js +38 -19
- package/src/components/radio/stories/radio.stories.js +7 -1
- package/src/components/radio/test/radio-group.test.js +86 -0
- package/src/components/radio/test/radio.test.js +108 -17
- package/src/components/scroll-top/ScrollTop.js +87 -0
- package/src/components/scroll-top/leu-scroll-top.js +6 -0
- package/src/components/scroll-top/scroll-top.css +34 -0
- package/src/components/scroll-top/stories/scroll-top.stories.js +217 -0
- package/src/components/scroll-top/test/scroll-top.test.js +22 -0
- package/src/components/select/Select.js +58 -37
- package/src/components/select/leu-select.js +5 -2
- package/src/components/select/select.css +15 -15
- package/src/components/select/stories/select.stories.js +15 -168
- package/src/components/select/test/fixtures.js +162 -0
- package/src/components/select/test/select.test.js +236 -12
- package/src/components/table/Table.js +43 -118
- package/src/components/table/leu-table.js +5 -2
- package/src/components/table/stories/table.stories.js +20 -10
- package/src/components/table/table.css +99 -0
- package/src/components/table/test/table.test.js +1 -1
- package/src/components/visually-hidden/VisuallyHidden.js +13 -0
- package/src/components/visually-hidden/leu-visually-hidden.js +6 -0
- package/src/components/visually-hidden/stories/visually-hidden.stories.js +22 -0
- package/src/components/visually-hidden/test/visually-hidden.test.js +36 -0
- package/src/components/visually-hidden/visually-hidden.css +10 -0
- package/src/lib/defineElement.js +1 -1
- package/src/lib/hasSlotController.js +5 -3
- package/src/lib/utils.js +35 -0
- package/src/styles/custom-properties.css +6 -2
- package/src/styles/font-definitions.json +202 -0
- package/stylelint.config.mjs +2 -0
- package/tsconfig.build.json +21 -0
- package/tsconfig.json +16 -0
- package/{web-dev-server-storybook.config.mjs → web-dev-server.config.mjs} +1 -2
- package/web-test-runner.config.mjs +15 -2
- package/dist/index.js +0 -26
package/dist/MenuItem.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
2
|
-
import { css, LitElement,
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
|
+
import { css, LitElement, nothing } from 'lit';
|
|
3
|
+
import { html, unsafeStatic } from 'lit/static-html.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
3
5
|
import { a as ICON_NAMES, I as Icon } from './icon-03e86700.js';
|
|
4
6
|
|
|
5
7
|
var css_248z = css`:host,
|
|
@@ -11,15 +13,18 @@ var css_248z = css`:host,
|
|
|
11
13
|
--background: var(--leu-color-black-0);
|
|
12
14
|
--background-hover: var(--leu-color-black-10);
|
|
13
15
|
--background-active: var(--leu-color-func-cyan);
|
|
14
|
-
--background-disabled: var(--leu-color-black-0);
|
|
16
|
+
--background-disabled: var(--leu-color-black-black-0);
|
|
15
17
|
--color: var(--leu-color-black-transp-60);
|
|
16
|
-
--
|
|
17
|
-
--font-
|
|
18
|
+
--color-disabled: var(--leu-color-black-transp-20);
|
|
19
|
+
--font-regular: var(--leu-font-family-regular);
|
|
20
|
+
--font-black: var(--leu-font-family-black);
|
|
18
21
|
|
|
19
|
-
font-family: var(--
|
|
22
|
+
font-family: var(--leu-font-family-regular);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
.button {
|
|
26
|
+
-webkit-text-decoration: none;
|
|
27
|
+
text-decoration: none;
|
|
23
28
|
-webkit-appearance: none;
|
|
24
29
|
-moz-appearance: none;
|
|
25
30
|
appearance: none;
|
|
@@ -57,6 +62,7 @@ var css_248z = css`:host,
|
|
|
57
62
|
|
|
58
63
|
:host([disabled]) .button {
|
|
59
64
|
--background: var(--background-disabled);
|
|
65
|
+
--color: var(--color-disabled);
|
|
60
66
|
cursor: default;
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -87,8 +93,6 @@ class LeuMenuItem extends LitElement {
|
|
|
87
93
|
super();
|
|
88
94
|
this.active = false;
|
|
89
95
|
this.disabled = false;
|
|
90
|
-
this.before = "";
|
|
91
|
-
this.after = "";
|
|
92
96
|
|
|
93
97
|
/**
|
|
94
98
|
* A programmatic way to highlight the menu item like it is hovered.
|
|
@@ -106,24 +110,30 @@ class LeuMenuItem extends LitElement {
|
|
|
106
110
|
return name;
|
|
107
111
|
}
|
|
108
112
|
renderBefore() {
|
|
109
|
-
if (this.before
|
|
113
|
+
if (this.before) {
|
|
110
114
|
const content = LeuMenuItem.getIconOrText(this.before);
|
|
111
115
|
return html`<span class="before">${content}</span>`;
|
|
112
116
|
}
|
|
113
117
|
return nothing;
|
|
114
118
|
}
|
|
115
119
|
renderAfter() {
|
|
116
|
-
if (this.after
|
|
120
|
+
if (this.after) {
|
|
117
121
|
const content = LeuMenuItem.getIconOrText(this.after);
|
|
118
122
|
return html`<span class="after">${content}</span>`;
|
|
119
123
|
}
|
|
120
124
|
return nothing;
|
|
121
125
|
}
|
|
126
|
+
getTagName() {
|
|
127
|
+
return this.href ? "a" : "button";
|
|
128
|
+
}
|
|
122
129
|
render() {
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
/* The eslint rules don't recognize html import from lit/static-html.js */
|
|
131
|
+
/* eslint-disable lit/binding-positions, lit/no-invalid-html */
|
|
132
|
+
return html`<${unsafeStatic(this.getTagName())} class="button" href=${ifDefined(this.href)} ?disabled=${this.disabled}>
|
|
133
|
+
${this.renderBefore()}<span class="label">${this.label}</span
|
|
125
134
|
>${this.renderAfter()}
|
|
126
|
-
|
|
135
|
+
</${unsafeStatic(this.getTagName())}>`;
|
|
136
|
+
/* eslint-enable lit/binding-positions, lit/no-invalid-html */
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
_defineProperty(LeuMenuItem, "styles", css_248z);
|
|
@@ -164,10 +174,15 @@ _defineProperty(LeuMenuItem, "properties", {
|
|
|
164
174
|
disabled: {
|
|
165
175
|
type: Boolean,
|
|
166
176
|
reflect: true
|
|
177
|
+
},
|
|
178
|
+
label: {
|
|
179
|
+
type: String,
|
|
180
|
+
reflect: true
|
|
181
|
+
},
|
|
182
|
+
href: {
|
|
183
|
+
type: String,
|
|
184
|
+
reflect: true
|
|
167
185
|
}
|
|
168
186
|
});
|
|
169
|
-
function defineMenuItemElements() {
|
|
170
|
-
defineElement("menu-item", LeuMenuItem);
|
|
171
|
-
}
|
|
172
187
|
|
|
173
|
-
export { LeuMenuItem
|
|
188
|
+
export { LeuMenuItem };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tagname leu-pagination
|
|
3
|
+
*/
|
|
4
|
+
export class LeuPagination extends LitElement {
|
|
5
|
+
/** @type {Number} */
|
|
6
|
+
numOfItems: number;
|
|
7
|
+
/** @type {Number} */
|
|
8
|
+
itemsPerPage: number;
|
|
9
|
+
/** @type {Number} */
|
|
10
|
+
_page: number;
|
|
11
|
+
attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
|
|
12
|
+
set page(page: number);
|
|
13
|
+
get page(): number;
|
|
14
|
+
get startIndex(): number;
|
|
15
|
+
get endIndex(): number;
|
|
16
|
+
get _maxPage(): number;
|
|
17
|
+
_isFirstPage(): boolean;
|
|
18
|
+
_isLastPage(): boolean;
|
|
19
|
+
_clampPage(page: any): number;
|
|
20
|
+
_updatePage(page: any): void;
|
|
21
|
+
_handleChange(event: any): void;
|
|
22
|
+
_handleInput(event: any): void;
|
|
23
|
+
_handleKeyDown(event: any): void;
|
|
24
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
}
|
|
26
|
+
import { LitElement } from 'lit';
|
|
27
|
+
//# sourceMappingURL=Pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["Pagination.js"],"names":[],"mappings":"AA2EA;;GAEG;AACH;IAII,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;IACrB,cAAc;IAEhB,oEAKC;IAID,uBAEC;IALD,mBAEC;IAID,yBAEC;IACD,uBAEC;IACD,uBAEC;IACD,wBAEC;IACD,uBAEC;IACD,8BAEC;IACD,6BAaC;IACD,gCAEC;IACD,+BAKC;IACD,iCASC;IACD,+CAsCC;CACF;2BA9LqC,KAAK"}
|
package/dist/Pagination.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html } from 'lit';
|
|
3
|
-
import {
|
|
3
|
+
import { live } from 'lit/directives/live.js';
|
|
4
|
+
import './leu-button.js';
|
|
5
|
+
import './leu-visually-hidden.js';
|
|
6
|
+
import './defineElement-40372b4b.js';
|
|
7
|
+
import './Button-da11d064.js';
|
|
4
8
|
import 'lit/directives/class-map.js';
|
|
9
|
+
import 'lit/directives/if-defined.js';
|
|
5
10
|
import './icon-03e86700.js';
|
|
11
|
+
import './VisuallyHidden.js';
|
|
6
12
|
|
|
7
13
|
var css_248z = css`:host {
|
|
8
14
|
margin-top: 16px;
|
|
9
15
|
display: flex;
|
|
10
16
|
justify-content: end;
|
|
11
|
-
font-family: var(--leu-font-regular);
|
|
17
|
+
font-family: var(--leu-font-family-regular);
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
.input {
|
|
@@ -58,6 +64,11 @@ var css_248z = css`:host {
|
|
|
58
64
|
color: var(--leu-color-black-transp-60);
|
|
59
65
|
white-space: nowrap;
|
|
60
66
|
}
|
|
67
|
+
|
|
68
|
+
.button-group {
|
|
69
|
+
display: flex;
|
|
70
|
+
gap: 0.25rem;
|
|
71
|
+
}
|
|
61
72
|
`;
|
|
62
73
|
|
|
63
74
|
const MIN_PAGE = 1;
|
|
@@ -68,128 +79,149 @@ const MIN_PAGE = 1;
|
|
|
68
79
|
class LeuPagination extends LitElement {
|
|
69
80
|
constructor() {
|
|
70
81
|
super();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
|
|
83
|
+
/** @type {Number} */
|
|
84
|
+
this.numOfItems = 1;
|
|
85
|
+
/** @type {Number} */
|
|
86
|
+
this.itemsPerPage = 1;
|
|
87
|
+
/** @type {Number} */
|
|
88
|
+
this._page = 1;
|
|
89
|
+
}
|
|
90
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
91
|
+
super.attributeChangedCallback(name, oldVal, newVal);
|
|
92
|
+
if (name === "defaultpage" && newVal !== oldVal) {
|
|
93
|
+
this.page = parseInt(newVal, 10);
|
|
94
|
+
}
|
|
77
95
|
}
|
|
78
|
-
get
|
|
79
|
-
return
|
|
96
|
+
get page() {
|
|
97
|
+
return this._page;
|
|
80
98
|
}
|
|
81
|
-
|
|
99
|
+
set page(page) {
|
|
100
|
+
this._page = this._clampPage(page);
|
|
101
|
+
}
|
|
102
|
+
get startIndex() {
|
|
103
|
+
return (this.page - 1) * this.itemsPerPage;
|
|
104
|
+
}
|
|
105
|
+
get endIndex() {
|
|
106
|
+
return Math.min(this.startIndex + this.itemsPerPage, this.numOfItems);
|
|
107
|
+
}
|
|
108
|
+
get _maxPage() {
|
|
109
|
+
return Math.ceil(this.numOfItems / this.itemsPerPage);
|
|
110
|
+
}
|
|
111
|
+
_isFirstPage() {
|
|
82
112
|
return this.page === MIN_PAGE;
|
|
83
113
|
}
|
|
84
|
-
|
|
85
|
-
return this.page === this.
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return Math.min(Math.max(
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
_isLastPage() {
|
|
115
|
+
return this.page === this._maxPage;
|
|
116
|
+
}
|
|
117
|
+
_clampPage(page) {
|
|
118
|
+
return Math.min(Math.max(page, MIN_PAGE), this._maxPage);
|
|
119
|
+
}
|
|
120
|
+
_updatePage(page) {
|
|
121
|
+
const prevPage = this.page;
|
|
122
|
+
this.page = this._clampPage(page);
|
|
123
|
+
if (this.page !== prevPage) {
|
|
124
|
+
this.dispatchEvent(new CustomEvent("leu:pagechange", {
|
|
125
|
+
detail: {
|
|
126
|
+
startIndex: this.startIndex,
|
|
127
|
+
endIndex: this.endIndex,
|
|
128
|
+
page: this.page
|
|
129
|
+
},
|
|
130
|
+
bubbles: false
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
_handleChange(event) {
|
|
135
|
+
this._updatePage(parseInt(event.target.value, 10) || 0);
|
|
136
|
+
}
|
|
137
|
+
_handleInput(event) {
|
|
107
138
|
if (event.target.value !== "") {
|
|
108
139
|
event.preventDefault();
|
|
109
|
-
this.
|
|
140
|
+
this._handleChange(event);
|
|
110
141
|
}
|
|
111
142
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const numberKeys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
115
|
-
if (!numberKeys.includes(event.key) && !specialKeys.includes(event.key)) {
|
|
143
|
+
_handleKeyDown(event) {
|
|
144
|
+
if (event.key === "ArrowUp") {
|
|
116
145
|
event.preventDefault();
|
|
117
|
-
|
|
118
|
-
if (event.key === "ArrowUp") {
|
|
119
|
-
event.preventDefault();
|
|
120
|
-
this.numberUpdate(this.page + 1);
|
|
121
|
-
}
|
|
122
|
-
if (event.key === "ArrowDown") {
|
|
123
|
-
event.preventDefault();
|
|
124
|
-
this.numberUpdate(this.page - 1);
|
|
125
|
-
}
|
|
146
|
+
this._updatePage(this.page + 1);
|
|
126
147
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
requestUpdate(name, oldValue, newValue) {
|
|
132
|
-
if (name === "itemsOnAPage") {
|
|
133
|
-
this.numberUpdate(this.page);
|
|
148
|
+
if (event.key === "ArrowDown") {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
this._updatePage(this.page - 1);
|
|
134
151
|
}
|
|
135
|
-
return super.requestUpdate(name, oldValue, newValue);
|
|
136
152
|
}
|
|
137
153
|
render() {
|
|
138
154
|
return html`
|
|
155
|
+
<leu-visually-hidden>
|
|
156
|
+
<label for="page-input">Aktuelle Seite</label>
|
|
157
|
+
</leu-visually-hidden>
|
|
139
158
|
<input
|
|
159
|
+
id="page-input"
|
|
140
160
|
class="input"
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
@
|
|
161
|
+
min=${MIN_PAGE}
|
|
162
|
+
max=${this._maxPage}
|
|
163
|
+
.value=${live(this.page.toString())}
|
|
164
|
+
@input=${this._handleInput}
|
|
165
|
+
@change=${this._handleChange}
|
|
166
|
+
@keydown=${this._handleKeyDown}
|
|
145
167
|
type="number"
|
|
146
168
|
/>
|
|
147
|
-
<div class="label">von ${this.
|
|
148
|
-
<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
169
|
+
<div class="label">von ${this._maxPage}</div>
|
|
170
|
+
<div class="button-group">
|
|
171
|
+
<leu-button
|
|
172
|
+
icon="angleLeft"
|
|
173
|
+
variant="secondary"
|
|
174
|
+
label="Vorherige Seite"
|
|
175
|
+
@click=${_ => {
|
|
176
|
+
this._updatePage(this.page - 1);
|
|
153
177
|
}}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
178
|
+
?disabled=${this._isFirstPage()}
|
|
179
|
+
></leu-button>
|
|
180
|
+
<leu-button
|
|
181
|
+
icon="angleRight"
|
|
182
|
+
variant="secondary"
|
|
183
|
+
label="Nächste Seite"
|
|
184
|
+
@click=${_ => {
|
|
185
|
+
this._updatePage(this.page + 1);
|
|
161
186
|
}}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
187
|
+
?disabled=${this._isLastPage()}
|
|
188
|
+
></leu-button>
|
|
189
|
+
</div>
|
|
165
190
|
`;
|
|
166
191
|
}
|
|
167
192
|
}
|
|
168
193
|
_defineProperty(LeuPagination, "styles", css_248z);
|
|
169
|
-
|
|
170
|
-
|
|
194
|
+
/**
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
_defineProperty(LeuPagination, "shadowRootOptions", {
|
|
198
|
+
...LitElement.shadowRootOptions,
|
|
199
|
+
delegatesFocus: true
|
|
171
200
|
});
|
|
172
201
|
_defineProperty(LeuPagination, "properties", {
|
|
173
|
-
|
|
202
|
+
defaultPage: {
|
|
174
203
|
type: Number,
|
|
175
204
|
reflect: true
|
|
176
205
|
},
|
|
177
|
-
|
|
206
|
+
itemsPerPage: {
|
|
178
207
|
type: Number,
|
|
179
208
|
reflect: true
|
|
180
209
|
},
|
|
181
|
-
|
|
210
|
+
numOfItems: {
|
|
182
211
|
type: Number,
|
|
183
212
|
reflect: true
|
|
184
213
|
},
|
|
185
|
-
|
|
186
|
-
|
|
214
|
+
/**
|
|
215
|
+
* Internal page state that contains an
|
|
216
|
+
* already clamped page number. Should only
|
|
217
|
+
* be accessed through the `page` getter and
|
|
218
|
+
* setter.
|
|
219
|
+
* @type {Number}
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
_page: {
|
|
187
223
|
state: true
|
|
188
224
|
}
|
|
189
225
|
});
|
|
190
|
-
function definePaginationElements() {
|
|
191
|
-
defineButtonElements();
|
|
192
|
-
defineElement("pagination", LeuPagination);
|
|
193
|
-
}
|
|
194
226
|
|
|
195
|
-
export { LeuPagination
|
|
227
|
+
export { LeuPagination };
|
package/dist/Popup.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tagname leu-popup
|
|
3
|
+
*/
|
|
4
|
+
export class LeuPopup extends LitElement {
|
|
5
|
+
anchorEl: any;
|
|
6
|
+
cleanup: () => void;
|
|
7
|
+
flip: boolean;
|
|
8
|
+
shift: boolean;
|
|
9
|
+
updated(changedProperties: any): void;
|
|
10
|
+
get popupEl(): Element;
|
|
11
|
+
start(): void;
|
|
12
|
+
stop(): void;
|
|
13
|
+
reposition(): void;
|
|
14
|
+
handleAnchorChange(): void;
|
|
15
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
}
|
|
17
|
+
import { LitElement } from 'lit';
|
|
18
|
+
//# sourceMappingURL=Popup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["Popup.js"],"names":[],"mappings":"AAuCA;;GAEG;AACH;IAGI,cAAoB;IACpB,oBAAwB;IACxB,cAAiB;IACjB,eAAkB;IAMpB,sCAcC;IACD,uBAEC;IACD,cAKC;IACD,aAIC;IACD,mBAiEC;IACD,2BAiBC;IACD,+CAOC;CACF;2BA9KqC,KAAK"}
|
package/dist/Popup.js
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
|
+
import { css, LitElement, html } from 'lit';
|
|
3
|
+
import { autoUpdate, size, flip, shift, computePosition } from '@floating-ui/dom';
|
|
4
|
+
|
|
5
|
+
var css_248z = css`:host,
|
|
6
|
+
:host * {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
--popup-font-regular: var(--leu-font-family-regular);
|
|
12
|
+
--popup-font-black: var(--leu-font-family-black);
|
|
13
|
+
|
|
14
|
+
font-family: var(--leu-font-family-regular);
|
|
15
|
+
|
|
16
|
+
font-family: var(--popup-font-regular);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.popup {
|
|
20
|
+
display: none;
|
|
21
|
+
|
|
22
|
+
max-width: none;
|
|
23
|
+
|
|
24
|
+
max-width: var(--auto-size-available-width, none);
|
|
25
|
+
max-height: none;
|
|
26
|
+
max-height: var(--auto-size-available-height, none);
|
|
27
|
+
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 0;
|
|
30
|
+
left: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* TODO: Should visibility be a matter of the popup component? */
|
|
34
|
+
|
|
35
|
+
:host([active]) .popup {
|
|
36
|
+
display: block;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @tagname leu-popup
|
|
42
|
+
*/
|
|
43
|
+
class LeuPopup extends LitElement {
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
this.anchorEl = null;
|
|
47
|
+
this.cleanup = undefined;
|
|
48
|
+
this.flip = false;
|
|
49
|
+
this.shift = false;
|
|
50
|
+
}
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
super.disconnectedCallback();
|
|
53
|
+
this.stop();
|
|
54
|
+
}
|
|
55
|
+
updated(changedProperties) {
|
|
56
|
+
if (changedProperties.has("active")) {
|
|
57
|
+
if (this.active) {
|
|
58
|
+
this.start();
|
|
59
|
+
} else {
|
|
60
|
+
this.stop();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (changedProperties.has("anchor")) {
|
|
64
|
+
this.handleAnchorChange();
|
|
65
|
+
}
|
|
66
|
+
if (this.active) {
|
|
67
|
+
this.reposition();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
get popupEl() {
|
|
71
|
+
return this.renderRoot?.querySelector(".popup") ?? null;
|
|
72
|
+
}
|
|
73
|
+
start() {
|
|
74
|
+
if (!this.anchorEl || !this.active) return;
|
|
75
|
+
this.cleanup = autoUpdate(this.anchorEl, this.popupEl, () => {
|
|
76
|
+
this.reposition();
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
stop() {
|
|
80
|
+
this.cleanup?.();
|
|
81
|
+
this.style.removeProperty("--auto-size-available-width");
|
|
82
|
+
this.style.removeProperty("--auto-size-available-height");
|
|
83
|
+
}
|
|
84
|
+
reposition() {
|
|
85
|
+
if (!this.anchorEl || !this.popupEl || !this.active) return;
|
|
86
|
+
const middleware = [];
|
|
87
|
+
if (this.matchSize) {
|
|
88
|
+
middleware.push(size({
|
|
89
|
+
apply: ({
|
|
90
|
+
rects
|
|
91
|
+
}) => {
|
|
92
|
+
const matchWidth = this.matchSize === "width" || this.matchSize === "both";
|
|
93
|
+
const matchHeight = this.matchSize === "height" || this.matchSize === "both";
|
|
94
|
+
this.popupEl.style.width = matchWidth ? `${rects.reference.width}px` : "";
|
|
95
|
+
this.popupEl.style.height = matchHeight ? `${rects.reference.height}px` : "";
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
} else {
|
|
99
|
+
// Cleanup styles if we're not matching width/height
|
|
100
|
+
this.popupEl.style.width = "";
|
|
101
|
+
this.popupEl.style.height = "";
|
|
102
|
+
}
|
|
103
|
+
if (this.flip) {
|
|
104
|
+
middleware.push(flip());
|
|
105
|
+
}
|
|
106
|
+
if (this.shift) {
|
|
107
|
+
middleware.push(shift({
|
|
108
|
+
padding: this.shiftPadding
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
if (this.autoSize) {
|
|
112
|
+
middleware.push(size({
|
|
113
|
+
padding: this.autoSizePadding,
|
|
114
|
+
apply: ({
|
|
115
|
+
availableWidth,
|
|
116
|
+
availableHeight
|
|
117
|
+
}) => {
|
|
118
|
+
const setMaxWidth = this.autoSize === "width" || this.autoSize === "both";
|
|
119
|
+
const setMaxHeight = this.autoSize === "height" || this.autoSize === "both";
|
|
120
|
+
if (setMaxHeight) {
|
|
121
|
+
this.style.setProperty("--auto-size-available-height", `${availableHeight}px`);
|
|
122
|
+
} else {
|
|
123
|
+
this.style.removeProperty("--auto-size-available-height");
|
|
124
|
+
}
|
|
125
|
+
if (setMaxWidth) {
|
|
126
|
+
this.style.setProperty("--auto-size-available-width", `${availableWidth}px`);
|
|
127
|
+
} else {
|
|
128
|
+
this.style.removeProperty("--auto-size-available-width");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
} else {
|
|
133
|
+
// Cleanup styles if we're not auto-sizing
|
|
134
|
+
this.style.removeProperty("--auto-size-available-width");
|
|
135
|
+
this.style.removeProperty("--auto-size-available-height");
|
|
136
|
+
}
|
|
137
|
+
computePosition(this.anchorEl, this.popupEl, {
|
|
138
|
+
placement: this.placement,
|
|
139
|
+
middleware
|
|
140
|
+
}).then(({
|
|
141
|
+
x,
|
|
142
|
+
y
|
|
143
|
+
}) => {
|
|
144
|
+
Object.assign(this.popupEl.style, {
|
|
145
|
+
left: `${x}px`,
|
|
146
|
+
top: `${y}px`
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
handleAnchorChange() {
|
|
151
|
+
if (this.anchor && typeof this.anchor === "string") {
|
|
152
|
+
const root = this.getRootNode();
|
|
153
|
+
this.anchorEl = root.getElementById(this.anchor);
|
|
154
|
+
} else if (this.anchor instanceof HTMLElement) {
|
|
155
|
+
this.anchorEl = this.anchor;
|
|
156
|
+
} else {
|
|
157
|
+
this.anchorEl = this.querySelector("[slot=anchor]");
|
|
158
|
+
}
|
|
159
|
+
if (this.anchorEl instanceof HTMLSlotElement) {
|
|
160
|
+
[this.anchorEl] = this.anchorEl.assignedElements({
|
|
161
|
+
flatten: true
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (this.anchorEl) {
|
|
165
|
+
this.start();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
render() {
|
|
169
|
+
return html`
|
|
170
|
+
<slot name="anchor" @slotchange=${this.handleAnchorChange}></slot>
|
|
171
|
+
<div class="popup">
|
|
172
|
+
<slot> </slot>
|
|
173
|
+
</div>
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
_defineProperty(LeuPopup, "styles", css_248z);
|
|
178
|
+
_defineProperty(LeuPopup, "shadowRootOptions", {
|
|
179
|
+
...LitElement.shadowRootOptions,
|
|
180
|
+
delegatesFocus: true
|
|
181
|
+
});
|
|
182
|
+
_defineProperty(LeuPopup, "properties", {
|
|
183
|
+
anchor: {},
|
|
184
|
+
active: {
|
|
185
|
+
type: Boolean
|
|
186
|
+
},
|
|
187
|
+
/**
|
|
188
|
+
* @type {"top"|"top-start"|"top-end"|"bottom"|"bottom-start"|"bottom-end"|"left"|"left-start"|"left-end"|"right"|"right-start"|"right-end"}
|
|
189
|
+
*/
|
|
190
|
+
placement: {
|
|
191
|
+
type: String
|
|
192
|
+
},
|
|
193
|
+
flip: {
|
|
194
|
+
type: Boolean
|
|
195
|
+
},
|
|
196
|
+
shift: {
|
|
197
|
+
type: Boolean
|
|
198
|
+
},
|
|
199
|
+
shiftPadding: {
|
|
200
|
+
type: Number
|
|
201
|
+
},
|
|
202
|
+
/** @type {"width" | "height" | "both"} */
|
|
203
|
+
matchSize: {
|
|
204
|
+
type: String
|
|
205
|
+
},
|
|
206
|
+
/** @type {"width" | "height" | "both"} */
|
|
207
|
+
autoSize: {
|
|
208
|
+
type: String
|
|
209
|
+
},
|
|
210
|
+
autoSizePadding: {
|
|
211
|
+
type: Number
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
export { LeuPopup };
|
package/dist/Radio.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tagname leu-radio
|
|
3
|
+
*/
|
|
4
|
+
export class LeuRadio extends LitElement {
|
|
5
|
+
checked: boolean;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
handleChange(event: any): void;
|
|
8
|
+
handleInput(event: any): void;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
}
|
|
11
|
+
import { LitElement } from 'lit';
|
|
12
|
+
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["Radio.js"],"names":[],"mappings":"AAgGA;;GAEG;AACH;IAGI,iBAAoB;IACpB,kBAAqB;IAEvB,+BAIC;IACD,8BAEC;IACD,+CAeC;CACF;2BAhIqC,KAAK"}
|