@sebgroup/green-core 1.14.0 → 1.15.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/components/icon/icon.d.ts +1 -1
- package/components/index.d.ts +1 -0
- package/components/theme/theme.d.ts +20 -0
- package/components/theme/theme.style.d.ts +0 -0
- package/components/theme/theme.trans.styles.d.ts +2 -0
- package/gds-element.d.ts +5 -1
- package/index.js +119 -85
- package/package.json +1 -1
- package/transitional-styles.d.ts +1 -1
- package/transitional-styles.js +3809 -3191
- package/utils/{helpers → transitional-styles}/transitional-styles.d.ts +2 -1
package/components/index.d.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GdsElement } from '../../gds-element';
|
|
2
|
+
/**
|
|
3
|
+
* @element gds-theme
|
|
4
|
+
*
|
|
5
|
+
* A component that provides CSS variables for a part of the DOM tree.
|
|
6
|
+
* Every descendant of this component will inherit the CSS variables
|
|
7
|
+
* provided by the theme set on this component.
|
|
8
|
+
*
|
|
9
|
+
* @slot - The content to apply the theme to.
|
|
10
|
+
*
|
|
11
|
+
* @status beta
|
|
12
|
+
*/
|
|
13
|
+
export declare class GdsTheme extends GdsElement {
|
|
14
|
+
/**
|
|
15
|
+
* The theme mode. Can be `light`, `dark`, or `auto`.
|
|
16
|
+
*/
|
|
17
|
+
colorScheme: 'light' | 'dark' | 'auto';
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
render(): any;
|
|
20
|
+
}
|
|
File without changes
|
package/gds-element.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export declare class GdsElement extends LitElement {
|
|
|
4
4
|
* The unscoped name of this element.
|
|
5
5
|
*/
|
|
6
6
|
gdsElementName: string;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Whether the element is using transitional styles.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
_isUsingTransitionalStyles: boolean;
|
|
8
12
|
connectedCallback(): void;
|
|
9
13
|
}
|
package/index.js
CHANGED
|
@@ -85,8 +85,8 @@ function watch(propertyName, options) {
|
|
|
85
85
|
const { update } = proto;
|
|
86
86
|
const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];
|
|
87
87
|
proto.update = function(changedProps) {
|
|
88
|
-
watchedProperties.forEach((
|
|
89
|
-
const key =
|
|
88
|
+
watchedProperties.forEach((property15) => {
|
|
89
|
+
const key = property15;
|
|
90
90
|
if (changedProps.has(key)) {
|
|
91
91
|
const oldValue = changedProps.get(key);
|
|
92
92
|
const newValue = this[key];
|
|
@@ -152,7 +152,7 @@ function watchMediaQuery(q) {
|
|
|
152
152
|
// libs/core/src/utils/helpers/custom-element-scoping.ts
|
|
153
153
|
import { html as litHtml } from "lit";
|
|
154
154
|
import { customElement } from "lit/decorators.js";
|
|
155
|
-
var VER_SUFFIX = "-
|
|
155
|
+
var VER_SUFFIX = "-633bb8";
|
|
156
156
|
var elementLookupTable = /* @__PURE__ */ new Map();
|
|
157
157
|
var gdsCustomElement = (tagName) => {
|
|
158
158
|
if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
|
|
@@ -204,7 +204,7 @@ function getUnscopedTagName(tagName) {
|
|
|
204
204
|
import { property, state } from "lit/decorators.js";
|
|
205
205
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
206
206
|
|
|
207
|
-
// libs/core/src/utils/
|
|
207
|
+
// libs/core/src/utils/transitional-styles/transitional-styles.ts
|
|
208
208
|
import { html as html2 } from "lit";
|
|
209
209
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
210
210
|
function supportsConstructedStylesheets() {
|
|
@@ -215,18 +215,19 @@ function supportsConstructedStylesheets() {
|
|
|
215
215
|
return false;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
var TransitionalStyles = class {
|
|
218
|
+
var TransitionalStyles = class _TransitionalStyles {
|
|
219
219
|
constructor() {
|
|
220
220
|
this.sheets = /* @__PURE__ */ new Map();
|
|
221
221
|
this.elements = /* @__PURE__ */ new Map();
|
|
222
222
|
this.sheetsLegacy = /* @__PURE__ */ new Map();
|
|
223
223
|
this.useLegacyStylesheets = !supportsConstructedStylesheets();
|
|
224
|
+
this.chlorophyllTokens = new CSSStyleSheet();
|
|
224
225
|
}
|
|
225
226
|
static get instance() {
|
|
226
227
|
if (!globalThis.__gdsTransitionalStyles?.[VER_SUFFIX])
|
|
227
228
|
globalThis.__gdsTransitionalStyles = {
|
|
228
229
|
...globalThis.__gdsTransitionalStyles,
|
|
229
|
-
[VER_SUFFIX]: new
|
|
230
|
+
[VER_SUFFIX]: new _TransitionalStyles()
|
|
230
231
|
};
|
|
231
232
|
return globalThis.__gdsTransitionalStyles[VER_SUFFIX];
|
|
232
233
|
}
|
|
@@ -248,10 +249,10 @@ var TransitionalStyles = class {
|
|
|
248
249
|
const element = this.elements.get(styleKey);
|
|
249
250
|
if (!element || !element.shadowRoot)
|
|
250
251
|
return;
|
|
251
|
-
element.shadowRoot.adoptedStyleSheets = [sheet];
|
|
252
|
-
element.
|
|
252
|
+
element.shadowRoot.adoptedStyleSheets = [this.chlorophyllTokens, sheet];
|
|
253
|
+
element._isUsingTransitionalStyles = true;
|
|
253
254
|
}
|
|
254
|
-
// This is a fallback for browsers that
|
|
255
|
+
// This is a fallback for browsers that dosen't support constructed stylesheets.
|
|
255
256
|
// Primarily, this is here to support Safari/iOS 15.x
|
|
256
257
|
//
|
|
257
258
|
// To work around the lack of Constructed Stylesheets, we use a regular <style>
|
|
@@ -261,7 +262,7 @@ var TransitionalStyles = class {
|
|
|
261
262
|
// Lit itself will also add a <style> element to the shadow root in these browsers,
|
|
262
263
|
// meaning that we have to override the base styles added from the static style
|
|
263
264
|
// property in this case. This is what the `all: revert` rule is for.
|
|
264
|
-
// We can use cascade layers to ensure that the revert rule
|
|
265
|
+
// We can use cascade layers to ensure that the revert rule overides the base styles
|
|
265
266
|
// but not the transitional styles.
|
|
266
267
|
// `@layer base, reset, transitional-styles;`
|
|
267
268
|
applyToElementLegacy(styleKey) {
|
|
@@ -277,6 +278,7 @@ var TransitionalStyles = class {
|
|
|
277
278
|
}
|
|
278
279
|
${unsafeHTML(sheet)}
|
|
279
280
|
</style>`;
|
|
281
|
+
element._isUsingTransitionalStyles = true;
|
|
280
282
|
}
|
|
281
283
|
register(name, styles2) {
|
|
282
284
|
if (this.useLegacyStylesheets) {
|
|
@@ -295,15 +297,19 @@ var TransitionalStyles = class {
|
|
|
295
297
|
import "reflect-metadata";
|
|
296
298
|
|
|
297
299
|
// libs/core/src/gds-element.ts
|
|
298
|
-
import { LitElement
|
|
299
|
-
var GdsElement = class extends
|
|
300
|
+
import { LitElement } from "lit";
|
|
301
|
+
var GdsElement = class extends LitElement {
|
|
300
302
|
constructor() {
|
|
301
303
|
super(...arguments);
|
|
302
304
|
/**
|
|
303
305
|
* The unscoped name of this element.
|
|
304
306
|
*/
|
|
305
307
|
this.gdsElementName = "";
|
|
306
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Whether the element is using transitional styles.
|
|
310
|
+
* @internal
|
|
311
|
+
*/
|
|
312
|
+
this._isUsingTransitionalStyles = false;
|
|
307
313
|
}
|
|
308
314
|
connectedCallback() {
|
|
309
315
|
super.connectedCallback();
|
|
@@ -637,8 +643,8 @@ var GdsOption = class extends Focusable(GdsElement) {
|
|
|
637
643
|
else
|
|
638
644
|
this.removeAttribute("highlighted");
|
|
639
645
|
}
|
|
640
|
-
return html3`${this._tStyles}
|
|
641
|
-
<slot></slot>`;
|
|
646
|
+
return html3`${this._tStyles}
|
|
647
|
+
<div>${when(isMultiple, () => checkbox)} <slot></slot></div>`;
|
|
642
648
|
}
|
|
643
649
|
};
|
|
644
650
|
_hidden = new WeakMap();
|
|
@@ -1008,11 +1014,9 @@ GdsPopover = __decorateClass([
|
|
|
1008
1014
|
|
|
1009
1015
|
// libs/core/src/components/form-control.ts
|
|
1010
1016
|
import { property as property4 } from "lit/decorators.js";
|
|
1011
|
-
var _internals;
|
|
1012
1017
|
var GdsFormControlElement = class extends GdsElement {
|
|
1013
1018
|
constructor() {
|
|
1014
1019
|
super();
|
|
1015
|
-
__privateAdd(this, _internals, void 0);
|
|
1016
1020
|
this.invalid = false;
|
|
1017
1021
|
this.name = "";
|
|
1018
1022
|
/**
|
|
@@ -1023,9 +1027,9 @@ var GdsFormControlElement = class extends GdsElement {
|
|
|
1023
1027
|
this.value = void 0;
|
|
1024
1028
|
};
|
|
1025
1029
|
try {
|
|
1026
|
-
|
|
1030
|
+
this.#internals = this.attachInternals();
|
|
1027
1031
|
} catch (e) {
|
|
1028
|
-
|
|
1032
|
+
this.#internals = {
|
|
1029
1033
|
form: this.closest("form"),
|
|
1030
1034
|
setFormValue: (value) => {
|
|
1031
1035
|
this.value = value;
|
|
@@ -1050,37 +1054,41 @@ var GdsFormControlElement = class extends GdsElement {
|
|
|
1050
1054
|
willValidate: true,
|
|
1051
1055
|
checkValidity: () => true,
|
|
1052
1056
|
reportValidity: () => true
|
|
1053
|
-
}
|
|
1057
|
+
};
|
|
1054
1058
|
}
|
|
1055
1059
|
}
|
|
1060
|
+
#internals;
|
|
1061
|
+
static {
|
|
1062
|
+
this.formAssociated = true;
|
|
1063
|
+
}
|
|
1056
1064
|
get form() {
|
|
1057
|
-
return
|
|
1065
|
+
return this.#internals.form;
|
|
1058
1066
|
}
|
|
1059
1067
|
get validity() {
|
|
1060
|
-
return
|
|
1068
|
+
return this.#internals.validity;
|
|
1061
1069
|
}
|
|
1062
1070
|
get validationMessage() {
|
|
1063
|
-
return
|
|
1071
|
+
return this.#internals.validationMessage;
|
|
1064
1072
|
}
|
|
1065
1073
|
get willValidate() {
|
|
1066
|
-
return
|
|
1074
|
+
return this.#internals.willValidate;
|
|
1067
1075
|
}
|
|
1068
1076
|
checkValidity() {
|
|
1069
|
-
return
|
|
1077
|
+
return this.#internals.checkValidity();
|
|
1070
1078
|
}
|
|
1071
1079
|
reportValidity() {
|
|
1072
|
-
return
|
|
1080
|
+
return this.#internals.reportValidity();
|
|
1073
1081
|
}
|
|
1074
1082
|
connectedCallback() {
|
|
1075
1083
|
super.connectedCallback();
|
|
1076
|
-
|
|
1084
|
+
this.#internals.form?.addEventListener("reset", this._handleFormReset);
|
|
1077
1085
|
}
|
|
1078
1086
|
disconnectedCallback() {
|
|
1079
1087
|
super.disconnectedCallback();
|
|
1080
|
-
|
|
1088
|
+
this.#internals.form?.removeEventListener("reset", this._handleFormReset);
|
|
1081
1089
|
}
|
|
1082
1090
|
__handleValidityChange() {
|
|
1083
|
-
|
|
1091
|
+
this.#internals.setValidity(
|
|
1084
1092
|
{
|
|
1085
1093
|
badInput: false,
|
|
1086
1094
|
customError: this.invalid,
|
|
@@ -1098,11 +1106,9 @@ var GdsFormControlElement = class extends GdsElement {
|
|
|
1098
1106
|
);
|
|
1099
1107
|
}
|
|
1100
1108
|
__handleValueChange() {
|
|
1101
|
-
|
|
1109
|
+
this.#internals.setFormValue(this.value);
|
|
1102
1110
|
}
|
|
1103
1111
|
};
|
|
1104
|
-
_internals = new WeakMap();
|
|
1105
|
-
GdsFormControlElement.formAssociated = true;
|
|
1106
1112
|
__decorateClass([
|
|
1107
1113
|
property4({
|
|
1108
1114
|
type: Boolean,
|
|
@@ -1566,22 +1572,22 @@ var context_menu_styles_default = style6;
|
|
|
1566
1572
|
// libs/core/src/primitives/menu/menu.ts
|
|
1567
1573
|
import { createRef as createRef3, ref as ref3 } from "lit/directives/ref.js";
|
|
1568
1574
|
import { state as state5 } from "lit/decorators.js";
|
|
1575
|
+
var _slotRef2;
|
|
1569
1576
|
var GdsMenu = class extends GdsElement {
|
|
1570
1577
|
constructor() {
|
|
1571
1578
|
super();
|
|
1572
|
-
this
|
|
1579
|
+
__privateAdd(this, _slotRef2, createRef3());
|
|
1573
1580
|
new ListboxKbNavController(this);
|
|
1574
1581
|
}
|
|
1575
|
-
#slotRef;
|
|
1576
1582
|
connectedCallback() {
|
|
1577
1583
|
super.connectedCallback();
|
|
1578
1584
|
this.setAttribute("role", "menu");
|
|
1579
1585
|
TransitionalStyles.instance.apply(this, "gds-listbox");
|
|
1580
1586
|
}
|
|
1581
1587
|
get navigableItems() {
|
|
1582
|
-
if (!this
|
|
1588
|
+
if (!__privateGet(this, _slotRef2).value)
|
|
1583
1589
|
return [];
|
|
1584
|
-
return unwrap(this
|
|
1590
|
+
return unwrap(__privateGet(this, _slotRef2).value).assignedElements().filter(
|
|
1585
1591
|
(o) => !o.hasAttribute("isplaceholder") && o.gdsElementName === "gds-menu-item"
|
|
1586
1592
|
) || [];
|
|
1587
1593
|
}
|
|
@@ -1592,9 +1598,10 @@ var GdsMenu = class extends GdsElement {
|
|
|
1592
1598
|
this.navigableItems[0]?.focus();
|
|
1593
1599
|
}
|
|
1594
1600
|
render() {
|
|
1595
|
-
return html`${this._tStyles}<slot ${ref3(this
|
|
1601
|
+
return html`${this._tStyles}<slot ${ref3(__privateGet(this, _slotRef2))}></slot>`;
|
|
1596
1602
|
}
|
|
1597
1603
|
};
|
|
1604
|
+
_slotRef2 = new WeakMap();
|
|
1598
1605
|
__decorateClass([
|
|
1599
1606
|
state5()
|
|
1600
1607
|
], GdsMenu.prototype, "_tStyles", 2);
|
|
@@ -1730,7 +1737,8 @@ var GdsMenuItem = class extends Focusable(GdsElement) {
|
|
|
1730
1737
|
TransitionalStyles.instance.apply(this, "gds-option");
|
|
1731
1738
|
}
|
|
1732
1739
|
render() {
|
|
1733
|
-
return html`${this._tStyles}
|
|
1740
|
+
return html`${this._tStyles}
|
|
1741
|
+
<div><slot></slot></div>`;
|
|
1734
1742
|
}
|
|
1735
1743
|
};
|
|
1736
1744
|
_handleOnClick = new WeakMap();
|
|
@@ -2026,10 +2034,10 @@ GdsCalendar = __decorateClass([
|
|
|
2026
2034
|
], GdsCalendar);
|
|
2027
2035
|
|
|
2028
2036
|
// libs/core/src/components/datepicker/date-part-spinner.ts
|
|
2029
|
-
import { LitElement as
|
|
2037
|
+
import { LitElement as LitElement5 } from "lit";
|
|
2030
2038
|
import { property as property8, state as state9 } from "lit/decorators.js";
|
|
2031
2039
|
var _inputBuffer, _increment, _decrement, _handleClick, _handleFocus, _handleBlur, _handleWheel, _handleKeyDown2, _focusNextSpinner, focusNextSpinner_fn, _dispatchChangeEvent, dispatchChangeEvent_fn, _formatNumber, formatNumber_fn, _clamp, clamp_fn, _clearInputBuffer, clearInputBuffer_fn;
|
|
2032
|
-
var GdsDatePartSpinner = class extends
|
|
2040
|
+
var GdsDatePartSpinner = class extends LitElement5 {
|
|
2033
2041
|
constructor() {
|
|
2034
2042
|
super(...arguments);
|
|
2035
2043
|
__privateAdd(this, _focusNextSpinner);
|
|
@@ -2812,7 +2820,7 @@ GdsDatepicker = __decorateClass([
|
|
|
2812
2820
|
], GdsDatepicker);
|
|
2813
2821
|
|
|
2814
2822
|
// libs/core/src/components/grid/grid.ts
|
|
2815
|
-
import { css as css10, LitElement as
|
|
2823
|
+
import { css as css10, LitElement as LitElement6, unsafeCSS as unsafeCSS3 } from "lit";
|
|
2816
2824
|
import { property as property10, state as state11 } from "lit/decorators.js";
|
|
2817
2825
|
|
|
2818
2826
|
// libs/core/src/tokens.style.ts
|
|
@@ -2821,7 +2829,7 @@ import { unsafeCSS as unsafeCSS2 } from "lit";
|
|
|
2821
2829
|
// dist/libs/tokens/internal/pallet.css
|
|
2822
2830
|
var pallet_default = `/**
|
|
2823
2831
|
* Do not edit directly
|
|
2824
|
-
* Generated on
|
|
2832
|
+
* Generated on Thu, 18 Apr 2024 14:24:24 GMT
|
|
2825
2833
|
*/
|
|
2826
2834
|
|
|
2827
2835
|
:host {
|
|
@@ -2982,7 +2990,7 @@ var pallet_default = `/**
|
|
|
2982
2990
|
// dist/libs/tokens/internal/theme/light.css
|
|
2983
2991
|
var light_default = `/**
|
|
2984
2992
|
* Do not edit directly
|
|
2985
|
-
* Generated on
|
|
2993
|
+
* Generated on Thu, 18 Apr 2024 14:24:24 GMT
|
|
2986
2994
|
*/
|
|
2987
2995
|
|
|
2988
2996
|
:host {
|
|
@@ -3103,7 +3111,7 @@ var light_default = `/**
|
|
|
3103
3111
|
// dist/libs/tokens/internal/size.css
|
|
3104
3112
|
var size_default = `/**
|
|
3105
3113
|
* Do not edit directly
|
|
3106
|
-
* Generated on
|
|
3114
|
+
* Generated on Thu, 18 Apr 2024 14:24:24 GMT
|
|
3107
3115
|
*/
|
|
3108
3116
|
|
|
3109
3117
|
:host {
|
|
@@ -3335,7 +3343,7 @@ var grid_style_css_default = style8;
|
|
|
3335
3343
|
|
|
3336
3344
|
// libs/core/src/components/grid/grid.ts
|
|
3337
3345
|
var BreakpointPattern = /(?<l>l:([a-z0-9]+))?\s*(?<m>m:([a-z0-9]+))?\s*(?<s>s:([a-z0-9]+))?/;
|
|
3338
|
-
var GdsGrid = class extends
|
|
3346
|
+
var GdsGrid = class extends LitElement6 {
|
|
3339
3347
|
constructor() {
|
|
3340
3348
|
super(...arguments);
|
|
3341
3349
|
this._gridVariables = {
|
|
@@ -3616,30 +3624,30 @@ import { unsafeCSS as unsafeCSS4 } from "lit";
|
|
|
3616
3624
|
|
|
3617
3625
|
// libs/core/src/components/segmented-control/segment/segment.style.css
|
|
3618
3626
|
var segment_style_default = `:host {
|
|
3619
|
-
z-index: 1;
|
|
3620
3627
|
display: flex;
|
|
3621
3628
|
transition: 0.2s;
|
|
3629
|
+
z-index: 1;
|
|
3622
3630
|
}
|
|
3623
3631
|
|
|
3624
3632
|
button {
|
|
3625
|
-
flex-shrink: 0;
|
|
3626
|
-
flex-grow: 1;
|
|
3627
|
-
font-family: inherit;
|
|
3628
|
-
padding: 0 1rem;
|
|
3629
|
-
text-align: center;
|
|
3630
|
-
cursor: pointer;
|
|
3631
|
-
border-radius: calc(infinity * 1px);
|
|
3632
3633
|
-webkit-appearance: none;
|
|
3633
3634
|
-moz-appearance: none;
|
|
3634
3635
|
appearance: none;
|
|
3635
3636
|
background: transparent;
|
|
3637
|
+
border-radius: calc(infinity * 1px);
|
|
3636
3638
|
border-width: 0;
|
|
3639
|
+
color: var(--gds-sys-color-content-content);
|
|
3640
|
+
cursor: pointer;
|
|
3641
|
+
flex-grow: 1;
|
|
3642
|
+
flex-shrink: 0;
|
|
3643
|
+
font-family: inherit;
|
|
3637
3644
|
font-size: inherit;
|
|
3638
3645
|
overflow: hidden;
|
|
3639
|
-
|
|
3646
|
+
padding: 0 1rem;
|
|
3647
|
+
text-align: center;
|
|
3640
3648
|
text-overflow: ellipsis;
|
|
3649
|
+
white-space: nowrap;
|
|
3641
3650
|
width: 100%;
|
|
3642
|
-
color: var(--gds-sys-color-content-content);
|
|
3643
3651
|
}
|
|
3644
3652
|
|
|
3645
3653
|
@media (pointer: fine) {
|
|
@@ -3688,16 +3696,16 @@ GdsSegment = __decorateClass([
|
|
|
3688
3696
|
|
|
3689
3697
|
// libs/core/src/components/segmented-control/segmented-control.style.css
|
|
3690
3698
|
var segmented_control_style_default = `:host {
|
|
3691
|
-
box-sizing: border-box;
|
|
3692
|
-
display: inline-flex;
|
|
3693
3699
|
background-color: var(--gds-sys-color-container-container-dim1);
|
|
3694
3700
|
border: 0.25rem solid var(--gds-sys-color-container-container-dim1);
|
|
3695
|
-
gap: 0.25rem;
|
|
3696
3701
|
border-radius: calc(infinity * 1px);
|
|
3702
|
+
box-sizing: border-box;
|
|
3697
3703
|
contain: layout;
|
|
3704
|
+
display: inline-flex;
|
|
3705
|
+
gap: 0.25rem;
|
|
3706
|
+
height: 3rem;
|
|
3698
3707
|
max-width: 100%;
|
|
3699
3708
|
overflow: hidden;
|
|
3700
|
-
height: 3rem;
|
|
3701
3709
|
}
|
|
3702
3710
|
|
|
3703
3711
|
:host([size='small']) {
|
|
@@ -3709,37 +3717,37 @@ var segmented_control_style_default = `:host {
|
|
|
3709
3717
|
display: flex;
|
|
3710
3718
|
flex-grow: 0;
|
|
3711
3719
|
flex-shrink: 1;
|
|
3712
|
-
width: 100%;
|
|
3713
|
-
position: relative;
|
|
3714
3720
|
overflow: hidden;
|
|
3721
|
+
position: relative;
|
|
3722
|
+
width: 100%;
|
|
3715
3723
|
}
|
|
3716
3724
|
|
|
3717
3725
|
#segments {
|
|
3718
3726
|
box-sizing: border-box;
|
|
3719
3727
|
display: inline-flex;
|
|
3720
|
-
|
|
3728
|
+
gap: 0.25rem;
|
|
3721
3729
|
position: relative;
|
|
3730
|
+
transition: 0.2s;
|
|
3722
3731
|
z-index: 1;
|
|
3723
|
-
gap: 0.25rem;
|
|
3724
3732
|
}
|
|
3725
3733
|
|
|
3726
3734
|
#btn-prev,
|
|
3727
3735
|
#btn-next {
|
|
3728
|
-
display: flex;
|
|
3729
3736
|
align-items: center;
|
|
3730
|
-
justify-content: center;
|
|
3731
|
-
font-size: 1rem;
|
|
3732
|
-
border-radius: calc(infinity * 1px);
|
|
3733
|
-
background-color: var(--gds-sys-color-container-container-dim1);
|
|
3734
|
-
border-width: 0;
|
|
3735
3737
|
-webkit-appearance: none;
|
|
3736
3738
|
-moz-appearance: none;
|
|
3737
3739
|
appearance: none;
|
|
3738
3740
|
aspect-ratio: 1;
|
|
3741
|
+
background-color: var(--gds-sys-color-container-container-dim1);
|
|
3742
|
+
border-radius: calc(infinity * 1px);
|
|
3743
|
+
border-width: 0;
|
|
3744
|
+
color: var(--gds-sys-color-content-content);
|
|
3745
|
+
cursor: pointer;
|
|
3746
|
+
display: flex;
|
|
3747
|
+
font-size: 1rem;
|
|
3739
3748
|
height: 100%;
|
|
3749
|
+
justify-content: center;
|
|
3740
3750
|
width: 2.5rem;
|
|
3741
|
-
cursor: pointer;
|
|
3742
|
-
color: var(--gds-sys-color-content-content);
|
|
3743
3751
|
|
|
3744
3752
|
@media (pointer: fine) {
|
|
3745
3753
|
&:hover {
|
|
@@ -3758,18 +3766,20 @@ var segmented_control_style_default = `:host {
|
|
|
3758
3766
|
}
|
|
3759
3767
|
|
|
3760
3768
|
::slotted(*) {
|
|
3761
|
-
flex-shrink: 0;
|
|
3762
3769
|
flex-grow: 1;
|
|
3770
|
+
flex-shrink: 0;
|
|
3763
3771
|
z-index: 1;
|
|
3764
3772
|
}
|
|
3765
3773
|
|
|
3766
3774
|
#indicator {
|
|
3767
|
-
position: absolute;
|
|
3768
|
-
left: 0;
|
|
3769
|
-
height: 100%;
|
|
3770
3775
|
background-color: var(--gds-sys-color-container-container-bright);
|
|
3771
3776
|
border-radius: calc(infinity * 1px);
|
|
3772
|
-
|
|
3777
|
+
height: 100%;
|
|
3778
|
+
left: 0;
|
|
3779
|
+
position: absolute;
|
|
3780
|
+
transition:
|
|
3781
|
+
transform 0.2s,
|
|
3782
|
+
width 0.2s;
|
|
3773
3783
|
z-index: 0;
|
|
3774
3784
|
}
|
|
3775
3785
|
`;
|
|
@@ -3850,14 +3860,14 @@ var GdsSegmentedControl = class extends GdsElement {
|
|
|
3850
3860
|
if (availableWidth / numSegments > this.segMinWidth) {
|
|
3851
3861
|
return {
|
|
3852
3862
|
count: numSegments,
|
|
3853
|
-
segmentWidth: (availableWidth - getSegmentGap(this.
|
|
3863
|
+
segmentWidth: (availableWidth - getSegmentGap(this._isUsingTransitionalStyles) * (numSegments - 1)) / numSegments
|
|
3854
3864
|
};
|
|
3855
3865
|
}
|
|
3856
3866
|
const availableWidthIncBtns = this.offsetWidth - BTN_SIZE[this.size] * 2;
|
|
3857
3867
|
const maxVisibleSegments = Math.floor(
|
|
3858
3868
|
availableWidthIncBtns / this.segMinWidth
|
|
3859
3869
|
);
|
|
3860
|
-
const segmentWidth = (availableWidth - getSegmentGap(this.
|
|
3870
|
+
const segmentWidth = (availableWidth - getSegmentGap(this._isUsingTransitionalStyles) * (maxVisibleSegments - 1)) / maxVisibleSegments;
|
|
3861
3871
|
return {
|
|
3862
3872
|
count: maxVisibleSegments,
|
|
3863
3873
|
segmentWidth
|
|
@@ -3887,7 +3897,7 @@ var GdsSegmentedControl = class extends GdsElement {
|
|
|
3887
3897
|
this.segments.forEach((segment) => {
|
|
3888
3898
|
segment.style.width = segmentWidth + "px";
|
|
3889
3899
|
});
|
|
3890
|
-
__privateSet(this, _segmentsContainerLeft, -__privateGet(this, _firstVisibleIndex) * segmentWidth - getSegmentGap(this.
|
|
3900
|
+
__privateSet(this, _segmentsContainerLeft, -__privateGet(this, _firstVisibleIndex) * segmentWidth - getSegmentGap(this._isUsingTransitionalStyles) * __privateGet(this, _firstVisibleIndex));
|
|
3891
3901
|
__privateGet(this, _applySegmentsTransform).call(this);
|
|
3892
3902
|
__privateSet(this, _calculatedSegmentWidth, segmentWidth);
|
|
3893
3903
|
__privateSet(this, _segmentWidth, segmentWidth);
|
|
@@ -3917,7 +3927,7 @@ var GdsSegmentedControl = class extends GdsElement {
|
|
|
3917
3927
|
const segment = this.segments.find((s) => s.selected);
|
|
3918
3928
|
if (segment) {
|
|
3919
3929
|
const selectedSegmentIndex = this.segments.indexOf(segment);
|
|
3920
|
-
const offset2 = selectedSegmentIndex * __privateGet(this, _segmentWidth) + getSegmentGap(this.
|
|
3930
|
+
const offset2 = selectedSegmentIndex * __privateGet(this, _segmentWidth) + getSegmentGap(this._isUsingTransitionalStyles) * selectedSegmentIndex;
|
|
3921
3931
|
this._elIndicator.style.transform = `translateX(${offset2}px)`;
|
|
3922
3932
|
this._elIndicator.style.width = `${__privateGet(this, _segmentWidth)}px`;
|
|
3923
3933
|
} else {
|
|
@@ -4107,8 +4117,7 @@ GdsSegmentedControl = __decorateClass([
|
|
|
4107
4117
|
], GdsSegmentedControl);
|
|
4108
4118
|
|
|
4109
4119
|
// libs/core/src/components/icon/icon.ts
|
|
4110
|
-
import { LitElement as
|
|
4111
|
-
import { customElement as customElement2 } from "lit/decorators.js";
|
|
4120
|
+
import { LitElement as LitElement7, unsafeCSS as unsafeCSS6 } from "lit";
|
|
4112
4121
|
|
|
4113
4122
|
// libs/core/src/components/icon/stem.styles.scss
|
|
4114
4123
|
var stem_styles_default = `svg:not([display=none]) {
|
|
@@ -4131,7 +4140,7 @@ symbol {
|
|
|
4131
4140
|
}`;
|
|
4132
4141
|
|
|
4133
4142
|
// libs/core/src/components/icon/icon.ts
|
|
4134
|
-
var GdsIcon = class extends
|
|
4143
|
+
var GdsIcon = class extends LitElement7 {
|
|
4135
4144
|
constructor() {
|
|
4136
4145
|
super(...arguments);
|
|
4137
4146
|
this.open = false;
|
|
@@ -4142,7 +4151,7 @@ var GdsIcon = class extends LitElement8 {
|
|
|
4142
4151
|
}
|
|
4143
4152
|
render() {
|
|
4144
4153
|
const { name } = this;
|
|
4145
|
-
return
|
|
4154
|
+
return html`
|
|
4146
4155
|
<svg display="none">
|
|
4147
4156
|
<symbol id="plus">
|
|
4148
4157
|
<line x1="12" y1="5" x2="12" y2="19" />
|
|
@@ -4244,8 +4253,32 @@ GdsIcon.properties = {
|
|
|
4244
4253
|
name: { type: String }
|
|
4245
4254
|
};
|
|
4246
4255
|
GdsIcon = __decorateClass([
|
|
4247
|
-
|
|
4256
|
+
gdsCustomElement("gds-icon")
|
|
4248
4257
|
], GdsIcon);
|
|
4258
|
+
|
|
4259
|
+
// libs/core/src/components/theme/theme.ts
|
|
4260
|
+
import { property as property14 } from "lit/decorators.js";
|
|
4261
|
+
var GdsTheme = class extends GdsElement {
|
|
4262
|
+
constructor() {
|
|
4263
|
+
super(...arguments);
|
|
4264
|
+
this.colorScheme = "light";
|
|
4265
|
+
}
|
|
4266
|
+
connectedCallback() {
|
|
4267
|
+
super.connectedCallback();
|
|
4268
|
+
TransitionalStyles.instance.apply(this, "gds-theme");
|
|
4269
|
+
}
|
|
4270
|
+
render() {
|
|
4271
|
+
return html`
|
|
4272
|
+
<slot></slot>
|
|
4273
|
+
`;
|
|
4274
|
+
}
|
|
4275
|
+
};
|
|
4276
|
+
__decorateClass([
|
|
4277
|
+
property14({ reflect: true, attribute: "color-scheme" })
|
|
4278
|
+
], GdsTheme.prototype, "colorScheme", 2);
|
|
4279
|
+
GdsTheme = __decorateClass([
|
|
4280
|
+
gdsCustomElement("gds-theme")
|
|
4281
|
+
], GdsTheme);
|
|
4249
4282
|
export {
|
|
4250
4283
|
GdsContextMenu,
|
|
4251
4284
|
GdsDatepicker,
|
|
@@ -4257,6 +4290,7 @@ export {
|
|
|
4257
4290
|
GdsMenuItem,
|
|
4258
4291
|
GdsOption,
|
|
4259
4292
|
GdsSegmentedControl,
|
|
4293
|
+
GdsTheme,
|
|
4260
4294
|
VER_SUFFIX,
|
|
4261
4295
|
gdsCustomElement,
|
|
4262
4296
|
getScopedTagName,
|
package/package.json
CHANGED
package/transitional-styles.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './utils/
|
|
1
|
+
export * from './utils/transitional-styles/transitional-styles';
|