@lmvz-ds/components 0.20.0 → 0.21.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lmvz-ds/components
2
2
 
3
+ ## 0.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1cbce93: Toggle Komponente hinzugefügt
8
+
3
9
  ## 0.20.0
4
10
 
5
11
  ### Minor Changes
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["lmvz-header_2.cjs",[[769,"lmvz-header",{"role":[2561],"lmvzActiveNav":[1,"lmvz-active-nav"]},null,{"lmvzActiveNav":[{"handleActiveNavChange":0}]}],[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-action.cjs",[[257,"lmvz-action"]]],["lmvz-button.cjs",[[785,"lmvz-button",{"ti":[2562,"tabindex"],"scale":[513],"variant":[513],"disabled":[516],"type":[1],"form":[1]}]]],["lmvz-card.cjs",[[774,"lmvz-card",{"cardTitle":[1,"card-title"],"imageUrl":[1,"image-url"],"description":[1],"primaryActionLabel":[1,"primary-action-label"]}]]],["lmvz-checkbox.cjs",[[578,"lmvz-checkbox",{"label":[1],"checked":[1540],"value":[1],"name":[1],"disabled":[516],"required":[516],"error":[516],"errorMessage":[1,"error-message"],"helperText":[1,"helper-text"],"form":[1],"autofocus":[4],"checkedState":[32],"focusInput":[64],"checkValidity":[64],"reportValidity":[64]},null,{"checked":[{"handleCheckedChange":0}]}]]],["lmvz-chip.cjs",[[769,"lmvz-chip",{"type":[1537],"size":[1537]},null,{"type":[{"normalizeType":0}],"size":[{"normalizeSize":0}]}]]],["lmvz-icon.cjs",[[514,"lmvz-icon",{"icon":[513],"weight":[513],"size":[513],"iconset":[513],"ariaLabel":[513,"aria-label"],"iconData":[32],"visible":[32]},null,{"icon":[{"loadIconPathData":0}],"iconset":[{"loadIconPathData":0}]}]]],["lmvz-input.cjs",[[838,"lmvz-input",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"placeholder":[1],"disabled":[516],"readonly":[516],"required":[516],"name":[1],"type":[1],"errorMessage":[1,"error-message"],"autocomplete":[1],"inputmode":[1],"autocorrect":[1],"autocapitalize":[1],"spellcheck":[4],"autofocus":[4],"minlength":[2],"maxlength":[2],"pattern":[1],"min":[8],"max":[8],"step":[8],"form":[1],"error":[6660],"nativeError":[32],"setValue":[64],"focusInput":[64],"blurInput":[64],"select":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"value":[{"handleValueChange":0}],"disabled":[{"handleDisabledChange":0}]}]]],["lmvz-menuitem.cjs",[[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-select.cjs",[[774,"lmvz-select",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"disabled":[516],"required":[516],"name":[1],"selectedLabel":[32]},null,{"value":[{"handleValueChange":0}]}]]]], options);
22
+ return index.bootstrapLazy([["lmvz-header_2.cjs",[[769,"lmvz-header",{"role":[2561],"lmvzActiveNav":[1,"lmvz-active-nav"]},null,{"lmvzActiveNav":[{"handleActiveNavChange":0}]}],[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-action.cjs",[[257,"lmvz-action"]]],["lmvz-button.cjs",[[785,"lmvz-button",{"ti":[2562,"tabindex"],"scale":[513],"variant":[513],"disabled":[516],"type":[1],"form":[1]}]]],["lmvz-card.cjs",[[774,"lmvz-card",{"cardTitle":[1,"card-title"],"imageUrl":[1,"image-url"],"description":[1],"primaryActionLabel":[1,"primary-action-label"]}]]],["lmvz-checkbox.cjs",[[578,"lmvz-checkbox",{"label":[1],"checked":[1540],"value":[1],"name":[1],"disabled":[516],"required":[516],"error":[516],"errorMessage":[1,"error-message"],"helperText":[1,"helper-text"],"form":[1],"autofocus":[4],"checkedState":[32],"focusInput":[64],"checkValidity":[64],"reportValidity":[64]},null,{"checked":[{"handleCheckedChange":0}]}]]],["lmvz-chip.cjs",[[769,"lmvz-chip",{"type":[1537],"size":[1537]},null,{"type":[{"normalizeType":0}],"size":[{"normalizeSize":0}]}]]],["lmvz-icon.cjs",[[514,"lmvz-icon",{"icon":[513],"weight":[513],"size":[513],"iconset":[513],"ariaLabel":[513,"aria-label"],"iconData":[32],"visible":[32]},null,{"icon":[{"loadIconPathData":0}],"iconset":[{"loadIconPathData":0}]}]]],["lmvz-input.cjs",[[838,"lmvz-input",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"placeholder":[1],"disabled":[516],"readonly":[516],"required":[516],"name":[1],"type":[1],"errorMessage":[1,"error-message"],"autocomplete":[1],"inputmode":[1],"autocorrect":[1],"autocapitalize":[1],"spellcheck":[4],"autofocus":[4],"minlength":[2],"maxlength":[2],"pattern":[1],"min":[8],"max":[8],"step":[8],"form":[1],"error":[6660],"nativeError":[32],"setValue":[64],"focusInput":[64],"blurInput":[64],"select":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"value":[{"handleValueChange":0}],"disabled":[{"handleDisabledChange":0}]}]]],["lmvz-menuitem.cjs",[[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-select.cjs",[[774,"lmvz-select",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"disabled":[516],"required":[516],"name":[1],"selectedLabel":[32]},null,{"value":[{"handleValueChange":0}]}]]],["lmvz-toggle.cjs",[[578,"lmvz-toggle",{"label":[1],"checked":[1540],"disabled":[516],"required":[516],"name":[1],"value":[1],"form":[1],"focusToggle":[64],"blurToggle":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"checked":[{"handleCheckedChange":0}],"disabled":[{"handleDisabledChange":0}]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -0,0 +1,96 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-C2yDXRqP.js');
4
+ var reactiveControllerHost = require('./reactive-controller-host-BA4ZhjKA.js');
5
+ var component = require('./component-Csg9MtNK.js');
6
+ require('./aria-loader-Cec1zR2g.js');
7
+
8
+ const lmvzToggleCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } .sc-lmvz-toggle-h { display: inline-flex; align-items: center; gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); padding-block: var(--lmvz-dimension-2-8, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); padding-inline: var(--lmvz-dimension-4-10, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); border-radius: var(--lmvz-semantic-border-radius-round, 999px); cursor: pointer; background-color: transparent; user-select: none; } .sc-lmvz-toggle-h:not([disabled]):hover { background-color: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } [checked].sc-lmvz-toggle-h { background-color: var(--lmvz-semantic-color-status-active, #f1f9fe); } [disabled][checked].sc-lmvz-toggle-h { background-color: var(--lmvz-semantic-color-status-active, #f1f9fe); } [disabled].sc-lmvz-toggle-h { cursor: not-allowed; opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; } .track.sc-lmvz-toggle { position: relative; flex-shrink: 0; width: var(--lmvz-global-s32, 32px); height: var(--lmvz-global-s20, 20px); border-radius: var(--lmvz-semantic-border-radius-round, 999px); background-color: var(--lmvz-semantic-color-surface-input-primary, #ffffff); border: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-default, #e0e0e0); } .sc-lmvz-toggle-h:not([disabled]):hover .track.sc-lmvz-toggle { border-color: var(--lmvz-semantic-color-border-hover, #c7c7c7); } [checked].sc-lmvz-toggle-h .track.sc-lmvz-toggle { border-color: var(--lmvz-semantic-color-border-active, #0f8acc); } input.sc-lmvz-toggle { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: inherit; } .sc-lmvz-toggle-h:focus-within { outline: 2px solid var(--lmvz-semantic-color-border-active, #0f8acc); outline-offset: 2px; } .thumb.sc-lmvz-toggle { position: absolute; width: var(--lmvz-global-s13, 13px); height: var(--lmvz-global-s13, 13px); border-radius: 50%; background-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a); top: 50%; transform: translateY(-50%); left: var(--lmvz-global-s4, 4px); transition: left 0.2s ease, background-color 0.2s ease; pointer-events: none; } [checked].sc-lmvz-toggle-h .thumb.sc-lmvz-toggle { left: calc(var(--lmvz-global-s4, 4px) + var(--lmvz-global-s11, 11px)); background-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); } label.sc-lmvz-toggle { font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); color: var(--lmvz-semantic-color-on-surface-primary, #000000); cursor: pointer; }`;
9
+
10
+ let toggleIdCounter = 0;
11
+ const LmvzToggle = class extends reactiveControllerHost.ReactiveControllerHost {
12
+ get el() { return index.getElement(this); }
13
+ get validationEl() {
14
+ return this.el;
15
+ }
16
+ internals;
17
+ nativeInputElement;
18
+ toggleId = `lmvz-toggle-${toggleIdCounter++}`;
19
+ lmvzChange;
20
+ label;
21
+ checked = false;
22
+ disabled = false;
23
+ required = false;
24
+ name;
25
+ value = 'on';
26
+ form;
27
+ constructor(hostRef) {
28
+ super();
29
+ index.registerInstance(this, hostRef);
30
+ this.lmvzChange = index.createEvent(this, "lmvzChange");
31
+ if (hostRef.$hostElement$["s-ei"]) {
32
+ this.internals = hostRef.$hostElement$["s-ei"];
33
+ }
34
+ else {
35
+ this.internals = hostRef.$hostElement$.attachInternals();
36
+ hostRef.$hostElement$["s-ei"] = this.internals;
37
+ }
38
+ this.addController(new reactiveControllerHost.AriaValidationController(this));
39
+ }
40
+ formAssociatedCallback(_form) {
41
+ this.internals.setFormValue?.(this.checked ? this.value : null);
42
+ }
43
+ formResetCallback() {
44
+ this.checked = false;
45
+ }
46
+ formStateRestoreCallback(state) {
47
+ this.checked = state === this.value;
48
+ this.internals.setFormValue?.(this.checked ? this.value : null);
49
+ }
50
+ handleCheckedChange(checked) {
51
+ this.internals.setFormValue?.(checked ? this.value : null);
52
+ }
53
+ handleDisabledChange(disabled) {
54
+ if (disabled && this.nativeInputElement) {
55
+ this.nativeInputElement.blur();
56
+ }
57
+ }
58
+ async focusToggle() {
59
+ this.nativeInputElement?.focus();
60
+ }
61
+ async blurToggle() {
62
+ this.nativeInputElement?.blur();
63
+ }
64
+ async checkValidity() {
65
+ return this.nativeInputElement?.checkValidity?.() ?? false;
66
+ }
67
+ async reportValidity() {
68
+ return this.nativeInputElement?.reportValidity?.() ?? false;
69
+ }
70
+ async getInputElement() {
71
+ if (!this.nativeInputElement) {
72
+ await new Promise((resolve) => component.componentOnReady(this.el, resolve));
73
+ }
74
+ return Promise.resolve(this.nativeInputElement);
75
+ }
76
+ handleChange = (event) => {
77
+ const newChecked = event.target.checked;
78
+ this.checked = newChecked;
79
+ this.lmvzChange.emit(newChecked);
80
+ };
81
+ render() {
82
+ return (index.h(index.Host, { key: '0a0f0e278a0ccd6739e7e9e82267c047efad74ad' }, index.h("span", { key: 'da93a2dd256c72171e7a423223a3738d6ca13ebb', class: "track" }, index.h("input", { key: '6e90ec39ec856fa38097e6224c7fed50b23088e5', type: "checkbox", role: "switch", id: this.toggleId, checked: this.checked, disabled: this.disabled, required: this.required, name: this.name, value: this.value, form: this.form, ref: (el) => (this.nativeInputElement = el), onChange: this.handleChange }), index.h("span", { key: '8fca08269e216b9a2840e7707fa5562220f8b36c', class: "thumb", "aria-hidden": "true" })), index.h("label", { key: 'f0a0842fef8c9fa3981b6d8c373a79fe0c33fad3', htmlFor: this.toggleId }, this.label)));
83
+ }
84
+ static get formAssociated() { return true; }
85
+ static get watchers() { return {
86
+ "checked": [{
87
+ "handleCheckedChange": 0
88
+ }],
89
+ "disabled": [{
90
+ "handleDisabledChange": 0
91
+ }]
92
+ }; }
93
+ };
94
+ LmvzToggle.style = lmvzToggleCss();
95
+
96
+ exports.lmvz_toggle = LmvzToggle;
package/cjs/loader.cjs.js CHANGED
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["lmvz-header_2.cjs",[[769,"lmvz-header",{"role":[2561],"lmvzActiveNav":[1,"lmvz-active-nav"]},null,{"lmvzActiveNav":[{"handleActiveNavChange":0}]}],[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-action.cjs",[[257,"lmvz-action"]]],["lmvz-button.cjs",[[785,"lmvz-button",{"ti":[2562,"tabindex"],"scale":[513],"variant":[513],"disabled":[516],"type":[1],"form":[1]}]]],["lmvz-card.cjs",[[774,"lmvz-card",{"cardTitle":[1,"card-title"],"imageUrl":[1,"image-url"],"description":[1],"primaryActionLabel":[1,"primary-action-label"]}]]],["lmvz-checkbox.cjs",[[578,"lmvz-checkbox",{"label":[1],"checked":[1540],"value":[1],"name":[1],"disabled":[516],"required":[516],"error":[516],"errorMessage":[1,"error-message"],"helperText":[1,"helper-text"],"form":[1],"autofocus":[4],"checkedState":[32],"focusInput":[64],"checkValidity":[64],"reportValidity":[64]},null,{"checked":[{"handleCheckedChange":0}]}]]],["lmvz-chip.cjs",[[769,"lmvz-chip",{"type":[1537],"size":[1537]},null,{"type":[{"normalizeType":0}],"size":[{"normalizeSize":0}]}]]],["lmvz-icon.cjs",[[514,"lmvz-icon",{"icon":[513],"weight":[513],"size":[513],"iconset":[513],"ariaLabel":[513,"aria-label"],"iconData":[32],"visible":[32]},null,{"icon":[{"loadIconPathData":0}],"iconset":[{"loadIconPathData":0}]}]]],["lmvz-input.cjs",[[838,"lmvz-input",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"placeholder":[1],"disabled":[516],"readonly":[516],"required":[516],"name":[1],"type":[1],"errorMessage":[1,"error-message"],"autocomplete":[1],"inputmode":[1],"autocorrect":[1],"autocapitalize":[1],"spellcheck":[4],"autofocus":[4],"minlength":[2],"maxlength":[2],"pattern":[1],"min":[8],"max":[8],"step":[8],"form":[1],"error":[6660],"nativeError":[32],"setValue":[64],"focusInput":[64],"blurInput":[64],"select":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"value":[{"handleValueChange":0}],"disabled":[{"handleDisabledChange":0}]}]]],["lmvz-menuitem.cjs",[[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-select.cjs",[[774,"lmvz-select",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"disabled":[516],"required":[516],"name":[1],"selectedLabel":[32]},null,{"value":[{"handleValueChange":0}]}]]]], options);
9
+ return index.bootstrapLazy([["lmvz-header_2.cjs",[[769,"lmvz-header",{"role":[2561],"lmvzActiveNav":[1,"lmvz-active-nav"]},null,{"lmvzActiveNav":[{"handleActiveNavChange":0}]}],[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-action.cjs",[[257,"lmvz-action"]]],["lmvz-button.cjs",[[785,"lmvz-button",{"ti":[2562,"tabindex"],"scale":[513],"variant":[513],"disabled":[516],"type":[1],"form":[1]}]]],["lmvz-card.cjs",[[774,"lmvz-card",{"cardTitle":[1,"card-title"],"imageUrl":[1,"image-url"],"description":[1],"primaryActionLabel":[1,"primary-action-label"]}]]],["lmvz-checkbox.cjs",[[578,"lmvz-checkbox",{"label":[1],"checked":[1540],"value":[1],"name":[1],"disabled":[516],"required":[516],"error":[516],"errorMessage":[1,"error-message"],"helperText":[1,"helper-text"],"form":[1],"autofocus":[4],"checkedState":[32],"focusInput":[64],"checkValidity":[64],"reportValidity":[64]},null,{"checked":[{"handleCheckedChange":0}]}]]],["lmvz-chip.cjs",[[769,"lmvz-chip",{"type":[1537],"size":[1537]},null,{"type":[{"normalizeType":0}],"size":[{"normalizeSize":0}]}]]],["lmvz-icon.cjs",[[514,"lmvz-icon",{"icon":[513],"weight":[513],"size":[513],"iconset":[513],"ariaLabel":[513,"aria-label"],"iconData":[32],"visible":[32]},null,{"icon":[{"loadIconPathData":0}],"iconset":[{"loadIconPathData":0}]}]]],["lmvz-input.cjs",[[838,"lmvz-input",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"placeholder":[1],"disabled":[516],"readonly":[516],"required":[516],"name":[1],"type":[1],"errorMessage":[1,"error-message"],"autocomplete":[1],"inputmode":[1],"autocorrect":[1],"autocapitalize":[1],"spellcheck":[4],"autofocus":[4],"minlength":[2],"maxlength":[2],"pattern":[1],"min":[8],"max":[8],"step":[8],"form":[1],"error":[6660],"nativeError":[32],"setValue":[64],"focusInput":[64],"blurInput":[64],"select":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"value":[{"handleValueChange":0}],"disabled":[{"handleDisabledChange":0}]}]]],["lmvz-menuitem.cjs",[[774,"lmvz-menuitem",{"role":[2561],"ti":[2562,"tabindex"]}]]],["lmvz-select.cjs",[[774,"lmvz-select",{"value":[1025],"label":[1],"helperText":[1,"helper-text"],"disabled":[516],"required":[516],"name":[1],"selectedLabel":[32]},null,{"value":[{"handleValueChange":0}]}]]],["lmvz-toggle.cjs",[[578,"lmvz-toggle",{"label":[1],"checked":[1540],"disabled":[516],"required":[516],"name":[1],"value":[1],"form":[1],"focusToggle":[64],"blurToggle":[64],"checkValidity":[64],"reportValidity":[64],"getInputElement":[64]},null,{"checked":[{"handleCheckedChange":0}],"disabled":[{"handleDisabledChange":0}]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -10,6 +10,7 @@
10
10
  "components/lmvz-input/lmvz-input.js",
11
11
  "components/lmvz-menuitem/lmvz-menuitem.js",
12
12
  "components/lmvz-select/lmvz-select.js",
13
+ "components/lmvz-toggle/lmvz-toggle.js",
13
14
  "integration/header-integration/header-integration.js"
14
15
  ],
15
16
  "mixins": [],
@@ -0,0 +1,118 @@
1
+
2
+ @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides;
3
+ /**
4
+ * This defines the order of our lmvz-ds' CSS layers. See readme.md for details.
5
+ * Important: Always import this file _before_ layering your own styles!
6
+ */
7
+ @layer lmvz-ds.theme {
8
+ @font-face {
9
+ font-family: Router;
10
+ src:
11
+ local('Router-Book'),
12
+ url('/assets/fonts/Router-Book.woff') format('woff'),
13
+ local('Router');
14
+ font-weight: 400 normal;
15
+ }
16
+
17
+ @font-face {
18
+ font-family: Router;
19
+ src:
20
+ local('Router-Medium'),
21
+ url('/assets/fonts/Router-Medium.woff') format('woff'),
22
+ local('Router');
23
+ font-weight: 500;
24
+ }
25
+
26
+ @font-face {
27
+ font-family: Router;
28
+ src:
29
+ local('Router-Bold'),
30
+ url('/assets/fonts/Router-Bold.woff') format('woff'),
31
+ local('Router');
32
+ font-weight: 700 bold;
33
+ }
34
+
35
+ }
36
+ :host {
37
+ display: inline-flex;
38
+ align-items: center;
39
+ gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem));
40
+ padding-block: var(--lmvz-dimension-2-8, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem));
41
+ padding-inline: var(--lmvz-dimension-4-10, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem));
42
+ /* TODO[LDHCID-136]: min-height currently below accessibility requirements for tap targets (44px) */
43
+ /* min-height: 38px; */
44
+ border-radius: var(--lmvz-semantic-border-radius-round, 999px);
45
+ cursor: pointer;
46
+ background-color: transparent;
47
+ user-select: none;
48
+ }
49
+ :host(:not([disabled]):hover) {
50
+ background-color: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0);
51
+ }
52
+ :host([checked]) {
53
+ background-color: var(--lmvz-semantic-color-status-active, #f1f9fe);
54
+ }
55
+ :host([disabled][checked]) {
56
+ background-color: var(--lmvz-semantic-color-status-active, #f1f9fe);
57
+ }
58
+ :host([disabled]) {
59
+ cursor: not-allowed;
60
+ opacity: var(--lmvz-component-input-disabled-opacity, 40%);
61
+ pointer-events: none;
62
+ }
63
+ .track {
64
+ position: relative;
65
+ flex-shrink: 0;
66
+ width: var(--lmvz-global-s32, 32px);
67
+ height: var(--lmvz-global-s20, 20px);
68
+ border-radius: var(--lmvz-semantic-border-radius-round, 999px);
69
+ background-color: var(--lmvz-semantic-color-surface-input-primary, #ffffff);
70
+ border: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-default, #e0e0e0);
71
+ }
72
+ :host(:not([disabled]):hover) .track {
73
+ border-color: var(--lmvz-semantic-color-border-hover, #c7c7c7);
74
+ }
75
+ :host([checked]) .track {
76
+ border-color: var(--lmvz-semantic-color-border-active, #0f8acc);
77
+ }
78
+ input {
79
+ /* visually hidden, keyboard-accessible */
80
+ position: absolute;
81
+ top: 0;
82
+ left: 0;
83
+ width: 100%;
84
+ height: 100%;
85
+ opacity: 0;
86
+ margin: 0;
87
+ cursor: inherit;
88
+ }
89
+ :host(:focus-within) {
90
+ /* TODO[LDHCID-136]: no focus-visible token in DS */
91
+ outline: 2px solid var(--lmvz-semantic-color-border-active, #0f8acc);
92
+ outline-offset: 2px;
93
+ }
94
+ .thumb {
95
+ position: absolute;
96
+ width: var(--lmvz-global-s13, 13px);
97
+ height: var(--lmvz-global-s13, 13px);
98
+ border-radius: 50%;
99
+ background-color: var(--lmvz-semantic-color-on-surface-input-secondary, #7a7a7a);
100
+ top: 50%;
101
+ transform: translateY(-50%);
102
+ left: var(--lmvz-global-s4, 4px);
103
+ /* TODO[LDHCID-136]: no DS motion/duration token — 0.2s ease from Figma interaction baseline */
104
+ transition:
105
+ left 0.2s ease,
106
+ background-color 0.2s ease;
107
+ pointer-events: none;
108
+ }
109
+ :host([checked]) .thumb {
110
+ left: calc(var(--lmvz-global-s4, 4px) + var(--lmvz-global-s11, 11px));
111
+ background-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4);
112
+ }
113
+ label {
114
+ font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4
115
+ Router);
116
+ color: var(--lmvz-semantic-color-on-surface-primary, #000000);
117
+ cursor: pointer;
118
+ }
@@ -0,0 +1,358 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { AriaValidationController } from "../../utils/aria/aria-validation-controller";
3
+ import { componentOnReady } from "../../utils/component";
4
+ import { ReactiveControllerHost } from "../../utils/reactive-controller-host";
5
+ let toggleIdCounter = 0;
6
+ export class LmvzToggle extends ReactiveControllerHost {
7
+ el;
8
+ get validationEl() {
9
+ return this.el;
10
+ }
11
+ internals;
12
+ nativeInputElement;
13
+ toggleId = `lmvz-toggle-${toggleIdCounter++}`;
14
+ lmvzChange;
15
+ label;
16
+ checked = false;
17
+ disabled = false;
18
+ required = false;
19
+ name;
20
+ value = 'on';
21
+ form;
22
+ constructor() {
23
+ super();
24
+ this.addController(new AriaValidationController(this));
25
+ }
26
+ formAssociatedCallback(_form) {
27
+ this.internals.setFormValue?.(this.checked ? this.value : null);
28
+ }
29
+ formResetCallback() {
30
+ this.checked = false;
31
+ }
32
+ formStateRestoreCallback(state) {
33
+ this.checked = state === this.value;
34
+ this.internals.setFormValue?.(this.checked ? this.value : null);
35
+ }
36
+ handleCheckedChange(checked) {
37
+ this.internals.setFormValue?.(checked ? this.value : null);
38
+ }
39
+ handleDisabledChange(disabled) {
40
+ if (disabled && this.nativeInputElement) {
41
+ this.nativeInputElement.blur();
42
+ }
43
+ }
44
+ async focusToggle() {
45
+ this.nativeInputElement?.focus();
46
+ }
47
+ async blurToggle() {
48
+ this.nativeInputElement?.blur();
49
+ }
50
+ async checkValidity() {
51
+ return this.nativeInputElement?.checkValidity?.() ?? false;
52
+ }
53
+ async reportValidity() {
54
+ return this.nativeInputElement?.reportValidity?.() ?? false;
55
+ }
56
+ async getInputElement() {
57
+ if (!this.nativeInputElement) {
58
+ await new Promise((resolve) => componentOnReady(this.el, resolve));
59
+ }
60
+ return Promise.resolve(this.nativeInputElement);
61
+ }
62
+ handleChange = (event) => {
63
+ const newChecked = event.target.checked;
64
+ this.checked = newChecked;
65
+ this.lmvzChange.emit(newChecked);
66
+ };
67
+ render() {
68
+ return (h(Host, { key: '0a0f0e278a0ccd6739e7e9e82267c047efad74ad' }, h("span", { key: 'da93a2dd256c72171e7a423223a3738d6ca13ebb', class: "track" }, h("input", { key: '6e90ec39ec856fa38097e6224c7fed50b23088e5', type: "checkbox", role: "switch", id: this.toggleId, checked: this.checked, disabled: this.disabled, required: this.required, name: this.name, value: this.value, form: this.form, ref: (el) => (this.nativeInputElement = el), onChange: this.handleChange }), h("span", { key: '8fca08269e216b9a2840e7707fa5562220f8b36c', class: "thumb", "aria-hidden": "true" })), h("label", { key: 'f0a0842fef8c9fa3981b6d8c373a79fe0c33fad3', htmlFor: this.toggleId }, this.label)));
69
+ }
70
+ static get is() { return "lmvz-toggle"; }
71
+ static get encapsulation() { return "scoped"; }
72
+ static get formAssociated() { return true; }
73
+ static get originalStyleUrls() {
74
+ return {
75
+ "$": ["./lmvz-toggle.css"]
76
+ };
77
+ }
78
+ static get styleUrls() {
79
+ return {
80
+ "$": ["lmvz-toggle.css"]
81
+ };
82
+ }
83
+ static get properties() {
84
+ return {
85
+ "label": {
86
+ "type": "string",
87
+ "mutable": false,
88
+ "complexType": {
89
+ "original": "string",
90
+ "resolved": "string",
91
+ "references": {}
92
+ },
93
+ "required": true,
94
+ "optional": false,
95
+ "docs": {
96
+ "tags": [],
97
+ "text": "Label text for the toggle"
98
+ },
99
+ "getter": false,
100
+ "setter": false,
101
+ "reflect": false,
102
+ "attribute": "label"
103
+ },
104
+ "checked": {
105
+ "type": "boolean",
106
+ "mutable": true,
107
+ "complexType": {
108
+ "original": "boolean",
109
+ "resolved": "boolean",
110
+ "references": {}
111
+ },
112
+ "required": false,
113
+ "optional": false,
114
+ "docs": {
115
+ "tags": [{
116
+ "name": "default",
117
+ "text": "false"
118
+ }],
119
+ "text": "Whether the toggle is checked"
120
+ },
121
+ "getter": false,
122
+ "setter": false,
123
+ "reflect": true,
124
+ "attribute": "checked",
125
+ "defaultValue": "false"
126
+ },
127
+ "disabled": {
128
+ "type": "boolean",
129
+ "mutable": false,
130
+ "complexType": {
131
+ "original": "boolean",
132
+ "resolved": "boolean",
133
+ "references": {}
134
+ },
135
+ "required": false,
136
+ "optional": false,
137
+ "docs": {
138
+ "tags": [{
139
+ "name": "default",
140
+ "text": "false"
141
+ }],
142
+ "text": "Whether the toggle is disabled"
143
+ },
144
+ "getter": false,
145
+ "setter": false,
146
+ "reflect": true,
147
+ "attribute": "disabled",
148
+ "defaultValue": "false"
149
+ },
150
+ "required": {
151
+ "type": "boolean",
152
+ "mutable": false,
153
+ "complexType": {
154
+ "original": "boolean",
155
+ "resolved": "boolean",
156
+ "references": {}
157
+ },
158
+ "required": false,
159
+ "optional": false,
160
+ "docs": {
161
+ "tags": [{
162
+ "name": "default",
163
+ "text": "false"
164
+ }],
165
+ "text": "Whether the toggle is required"
166
+ },
167
+ "getter": false,
168
+ "setter": false,
169
+ "reflect": true,
170
+ "attribute": "required",
171
+ "defaultValue": "false"
172
+ },
173
+ "name": {
174
+ "type": "string",
175
+ "mutable": false,
176
+ "complexType": {
177
+ "original": "string",
178
+ "resolved": "string | undefined",
179
+ "references": {}
180
+ },
181
+ "required": false,
182
+ "optional": true,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": "Name attribute for form integration"
186
+ },
187
+ "getter": false,
188
+ "setter": false,
189
+ "reflect": false,
190
+ "attribute": "name"
191
+ },
192
+ "value": {
193
+ "type": "string",
194
+ "mutable": false,
195
+ "complexType": {
196
+ "original": "string",
197
+ "resolved": "string",
198
+ "references": {}
199
+ },
200
+ "required": false,
201
+ "optional": false,
202
+ "docs": {
203
+ "tags": [{
204
+ "name": "default",
205
+ "text": "'on'"
206
+ }],
207
+ "text": "Value submitted with the form when checked"
208
+ },
209
+ "getter": false,
210
+ "setter": false,
211
+ "reflect": false,
212
+ "attribute": "value",
213
+ "defaultValue": "'on'"
214
+ },
215
+ "form": {
216
+ "type": "string",
217
+ "mutable": false,
218
+ "complexType": {
219
+ "original": "string",
220
+ "resolved": "string | undefined",
221
+ "references": {}
222
+ },
223
+ "required": false,
224
+ "optional": true,
225
+ "docs": {
226
+ "tags": [],
227
+ "text": "Form id to associate with"
228
+ },
229
+ "getter": false,
230
+ "setter": false,
231
+ "reflect": false,
232
+ "attribute": "form"
233
+ }
234
+ };
235
+ }
236
+ static get events() {
237
+ return [{
238
+ "method": "lmvzChange",
239
+ "name": "lmvzChange",
240
+ "bubbles": true,
241
+ "cancelable": true,
242
+ "composed": true,
243
+ "docs": {
244
+ "tags": [],
245
+ "text": "Emitted when the toggle is switched. Event detail is the new checked state."
246
+ },
247
+ "complexType": {
248
+ "original": "boolean",
249
+ "resolved": "boolean",
250
+ "references": {}
251
+ }
252
+ }];
253
+ }
254
+ static get methods() {
255
+ return {
256
+ "focusToggle": {
257
+ "complexType": {
258
+ "signature": "() => Promise<void>",
259
+ "parameters": [],
260
+ "references": {
261
+ "Promise": {
262
+ "location": "global",
263
+ "id": "global::Promise"
264
+ }
265
+ },
266
+ "return": "Promise<void>"
267
+ },
268
+ "docs": {
269
+ "text": "Sets focus on the toggle",
270
+ "tags": []
271
+ }
272
+ },
273
+ "blurToggle": {
274
+ "complexType": {
275
+ "signature": "() => Promise<void>",
276
+ "parameters": [],
277
+ "references": {
278
+ "Promise": {
279
+ "location": "global",
280
+ "id": "global::Promise"
281
+ }
282
+ },
283
+ "return": "Promise<void>"
284
+ },
285
+ "docs": {
286
+ "text": "Removes focus from the toggle",
287
+ "tags": []
288
+ }
289
+ },
290
+ "checkValidity": {
291
+ "complexType": {
292
+ "signature": "() => Promise<boolean>",
293
+ "parameters": [],
294
+ "references": {
295
+ "Promise": {
296
+ "location": "global",
297
+ "id": "global::Promise"
298
+ }
299
+ },
300
+ "return": "Promise<boolean>"
301
+ },
302
+ "docs": {
303
+ "text": "Returns whether the toggle satisfies its validation constraints",
304
+ "tags": []
305
+ }
306
+ },
307
+ "reportValidity": {
308
+ "complexType": {
309
+ "signature": "() => Promise<boolean>",
310
+ "parameters": [],
311
+ "references": {
312
+ "Promise": {
313
+ "location": "global",
314
+ "id": "global::Promise"
315
+ }
316
+ },
317
+ "return": "Promise<boolean>"
318
+ },
319
+ "docs": {
320
+ "text": "Reports validation errors to the user",
321
+ "tags": []
322
+ }
323
+ },
324
+ "getInputElement": {
325
+ "complexType": {
326
+ "signature": "() => Promise<HTMLInputElement | undefined>",
327
+ "parameters": [],
328
+ "references": {
329
+ "Promise": {
330
+ "location": "global",
331
+ "id": "global::Promise"
332
+ },
333
+ "HTMLInputElement": {
334
+ "location": "global",
335
+ "id": "global::HTMLInputElement"
336
+ }
337
+ },
338
+ "return": "Promise<HTMLInputElement | undefined>"
339
+ },
340
+ "docs": {
341
+ "text": "Returns the native HTMLInputElement.\n\nPromise resolves when the element is ready and the input is available.",
342
+ "tags": []
343
+ }
344
+ }
345
+ };
346
+ }
347
+ static get elementRef() { return "el"; }
348
+ static get watchers() {
349
+ return [{
350
+ "propName": "checked",
351
+ "methodName": "handleCheckedChange"
352
+ }, {
353
+ "propName": "disabled",
354
+ "methodName": "handleDisabledChange"
355
+ }];
356
+ }
357
+ static get attachInternalsMemberName() { return "internals"; }
358
+ }
@@ -20,7 +20,7 @@ export class HeaderIntegration {
20
20
  this.activeNav = navId;
21
21
  }
22
22
  render() {
23
- return (h(Host, { key: '83ffaf59132a1890e428eda0d86ce42e200b3dd0' }, h("lmvz-header", { key: '43400e9ceaff3b4df1d4f9cf1019e07464222cbe', lmvzActiveNav: this.activeNav }, h("lmvz-menuitem", { key: '00f199bf22fe04763b94cb0a8915d77d6f42c073', slot: "nav-primary", id: "lehrmittel", onLmvzActivation: this.activate.bind(this) }, h("a", { key: '32b5ac9a962b1c0f6d4eca27f50442088edcccf8', href: "#" }, "Lehrmittel")), h("lmvz-menuitem", { key: 'ddbd5ff9c0cb2c6eca762e8b259f3b6c9f54ad4e', slot: "nav-primary", id: "verwaltung", onLmvzActivation: this.activate.bind(this) }, h("a", { key: '86ec5784b091c691759e516dc061bde41bf25d42', href: "#" }, "Verwaltung")), h("lmvz-menuitem", { key: '9af310fcad4eee7ae42025c0a0e562e2db762958', slot: "connect-nav-lehrmittel" }, h("lmvz-icon", { key: '5d8e64e95b9d7187bff280bf7acb8b73e80de940', ...typedIconFromSet('lmvz', 'edit') }), "Deutsch 7"), h("lmvz-menuitem", { key: '42f40b68ee3b27323a3802ebabe4d6b61e742b92', slot: "connect-nav-lehrmittel" }, h("lmvz-icon", { key: '2fd1777696e789a89a5775f41b8dd9e8946de0f6', ...typedIconFromSet('lmvz', 'edit') }), "Mathe 2"), h("lmvz-menuitem", { key: 'da08ce4e9d54f675c7da39ebd963b5830185e299', slot: "connect-nav-verwaltung" }, h("lmvz-icon", { key: '82e074c463ca9115fef3ffffc34646f9f91135d6', ...typedIconFromSet('lmvz', 'settings') }), "iwas mit Verwaltung"), h("lmvz-menuitem", { key: '0abaf7cb24e699e0a71c407dc02b671e588ff777', slot: "connect-nav-verwaltung", "aria-label": "Einstellungen" }, h("lmvz-icon", { key: '01146d2a899330f39538df782c14fad3ab440174', ...typedIconFromSet('lmvz', 'settings') })), h("lmvz-button", { key: '8654a845ae45439ea4be43357e0cc3dba38ad34d', slot: "actions", "aria-label": "Benutzerkonto" }, h("lmvz-icon", { key: '39754f979f8d7616afcad9ff87f94820e6ad166c', ...typedIconFromSet('lmvz', 'user'), size: "lg" })))));
23
+ return (h(Host, { key: '591e69a796357032fdefd54e81977cb6b818b653' }, h("lmvz-header", { key: 'bfc51bdc2979100082f210ad020ad3884837a1e7', lmvzActiveNav: this.activeNav }, h("lmvz-menuitem", { key: '808ee90cc2dbcaf59b1490ac4d59f0b8d445dace', slot: "nav-primary", id: "lehrmittel", onLmvzActivation: this.activate.bind(this) }, h("a", { key: '08e8f747bae27ab19e58c44a28d3661ea4a019f6', href: "#" }, "Lehrmittel")), h("lmvz-menuitem", { key: '5419724b8b29543206c33716bdd38edbb9e0ef25', slot: "nav-primary", id: "verwaltung", onLmvzActivation: this.activate.bind(this) }, h("a", { key: '04ea3fe11c3f64a1d023b71b496c44e8b6b4662b', href: "#" }, "Verwaltung")), h("lmvz-menuitem", { key: '4a0dc144d0e429d21fa8817973d5882aac6f11bb', slot: "connect-nav-lehrmittel" }, h("lmvz-icon", { key: 'b5e34ca29bb787409f1ff2d73e150e1f47e32afb', ...typedIconFromSet('lmvz', 'edit') }), "Deutsch 7"), h("lmvz-menuitem", { key: '53ffb0fa8d8bcd35c5860d1594ec23edd4b64102', slot: "connect-nav-lehrmittel" }, h("lmvz-icon", { key: '7959e991e4414173530efa34b2e12cb402a1c866', ...typedIconFromSet('lmvz', 'edit') }), "Mathe 2"), h("lmvz-menuitem", { key: '572a57ebfb71241913aa77c63ac21117aa66800a', slot: "connect-nav-verwaltung" }, h("lmvz-icon", { key: '758cc39b1cf02168a11090f393d51e18a36b0d01', ...typedIconFromSet('lmvz', 'settings') }), "iwas mit Verwaltung"), h("lmvz-menuitem", { key: '47e14b75d64977fb871c907e199d37e5695c8d2d', slot: "connect-nav-verwaltung", "aria-label": "Einstellungen" }, h("lmvz-icon", { key: '19c4ca2458449afa9eeceb5b8aea972f85b9be0a', ...typedIconFromSet('lmvz', 'settings') })), h("lmvz-button", { key: '272b2252ae3890f09b7c380579f856990c8167a9', slot: "actions", "aria-label": "Benutzerkonto" }, h("lmvz-icon", { key: 'c32fa138419eec95caabfcffbc22cc6e25b24559', ...typedIconFromSet('lmvz', 'user'), size: "lg" })))));
24
24
  }
25
25
  static get is() { return "header-integration"; }
26
26
  static get encapsulation() { return "shadow"; }