@sebgroup/green-core 3.5.1 → 3.6.3

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.
Files changed (41) hide show
  1. package/components/checkbox/checkbox.component.js +12 -2
  2. package/components/form/form-control.d.ts +6 -0
  3. package/components/form/form-control.js +8 -0
  4. package/components/index.d.ts +1 -0
  5. package/components/index.js +1 -0
  6. package/components/input/input.component.d.ts +1 -1
  7. package/components/input/input.component.js +2 -1
  8. package/components/switch/index.d.ts +1 -0
  9. package/components/switch/index.js +1 -0
  10. package/components/switch/switch.component.d.ts +44 -0
  11. package/components/switch/switch.component.js +185 -0
  12. package/components/switch/switch.d.ts +2 -0
  13. package/components/switch/switch.js +6 -0
  14. package/components/switch/switch.styles.d.ts +1 -0
  15. package/components/switch/switch.styles.js +239 -0
  16. package/custom-elements.json +120645 -119550
  17. package/gds-element.js +1 -1
  18. package/generated/mcp/components.json +14 -1
  19. package/generated/mcp/concepts/scoping.md +16 -1
  20. package/generated/mcp/guides/migration.md +4 -0
  21. package/generated/mcp/icons.json +1 -1
  22. package/generated/mcp/index.json +1 -1
  23. package/generated/mcp/input/api.md +1 -1
  24. package/generated/mcp/switch/angular.md +24 -0
  25. package/generated/mcp/switch/api.md +56 -0
  26. package/generated/mcp/switch/guidelines.md +35 -0
  27. package/generated/mcp/switch/index.json +9 -0
  28. package/generated/mcp/switch/react.md +24 -0
  29. package/generated/mcp/tokens.json +1 -1
  30. package/generated/react/index.d.ts +4 -3
  31. package/generated/react/index.js +4 -3
  32. package/generated/react/input/index.d.ts +2 -2
  33. package/generated/react/switch/index.d.ts +701 -0
  34. package/generated/react/switch/index.js +24 -0
  35. package/generated/react/textarea/index.d.ts +1 -1
  36. package/package.json +3 -1
  37. package/pure.d.ts +1 -0
  38. package/pure.js +1 -0
  39. package/utils/helpers/component-meta.d.ts +1 -0
  40. package/utils/helpers/component-meta.js +5 -4
  41. package/utils/helpers/custom-element-scoping.js +1 -1
@@ -4,7 +4,7 @@ import {
4
4
  __privateGet,
5
5
  __privateMethod
6
6
  } from "../../chunks/chunk.CAV4X6PU.js";
7
- var _toggleChecked, toggleChecked_fn, _handleInputChange, _dispatchChangeEvents, dispatchChangeEvents_fn;
7
+ var _toggleChecked, toggleChecked_fn, _handleInputChange, _syncFormValue, syncFormValue_fn, _dispatchChangeEvents, dispatchChangeEvents_fn;
8
8
  import { property, query } from "lit/decorators.js";
9
9
  import { when } from "lit/directives/when.js";
10
10
  import { GdsToggleControlBase } from "../../primitives/toggle-controls-base/toggle-control-base.component.js";
