@sebgroup/green-core 1.15.0 → 1.16.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/README.md +101 -7
- package/chunks/chunk.274BU2AI.js +244 -0
- package/chunks/chunk.2LQSDOD4.js +29 -0
- package/chunks/chunk.2ND5EWHE.js +65 -0
- package/chunks/chunk.2OOTOCUG.js +420 -0
- package/chunks/chunk.2WO4NHJ2.js +34 -0
- package/chunks/chunk.2Y3BHFKO.js +154 -0
- package/chunks/chunk.375BWME4.js +29 -0
- package/chunks/chunk.3SEVAGLE.js +96 -0
- package/chunks/chunk.522C22QY.js +460 -0
- package/chunks/chunk.5VURDMKE.js +75 -0
- package/chunks/chunk.6NM7ENKA.js +31 -0
- package/chunks/chunk.6UA66KQU.js +153 -0
- package/chunks/chunk.7P5N6NZL.js +560 -0
- package/chunks/chunk.7TCXY7BP.js +0 -0
- package/chunks/chunk.D7H7CUS4.js +55 -0
- package/chunks/chunk.DFYMYEGD.js +78 -0
- package/chunks/chunk.HS7ICQNA.js +0 -0
- package/chunks/chunk.IYCENQZG.js +28 -0
- package/chunks/chunk.J2A6J77W.js +81 -0
- package/chunks/chunk.KC32OWZE.js +274 -0
- package/chunks/chunk.KV4SDMFS.js +101 -0
- package/chunks/chunk.LUHCF4BJ.js +64 -0
- package/chunks/chunk.MAD5DQMN.js +161 -0
- package/chunks/chunk.MI4A2C2A.js +0 -0
- package/chunks/chunk.NOYHINYP.js +467 -0
- package/chunks/chunk.Q2T57HE7.js +0 -0
- package/chunks/chunk.QONSFT2N.js +4653 -0
- package/chunks/chunk.TMBQL2RO.js +0 -0
- package/chunks/chunk.TN6ZYAH3.js +74 -0
- package/chunks/chunk.TSDZQZBY.js +0 -0
- package/chunks/chunk.TX64TTBN.js +0 -0
- package/chunks/chunk.UF6IEONX.js +0 -0
- package/chunks/chunk.VOYMQ322.js +61 -0
- package/chunks/chunk.VYK7D6QO.js +64 -0
- package/chunks/chunk.WDZ2JTCP.js +360 -0
- package/chunks/chunk.WJDR7FTS.js +193 -0
- package/chunks/chunk.WM7HBMMV.js +54 -0
- package/chunks/chunk.XHTJVQUJ.js +140 -0
- package/chunks/chunk.XI4H54TV.js +39 -0
- package/chunks/chunk.XU4HZLJL.js +0 -0
- package/chunks/chunk.YIQIH4RW.js +139 -0
- package/chunks/chunk.YJHAKLGR.js +54 -0
- package/chunks/chunk.YO24ZYAD.js +0 -0
- package/chunks/chunk.ZTE73BY2.js +655 -0
- package/components/badge/badge.js +245 -0
- package/components/button/button.d.ts +5 -5
- package/components/button/button.js +18 -0
- package/components/button/button.trans.styles.d.ts +2 -0
- package/components/button/index.d.ts +1 -0
- package/components/button/index.js +18 -0
- package/components/checkbox/checkbox.js +219 -0
- package/components/context-menu/context-menu.d.ts +2 -1
- package/components/context-menu/context-menu.js +22 -0
- package/components/context-menu/index.d.ts +3 -0
- package/components/context-menu/index.js +29 -0
- package/components/datepicker/date-part-spinner.js +10 -0
- package/components/datepicker/datepicker.d.ts +3 -2
- package/components/datepicker/datepicker.js +29 -0
- package/components/datepicker/index.d.ts +1 -0
- package/components/datepicker/index.js +29 -0
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +22 -0
- package/components/dropdown/index.d.ts +3 -0
- package/components/dropdown/index.js +30 -0
- package/components/form-control.js +12 -0
- package/components/grid/grid.d.ts +2 -2
- package/components/grid/grid.js +11 -0
- package/components/grid/grid.style.css.js +7 -0
- package/components/grid/index.d.ts +1 -0
- package/components/grid/index.js +11 -0
- package/components/grouped-list/grouped-list.js +14 -0
- package/components/grouped-list/index.d.ts +2 -0
- package/components/grouped-list/index.js +17 -0
- package/components/grouped-list/list-item.js +10 -0
- package/components/icon/icon.d.ts +2 -2
- package/components/icon/icon.js +10 -0
- package/components/icon/index.d.ts +1 -0
- package/components/icon/index.js +10 -0
- package/components/index.d.ts +4 -3
- package/components/index.js +81 -0
- package/components/input/input.js +682 -0
- package/components/radio/radio-group.js +9 -0
- package/components/radio/radio.js +240 -0
- package/components/segmented-control/index.d.ts +1 -0
- package/components/segmented-control/index.js +15 -0
- package/components/segmented-control/segment/index.d.ts +1 -0
- package/components/segmented-control/segment/index.js +13 -0
- package/components/segmented-control/segment/segment.js +12 -0
- package/components/segmented-control/segmented-control.d.ts +1 -1
- package/components/segmented-control/segmented-control.js +15 -0
- package/components/switch/switch.js +164 -0
- package/components/theme/index.d.ts +1 -0
- package/components/theme/index.js +11 -0
- package/components/theme/theme.js +11 -0
- package/components/tooltip/tooltip.js +252 -0
- package/index.js +72 -4278
- package/localization.js +40 -44
- package/package.json +7 -16
- package/primitives/calendar/calendar.js +13 -0
- package/primitives/calendar/functions.js +7 -0
- package/primitives/calendar/index.d.ts +1 -0
- package/primitives/calendar/index.js +14 -0
- package/primitives/listbox/index.d.ts +0 -1
- package/primitives/listbox/index.js +17 -0
- package/primitives/listbox/listbox.d.ts +2 -1
- package/primitives/listbox/listbox.js +16 -0
- package/primitives/listbox/option.js +14 -0
- package/primitives/menu/index.d.ts +1 -0
- package/primitives/menu/index.js +15 -0
- package/primitives/menu/menu-heading.js +11 -0
- package/primitives/menu/menu-item.d.ts +1 -2
- package/primitives/menu/menu-item.js +12 -0
- package/primitives/menu/menu.d.ts +2 -1
- package/primitives/menu/menu.js +14 -0
- package/primitives/popover/index.js +14 -0
- package/primitives/popover/popover.js +13 -0
- package/primitives/ripple/index.d.ts +1 -0
- package/primitives/ripple/index.js +11 -0
- package/primitives/ripple/ripple.d.ts +1 -1
- package/primitives/ripple/ripple.js +10 -0
- package/scoping.d.ts +1 -0
- package/scoping.js +18 -0
- package/transitional-styles.js +6 -4275
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsRadioGroup
|
|
3
|
+
} from "../../chunks/chunk.TN6ZYAH3.js";
|
|
4
|
+
import "../../chunks/chunk.7TCXY7BP.js";
|
|
5
|
+
import {
|
|
6
|
+
constrainSlots
|
|
7
|
+
} from "../../chunks/chunk.6NM7ENKA.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass,
|
|
10
|
+
__privateAdd,
|
|
11
|
+
__privateSet
|
|
12
|
+
} from "../../chunks/chunk.5VURDMKE.js";
|
|
13
|
+
|
|
14
|
+
// libs/core/src/components/radio/radio.ts
|
|
15
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
16
|
+
import { customElement } from "lit/decorators.js";
|
|
17
|
+
|
|
18
|
+
// libs/core/src/components/radio/radio.css
|
|
19
|
+
var radio_default = `:host {
|
|
20
|
+
--gds-checkbox-bg-color: hsl(0, 0%, 100%);
|
|
21
|
+
--gds-checkbox-border-color: hsla(60, 4%, 50%, 1);
|
|
22
|
+
--gds-checkbox-border-width: 1px;
|
|
23
|
+
--gds-checkbox-border-radius: 200px;
|
|
24
|
+
--gds-checkbox-color-hover: hsla(60, 6%, 90%, 1);
|
|
25
|
+
--gds-checkbox-color-active: hsla(60, 4%, 85%, 1);
|
|
26
|
+
--gds-checkbox-checked-color: hsla(60, 4%, 20%, 1);
|
|
27
|
+
--gds-checkbox-color-tick: hsl(0, 0%, 100%);
|
|
28
|
+
--gds-radio-transition: all 248ms ease-in-out;
|
|
29
|
+
--gds-radio-transition-input: all 248ms cubic-bezier(0.2, 0.85, 0.32, 1.2);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media (prefers-color-scheme: dark) {
|
|
33
|
+
:host {
|
|
34
|
+
--gds-dark: none;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (prefers-reduced-motion: reduce) {
|
|
39
|
+
:host {
|
|
40
|
+
--gds-radio-transition: none;
|
|
41
|
+
--gds-radio-transition-input: none;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
46
|
+
:host {
|
|
47
|
+
--gds-input-transparency: 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@media (prefers-contrast: more) {
|
|
52
|
+
:host {
|
|
53
|
+
--gds-input-color-bg: hsla(60, 4%, 96%, 1);
|
|
54
|
+
--gds-input-color-outline-alpha: 0%;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.gds-radio {
|
|
59
|
+
align-items: center;
|
|
60
|
+
border-radius: var(--gds-checkbox-border-radius);
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
display: flex;
|
|
63
|
+
height: 32px;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
position: relative;
|
|
66
|
+
transition: var(--gds-radio-transition);
|
|
67
|
+
width: 32px;
|
|
68
|
+
|
|
69
|
+
input {
|
|
70
|
+
-webkit-appearance: none;
|
|
71
|
+
-moz-appearance: none;
|
|
72
|
+
appearance: none;
|
|
73
|
+
aspect-ratio: 1/1;
|
|
74
|
+
background-color: var(--gds-checkbox-bg-color);
|
|
75
|
+
border: var(--gds-checkbox-border-width) solid
|
|
76
|
+
var(--gds-checkbox-border-color);
|
|
77
|
+
border-radius: var(--gds-checkbox-border-radius);
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
height: 16px;
|
|
81
|
+
margin: unset;
|
|
82
|
+
padding: unset;
|
|
83
|
+
position: relative;
|
|
84
|
+
transition: var(--gds-radio-transition-input);
|
|
85
|
+
width: 16px;
|
|
86
|
+
|
|
87
|
+
&:checked {
|
|
88
|
+
border-color: var(--gds-checkbox-checked-color);
|
|
89
|
+
border-width: 4px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&[indeterminate],
|
|
93
|
+
&:indeterminate {
|
|
94
|
+
&::after {
|
|
95
|
+
border-left: 0;
|
|
96
|
+
border-radius: 0;
|
|
97
|
+
border-top: 0;
|
|
98
|
+
height: var(--gds-checkbox-border-width);
|
|
99
|
+
inset: 5px 0 0 2px;
|
|
100
|
+
opacity: 1;
|
|
101
|
+
rotate: 0deg;
|
|
102
|
+
scale: 1;
|
|
103
|
+
width: 8px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:disabled {
|
|
108
|
+
cursor: not-allowed;
|
|
109
|
+
opacity: 0.5;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&:hover:has(input:not([disabled])) {
|
|
114
|
+
background-color: var(--gds-checkbox-color-hover);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&:active:has(input:not([disabled])) {
|
|
118
|
+
background-color: var(--gds-checkbox-color-active);
|
|
119
|
+
|
|
120
|
+
.gds-checkbox-core {
|
|
121
|
+
border-color: var(--gds-checkbox-checked-color);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&:has(input:checked) {
|
|
126
|
+
background-color: var(--gds-checkbox-color-hover);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&:has(input:disabled) {
|
|
130
|
+
cursor: not-allowed;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Invalid state */
|
|
134
|
+
&:has(input:invalid) {
|
|
135
|
+
--gds-checkbox-bg-color: hsla(13, 75%, 95%, 1);
|
|
136
|
+
--gds-checkbox-border-color: hsla(9, 75%, 38%, 1);
|
|
137
|
+
--gds-checkbox-color-hover: hsla(12, 75%, 91%, 1);
|
|
138
|
+
--gds-checkbox-color-active: hsla(12, 78%, 86%, 1);
|
|
139
|
+
--gds-checkbox-checked-color: hsla(9, 75%, 38%, 1);
|
|
140
|
+
--gds-checkbox-color-tick: hsla(0, 0%, 100%, 1);
|
|
141
|
+
|
|
142
|
+
input {
|
|
143
|
+
&::after {
|
|
144
|
+
border-color: var(--gds-checkbox-color-tick);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:checked {
|
|
148
|
+
background-color: var(--gds-checkbox-checked-color);
|
|
149
|
+
border-color: var(--gds-checkbox-checked-color);
|
|
150
|
+
color: var(--gds-checkbox-checked-color-tick);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&:hover:has(input:not([disabled])) {
|
|
155
|
+
background-color: var(--gds-checkbox-color-hover);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:active:has(input:not([disabled])) {
|
|
159
|
+
background-color: var(--gds-checkbox-color-active);
|
|
160
|
+
|
|
161
|
+
.gds-checkbox-core {
|
|
162
|
+
border-color: var(--gds-checkbox-checked-color);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&:has(input:checked) {
|
|
167
|
+
background-color: var(--gds-checkbox-color-hover);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.gds-radio-group {
|
|
173
|
+
-webkit-appearance: none;
|
|
174
|
+
-moz-appearance: none;
|
|
175
|
+
appearance: none;
|
|
176
|
+
border: 0;
|
|
177
|
+
padding: 0;
|
|
178
|
+
}
|
|
179
|
+
`;
|
|
180
|
+
|
|
181
|
+
// libs/core/src/components/radio/radio.ts
|
|
182
|
+
var _internals;
|
|
183
|
+
var GdsRadio = class extends LitElement {
|
|
184
|
+
constructor() {
|
|
185
|
+
super();
|
|
186
|
+
// Private members
|
|
187
|
+
__privateAdd(this, _internals, void 0);
|
|
188
|
+
this.inputElement = null;
|
|
189
|
+
this.exludeAttr = ["id", "label"];
|
|
190
|
+
__privateSet(this, _internals, this.attachInternals());
|
|
191
|
+
constrainSlots(this);
|
|
192
|
+
}
|
|
193
|
+
reflectAttributesToInput() {
|
|
194
|
+
if (this.inputElement) {
|
|
195
|
+
const attributes = this.attributes;
|
|
196
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
197
|
+
const attribute = attributes[i];
|
|
198
|
+
if (!this.exludeAttr.includes(attribute.name)) {
|
|
199
|
+
this.inputElement.setAttribute(attribute.name, attribute.value);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
update(changedProperties) {
|
|
205
|
+
var _a;
|
|
206
|
+
super.update(changedProperties);
|
|
207
|
+
if (!this.inputElement) {
|
|
208
|
+
this.inputElement = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(
|
|
209
|
+
"radio"
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
this.reflectAttributesToInput();
|
|
213
|
+
}
|
|
214
|
+
handleClick() {
|
|
215
|
+
const radioGroup = this.closest("gds-radio-group");
|
|
216
|
+
if (radioGroup instanceof GdsRadioGroup) {
|
|
217
|
+
radioGroup.selectedValue = this.value;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
render() {
|
|
221
|
+
return html`
|
|
222
|
+
<label class="gds-radio">
|
|
223
|
+
<input id="radio" type="radio" />
|
|
224
|
+
</label>
|
|
225
|
+
<label for="radio">${this.textContent}</label>
|
|
226
|
+
`;
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
_internals = new WeakMap();
|
|
230
|
+
GdsRadio.styles = unsafeCSS(radio_default);
|
|
231
|
+
GdsRadio.shadowRootOptions = {
|
|
232
|
+
mode: "open",
|
|
233
|
+
delegatesFocus: true
|
|
234
|
+
};
|
|
235
|
+
GdsRadio = __decorateClass([
|
|
236
|
+
customElement("gds-radio")
|
|
237
|
+
], GdsRadio);
|
|
238
|
+
export {
|
|
239
|
+
GdsRadio
|
|
240
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './segmented-control';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsSegmentedControl
|
|
3
|
+
} from "../../chunks/chunk.522C22QY.js";
|
|
4
|
+
import "../../chunks/chunk.TSDZQZBY.js";
|
|
5
|
+
import "../../chunks/chunk.3SEVAGLE.js";
|
|
6
|
+
import "../../chunks/chunk.7P5N6NZL.js";
|
|
7
|
+
import "../../chunks/chunk.QONSFT2N.js";
|
|
8
|
+
import "../../chunks/chunk.2LQSDOD4.js";
|
|
9
|
+
import "../../chunks/chunk.YO24ZYAD.js";
|
|
10
|
+
import "../../chunks/chunk.2WO4NHJ2.js";
|
|
11
|
+
import "../../chunks/chunk.VOYMQ322.js";
|
|
12
|
+
import "../../chunks/chunk.5VURDMKE.js";
|
|
13
|
+
export {
|
|
14
|
+
GdsSegmentedControl
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './segment';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "../../../chunks/chunk.TSDZQZBY.js";
|
|
2
|
+
import {
|
|
3
|
+
GdsSegment
|
|
4
|
+
} from "../../../chunks/chunk.3SEVAGLE.js";
|
|
5
|
+
import "../../../chunks/chunk.7P5N6NZL.js";
|
|
6
|
+
import "../../../chunks/chunk.QONSFT2N.js";
|
|
7
|
+
import "../../../chunks/chunk.2LQSDOD4.js";
|
|
8
|
+
import "../../../chunks/chunk.YO24ZYAD.js";
|
|
9
|
+
import "../../../chunks/chunk.VOYMQ322.js";
|
|
10
|
+
import "../../../chunks/chunk.5VURDMKE.js";
|
|
11
|
+
export {
|
|
12
|
+
GdsSegment
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsSegment
|
|
3
|
+
} from "../../../chunks/chunk.3SEVAGLE.js";
|
|
4
|
+
import "../../../chunks/chunk.7P5N6NZL.js";
|
|
5
|
+
import "../../../chunks/chunk.QONSFT2N.js";
|
|
6
|
+
import "../../../chunks/chunk.2LQSDOD4.js";
|
|
7
|
+
import "../../../chunks/chunk.YO24ZYAD.js";
|
|
8
|
+
import "../../../chunks/chunk.VOYMQ322.js";
|
|
9
|
+
import "../../../chunks/chunk.5VURDMKE.js";
|
|
10
|
+
export {
|
|
11
|
+
GdsSegment
|
|
12
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GdsElement } from '../../gds-element';
|
|
2
|
-
import { GdsSegment } from '
|
|
2
|
+
import { GdsSegment } from '../../components/segmented-control/segment';
|
|
3
3
|
/**
|
|
4
4
|
* @element gds-segmented-control
|
|
5
5
|
* A segmented control is a group of 2-5 buttons that lets the user switch views or sort elements.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsSegmentedControl
|
|
3
|
+
} from "../../chunks/chunk.522C22QY.js";
|
|
4
|
+
import "../../chunks/chunk.TSDZQZBY.js";
|
|
5
|
+
import "../../chunks/chunk.3SEVAGLE.js";
|
|
6
|
+
import "../../chunks/chunk.7P5N6NZL.js";
|
|
7
|
+
import "../../chunks/chunk.QONSFT2N.js";
|
|
8
|
+
import "../../chunks/chunk.2LQSDOD4.js";
|
|
9
|
+
import "../../chunks/chunk.YO24ZYAD.js";
|
|
10
|
+
import "../../chunks/chunk.2WO4NHJ2.js";
|
|
11
|
+
import "../../chunks/chunk.VOYMQ322.js";
|
|
12
|
+
import "../../chunks/chunk.5VURDMKE.js";
|
|
13
|
+
export {
|
|
14
|
+
GdsSegmentedControl
|
|
15
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import "../../chunks/chunk.7TCXY7BP.js";
|
|
2
|
+
import {
|
|
3
|
+
constrainSlots
|
|
4
|
+
} from "../../chunks/chunk.6NM7ENKA.js";
|
|
5
|
+
import {
|
|
6
|
+
__decorateClass,
|
|
7
|
+
__privateAdd,
|
|
8
|
+
__privateSet
|
|
9
|
+
} from "../../chunks/chunk.5VURDMKE.js";
|
|
10
|
+
|
|
11
|
+
// libs/core/src/components/switch/switch.ts
|
|
12
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
13
|
+
import { customElement } from "lit/decorators.js";
|
|
14
|
+
|
|
15
|
+
// libs/core/src/components/switch/switch.css
|
|
16
|
+
var switch_default = `:host {
|
|
17
|
+
--gds-checkbox-bg-color: hsl(0, 0%, 100%);
|
|
18
|
+
--gds-checkbox-border-color: hsla(60, 4%, 20%, 1);
|
|
19
|
+
--gds-checkbox-border-width: 7.5px;
|
|
20
|
+
--gds-checkbox-border-radius: 200px;
|
|
21
|
+
--gds-checkbox-color-hover: hsla(60, 6%, 90%, 1);
|
|
22
|
+
--gds-checkbox-color-active: hsla(60, 4%, 85%, 1);
|
|
23
|
+
--gds-checkbox-checked-color: hsla(130, 40%, 30%, 1);
|
|
24
|
+
--gds-checkbox-color-tick: hsl(0, 0%, 100%);
|
|
25
|
+
--gds-switch-transition: all 548ms ease-in-out;
|
|
26
|
+
--gds-switch-animaton-on: 248ms;
|
|
27
|
+
--gds-switch-animaton-off: 248ms;
|
|
28
|
+
--gds-switch-animaton-transition: all 248ms cubic-bezier(0.2, 0.85, 0.32, 1.2);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media (prefers-reduced-motion: reduce) {
|
|
32
|
+
:host {
|
|
33
|
+
--gds-switch-transition: none;
|
|
34
|
+
--gds-switch-animaton-on: 0ms;
|
|
35
|
+
--gds-switch-animaton-off: 0ms;
|
|
36
|
+
--gds-switch-animaton-transition: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.gds-switch {
|
|
41
|
+
align-items: center;
|
|
42
|
+
background-color: var(--gds-checkbox-color-hover);
|
|
43
|
+
border-radius: var(--gds-checkbox-border-radius);
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
display: flex;
|
|
46
|
+
height: 32px;
|
|
47
|
+
justify-content: flex-start;
|
|
48
|
+
position: relative;
|
|
49
|
+
transition: var(--gds-switch-transition);
|
|
50
|
+
width: 64px;
|
|
51
|
+
|
|
52
|
+
input {
|
|
53
|
+
-webkit-appearance: none;
|
|
54
|
+
-moz-appearance: none;
|
|
55
|
+
appearance: none;
|
|
56
|
+
background-color: var(--gds-checkbox-bg-color);
|
|
57
|
+
border: var(--gds-checkbox-border-width) solid
|
|
58
|
+
var(--gds-checkbox-border-color);
|
|
59
|
+
border-radius: var(--gds-checkbox-border-radius);
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
height: 32px;
|
|
63
|
+
margin: unset;
|
|
64
|
+
padding: unset;
|
|
65
|
+
position: relative;
|
|
66
|
+
transition: var(--gds-switch-animaton-transition);
|
|
67
|
+
width: 32px;
|
|
68
|
+
|
|
69
|
+
&:checked {
|
|
70
|
+
animation: switch-on var(--gds-switch-animaton-on) forwards;
|
|
71
|
+
border-color: var(--gds-checkbox-checked-color);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:not(:checked) {
|
|
75
|
+
animation: switch-off var(--gds-switch-animaton-off) backwards;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:has(input:checked) {
|
|
80
|
+
background-color: var(--gds-checkbox-checked-color);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&:has(input:disabled) {
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
opacity: 0.5;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@keyframes switch-on {
|
|
90
|
+
to {
|
|
91
|
+
border-width: 0;
|
|
92
|
+
transform: translate3d(100%, 0, 0) scale(0.5);
|
|
93
|
+
width: 32px;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@keyframes switch-off {
|
|
98
|
+
from {
|
|
99
|
+
border-width: 0;
|
|
100
|
+
transform: translate3d(100%, 0, 0) scale(0.5);
|
|
101
|
+
width: 32px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
to {
|
|
105
|
+
border-width: 7.5px;
|
|
106
|
+
transform: translate3d(0%, 0, 0) scale(1);
|
|
107
|
+
width: 32px;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
|
|
112
|
+
// libs/core/src/components/switch/switch.ts
|
|
113
|
+
var _internals;
|
|
114
|
+
var GdsSwitch = class extends LitElement {
|
|
115
|
+
constructor() {
|
|
116
|
+
super();
|
|
117
|
+
// Private members
|
|
118
|
+
__privateAdd(this, _internals, void 0);
|
|
119
|
+
this.inputElement = null;
|
|
120
|
+
this.exludeAttr = ["id", "label"];
|
|
121
|
+
__privateSet(this, _internals, this.attachInternals());
|
|
122
|
+
constrainSlots(this);
|
|
123
|
+
}
|
|
124
|
+
reflectAttributesToInput() {
|
|
125
|
+
if (this.inputElement) {
|
|
126
|
+
const attributes = this.attributes;
|
|
127
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
128
|
+
const attribute = attributes[i];
|
|
129
|
+
if (!this.exludeAttr.includes(attribute.name)) {
|
|
130
|
+
this.inputElement.setAttribute(attribute.name, attribute.value);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
update(changedProperties) {
|
|
136
|
+
var _a;
|
|
137
|
+
super.update(changedProperties);
|
|
138
|
+
if (!this.inputElement) {
|
|
139
|
+
this.inputElement = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(
|
|
140
|
+
"switch"
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
this.reflectAttributesToInput();
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
return html`
|
|
147
|
+
<label class="gds-switch">
|
|
148
|
+
<input id="switch" type="checkbox" />
|
|
149
|
+
</label>
|
|
150
|
+
`;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
_internals = new WeakMap();
|
|
154
|
+
GdsSwitch.styles = unsafeCSS(switch_default);
|
|
155
|
+
GdsSwitch.shadowRootOptions = {
|
|
156
|
+
mode: "open",
|
|
157
|
+
delegatesFocus: true
|
|
158
|
+
};
|
|
159
|
+
GdsSwitch = __decorateClass([
|
|
160
|
+
customElement("gds-switch")
|
|
161
|
+
], GdsSwitch);
|
|
162
|
+
export {
|
|
163
|
+
GdsSwitch
|
|
164
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './theme';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsTheme
|
|
3
|
+
} from "../../chunks/chunk.XI4H54TV.js";
|
|
4
|
+
import "../../chunks/chunk.QONSFT2N.js";
|
|
5
|
+
import "../../chunks/chunk.2LQSDOD4.js";
|
|
6
|
+
import "../../chunks/chunk.YO24ZYAD.js";
|
|
7
|
+
import "../../chunks/chunk.VOYMQ322.js";
|
|
8
|
+
import "../../chunks/chunk.5VURDMKE.js";
|
|
9
|
+
export {
|
|
10
|
+
GdsTheme
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsTheme
|
|
3
|
+
} from "../../chunks/chunk.XI4H54TV.js";
|
|
4
|
+
import "../../chunks/chunk.QONSFT2N.js";
|
|
5
|
+
import "../../chunks/chunk.2LQSDOD4.js";
|
|
6
|
+
import "../../chunks/chunk.YO24ZYAD.js";
|
|
7
|
+
import "../../chunks/chunk.VOYMQ322.js";
|
|
8
|
+
import "../../chunks/chunk.5VURDMKE.js";
|
|
9
|
+
export {
|
|
10
|
+
GdsTheme
|
|
11
|
+
};
|