@statistikzh/leu 0.8.0 → 0.10.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/release-please.yml +3 -3
- package/CHANGELOG.md +34 -0
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +1 -1
- package/dist/Breadcrumb.d.ts +1 -1
- package/dist/Breadcrumb.js +1 -1
- package/dist/Button.d.ts +45 -1
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +473 -6
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.js +2 -2
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.js +1 -1
- package/dist/Chip.d.ts +1 -1
- package/dist/Chip.js +1 -1
- package/dist/ChipGroup.d.ts +1 -1
- package/dist/ChipGroup.js +2 -2
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.d.ts +17 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Dialog.js +255 -0
- package/dist/Dropdown.d.ts +1 -1
- package/dist/Dropdown.d.ts.map +1 -1
- package/dist/Dropdown.js +4 -3
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.d.ts +1 -1
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +3 -1
- package/dist/{LeuElement-a20c5fd6.d.ts → LeuElement-6fbc0dee.d.ts} +1 -1
- package/dist/LeuElement-6fbc0dee.d.ts.map +1 -0
- package/dist/{LeuElement-a20c5fd6.js → LeuElement-6fbc0dee.js} +1 -1
- package/dist/Menu.d.ts +1 -1
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.d.ts +5 -1
- package/dist/MenuItem.d.ts.map +1 -1
- package/dist/MenuItem.js +18 -3
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.d.ts.map +1 -1
- package/dist/Pagination.js +3 -2
- package/dist/Popup.d.ts +1 -1
- package/dist/Popup.js +1 -1
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.js +2 -2
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +1 -1
- package/dist/ScrollTop.d.ts +1 -1
- package/dist/ScrollTop.d.ts.map +1 -1
- package/dist/ScrollTop.js +3 -2
- package/dist/Select.d.ts +1 -1
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +10 -5
- package/dist/Spinner.d.ts +9 -0
- package/dist/Spinner.d.ts.map +1 -0
- package/dist/Spinner.js +53 -0
- package/dist/Table.d.ts +1 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +3 -2
- package/dist/VisuallyHidden.d.ts +1 -1
- package/dist/VisuallyHidden.js +1 -1
- package/dist/hasSlotController-04d0dfa2.d.ts +38 -0
- package/dist/hasSlotController-04d0dfa2.d.ts.map +1 -0
- package/dist/hasSlotController-04d0dfa2.js +75 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-breadcrumb.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.d.ts.map +1 -1
- package/dist/leu-button.js +3 -2
- package/dist/leu-checkbox-group.js +1 -1
- package/dist/leu-checkbox.js +1 -1
- package/dist/leu-chip-group.js +1 -1
- package/dist/leu-chip-link.js +1 -1
- package/dist/leu-chip-removable.js +1 -1
- package/dist/leu-chip-selectable.js +1 -1
- package/dist/leu-dialog.d.ts +3 -0
- package/dist/leu-dialog.d.ts.map +1 -0
- package/dist/leu-dialog.js +11 -0
- package/dist/leu-dropdown.js +3 -2
- package/dist/leu-icon.js +1 -1
- package/dist/leu-input.js +1 -1
- package/dist/leu-menu-item.js +1 -1
- package/dist/leu-menu.js +1 -1
- package/dist/leu-pagination.js +3 -2
- package/dist/leu-popup.js +1 -1
- package/dist/leu-radio-group.js +1 -1
- package/dist/leu-radio.js +1 -1
- package/dist/leu-scroll-top.js +3 -2
- package/dist/leu-select.js +3 -2
- package/dist/leu-spinner.d.ts +3 -0
- package/dist/leu-spinner.d.ts.map +1 -0
- package/dist/leu-spinner.js +7 -0
- package/dist/leu-table.js +3 -2
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/theme.css +370 -217
- package/dist/vscode.html-custom-data.json +31 -0
- package/dist/vue/index.d.ts +34 -0
- package/dist/web-types.json +47 -1
- package/package.json +1 -1
- package/rollup.config.js +4 -1
- package/scripts/generate-component/templates/[namespace]-[name].js +1 -2
- package/scripts/postcss-leu-font-styles.cjs +29 -35
- package/src/components/button/button.css +2 -3
- package/src/components/checkbox/Checkbox.js +1 -1
- package/src/components/checkbox/stories/checkbox.stories.js +7 -2
- package/src/components/chip/chip-group.css +1 -1
- package/src/components/dialog/Dialog.js +100 -0
- package/src/components/dialog/dialog.css +162 -0
- package/src/components/dialog/leu-dialog.js +5 -0
- package/src/components/dialog/stories/dialog.stories.js +144 -0
- package/src/components/dialog/test/dialog.test.js +85 -0
- package/src/components/dropdown/Dropdown.js +1 -1
- package/src/components/dropdown/test/dropdown.test.js +20 -3
- package/src/components/input/input.css +2 -0
- package/src/components/menu/MenuItem.js +21 -2
- package/src/components/menu/stories/menu-item.stories.js +18 -8
- package/src/components/menu/test/menu-item.test.js +23 -0
- package/src/components/radio/Radio.js +1 -1
- package/src/components/radio/stories/radio.stories.js +7 -1
- package/src/components/select/Select.js +8 -6
- package/src/components/select/test/select.test.js +30 -0
- package/src/components/spinner/Spinner.js +31 -0
- package/src/components/spinner/leu-spinner.js +5 -0
- package/src/components/spinner/spinner.css +20 -0
- package/src/components/spinner/stories/spinner.stories.js +29 -0
- package/src/components/spinner/test/spinner.test.js +30 -0
- package/src/styles/custom-properties.css +35 -3
- package/src/styles/font-definitions.json +27 -19
- package/src/styles/style.stories.js +61 -0
- package/dist/Button-3adfb3ed.d.ts +0 -83
- package/dist/Button-3adfb3ed.d.ts.map +0 -1
- package/dist/Button-3adfb3ed.js +0 -545
- package/dist/LeuElement-a20c5fd6.d.ts.map +0 -1
|
@@ -250,6 +250,21 @@
|
|
|
250
250
|
}
|
|
251
251
|
]
|
|
252
252
|
},
|
|
253
|
+
{
|
|
254
|
+
"name": "leu-dialog",
|
|
255
|
+
"description": "\n---\n",
|
|
256
|
+
"attributes": [
|
|
257
|
+
{ "name": "label", "values": [] },
|
|
258
|
+
{ "name": "sublabel", "values": [] },
|
|
259
|
+
{ "name": "open", "values": [] }
|
|
260
|
+
],
|
|
261
|
+
"references": [
|
|
262
|
+
{
|
|
263
|
+
"name": "Documentation",
|
|
264
|
+
"url": "https://statistikzh.github.io/leu/?path=/story/dialog"
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
},
|
|
253
268
|
{
|
|
254
269
|
"name": "leu-dropdown",
|
|
255
270
|
"description": "\n---\n",
|
|
@@ -420,6 +435,11 @@
|
|
|
420
435
|
"description": "Defines if the item is selected or checked",
|
|
421
436
|
"values": []
|
|
422
437
|
},
|
|
438
|
+
{
|
|
439
|
+
"name": "multipleSelection",
|
|
440
|
+
"description": "If the item is part of a multiple selection. Renders a checkmark before the label when active",
|
|
441
|
+
"values": []
|
|
442
|
+
},
|
|
423
443
|
{
|
|
424
444
|
"name": "disabled",
|
|
425
445
|
"description": "Disables the underlying button or link",
|
|
@@ -603,6 +623,17 @@
|
|
|
603
623
|
}
|
|
604
624
|
]
|
|
605
625
|
},
|
|
626
|
+
{
|
|
627
|
+
"name": "leu-spinner",
|
|
628
|
+
"description": "\n---\n\n\n### **CSS Properties:**\n - **--leu-spinner-size** - The size of the spinner. _(default: undefined)_",
|
|
629
|
+
"attributes": [],
|
|
630
|
+
"references": [
|
|
631
|
+
{
|
|
632
|
+
"name": "Documentation",
|
|
633
|
+
"url": "https://statistikzh.github.io/leu/?path=/story/spinner"
|
|
634
|
+
}
|
|
635
|
+
]
|
|
636
|
+
},
|
|
606
637
|
{
|
|
607
638
|
"name": "leu-table",
|
|
608
639
|
"description": "\n---\n",
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { LeuChipGroup } from "../ChipGroup.js";
|
|
|
10
10
|
import type { LeuChipLink } from "../ChipLink.js";
|
|
11
11
|
import type { LeuChipRemovable } from "../ChipRemovable.js";
|
|
12
12
|
import type { LeuChipSelectable, CustomEvent } from "../ChipSelectable.js";
|
|
13
|
+
import type { LeuDialog } from "../Dialog.js";
|
|
13
14
|
import type { LeuDropdown } from "../Dropdown.js";
|
|
14
15
|
import type { LeuIcon } from "../Icon.js";
|
|
15
16
|
import type { LeuInput, CustomEvent } from "../Input.js";
|
|
@@ -21,6 +22,7 @@ import type { LeuRadio } from "../Radio.js";
|
|
|
21
22
|
import type { LeuRadioGroup } from "../RadioGroup.js";
|
|
22
23
|
import type { LeuScrollTop } from "../ScrollTop.js";
|
|
23
24
|
import type { LeuSelect } from "../Select.js";
|
|
25
|
+
import type { LeuSpinner } from "../Spinner.js";
|
|
24
26
|
import type { LeuTable } from "../Table.js";
|
|
25
27
|
import type { LeuVisuallyHidden } from "../VisuallyHidden.js";
|
|
26
28
|
|
|
@@ -171,6 +173,17 @@ type LeuChipSelectableProps = {
|
|
|
171
173
|
onInput?: (e: CustomEvent<CustomEvent>) => void;
|
|
172
174
|
};
|
|
173
175
|
|
|
176
|
+
type LeuDialogProps = {
|
|
177
|
+
/** */
|
|
178
|
+
label?: LeuDialog["label"];
|
|
179
|
+
/** */
|
|
180
|
+
sublabel?: LeuDialog["sublabel"];
|
|
181
|
+
/** */
|
|
182
|
+
open?: LeuDialog["open"];
|
|
183
|
+
/** */
|
|
184
|
+
_dialogRef?: LeuDialog["_dialogRef"];
|
|
185
|
+
};
|
|
186
|
+
|
|
174
187
|
type LeuDropdownProps = {
|
|
175
188
|
/** */
|
|
176
189
|
label?: LeuDropdown["label"];
|
|
@@ -255,6 +268,8 @@ type LeuMenuProps = {
|
|
|
255
268
|
type LeuMenuItemProps = {
|
|
256
269
|
/** Defines if the item is selected or checked */
|
|
257
270
|
active?: LeuMenuItem["active"];
|
|
271
|
+
/** If the item is part of a multiple selection. Renders a checkmark before the label when active */
|
|
272
|
+
multipleSelection?: LeuMenuItem["multipleSelection"];
|
|
258
273
|
/** Disables the underlying button or link */
|
|
259
274
|
disabled?: LeuMenuItem["disabled"];
|
|
260
275
|
/** If the item should be focusable. Will be reflected as `tabindex` to the underlying button or link */
|
|
@@ -383,6 +398,8 @@ type LeuSelectProps = {
|
|
|
383
398
|
_menuRef?: LeuSelect["_menuRef"];
|
|
384
399
|
};
|
|
385
400
|
|
|
401
|
+
type LeuSpinnerProps = {};
|
|
402
|
+
|
|
386
403
|
type LeuTableProps = {
|
|
387
404
|
/** */
|
|
388
405
|
columns?: LeuTable["columns"];
|
|
@@ -556,6 +573,13 @@ export type CustomElements = {
|
|
|
556
573
|
*/
|
|
557
574
|
"leu-chip-selectable": DefineComponent<LeuChipSelectableProps>;
|
|
558
575
|
|
|
576
|
+
/**
|
|
577
|
+
*
|
|
578
|
+
* ---
|
|
579
|
+
*
|
|
580
|
+
*/
|
|
581
|
+
"leu-dialog": DefineComponent<LeuDialogProps>;
|
|
582
|
+
|
|
559
583
|
/**
|
|
560
584
|
*
|
|
561
585
|
* ---
|
|
@@ -674,6 +698,16 @@ export type CustomElements = {
|
|
|
674
698
|
*/
|
|
675
699
|
"leu-select": DefineComponent<LeuSelectProps>;
|
|
676
700
|
|
|
701
|
+
/**
|
|
702
|
+
*
|
|
703
|
+
* ---
|
|
704
|
+
*
|
|
705
|
+
*
|
|
706
|
+
* ### **CSS Properties:**
|
|
707
|
+
* - **--leu-spinner-size** - The size of the spinner. _(default: undefined)_
|
|
708
|
+
*/
|
|
709
|
+
"leu-spinner": DefineComponent<LeuSpinnerProps>;
|
|
710
|
+
|
|
677
711
|
/**
|
|
678
712
|
*
|
|
679
713
|
* ---
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@statistikzh/leu",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -488,6 +488,34 @@
|
|
|
488
488
|
"events": [{ "name": "input" }]
|
|
489
489
|
}
|
|
490
490
|
},
|
|
491
|
+
{
|
|
492
|
+
"name": "leu-dialog",
|
|
493
|
+
"description": "\n---\n",
|
|
494
|
+
"doc-url": "",
|
|
495
|
+
"attributes": [
|
|
496
|
+
{
|
|
497
|
+
"name": "label",
|
|
498
|
+
"value": { "type": "string", "default": "\"\"" }
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"name": "sublabel",
|
|
502
|
+
"value": { "type": "string", "default": "\"\"" }
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"name": "open",
|
|
506
|
+
"value": { "type": "boolean", "default": "false" }
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"events": [],
|
|
510
|
+
"js": {
|
|
511
|
+
"properties": [
|
|
512
|
+
{ "name": "label", "value": { "type": "string" } },
|
|
513
|
+
{ "name": "sublabel", "value": { "type": "string" } },
|
|
514
|
+
{ "name": "open", "value": { "type": "boolean" } }
|
|
515
|
+
],
|
|
516
|
+
"events": []
|
|
517
|
+
}
|
|
518
|
+
},
|
|
491
519
|
{
|
|
492
520
|
"name": "leu-dropdown",
|
|
493
521
|
"description": "\n---\n",
|
|
@@ -803,6 +831,11 @@
|
|
|
803
831
|
"description": "Defines if the item is selected or checked",
|
|
804
832
|
"value": { "type": "boolean", "default": "false" }
|
|
805
833
|
},
|
|
834
|
+
{
|
|
835
|
+
"name": "multipleSelection",
|
|
836
|
+
"description": "If the item is part of a multiple selection. Renders a checkmark before the label when active",
|
|
837
|
+
"value": { "type": "boolean", "default": "false" }
|
|
838
|
+
},
|
|
806
839
|
{
|
|
807
840
|
"name": "disabled",
|
|
808
841
|
"description": "Disables the underlying button or link",
|
|
@@ -840,6 +873,11 @@
|
|
|
840
873
|
"description": "Defines if the item is selected or checked",
|
|
841
874
|
"value": { "type": "boolean" }
|
|
842
875
|
},
|
|
876
|
+
{
|
|
877
|
+
"name": "multipleSelection",
|
|
878
|
+
"description": "If the item is part of a multiple selection. Renders a checkmark before the label when active",
|
|
879
|
+
"value": { "type": "boolean" }
|
|
880
|
+
},
|
|
843
881
|
{
|
|
844
882
|
"name": "disabled",
|
|
845
883
|
"description": "Disables the underlying button or link",
|
|
@@ -1147,6 +1185,14 @@
|
|
|
1147
1185
|
"events": []
|
|
1148
1186
|
}
|
|
1149
1187
|
},
|
|
1188
|
+
{
|
|
1189
|
+
"name": "leu-spinner",
|
|
1190
|
+
"description": "\n---\n\n\n### **CSS Properties:**\n - **--leu-spinner-size** - The size of the spinner. _(default: undefined)_",
|
|
1191
|
+
"doc-url": "",
|
|
1192
|
+
"attributes": [],
|
|
1193
|
+
"events": [],
|
|
1194
|
+
"js": { "properties": [], "events": [] }
|
|
1195
|
+
},
|
|
1150
1196
|
{
|
|
1151
1197
|
"name": "leu-table",
|
|
1152
1198
|
"description": "\n---\n",
|
package/package.json
CHANGED
package/rollup.config.js
CHANGED
|
@@ -11,7 +11,10 @@ export const plugins = [
|
|
|
11
11
|
plugin: replace,
|
|
12
12
|
args: [
|
|
13
13
|
{
|
|
14
|
-
|
|
14
|
+
preventAssignment: true,
|
|
15
|
+
values: {
|
|
16
|
+
__LEU_VERSION__: JSON.stringify(process.env.npm_package_version),
|
|
17
|
+
},
|
|
15
18
|
},
|
|
16
19
|
],
|
|
17
20
|
},
|
|
@@ -14,13 +14,13 @@ async function parseFile(file) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function generateCustomPropertyDeclarations({
|
|
17
|
-
|
|
17
|
+
name,
|
|
18
18
|
fontSize,
|
|
19
19
|
fontWeight,
|
|
20
20
|
lineHeight,
|
|
21
21
|
spacing,
|
|
22
22
|
}) {
|
|
23
|
-
const customPropertyPrefix = `--leu-t-${
|
|
23
|
+
const customPropertyPrefix = `--leu-t-${name}-${fontWeight}`
|
|
24
24
|
|
|
25
25
|
const varFontSize = `${customPropertyPrefix}-font-size`
|
|
26
26
|
const varLineHeight = `${customPropertyPrefix}-line-height`
|
|
@@ -77,14 +77,11 @@ async function createLeuFontStyleNodes(file, postcss, nodeSource) {
|
|
|
77
77
|
: [style.fontWeight]
|
|
78
78
|
const spacing = getPixelValue(style.spacing) / 16
|
|
79
79
|
|
|
80
|
-
const identifier = (fontSize / 4) * 10
|
|
81
|
-
|
|
82
80
|
return fontWeights.map((fontWeight) => ({
|
|
83
81
|
name: style.name,
|
|
84
82
|
fontWeight,
|
|
85
|
-
identifier,
|
|
86
83
|
declarations: generateCustomPropertyDeclarations({
|
|
87
|
-
|
|
84
|
+
name: style.name,
|
|
88
85
|
fontSize,
|
|
89
86
|
fontWeight,
|
|
90
87
|
lineHeight: style.lineHeight,
|
|
@@ -100,36 +97,33 @@ async function createLeuFontStyleNodes(file, postcss, nodeSource) {
|
|
|
100
97
|
)
|
|
101
98
|
)
|
|
102
99
|
|
|
103
|
-
const curveNodes = curves.flatMap((curve) =>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
nodes,
|
|
129
|
-
source: nodeSource,
|
|
130
|
-
})
|
|
100
|
+
const curveNodes = curves.flatMap((curve) =>
|
|
101
|
+
curve.weights.flatMap((fontWeight) => {
|
|
102
|
+
const curvePrefix = `--leu-t-curve-${curve.name}-${fontWeight}`
|
|
103
|
+
|
|
104
|
+
return curve.steps.flatMap((step) => {
|
|
105
|
+
const [viewport, styleName] = step
|
|
106
|
+
|
|
107
|
+
const stepStyle = fontStyleDeclarations.find(
|
|
108
|
+
(s) => s.name === styleName && s.fontWeight === fontWeight
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
const nodes = curveStepDeclarations(curvePrefix, stepStyle).map(
|
|
112
|
+
({ prop, value }) =>
|
|
113
|
+
new postcss.Declaration({ prop, value, source: nodeSource })
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return viewport === null
|
|
117
|
+
? nodes
|
|
118
|
+
: new postcss.AtRule({
|
|
119
|
+
name: "media",
|
|
120
|
+
params: `(${viewport})`,
|
|
121
|
+
nodes,
|
|
122
|
+
source: nodeSource,
|
|
123
|
+
})
|
|
124
|
+
})
|
|
131
125
|
})
|
|
132
|
-
|
|
126
|
+
)
|
|
133
127
|
|
|
134
128
|
return [...fontStyleNodes, ...curveNodes]
|
|
135
129
|
}
|
|
@@ -8,7 +8,7 @@ button {
|
|
|
8
8
|
appearance: none;
|
|
9
9
|
transition: background 0.1s ease;
|
|
10
10
|
cursor: pointer;
|
|
11
|
-
border:
|
|
11
|
+
border: none;
|
|
12
12
|
border-radius: 2px;
|
|
13
13
|
|
|
14
14
|
max-width: 100%;
|
|
@@ -33,12 +33,11 @@ button:disabled {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
button:focus-visible {
|
|
36
|
-
border: 1px solid var(--leu-color-black-0);
|
|
37
36
|
outline: 2px solid var(--leu-color-func-cyan);
|
|
37
|
+
outline-offset: 2px;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
button.inverted:focus-visible {
|
|
41
|
-
border: 1px solid var(--leu-color-black-100);
|
|
42
41
|
outline: 2px solid var(--leu-color-black-0);
|
|
43
42
|
}
|
|
44
43
|
|
|
@@ -59,7 +59,7 @@ export class LeuCheckbox extends LeuElement {
|
|
|
59
59
|
@input=${this.handleInput}
|
|
60
60
|
.checked=${this.checked}
|
|
61
61
|
?disabled=${this.disabled}
|
|
62
|
-
.value=${this.value}
|
|
62
|
+
.value=${this.value ?? ""}
|
|
63
63
|
/>
|
|
64
64
|
<label for=${`checkbox-${this.name}`} class="label"><slot></slot></label>
|
|
65
65
|
<leu-icon class="icon" name="check"></leu-icon>
|
|
@@ -17,9 +17,14 @@ export default {
|
|
|
17
17
|
},
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function Template({ label = "Label", value, checked, disabled }) {
|
|
20
|
+
function Template({ label = "Label", value, checked, disabled, name = "" }) {
|
|
21
21
|
return html`
|
|
22
|
-
<leu-checkbox
|
|
22
|
+
<leu-checkbox
|
|
23
|
+
.value=${value}
|
|
24
|
+
?checked=${checked}
|
|
25
|
+
?disabled=${disabled}
|
|
26
|
+
name=${name}
|
|
27
|
+
>
|
|
23
28
|
${label}
|
|
24
29
|
</leu-checkbox>
|
|
25
30
|
`
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { html, nothing } from "lit"
|
|
2
|
+
import { createRef, ref } from "lit/directives/ref.js"
|
|
3
|
+
import { classMap } from "lit/directives/class-map.js"
|
|
4
|
+
|
|
5
|
+
import { LeuElement } from "../../lib/LeuElement.js"
|
|
6
|
+
import { HasSlotController } from "../../lib/hasSlotController.js"
|
|
7
|
+
import { LeuIcon } from "../icon/Icon.js"
|
|
8
|
+
|
|
9
|
+
// design: https://www.figma.com/design/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?node-id=21161-186812&node-type=FRAME
|
|
10
|
+
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import styles from "./dialog.css"
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @tagname leu-dialog
|
|
16
|
+
*/
|
|
17
|
+
export class LeuDialog extends LeuElement {
|
|
18
|
+
static dependencies = {
|
|
19
|
+
"leu-icon": LeuIcon,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static styles = styles
|
|
23
|
+
|
|
24
|
+
static shadowRootOptions = {
|
|
25
|
+
...LeuElement.shadowRootOptions,
|
|
26
|
+
delegatesFocus: true,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
hasSlotController = new HasSlotController(this, ["toolbar"])
|
|
33
|
+
|
|
34
|
+
static properties = {
|
|
35
|
+
label: { type: String },
|
|
36
|
+
sublabel: { type: String },
|
|
37
|
+
open: { type: Boolean, open: true },
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
constructor() {
|
|
41
|
+
super()
|
|
42
|
+
|
|
43
|
+
/** @type {import("lit/directives/ref").Ref<HTMLDialogElement>} */
|
|
44
|
+
this._dialogRef = createRef()
|
|
45
|
+
|
|
46
|
+
/** @type {string} */
|
|
47
|
+
this.label = ""
|
|
48
|
+
/** @type {string} */
|
|
49
|
+
this.sublabel = ""
|
|
50
|
+
/** @type {boolean} */
|
|
51
|
+
this.open = false
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
show() {
|
|
55
|
+
this._dialogRef.value.showModal()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
close() {
|
|
59
|
+
this._dialogRef.value.close()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
render() {
|
|
63
|
+
const hasActionbar = this.hasSlotController.test("actionbar")
|
|
64
|
+
|
|
65
|
+
const closeButtonLabelClasses = {
|
|
66
|
+
"close-button__label": true,
|
|
67
|
+
"close-button__label--hidden": hasActionbar,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return html`
|
|
71
|
+
<dialog class="dialog" ref=${ref(this._dialogRef)} ?open=${this.open}>
|
|
72
|
+
<div class="content">
|
|
73
|
+
<div class="header">
|
|
74
|
+
<div class="title-wrapper">
|
|
75
|
+
<h1 class="title">${this.label}</h1>
|
|
76
|
+
${this.sublabel
|
|
77
|
+
? html`<p class="subtitle">${this.sublabel}</p>`
|
|
78
|
+
: nothing}
|
|
79
|
+
</div>
|
|
80
|
+
<button
|
|
81
|
+
class="close-button"
|
|
82
|
+
@click=${this.close}
|
|
83
|
+
aria-label="Schliessen"
|
|
84
|
+
>
|
|
85
|
+
<span
|
|
86
|
+
class=${classMap(closeButtonLabelClasses)}
|
|
87
|
+
aria-hidden="true"
|
|
88
|
+
>Schliessen</span
|
|
89
|
+
><leu-icon name="close"> </leu-icon>
|
|
90
|
+
</button>
|
|
91
|
+
</div>
|
|
92
|
+
<slot></slot>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="actionbar">
|
|
95
|
+
<slot name="actionbar"></slot>
|
|
96
|
+
</div>
|
|
97
|
+
</dialog>
|
|
98
|
+
`
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
@import url("../../styles/custom-media.css");
|
|
2
|
+
|
|
3
|
+
/* figma https://www.figma.com/design/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?node-id=21161-186812&t=8VgDy9avMRG5aL7s-0 */
|
|
4
|
+
|
|
5
|
+
:host,
|
|
6
|
+
:host * {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
--dialog-font-regular: var(--leu-font-family-regular);
|
|
12
|
+
--dialog-font-black: var(--leu-font-family-black);
|
|
13
|
+
|
|
14
|
+
font-family: var(--dialog-font-regular);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.dialog {
|
|
18
|
+
background: #fff;
|
|
19
|
+
border: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
background-color: var(--leu-color-black-0);
|
|
24
|
+
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
|
|
27
|
+
margin: 0 auto;
|
|
28
|
+
height: 100vh;
|
|
29
|
+
width: 100vw;
|
|
30
|
+
max-height: 100vh;
|
|
31
|
+
max-width: 100vw;
|
|
32
|
+
|
|
33
|
+
@media (--viewport-regular) {
|
|
34
|
+
margin: 80px auto;
|
|
35
|
+
height: fit-content;
|
|
36
|
+
width: fit-content;
|
|
37
|
+
max-width: min(100% - 4.5rem, 60.5rem);
|
|
38
|
+
max-height: calc(100vh - 5rem);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dialog[open] {
|
|
43
|
+
display: flex;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dialog::backdrop {
|
|
47
|
+
background-color: var(--leu-color-black-transp-40);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.content {
|
|
51
|
+
--padding: 2rem;
|
|
52
|
+
padding: var(--padding);
|
|
53
|
+
padding-bottom: 0;
|
|
54
|
+
margin-bottom: 1.5rem;
|
|
55
|
+
overflow-y: auto;
|
|
56
|
+
|
|
57
|
+
@media (--viewport-regular) {
|
|
58
|
+
--padding: 2.5rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media (--viewport-medium) {
|
|
62
|
+
margin-bottom: 2rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (--viewport-large) {
|
|
66
|
+
--padding: 3.5rem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@media (--viewport-xlarge) {
|
|
70
|
+
margin-bottom: 2.5rem;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.title-wrapper {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-flow: column wrap;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.header {
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: flex-start;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.title {
|
|
86
|
+
font: var(--leu-t-curve-big-black-font);
|
|
87
|
+
margin: 0 0 0.75rem;
|
|
88
|
+
order: 2;
|
|
89
|
+
|
|
90
|
+
@media (--viewport-regular) {
|
|
91
|
+
margin-bottom: 1rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media (--viewport-medium) {
|
|
95
|
+
margin-bottom: 1.25rem;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@media (--viewport-xlarge) {
|
|
99
|
+
margin-bottom: 1.5rem;
|
|
100
|
+
font: var(--leu-t-bigger-big-black-font);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.subtitle {
|
|
105
|
+
color: var(--leu-color-black-transp-60);
|
|
106
|
+
font-size: var(--leu-t-tiny-regular-font-size);
|
|
107
|
+
line-height: var(--leu-t-tiny-regular-line-height);
|
|
108
|
+
|
|
109
|
+
order: 1;
|
|
110
|
+
|
|
111
|
+
margin: 0 0 4px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.close-button {
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
display: flex;
|
|
117
|
+
gap: 0.5rem;
|
|
118
|
+
|
|
119
|
+
padding: 0.25rem 0;
|
|
120
|
+
margin-left: 0.75rem;
|
|
121
|
+
border: 0;
|
|
122
|
+
border-radius: 0.125rem;
|
|
123
|
+
|
|
124
|
+
color: var(--leu-color-black-transp-60);
|
|
125
|
+
background: transparent;
|
|
126
|
+
|
|
127
|
+
@media (--viewport-regular) {
|
|
128
|
+
margin-left: 1rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@media (--viewport-medium) {
|
|
132
|
+
margin-left: 1.25rem;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@media (--viewport-xlarge) {
|
|
136
|
+
margin-left: 1.5rem;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.close-button:focus-visible {
|
|
141
|
+
outline: 2px solid var(--leu-color-func-cyan);
|
|
142
|
+
outline-offset: 2px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.close-button__label {
|
|
146
|
+
display: none;
|
|
147
|
+
font: var(--leu-t-regular-regular-font);
|
|
148
|
+
|
|
149
|
+
@media (--viewport-medium) {
|
|
150
|
+
display: inline;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.close-button__label--hidden {
|
|
155
|
+
display: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.actionbar {
|
|
159
|
+
display: flex;
|
|
160
|
+
justify-content: flex-end;
|
|
161
|
+
min-height: 3rem;
|
|
162
|
+
}
|