@sebgroup/green-core 1.38.1 → 1.40.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 +1 -1
- package/chunks/{chunk.HEEBT6PP.js → chunk.22BHF5MM.js} +1 -1
- package/chunks/{chunk.ZEGPRNBY.js → chunk.42QKJ3AE.js} +1 -1
- package/chunks/{chunk.IWTL7STV.js → chunk.4VE5KIQV.js} +1 -1
- package/chunks/{chunk.6OJLIA73.js → chunk.5FEETFJJ.js} +1 -1
- package/chunks/chunk.7VC33K5Z.js +49 -0
- package/chunks/{chunk.Z3RX3OZJ.js → chunk.CZFPSYSK.js} +2 -2
- package/chunks/{chunk.D35VWG7Z.js → chunk.DM2X2WJJ.js} +2 -2
- package/chunks/{chunk.XKFWKMOP.js → chunk.GDH3LVVJ.js} +1 -1
- package/chunks/{chunk.AP23QGB4.js → chunk.H2VKRHL7.js} +1 -1
- package/chunks/{chunk.PC4VJLMM.js → chunk.HSI6XK2B.js} +5 -5
- package/chunks/{chunk.PN4BONI4.js → chunk.LV3U2CE2.js} +2 -2
- package/chunks/{chunk.NMP7SICY.js → chunk.Q6HA6IGV.js} +1 -1
- package/chunks/chunk.QHOOLVJZ.js +625 -0
- package/chunks/{chunk.REE5LG5I.js → chunk.TEPZ5LAW.js} +1 -1
- package/chunks/{chunk.TH5D3QVK.js → chunk.TH2C35R2.js} +1 -1
- package/chunks/{chunk.WBYZIT2A.js → chunk.UMYAICK2.js} +3 -3
- package/chunks/{chunk.V22RY2FP.js → chunk.UWI5YW33.js} +1 -1
- package/chunks/{chunk.SXLN3MMQ.js → chunk.VBALKDBZ.js} +1 -1
- package/chunks/{chunk.EF6MCM6B.js → chunk.VIVDWSPB.js} +28 -1
- package/chunks/{chunk.WWR3VPSV.js → chunk.VL4HFY2N.js} +7 -5
- package/chunks/chunk.VOYMQ322.js +1 -1
- package/chunks/chunk.WNFJQ5DF.js +40 -0
- package/chunks/chunk.WZRLM4IU.js +394 -0
- package/chunks/chunk.YBOK7MI7.js +31 -0
- package/chunks/{chunk.J5IZQIXN.js → chunk.YUMPRKYF.js} +1 -1
- package/chunks/chunk.ZFI2LPGC.js +758 -0
- package/components/button/button.js +4 -3
- package/components/button/fab/fab.js +5 -4
- package/components/button/fab/index.js +5 -4
- package/components/button/index.js +4 -3
- package/components/calendar/calendar.js +2 -2
- package/components/calendar/index.js +2 -2
- package/components/content/divider/divider.js +2 -2
- package/components/content/divider/index.js +2 -2
- package/components/content/spacer/index.js +2 -2
- package/components/content/spacer/spacer.js +2 -2
- package/components/content/text/index.js +2 -2
- package/components/content/text/text.js +2 -2
- package/components/context-menu/context-menu.js +1 -1
- package/components/context-menu/index.js +1 -1
- package/components/datepicker/datepicker.js +9 -8
- package/components/datepicker/index.js +9 -8
- package/components/dropdown/dropdown.js +7 -6
- package/components/dropdown/index.js +7 -6
- package/components/filter-chips/filter-chip/filter-chip.js +4 -3
- package/components/filter-chips/filter-chip/index.js +4 -3
- package/components/filter-chips/filter-chips.js +4 -3
- package/components/filter-chips/index.js +4 -3
- package/components/form/index.js +5 -5
- package/components/form/summary/index.js +5 -5
- package/components/form/summary/summary.js +5 -5
- package/components/index.js +26 -25
- package/components/input/index.d.ts +1 -0
- package/components/input/index.js +18 -0
- package/components/input/input.d.ts +67 -0
- package/components/input/input.js +18 -0
- package/components/input/input.styles.d.ts +1 -0
- package/components/layout/card/card.js +4 -4
- package/components/layout/card/index.js +4 -4
- package/components/layout/container/container.js +2 -2
- package/components/layout/container/index.js +2 -2
- package/components/layout/flex/flex.js +3 -3
- package/components/layout/flex/index.js +3 -3
- package/components/layout/grid/grid.js +2 -2
- package/components/layout/grid/index.js +2 -2
- package/components/media/img/img.js +2 -2
- package/components/media/img/index.js +2 -2
- package/components/media/video/index.js +2 -2
- package/components/media/video/video.js +2 -2
- package/components/menu-button/index.js +2 -2
- package/components/menu-button/menu-button.js +2 -2
- package/components/popover/index.js +3 -3
- package/components/segmented-control/index.js +3 -3
- package/components/segmented-control/segment/index.js +2 -2
- package/components/segmented-control/segment/segment.js +2 -2
- package/components/segmented-control/segmented-control.js +3 -3
- package/components/theme/index.js +4 -1
- package/components/theme/theme.d.ts +1 -0
- package/components/theme/theme.js +4 -1
- package/index.js +26 -25
- package/package.json +3 -3
- package/primitives/listbox/index.js +2 -2
- package/primitives/listbox/listbox.js +2 -2
- package/primitives/listbox/option.js +2 -2
- package/primitives/ripple/index.js +2 -2
- package/primitives/ripple/ripple.js +2 -2
- package/primitives/signal/index.d.ts +1 -0
- package/primitives/signal/index.js +15 -0
- package/primitives/signal/signal.d.ts +9 -0
- package/primitives/signal/signal.js +15 -0
- package/primitives/signal/signal.style.css.d.ts +2 -0
- package/primitives/signal/signal.style.css.js +7 -0
- package/tokens.style.d.ts +3 -1
- package/chunks/chunk.OYCRDQFS.js +0 -419
- package/chunks/chunk.R2RVGPT7.js +0 -540
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TransitionalStyles
|
|
3
3
|
} from "./chunk.S7DYDS4E.js";
|
|
4
|
+
import {
|
|
5
|
+
dark_default,
|
|
6
|
+
light_default
|
|
7
|
+
} from "./chunk.ZFI2LPGC.js";
|
|
8
|
+
import {
|
|
9
|
+
watch
|
|
10
|
+
} from "./chunk.2WO4NHJ2.js";
|
|
4
11
|
import {
|
|
5
12
|
GdsElement
|
|
6
13
|
} from "./chunk.ZQ4D5K7J.js";
|
|
@@ -14,7 +21,7 @@ import {
|
|
|
14
21
|
|
|
15
22
|
// libs/core/src/components/theme/theme.ts
|
|
16
23
|
import { property } from "lit/decorators.js";
|
|
17
|
-
import { css } from "lit";
|
|
24
|
+
import { css, unsafeCSS } from "lit";
|
|
18
25
|
var GdsTheme = class extends GdsElement {
|
|
19
26
|
constructor() {
|
|
20
27
|
super(...arguments);
|
|
@@ -23,10 +30,27 @@ var GdsTheme = class extends GdsElement {
|
|
|
23
30
|
connectedCallback() {
|
|
24
31
|
super.connectedCallback();
|
|
25
32
|
TransitionalStyles.instance.apply(this, "gds-theme");
|
|
33
|
+
this._dynamicStylesController.inject(
|
|
34
|
+
"tokens",
|
|
35
|
+
unsafeCSS(`:host {${dark_default}}`)
|
|
36
|
+
);
|
|
26
37
|
}
|
|
27
38
|
render() {
|
|
28
39
|
return html`<slot></slot>`;
|
|
29
40
|
}
|
|
41
|
+
_onColorSchemeChange() {
|
|
42
|
+
if (this.colorScheme === "dark") {
|
|
43
|
+
this._dynamicStylesController.inject(
|
|
44
|
+
"tokens",
|
|
45
|
+
unsafeCSS(`:host { ${dark_default}}`)
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
this._dynamicStylesController.inject(
|
|
49
|
+
"tokens",
|
|
50
|
+
unsafeCSS(`:host { ${light_default}}`)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
30
54
|
};
|
|
31
55
|
GdsTheme.styles = css`
|
|
32
56
|
:host {
|
|
@@ -36,6 +60,9 @@ GdsTheme.styles = css`
|
|
|
36
60
|
__decorateClass([
|
|
37
61
|
property({ reflect: true, attribute: "color-scheme" })
|
|
38
62
|
], GdsTheme.prototype, "colorScheme", 2);
|
|
63
|
+
__decorateClass([
|
|
64
|
+
watch("colorScheme")
|
|
65
|
+
], GdsTheme.prototype, "_onColorSchemeChange", 1);
|
|
39
66
|
GdsTheme = __decorateClass([
|
|
40
67
|
gdsCustomElement("gds-theme")
|
|
41
68
|
], GdsTheme);
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk.ADPMTWTS.js";
|
|
4
4
|
import {
|
|
5
5
|
GdsButton
|
|
6
|
-
} from "./chunk.
|
|
6
|
+
} from "./chunk.WZRLM4IU.js";
|
|
7
7
|
import {
|
|
8
8
|
gdsCustomElement
|
|
9
9
|
} from "./chunk.VOYMQ322.js";
|
|
@@ -15,13 +15,14 @@ import {
|
|
|
15
15
|
import { css } from "lit";
|
|
16
16
|
var style = css`
|
|
17
17
|
:host {
|
|
18
|
-
|
|
19
|
-
inset: auto 2rem 2rem auto;
|
|
18
|
+
display: contents;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
.button {
|
|
23
22
|
box-shadow: var(--gds-shadow-m);
|
|
24
|
-
|
|
23
|
+
position: fixed;
|
|
24
|
+
inset: auto var(--gds-space-3xl) var(--gds-space-3xl) auto;
|
|
25
|
+
block-size: calc(var(--_block-size) + var(--gds-space-xs));
|
|
25
26
|
}
|
|
26
27
|
`;
|
|
27
28
|
var fab_styles_default = style;
|
|
@@ -45,7 +46,8 @@ __decorateClass([
|
|
|
45
46
|
], GdsFab.prototype, "transform", 2);
|
|
46
47
|
__decorateClass([
|
|
47
48
|
styleExpressionProperty({
|
|
48
|
-
valueTemplate: (v) => v
|
|
49
|
+
valueTemplate: (v) => v,
|
|
50
|
+
selector: '[part="_button"]'
|
|
49
51
|
})
|
|
50
52
|
], GdsFab.prototype, "inset", 2);
|
|
51
53
|
GdsFab = __decorateClass([
|
package/chunks/chunk.VOYMQ322.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// libs/core/src/utils/helpers/custom-element-scoping.ts
|
|
2
2
|
import { html as litHtml } from "lit";
|
|
3
3
|
import { customElement } from "lit/decorators.js";
|
|
4
|
-
var VER_SUFFIX = "-
|
|
4
|
+
var VER_SUFFIX = "-c5afc6";
|
|
5
5
|
var elementLookupTable = /* @__PURE__ */ new Map();
|
|
6
6
|
var gdsCustomElement = (tagName) => {
|
|
7
7
|
if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
signal_style_css_default
|
|
3
|
+
} from "./chunk.7VC33K5Z.js";
|
|
4
|
+
import {
|
|
5
|
+
styleExpressionProperty
|
|
6
|
+
} from "./chunk.ADPMTWTS.js";
|
|
7
|
+
import {
|
|
8
|
+
tokens
|
|
9
|
+
} from "./chunk.ZFI2LPGC.js";
|
|
10
|
+
import {
|
|
11
|
+
GdsElement
|
|
12
|
+
} from "./chunk.ZQ4D5K7J.js";
|
|
13
|
+
import {
|
|
14
|
+
gdsCustomElement
|
|
15
|
+
} from "./chunk.VOYMQ322.js";
|
|
16
|
+
import {
|
|
17
|
+
__decorateClass
|
|
18
|
+
} from "./chunk.5VURDMKE.js";
|
|
19
|
+
|
|
20
|
+
// libs/core/src/primitives/signal/signal.ts
|
|
21
|
+
import { html } from "lit/static-html.js";
|
|
22
|
+
var GdsSignal = class extends GdsElement {
|
|
23
|
+
render() {
|
|
24
|
+
return html`<div part="signal"></div>`;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
GdsSignal.styles = [tokens, signal_style_css_default];
|
|
28
|
+
__decorateClass([
|
|
29
|
+
styleExpressionProperty({
|
|
30
|
+
valueTemplate: (v) => `var(--gds-color-${v})`,
|
|
31
|
+
selector: '[part="signal"]'
|
|
32
|
+
})
|
|
33
|
+
], GdsSignal.prototype, "color", 2);
|
|
34
|
+
GdsSignal = __decorateClass([
|
|
35
|
+
gdsCustomElement("gds-signal")
|
|
36
|
+
], GdsSignal);
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
GdsSignal
|
|
40
|
+
};
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardAttributes
|
|
3
|
+
} from "./chunk.YBOK7MI7.js";
|
|
4
|
+
import {
|
|
5
|
+
GdsFormControlElement
|
|
6
|
+
} from "./chunk.2BMJPIND.js";
|
|
7
|
+
import {
|
|
8
|
+
constrainSlots
|
|
9
|
+
} from "./chunk.KBYQYDL3.js";
|
|
10
|
+
import {
|
|
11
|
+
TransitionalStyles
|
|
12
|
+
} from "./chunk.S7DYDS4E.js";
|
|
13
|
+
import {
|
|
14
|
+
tokens
|
|
15
|
+
} from "./chunk.ZFI2LPGC.js";
|
|
16
|
+
import {
|
|
17
|
+
gdsCustomElement,
|
|
18
|
+
html
|
|
19
|
+
} from "./chunk.VOYMQ322.js";
|
|
20
|
+
import {
|
|
21
|
+
__decorateClass,
|
|
22
|
+
__privateAdd,
|
|
23
|
+
__privateGet,
|
|
24
|
+
__privateSet
|
|
25
|
+
} from "./chunk.5VURDMKE.js";
|
|
26
|
+
|
|
27
|
+
// libs/core/src/components/button/button.ts
|
|
28
|
+
import { nothing, unsafeCSS } from "lit";
|
|
29
|
+
import { html as staticHtml, literal } from "lit/static-html.js";
|
|
30
|
+
import { property, query } from "lit/decorators.js";
|
|
31
|
+
import { when } from "lit/directives/when.js";
|
|
32
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
33
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
34
|
+
|
|
35
|
+
// libs/core/src/components/button/button.style.css?inline
|
|
36
|
+
var button_style_default = `@layer tokens, a11y, core, ranks, sizes, variants, disabled;
|
|
37
|
+
|
|
38
|
+
@layer tokens {
|
|
39
|
+
:host {
|
|
40
|
+
display: contents;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@layer a11y {
|
|
45
|
+
@media (prefers-reduced-motion: reduce) {
|
|
46
|
+
:host {
|
|
47
|
+
transition: none;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@layer core {
|
|
53
|
+
.button {
|
|
54
|
+
--_block-size: var(--gds-space-3xl);
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
border: none;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
block-size: var(--_block-size);
|
|
62
|
+
background-color: var(--gds-color-l3-background-primary);
|
|
63
|
+
color: var(--gds-color-l3-content-primary);
|
|
64
|
+
border-radius: var(--gds-space-max);
|
|
65
|
+
font-family: inherit;
|
|
66
|
+
font-size: var(--gds-text-size-detail-m);
|
|
67
|
+
line-height: var(--gds-text-line-height-detail-m);
|
|
68
|
+
font-weight: var(--gds-text-weight-regular);
|
|
69
|
+
gap: var(--gds-space-s);
|
|
70
|
+
outline-color: transparent;
|
|
71
|
+
outline-offset: var(--gds-space-3xs);
|
|
72
|
+
outline-style: solid;
|
|
73
|
+
outline-width: var(--gds-space-3xs);
|
|
74
|
+
padding-block: var(--gds-space-s);
|
|
75
|
+
padding-inline: var(--gds-space-l);
|
|
76
|
+
position: relative;
|
|
77
|
+
text-decoration: none;
|
|
78
|
+
transition-property: color, border-color;
|
|
79
|
+
transition: all 0.4s;
|
|
80
|
+
|
|
81
|
+
&:focus {
|
|
82
|
+
outline-color: color-mix(in srgb, currentcolor, #000 100%);
|
|
83
|
+
|
|
84
|
+
&:not(:focus-visible) {
|
|
85
|
+
outline-color: transparent;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.state {
|
|
90
|
+
border-radius: inherit;
|
|
91
|
+
position: absolute;
|
|
92
|
+
inset: 0;
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
pointer-events: none;
|
|
95
|
+
isolation: isolate;
|
|
96
|
+
transition: all 0.4s;
|
|
97
|
+
|
|
98
|
+
:hover & {
|
|
99
|
+
background-color: var(--gds-color-l3-states-dark-hover);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:active & {
|
|
103
|
+
background-color: var(--gds-color-l3-states-dark-pressed);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:not(.circle) slot:not([name]) {
|
|
108
|
+
display: inline-block;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
max-width: 20ch;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* High specificity */
|
|
118
|
+
.button.circle {
|
|
119
|
+
aspect-ratio: 1/1;
|
|
120
|
+
padding: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.button:disabled {
|
|
124
|
+
pointer-events: none;
|
|
125
|
+
background-color: var(--gds-color-l3-background-disabled);
|
|
126
|
+
color: var(--gds-color-l3-content-disabled);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@layer ranks {
|
|
130
|
+
:host([rank*='secondary']) .button {
|
|
131
|
+
background-color: var(--gds-color-l3-background-secondary);
|
|
132
|
+
color: var(--gds-color-l3-content-secondary);
|
|
133
|
+
|
|
134
|
+
.state {
|
|
135
|
+
:hover & {
|
|
136
|
+
background-color: var(--gds-color-l3-states-light-hover);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:active & {
|
|
140
|
+
background-color: var(--gds-color-l3-states-light-pressed);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([rank*='tertiary']) .button {
|
|
146
|
+
background-color: transparent;
|
|
147
|
+
color: var(--gds-color-l3-content-tertiary);
|
|
148
|
+
|
|
149
|
+
.state {
|
|
150
|
+
:hover & {
|
|
151
|
+
background-color: var(--gds-color-l3-states-light-hover);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:active & {
|
|
155
|
+
background-color: var(--gds-color-l3-states-light-pressed);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@layer sizes {
|
|
162
|
+
:host([size='small']) .button {
|
|
163
|
+
--_block-size: var(--gds-space-xl);
|
|
164
|
+
font-size: var(--gds-text-size-detail-s);
|
|
165
|
+
line-height: var(--gds-text-line-height-detail-s);
|
|
166
|
+
padding-inline: var(--gds-space-m);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host([size='medium']) .button {
|
|
170
|
+
--_block-size: var(--gds-space-2xl);
|
|
171
|
+
font-size: var(--gds-text-size-detail-m);
|
|
172
|
+
line-height: var(--gds-text-line-height-detail-m);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@layer variants {
|
|
177
|
+
.positive {
|
|
178
|
+
background-color: var(--gds-color-l3c-background-positive);
|
|
179
|
+
|
|
180
|
+
.state {
|
|
181
|
+
:where(.secondary, .tertiary):hover & {
|
|
182
|
+
background-color: var(--gds-color-l3-states-positive-hover);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:where(.secondary, .tertiary):active & {
|
|
186
|
+
background-color: var(--gds-color-l3-states-positive-pressed);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&.secondary {
|
|
191
|
+
background-color: var(--gds-color-l3c-background-positive-secondary);
|
|
192
|
+
color: var(--gds-color-l3c-content-positive);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&.tertiary {
|
|
196
|
+
background-color: transparent;
|
|
197
|
+
color: var(--gds-color-l3c-content-positive);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.negative {
|
|
202
|
+
background-color: var(--gds-color-l3c-background-negative);
|
|
203
|
+
|
|
204
|
+
.state {
|
|
205
|
+
:where(.secondary, .tertiary):hover & {
|
|
206
|
+
background-color: var(--gds-color-l3-states-negative-hover);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
:where(.secondary, .tertiary):active & {
|
|
210
|
+
background-color: var(--gds-color-l3-states-negative-pressed);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&.secondary {
|
|
215
|
+
background-color: var(--gds-color-l3c-background-negative-secondary);
|
|
216
|
+
color: var(--gds-color-l3c-content-negative);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
&.tertiary {
|
|
220
|
+
background-color: transparent;
|
|
221
|
+
color: var(--gds-color-l3c-content-negative);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
|
|
227
|
+
// libs/core/src/utils/helpers/strip-white-space.ts
|
|
228
|
+
var templateCache = /* @__PURE__ */ new WeakMap();
|
|
229
|
+
function stripWhitespace(extendedTag) {
|
|
230
|
+
return (strings, ...values) => {
|
|
231
|
+
let modstrings = templateCache.get(strings);
|
|
232
|
+
if (!modstrings) {
|
|
233
|
+
modstrings = strings.map((s) => s.replace(/\n[\s]+</gm, "<"));
|
|
234
|
+
modstrings.raw = strings.raw;
|
|
235
|
+
templateCache.set(strings, modstrings);
|
|
236
|
+
}
|
|
237
|
+
return extendedTag(modstrings, ...values);
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// libs/core/src/components/button/button.ts
|
|
242
|
+
var html2 = stripWhitespace(html);
|
|
243
|
+
var _isIconButton, _isLink, isLink_get, _defaultRel, defaultRel_get, _mainSlotChange, _handleClick;
|
|
244
|
+
var GdsButton = class extends GdsFormControlElement {
|
|
245
|
+
constructor() {
|
|
246
|
+
super();
|
|
247
|
+
__privateAdd(this, _isLink);
|
|
248
|
+
__privateAdd(this, _defaultRel);
|
|
249
|
+
this.disabled = false;
|
|
250
|
+
this.rank = "primary";
|
|
251
|
+
this.variant = "neutral";
|
|
252
|
+
this.size = "medium";
|
|
253
|
+
this.label = "";
|
|
254
|
+
this.href = "";
|
|
255
|
+
__privateAdd(this, _isIconButton, false);
|
|
256
|
+
// Check if the button is an icon button.
|
|
257
|
+
__privateAdd(this, _mainSlotChange, () => {
|
|
258
|
+
var _a, _b;
|
|
259
|
+
const assignedNodes = (_b = (_a = this._mainSlot) == null ? void 0 : _a.assignedNodes()) != null ? _b : [];
|
|
260
|
+
__privateSet(this, _isIconButton, assignedNodes.length === 1 && assignedNodes.some(
|
|
261
|
+
(node) => node.nodeName.toLowerCase().startsWith("gds-icon")
|
|
262
|
+
));
|
|
263
|
+
this.requestUpdate();
|
|
264
|
+
});
|
|
265
|
+
__privateAdd(this, _handleClick, (e) => {
|
|
266
|
+
this.dispatchEvent(
|
|
267
|
+
new CustomEvent("gds-click", {
|
|
268
|
+
bubbles: true,
|
|
269
|
+
composed: true,
|
|
270
|
+
detail: e
|
|
271
|
+
})
|
|
272
|
+
);
|
|
273
|
+
if (this.form && !__privateGet(this, _isLink, isLink_get)) {
|
|
274
|
+
if (this.type === "submit") {
|
|
275
|
+
this.form.requestSubmit();
|
|
276
|
+
} else if (this.type === "reset") {
|
|
277
|
+
this.form.reset();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
constrainSlots(this);
|
|
282
|
+
}
|
|
283
|
+
connectedCallback() {
|
|
284
|
+
super.connectedCallback();
|
|
285
|
+
this.setAttribute("role", "none");
|
|
286
|
+
TransitionalStyles.instance.apply(this, "gds-button");
|
|
287
|
+
}
|
|
288
|
+
render() {
|
|
289
|
+
const buttonClasses = {
|
|
290
|
+
button: true,
|
|
291
|
+
circle: __privateGet(this, _isIconButton),
|
|
292
|
+
icon: __privateGet(this, _isIconButton),
|
|
293
|
+
small: this.size === "small",
|
|
294
|
+
large: this.size === "large",
|
|
295
|
+
positive: this.variant === "positive",
|
|
296
|
+
negative: this.variant === "negative",
|
|
297
|
+
primary: this.rank === "primary",
|
|
298
|
+
secondary: this.rank === "secondary",
|
|
299
|
+
tertiary: this.rank === "tertiary"
|
|
300
|
+
};
|
|
301
|
+
const tag = __privateGet(this, _isLink, isLink_get) ? literal`a` : literal`button`;
|
|
302
|
+
return staticHtml`
|
|
303
|
+
<${tag}
|
|
304
|
+
class=${classMap(buttonClasses)}
|
|
305
|
+
type="${ifDefined(__privateGet(this, _isLink, isLink_get) ? void 0 : this.type)}"
|
|
306
|
+
?disabled="${this.disabled}"
|
|
307
|
+
aria-label=${this.label || nothing}
|
|
308
|
+
href=${ifDefined(__privateGet(this, _isLink, isLink_get) ? this.href : void 0)}
|
|
309
|
+
target=${ifDefined(__privateGet(this, _isLink, isLink_get) ? this.target : void 0)}
|
|
310
|
+
rel=${ifDefined(__privateGet(this, _isLink, isLink_get) ? this.rel || __privateGet(this, _defaultRel, defaultRel_get) : void 0)}
|
|
311
|
+
download=${ifDefined(__privateGet(this, _isLink, isLink_get) ? this.download : void 0)}
|
|
312
|
+
part="_button"
|
|
313
|
+
@click="${__privateGet(this, _handleClick)}"
|
|
314
|
+
${forwardAttributes(
|
|
315
|
+
(attr) => attr.name.startsWith("gds-aria") || attr.name === "gds-role"
|
|
316
|
+
)}
|
|
317
|
+
>
|
|
318
|
+
<slot name="lead"></slot>
|
|
319
|
+
<slot @slotchange=${__privateGet(this, _mainSlotChange)}></slot>
|
|
320
|
+
<slot name="trail"></slot>
|
|
321
|
+
${when(
|
|
322
|
+
!this._isUsingTransitionalStyles,
|
|
323
|
+
() => html2`<gds-ripple part="_ripple"></gds-ripple>`
|
|
324
|
+
)}
|
|
325
|
+
<div class="state"></div>
|
|
326
|
+
</${tag}>
|
|
327
|
+
`;
|
|
328
|
+
}
|
|
329
|
+
_getValidityAnchor() {
|
|
330
|
+
return this._button;
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
_isIconButton = new WeakMap();
|
|
334
|
+
_isLink = new WeakSet();
|
|
335
|
+
isLink_get = function() {
|
|
336
|
+
return this.href.length > 0;
|
|
337
|
+
};
|
|
338
|
+
_defaultRel = new WeakSet();
|
|
339
|
+
defaultRel_get = function() {
|
|
340
|
+
return this.target === "_blank" ? "noreferrer noopener" : void 0;
|
|
341
|
+
};
|
|
342
|
+
_mainSlotChange = new WeakMap();
|
|
343
|
+
_handleClick = new WeakMap();
|
|
344
|
+
GdsButton.styles = [tokens, unsafeCSS(button_style_default)];
|
|
345
|
+
/**
|
|
346
|
+
* @internal
|
|
347
|
+
*/
|
|
348
|
+
GdsButton.shadowRootOptions = {
|
|
349
|
+
mode: "open",
|
|
350
|
+
delegatesFocus: true
|
|
351
|
+
};
|
|
352
|
+
__decorateClass([
|
|
353
|
+
property({ type: Boolean, reflect: true })
|
|
354
|
+
], GdsButton.prototype, "disabled", 2);
|
|
355
|
+
__decorateClass([
|
|
356
|
+
property({ reflect: true })
|
|
357
|
+
], GdsButton.prototype, "type", 2);
|
|
358
|
+
__decorateClass([
|
|
359
|
+
property({ reflect: true })
|
|
360
|
+
], GdsButton.prototype, "rank", 2);
|
|
361
|
+
__decorateClass([
|
|
362
|
+
property({ reflect: true })
|
|
363
|
+
], GdsButton.prototype, "variant", 2);
|
|
364
|
+
__decorateClass([
|
|
365
|
+
property({ reflect: true })
|
|
366
|
+
], GdsButton.prototype, "size", 2);
|
|
367
|
+
__decorateClass([
|
|
368
|
+
property()
|
|
369
|
+
], GdsButton.prototype, "label", 2);
|
|
370
|
+
__decorateClass([
|
|
371
|
+
property()
|
|
372
|
+
], GdsButton.prototype, "href", 2);
|
|
373
|
+
__decorateClass([
|
|
374
|
+
property()
|
|
375
|
+
], GdsButton.prototype, "target", 2);
|
|
376
|
+
__decorateClass([
|
|
377
|
+
property()
|
|
378
|
+
], GdsButton.prototype, "rel", 2);
|
|
379
|
+
__decorateClass([
|
|
380
|
+
property()
|
|
381
|
+
], GdsButton.prototype, "download", 2);
|
|
382
|
+
__decorateClass([
|
|
383
|
+
query("slot:not([name])")
|
|
384
|
+
], GdsButton.prototype, "_mainSlot", 2);
|
|
385
|
+
__decorateClass([
|
|
386
|
+
query(".button")
|
|
387
|
+
], GdsButton.prototype, "_button", 2);
|
|
388
|
+
GdsButton = __decorateClass([
|
|
389
|
+
gdsCustomElement("gds-button")
|
|
390
|
+
], GdsButton);
|
|
391
|
+
|
|
392
|
+
export {
|
|
393
|
+
GdsButton
|
|
394
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// libs/core/src/utils/directives/forward-attributes.ts
|
|
2
|
+
import { Directive, PartType, directive } from "lit/directive.js";
|
|
3
|
+
import { nothing } from "lit/html.js";
|
|
4
|
+
var ForwardAttributesDirective = class extends Directive {
|
|
5
|
+
constructor(partInfo) {
|
|
6
|
+
super(partInfo);
|
|
7
|
+
if (partInfo.type !== PartType.ELEMENT) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"The `forwardAttributes` directive must be used in element bindings"
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
render(_filter) {
|
|
14
|
+
return nothing;
|
|
15
|
+
}
|
|
16
|
+
update(part, [filter]) {
|
|
17
|
+
var _a;
|
|
18
|
+
const element = part.element;
|
|
19
|
+
const host = (_a = part.options) == null ? void 0 : _a.host;
|
|
20
|
+
Array.from(host.attributes).forEach((attr) => {
|
|
21
|
+
if (filter(attr)) {
|
|
22
|
+
element.setAttribute(attr.name.replace("gds-", ""), attr.value);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var forwardAttributes = directive(ForwardAttributesDirective);
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
forwardAttributes
|
|
31
|
+
};
|