@riverty/web-components 5.7.0 → 5.8.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/CHANGELOG.md +42 -0
- package/custom-elements.json +28 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/r-alert.cjs.entry.js +24 -8
- package/dist/cjs/r-button.cjs.entry.js +1 -1
- package/dist/cjs/r-checkbox-group.cjs.entry.js +27 -13
- package/dist/cjs/r-checkbox.cjs.entry.js +25 -10
- package/dist/cjs/r-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/r-icon.cjs.entry.js +1 -1
- package/dist/cjs/r-input-code.cjs.entry.js +29 -16
- package/dist/cjs/r-input-date.cjs.entry.js +85 -15
- package/dist/cjs/r-input-password.cjs.entry.js +20 -7
- package/dist/cjs/r-input-phone-number.cjs.entry.js +27 -14
- package/dist/cjs/r-input.cjs.entry.js +24 -11
- package/dist/cjs/r-pagination.cjs.entry.js +1 -1
- package/dist/cjs/r-popover-action.cjs.entry.js +1 -1
- package/dist/cjs/r-popover.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-group.cjs.entry.js +20 -16
- package/dist/cjs/r-select.cjs.entry.js +112 -18
- package/dist/cjs/r-textarea.cjs.entry.js +18 -5
- package/dist/cjs/r-toast.cjs.entry.js +50 -19
- package/dist/cjs/web-components.cjs.js +1 -1
- package/dist/collection/components/alert/alert.css +52 -12
- package/dist/collection/components/alert/alert.js +48 -11
- package/dist/collection/components/alert/exports.js +1 -1
- package/dist/collection/components/button/button.css +6 -7
- package/dist/collection/components/checkbox/checkbox.js +45 -10
- package/dist/collection/components/checkbox-group/checkbox-group.js +47 -13
- package/dist/collection/components/icon/bundled-icons/riverty-kit.json +1 -1
- package/dist/collection/components/icon/riverty-kit.js +1 -1
- package/dist/collection/components/icon-button/icon-button.css +0 -7
- package/dist/collection/components/input/input.js +44 -11
- package/dist/collection/components/input-code/input-code.js +49 -16
- package/dist/collection/components/input-date/input-date.js +235 -16
- package/dist/collection/components/input-password/input-password.js +40 -7
- package/dist/collection/components/input-phone-number/input-phone-number.js +47 -14
- package/dist/collection/components/pagination/pagination.css +23 -23
- package/dist/collection/components/popover/popover.css +11 -3
- package/dist/collection/components/popover-action/popover-action.css +3 -5
- package/dist/collection/components/radio-group/radio-group.js +21 -17
- package/dist/collection/components/select/select.js +193 -21
- package/dist/collection/components/textarea/textarea.js +38 -5
- package/dist/collection/components/toast/toast.css +22 -14
- package/dist/collection/components/toast/toast.js +94 -20
- package/dist/esm/loader.js +1 -1
- package/dist/esm/r-alert.entry.js +24 -8
- package/dist/esm/r-button.entry.js +1 -1
- package/dist/esm/r-checkbox-group.entry.js +27 -13
- package/dist/esm/r-checkbox.entry.js +25 -10
- package/dist/esm/r-icon-button.entry.js +1 -1
- package/dist/esm/r-icon.entry.js +1 -1
- package/dist/esm/r-input-code.entry.js +29 -16
- package/dist/esm/r-input-date.entry.js +85 -15
- package/dist/esm/r-input-password.entry.js +20 -7
- package/dist/esm/r-input-phone-number.entry.js +27 -14
- package/dist/esm/r-input.entry.js +24 -11
- package/dist/esm/r-pagination.entry.js +1 -1
- package/dist/esm/r-popover-action.entry.js +1 -1
- package/dist/esm/r-popover.entry.js +1 -1
- package/dist/esm/r-radio-group.entry.js +20 -16
- package/dist/esm/r-select.entry.js +112 -18
- package/dist/esm/r-textarea.entry.js +18 -5
- package/dist/esm/r-toast.entry.js +50 -19
- package/dist/esm/web-components.js +1 -1
- package/dist/types/components/alert/alert.d.ts +3 -0
- package/dist/types/components/alert/exports.d.ts +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +5 -0
- package/dist/types/components/checkbox-group/checkbox-group.d.ts +6 -0
- package/dist/types/components/input/input.d.ts +5 -0
- package/dist/types/components/input-code/input-code.d.ts +5 -0
- package/dist/types/components/input-date/input-date.d.ts +30 -0
- package/dist/types/components/input-password/input-password.d.ts +5 -0
- package/dist/types/components/input-phone-number/input-phone-number.d.ts +5 -0
- package/dist/types/components/radio-group/radio-group.d.ts +1 -2
- package/dist/types/components/select/select.d.ts +34 -2
- package/dist/types/components/textarea/textarea.d.ts +5 -0
- package/dist/types/components/toast/toast.d.ts +10 -2
- package/dist/types/components.d.ts +143 -8
- package/dist/web-components/bundled-icons/riverty-kit.json +1 -1
- package/dist/web-components/p-15ac0fdd.entry.js +1 -0
- package/dist/web-components/p-1c956370.entry.js +1 -0
- package/dist/web-components/p-2a512983.entry.js +1 -0
- package/dist/web-components/p-2e18e762.entry.js +1 -0
- package/dist/web-components/{p-72c0c0d8.entry.js → p-3078b2b8.entry.js} +1 -1
- package/dist/web-components/p-56da04d8.entry.js +1 -0
- package/dist/web-components/p-5744d75c.entry.js +1 -0
- package/dist/web-components/p-5bbd6e3c.entry.js +1 -0
- package/dist/web-components/p-5e6aabd8.entry.js +1 -0
- package/dist/web-components/p-656229de.entry.js +1 -0
- package/dist/web-components/p-6a4f3836.entry.js +1 -0
- package/dist/web-components/p-7775228c.entry.js +1 -0
- package/dist/web-components/p-8563a1ab.entry.js +1 -0
- package/dist/web-components/p-ad9b2a48.entry.js +1 -0
- package/dist/web-components/p-b87ad83b.entry.js +1 -0
- package/dist/web-components/{p-77155630.entry.js → p-b98ab649.entry.js} +1 -1
- package/dist/web-components/p-dbe579e8.entry.js +1 -0
- package/dist/web-components/p-f2577a3c.entry.js +1 -0
- package/dist/web-components/web-components.esm.js +1 -1
- package/package.json +1 -1
- package/dist/web-components/p-289eb4b0.entry.js +0 -1
- package/dist/web-components/p-2b8e12ae.entry.js +0 -1
- package/dist/web-components/p-2e2c8a5b.entry.js +0 -1
- package/dist/web-components/p-3a39932b.entry.js +0 -1
- package/dist/web-components/p-44be9992.entry.js +0 -1
- package/dist/web-components/p-4652635a.entry.js +0 -1
- package/dist/web-components/p-63474b32.entry.js +0 -1
- package/dist/web-components/p-74d2a563.entry.js +0 -1
- package/dist/web-components/p-8028c2a9.entry.js +0 -1
- package/dist/web-components/p-96ddeb7f.entry.js +0 -1
- package/dist/web-components/p-9d898089.entry.js +0 -1
- package/dist/web-components/p-9eb1f262.entry.js +0 -1
- package/dist/web-components/p-c300c22f.entry.js +0 -1
- package/dist/web-components/p-d93c240d.entry.js +0 -1
- package/dist/web-components/p-f770e22b.entry.js +0 -1
- package/dist/web-components/p-f952161b.entry.js +0 -1
|
@@ -3,13 +3,9 @@
|
|
|
3
3
|
--background-color: var(--r-status-info-regular, #3e5c73);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
:host([status=success]) {
|
|
7
|
-
--color: var(--r-status-success-soft, #f7fdf8);
|
|
8
|
-
--background-color: var(--r-status-success-regular, #298535);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
6
|
:host([status=warning]) {
|
|
12
|
-
--color: var(--r-
|
|
7
|
+
--color: var(--r-text-warning, #000000);
|
|
8
|
+
--r-alert--leading-icon--color: var(--r-icon-warning, #000000);
|
|
13
9
|
--background-color: var(--r-status-warning-regular, #ff7429);
|
|
14
10
|
}
|
|
15
11
|
|
|
@@ -18,6 +14,27 @@
|
|
|
18
14
|
--background-color: var(--r-status-error-regular, #b00c15);
|
|
19
15
|
}
|
|
20
16
|
|
|
17
|
+
:host([status=error]) r-icon-button:hover,
|
|
18
|
+
:host([status=info]) r-icon-button:hover {
|
|
19
|
+
--r-icon-button--background-color: var(--r-background-interactive-hovered-inverse, rgba(243, 241, 240, 0.04));
|
|
20
|
+
}
|
|
21
|
+
:host([status=error]) r-icon-button:active,
|
|
22
|
+
:host([status=info]) r-icon-button:active {
|
|
23
|
+
--r-icon-button--background-color: var(--r-background-interactive-pressed-inverse, rgba(243, 241, 240, 0.12));
|
|
24
|
+
}
|
|
25
|
+
:host([status=error]) .r-alert--link:hover,
|
|
26
|
+
:host([status=error]) ::slotted(r-button:hover:not([disabled]):not([disabled=true])),
|
|
27
|
+
:host([status=info]) .r-alert--link:hover,
|
|
28
|
+
:host([status=info]) ::slotted(r-button:hover:not([disabled]):not([disabled=true])) {
|
|
29
|
+
--r-button--background-color: var(--r-background-interactive-hovered-inverse, rgba(243, 241, 240, 0.04));
|
|
30
|
+
}
|
|
31
|
+
:host([status=error]) .r-alert--link:active,
|
|
32
|
+
:host([status=error]) ::slotted(r-button:active:not([disabled]):not([disabled=true])),
|
|
33
|
+
:host([status=info]) .r-alert--link:active,
|
|
34
|
+
:host([status=info]) ::slotted(r-button:active:not([disabled]):not([disabled=true])) {
|
|
35
|
+
--r-button--background-color--active: var(--r-background-interactive-pressed-inverse, rgba(243, 241, 240, 0.12));
|
|
36
|
+
}
|
|
37
|
+
|
|
21
38
|
:host([aria-hidden=true]) {
|
|
22
39
|
--transition: all 0.5s;
|
|
23
40
|
--position: absolute;
|
|
@@ -38,23 +55,25 @@
|
|
|
38
55
|
opacity: var(--opacity, 1);
|
|
39
56
|
z-index: var(--z-index, unset);
|
|
40
57
|
font-family: var(--font-family, var(--r-font-family-text, system-ui));
|
|
41
|
-
font-size: var(--font-size, var(--r-font-size-400,
|
|
58
|
+
font-size: var(--font-size, var(--r-font-size-400, 1rem));
|
|
42
59
|
font-weight: var(--font-weight, var(--r-font-weight-regular, 400));
|
|
43
60
|
}
|
|
61
|
+
@media (prefers-reduced-motion) {
|
|
62
|
+
:host {
|
|
63
|
+
transition: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
44
66
|
|
|
45
67
|
.r-alert {
|
|
46
68
|
display: var(--r-alert--display, grid);
|
|
47
69
|
grid-template-columns: var(--r-alert--grid-template-columns, auto 1fr auto);
|
|
48
70
|
gap: var(--r-alert--gap, var(--r-spacing-100, 1rem));
|
|
49
|
-
padding: var(--r-alert--padding,
|
|
71
|
+
padding: var(--r-alert--padding, 16px);
|
|
50
72
|
box-sizing: var(--r-alert--box-sizing, border-box);
|
|
51
73
|
}
|
|
52
74
|
.r-alert:empty {
|
|
53
75
|
--r-alert--display: none;
|
|
54
76
|
}
|
|
55
|
-
.r-alert a {
|
|
56
|
-
color: var(--color);
|
|
57
|
-
}
|
|
58
77
|
.r-alert--main {
|
|
59
78
|
display: var(--r-alert--main--display, flex);
|
|
60
79
|
flex-flow: var(--r-alert--main--flex-flow, column);
|
|
@@ -67,7 +86,28 @@
|
|
|
67
86
|
line-height: var(--r-alert--headline--line-height, var(--r-line-height-m, 1.5));
|
|
68
87
|
margin: var(--r-alert--headline--margin, 0);
|
|
69
88
|
}
|
|
70
|
-
.r-alert--
|
|
89
|
+
.r-alert--leading {
|
|
90
|
+
color: var(--r-alert--leading-icon--color, var(--color));
|
|
91
|
+
}
|
|
92
|
+
.r-alert--trailing r-icon-button {
|
|
71
93
|
--r-button--padding: 0;
|
|
72
94
|
--r-button--color: var(--color);
|
|
73
95
|
}
|
|
96
|
+
.r-alert--link,
|
|
97
|
+
.r-alert ::slotted(r-button) {
|
|
98
|
+
--r-button--background-color: transparent;
|
|
99
|
+
--r-button--border-width: 0;
|
|
100
|
+
--r-button--color: var(--r-alert--link--color, var(--color));
|
|
101
|
+
--r-button--padding: 10px 2px 18px 2px;
|
|
102
|
+
--r-button--slot--text-decoration: underline;
|
|
103
|
+
--r-button--slot--text-underline-offset: 9px;
|
|
104
|
+
}
|
|
105
|
+
.r-alert--link:hover,
|
|
106
|
+
.r-alert ::slotted(r-button:hover:not([disabled]):not([disabled=true])) {
|
|
107
|
+
--r-button--background-color: var(--r-background-interactive-hovered);
|
|
108
|
+
}
|
|
109
|
+
.r-alert--link:active,
|
|
110
|
+
.r-alert ::slotted(r-button:active:not([disabled]):not([disabled=true])) {
|
|
111
|
+
--r-button--color--active: var(--r-alert--link--color, var(--color));
|
|
112
|
+
--r-button--background-color--active: var(--r-background-interactive-pressed);
|
|
113
|
+
}
|
|
@@ -3,17 +3,21 @@ export class Alert {
|
|
|
3
3
|
constructor() {
|
|
4
4
|
/** Alert status controls apperance according to the status */
|
|
5
5
|
this.status = 'info';
|
|
6
|
+
/** Sets role="alert" and will be announced to screen reader users */
|
|
7
|
+
this.announced = true;
|
|
6
8
|
/** Defines an icon size to be presented in leading slot*/
|
|
7
9
|
this.leadingIconSize = 'm';
|
|
10
|
+
/** Defines an icon to be presented in trailing slot */
|
|
11
|
+
this.trailingIcon = 'cross';
|
|
8
12
|
/** Defines an icon size to be presented in trailing slot*/
|
|
9
|
-
this.trailingIconSize = '
|
|
13
|
+
this.trailingIconSize = 'm';
|
|
10
14
|
/**
|
|
11
15
|
* Defines the target for the linked URL when `href` is provided.
|
|
12
16
|
* Options: `"_blank"`, `"_self"`, `"_parent"`, `"_top"`.
|
|
13
17
|
*/
|
|
14
18
|
this.target = '_self';
|
|
15
19
|
/** Text content for an alert dismiss button */
|
|
16
|
-
this.dismissButtonAriaLabel = '
|
|
20
|
+
this.dismissButtonAriaLabel = 'Dismiss alert';
|
|
17
21
|
this.isElContent = (selector) => {
|
|
18
22
|
const el = this.host.querySelector(selector);
|
|
19
23
|
return el !== null && (el === null || el === void 0 ? void 0 : el.textContent.trim().length) > 0;
|
|
@@ -74,11 +78,23 @@ export class Alert {
|
|
|
74
78
|
get isDelay() {
|
|
75
79
|
return this.delay && this.delay >= 0;
|
|
76
80
|
}
|
|
81
|
+
get headlineSlotContent() {
|
|
82
|
+
var _a;
|
|
83
|
+
const el = this.host.querySelector('[slot="headline"]');
|
|
84
|
+
return (_a = el === null || el === void 0 ? void 0 : el.textContent) === null || _a === void 0 ? void 0 : _a.trim();
|
|
85
|
+
}
|
|
77
86
|
componentDidLoad() {
|
|
78
87
|
if (this.isDelay)
|
|
79
88
|
this.startCollapseTimer();
|
|
80
89
|
}
|
|
81
90
|
render() {
|
|
91
|
+
const hostAttrs = this.announced ? {
|
|
92
|
+
role: 'alert',
|
|
93
|
+
'aria-live': this.status === 'info' ? 'polite' : 'assertive'
|
|
94
|
+
} : {
|
|
95
|
+
role: 'region',
|
|
96
|
+
'aria-label': this.headlineSlotContent || this.headline || null
|
|
97
|
+
};
|
|
82
98
|
const leadingIconAttrs = {
|
|
83
99
|
name: this.leadingIcon,
|
|
84
100
|
src: this.leadingIconSrc,
|
|
@@ -89,14 +105,14 @@ export class Alert {
|
|
|
89
105
|
src: this.trailingIconSrc,
|
|
90
106
|
size: this.trailingIconSize
|
|
91
107
|
};
|
|
92
|
-
return (h(Host, { key: '
|
|
93
|
-
h("div", { key: '
|
|
108
|
+
return (h(Host, Object.assign({ key: '21f71227b2d8e749b9c222553324b7a518db6c00' }, hostAttrs), h("div", { key: '04545eb2e7f5aa149e08b1098a09b7bbd41b8f8b', class: "r-alert" }, this.isLeading &&
|
|
109
|
+
h("div", { key: '697fcb773c8688605bc369ecd562595f841c8b86', class: "r-alert--leading" }, h("slot", { key: 'e4f2341b214b5813c05663b98ebaf59144a29a21', name: "leading" }), this.isLeadingIcon && h("r-icon", Object.assign({ key: '94d64589b0b6063ba22b1b044a03505e8accc03a' }, leadingIconAttrs))), this.isMain ?
|
|
94
110
|
h("div", { class: "r-alert--main" }, h("slot", { name: "headline" }, this.isHeadline && h("h3", { class: "r-alert--headline" }, this.headline)), h("slot", { name: "content" }, this.isContent && h("div", { class: "r-alert--content" }, this.content)), h("slot", { name: "link" }, this.isLink &&
|
|
95
|
-
h("
|
|
111
|
+
h("r-button", { class: "r-alert--link", variant: "text-inline", size: "small", href: this.href, target: this.target }, this.linkText)), h("slot", null))
|
|
96
112
|
:
|
|
97
113
|
h("slot", null), this.isTrailing &&
|
|
98
|
-
h("div", { key: '
|
|
99
|
-
h("r-button", { key: '
|
|
114
|
+
h("div", { key: '5ff4fffe810c9239edde784eae84640241881b26', class: "r-alert--trailing" }, h("slot", { key: '633dc2f469d7e5d30d3168cad9f09d2d571907b0', name: "trailing" }, this.isTrailingIcon &&
|
|
115
|
+
h("r-icon-button", { key: '32bf203995271d64ad7ba57a979c5894d9da152d', name: !this.trailingIconSrc ? this.trailingIcon : null, onClick: this.handleTrailingButtonClick, label: this.dismissButtonAriaLabel }, this.trailingIconSrc && h("r-icon", Object.assign({ key: 'b3dcf618e5910745944600065c622ff6e19a953d' }, trailingIconAttrs))))))));
|
|
100
116
|
}
|
|
101
117
|
static get is() { return "r-alert"; }
|
|
102
118
|
static get encapsulation() { return "shadow"; }
|
|
@@ -118,7 +134,7 @@ export class Alert {
|
|
|
118
134
|
"mutable": false,
|
|
119
135
|
"complexType": {
|
|
120
136
|
"original": "AlertStatus",
|
|
121
|
-
"resolved": "\"error\" | \"info\" | \"
|
|
137
|
+
"resolved": "\"error\" | \"info\" | \"warning\"",
|
|
122
138
|
"references": {
|
|
123
139
|
"AlertStatus": {
|
|
124
140
|
"location": "import",
|
|
@@ -138,6 +154,26 @@ export class Alert {
|
|
|
138
154
|
"reflect": true,
|
|
139
155
|
"defaultValue": "'info'"
|
|
140
156
|
},
|
|
157
|
+
"announced": {
|
|
158
|
+
"type": "boolean",
|
|
159
|
+
"attribute": "announced",
|
|
160
|
+
"mutable": false,
|
|
161
|
+
"complexType": {
|
|
162
|
+
"original": "boolean",
|
|
163
|
+
"resolved": "boolean",
|
|
164
|
+
"references": {}
|
|
165
|
+
},
|
|
166
|
+
"required": false,
|
|
167
|
+
"optional": false,
|
|
168
|
+
"docs": {
|
|
169
|
+
"tags": [],
|
|
170
|
+
"text": "Sets role=\"alert\" and will be announced to screen reader users"
|
|
171
|
+
},
|
|
172
|
+
"getter": false,
|
|
173
|
+
"setter": false,
|
|
174
|
+
"reflect": true,
|
|
175
|
+
"defaultValue": "true"
|
|
176
|
+
},
|
|
141
177
|
"leadingIcon": {
|
|
142
178
|
"type": "string",
|
|
143
179
|
"attribute": "leading-icon",
|
|
@@ -231,7 +267,8 @@ export class Alert {
|
|
|
231
267
|
},
|
|
232
268
|
"getter": false,
|
|
233
269
|
"setter": false,
|
|
234
|
-
"reflect": false
|
|
270
|
+
"reflect": false,
|
|
271
|
+
"defaultValue": "'cross'"
|
|
235
272
|
},
|
|
236
273
|
"trailingIconSrc": {
|
|
237
274
|
"type": "string",
|
|
@@ -276,7 +313,7 @@ export class Alert {
|
|
|
276
313
|
"getter": false,
|
|
277
314
|
"setter": false,
|
|
278
315
|
"reflect": false,
|
|
279
|
-
"defaultValue": "'
|
|
316
|
+
"defaultValue": "'m'"
|
|
280
317
|
},
|
|
281
318
|
"headline": {
|
|
282
319
|
"type": "string",
|
|
@@ -417,7 +454,7 @@ export class Alert {
|
|
|
417
454
|
"getter": false,
|
|
418
455
|
"setter": false,
|
|
419
456
|
"reflect": false,
|
|
420
|
-
"defaultValue": "'
|
|
457
|
+
"defaultValue": "'Dismiss alert'"
|
|
421
458
|
}
|
|
422
459
|
};
|
|
423
460
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const alertStatusArray = ['info', 'warning', '
|
|
1
|
+
export const alertStatusArray = ['info', 'warning', 'error'];
|
|
2
2
|
export const alertTargetArray = ['_blank', '_self', '_parent', '_top'];
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
--r-button--border-color: var(--r-border-soft, #686868);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
:host([variant=secondary] .r-button[aria-disabled=
|
|
54
|
+
:host([variant=secondary] .r-button:not([aria-disabled=true]):active) {
|
|
55
55
|
--r-button--color: var(--r-text-regular, #282828);
|
|
56
56
|
--r-button--border-color: var(--r-border-soft, #686868);
|
|
57
57
|
--r-button--background-color: var(--r-background-interactive-pressed, rgba(40, 40, 40, 0.12));
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
--r-button--background-color: var(--r-background-interactive-hovered, rgba(40, 40, 40, 0.04));
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
:host([variant=text] .r-button[aria-disabled=
|
|
73
|
+
:host([variant=text] .r-button:not([aria-disabled=true]):active) {
|
|
74
74
|
--r-button--background-color: var(--r-background-interactive-pressed, rgba(40, 40, 40, 0.12));
|
|
75
75
|
--r-button--border-color: var(--r-border-soft, #686868);
|
|
76
76
|
}
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
:host([variant=text-inline]:active:not([disabled]:not([disabled=false]))) {
|
|
102
|
-
--r-button--color: var(--r-border-softer, #c9c9c9);
|
|
103
102
|
--r-button--border-color: transparent;
|
|
104
103
|
--r-button--background-color: transparent;
|
|
105
104
|
}
|
|
@@ -161,10 +160,10 @@
|
|
|
161
160
|
vertical-align: var(--r-button--vertical-align, top);
|
|
162
161
|
opacity: var(--r-button--opacity, 1);
|
|
163
162
|
}
|
|
164
|
-
.r-button[aria-disabled=
|
|
165
|
-
--r-button--color: var(--r-text-regular, #282828);
|
|
166
|
-
--r-button--background-color: var(--r-background-interactive-pressed, rgba(40, 40, 40, 0.12));
|
|
167
|
-
--r-button--border-color: var(--r-border-soft, #686868);
|
|
163
|
+
.r-button:not([aria-disabled=true]):active {
|
|
164
|
+
--r-button--color: var(--r-button--color--active, var(--r-text-regular, #282828));
|
|
165
|
+
--r-button--background-color: var(--r-button--background-color--active, var(--r-background-interactive-pressed, rgba(40, 40, 40, 0.12)));
|
|
166
|
+
--r-button--border-color: var(--r-button--border-color--active, var(--r-border-soft, #686868));
|
|
168
167
|
}
|
|
169
168
|
.r-button--slot {
|
|
170
169
|
position: var(--r-button--slot--position, relative);
|
|
@@ -17,16 +17,19 @@ export class Checkbox {
|
|
|
17
17
|
this.validityMessage = '';
|
|
18
18
|
this.initial = {};
|
|
19
19
|
this.getValidityStateData = (element) => {
|
|
20
|
+
let validityState = '';
|
|
21
|
+
let validityMessage = '';
|
|
20
22
|
for (const state in element.validity) {
|
|
21
23
|
if (element.validity[state]) {
|
|
22
|
-
|
|
24
|
+
validityState = state;
|
|
23
25
|
if (this[state + 'Message']) {
|
|
24
|
-
|
|
25
|
-
return;
|
|
26
|
+
validityMessage = this[state + 'Message'];
|
|
27
|
+
return { validityState, validityMessage };
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
validityMessage = element.validationMessage;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
32
|
+
return { validityState, validityMessage };
|
|
30
33
|
};
|
|
31
34
|
this.validateFormElement = (element = null) => {
|
|
32
35
|
if (element === null)
|
|
@@ -35,7 +38,9 @@ export class Checkbox {
|
|
|
35
38
|
return;
|
|
36
39
|
if (this.error)
|
|
37
40
|
return;
|
|
38
|
-
this.getValidityStateData(element);
|
|
41
|
+
const { validityState, validityMessage } = this.getValidityStateData(element);
|
|
42
|
+
this.validityState = validityState;
|
|
43
|
+
this.validityMessage = validityMessage;
|
|
39
44
|
const isValid = this.validityState === 'valid';
|
|
40
45
|
this.valid = isValid;
|
|
41
46
|
this.invalid = !isValid;
|
|
@@ -102,7 +107,9 @@ export class Checkbox {
|
|
|
102
107
|
* - `message`: A string containing the validity message.
|
|
103
108
|
*/
|
|
104
109
|
async getValidityState() {
|
|
105
|
-
this.getValidityStateData(this.nativeElement);
|
|
110
|
+
const { validityState, validityMessage } = this.getValidityStateData(this.nativeElement);
|
|
111
|
+
this.validityState = validityState;
|
|
112
|
+
this.validityMessage = validityMessage;
|
|
106
113
|
return {
|
|
107
114
|
state: this.validityState,
|
|
108
115
|
message: this.validityMessage
|
|
@@ -197,6 +204,14 @@ export class Checkbox {
|
|
|
197
204
|
async clearIndeterminate() {
|
|
198
205
|
this.indeterminate = false;
|
|
199
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Validates the checkbox without triggering UI and returns a boolean indicating its validity.
|
|
209
|
+
* @returns A boolean indicating whether the checkbox is valid.
|
|
210
|
+
*/
|
|
211
|
+
async checkValidity() {
|
|
212
|
+
const { validityState } = this.getValidityStateData(this.nativeElement);
|
|
213
|
+
return validityState === 'valid';
|
|
214
|
+
}
|
|
200
215
|
get hasErrorMessage() {
|
|
201
216
|
var _a;
|
|
202
217
|
return typeof this.error === 'string' && ((_a = this.error) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
@@ -232,13 +247,13 @@ export class Checkbox {
|
|
|
232
247
|
checked,
|
|
233
248
|
indeterminate
|
|
234
249
|
};
|
|
235
|
-
return (h(Host, { key: '
|
|
250
|
+
return (h(Host, { key: '3c1b6f0ea2497cc8c1641b9ba3a1408832c50808', onClick: this.handleClick }, h("div", { key: '585298821156cb66889bfc13e7148afb2847d1c4', class: "r-checkbox" }, h("input", Object.assign({ key: '02509a5c0d4b869c03e6a023e5c3aa1ef4b7057e', class: "r-checkbox--input", type: "checkbox" }, inputAttrs, { id: `${uniqueId}-input`, ref: el => this.nativeElement = el, "aria-describedby": this.hasMessage ? `${uniqueId}-message` : null, "aria-required": `${this.required || false}`, "aria-invalid": `${this.invalid || false}` })), h("div", { key: 'ec02858464651e1938848375fbf527f73fab76f1', class: "r-checkbox--box", "aria-hidden": "true" }, this.checked ?
|
|
236
251
|
h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M8.80019 15.8988L4.6002 11.6988L3.2002 13.0988L8.80019 18.6988L20.8002 6.69883L19.4002 5.29883L8.80019 15.8988Z", fill: "currentColor" }))
|
|
237
252
|
: this.indeterminate ?
|
|
238
253
|
h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("rect", { x: "4", y: "11", width: "16", height: "2", fill: "currentColor" }))
|
|
239
|
-
: null), h("div", { key: '
|
|
240
|
-
h("r-hint", { key: '
|
|
241
|
-
h("r-hint", { key: '
|
|
254
|
+
: null), h("div", { key: '310a1c3a77074fa77bf9daa4e371196f9f39fdd5', class: "r-checkbox--description" }, h("label", { key: '05666e7a11e9907067b9fbe7024669e8b11e5884', class: "r-checkbox--label", id: `${uniqueId}-label`, htmlFor: `${uniqueId}-input` }, h("slot", { key: '45c7ed40f84a15a0dccb6768011d067d4c9da26b' })), h("div", { key: 'b41e092d77775c0a9c4582248d353b1b49533206', id: `${uniqueId}-message`, class: !this.hasMessage ? 'visually-hidden' : 'r-checkbox--message', "aria-live": "polite", "aria-atomic": "true" }, this.hasInvalidMessage &&
|
|
255
|
+
h("r-hint", { key: '169e7d7ae74e6484f50f0cc5575dfdb537b16076', variant: "error" }, error || this.customErrorMessage || this.validityMessage), this.hasValidMessage &&
|
|
256
|
+
h("r-hint", { key: 'cdaaad06d4f0cd0e880a3f327c0eb8d2058eb91b', variant: "success" }, this.validMessage))))));
|
|
242
257
|
}
|
|
243
258
|
static get is() { return "r-checkbox"; }
|
|
244
259
|
static get encapsulation() { return "shadow"; }
|
|
@@ -747,6 +762,26 @@ export class Checkbox {
|
|
|
747
762
|
"text": "Sets the indeterminate state of the checkbox element.",
|
|
748
763
|
"tags": []
|
|
749
764
|
}
|
|
765
|
+
},
|
|
766
|
+
"checkValidity": {
|
|
767
|
+
"complexType": {
|
|
768
|
+
"signature": "() => Promise<boolean>",
|
|
769
|
+
"parameters": [],
|
|
770
|
+
"references": {
|
|
771
|
+
"Promise": {
|
|
772
|
+
"location": "global",
|
|
773
|
+
"id": "global::Promise"
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
"return": "Promise<boolean>"
|
|
777
|
+
},
|
|
778
|
+
"docs": {
|
|
779
|
+
"text": "Validates the checkbox without triggering UI and returns a boolean indicating its validity.",
|
|
780
|
+
"tags": [{
|
|
781
|
+
"name": "returns",
|
|
782
|
+
"text": "A boolean indicating whether the checkbox is valid."
|
|
783
|
+
}]
|
|
784
|
+
}
|
|
750
785
|
}
|
|
751
786
|
};
|
|
752
787
|
}
|
|
@@ -27,24 +27,30 @@ export class CheckboxGroup {
|
|
|
27
27
|
const variant = this.valid ? 'success' : 'error';
|
|
28
28
|
return (h("r-hint", { variant: variant, role: "alert", "aria-live": "polite", id: `${this.uniqueId}-message`, class: this.message ? null : 'visually-hidden' }, this.message));
|
|
29
29
|
};
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
this.getValidityStateData = () => {
|
|
31
|
+
let validityState = '';
|
|
32
|
+
let validityMessage = '';
|
|
33
33
|
const isValid = this.checkboxes.some(checkbox => checkbox.checked);
|
|
34
34
|
if (this.required && !isValid) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.invalid = true;
|
|
38
|
-
this.valid = false;
|
|
39
|
-
this.noChecked = true;
|
|
35
|
+
validityState = 'valueMissing';
|
|
36
|
+
validityMessage = this.valueMissingMessage || 'Please select at least one option.';
|
|
40
37
|
}
|
|
41
38
|
else {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.invalid = false;
|
|
45
|
-
this.valid = true;
|
|
46
|
-
this.noChecked = false;
|
|
39
|
+
validityState = 'valid';
|
|
40
|
+
validityMessage = null;
|
|
47
41
|
}
|
|
42
|
+
return { validityState, validityMessage };
|
|
43
|
+
};
|
|
44
|
+
this.validateGroup = () => {
|
|
45
|
+
if (this.isNoValidate || !this.required)
|
|
46
|
+
return;
|
|
47
|
+
const { validityState, validityMessage } = this.getValidityStateData();
|
|
48
|
+
this.validityState = validityState;
|
|
49
|
+
this.validityMessage = validityMessage;
|
|
50
|
+
const isValid = this.validityState === 'valid';
|
|
51
|
+
this.valid = isValid;
|
|
52
|
+
this.invalid = !isValid;
|
|
53
|
+
this.noChecked = !isValid;
|
|
48
54
|
this.rValidate.emit({
|
|
49
55
|
state: this.validityState,
|
|
50
56
|
message: this.validityMessage
|
|
@@ -64,6 +70,14 @@ export class CheckboxGroup {
|
|
|
64
70
|
this.resetToInitial();
|
|
65
71
|
};
|
|
66
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Validates the checkbox group without triggering UI and returns a boolean indicating its validity.
|
|
75
|
+
* @returns A boolean indicating whether the checkbox is valid.
|
|
76
|
+
*/
|
|
77
|
+
async checkValidity() {
|
|
78
|
+
const { validityState } = this.getValidityStateData();
|
|
79
|
+
return validityState === 'valid';
|
|
80
|
+
}
|
|
67
81
|
/**
|
|
68
82
|
* Resets the validity state and message of the radio group.
|
|
69
83
|
* This method clears the validity message and state, and sets the invalid
|
|
@@ -667,6 +681,26 @@ export class CheckboxGroup {
|
|
|
667
681
|
}
|
|
668
682
|
static get methods() {
|
|
669
683
|
return {
|
|
684
|
+
"checkValidity": {
|
|
685
|
+
"complexType": {
|
|
686
|
+
"signature": "() => Promise<boolean>",
|
|
687
|
+
"parameters": [],
|
|
688
|
+
"references": {
|
|
689
|
+
"Promise": {
|
|
690
|
+
"location": "global",
|
|
691
|
+
"id": "global::Promise"
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
"return": "Promise<boolean>"
|
|
695
|
+
},
|
|
696
|
+
"docs": {
|
|
697
|
+
"text": "Validates the checkbox group without triggering UI and returns a boolean indicating its validity.",
|
|
698
|
+
"tags": [{
|
|
699
|
+
"name": "returns",
|
|
700
|
+
"text": "A boolean indicating whether the checkbox is valid."
|
|
701
|
+
}]
|
|
702
|
+
}
|
|
703
|
+
},
|
|
670
704
|
"resetValidity": {
|
|
671
705
|
"complexType": {
|
|
672
706
|
"signature": "() => Promise<void>",
|