@sebgroup/green-core 1.81.0 → 1.82.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/checkbox/checkbox-group/checkbox-group.component.js +1 -1
- package/components/datepicker/datepicker.component.js +6 -3
- package/components/datepicker/datepicker.styles.js +2 -2
- package/components/dropdown/dropdown.component.js +6 -3
- package/components/form/form-control.js +2 -2
- package/components/input/input.component.js +4 -4
- package/components/popover/popover.component.js +1 -1
- package/components/radio/radio-group/radio-group.component.js +1 -1
- package/components/textarea/textarea.component.js +6 -4
- package/generated/react/form-control-footer/index.d.ts +2 -2
- package/generated/react/index.d.ts +4 -4
- package/generated/react/index.js +4 -4
- package/package.json +1 -1
- package/primitives/form-control-footer/form-control-footer.component.d.ts +3 -1
- package/primitives/form-control-footer/form-control-footer.component.js +19 -4
- package/primitives/form-control-footer/form-control-footer.styles.js +8 -0
- package/utils/helpers/custom-element-scoping.js +1 -1
|
@@ -153,7 +153,7 @@ renderFieldControlFooter_fn = function() {
|
|
|
153
153
|
return html`<gds-form-control-footer
|
|
154
154
|
id="footer"
|
|
155
155
|
class="size-${this.size}"
|
|
156
|
-
.
|
|
156
|
+
.errorMessage=${this.invalid ? this.errorMessage : void 0}
|
|
157
157
|
>
|
|
158
158
|
</gds-form-control-footer>`;
|
|
159
159
|
};
|
|
@@ -369,13 +369,16 @@ let Datepicker = class extends GdsFormControlElement {
|
|
|
369
369
|
|
|
370
370
|
${when(
|
|
371
371
|
__privateMethod(this, _shouldShowFooter, shouldShowFooter_fn).call(this),
|
|
372
|
-
() => html`<gds-form-control-footer
|
|
372
|
+
() => html`<gds-form-control-footer
|
|
373
|
+
class="size-${this.size}"
|
|
374
|
+
.errorMessage=${this.invalid ? this.errorMessage : void 0}
|
|
375
|
+
>
|
|
373
376
|
${``}
|
|
374
377
|
<slot id="message" name="message" slot="message">
|
|
375
378
|
<gds-icon-triangle-exclamation
|
|
376
379
|
solid
|
|
377
380
|
></gds-icon-triangle-exclamation>
|
|
378
|
-
${this.errorMessage
|
|
381
|
+
${this.errorMessage}
|
|
379
382
|
</slot>
|
|
380
383
|
</gds-form-control-footer>`
|
|
381
384
|
)}
|
|
@@ -553,7 +556,7 @@ let Datepicker = class extends GdsFormControlElement {
|
|
|
553
556
|
_valueOnOpen = new WeakMap();
|
|
554
557
|
_shouldShowFooter = new WeakSet();
|
|
555
558
|
shouldShowFooter_fn = function() {
|
|
556
|
-
return !this.plain
|
|
559
|
+
return !this.plain;
|
|
557
560
|
};
|
|
558
561
|
_renderBackToValidRangeButton = new WeakSet();
|
|
559
562
|
renderBackToValidRangeButton_fn = async function() {
|
|
@@ -38,8 +38,8 @@ const styles = css`
|
|
|
38
38
|
text-align: center;
|
|
39
39
|
|
|
40
40
|
&:focus {
|
|
41
|
-
background-color: var(--gds-color-l2-background-tertiary);
|
|
42
|
-
color: var(--gds-color-l2-content-tertiary);
|
|
41
|
+
background-color: var(--gds-sys-color-l2-background-tertiary);
|
|
42
|
+
color: var(--gds-sys-color-l2-content-tertiary);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -373,13 +373,16 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
373
373
|
${when(
|
|
374
374
|
__privateMethod(this, _shouldShowFooter, shouldShowFooter_fn).call(this),
|
|
375
375
|
() => html`
|
|
376
|
-
<gds-form-control-footer
|
|
376
|
+
<gds-form-control-footer
|
|
377
|
+
class="size-${this.size}"
|
|
378
|
+
.errorMessage=${this.invalid ? this.errorMessage : void 0}
|
|
379
|
+
>
|
|
377
380
|
${``}
|
|
378
381
|
<slot id="message" name="message" slot="message">
|
|
379
382
|
<gds-icon-triangle-exclamation
|
|
380
383
|
solid
|
|
381
384
|
></gds-icon-triangle-exclamation>
|
|
382
|
-
${this.
|
|
385
|
+
${this.validationMessage || this.errorMessage}
|
|
383
386
|
</slot>
|
|
384
387
|
</gds-form-control-footer>
|
|
385
388
|
`
|
|
@@ -439,7 +442,7 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
439
442
|
_optionElements = new WeakMap();
|
|
440
443
|
_shouldShowFooter = new WeakSet();
|
|
441
444
|
shouldShowFooter_fn = function() {
|
|
442
|
-
return !this.plain
|
|
445
|
+
return !this.plain;
|
|
443
446
|
};
|
|
444
447
|
_renderCombobox = new WeakMap();
|
|
445
448
|
_renderTriggerButton = new WeakMap();
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
__privateSet
|
|
6
6
|
} from "../../chunks/chunk.QTSIPXV3.js";
|
|
7
7
|
var _internals;
|
|
8
|
-
import { msg } from "@lit/localize";
|
|
9
8
|
import { property } from "lit/decorators.js";
|
|
10
9
|
import { GdsElement } from "../../gds-element.js";
|
|
11
10
|
import { watch } from "../../utils/decorators/index.js";
|
|
@@ -59,7 +58,7 @@ class GdsFormControlElement extends GdsElement {
|
|
|
59
58
|
customError: value,
|
|
60
59
|
valid: !value
|
|
61
60
|
},
|
|
62
|
-
this.validationMessage ||
|
|
61
|
+
this.errorMessage || this.validationMessage || " ",
|
|
63
62
|
// @ts-expect-error - setValidity actually takes an element as the third argument, but the type definition is wrong.
|
|
64
63
|
this._getValidityAnchor() || void 0
|
|
65
64
|
);
|
|
@@ -99,6 +98,7 @@ class GdsFormControlElement extends GdsElement {
|
|
|
99
98
|
{ ...this.validity, valid: true },
|
|
100
99
|
""
|
|
101
100
|
];
|
|
101
|
+
this.errorMessage = validity[1] || this.errorMessage;
|
|
102
102
|
__privateGet(this, _internals).setValidity(
|
|
103
103
|
validity[0],
|
|
104
104
|
validity[1],
|
|
@@ -121,10 +121,10 @@ let Input = class extends GdsFormControlElement {
|
|
|
121
121
|
</gds-field-base>
|
|
122
122
|
${when(
|
|
123
123
|
__privateMethod(this, _shouldShowFooter, shouldShowFooter_fn).call(this),
|
|
124
|
-
() => html
|
|
124
|
+
() => html` <gds-form-control-footer
|
|
125
125
|
class="size-${this.size}"
|
|
126
|
-
.charCounter=${__privateGet(this, _shouldShowRemainingChars, shouldShowRemainingChars_get)
|
|
127
|
-
.
|
|
126
|
+
.charCounter=${__privateGet(this, _shouldShowRemainingChars, shouldShowRemainingChars_get) ? this.maxlength - (this.value?.length || 0) : void 0}
|
|
127
|
+
.errorMessage=${this.invalid ? this.errorMessage : void 0}
|
|
128
128
|
></gds-form-control-footer>`
|
|
129
129
|
)}
|
|
130
130
|
`;
|
|
@@ -135,7 +135,7 @@ let Input = class extends GdsFormControlElement {
|
|
|
135
135
|
};
|
|
136
136
|
_shouldShowFooter = new WeakSet();
|
|
137
137
|
shouldShowFooter_fn = function() {
|
|
138
|
-
return !this.plain
|
|
138
|
+
return !this.plain;
|
|
139
139
|
};
|
|
140
140
|
_handleOnInput = new WeakMap();
|
|
141
141
|
_handleOnChange = new WeakMap();
|
|
@@ -145,7 +145,7 @@ let GdsPopover = class extends GdsElement {
|
|
|
145
145
|
});
|
|
146
146
|
this.addEventListener("focusin", (e) => {
|
|
147
147
|
const t = e.target;
|
|
148
|
-
if (t.tagName === "INPUT" || t.tagName === "TEXTAREA") {
|
|
148
|
+
if (t === this || t.tagName === "INPUT" || t.tagName === "TEXTAREA") {
|
|
149
149
|
this._isVirtKbVisible = true;
|
|
150
150
|
} else {
|
|
151
151
|
this._isVirtKbVisible = false;
|
|
@@ -245,7 +245,7 @@ renderFieldControlFooter_fn = function() {
|
|
|
245
245
|
return html` <gds-form-control-footer
|
|
246
246
|
id="footer"
|
|
247
247
|
class="size-${this.size}"
|
|
248
|
-
.
|
|
248
|
+
.errorMessage=${this.invalid ? this.errorMessage : void 0}
|
|
249
249
|
>
|
|
250
250
|
</gds-form-control-footer>`;
|
|
251
251
|
};
|
|
@@ -188,9 +188,10 @@ let Textarea = class extends GdsFormControlElement {
|
|
|
188
188
|
${when(
|
|
189
189
|
__privateMethod(this, _shouldShowFooter, shouldShowFooter_fn).call(this),
|
|
190
190
|
() => html`<gds-form-control-footer
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
.
|
|
191
|
+
id="footer"
|
|
192
|
+
class="size-${this.size}"
|
|
193
|
+
.charCounter=${__privateGet(this, _shouldShowRemainingChars, shouldShowRemainingChars_get) ? this.maxlength - (this.value?.length || 0) : void 0}
|
|
194
|
+
.errorMessage=${this.invalid ? this.errorMessage : void 0}
|
|
194
195
|
></gds-form-control-footer>`
|
|
195
196
|
)}
|
|
196
197
|
`;
|
|
@@ -239,7 +240,7 @@ let Textarea = class extends GdsFormControlElement {
|
|
|
239
240
|
};
|
|
240
241
|
_shouldShowFooter = new WeakSet();
|
|
241
242
|
shouldShowFooter_fn = function() {
|
|
242
|
-
return !this.plain
|
|
243
|
+
return !this.plain;
|
|
243
244
|
};
|
|
244
245
|
_handleOnInput = new WeakMap();
|
|
245
246
|
_handleOnChange = new WeakMap();
|
|
@@ -276,6 +277,7 @@ renderNativeTextarea_fn = function() {
|
|
|
276
277
|
class="native-control resize-${this.resizable}"
|
|
277
278
|
aria-label=${this.plain && this.label || nothing}
|
|
278
279
|
aria-describedby="supporting-text extended-supporting-text sub-label message"
|
|
280
|
+
aria-errormessage="footer"
|
|
279
281
|
placeholder=" "
|
|
280
282
|
autocapitalize=${ifDefined(this.autocapitalize)}
|
|
281
283
|
autocomplete=${ifDefined(this.autocomplete)}
|
|
@@ -2,12 +2,12 @@ import { getReactComponent } from "../../../utils/react";
|
|
|
2
2
|
import { GdsFormControlFooter as GdsFormControlFooterClass } from "../../../primitives/form-control-footer/form-control-footer.component";
|
|
3
3
|
export declare const GdsFormControlFooter: (props: React.ComponentProps<ReturnType<typeof getReactComponent<GdsFormControlFooterClass>>>) => import("react").ReactElement<Omit<{
|
|
4
4
|
charCounter?: number | undefined;
|
|
5
|
-
|
|
5
|
+
errorMessage?: string | undefined;
|
|
6
|
+
connectedCallback?: (() => void) | undefined;
|
|
6
7
|
render?: (() => any) | undefined;
|
|
7
8
|
gdsElementName?: string | undefined;
|
|
8
9
|
_isUsingTransitionalStyles?: boolean | undefined;
|
|
9
10
|
_dynamicStylesController?: import("../../../utils/controllers/dynamic-styles-controller").DynamicStylesController | undefined;
|
|
10
|
-
connectedCallback?: (() => void) | undefined;
|
|
11
11
|
disconnectedCallback?: (() => void) | undefined;
|
|
12
12
|
readonly renderOptions?: import("lit-html").RenderOptions | undefined;
|
|
13
13
|
readonly renderRoot?: HTMLElement | DocumentFragment | undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * from './badge/index.js';
|
|
2
|
+
export * from './blur/index.js';
|
|
2
3
|
export * from './breadcrumbs/index.js';
|
|
3
4
|
export * from './button/index.js';
|
|
4
5
|
export * from './calendar/index.js';
|
|
5
|
-
export * from './blur/index.js';
|
|
6
6
|
export * from './card/index.js';
|
|
7
7
|
export * from './checkbox/index.js';
|
|
8
|
-
export * from './container/index.js';
|
|
9
8
|
export * from './coachmark/index.js';
|
|
9
|
+
export * from './container/index.js';
|
|
10
10
|
export * from './context-menu/index.js';
|
|
11
11
|
export * from './datepicker/index.js';
|
|
12
12
|
export * from './details/index.js';
|
|
@@ -52,8 +52,6 @@ export * from './formatted-number/index.js';
|
|
|
52
52
|
export * from './radio-group/index.js';
|
|
53
53
|
export * from './segment/index.js';
|
|
54
54
|
export * from './sensitive-account/index.js';
|
|
55
|
-
export * from './sensitive-date/index.js';
|
|
56
|
-
export * from './sensitive-number/index.js';
|
|
57
55
|
export * from './icons/icon-ai/index.js';
|
|
58
56
|
export * from './icons/icon-airplane-up/index.js';
|
|
59
57
|
export * from './icons/icon-archive/index.js';
|
|
@@ -341,3 +339,5 @@ export * from './icons/icon-youtube/index.js';
|
|
|
341
339
|
export * from './icons/icon-zap/index.js';
|
|
342
340
|
export * from './icons/icon-zoom-in/index.js';
|
|
343
341
|
export * from './icons/icon-zoom-out/index.js';
|
|
342
|
+
export * from './sensitive-date/index.js';
|
|
343
|
+
export * from './sensitive-number/index.js';
|
package/generated/react/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * from "./badge/index.js";
|
|
2
|
+
export * from "./blur/index.js";
|
|
2
3
|
export * from "./breadcrumbs/index.js";
|
|
3
4
|
export * from "./button/index.js";
|
|
4
5
|
export * from "./calendar/index.js";
|
|
5
|
-
export * from "./blur/index.js";
|
|
6
6
|
export * from "./card/index.js";
|
|
7
7
|
export * from "./checkbox/index.js";
|
|
8
|
-
export * from "./container/index.js";
|
|
9
8
|
export * from "./coachmark/index.js";
|
|
9
|
+
export * from "./container/index.js";
|
|
10
10
|
export * from "./context-menu/index.js";
|
|
11
11
|
export * from "./datepicker/index.js";
|
|
12
12
|
export * from "./details/index.js";
|
|
@@ -52,8 +52,6 @@ export * from "./formatted-number/index.js";
|
|
|
52
52
|
export * from "./radio-group/index.js";
|
|
53
53
|
export * from "./segment/index.js";
|
|
54
54
|
export * from "./sensitive-account/index.js";
|
|
55
|
-
export * from "./sensitive-date/index.js";
|
|
56
|
-
export * from "./sensitive-number/index.js";
|
|
57
55
|
export * from "./icons/icon-ai/index.js";
|
|
58
56
|
export * from "./icons/icon-airplane-up/index.js";
|
|
59
57
|
export * from "./icons/icon-archive/index.js";
|
|
@@ -341,3 +339,5 @@ export * from "./icons/icon-youtube/index.js";
|
|
|
341
339
|
export * from "./icons/icon-zap/index.js";
|
|
342
340
|
export * from "./icons/icon-zoom-in/index.js";
|
|
343
341
|
export * from "./icons/icon-zoom-out/index.js";
|
|
342
|
+
export * from "./sensitive-date/index.js";
|
|
343
|
+
export * from "./sensitive-number/index.js";
|
package/package.json
CHANGED
|
@@ -6,6 +6,8 @@ export declare class GdsFormControlFooter extends GdsElement {
|
|
|
6
6
|
#private;
|
|
7
7
|
static styles: import("lit").CSSResult[];
|
|
8
8
|
charCounter?: number;
|
|
9
|
-
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
private _handleVisibilityChange;
|
|
11
|
+
connectedCallback(): void;
|
|
10
12
|
render(): any;
|
|
11
13
|
}
|
|
@@ -9,6 +9,7 @@ import { when } from "lit/directives/when.js";
|
|
|
9
9
|
import { GdsBadge } from "../../components/badge/badge.component.js";
|
|
10
10
|
import { IconTriangleExclamation } from "../../components/icon/icons/triangle-exclamation.component.js";
|
|
11
11
|
import { GdsElement } from "../../gds-element.js";
|
|
12
|
+
import { watch } from "../../utils/decorators/watch.js";
|
|
12
13
|
import {
|
|
13
14
|
gdsCustomElement,
|
|
14
15
|
html
|
|
@@ -19,22 +20,32 @@ let GdsFormControlFooter = class extends GdsElement {
|
|
|
19
20
|
super(...arguments);
|
|
20
21
|
__privateAdd(this, _renderRemainingCharsBadge);
|
|
21
22
|
}
|
|
23
|
+
_handleVisibilityChange() {
|
|
24
|
+
this.classList.toggle(
|
|
25
|
+
"visually-hidden",
|
|
26
|
+
!this.errorMessage && !this.charCounter
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
connectedCallback() {
|
|
30
|
+
super.connectedCallback();
|
|
31
|
+
this._handleVisibilityChange();
|
|
32
|
+
}
|
|
22
33
|
render() {
|
|
23
34
|
return html`<div aria-live="polite">
|
|
24
35
|
<div class="error-message">
|
|
25
36
|
<slot name="message"
|
|
26
37
|
>${when(
|
|
27
|
-
this.
|
|
38
|
+
this.errorMessage,
|
|
28
39
|
() => html`
|
|
29
40
|
<gds-icon-triangle-exclamation
|
|
30
41
|
solid
|
|
31
42
|
></gds-icon-triangle-exclamation>
|
|
32
|
-
${this.
|
|
43
|
+
${this.errorMessage}
|
|
33
44
|
`
|
|
34
45
|
)}</slot
|
|
35
46
|
>
|
|
36
47
|
</div>
|
|
37
|
-
<div class="char-counter">
|
|
48
|
+
<div class="char-counter" aria-hidden="true">
|
|
38
49
|
${when(
|
|
39
50
|
Number.isInteger(this.charCounter),
|
|
40
51
|
() => __privateMethod(this, _renderRemainingCharsBadge, renderRemainingCharsBadge_fn).call(this, this.charCounter)
|
|
@@ -61,7 +72,11 @@ __decorateClass([
|
|
|
61
72
|
], GdsFormControlFooter.prototype, "charCounter", 2);
|
|
62
73
|
__decorateClass([
|
|
63
74
|
property()
|
|
64
|
-
], GdsFormControlFooter.prototype, "
|
|
75
|
+
], GdsFormControlFooter.prototype, "errorMessage", 2);
|
|
76
|
+
__decorateClass([
|
|
77
|
+
watch("charCounter"),
|
|
78
|
+
watch("errorMessage")
|
|
79
|
+
], GdsFormControlFooter.prototype, "_handleVisibilityChange", 1);
|
|
65
80
|
GdsFormControlFooter = __decorateClass([
|
|
66
81
|
gdsCustomElement("gds-form-control-footer", {
|
|
67
82
|
dependsOn: [GdsBadge, IconTriangleExclamation]
|
|
@@ -3,6 +3,14 @@ import { css } from "lit";
|
|
|
3
3
|
const styles = css`
|
|
4
4
|
@layer base, reset, transitional-styles;
|
|
5
5
|
@layer base {
|
|
6
|
+
:host(.visually-hidden) {
|
|
7
|
+
position: absolute;
|
|
8
|
+
clip: rect(0 0 0 0);
|
|
9
|
+
width: 0px;
|
|
10
|
+
height: 0px;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
6
14
|
:host > *:not(style) {
|
|
7
15
|
display: flex;
|
|
8
16
|
justify-content: space-between;
|