@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
|
@@ -68,6 +68,10 @@ const InputDate = class {
|
|
|
68
68
|
this.validityState = '';
|
|
69
69
|
/** Validity message passed from validateFormElement function after validation */
|
|
70
70
|
this.validityMessage = '';
|
|
71
|
+
/** Defines if the component has been touched by user */
|
|
72
|
+
this.touched = false;
|
|
73
|
+
/** Defines if the value has been changed by user interaction */
|
|
74
|
+
this.dirty = false;
|
|
71
75
|
/**
|
|
72
76
|
* Initial attributes state
|
|
73
77
|
* */
|
|
@@ -158,6 +162,7 @@ const InputDate = class {
|
|
|
158
162
|
if (this.readonly)
|
|
159
163
|
return;
|
|
160
164
|
if (event.code === 'Enter') {
|
|
165
|
+
this.touched = true;
|
|
161
166
|
this.validateFormElement(this.nativeElement);
|
|
162
167
|
if (this.invalid && !this.isNoValidate)
|
|
163
168
|
return;
|
|
@@ -208,6 +213,8 @@ const InputDate = class {
|
|
|
208
213
|
if (this.readonly)
|
|
209
214
|
return;
|
|
210
215
|
this.value = event.clipboardData.getData('text');
|
|
216
|
+
this.touched = true;
|
|
217
|
+
this.dirty = true;
|
|
211
218
|
event.preventDefault();
|
|
212
219
|
};
|
|
213
220
|
this.createInputHandler = (input, index) => {
|
|
@@ -225,7 +232,10 @@ const InputDate = class {
|
|
|
225
232
|
index < this.inputOrder.length - 1) {
|
|
226
233
|
(_c = this.inputs[index + 1]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
227
234
|
}
|
|
235
|
+
this.touched = true;
|
|
236
|
+
this.dirty = true;
|
|
228
237
|
this.rInput.emit({ element: this.host, value: this.value });
|
|
238
|
+
this.validateFormElement(this.nativeElement);
|
|
229
239
|
};
|
|
230
240
|
this.createChangeHandler = (input) => {
|
|
231
241
|
return (e) => this.handleChange(input, e);
|
|
@@ -238,29 +248,64 @@ const InputDate = class {
|
|
|
238
248
|
event.target.value = value;
|
|
239
249
|
this.setDateComponent(input, value);
|
|
240
250
|
this.value = this.inputOrder.map((el) => this.getDateComponent(el)).join(this.delimiter);
|
|
251
|
+
this.touched = true;
|
|
252
|
+
this.dirty = true;
|
|
241
253
|
this.rChange.emit({ element: this.host, value: this.value });
|
|
242
254
|
this.validateFormElement(this.nativeElement);
|
|
243
255
|
};
|
|
256
|
+
this.handleBlur = () => {
|
|
257
|
+
this.touched = true;
|
|
258
|
+
this.validateFormElement(this.nativeElement);
|
|
259
|
+
};
|
|
244
260
|
this.getValidityStateData = (element) => {
|
|
261
|
+
let validityState = '';
|
|
262
|
+
let validityMessage = '';
|
|
245
263
|
if (this.required && element.value.length === 0) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return;
|
|
264
|
+
validityState = 'valueMissing';
|
|
265
|
+
validityMessage = this.valueMissingMessage;
|
|
266
|
+
return { validityState, validityMessage };
|
|
249
267
|
}
|
|
250
|
-
const valid = dayjs(this.value, this.format, true).isValid();
|
|
268
|
+
const valid = this.value ? dayjs(this.value, this.format, true).isValid() : true;
|
|
251
269
|
if (!valid) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return;
|
|
270
|
+
validityState = 'invalid';
|
|
271
|
+
validityMessage = this.invalidDateMessage;
|
|
272
|
+
return { validityState, validityMessage };
|
|
255
273
|
}
|
|
256
|
-
|
|
274
|
+
// Check min/max constraints only if date is valid and has a value
|
|
275
|
+
// Note: min and max are expected to be in the same format as this.format
|
|
276
|
+
// If format changes, the developer should update min/max accordingly
|
|
277
|
+
if (this.value && valid) {
|
|
278
|
+
const currentDate = dayjs(this.value, this.format, true);
|
|
279
|
+
// Check minimum date constraint
|
|
280
|
+
if (this.min) {
|
|
281
|
+
const minDate = dayjs(this.min, this.format, true);
|
|
282
|
+
if (minDate.isValid() && currentDate.isBefore(minDate, 'day')) {
|
|
283
|
+
validityState = 'rangeUnderflow';
|
|
284
|
+
validityMessage = this.rangeUnderflowMessage;
|
|
285
|
+
return { validityState, validityMessage };
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Check maximum date constraint
|
|
289
|
+
if (this.max) {
|
|
290
|
+
const maxDate = dayjs(this.max, this.format, true);
|
|
291
|
+
if (maxDate.isValid() && currentDate.isAfter(maxDate, 'day')) {
|
|
292
|
+
validityState = 'rangeOverflow';
|
|
293
|
+
validityMessage = this.rangeOverflowMessage;
|
|
294
|
+
return { validityState, validityMessage };
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
validityState = 'valid';
|
|
299
|
+
return { validityState, validityMessage };
|
|
257
300
|
};
|
|
258
301
|
this.validateFormElement = (element) => {
|
|
259
302
|
if (element === null)
|
|
260
303
|
return;
|
|
261
304
|
if (this.isNoValidate)
|
|
262
305
|
return;
|
|
263
|
-
this.getValidityStateData(element);
|
|
306
|
+
const { validityState, validityMessage } = this.getValidityStateData(element);
|
|
307
|
+
this.validityState = validityState;
|
|
308
|
+
this.validityMessage = validityMessage;
|
|
264
309
|
const isValid = this.validityState === 'valid';
|
|
265
310
|
this.valid = isValid;
|
|
266
311
|
this.invalid = !isValid;
|
|
@@ -309,6 +354,8 @@ const InputDate = class {
|
|
|
309
354
|
}
|
|
310
355
|
handleValueChange() {
|
|
311
356
|
this.setCurrentValues();
|
|
357
|
+
if (this.touched)
|
|
358
|
+
this.validateFormElement(this.nativeElement);
|
|
312
359
|
}
|
|
313
360
|
/** Get the date value */
|
|
314
361
|
async getValue() {
|
|
@@ -316,6 +363,7 @@ const InputDate = class {
|
|
|
316
363
|
}
|
|
317
364
|
/** Sets the date value */
|
|
318
365
|
async setValue(value) {
|
|
366
|
+
this.nativeElement.value = value;
|
|
319
367
|
this.value = value;
|
|
320
368
|
}
|
|
321
369
|
/** Gets the current date format */
|
|
@@ -326,6 +374,19 @@ const InputDate = class {
|
|
|
326
374
|
async setFormat(format) {
|
|
327
375
|
this.format = format;
|
|
328
376
|
}
|
|
377
|
+
/** Gets the touched state (whether user has interacted with the input) */
|
|
378
|
+
async isTouched() {
|
|
379
|
+
return this.touched;
|
|
380
|
+
}
|
|
381
|
+
/** Gets the dirty state (whether value has been changed by user) */
|
|
382
|
+
async isDirty() {
|
|
383
|
+
return this.dirty;
|
|
384
|
+
}
|
|
385
|
+
/** Resets touched and dirty states to pristine (untouched/clean) */
|
|
386
|
+
async markAsPristine() {
|
|
387
|
+
this.touched = false;
|
|
388
|
+
this.dirty = false;
|
|
389
|
+
}
|
|
329
390
|
/**
|
|
330
391
|
* Resets the component by clearing all input values and focusing the first input.
|
|
331
392
|
* @returns Promise that resolves when reset is complete
|
|
@@ -333,6 +394,7 @@ const InputDate = class {
|
|
|
333
394
|
async reset() {
|
|
334
395
|
if (this.readonly)
|
|
335
396
|
return;
|
|
397
|
+
this.markAsPristine();
|
|
336
398
|
this.validityState = null;
|
|
337
399
|
this.validityMessage = null;
|
|
338
400
|
this.value = this.initial['value'];
|
|
@@ -340,6 +402,14 @@ const InputDate = class {
|
|
|
340
402
|
this.format = this.initial['format'];
|
|
341
403
|
this.valid = !this.invalid;
|
|
342
404
|
}
|
|
405
|
+
/**
|
|
406
|
+
* Validates the input date without triggering UI and returns a boolean indicating its validity.
|
|
407
|
+
* @returns A boolean indicating whether the input date is valid.
|
|
408
|
+
*/
|
|
409
|
+
async checkValidity() {
|
|
410
|
+
const { validityState } = this.getValidityStateData(this.nativeElement);
|
|
411
|
+
return validityState === 'valid';
|
|
412
|
+
}
|
|
343
413
|
get inputs() {
|
|
344
414
|
return Array.from(this.host.shadowRoot.querySelectorAll('input[data-date-type]'));
|
|
345
415
|
}
|
|
@@ -433,14 +503,14 @@ const InputDate = class {
|
|
|
433
503
|
id: `${uniqueId}-label`,
|
|
434
504
|
fieldIndicator
|
|
435
505
|
} : {};
|
|
436
|
-
return (h(Host, { key: '
|
|
506
|
+
return (h(Host, { key: '00e6bbea2dcaf1e88b4587fa9df6165a2c28c134', onClick: this.onHostClick, "data-touched": `${this.touched}`, "data-dirty": `${this.dirty}` }, h("fieldset", Object.assign({ key: '94d107ad0f00608263df3f47b0c2240d93a01c4e', class: "r-input-date" }, groupAttrs), h("div", { key: '3ac5991c7b8754f2fa94c8053f60af17a99301e0', class: "r-input-date--legend-container" }, h("legend", { key: '62fc7c2b6af2f7911c11f135432323621dd278b8', class: "r-input-date--legend" }, h("label", { key: 'd161f2b149ca1295c6e96746520c6ef1cf2e23ba', htmlFor: uniqueId }, label ?
|
|
437
507
|
h("r-label", Object.assign({}, labelAttr, tooltipAttrs), label)
|
|
438
508
|
:
|
|
439
|
-
h("slot", { name: "label" }))), h("slot", { key: '
|
|
440
|
-
h("r-hint", { key: '
|
|
441
|
-
h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), h("input", Object.assign({ key: '
|
|
442
|
-
h("r-icon", { key: '
|
|
443
|
-
h("r-icon", { key: '
|
|
509
|
+
h("slot", { name: "label" }))), h("slot", { key: '81c9e7753273c5e7d6db5d6a1f0fad8398a57c0a', name: "popover" })), hint &&
|
|
510
|
+
h("r-hint", { key: '0814c3ef100ed6a8512b2f15d5b59e01664bd811', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '65247f18a297ef6a5751ab86e1123271ed8759f7', class: "r-input-date--container" }, h("r-icon", { key: 'fce4150b7c1b801752e1a67339b1a599728b0631', name: "calendar", size: "s", class: "r-input-date--calendar-icon" }), h("div", { key: '3b5e4776102b06acd9626477c702d2dc52ef681c', class: "r-input-date--inputs" }, this.inputOrder.map((input, i) => (h(Fragment, null, h("input", Object.assign({ class: "r-input-date--input" }, this.getInputAttrs(input), { key: input, value: this.getDateComponent(input), onInput: this.createInputHandler(input, i), onChange: this.createChangeHandler(input), onClick: this.onInputClick, onBlur: this.handleBlur, onKeyDown: this.createKeyDownHandler(i), onPaste: this.handlePaste })), i < this.inputOrder.length - 1 &&
|
|
511
|
+
h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), h("input", Object.assign({ key: '2c181871c97962a35988eb406c09a05c8f27181d', type: "hidden" }, dateInputAttrs, { value: this.value, ref: (el) => this.nativeElement = el }))), h("div", { key: '8c694c11cc7ea4ecc23484d3f014cc865e0c56ad', class: "r-input-date--trailing" }, this.readonly &&
|
|
512
|
+
h("r-icon", { key: '8ed65eaef19f280381b7c0fae206163f3adeb5f4', class: "r-input-date--readonly-icon", name: "pen-disabled", size: "s" }), valid &&
|
|
513
|
+
h("r-icon", { key: 'aef55123b4b001576b482e0be4eff0df6dc97930', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" }), this.hasTrailingSlot && h("slot", { key: 'd92dcda80b7434af1f8ed781329ce8f2e6734225', name: "trailing" }))), h("div", { key: '139792ccc090b29f041e3a731f65e5916379b911', id: `${uniqueId}-message`, "aria-live": "polite", class: "r-input-date--message" }, this.hasMessage && h("r-hint", { key: '74d444c9748c032e844c0772b8758873bdaef391', variant: "error" }, this.message)))));
|
|
444
514
|
}
|
|
445
515
|
get host() { return getElement(this); }
|
|
446
516
|
static get watchers() { return {
|
|
@@ -59,16 +59,19 @@ const InputPassword = class {
|
|
|
59
59
|
this.rChange.emit({ element: host, value });
|
|
60
60
|
};
|
|
61
61
|
this.getValidityStateData = (element) => {
|
|
62
|
+
let validityState = '';
|
|
63
|
+
let validityMessage = '';
|
|
62
64
|
for (const state in element.validity) {
|
|
63
65
|
if (element.validity[state]) {
|
|
64
|
-
|
|
66
|
+
validityState = state;
|
|
65
67
|
if (this[state + 'Message']) {
|
|
66
|
-
|
|
67
|
-
return;
|
|
68
|
+
validityMessage = this[state + 'Message'];
|
|
69
|
+
return { validityState, validityMessage };
|
|
68
70
|
}
|
|
69
|
-
|
|
71
|
+
validityMessage = element.validationMessage;
|
|
70
72
|
}
|
|
71
73
|
}
|
|
74
|
+
return { validityState, validityMessage };
|
|
72
75
|
};
|
|
73
76
|
this.validateFormElement = (element) => {
|
|
74
77
|
if (element === null)
|
|
@@ -77,7 +80,9 @@ const InputPassword = class {
|
|
|
77
80
|
return;
|
|
78
81
|
if (this.error)
|
|
79
82
|
return;
|
|
80
|
-
this.getValidityStateData(element.shadowRoot.querySelector('input'));
|
|
83
|
+
const { validityState, validityMessage } = this.getValidityStateData(element.shadowRoot.querySelector('input'));
|
|
84
|
+
this.validityState = validityState;
|
|
85
|
+
this.validityMessage = validityMessage;
|
|
81
86
|
const isValid = this.validityState === 'valid';
|
|
82
87
|
this.valid = isValid;
|
|
83
88
|
this.invalid = !isValid;
|
|
@@ -164,6 +169,14 @@ const InputPassword = class {
|
|
|
164
169
|
this.value = value;
|
|
165
170
|
this.validateFormElement(this.nativeElement);
|
|
166
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Validates the input password without triggering UI and returns a boolean indicating its validity.
|
|
174
|
+
* @returns A boolean indicating whether the input password is valid.
|
|
175
|
+
*/
|
|
176
|
+
async checkValidity() {
|
|
177
|
+
const { validityState } = this.getValidityStateData(this.nativeElement.shadowRoot.querySelector('input'));
|
|
178
|
+
return validityState === 'valid';
|
|
179
|
+
}
|
|
167
180
|
/** Identify wrapping form element */
|
|
168
181
|
get parentFormEl() {
|
|
169
182
|
return this.host.closest('form') || document.querySelector(`#${this.form}`) || null;
|
|
@@ -232,8 +245,8 @@ const InputPassword = class {
|
|
|
232
245
|
novalidate: true,
|
|
233
246
|
readonly
|
|
234
247
|
};
|
|
235
|
-
return (h(Host, { key: '
|
|
236
|
-
h("r-hint", { key: '
|
|
248
|
+
return (h(Host, { key: '810ae74cdcdcd8a4289255e2b99b6cfc213330ac' }, h("r-input", Object.assign({ key: '55027ca5cd8b8ba4eade60067ac182e38eaf1bfa' }, inputAttrs, { ref: (el) => this.nativeElement = el, type: showed ? 'text' : 'password', onRInput: this.onInput, onRChange: this.onChange, onKeyUp: this.handleKeyup, onRBlur: this.handleBlur }), h("r-icon", { key: '935aa481c0eff444462e6be6d8e6975db8a24708', name: "padlock-closed", size: "s", slot: "leading" }), h("slot", { key: 'df29bd4fa96db1c1f5f70be9c44fab1b9c5f02be', name: "popover", slot: "popover" }), h("r-icon-button", { key: '95d5f3c5e64eb7b43364db7aff943d35fbdc4d2d', slot: "trailing", name: showed ? 'eye-crossed-out' : 'eye', size: "s", disabled: disabled, label: showed ? hidePasswordAriaLabel : showPasswordAriaLabel, onClick: this.onShowClick }), this.hasMessage &&
|
|
249
|
+
h("r-hint", { key: '7390d667a69c4ae5c2c6ae480eaf5f879ad6ed78', slot: "message", variant: "error" }, this.hasError && this.error, this.hasValidationError && (this.customErrorMessage || this.validityMessage))), h("div", { key: 'c70c38f1249c80973bb2fe2a25ddf7d88835c686', class: "visually-hidden", ref: el => this.passwordVisibilityChangeAlertContainer = el, "aria-live": "polite" })));
|
|
237
250
|
}
|
|
238
251
|
get host() { return getElement(this); }
|
|
239
252
|
};
|
|
@@ -2271,7 +2271,9 @@ const InputPhoneNumber = class {
|
|
|
2271
2271
|
return;
|
|
2272
2272
|
if (this.error)
|
|
2273
2273
|
return;
|
|
2274
|
-
this.getValidityStateData();
|
|
2274
|
+
const { validityState, validityMessage } = this.getValidityStateData();
|
|
2275
|
+
this.validityState = validityState;
|
|
2276
|
+
this.validityMessage = validityMessage;
|
|
2275
2277
|
const isValid = this.validityState === 'valid';
|
|
2276
2278
|
this.valid = isValid;
|
|
2277
2279
|
this.invalid = !isValid;
|
|
@@ -2282,22 +2284,25 @@ const InputPhoneNumber = class {
|
|
|
2282
2284
|
};
|
|
2283
2285
|
this.getValidityStateData = () => {
|
|
2284
2286
|
var _a, _b;
|
|
2287
|
+
let validityState = '';
|
|
2288
|
+
let validityMessage = '';
|
|
2285
2289
|
if (!this.required && !((_a = this.phoneNumber) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2286
|
-
|
|
2287
|
-
return;
|
|
2290
|
+
validityState = 'valid';
|
|
2291
|
+
return { validityState, validityMessage };
|
|
2288
2292
|
}
|
|
2289
2293
|
if (!((_b = this.phoneNumber) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
return;
|
|
2294
|
+
validityState = 'valueMissing';
|
|
2295
|
+
validityMessage = this.valueMissingMessage;
|
|
2296
|
+
return { validityState, validityMessage };
|
|
2293
2297
|
}
|
|
2294
2298
|
const isPhoneNumberValid = this.countryCode ? this.getPhoneValidationResult(this.phoneNumber, this.countryCode).isValid : false;
|
|
2295
2299
|
if (!isPhoneNumberValid) {
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
return;
|
|
2300
|
+
validityState = 'invalid';
|
|
2301
|
+
validityMessage = this.customErrorMessage;
|
|
2302
|
+
return { validityState, validityMessage };
|
|
2299
2303
|
}
|
|
2300
|
-
|
|
2304
|
+
validityState = 'valid';
|
|
2305
|
+
return { validityState, validityMessage };
|
|
2301
2306
|
};
|
|
2302
2307
|
this.onSubmitForm = (event) => {
|
|
2303
2308
|
if (this.isNoValidate)
|
|
@@ -2339,6 +2344,14 @@ const InputPhoneNumber = class {
|
|
|
2339
2344
|
this.customErrorMessage = message;
|
|
2340
2345
|
this.validateFormElement(this.nativeElement);
|
|
2341
2346
|
}
|
|
2347
|
+
/**
|
|
2348
|
+
* Validates the input phone number without triggering UI and returns a boolean indicating its validity.
|
|
2349
|
+
* @returns A boolean indicating whether the input phone number is valid.
|
|
2350
|
+
*/
|
|
2351
|
+
async checkValidity() {
|
|
2352
|
+
const { validityState } = this.getValidityStateData();
|
|
2353
|
+
return validityState === 'valid';
|
|
2354
|
+
}
|
|
2342
2355
|
/** Check validity and reveal validation state. */
|
|
2343
2356
|
async reportValidity() {
|
|
2344
2357
|
this.validateFormElement(this.nativeElement);
|
|
@@ -2496,10 +2509,10 @@ const InputPhoneNumber = class {
|
|
|
2496
2509
|
disabled,
|
|
2497
2510
|
'aria-describedby': this.ariaDescribedBy
|
|
2498
2511
|
};
|
|
2499
|
-
return (h(Host, { key: '
|
|
2500
|
-
h("r-label", Object.assign({ key: '
|
|
2501
|
-
h("r-hint", { key: '
|
|
2502
|
-
h("r-icon", { key: '
|
|
2512
|
+
return (h(Host, { key: '4551070926e1974ddf3fcb8cc435570ddde50276' }, h("div", { key: 'a076fb01b4e0563ec2d30a5680a6ccd48b2f6895', class: "r-input-phone-number--label-container" }, h("label", { key: 'a8ad943efeca2ac3b5a63857ea0a52b19c32f09c', id: `${uniqueId}-label` }, label &&
|
|
2513
|
+
h("r-label", Object.assign({ key: 'ac0d2a1c12cb85ec03e6596b9bb2e28328026eac' }, labelAttr), label)), h("slot", { key: 'cadd98a33c32bfb60be0a3448772eac483630bdf', name: "popover" })), hint &&
|
|
2514
|
+
h("r-hint", { key: '23874cabee60dc0a5e620066eed92de809cac1eb', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '800b3a389ce815c5e137077dd5766177c317a05d', class: "r-input-phone-number", role: "group", "aria-labelledby": `${uniqueId}-label`, "aria-describedby": this.ariaDescribedBy }, h("slot", { key: '6106007980212ef05cd11304da2a4d0cc28ddf4f' }), h("r-input", { key: 'd65b4d9ca8761c7e6dd08359ff02f3c88c57aa66', label: inputLabel, value: phoneNumber, internal: true, valid: valid, invalid: invalid, required: required, readonly: this.readonly, novalidate: true, fullWidth: fullWidth, type: "tel", error: this.errorMessage || '', onRInput: this.handleOnInput, onRChange: this.handleInputOnChange, disabled: disabled }, valid && phoneNumber &&
|
|
2515
|
+
h("r-icon", { key: '09c721cb014d6d7ece724bcf7de9ec5928624dac', slot: "trailing", name: "circled-check", size: "s", color: "var(--r-status-success-regular)" }))), h("input", Object.assign({ key: 'e2eef2512f9125f0dd3d1b09120cbb77955350bd', type: "hidden" }, inputAttrs, { readonly: this.readonly, value: fullPhoneNumber, ref: el => this.nativeElement = el })), h("r-hint", { key: 'a12e9640bcf2df7b754de4e54b111e4ead2d023e', "aria-live": "polite", "aria-atomic": "true", id: `${uniqueId}-message`, class: !this.hasMessage && 'visually-hidden', variant: "error" }, this.hasMessage ? (this.hasError ? this.error : this.validityMessage) : '')));
|
|
2503
2516
|
}
|
|
2504
2517
|
get host() { return getElement(this); }
|
|
2505
2518
|
static get watchers() { return {
|
|
@@ -48,16 +48,25 @@ const RInput = class {
|
|
|
48
48
|
* */
|
|
49
49
|
this.initial = {};
|
|
50
50
|
this.getValidityStateData = (element) => {
|
|
51
|
+
let validityState = '';
|
|
52
|
+
let validityMessage = '';
|
|
53
|
+
if (this.type === 'email' && this.pattern) {
|
|
54
|
+
element.setCustomValidity('');
|
|
55
|
+
validityState = this.validEmailPattern ? 'valid' : 'patternMismatch';
|
|
56
|
+
validityMessage = this.validEmailPattern ? '' : this.patternMismatchMessage;
|
|
57
|
+
return { validityState, validityMessage };
|
|
58
|
+
}
|
|
51
59
|
for (const state in element.validity) {
|
|
52
60
|
if (element.validity[state]) {
|
|
53
|
-
|
|
61
|
+
validityState = state;
|
|
54
62
|
if (this[state + 'Message']) {
|
|
55
|
-
|
|
56
|
-
return;
|
|
63
|
+
validityMessage = this[state + 'Message'];
|
|
64
|
+
return { validityState, validityMessage };
|
|
57
65
|
}
|
|
58
|
-
|
|
66
|
+
validityMessage = element.validationMessage;
|
|
59
67
|
}
|
|
60
68
|
}
|
|
69
|
+
return { validityState, validityMessage };
|
|
61
70
|
};
|
|
62
71
|
this.validateFormElement = (element) => {
|
|
63
72
|
if (element === null)
|
|
@@ -66,13 +75,9 @@ const RInput = class {
|
|
|
66
75
|
return;
|
|
67
76
|
if (this.error)
|
|
68
77
|
return;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.validityMessage = this.validEmailPattern ? '' : this.patternMismatchMessage;
|
|
73
|
-
}
|
|
74
|
-
else
|
|
75
|
-
this.getValidityStateData(element);
|
|
78
|
+
const { validityState, validityMessage } = this.getValidityStateData(element);
|
|
79
|
+
this.validityState = validityState;
|
|
80
|
+
this.validityMessage = validityMessage;
|
|
76
81
|
const isValid = this.validityState === 'valid';
|
|
77
82
|
this.valid = isValid;
|
|
78
83
|
this.invalid = !isValid;
|
|
@@ -207,6 +212,14 @@ const RInput = class {
|
|
|
207
212
|
this.nativeElement.value = value;
|
|
208
213
|
this.validateFormElement(this.nativeElement);
|
|
209
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Validates the input without triggering UI and returns a boolean indicating its validity.
|
|
217
|
+
* @returns A boolean indicating whether the input is valid.
|
|
218
|
+
*/
|
|
219
|
+
async checkValidity() {
|
|
220
|
+
const { validityState } = this.getValidityStateData(this.nativeElement);
|
|
221
|
+
return validityState === 'valid';
|
|
222
|
+
}
|
|
210
223
|
/** Identify wrapping form element */
|
|
211
224
|
get parentFormEl() {
|
|
212
225
|
return this.host.closest('form') || document.querySelector(`#${this.form}`) || null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement, F as Fragment } from './index-Da7qOBFr.js';
|
|
2
2
|
|
|
3
|
-
const paginationCss = ":host{--r-pagination--display:flex;--r-pagination--list-style:none;--r-pagination--align-items:center;--r-pagination--justify-content:center;--r-pagination--font-family:var(--r-font-family-text);--r-pagination--margin:0 auto;--r-pagination--flex-direction:column;--r-pagination--width:100%;--r-pagination--max-width:664px;--r-pagination--margin:0 auto;--r-pagination--item--display:flex;--r-pagination--item--align-items:center;--r-pagination--item--justify-content:center;--r-pagination--item--margin-right:-1px;--r-pagination--item--color:var(--r-text-regular);--r-pagination--item--background-color:transparent;--r-pagination--item--width:48px;--r-pagination--item--height:48px;--r-pagination--item--border-width:1px;--r-pagination--item--border-style:solid;--r-pagination--item--border-color:var(--r-border-softer);--r-pagination--item--z-index:0;--r-pagination--item--font-family:inherit;--r-pagination--button--width:100%;--r-pagination--button--height:100%;--r-pagination--button--color:var(--r-text-regular);--r-pagination--button--background-color:transparent;--r-pagination--button--border-width:0;--r-pagination--button--padding:0;--r-pagination--button--font-size:var(--r-font-size-300);--r-pagination--header--display:flex;--r-pagination--header--align-items:center;--r-pagination--header--justify-content:space-between;--r-pagination--header--min-width:287px;--r-pagination--footer--display:flex;--r-pagination--footer--justify-content:center;--r-pagination--footer--width:100%;--r-pagination--item--disabled-text:none;--r-pagination--font-size:var(--r-font-size-200);display:block}:host([variant=minimized]){--r-pagination--max-width:440px}:host([variant=standard]){--r-pagination--max-width:560px}:host([variant=maximized]){--r-pagination--max-width:664px}.r-pagination r-select{--r-select--font-size:var(--r-pagination--font-size, 12px);--r-select-option--font-size:var(--r-pagination--font-size, 12px)}.r-pagination{align-items:var(--r-pagination--align-items);display:var(--r-pagination--display);flex-direction:var(--r-pagination--flex-direction);font-family:var(--r-pagination--font-family);font-size:var(--r-pagination--font-size);justify-content:var(--r-pagination--justify-content);list-style:var(--r-pagination--list-style);margin:var(--r-pagination--margin);max-width:var(--r-pagination--max-width);user-select:var(--r-pagination--item--disabled-text);width:var(--r-pagination--width)}.r-pagination--footer{align-items:var(--r-pagination--header--align-items);display:var(--r-pagination--footer--display);justify-content:var(--r-pagination--footer--justify-content)}.r-pagination--header{align-items:var(--r-pagination--header--align-items);display:var(--r-pagination--header--display);justify-content:var(--r-pagination--header--justify-content);font-family:var(--r-pagination--font-family);min-width:var(--r-pagination--header--min-width)}.r-pagination--header--select{min-width:auto;--width:unset !important}.r-pagination--header label{font-size:var(--r-pagination--font-size)}.r-pagination--item
|
|
3
|
+
const paginationCss = ":host{--r-pagination--display:flex;--r-pagination--list-style:none;--r-pagination--align-items:center;--r-pagination--justify-content:center;--r-pagination--font-family:var(--r-font-family-text);--r-pagination--margin:0 auto;--r-pagination--flex-direction:column;--r-pagination--width:100%;--r-pagination--max-width:664px;--r-pagination--margin:0 auto;--r-pagination--item--display:flex;--r-pagination--item--align-items:center;--r-pagination--item--justify-content:center;--r-pagination--item--margin-right:-1px;--r-pagination--item--color:var(--r-text-regular);--r-pagination--item--background-color:transparent;--r-pagination--item--width:48px;--r-pagination--item--height:48px;--r-pagination--item--border-width:1px;--r-pagination--item--border-style:solid;--r-pagination--item--border-color:var(--r-border-softer);--r-pagination--item--z-index:0;--r-pagination--item--font-family:inherit;--r-pagination--button--width:100%;--r-pagination--button--height:100%;--r-pagination--button--color:var(--r-text-regular);--r-pagination--button--background-color:transparent;--r-pagination--button--border-width:0;--r-pagination--button--padding:0;--r-pagination--button--font-size:var(--r-font-size-300);--r-pagination--header--display:flex;--r-pagination--header--align-items:center;--r-pagination--header--justify-content:space-between;--r-pagination--header--min-width:287px;--r-pagination--footer--display:flex;--r-pagination--footer--justify-content:center;--r-pagination--footer--width:100%;--r-pagination--item--disabled-text:none;--r-pagination--font-size:var(--r-font-size-200);display:block}:host([variant=minimized]){--r-pagination--max-width:440px}:host([variant=standard]){--r-pagination--max-width:560px}:host([variant=maximized]){--r-pagination--max-width:664px}.r-pagination r-select{--r-select--font-size:var(--r-pagination--font-size, 12px);--r-select-option--font-size:var(--r-pagination--font-size, 12px)}.r-pagination{align-items:var(--r-pagination--align-items);display:var(--r-pagination--display);flex-direction:var(--r-pagination--flex-direction);font-family:var(--r-pagination--font-family);font-size:var(--r-pagination--font-size);justify-content:var(--r-pagination--justify-content);list-style:var(--r-pagination--list-style);margin:var(--r-pagination--margin);max-width:var(--r-pagination--max-width);user-select:var(--r-pagination--item--disabled-text);width:var(--r-pagination--width)}.r-pagination--footer{align-items:var(--r-pagination--header--align-items);display:var(--r-pagination--footer--display);justify-content:var(--r-pagination--footer--justify-content)}.r-pagination--header{align-items:var(--r-pagination--header--align-items);display:var(--r-pagination--header--display);justify-content:var(--r-pagination--header--justify-content);font-family:var(--r-pagination--font-family);min-width:var(--r-pagination--header--min-width)}.r-pagination--header--select{min-width:auto;--width:unset !important}.r-pagination--header label{font-size:var(--r-pagination--font-size)}.r-pagination--item:hover{--r-pagination--item--background-color:var(--r-background-interactive-hovered)}.r-pagination--item:focus{--r-pagination--item--outline-color:var(--r-border-focused);--r-pagination--item--box-shadow:0 0 0 3px var(--r-border-focused-outlined);--r-pagination--item--z-index:1}.r-pagination--item:active{--r-pagination--item--background-color:var(--r-background-interactive-pressed)}.r-pagination--item.stepper{--r-pagination--item--background-color:transparent}.r-pagination--item.active{--r-pagination--item--color:var(--r-text-regular);--r-pagination--item--background-color:var(--r-background-interactive-activated);font-weight:var(--r-font-weight-semibold)}.r-pagination--item.arrow.previous{--r-pagination--item--margin-left:0;--r-pagination--item--margin-right:16px}.r-pagination--item.arrow.next{--r-pagination--item--margin-left:16px;--r-pagination--item--margin-right:0}.r-pagination--item.arrow.first{--r-pagination--item--margin-left:0;--r-pagination--item--margin-right:8px}.r-pagination--item.arrow.last{--r-pagination--item--margin-left:8px;--r-pagination--item--margin-right:0}.r-pagination--item.disabled,.r-pagination--item.disabled:hover{--r-pagination--item--opacity:0.4;--r-pagination--item--background-color:transparent}.r-pagination--item.number{--r-button--font-size:0.813rem}.r-pagination--item{--r-button--display:flex;--r-button--width:var(--r-pagination--button--width);--r-button--height:var(--r-pagination--button--height);--r-button--color:var(--r-pagination--button--color);--r-button--background-color:var(--r-pagination--button--background-color);--r-button--border-width:var(--r-pagination--button--border-width);--r-button--padding:var(--r-pagination--button--padding);--r-button--icon--width:auto;--r-button--icon--height:auto;align-items:var(--r-pagination--item--align-items);background-color:var(--r-pagination--item--background-color);color:var(--r-pagination--item--color);display:var(--r-pagination--item--display);font-family:var(--r-pagination--item--font-family);height:var(--r-pagination--item--height);justify-content:var(--r-pagination--item--justify-content);margin-left:var(--r-pagination--item--margin-left);margin-right:var(--r-pagination--item--margin-right);opacity:var(--r-pagination--item--opacity);width:var(--r-pagination--item--width);z-index:var(--r-pagination--item--z-index)}";
|
|
4
4
|
|
|
5
5
|
const RPagination = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -3,7 +3,7 @@ import { s as setupInverseThemeAwareness, a as stopInverseThemeAwareness } from
|
|
|
3
3
|
import { f as focusableElements } from './focusable-ky1yonnS.js';
|
|
4
4
|
import './style-observer-4Uv3PpKT.js';
|
|
5
5
|
|
|
6
|
-
const popoverActionCss = ":host slot{display:contents}::slotted(r-button){--r-button--color:var(--r-text-regular);--r-button--border-
|
|
6
|
+
const popoverActionCss = ":host slot{display:contents}::slotted(r-button){--r-button--color:var(--r-text-regular);--r-button--border-width:0;--r-button--background-color:rgba(0,0,0,0);--r-button--slot--position:relative;--r-button--slot--text-decoration:underline;--r-button--padding:10px 2px 18px 2px;--r-button--slot--text-underline-offset:9px}::slotted(r-button:hover:not([disabled]):not([disabled=false])){--r-button--background-color:var(--r-background-interactive-hovered)}::slotted(r-button:active:not([disabled]):not([disabled=false])){--r-button--background-color:var(--r-background-interactive-pressed)}";
|
|
7
7
|
|
|
8
8
|
const PopoverAction = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-Da7qOBFr.js';
|
|
2
2
|
|
|
3
|
-
const popoverCss = ":host{position:relative;overflow:visible;color:var(--r-text-inverse);font-family:var(--r-font-family-text, system-ui);font-weight:var(--r-font-weight-regular, 400);font-size:var(--r-font-size-400, 1rem);text-align:left;--board--shift:1rem;--board--min-width:304px;--board--max-width:504px;--board--max-height:320px;--pointer--width:1rem;--pointer--height:0.5rem;--pointer--spacer:0.25rem}:host slot{display:contents}:host([size=s]){--r-popover--board--max-width:375px}:host([size=l]){--r-popover--board--max-width:500px}:host([data-open=true]){--r-popover--pointer--display:block;--r-popover--board--visibility:visible;--r-popover--board--left:var(--r-popover--trigger--left);--r-popover--board--top:var(--r-popover--trigger--top)}:host([data-open=true]) ::slotted([slot=trigger]){--r-popover--trigger--display:none}:host([data-vertical=top]){--r-popover--pointer--top:100%;--r-popover--pointer--transform:rotate(0deg) translate(0,-1px)}:host([data-vertical=bottom]){--r-popover--pointer--bottom:100%;--r-popover--pointer--transform:rotate(180deg)}:host([data-vertical=middle]){--r-popover--pointer--top:calc(50% - var(--pointer--height)/2);--r-popover--pointer--bottom:auto}:host([data-horizontal=left]){--r-popover--board--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0) + var(--board--shift));--r-popover--pointer--left:calc(100% - var(--r-popover--trigger--width, 0)/2 - var(--board--shift) - var(--pointer--width)/2)}:host([data-horizontal=right]){--r-popover--pointer--left:calc(var(--r-popover--trigger--width, 0)/2 + var(--pointer--width)/2)}:host([data-horizontal=center]){--r-popover--pointer--left:calc(50% - var(--pointer--width)/2)}:host([data-vertical=top][data-horizontal=left]){--r-popover--board--transform:translate(-100%, calc(-100% - var(--pointer--spacer) - var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=top][data-horizontal=right]){--r-popover--board--transform:translate(calc(0px - var(--board--shift)), calc(-100% - var(--pointer--spacer) - var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=top][data-horizontal=center]){--r-popover--board--transform:translate(calc(-50% + var(--r-popover--trigger--width, 0)/2), calc(-100% - var(--pointer--spacer) - var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=top][data-horizontal=cover]){--r-popover--pointer--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0)/2 - var(--r-popover--pointer--width, var(--pointer--width))/2);--r-popover--board--left:0;--r-popover--board--transform:translate(0, calc(-100% - var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=middle][data-horizontal=left]){--r-popover--board--left:var(--r-popover--trigger--left, 0);--r-popover--board--transform:translate(calc(-100% - var(--pointer--height) - var(--pointer--spacer)), calc(-50% + var(--r-popover--trigger--height, 0)/2));--r-popover--pointer--left:100%;--r-popover--pointer--right:auto;--r-popover--pointer--transform:rotate(-90deg) translate(0, calc(0px - var(--pointer--spacer)))}:host([data-vertical=middle][data-horizontal=right]){--r-popover--board--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0) + var(--pointer--height) + var(--pointer--spacer));--r-popover--board--transform:translate(0, calc(-50% + var(--r-popover--trigger--height, 0)/2));--r-popover--pointer--top:calc(50% - var(--pointer--height)/2);--r-popover--pointer--left:auto;--r-popover--pointer--right:100%;--r-popover--pointer--transform:rotate(90deg) translate(0, calc(0px - var(--pointer--spacer)))}:host([data-vertical=middle][data-horizontal=center]){--r-popover--pointer--display:none;--r-popover--board--transform:translate(calc(-50% + var(--r-popover--trigger--width, 0)/2), calc(-50% + var(--r-popover--trigger--height, 0)/2))}:host([data-vertical=middle][data-horizontal=cover]){--r-popover--pointer--display:none;--r-popover--board--left:0;--r-popover--board--transform:translate(0, calc(-50% + var(--r-popover--trigger--height, 0)/2))}:host([data-vertical=bottom][data-horizontal=left]){--r-popover--board--transform:translate(-100%, calc(var(--r-popover--trigger--height, 0) + var(--pointer--spacer) + var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=bottom][data-horizontal=right]){--r-popover--board--transform:translate(calc(0px - var(--board--shift)), calc(var(--r-popover--trigger--height, 0) + var(--r-popover--pointer--height, var(--pointer--height)) + var(--pointer--spacer)))}:host([data-vertical=bottom][data-horizontal=center]){--r-popover--board--transform:translate(calc(-50% + var(--r-popover--trigger--width, 0)/2), calc(var(--r-popover--trigger--height, 0) + var(--pointer--spacer) + var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=bottom][data-horizontal=cover]){--r-popover--pointer--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0)/2 - var(--r-popover--pointer--width, var(--pointer--width))/2);--r-popover--board--left:0;--r-popover--board--transform:translate(0, calc(var(--r-popover--trigger--height, 0) + var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=cover]){--r-popover--board--top:0;--r-popover--board--height:100%;--r-popover--board-content--height:100%;--r-popover--pointer--top:calc(var(--r-popover--trigger--top, 0) + var(--r-popover--trigger--height)/2 - var(--pointer--height)/2);--r-popover--pointer--bottom:auto}:host([data-vertical=cover][data-content-has-scroll=false]){--r-popover--board--top:var(--r-popover--trigger--top, 0)}:host([data-vertical=cover][data-horizontal=left]){--r-popover--board--left:var(--r-popover--trigger--left, 0);--r-popover--board--transform:translate(calc(-100% - var(--pointer--spacer) - var(--pointer--height)), 0);--r-popover--pointer--left:100%;--r-popover--pointer--right:auto;--r-popover--pointer--transform:rotate(-90deg) translate(0, calc(0px - var(--pointer--spacer)))}:host([data-vertical=cover][data-horizontal=right]){--r-popover--board--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0) + var(--pointer--width));--r-popover--pointer--left:auto;--r-popover--pointer--right:100%;--r-popover--pointer--transform:rotate(90deg) translate(0, calc(0px - var(--pointer--spacer)))}:host([data-vertical=cover][data-horizontal=center]),:host([data-vertical=cover][data-horizontal=cover]){--r-popover--pointer--display:none;--r-popover--board--transform:translate(calc(-50% + var(--r-popover--trigger--width, 0)/2), 0)}:host([data-vertical=cover][data-horizontal=cover]){--r-popover--pointer--display:none;--r-popover--board--transform:none;--r-popover--board--height:100%;--r-popover--board--width:100%;--r-popover--board--left:0}:host([data-fixed-top=true]){--r-popover--board-container--height:var(--r-popover--trigger--top, var(--board--max-height))}:host([dismiss-mode=manual]){--r-popover--board-content--padding:1.5rem 3.5rem 1.5rem 1.5rem}.r-popover{position:var(--r-popover--position, relative);display:var(--r-popover--display, inline-flex)}.r-popover--dismiss{position:var(--r-popover--dismiss--position, absolute);top:var(--r-popover--dismiss--top, 20px);right:var(--r-popover--dismiss--right, 20px);color:var(--r-text-inverse)}.r-popover--trigger{border:var(--r-popover--trigger--border, none);background:var(--r-popover--trigger--background, none);padding:var(--r-popover--trigger--padding, 0);cursor:var(--r-popover--trigger--cursor, pointer);display:var(--r-popover--trigger--display, inline-flex);align-items:var(--r-popover--trigger--align-items, center);justify-content:var(--r-popover--trigger--justify-content, center);min-width:var(--r-popover--trigger--min-width, unset);min-height:var(--r-popover--trigger--min-height, unset)}.r-popover--trigger:focus{box-shadow:0 0 0 6px var(--r-border-focused-outlined, #fff);outline:2px solid var(--r-border-focused, #0071e3);outline-offset:2px}.r-popover--board{position:var(--r-popover--board--position, fixed);top:var(--r-popover--board--top, -1000em);right:var(--r-popover--board--right, auto);bottom:var(--r-popover--board--bottom, auto);left:var(--r-popover--board--left, -1000em);visibility:var(--r-popover--board--visibility, hidden);width:var(--r-popover--board--width, 100%);min-width:var(--r-popover--board--max-width, var(--board--min-width));max-width:var(--r-popover--board--max-width, var(--board--max-width));height:var(--r-popover--board--height, auto);max-height:var(--r-popover--board--max-height, var(--board--max-height));background-color:var(--r-popover--board--background-color, var(--r-background-inverse));color:var(--r-popover--board--color, var(--r-text-inverse));border:var(--r-popover--board--border, none);transform:var(--r-popover--board--transform, none);box-sizing:var(--r-popover--board--box-sizing, border-box);padding:var(--r-popover--board--padding, 0);margin:var(--r-popover--board--margin, 0);overflow:var(--r-popover--board--overflow, visible)}.r-popover--board-content{display:var(--r-popover--board-content--display, flex);flex-direction:var(--r-popover--board-content--flex-direction, column);gap:var(--r-popover--board-content--gap, 1.5rem);overflow:var(--r-popover--board-content--overflow, auto);height:var(--r-popover--board-content--height, auto);max-height:var(--r-popover--board-content--max-height, var(--board--max-height));padding:var(--r-popover--board-content--padding, 1.5rem);box-sizing:var(--r-popover--board-content--box-sizing, border-box)}.r-popover--board-pointer{display:var(--r-popover--pointer--display, flex);width:var(--r-popover--pointer--width, var(--pointer--width));height:var(--r-popover--pointer--height, var(--pointer--height));position:var(--r-popover--pointer--position, absolute);top:var(--r-popover--pointer--top, auto);right:var(--r-popover--pointer--right, auto);bottom:var(--r-popover--pointer--bottom, auto);left:var(--r-popover--pointer--left, auto);color:var(--r-popover--pointer--color, var(--r-background-inverse));transform:var(--r-popover--pointer--transform, none);transform-origin:var(--r-popover--pointer--transform-origin, center)}.r-popover--board-pointer>svg{display:flex}";
|
|
3
|
+
const popoverCss = ":host{position:relative;overflow:visible;color:var(--r-text-inverse);font-family:var(--r-font-family-text, system-ui);font-weight:var(--r-font-weight-regular, 400);font-size:var(--r-font-size-400, 1rem);text-align:left}:host slot{display:contents}:host{--board--shift:1rem;--board--min-width:304px;--board--max-width:504px;--board--max-height:320px;--pointer--width:1rem;--pointer--height:0.5rem;--pointer--spacer:0.25rem}:host([size=s]){--r-popover--board--max-width:375px}:host([size=l]){--r-popover--board--max-width:500px}:host([data-open=true]){--r-popover--pointer--display:block;--r-popover--board--visibility:visible;--r-popover--board--left:var(--r-popover--trigger--left);--r-popover--board--top:var(--r-popover--trigger--top)}:host([data-open=true]) ::slotted([slot=trigger]){--r-popover--trigger--display:none}:host([data-vertical=top]){--r-popover--pointer--top:100%;--r-popover--pointer--transform:rotate(0deg) translate(0,-1px)}:host([data-vertical=bottom]){--r-popover--pointer--bottom:100%;--r-popover--pointer--transform:rotate(180deg)}:host([data-vertical=middle]){--r-popover--pointer--top:calc(50% - var(--pointer--height)/2);--r-popover--pointer--bottom:auto}:host([data-horizontal=left]){--r-popover--board--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0) + var(--board--shift));--r-popover--pointer--left:calc(100% - var(--r-popover--trigger--width, 0)/2 - var(--board--shift) - var(--pointer--width)/2)}:host([data-horizontal=right]){--r-popover--pointer--left:calc(var(--r-popover--trigger--width, 0)/2 + var(--pointer--width)/2)}:host([data-horizontal=center]){--r-popover--pointer--left:calc(50% - var(--pointer--width)/2)}:host([data-vertical=top][data-horizontal=left]){--r-popover--board--transform:translate(-100%, calc(-100% - var(--pointer--spacer) - var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=top][data-horizontal=right]){--r-popover--board--transform:translate(calc(0px - var(--board--shift)), calc(-100% - var(--pointer--spacer) - var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=top][data-horizontal=center]){--r-popover--board--transform:translate(calc(-50% + var(--r-popover--trigger--width, 0)/2), calc(-100% - var(--pointer--spacer) - var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=top][data-horizontal=cover]){--r-popover--pointer--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0)/2 - var(--r-popover--pointer--width, var(--pointer--width))/2);--r-popover--board--left:0;--r-popover--board--transform:translate(0, calc(-100% - var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=middle][data-horizontal=left]){--r-popover--board--left:var(--r-popover--trigger--left, 0);--r-popover--board--transform:translate(calc(-100% - var(--pointer--height) - var(--pointer--spacer)), calc(-50% + var(--r-popover--trigger--height, 0)/2));--r-popover--pointer--left:100%;--r-popover--pointer--right:auto;--r-popover--pointer--transform:rotate(-90deg) translate(0, calc(0px - var(--pointer--spacer)))}:host([data-vertical=middle][data-horizontal=right]){--r-popover--board--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0) + var(--pointer--height) + var(--pointer--spacer));--r-popover--board--transform:translate(0, calc(-50% + var(--r-popover--trigger--height, 0)/2));--r-popover--pointer--top:calc(50% - var(--pointer--height)/2);--r-popover--pointer--left:auto;--r-popover--pointer--right:100%;--r-popover--pointer--transform:rotate(90deg) translate(0, calc(0px - var(--pointer--spacer)))}:host([data-vertical=middle][data-horizontal=center]){--r-popover--pointer--display:none;--r-popover--board--transform:translate(calc(-50% + var(--r-popover--trigger--width, 0)/2), calc(-50% + var(--r-popover--trigger--height, 0)/2))}:host([data-vertical=middle][data-horizontal=cover]){--r-popover--pointer--display:none;--r-popover--board--left:0;--r-popover--board--transform:translate(0, calc(-50% + var(--r-popover--trigger--height, 0)/2))}:host([data-vertical=bottom][data-horizontal=left]){--r-popover--board--transform:translate(-100%, calc(var(--r-popover--trigger--height, 0) + var(--pointer--spacer) + var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=bottom][data-horizontal=right]){--r-popover--board--transform:translate(calc(0px - var(--board--shift)), calc(var(--r-popover--trigger--height, 0) + var(--r-popover--pointer--height, var(--pointer--height)) + var(--pointer--spacer)))}:host([data-vertical=bottom][data-horizontal=center]){--r-popover--board--transform:translate(calc(-50% + var(--r-popover--trigger--width, 0)/2), calc(var(--r-popover--trigger--height, 0) + var(--pointer--spacer) + var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=bottom][data-horizontal=cover]){--r-popover--pointer--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0)/2 - var(--r-popover--pointer--width, var(--pointer--width))/2);--r-popover--board--left:0;--r-popover--board--transform:translate(0, calc(var(--r-popover--trigger--height, 0) + var(--r-popover--pointer--height, var(--pointer--height))))}:host([data-vertical=cover]){--r-popover--board--top:0;--r-popover--board--height:100%;--r-popover--board-content--height:100%;--r-popover--pointer--top:calc(var(--r-popover--trigger--top, 0) + var(--r-popover--trigger--height)/2 - var(--pointer--height)/2);--r-popover--pointer--bottom:auto}:host([data-vertical=cover][data-content-has-scroll=false]){--r-popover--board--top:var(--r-popover--trigger--top, 0)}:host([data-vertical=cover][data-horizontal=left]){--r-popover--board--left:var(--r-popover--trigger--left, 0);--r-popover--board--transform:translate(calc(-100% - var(--pointer--spacer) - var(--pointer--height)), 0);--r-popover--pointer--left:100%;--r-popover--pointer--right:auto;--r-popover--pointer--transform:rotate(-90deg) translate(0, calc(0px - var(--pointer--spacer)))}:host([data-vertical=cover][data-horizontal=right]){--r-popover--board--left:calc(var(--r-popover--trigger--left, 0) + var(--r-popover--trigger--width, 0) + var(--pointer--width));--r-popover--pointer--left:auto;--r-popover--pointer--right:100%;--r-popover--pointer--transform:rotate(90deg) translate(0, calc(0px - var(--pointer--spacer)))}:host([data-vertical=cover][data-horizontal=center]),:host([data-vertical=cover][data-horizontal=cover]){--r-popover--pointer--display:none;--r-popover--board--transform:translate(calc(-50% + var(--r-popover--trigger--width, 0)/2), 0)}:host([data-vertical=cover][data-horizontal=cover]){--r-popover--pointer--display:none;--r-popover--board--transform:none;--r-popover--board--height:100%;--r-popover--board--width:100%;--r-popover--board--left:0}:host([data-fixed-top=true]){--r-popover--board-container--height:var(--r-popover--trigger--top, var(--board--max-height))}:host([dismiss-mode=manual]){--r-popover--board-content--padding:1.5rem 3.5rem 1.5rem 1.5rem}.r-popover{position:var(--r-popover--position, relative);display:var(--r-popover--display, inline-flex)}.r-popover--dismiss{position:var(--r-popover--dismiss--position, absolute);top:var(--r-popover--dismiss--top, 20px);right:var(--r-popover--dismiss--right, 20px);color:var(--r-text-inverse)}.r-popover--dismiss:hover{--r-icon-button--background-color:var(--r-background-interactive-hovered-inverse, rgba(243, 241, 240, 0.04))}.r-popover--dismiss:active{--r-icon-button--background-color:var(--r-background-interactive-pressed-inverse, rgba(243, 241, 240, 0.12))}.r-popover--trigger{border:var(--r-popover--trigger--border, none);background:var(--r-popover--trigger--background, none);padding:var(--r-popover--trigger--padding, 0);cursor:var(--r-popover--trigger--cursor, pointer);display:var(--r-popover--trigger--display, inline-flex);align-items:var(--r-popover--trigger--align-items, center);justify-content:var(--r-popover--trigger--justify-content, center);min-width:var(--r-popover--trigger--min-width, unset);min-height:var(--r-popover--trigger--min-height, unset)}.r-popover--trigger:focus{box-shadow:0 0 0 6px var(--r-border-focused-outlined, #fff);outline:2px solid var(--r-border-focused, #0071e3);outline-offset:2px}.r-popover--board{position:var(--r-popover--board--position, fixed);top:var(--r-popover--board--top, -1000em);right:var(--r-popover--board--right, auto);bottom:var(--r-popover--board--bottom, auto);left:var(--r-popover--board--left, -1000em);visibility:var(--r-popover--board--visibility, hidden);width:var(--r-popover--board--width, 100%);min-width:var(--r-popover--board--max-width, var(--board--min-width));max-width:var(--r-popover--board--max-width, var(--board--max-width));height:var(--r-popover--board--height, auto);max-height:var(--r-popover--board--max-height, var(--board--max-height));background-color:var(--r-popover--board--background-color, var(--r-background-inverse));color:var(--r-popover--board--color, var(--r-text-inverse));border:var(--r-popover--board--border, none);transform:var(--r-popover--board--transform, none);box-sizing:var(--r-popover--board--box-sizing, border-box);padding:var(--r-popover--board--padding, 0);margin:var(--r-popover--board--margin, 0);overflow:var(--r-popover--board--overflow, visible)}.r-popover--board-content{display:var(--r-popover--board-content--display, flex);flex-direction:var(--r-popover--board-content--flex-direction, column);gap:var(--r-popover--board-content--gap, 1.5rem);overflow:var(--r-popover--board-content--overflow, auto);height:var(--r-popover--board-content--height, auto);max-height:var(--r-popover--board-content--max-height, var(--board--max-height));padding:var(--r-popover--board-content--padding, 1.5rem);box-sizing:var(--r-popover--board-content--box-sizing, border-box)}.r-popover--board-pointer{display:var(--r-popover--pointer--display, flex);width:var(--r-popover--pointer--width, var(--pointer--width));height:var(--r-popover--pointer--height, var(--pointer--height));position:var(--r-popover--pointer--position, absolute);top:var(--r-popover--pointer--top, auto);right:var(--r-popover--pointer--right, auto);bottom:var(--r-popover--pointer--bottom, auto);left:var(--r-popover--pointer--left, auto);color:var(--r-popover--pointer--color, var(--r-background-inverse));transform:var(--r-popover--pointer--transform, none);transform-origin:var(--r-popover--pointer--transform-origin, center)}.r-popover--board-pointer>svg{display:flex}";
|
|
4
4
|
|
|
5
5
|
const Popover = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -27,18 +27,21 @@ const RadioGroup = class {
|
|
|
27
27
|
/** Unique id */
|
|
28
28
|
this.uniqueId = `r-radio-group-${Date.now().toString(32)}${Math.random().toString(32)}`.replace(/\./g, '');
|
|
29
29
|
this.getValidityStateData = element => {
|
|
30
|
+
let validityState = '';
|
|
31
|
+
let validityMessage = '';
|
|
30
32
|
if (element === null)
|
|
31
|
-
return;
|
|
33
|
+
return { validityState, validityMessage };
|
|
32
34
|
for (const state in element.validity) {
|
|
33
35
|
if (element.validity[state]) {
|
|
34
|
-
|
|
36
|
+
validityState = state;
|
|
35
37
|
if (this[state + 'Message']) {
|
|
36
|
-
|
|
37
|
-
return;
|
|
38
|
+
validityMessage = this[state + 'Message'];
|
|
39
|
+
return { validityState, validityMessage };
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
validityMessage = element.validationMessage;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
44
|
+
return { validityState, validityMessage };
|
|
42
45
|
};
|
|
43
46
|
this.validateFormElement = (element = null) => {
|
|
44
47
|
if (element === null)
|
|
@@ -47,7 +50,9 @@ const RadioGroup = class {
|
|
|
47
50
|
return;
|
|
48
51
|
if (this.error)
|
|
49
52
|
return;
|
|
50
|
-
this.getValidityStateData(element);
|
|
53
|
+
const { validityState, validityMessage } = this.getValidityStateData(element);
|
|
54
|
+
this.validityState = validityState;
|
|
55
|
+
this.validityMessage = validityMessage;
|
|
51
56
|
const isValid = this.validityState === 'valid';
|
|
52
57
|
this.valid = isValid;
|
|
53
58
|
this.invalid = !isValid;
|
|
@@ -204,14 +209,13 @@ const RadioGroup = class {
|
|
|
204
209
|
this.value = null;
|
|
205
210
|
}
|
|
206
211
|
/**
|
|
207
|
-
* Validates the radio group and returns a boolean indicating its validity.
|
|
208
|
-
*
|
|
212
|
+
* Validates the radio group without triggering UI and returns a boolean indicating its validity.
|
|
209
213
|
* @returns A boolean indicating whether the radio group is valid.
|
|
210
214
|
*/
|
|
211
215
|
async checkValidity() {
|
|
212
216
|
const element = this.nativeSelectedEl || this.nativeFirstEl || null;
|
|
213
|
-
this.getValidityStateData(element);
|
|
214
|
-
return
|
|
217
|
+
const { validityState } = this.getValidityStateData(element);
|
|
218
|
+
return validityState === 'valid';
|
|
215
219
|
}
|
|
216
220
|
/**
|
|
217
221
|
* Validates the radio group and displays the validity state.
|
|
@@ -336,12 +340,12 @@ const RadioGroup = class {
|
|
|
336
340
|
'tooltip-icon': tooltipIcon,
|
|
337
341
|
'tooltip-icon-color': tooltipIconColor
|
|
338
342
|
};
|
|
339
|
-
return (h(Host, { key: '
|
|
340
|
-
h("div", { key: '
|
|
341
|
-
h("r-hint", { key: '
|
|
342
|
-
h("r-hint", { key: '
|
|
343
|
-
h("r-hint", { key: '
|
|
344
|
-
h("r-hint", { key: '
|
|
343
|
+
return (h(Host, { key: '5bf5f0493d2329b07d82e332153e467239ddff0f' }, h("div", { key: '06f96cb1868f7cbb635137ca68eda6a326b969c3', class: "r-radio-group", onClick: this.onLabelClick }, label &&
|
|
344
|
+
h("div", { key: '4dca24e0cb903a2e74e55ee743ed595608af0bf4', class: "r-radio-group--label-container" }, h("r-label", Object.assign({ key: 'cba1398032eae164db0a00808a06116affa671ec', id: `${uniqueId}-label`, class: "r-radio-group--label", "field-indicator": fieldIndicator }, labelAttr), label), h("slot", { key: 'c0180f3c6c99fed7d524719aff8eb8e64236cc3c', name: "popover" })), hint &&
|
|
345
|
+
h("r-hint", { key: '3ae1c84630975059aa1532b4b72957967e398949', id: `${uniqueId}-hint`, class: "r-radio-group--hint", role: "note" }, hint), h("div", { key: '2c18a09474189e6f2719db7c6ee5fb51c460e52f', class: "r-radio-group--content" }, h("slot", { key: '1c79f92cc0cd2095cfe51ee5fc108b6a004c4e4e' }))), invalid && error &&
|
|
346
|
+
h("r-hint", { key: '86aa0f4d1400e401cc7f71259511f118a3f68ef7', "aria-live": "polite", id: `${uniqueId}-message`, role: "alert", variant: "error" }, error), this.validityState !== 'valid' && this.validityMessage &&
|
|
347
|
+
h("r-hint", { key: 'aa06f829a6566becdf4a1f86e26e5161526756fb', "aria-live": "polite", id: `${uniqueId}-message`, role: "alert", variant: "error" }, this.customErrorMessage || this.validityMessage), this.valid && this.validMessage && this.showValid &&
|
|
348
|
+
h("r-hint", { key: '11500e705487028e4312679a6757dc48d861ebba', role: "alert", variant: "success" }, this.validMessage)));
|
|
345
349
|
}
|
|
346
350
|
get host() { return getElement(this); }
|
|
347
351
|
};
|