@sebgroup/green-core 2.5.3 → 2.6.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/alert/alert.styles.js +3 -3
- package/components/badge/badge.component.d.ts +1 -0
- package/components/badge/badge.component.js +77 -18
- package/components/button/button.styles.js +14 -10
- package/components/calendar/calendar.styles.js +4 -5
- package/components/card/card.component.js +4 -4
- package/components/checkbox/checkbox-group/checkbox-group.styles.js +20 -2
- package/components/datepicker/datepicker.styles.js +5 -5
- package/components/details/details.styles.js +2 -2
- package/components/dialog/dialog.component.js +28 -18
- package/components/dialog/dialog.styles.js +1 -0
- package/components/div/div.styles.js +2 -2
- package/components/dropdown/dropdown.component.js +5 -5
- package/components/dropdown/dropdown.styles.js +1 -1
- package/components/input/input.component.d.ts +1 -1
- package/components/input/input.component.js +5 -4
- package/components/popover/popover.styles.js +1 -1
- package/components/radio/radio-group/radio-group.styles.js +17 -3
- package/components/rich-text/rich-text.styles.js +7 -7
- package/components/segmented-control/segment/segment.styles.js +1 -1
- package/components/select/select.component.js +1 -1
- package/components/signal/signal.component.d.ts +0 -1
- package/components/signal/signal.component.js +2 -1
- package/components/textarea/textarea.component.js +3 -3
- package/gds-element.js +1 -1
- package/generated/react/badge/index.d.ts +1 -0
- package/generated/react/index.d.ts +7 -7
- package/generated/react/index.js +7 -7
- package/generated/react/input/index.d.ts +1 -1
- package/package.json +1 -1
- package/primitives/field-base/field-base.styles.js +34 -23
- package/primitives/form-control-footer/form-control-footer.styles.js +2 -2
- package/primitives/form-control-header/form-control-header.styles.js +6 -5
- package/primitives/listbox/option.styles.js +3 -3
- package/primitives/toggle-controls-base/toggle-control-base.styles.js +2 -2
- package/shared-styles/form-control-host.style.js +1 -1
- package/shared-styles/rbcb-toggle.style.js +14 -15
- package/tokens/variables.base.css.js +1 -1
- package/utils/helpers/custom-element-scoping.js +1 -1
|
@@ -61,7 +61,7 @@ const style = css`
|
|
|
61
61
|
.wrapper {
|
|
62
62
|
grid-area: wrapper;
|
|
63
63
|
display: flex;
|
|
64
|
-
gap: var(--gds-sys-space-
|
|
64
|
+
gap: var(--gds-sys-space-xs);
|
|
65
65
|
|
|
66
66
|
.message {
|
|
67
67
|
max-width: 80ch;
|
|
@@ -69,7 +69,7 @@ const style = css`
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.dismissible .wrapper {
|
|
72
|
-
margin-top: var(--gds-sys-space-
|
|
72
|
+
margin-top: var(--gds-sys-space-3xs);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.has-action {
|
|
@@ -81,7 +81,7 @@ const style = css`
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.has-action.dismissible .close {
|
|
84
|
-
margin-top: var(--gds-sys-space-
|
|
84
|
+
margin-top: var(--gds-sys-space-3xs);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
.message {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__privateAdd,
|
|
4
4
|
__privateMethod
|
|
5
5
|
} from "../../chunks/chunk.QU3DSPNU.js";
|
|
6
|
-
var _GdsBadge_instances, renderLeadSlot_fn, renderMainSlot_fn,
|
|
6
|
+
var _GdsBadge_instances, handleSlotChange_fn, renderLeadSlot_fn, renderMainSlot_fn, renderTrailSlot_fn;
|
|
7
7
|
import { property, state } from "lit/decorators.js";
|
|
8
8
|
import { GdsElement } from "../../gds-element.js";
|
|
9
9
|
import { html } from "../../scoping.js";
|
|
@@ -27,6 +27,7 @@ let GdsBadge = class extends withSizeXProps(
|
|
|
27
27
|
this.notification = false;
|
|
28
28
|
this.rounded = false;
|
|
29
29
|
this.mainSlotOccupied = false;
|
|
30
|
+
this.leadSlotOccupied = false;
|
|
30
31
|
}
|
|
31
32
|
render() {
|
|
32
33
|
let background;
|
|
@@ -66,20 +67,70 @@ let GdsBadge = class extends withSizeXProps(
|
|
|
66
67
|
break;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
const padding =
|
|
70
|
-
|
|
70
|
+
const padding = (() => {
|
|
71
|
+
const paddings = {
|
|
72
|
+
notification: {
|
|
73
|
+
occupied: "4xs 2xs",
|
|
74
|
+
default: "3xs"
|
|
75
|
+
},
|
|
76
|
+
small: {
|
|
77
|
+
occupied: "4xs 3xs",
|
|
78
|
+
default: "4xs 3xs"
|
|
79
|
+
},
|
|
80
|
+
default: {
|
|
81
|
+
occupied: "3xs xs 3xs 2xs",
|
|
82
|
+
default: "4xs xs"
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
if (this.notification) {
|
|
86
|
+
return paddings.notification[this.mainSlotOccupied ? "occupied" : "default"];
|
|
87
|
+
}
|
|
88
|
+
const isSmall = this.size === "small";
|
|
89
|
+
return paddings[isSmall ? "small" : "default"][this.leadSlotOccupied ? "occupied" : "default"];
|
|
90
|
+
})();
|
|
91
|
+
const blockSize = (() => {
|
|
92
|
+
const sizes = {
|
|
93
|
+
occupied: {
|
|
94
|
+
small: "m",
|
|
95
|
+
default: "l"
|
|
96
|
+
},
|
|
97
|
+
default: "xs"
|
|
98
|
+
};
|
|
99
|
+
return this.mainSlotOccupied ? sizes.occupied[this.size === "small" || this.notification ? "small" : "default"] : sizes.default;
|
|
100
|
+
})();
|
|
101
|
+
const inlineSize = (() => {
|
|
102
|
+
const sizes = {
|
|
103
|
+
notification: {
|
|
104
|
+
occupied: "l",
|
|
105
|
+
default: "0"
|
|
106
|
+
},
|
|
107
|
+
default: "l"
|
|
108
|
+
};
|
|
109
|
+
return this.notification ? sizes.notification[this.mainSlotOccupied ? "occupied" : "default"] : sizes.default;
|
|
110
|
+
})();
|
|
111
|
+
const borderRadius = (() => {
|
|
112
|
+
const radiuses = {
|
|
113
|
+
small: "3xs",
|
|
114
|
+
notification: "max",
|
|
115
|
+
default: "2xs"
|
|
116
|
+
};
|
|
117
|
+
if (this.rounded) return "max";
|
|
118
|
+
if (this.notification) return radiuses.notification;
|
|
119
|
+
return this.size === "small" ? radiuses.small : radiuses.default;
|
|
120
|
+
})();
|
|
71
121
|
return html`<gds-flex
|
|
72
122
|
level="3"
|
|
73
123
|
background=${background}
|
|
74
124
|
color=${color}
|
|
75
|
-
gap="${this.notification ? "" : "
|
|
125
|
+
gap="${this.notification ? "" : "3xs"}"
|
|
76
126
|
align-items="center"
|
|
77
|
-
justify-content="flex-start"
|
|
78
|
-
padding
|
|
79
|
-
|
|
80
|
-
|
|
127
|
+
justify-content="${this.notification ? "center" : "flex-start"}"
|
|
128
|
+
padding="${padding}"
|
|
129
|
+
min-height="${blockSize}"
|
|
130
|
+
border-radius="${borderRadius}"
|
|
81
131
|
width="100%"
|
|
82
|
-
|
|
132
|
+
min-width="${inlineSize}"
|
|
133
|
+
font="${this.size === "small" || this.notification ? "detail-book-xs" : "detail-book-s"}"
|
|
83
134
|
>
|
|
84
135
|
${__privateMethod(this, _GdsBadge_instances, renderLeadSlot_fn).call(this)} ${__privateMethod(this, _GdsBadge_instances, renderMainSlot_fn).call(this)}
|
|
85
136
|
${__privateMethod(this, _GdsBadge_instances, renderTrailSlot_fn).call(this)}
|
|
@@ -87,20 +138,25 @@ let GdsBadge = class extends withSizeXProps(
|
|
|
87
138
|
}
|
|
88
139
|
};
|
|
89
140
|
_GdsBadge_instances = new WeakSet();
|
|
141
|
+
handleSlotChange_fn = function(event, stateProperty) {
|
|
142
|
+
const slot = event.target;
|
|
143
|
+
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
144
|
+
this[stateProperty] = assignedNodes.length > 0 && assignedNodes.some(
|
|
145
|
+
(node) => node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE && node.textContent?.trim() !== ""
|
|
146
|
+
);
|
|
147
|
+
};
|
|
90
148
|
renderLeadSlot_fn = function() {
|
|
91
149
|
if (this.size !== "small" || !this.notification) {
|
|
92
|
-
return html`<slot
|
|
150
|
+
return html`<slot
|
|
151
|
+
name="lead"
|
|
152
|
+
@slotchange=${(e) => __privateMethod(this, _GdsBadge_instances, handleSlotChange_fn).call(this, e, "leadSlotOccupied")}
|
|
153
|
+
></slot>`;
|
|
93
154
|
}
|
|
94
155
|
};
|
|
95
156
|
renderMainSlot_fn = function() {
|
|
96
|
-
return html`<slot
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const slot = event.target;
|
|
100
|
-
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
101
|
-
this.mainSlotOccupied = assignedNodes.length > 0 && assignedNodes.some(
|
|
102
|
-
(node) => node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE && node.textContent?.trim() !== ""
|
|
103
|
-
);
|
|
157
|
+
return html`<slot
|
|
158
|
+
@slotchange=${(e) => __privateMethod(this, _GdsBadge_instances, handleSlotChange_fn).call(this, e, "mainSlotOccupied")}
|
|
159
|
+
></slot>`;
|
|
104
160
|
};
|
|
105
161
|
renderTrailSlot_fn = function() {
|
|
106
162
|
return html`<slot name="trail"></slot>`;
|
|
@@ -129,6 +185,9 @@ __decorateClass([
|
|
|
129
185
|
__decorateClass([
|
|
130
186
|
state()
|
|
131
187
|
], GdsBadge.prototype, "mainSlotOccupied", 2);
|
|
188
|
+
__decorateClass([
|
|
189
|
+
state()
|
|
190
|
+
], GdsBadge.prototype, "leadSlotOccupied", 2);
|
|
132
191
|
GdsBadge = __decorateClass([
|
|
133
192
|
gdsCustomElement("gds-badge", { dependsOn: [GdsFlex] })
|
|
134
193
|
], GdsBadge);
|
|
@@ -18,7 +18,7 @@ const style = css`
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.button {
|
|
21
|
-
--_block-size: var(--gds-sys-space-
|
|
21
|
+
--_block-size: var(--gds-sys-space-4xl);
|
|
22
22
|
display: flex;
|
|
23
23
|
align-items: center;
|
|
24
24
|
justify-content: center;
|
|
@@ -31,13 +31,13 @@ const style = css`
|
|
|
31
31
|
border-radius: var(--gds-sys-radius-max);
|
|
32
32
|
font-family: inherit;
|
|
33
33
|
font: var(--gds-sys-text-detail-book-m);
|
|
34
|
-
gap: var(--gds-sys-space-
|
|
34
|
+
gap: var(--gds-sys-space-xs);
|
|
35
35
|
outline-color: transparent;
|
|
36
|
-
outline-offset: var(--gds-sys-space-
|
|
36
|
+
outline-offset: var(--gds-sys-space-4xs);
|
|
37
37
|
outline-style: solid;
|
|
38
|
-
outline-width: var(--gds-sys-space-
|
|
38
|
+
outline-width: var(--gds-sys-space-4xs);
|
|
39
39
|
padding-block: var(--gds-sys-space-s);
|
|
40
|
-
padding-inline: var(--gds-sys-space-
|
|
40
|
+
padding-inline: var(--gds-sys-space-xl);
|
|
41
41
|
position: relative;
|
|
42
42
|
text-decoration: none;
|
|
43
43
|
transition-property: color, border-colorm, background;
|
|
@@ -143,20 +143,24 @@ const style = css`
|
|
|
143
143
|
@layer sizes {
|
|
144
144
|
:host([size='xs']) .button {
|
|
145
145
|
--_block-size: var(--gds-sys-space-l);
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
gap: var(--gds-sys-space-4xs);
|
|
147
|
+
font: var(--gds-sys-text-detail-book-xs);
|
|
148
|
+
padding-inline: var(--gds-sys-space-s);
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
:host([size='small']) .button {
|
|
151
|
-
--_block-size: var(--gds-sys-space-
|
|
152
|
+
--_block-size: var(--gds-sys-space-2xl);
|
|
152
153
|
font: var(--gds-sys-text-detail-book-s);
|
|
153
|
-
|
|
154
|
+
gap: var(--gds-sys-space-3xs);
|
|
155
|
+
padding-block: var(--gds-sys-space-3xs);
|
|
154
156
|
padding-inline: var(--gds-sys-space-m);
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
:host([size='medium']) .button {
|
|
158
|
-
--_block-size: var(--gds-sys-space-
|
|
160
|
+
--_block-size: var(--gds-sys-space-3xl);
|
|
161
|
+
gap: var(--gds-sys-space-2xs);
|
|
159
162
|
font: var(--gds-sys-text-detail-book-m);
|
|
163
|
+
padding-inline: var(--gds-sys-space-l);
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
166
|
|
|
@@ -21,7 +21,7 @@ const style = css`
|
|
|
21
21
|
padding: 1ch;
|
|
22
22
|
|
|
23
23
|
&.small {
|
|
24
|
-
border-spacing: var(--gds-sys-space-
|
|
24
|
+
border-spacing: var(--gds-sys-space-3xs);
|
|
25
25
|
|
|
26
26
|
thead th {
|
|
27
27
|
width: var(--gds-sys-space-xl);
|
|
@@ -59,7 +59,7 @@ const style = css`
|
|
|
59
59
|
box-sizing: border-box;
|
|
60
60
|
text-align: center;
|
|
61
61
|
user-select: none;
|
|
62
|
-
border-width: var(--gds-sys-space-
|
|
62
|
+
border-width: var(--gds-sys-space-4xs);
|
|
63
63
|
border-style: solid;
|
|
64
64
|
border-color: transparent;
|
|
65
65
|
border-radius: var(--gds-sys-radius-max);
|
|
@@ -67,8 +67,7 @@ const style = css`
|
|
|
67
67
|
outline-style: solid;
|
|
68
68
|
outline-color: transparent;
|
|
69
69
|
outline-width: 0px;
|
|
70
|
-
outline-offset: var(--gds-sys-space-
|
|
71
|
-
//--_background: transparent;
|
|
70
|
+
outline-offset: var(--gds-sys-space-4xs);
|
|
72
71
|
|
|
73
72
|
&.short {
|
|
74
73
|
width: var(--gds-sys-space-4xl);
|
|
@@ -141,7 +140,7 @@ const style = css`
|
|
|
141
140
|
|
|
142
141
|
&:focus-visible {
|
|
143
142
|
outline-color: var(--gds-sys-color-content-neutral-01);
|
|
144
|
-
outline-width: var(--gds-sys-space-
|
|
143
|
+
outline-width: var(--gds-sys-space-4xs);
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
&.small {
|
|
@@ -14,9 +14,9 @@ let GdsCard = class extends GdsDiv {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
super();
|
|
16
16
|
this.variant = "primary";
|
|
17
|
-
this.padding = "
|
|
18
|
-
this["border-radius"] = "
|
|
19
|
-
this["gap"] = "
|
|
17
|
+
this.padding = "m;m{l}";
|
|
18
|
+
this["border-radius"] = "s";
|
|
19
|
+
this["gap"] = "m;m{l}";
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
return html`<slot></slot>`;
|
|
@@ -30,7 +30,7 @@ GdsCard.styles = [
|
|
|
30
30
|
border-color: var(--_border-color);
|
|
31
31
|
background-color: var(--_background-color);
|
|
32
32
|
color: var(--_color);
|
|
33
|
-
border-width: var(--gds-sys-space-
|
|
33
|
+
border-width: var(--gds-sys-space-5xs);
|
|
34
34
|
border-style: solid;
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
@@ -9,6 +9,10 @@ const styles = css`
|
|
|
9
9
|
|
|
10
10
|
/* Color */
|
|
11
11
|
--_checkbox-label-color: var(--gds-sys-color-l3-content-tertiary);
|
|
12
|
+
|
|
13
|
+
/* Perimiter */
|
|
14
|
+
--_perimeter-size: var(--gds-sys-space-2xl);
|
|
15
|
+
--_container-gap: var(--gds-sys-space-s);
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
:host(:invalid) {
|
|
@@ -17,7 +21,9 @@ const styles = css`
|
|
|
17
21
|
|
|
18
22
|
:host([size='small']) {
|
|
19
23
|
--_font-label: var(--gds-sys-text-detail-book-s);
|
|
20
|
-
--_font-supporting-text: var(--gds-sys-text-detail-regular-
|
|
24
|
+
--_font-supporting-text: var(--gds-sys-text-detail-regular-xs);
|
|
25
|
+
--_perimeter-size: var(--gds-sys-space-xl);
|
|
26
|
+
--_container-gap: var(--gds-sys-space-xs);
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
.checkbox-group {
|
|
@@ -26,6 +32,10 @@ const styles = css`
|
|
|
26
32
|
gap: var(--gds-sys-space-m);
|
|
27
33
|
}
|
|
28
34
|
|
|
35
|
+
:host([size='small']) .checkbox-group {
|
|
36
|
+
gap: var(--gds-sys-space-xs);
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
.content {
|
|
30
40
|
display: flex;
|
|
31
41
|
position: relative;
|
|
@@ -36,13 +46,21 @@ const styles = css`
|
|
|
36
46
|
.direction-row .content {
|
|
37
47
|
flex-direction: row;
|
|
38
48
|
flex-wrap: wrap;
|
|
39
|
-
gap: var(--gds-sys-space-
|
|
49
|
+
gap: var(--gds-sys-space-s) var(--gds-sys-space-xl);
|
|
40
50
|
}
|
|
41
51
|
|
|
42
52
|
.direction-column .content {
|
|
43
53
|
flex-direction: column;
|
|
54
|
+
gap: var(--gds-sys-space-s);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([size='small']) .direction-column .content {
|
|
44
58
|
gap: var(--gds-sys-space-xs);
|
|
45
59
|
}
|
|
60
|
+
|
|
61
|
+
:host([size='small']) .direction-row .content {
|
|
62
|
+
gap: var(--gds-sys-space-xs) var(--gds-sys-space-m);
|
|
63
|
+
}
|
|
46
64
|
`;
|
|
47
65
|
export {
|
|
48
66
|
styles
|
|
@@ -13,7 +13,7 @@ const style = css`
|
|
|
13
13
|
align-items: center;
|
|
14
14
|
justify-content: flex-start;
|
|
15
15
|
inline-size: 12ch;
|
|
16
|
-
gap: var(--gds-sys-space-
|
|
16
|
+
gap: var(--gds-sys-space-5xs);
|
|
17
17
|
font: var(--gds-sys-text-detail-regular-m);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -29,13 +29,13 @@ const style = css`
|
|
|
29
29
|
height: 100%;
|
|
30
30
|
box-sizing: border-box;
|
|
31
31
|
outline: none;
|
|
32
|
-
padding-block: var(--gds-sys-space-
|
|
32
|
+
padding-block: var(--gds-sys-space-4xs);
|
|
33
33
|
text-transform: uppercase;
|
|
34
34
|
line-height: 1;
|
|
35
35
|
text-align: center;
|
|
36
|
-
padding: var(--gds-sys-space-
|
|
37
|
-
margin: calc(-1 * var(--gds-sys-space-
|
|
38
|
-
border-radius: var(--gds-sys-radius-
|
|
36
|
+
padding: var(--gds-sys-space-4xs);
|
|
37
|
+
margin: calc(-1 * var(--gds-sys-space-4xs));
|
|
38
|
+
border-radius: var(--gds-sys-radius-3xs);
|
|
39
39
|
|
|
40
40
|
&:focus-visible {
|
|
41
41
|
background-color: var(--gds-sys-color-l3-neutral-01);
|
|
@@ -4,7 +4,7 @@ const style = css`
|
|
|
4
4
|
@layer base, reset;
|
|
5
5
|
@layer base {
|
|
6
6
|
.details {
|
|
7
|
-
border-bottom: solid var(--gds-sys-space-
|
|
7
|
+
border-bottom: solid var(--gds-sys-space-5xs)
|
|
8
8
|
var(--gds-sys-color-border-subtle-01);
|
|
9
9
|
font: var(--gds-sys-text-body-regular-m);
|
|
10
10
|
color: var(--gds-sys-color-content-neutral-01);
|
|
@@ -17,7 +17,7 @@ const style = css`
|
|
|
17
17
|
align-items: center;
|
|
18
18
|
list-style: none;
|
|
19
19
|
user-select: none;
|
|
20
|
-
outline-offset: var(--gds-sys-space-
|
|
20
|
+
outline-offset: var(--gds-sys-space-3xs);
|
|
21
21
|
outline-color: currentColor;
|
|
22
22
|
transition: all 120ms;
|
|
23
23
|
color: var(--gds-sys-color-content-neutral-01);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__privateMethod,
|
|
6
6
|
__privateSet
|
|
7
7
|
} from "../../chunks/chunk.QU3DSPNU.js";
|
|
8
|
-
var _returnValue, _handleNativeClose, _dispatchCloseEvent, _dispatchShowEvent, _dispatchUiStateEvent, _GdsDialog_instances, handleTriggerSlotChange_fn, _handleTriggerClick, _handleClickOutside;
|
|
8
|
+
var _returnValue, _clickStartedInside, _handleNativeClose, _dispatchCloseEvent, _dispatchShowEvent, _dispatchUiStateEvent, _GdsDialog_instances, handleTriggerSlotChange_fn, _handleTriggerClick, _handleClickOutside;
|
|
9
9
|
import { localized, msg } from "@lit/localize";
|
|
10
10
|
import { nothing } from "lit";
|
|
11
11
|
import { property, query } from "lit/decorators.js";
|
|
@@ -28,7 +28,7 @@ import { GdsButton } from "../button/button.component.js";
|
|
|
28
28
|
import { GdsCard } from "../card/card.component.js";
|
|
29
29
|
import { GdsDiv } from "../div/div.component.js";
|
|
30
30
|
import { GdsFlex } from "../flex/flex.component.js";
|
|
31
|
-
import {
|
|
31
|
+
import { IconCrossLarge } from "../icon/icons/cross-large.component.js";
|
|
32
32
|
import DialogStyles from "./dialog.styles.js";
|
|
33
33
|
import {
|
|
34
34
|
lockBodyScrolling,
|
|
@@ -47,17 +47,19 @@ let GdsDialog = class extends withSizeXProps(
|
|
|
47
47
|
this.placement = "initial";
|
|
48
48
|
this.scrollable = false;
|
|
49
49
|
__privateAdd(this, _returnValue);
|
|
50
|
+
__privateAdd(this, _clickStartedInside, false);
|
|
50
51
|
__privateAdd(this, _handleNativeClose, (e) => {
|
|
51
52
|
const dialog = e.target;
|
|
52
|
-
|
|
53
|
+
let returnValue = dialog.returnValue;
|
|
53
54
|
if (returnValue !== "prop-change") {
|
|
55
|
+
returnValue = returnValue || "native-close";
|
|
54
56
|
if (!__privateGet(this, _dispatchCloseEvent).call(this, returnValue)) {
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
|
-
this.close(returnValue
|
|
59
|
+
this.close(returnValue);
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
|
-
this.close(returnValue
|
|
62
|
+
this.close(returnValue);
|
|
61
63
|
});
|
|
62
64
|
__privateAdd(this, _dispatchCloseEvent, (reason) => {
|
|
63
65
|
if (__privateGet(this, _dispatchUiStateEvent).call(this, reason)) {
|
|
@@ -89,14 +91,15 @@ let GdsDialog = class extends withSizeXProps(
|
|
|
89
91
|
const e = evt;
|
|
90
92
|
const dialog = this._elDialog;
|
|
91
93
|
const isNotEnterKey = e.clientX > 0 || e.clientY > 0;
|
|
92
|
-
if (isNotEnterKey && dialog && this.open) {
|
|
94
|
+
if (isNotEnterKey && e.target === this && dialog && this.open) {
|
|
93
95
|
const rect = dialog.getBoundingClientRect();
|
|
94
96
|
const isInDialog = rect.top <= e.clientY && e.clientY <= rect.top + rect.height && rect.left <= e.clientX && e.clientX <= rect.left + rect.width;
|
|
95
97
|
const closeReason = "click-outside";
|
|
96
|
-
if (!isInDialog && __privateGet(this, _dispatchCloseEvent).call(this, closeReason)) {
|
|
98
|
+
if (!isInDialog && !__privateGet(this, _clickStartedInside) && __privateGet(this, _dispatchCloseEvent).call(this, closeReason)) {
|
|
97
99
|
this.close(closeReason);
|
|
98
100
|
}
|
|
99
101
|
}
|
|
102
|
+
__privateSet(this, _clickStartedInside, false);
|
|
100
103
|
});
|
|
101
104
|
}
|
|
102
105
|
/**
|
|
@@ -126,6 +129,7 @@ let GdsDialog = class extends withSizeXProps(
|
|
|
126
129
|
${when(
|
|
127
130
|
this.open,
|
|
128
131
|
() => html`<dialog
|
|
132
|
+
closedby="closerequest"
|
|
129
133
|
@close=${__privateGet(this, _handleNativeClose)}
|
|
130
134
|
class=${classMap({
|
|
131
135
|
[this.variant]: true,
|
|
@@ -135,23 +139,28 @@ let GdsDialog = class extends withSizeXProps(
|
|
|
135
139
|
>
|
|
136
140
|
<gds-card
|
|
137
141
|
class="card"
|
|
142
|
+
padding="xl"
|
|
138
143
|
variant="secondary"
|
|
139
144
|
box-shadow="xl"
|
|
140
|
-
|
|
141
|
-
border-radius="s"
|
|
145
|
+
border-radius="m"
|
|
142
146
|
max-width="100%"
|
|
147
|
+
@mousedown=${() => __privateSet(this, _clickStartedInside, true)}
|
|
143
148
|
>
|
|
144
149
|
<slot name="dialog">
|
|
145
150
|
<gds-flex justify-content="space-between">
|
|
146
151
|
<h2 id="heading">${this.heading}</h2>
|
|
147
152
|
<gds-button
|
|
148
153
|
id="close-btn"
|
|
149
|
-
rank="
|
|
154
|
+
rank="tertiary"
|
|
150
155
|
size="small"
|
|
151
156
|
label=${msg("Close")}
|
|
152
157
|
@click=${() => this.close("btn-close")}
|
|
153
|
-
|
|
154
|
-
|
|
158
|
+
>
|
|
159
|
+
<gds-icon-cross-large
|
|
160
|
+
size="m"
|
|
161
|
+
stroke="2"
|
|
162
|
+
></gds-icon-cross-large>
|
|
163
|
+
</gds-button>
|
|
155
164
|
</gds-flex>
|
|
156
165
|
<gds-div
|
|
157
166
|
id="content"
|
|
@@ -174,9 +183,9 @@ let GdsDialog = class extends withSizeXProps(
|
|
|
174
183
|
rank="secondary"
|
|
175
184
|
>${msg("Cancel")}</gds-button
|
|
176
185
|
>
|
|
177
|
-
<gds-button value="ok" @click=${() => this.close("btn-ok")}
|
|
178
|
-
|
|
179
|
-
>
|
|
186
|
+
<gds-button value="ok" @click=${() => this.close("btn-ok")}>
|
|
187
|
+
Ok
|
|
188
|
+
</gds-button>
|
|
180
189
|
</slot>
|
|
181
190
|
</gds-flex>
|
|
182
191
|
</slot>
|
|
@@ -190,9 +199,9 @@ let GdsDialog = class extends withSizeXProps(
|
|
|
190
199
|
this.updateComplete.then(() => {
|
|
191
200
|
this._elDialog?.showModal();
|
|
192
201
|
lockBodyScrolling(this);
|
|
193
|
-
|
|
202
|
+
this.removeEventListener("click", __privateGet(this, _handleClickOutside));
|
|
194
203
|
requestAnimationFrame(
|
|
195
|
-
() =>
|
|
204
|
+
() => this.addEventListener("click", __privateGet(this, _handleClickOutside))
|
|
196
205
|
);
|
|
197
206
|
if (isIOS) {
|
|
198
207
|
this._elDialog?.focus();
|
|
@@ -208,6 +217,7 @@ let GdsDialog = class extends withSizeXProps(
|
|
|
208
217
|
}
|
|
209
218
|
};
|
|
210
219
|
_returnValue = new WeakMap();
|
|
220
|
+
_clickStartedInside = new WeakMap();
|
|
211
221
|
_handleNativeClose = new WeakMap();
|
|
212
222
|
_dispatchCloseEvent = new WeakMap();
|
|
213
223
|
_dispatchShowEvent = new WeakMap();
|
|
@@ -250,7 +260,7 @@ __decorateClass([
|
|
|
250
260
|
], GdsDialog.prototype, "_handleOpenChange", 1);
|
|
251
261
|
GdsDialog = __decorateClass([
|
|
252
262
|
gdsCustomElement("gds-dialog", {
|
|
253
|
-
dependsOn: [GdsButton, GdsCard, GdsDiv, GdsFlex,
|
|
263
|
+
dependsOn: [GdsButton, GdsCard, GdsDiv, GdsFlex, IconCrossLarge]
|
|
254
264
|
}),
|
|
255
265
|
localized()
|
|
256
266
|
], GdsDialog);
|
|
@@ -10,9 +10,9 @@ const style = css`
|
|
|
10
10
|
}
|
|
11
11
|
:host(:focus-visible) {
|
|
12
12
|
outline-color: color-mix(in srgb, currentcolor, #000 100%);
|
|
13
|
-
outline-offset: var(--gds-sys-space-
|
|
13
|
+
outline-offset: var(--gds-sys-space-4xs);
|
|
14
14
|
outline-style: solid;
|
|
15
|
-
outline-width: var(--gds-sys-space-
|
|
15
|
+
outline-width: var(--gds-sys-space-4xs);
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
18
|
var div_styles_default = style;
|
|
@@ -24,7 +24,7 @@ import { watch } from "../../utils/decorators/watch.js";
|
|
|
24
24
|
import { GdsFormControlElement } from "../form/form-control.js";
|
|
25
25
|
import { IconCheckmark } from "../icon/icons/checkmark.component.js";
|
|
26
26
|
import { IconChevronBottom } from "../icon/icons/chevron-bottom.component.js";
|
|
27
|
-
import {
|
|
27
|
+
import { IconCrossSmall } from "../icon/icons/cross-small.component.js";
|
|
28
28
|
import { GdsPopover } from "../popover/popover.component.js";
|
|
29
29
|
import DropdownStyles from "./dropdown.styles.js";
|
|
30
30
|
export * from "../../primitives/listbox/option.component.js";
|
|
@@ -347,9 +347,9 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
347
347
|
size=${this.size === "small" ? "xs" : "small"}
|
|
348
348
|
label="${msg("Clear selection")}"
|
|
349
349
|
@click=${__privateGet(this, _handleClearButton)}
|
|
350
|
-
slot="
|
|
350
|
+
slot="action"
|
|
351
351
|
>
|
|
352
|
-
<gds-icon-cross-
|
|
352
|
+
<gds-icon-cross-small></gds-icon-cross-small>
|
|
353
353
|
</gds-button>`
|
|
354
354
|
)}
|
|
355
355
|
${when(this.combobox && !this.multiple, () => __privateGet(this, _renderCombobox).call(this))}
|
|
@@ -357,7 +357,7 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
357
357
|
!this.combobox || this.multiple,
|
|
358
358
|
() => __privateGet(this, _renderTriggerButton).call(this)
|
|
359
359
|
)}
|
|
360
|
-
<gds-icon-chevron-bottom slot="
|
|
360
|
+
<gds-icon-chevron-bottom slot="action"></gds-icon-chevron-bottom>
|
|
361
361
|
</gds-field-base>
|
|
362
362
|
|
|
363
363
|
${when(
|
|
@@ -578,7 +578,7 @@ GdsDropdown = __decorateClass([
|
|
|
578
578
|
GdsPopover,
|
|
579
579
|
IconCheckmark,
|
|
580
580
|
IconChevronBottom,
|
|
581
|
-
|
|
581
|
+
IconCrossSmall
|
|
582
582
|
]
|
|
583
583
|
}),
|
|
584
584
|
localized()
|
|
@@ -42,7 +42,7 @@ const style = css`
|
|
|
42
42
|
outline: none;
|
|
43
43
|
color: var(--gds-sys-color-content-disabled-01);
|
|
44
44
|
border-color: var(--gds-sys-color-border-interactive);
|
|
45
|
-
border-width: 0 0 var(--gds-sys-space-
|
|
45
|
+
border-width: 0 0 var(--gds-sys-space-5xs) 0;
|
|
46
46
|
border-style: solid;
|
|
47
47
|
width: 100%;
|
|
48
48
|
padding: var(--gds-sys-space-m);
|
|
@@ -48,7 +48,7 @@ declare class Input extends GdsFormControlElement<string> {
|
|
|
48
48
|
/** Controls whether and how text input is automatically capitalized as it is entered by the user. */
|
|
49
49
|
autocapitalize: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
|
|
50
50
|
/** Indicates whether the browser's autocorrect feature is on or off. */
|
|
51
|
-
autocorrect
|
|
51
|
+
autocorrect: boolean;
|
|
52
52
|
/**
|
|
53
53
|
* Specifies what permission the browser has to provide assistance in filling out form field values. Refer to
|
|
54
54
|
* [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for available values.
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { GdsButton } from "../button/button.component.js";
|
|
25
25
|
import { GdsFlex } from "../flex/flex.component.js";
|
|
26
26
|
import { GdsFormControlElement } from "../form/form-control.js";
|
|
27
|
-
import {
|
|
27
|
+
import { IconCrossSmall } from "../icon/icons/cross-small.component.js";
|
|
28
28
|
import InputStyles from "./input.styles.js";
|
|
29
29
|
let Input = class extends GdsFormControlElement {
|
|
30
30
|
constructor() {
|
|
@@ -38,6 +38,7 @@ let Input = class extends GdsFormControlElement {
|
|
|
38
38
|
this.plain = false;
|
|
39
39
|
this.type = "text";
|
|
40
40
|
this.autocapitalize = "off";
|
|
41
|
+
this.autocorrect = false;
|
|
41
42
|
this.autofocus = false;
|
|
42
43
|
this.spellcheck = true;
|
|
43
44
|
__privateAdd(this, _handleOnInput, (e) => {
|
|
@@ -187,7 +188,7 @@ renderClearButton_fn = function() {
|
|
|
187
188
|
id="clear-button"
|
|
188
189
|
slot="action"
|
|
189
190
|
>
|
|
190
|
-
<gds-icon-cross-
|
|
191
|
+
<gds-icon-cross-small></gds-icon-cross-small>
|
|
191
192
|
</gds-button>`;
|
|
192
193
|
else return nothing;
|
|
193
194
|
};
|
|
@@ -233,7 +234,7 @@ __decorateClass([
|
|
|
233
234
|
property()
|
|
234
235
|
], Input.prototype, "autocapitalize", 2);
|
|
235
236
|
__decorateClass([
|
|
236
|
-
property()
|
|
237
|
+
property({ type: Boolean })
|
|
237
238
|
], Input.prototype, "autocorrect", 2);
|
|
238
239
|
__decorateClass([
|
|
239
240
|
property()
|
|
@@ -278,7 +279,7 @@ GdsInput = __decorateClass([
|
|
|
278
279
|
GdsFieldBase,
|
|
279
280
|
GdsFlex,
|
|
280
281
|
GdsButton,
|
|
281
|
-
|
|
282
|
+
IconCrossSmall
|
|
282
283
|
]
|
|
283
284
|
})
|
|
284
285
|
], GdsInput);
|
|
@@ -29,7 +29,7 @@ const style = css`
|
|
|
29
29
|
right: 0;
|
|
30
30
|
margin: 0;
|
|
31
31
|
box-shadow: var(--gds-sys-shadow-l-01);
|
|
32
|
-
border: var(--gds-sys-space-
|
|
32
|
+
border: var(--gds-sys-space-5xs) solid
|
|
33
33
|
var(--gds-sys-color-border-subtle-01);
|
|
34
34
|
border-radius: var(--gds-sys-radius-s);
|
|
35
35
|
overscroll-behavior: contain;
|