@@ -21,6 +21,7 @@ let GdsCheckbox = class extends GdsFormControlElement {
21
21
  constructor() {
22
22
  super(...arguments);
23
23
  __privateAdd(this, _toggleChecked);
24
+ __privateAdd(this, _syncFormValue);
24
25
  __privateAdd(this, _dispatchChangeEvents);
25
26
  this.label = "";
26
27
  this.supportingText = "";
@@ -58,7 +59,7 @@ let GdsCheckbox = class extends GdsFormControlElement {
58
59
  <input
59
60
  type="checkbox"
60
61
  class="visually-hidden-checkbox"
61
- ?checked=${this.checked}
62
+ .checked=${this.checked}
62
63
  ?disabled=${this.disabled}
63
64
  .indeterminate=${this.indeterminate}
64
65
  aria-invalid=${this.invalid}
@@ -108,8 +109,17 @@ toggleChecked_fn = function(e) {
108
109
  __privateMethod(this, _dispatchChangeEvents, dispatchChangeEvents_fn).call(this);
109
110
  };
110
111
  _handleInputChange = new WeakMap();
112
+ _syncFormValue = new WeakSet();
113
+ syncFormValue_fn = function() {
114
+ if (this.checked) {
115
+ this._setFormValue(this._internalValue || "on");
116
+ } else {
117
+ this._setFormValue(null);
118
+ }
119
+ };
111
120
  _dispatchChangeEvents = new WeakSet();
112
121
  dispatchChangeEvents_fn = function() {
122
+ __privateMethod(this, _syncFormValue, syncFormValue_fn).call(this);
113
123
  this.dispatchStandardEvent("change", {
114
124
  bubbles: true,
115
125
  composed: true
@@ -69,6 +69,12 @@ export declare abstract class GdsFormControlElement<ValueT = any> extends GdsEle
69
69
  protected formResetCallback(): void;
70
70
  protected formAssociatedCallback(form?: HTMLFormElement): void;
71
71
  protected _handleFormSubmit(e: Event): void;
72
+ /**
73
+ * Proxy for `ElementInternals.setFormValue()`. Subclasses can call this to
74
+ * set the value that will be submitted with the form without going through
75
+ * the `value` setter.
76
+ */
77
+ protected _setFormValue(value: FormData | string | null): void;
72
78
  /**
73
79
  * This should return a reference to the HTML element that the browser will refer to when the form control is invalid.
74
80
  * The reference is used when setting the validity state in ElementInternals.
@@ -151,6 +151,14 @@ class GdsFormControlElement extends GdsElement {
151
151
  if (!this.validity.valid)
152
152
  e.preventDefault();
153
153
  }
154
+ /**
155
+ * Proxy for `ElementInternals.setFormValue()`. Subclasses can call this to
156
+ * set the value that will be submitted with the form without going through
157
+ * the `value` setter.
158
+ */
159
+ _setFormValue(value) {
160
+ __privateGet(this, _internals).setFormValue(value);
161
+ }
154
162
  }
155
163
  _internals = new WeakMap();
156
164
  GdsFormControlElement.formAssociated = true;
@@ -38,6 +38,7 @@ export * from './segmented-control';
38
38
  export * from './select';
39
39
  export * from './signal';
40
40
  export * from './spinner';
41
+ export * from './switch';
41
42
  export * from './text';
42
43
  export * from './table';
43
44
  export * from './textarea';
@@ -38,6 +38,7 @@ export * from "./segmented-control/index.js";
38
38
  export * from "./select/index.js";
39
39
  export * from "./signal/index.js";
40
40
  export * from "./spinner/index.js";
41
+ export * from "./switch/index.js";
41
42
  export * from "./text/index.js";
42
43
  export * from "./table/index.js";
43
44
  export * from "./textarea/index.js";
@@ -35,7 +35,7 @@ declare class Input extends GdsFormControlElement<string> {
35
35
  * The type of input. Works the same as a native `<input>` element, but only a subset of types are supported. Defaults
36
36
  * to `text`.
37
37
  */
38
- type: 'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url';
38
+ type: 'date' | 'datetime-local' | 'email' | 'file' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url';
39
39
  /** The input's minimum value. Only applies to date and number input types. */
40
40
  min?: number | string;
41
41
  /** The input's maximum value. Only applies to date and number input types. */
@@ -9,6 +9,7 @@ var _charCounterComputed, _shouldShowFooter, shouldShowFooter_fn, _handleOnInput
9
9
  import { localized, msg } from "@lit/localize";
10
10
  import { property, query, queryAsync } from "lit/decorators.js";
11
11
  import { ifDefined } from "lit/directives/if-defined.js";
12
+ import { live } from "lit/directives/live.js";
12
13
  import { when } from "lit/directives/when.js";
13
14
  import { nothing } from "lit/html.js";
14
15
  import { GdsFieldBase } from "../../primitives/field-base/field-base.component.js";
@@ -271,7 +272,7 @@ renderNativeInput_fn = function() {
271
272
  @input=${__privateGet(this, _handleOnInput)}
272
273
  @keydown=${__privateGet(this, _handleOnKeyDown)}
273
274
  @change=${__privateGet(this, _handleOnChange)}
274
- .value=${this.value}
275
+ .value=${live(this.value)}
275
276
  id="input"
276
277
  ?disabled=${this.disabled}
277
278
  aria-describedby="supporting-text extended-supporting-text sub-label message"
@@ -0,0 +1 @@
1
+ export * from './switch';
@@ -0,0 +1 @@
1
+ export * from "./switch.js";
@@ -0,0 +1,44 @@
1
+ import { GdsFormControlElement } from '../form/form-control';
2
+ declare class Switch extends GdsFormControlElement<string> {
3
+ #private;
4
+ static styles: import("lit").CSSResult[];
5
+ /**
6
+ * The checked state of the switch.
7
+ */
8
+ checked: boolean;
9
+ /**
10
+ * Controls where the control is placed relative to the label.
11
+ */
12
+ controlPlacement: 'start' | 'end';
13
+ /**
14
+ * Controls text and control sizing.
15
+ */
16
+ size: 'large' | 'small';
17
+ /**
18
+ * Controls horizontal distribution of label and control.
19
+ */
20
+ 'justify-content': string;
21
+ private _input;
22
+ private _perimeter?;
23
+ /**
24
+ * The value submitted with the form when the switch is checked.
25
+ * Defaults to 'on', matching native checkbox behaviour.
26
+ */
27
+ get value(): string;
28
+ set value(val: string);
29
+ protected _getValidityAnchor(): HTMLElement;
30
+ protected formResetCallback(): void;
31
+ focus(options?: FocusOptions): void;
32
+ render(): any;
33
+ }
34
+ declare const GdsSwitch_base: (new (...args: any[]) => import("../../utils/mixins/declarative-layout-mixins").LayoutChildProps) & (new (...args: any[]) => import("../../utils/mixins/declarative-layout-mixins").MarginProps) & (new (...args: any[]) => import("../../utils/mixins/declarative-layout-mixins").SizeXProps) & typeof Switch;
35
+ /**
36
+ * @element gds-switch
37
+ * @status beta
38
+ *
39
+ * @event input - Dispatched when the checked state changes.
40
+ * @event change - Dispatched when the checked state changes.
41
+ */
42
+ export declare class GdsSwitch extends GdsSwitch_base {
43
+ }
44
+ export {};
@@ -0,0 +1,185 @@
1
+ import {
2
+ __decorateClass,
3
+ __privateAdd,
4
+ __privateGet,
5
+ __privateMethod
6
+ } from "../../chunks/chunk.CAV4X6PU.js";
7
+ var _renderNativeInput, renderNativeInput_fn, _renderLabel, renderLabel_fn, _renderThumb, renderThumb_fn, _renderTrack, renderTrack_fn, _handleChange, _dispatchChangeEvents, dispatchChangeEvents_fn, _handleKeyDown, _syncFormValue, syncFormValue_fn, _triggerPerimeterRipple, triggerPerimeterRipple_fn;
8
+ import { property, query } from "lit/decorators.js";
9
+ import { classMap } from "lit/directives/class-map.js";
10
+ import { ifDefined } from "lit/directives/if-defined.js";
11
+ import { gdsCustomElement, html } from "../../scoping.js";
12
+ import { styleExpressionProperty } from "../../utils/decorators/style-expression-property.js";
13
+ import {
14
+ withLayoutChildProps,
15
+ withMarginProps,
16
+ withSizeXProps
17
+ } from "../../utils/mixins/declarative-layout-mixins.js";
18
+ import { GdsFormControlElement } from "../form/form-control.js";
19
+ import { IconCheckmark } from "../icon/icons/checkmark.component.js";
20
+ import { styles } from "./switch.styles.js";
21
+ class Switch extends GdsFormControlElement {
22
+ constructor() {
23
+ super(...arguments);
24
+ __privateAdd(this, _renderNativeInput);
25
+ __privateAdd(this, _renderLabel);
26
+ __privateAdd(this, _renderThumb);
27
+ __privateAdd(this, _renderTrack);
28
+ __privateAdd(this, _dispatchChangeEvents);
29
+ __privateAdd(this, _syncFormValue);
30
+ __privateAdd(this, _triggerPerimeterRipple);
31
+ this.checked = false;
32
+ this.controlPlacement = "end";
33
+ this.size = "large";
34
+ this["justify-content"] = "flex-start";
35
+ __privateAdd(this, _handleChange, () => {
36
+ this.checked = this._input.checked;
37
+ __privateMethod(this, _triggerPerimeterRipple, triggerPerimeterRipple_fn).call(this);
38
+ __privateMethod(this, _dispatchChangeEvents, dispatchChangeEvents_fn).call(this);
39
+ });
40
+ __privateAdd(this, _handleKeyDown, (event) => {
41
+ if (this.disabled)
42
+ return;
43
+ if (event.key === "Enter") {
44
+ event.preventDefault();
45
+ this._input.click();
46
+ }
47
+ });
48
+ }
49
+ /**
50
+ * The value submitted with the form when the switch is checked.
51
+ * Defaults to 'on', matching native checkbox behaviour.
52
+ */
53
+ get value() {
54
+ return this._internalValue || "on";
55
+ }
56
+ set value(val) {
57
+ this._internalValue = val;
58
+ }
59
+ _getValidityAnchor() {
60
+ return this._input;
61
+ }
62
+ formResetCallback() {
63
+ this.checked = false;
64
+ this._internalValue = void 0;
65
+ }
66
+ focus(options) {
67
+ this._input?.focus(options);
68
+ }
69
+ render() {
70
+ const classes = {
71
+ switch: true,
72
+ checked: this.checked,
73
+ disabled: this.disabled,
74
+ "control-start": this.controlPlacement === "start",
75
+ small: this.size === "small"
76
+ };
77
+ return html`
78
+ <label class=${classMap(classes)} for="switch-input">
79
+ ${[__privateMethod(this, _renderNativeInput, renderNativeInput_fn).call(this), __privateMethod(this, _renderLabel, renderLabel_fn).call(this), __privateMethod(this, _renderTrack, renderTrack_fn).call(this)]}
80
+ </label>
81
+ `;
82
+ }
83
+ }
84
+ _renderNativeInput = new WeakSet();
85
+ renderNativeInput_fn = function() {
86
+ return html`
87
+ <input
88
+ id="switch-input"
89
+ type="checkbox"
90
+ role="switch"
91
+ .checked=${this.checked}
92
+ ?disabled=${this.disabled}
93
+ aria-label=${ifDefined(this.label ? void 0 : "Switch")}
94
+ @keydown=${__privateGet(this, _handleKeyDown)}
95
+ @change=${__privateGet(this, _handleChange)}
96
+ />
97
+ `;
98
+ };
99
+ _renderLabel = new WeakSet();
100
+ renderLabel_fn = function() {
101
+ if (!this.label)
102
+ return null;
103
+ return html`<span id="label" class="label">${this.label}</span>`;
104
+ };
105
+ _renderThumb = new WeakSet();
106
+ renderThumb_fn = function() {
107
+ return html`<span class="thumb">
108
+ <span class="perimeter"></span>
109
+ <gds-icon-checkmark
110
+ size="${this.size === "small" ? "xs" : "s"}"
111
+ stroke="4"
112
+ color=${this.disabled ? "neutral-05" : "positive-01"}
113
+ class="checkmark"
114
+ ></gds-icon-checkmark>
115
+ </span>`;
116
+ };
117
+ _renderTrack = new WeakSet();
118
+ renderTrack_fn = function() {
119
+ return html`
120
+ <span class="track" aria-hidden="true"> ${__privateMethod(this, _renderThumb, renderThumb_fn).call(this)} </span>
121
+ `;
122
+ };
123
+ _handleChange = new WeakMap();
124
+ _dispatchChangeEvents = new WeakSet();
125
+ dispatchChangeEvents_fn = function() {
126
+ __privateMethod(this, _syncFormValue, syncFormValue_fn).call(this);
127
+ this.dispatchStandardEvent("change", {
128
+ bubbles: true,
129
+ composed: true
130
+ });
131
+ this.dispatchStandardEvent("input", {
132
+ bubbles: true,
133
+ composed: true
134
+ });
135
+ };
136
+ _handleKeyDown = new WeakMap();
137
+ _syncFormValue = new WeakSet();
138
+ syncFormValue_fn = function() {
139
+ if (this.checked) {
140
+ this._setFormValue(this._internalValue || "on");
141
+ } else {
142
+ this._setFormValue(null);
143
+ }
144
+ };
145
+ _triggerPerimeterRipple = new WeakSet();
146
+ triggerPerimeterRipple_fn = function() {
147
+ const perimeter = this._perimeter;
148
+ if (!perimeter)
149
+ return;
150
+ perimeter.classList.remove("ripple");
151
+ void perimeter.offsetWidth;
152
+ perimeter.classList.add("ripple");
153
+ };
154
+ Switch.styles = [styles];
155
+ __decorateClass([
156
+ property({ type: Boolean, reflect: true })
157
+ ], Switch.prototype, "checked", 2);
158
+ __decorateClass([
159
+ property({ attribute: "control-placement", reflect: true })
160
+ ], Switch.prototype, "controlPlacement", 2);
161
+ __decorateClass([
162
+ property({ reflect: true })
163
+ ], Switch.prototype, "size", 2);
164
+ __decorateClass([
165
+ styleExpressionProperty({
166
+ selector: ".switch",
167
+ valueTemplate: (v) => v
168
+ })
169
+ ], Switch.prototype, "justify-content", 2);
170
+ __decorateClass([
171
+ query('input[type="checkbox"]')
172
+ ], Switch.prototype, "_input", 2);
173
+ __decorateClass([
174
+ query(".perimeter")
175
+ ], Switch.prototype, "_perimeter", 2);
176
+ let GdsSwitch = class extends withLayoutChildProps(
177
+ withMarginProps(withSizeXProps(Switch))
178
+ ) {
179
+ };
180
+ GdsSwitch = __decorateClass([
181
+ gdsCustomElement("gds-switch", { dependsOn: [IconCheckmark] })
182
+ ], GdsSwitch);
183
+ export {
184
+ GdsSwitch
185
+ };
@@ -0,0 +1,2 @@
1
+ import { GdsSwitch } from './switch.component';
2
+ export { GdsSwitch };
@@ -0,0 +1,6 @@
1
+ import "../../chunks/chunk.CAV4X6PU.js";
2
+ import { GdsSwitch } from "./switch.component.js";
3
+ GdsSwitch.define();
4
+ export {
5
+ GdsSwitch
6
+ };
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,239 @@
1
+ import "../../chunks/chunk.CAV4X6PU.js";
2
+ import { css } from "lit";
3
+ const style = css`
4
+ @media (prefers-reduced-motion: reduce) {
5
+ :is(.track, .thumb, .checkmark) {
6
+ transition: none;
7
+ }
8
+
9
+ .perimeter.ripple {
10
+ animation: none;
11
+ }
12
+ }
13
+
14
+ :host {
15
+ --switch-motion-track-duration: var(--gds-sys-motion-duration-default);
16
+ --switch-motion-thumb-duration: var(--gds-sys-motion-duration-fast);
17
+ --switch-motion-checkmark-duration: var(--gds-sys-motion-duration-default);
18
+ --switch-motion-ripple-duration: var(--gds-sys-motion-duration-default);
19
+ --switch-motion-ease: cubic-bezier(var(--gds-sys-motion-easing-ease-out));
20
+ --switch-gap: var(--gds-sys-space-s);
21
+ }
22
+
23
+ :host([disabled]) {
24
+ color: var(--gds-sys-color-content-disabled-01);
25
+ }
26
+
27
+ #switch-input {
28
+ position: absolute;
29
+ opacity: 0;
30
+ padding: 0;
31
+ margin: 0;
32
+ pointer-events: none;
33
+ }
34
+
35
+ .switch {
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: flex-start;
39
+ flex-direction: row;
40
+ gap: var(--switch-gap);
41
+ user-select: none;
42
+ cursor: pointer;
43
+ z-index: 1;
44
+ }
45
+
46
+ .label {
47
+ font: var(--gds-sys-text-detail-m-book);
48
+ }
49
+
50
+ .switch.control-start {
51
+ flex-direction: row-reverse;
52
+ }
53
+
54
+ .switch.disabled {
55
+ cursor: not-allowed;
56
+ }
57
+
58
+ .switch.small {
59
+ --switch-gap: var(--gds-sys-space-xs);
60
+ --switch-track-width: 38px;
61
+ --switch-track-height: 24px;
62
+ --switch-thumb-size: 12px;
63
+ --switch-thumb-size-checked: 16px;
64
+ --switch-thumb-top: 4px;
65
+ --switch-thumb-left: 4px;
66
+ --switch-thumb-top-checked: 2px;
67
+ --switch-thumb-left-checked: calc(
68
+ 100% - var(--switch-thumb-size-checked) - 2px
69
+ );
70
+ }
71
+
72
+ .switch.small .label {
73
+ font: var(--gds-sys-text-detail-s-book);
74
+ }
75
+
76
+ .switch:not(.small) {
77
+ --switch-track-width: 54px;
78
+ --switch-track-height: 32px;
79
+ --switch-thumb-size: 20px;
80
+ --switch-thumb-size-checked: 24px;
81
+ --switch-thumb-top: 4px;
82
+ --switch-thumb-left: 4px;
83
+ --switch-thumb-top-checked: 2px;
84
+ --switch-thumb-left-checked: calc(
85
+ 100% - var(--switch-thumb-size-checked) - 2px
86
+ );
87
+ }
88
+
89
+ :is(.track, .thumb, .perimeter) {
90
+ border-radius: var(--gds-sys-radius-max);
91
+ }
92
+
93
+ .track {
94
+ display: flex;
95
+ position: relative;
96
+ box-sizing: border-box;
97
+ width: var(--switch-track-width);
98
+ height: var(--switch-track-height);
99
+ border-width: var(--gds-sys-space-4xs);
100
+ border-style: solid;
101
+ border-color: var(--gds-sys-color-border-neutral-01);
102
+ outline-color: transparent;
103
+ outline-offset: var(--gds-sys-space-4xs);
104
+ outline-style: solid;
105
+ outline-width: var(--gds-sys-space-4xs);
106
+ transition:
107
+ background-color var(--switch-motion-track-duration)
108
+ var(--switch-motion-ease),
109
+ border-color var(--switch-motion-track-duration) var(--switch-motion-ease),
110
+ outline-color var(--switch-motion-track-duration)
111
+ var(--switch-motion-ease);
112
+ }
113
+
114
+ #switch-input:focus-visible ~ .track {
115
+ outline-color: var(--gds-sys-color-content-neutral-01);
116
+ }
117
+
118
+ .thumb {
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ position: relative;
123
+ background: var(--gds-sys-color-border-neutral-01);
124
+ width: var(--switch-thumb-size);
125
+ height: var(--switch-thumb-size);
126
+ top: var(--switch-thumb-top);
127
+ left: var(--switch-thumb-left);
128
+ transition:
129
+ top var(--switch-motion-thumb-duration) var(--switch-motion-ease),
130
+ left var(--switch-motion-thumb-duration) var(--switch-motion-ease),
131
+ width var(--switch-motion-thumb-duration) var(--switch-motion-ease),
132
+ height var(--switch-motion-thumb-duration) var(--switch-motion-ease),
133
+ background-color var(--switch-motion-thumb-duration)
134
+ var(--switch-motion-ease),
135
+ scale var(--switch-motion-thumb-duration) var(--switch-motion-ease);
136
+ }
137
+
138
+ .perimeter {
139
+ display: flex;
140
+ position: absolute;
141
+ inset: -6px;
142
+ z-index: -2;
143
+ background: color-mix(
144
+ in srgb,
145
+ var(--gds-sys-color-l3-neutral-03),
146
+ var(--gds-sys-color-state-neutral-01)
147
+ );
148
+ opacity: 0;
149
+ transform: scale(0);
150
+ pointer-events: none;
151
+ }
152
+
153
+ .perimeter.ripple {
154
+ animation: perimeter-pulse var(--switch-motion-ripple-duration)
155
+ var(--switch-motion-ease);
156
+ }
157
+
158
+ @keyframes perimeter-pulse {
159
+ from {
160
+ opacity: 1;
161
+ transform: scale(0);
162
+ }
163
+ to {
164
+ opacity: 0;
165
+ transform: scale(1.2);
166
+ }
167
+ }
168
+
169
+ .checkmark {
170
+ opacity: 0;
171
+ scale: 0;
172
+ transition:
173
+ scale var(--switch-motion-checkmark-duration) var(--switch-motion-ease),
174
+ opacity var(--switch-motion-checkmark-duration) var(--switch-motion-ease);
175
+ transform-origin: center;
176
+ }
177
+
178
+ @media (pointer: fine) {
179
+ .switch:not(.disabled):not(:active):hover .thumb {
180
+ scale: 1.085;
181
+ }
182
+ }
183
+
184
+ .checked {
185
+ .track {
186
+ background-color: var(--gds-sys-color-l3-positive-01);
187
+ border-color: var(--gds-sys-color-l3-positive-01);
188
+ }
189
+
190
+ .thumb {
191
+ top: var(--switch-thumb-top-checked);
192
+ left: var(--switch-thumb-left-checked);
193
+ width: var(--switch-thumb-size-checked);
194
+ height: var(--switch-thumb-size-checked);
195
+ background: var(--gds-sys-color-l3-neutral-01);
196
+ }
197
+
198
+ .checkmark {
199
+ opacity: 1;
200
+ scale: 1;
201
+ }
202
+
203
+ .perimeter {
204
+ background: color-mix(
205
+ in srgb,
206
+ var(--gds-sys-color-l3-positive-01),
207
+ var(--gds-sys-color-state-positive-01)
208
+ );
209
+ }
210
+ }
211
+
212
+ .switch.disabled .track {
213
+ background-color: var(--gds-sys-color-l3-disabled-01);
214
+ border-color: var(--gds-sys-color-content-disabled-01);
215
+ outline-color: transparent;
216
+ }
217
+
218
+ .switch.disabled .thumb {
219
+ background: var(--gds-sys-color-content-disabled-01);
220
+ }
221
+
222
+ .switch.disabled .perimeter {
223
+ background: var(--gds-sys-color-state-neutral-01);
224
+ }
225
+
226
+ .switch.disabled .track {
227
+ opacity: 0.6;
228
+ }
229
+
230
+ @media (prefers-color-scheme: dark) {
231
+ .switch.disabled .track {
232
+ opacity: 0.4;
233
+ }
234
+ }
235
+ `;
236
+ const styles = style;
237
+ export {
238
+ styles
239
+ };