@statistikzh/leu 0.9.0 → 0.11.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/CHANGELOG.md +22 -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 +1 -1
- 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 +3 -2
- 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-7ab5ef5e.d.ts → LeuElement-78b4a998.d.ts} +1 -1
- package/dist/LeuElement-78b4a998.d.ts.map +1 -0
- package/dist/{LeuElement-7ab5ef5e.js → LeuElement-78b4a998.js} +1 -1
- package/dist/Menu.d.ts +1 -1
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.d.ts +1 -1
- package/dist/MenuItem.js +1 -1
- 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 +1 -1
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +1 -1
- package/dist/Range.d.ts +60 -0
- package/dist/Range.d.ts.map +1 -0
- package/dist/Range.js +414 -0
- 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 +3 -2
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +1 -1
- 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-fd1950b4.d.ts +38 -0
- package/dist/hasSlotController-fd1950b4.d.ts.map +1 -0
- package/dist/hasSlotController-fd1950b4.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-range.d.ts +3 -0
- package/dist/leu-range.d.ts.map +1 -0
- package/dist/leu-range.js +7 -0
- package/dist/leu-scroll-top.js +3 -2
- package/dist/leu-select.js +3 -2
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.js +3 -2
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/theme.css +318 -192
- package/dist/vscode.html-custom-data.json +35 -0
- package/dist/vue/index.d.ts +60 -0
- package/dist/web-types.json +73 -1
- package/package.json +1 -1
- package/rollup.config.js +4 -1
- package/scripts/postcss-leu-font-styles.cjs +29 -35
- 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/input/input.css +2 -0
- package/src/components/range/Range.js +237 -0
- package/src/components/range/leu-range.js +5 -0
- package/src/components/range/range.css +181 -0
- package/src/components/range/stories/range-slider.stories.js +142 -0
- package/src/components/range/test/range-test.js +24 -0
- package/src/styles/custom-properties.css +27 -0
- package/src/styles/font-definitions.json +27 -19
- package/src/styles/style.stories.js +61 -0
- package/dist/Button-5a8009c5.d.ts +0 -83
- package/dist/Button-5a8009c5.d.ts.map +0 -1
- package/dist/Button-5a8009c5.js +0 -544
- package/dist/LeuElement-7ab5ef5e.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",
|
|
@@ -542,6 +557,26 @@
|
|
|
542
557
|
}
|
|
543
558
|
]
|
|
544
559
|
},
|
|
560
|
+
{
|
|
561
|
+
"name": "leu-range",
|
|
562
|
+
"description": "\n---\n\n\n### **Methods:**\n - **_handlePointerDown(e: _PointerEvent & {target: HTMLInputElement}_)** - Determine if the \"click\" (pointer event) is closer the\nthe value of the other input element. Swap the values if this is the case.",
|
|
563
|
+
"attributes": [
|
|
564
|
+
{ "name": "value", "values": [{ "name": "array" }] },
|
|
565
|
+
{ "name": "min", "values": [] },
|
|
566
|
+
{ "name": "max", "values": [] },
|
|
567
|
+
{ "name": "step", "values": [] },
|
|
568
|
+
{ "name": "name", "values": [] },
|
|
569
|
+
{ "name": "label", "values": [] },
|
|
570
|
+
{ "name": "disabled", "values": [] },
|
|
571
|
+
{ "name": "multiple", "values": [] }
|
|
572
|
+
],
|
|
573
|
+
"references": [
|
|
574
|
+
{
|
|
575
|
+
"name": "Documentation",
|
|
576
|
+
"url": "https://statistikzh.github.io/leu/?path=/story/range"
|
|
577
|
+
}
|
|
578
|
+
]
|
|
579
|
+
},
|
|
545
580
|
{
|
|
546
581
|
"name": "leu-scroll-top",
|
|
547
582
|
"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";
|
|
@@ -19,6 +20,7 @@ import type { LeuPagination, CustomEvent } from "../Pagination.js";
|
|
|
19
20
|
import type { LeuPopup } from "../Popup.js";
|
|
20
21
|
import type { LeuRadio } from "../Radio.js";
|
|
21
22
|
import type { LeuRadioGroup } from "../RadioGroup.js";
|
|
23
|
+
import type { LeuRange } from "../Range.js";
|
|
22
24
|
import type { LeuScrollTop } from "../ScrollTop.js";
|
|
23
25
|
import type { LeuSelect } from "../Select.js";
|
|
24
26
|
import type { LeuSpinner } from "../Spinner.js";
|
|
@@ -172,6 +174,17 @@ type LeuChipSelectableProps = {
|
|
|
172
174
|
onInput?: (e: CustomEvent<CustomEvent>) => void;
|
|
173
175
|
};
|
|
174
176
|
|
|
177
|
+
type LeuDialogProps = {
|
|
178
|
+
/** */
|
|
179
|
+
label?: LeuDialog["label"];
|
|
180
|
+
/** */
|
|
181
|
+
sublabel?: LeuDialog["sublabel"];
|
|
182
|
+
/** */
|
|
183
|
+
open?: LeuDialog["open"];
|
|
184
|
+
/** */
|
|
185
|
+
_dialogRef?: LeuDialog["_dialogRef"];
|
|
186
|
+
};
|
|
187
|
+
|
|
175
188
|
type LeuDropdownProps = {
|
|
176
189
|
/** */
|
|
177
190
|
label?: LeuDropdown["label"];
|
|
@@ -348,6 +361,35 @@ type LeuRadioGroupProps = {
|
|
|
348
361
|
items?: LeuRadioGroup["items"];
|
|
349
362
|
};
|
|
350
363
|
|
|
364
|
+
type LeuRangeProps = {
|
|
365
|
+
/** */
|
|
366
|
+
value?: LeuRange["defaultValue"];
|
|
367
|
+
/** */
|
|
368
|
+
min?: LeuRange["min"];
|
|
369
|
+
/** */
|
|
370
|
+
max?: LeuRange["max"];
|
|
371
|
+
/** */
|
|
372
|
+
step?: LeuRange["step"];
|
|
373
|
+
/** */
|
|
374
|
+
name?: LeuRange["name"];
|
|
375
|
+
/** */
|
|
376
|
+
label?: LeuRange["label"];
|
|
377
|
+
/** */
|
|
378
|
+
disabled?: LeuRange["disabled"];
|
|
379
|
+
/** */
|
|
380
|
+
multiple?: LeuRange["multiple"];
|
|
381
|
+
/** Sets the value of the underlying input element(s).
|
|
382
|
+
The value has to be an array if "multiple" range is used.
|
|
383
|
+
Otherwise it has to be a string. */
|
|
384
|
+
value?: LeuRange["value"];
|
|
385
|
+
/** */
|
|
386
|
+
valueAsArray?: LeuRange["valueAsArray"];
|
|
387
|
+
/** */
|
|
388
|
+
valueLow?: LeuRange["valueLow"];
|
|
389
|
+
/** */
|
|
390
|
+
valueHigh?: LeuRange["valueHigh"];
|
|
391
|
+
};
|
|
392
|
+
|
|
351
393
|
type LeuScrollTopProps = {
|
|
352
394
|
/** */
|
|
353
395
|
_showButton?: LeuScrollTop["_showButton"];
|
|
@@ -561,6 +603,13 @@ export type CustomElements = {
|
|
|
561
603
|
*/
|
|
562
604
|
"leu-chip-selectable": DefineComponent<LeuChipSelectableProps>;
|
|
563
605
|
|
|
606
|
+
/**
|
|
607
|
+
*
|
|
608
|
+
* ---
|
|
609
|
+
*
|
|
610
|
+
*/
|
|
611
|
+
"leu-dialog": DefineComponent<LeuDialogProps>;
|
|
612
|
+
|
|
564
613
|
/**
|
|
565
614
|
*
|
|
566
615
|
* ---
|
|
@@ -653,6 +702,17 @@ export type CustomElements = {
|
|
|
653
702
|
*/
|
|
654
703
|
"leu-radio-group": DefineComponent<LeuRadioGroupProps>;
|
|
655
704
|
|
|
705
|
+
/**
|
|
706
|
+
*
|
|
707
|
+
* ---
|
|
708
|
+
*
|
|
709
|
+
*
|
|
710
|
+
* ### **Methods:**
|
|
711
|
+
* - **_handlePointerDown(e: _PointerEvent & {target: HTMLInputElement}_)** - Determine if the "click" (pointer event) is closer the
|
|
712
|
+
* the value of the other input element. Swap the values if this is the case.
|
|
713
|
+
*/
|
|
714
|
+
"leu-range": DefineComponent<LeuRangeProps>;
|
|
715
|
+
|
|
656
716
|
/**
|
|
657
717
|
*
|
|
658
718
|
* ---
|
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.11.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",
|
|
@@ -1035,6 +1063,50 @@
|
|
|
1035
1063
|
"events": []
|
|
1036
1064
|
}
|
|
1037
1065
|
},
|
|
1066
|
+
{
|
|
1067
|
+
"name": "leu-range",
|
|
1068
|
+
"description": "\n---\n\n\n### **Methods:**\n - **_handlePointerDown(e: _PointerEvent & {target: HTMLInputElement}_)** - Determine if the \"click\" (pointer event) is closer the\nthe value of the other input element. Swap the values if this is the case.",
|
|
1069
|
+
"doc-url": "",
|
|
1070
|
+
"attributes": [
|
|
1071
|
+
{
|
|
1072
|
+
"name": "value",
|
|
1073
|
+
"value": { "type": "array", "default": "[50]" }
|
|
1074
|
+
},
|
|
1075
|
+
{ "name": "min", "value": { "type": "number", "default": "0" } },
|
|
1076
|
+
{ "name": "max", "value": { "type": "number", "default": "100" } },
|
|
1077
|
+
{ "name": "step", "value": { "type": "number", "default": "1" } },
|
|
1078
|
+
{
|
|
1079
|
+
"name": "name",
|
|
1080
|
+
"value": { "type": "string", "default": "\"\"" }
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
"name": "label",
|
|
1084
|
+
"value": { "type": "string", "default": "\"\"" }
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
"name": "disabled",
|
|
1088
|
+
"value": { "type": "boolean", "default": "false" }
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
"name": "multiple",
|
|
1092
|
+
"value": { "type": "boolean", "default": "false" }
|
|
1093
|
+
}
|
|
1094
|
+
],
|
|
1095
|
+
"events": [],
|
|
1096
|
+
"js": {
|
|
1097
|
+
"properties": [
|
|
1098
|
+
{ "name": "value", "value": { "type": "array" } },
|
|
1099
|
+
{ "name": "min", "value": { "type": "number" } },
|
|
1100
|
+
{ "name": "max", "value": { "type": "number" } },
|
|
1101
|
+
{ "name": "step", "value": { "type": "number" } },
|
|
1102
|
+
{ "name": "name", "value": { "type": "string" } },
|
|
1103
|
+
{ "name": "label", "value": { "type": "string" } },
|
|
1104
|
+
{ "name": "disabled", "value": { "type": "boolean" } },
|
|
1105
|
+
{ "name": "multiple", "value": { "type": "boolean" } }
|
|
1106
|
+
],
|
|
1107
|
+
"events": []
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1038
1110
|
{
|
|
1039
1111
|
"name": "leu-scroll-top",
|
|
1040
1112
|
"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
|
}
|
|
@@ -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
|
+
}
|