@riverty/web-components 5.7.0 → 6.0.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 +128 -0
- package/custom-elements.json +152 -372
- package/dist/cjs/index-DJ4H_bFj.js +6 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/r-accordion-panel.cjs.entry.js +1 -1
- package/dist/cjs/r-accordion-section.cjs.entry.js +1 -1
- package/dist/cjs/r-accordion-trigger.cjs.entry.js +5 -35
- package/dist/cjs/r-accordion.cjs.entry.js +3 -7
- package/dist/cjs/r-alert.cjs.entry.js +45 -14
- package/dist/cjs/r-badge.cjs.entry.js +1 -1
- package/dist/cjs/r-button.cjs.entry.js +2 -2
- package/dist/cjs/r-checkbox-group.cjs.entry.js +28 -24
- package/dist/cjs/r-checkbox.cjs.entry.js +97 -81
- package/dist/cjs/r-dialog.cjs.entry.js +3 -11
- package/dist/cjs/r-hint_2.cjs.entry.js +50 -0
- package/dist/cjs/{r-hint_3.cjs.entry.js → r-icon-button_2.cjs.entry.js} +64 -51
- package/dist/cjs/r-icon.cjs.entry.js +1 -1
- package/dist/cjs/r-input-code.cjs.entry.js +133 -25
- package/dist/cjs/r-input-date.cjs.entry.js +87 -23
- package/dist/cjs/r-input-password.cjs.entry.js +34 -13
- package/dist/cjs/r-input-phone-number.cjs.entry.js +30 -22
- package/dist/cjs/r-input.cjs.entry.js +108 -49
- package/dist/cjs/r-list-item.cjs.entry.js +5 -5
- package/dist/cjs/r-pagination.cjs.entry.js +1 -1
- package/dist/cjs/r-panel.cjs.entry.js +2 -2
- package/dist/cjs/r-popover-action.cjs.entry.js +2 -2
- package/dist/cjs/r-popover-content.cjs.entry.js +1 -1
- package/dist/cjs/r-popover-headline.cjs.entry.js +1 -1
- package/dist/cjs/r-popover-trigger.cjs.entry.js +1 -1
- package/dist/cjs/r-popover.cjs.entry.js +3 -3
- package/dist/cjs/r-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button-description.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button-leading.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button-title.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button-trailing.cjs.entry.js +1 -1
- package/dist/cjs/r-radio-button.cjs.entry.js +29 -12
- package/dist/cjs/r-radio-group.cjs.entry.js +32 -32
- package/dist/cjs/r-select-option.cjs.entry.js +1 -1
- package/dist/cjs/r-select.cjs.entry.js +116 -40
- package/dist/cjs/r-skip-link.cjs.entry.js +1 -1
- package/dist/cjs/r-stepper-item.cjs.entry.js +2 -2
- package/dist/cjs/r-stepper.cjs.entry.js +1 -1
- package/dist/cjs/r-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/r-tab.cjs.entry.js +1 -1
- package/dist/cjs/r-tabs-list.cjs.entry.js +1 -1
- package/dist/cjs/r-tabs.cjs.entry.js +1 -1
- package/dist/cjs/r-textarea.cjs.entry.js +24 -23
- package/dist/cjs/r-toast-group.cjs.entry.js +1 -1
- package/dist/cjs/r-toast.cjs.entry.js +51 -20
- package/dist/cjs/web-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/accordion/accordion.css +0 -2
- package/dist/collection/components/accordion/accordion.js +4 -8
- package/dist/collection/components/accordion/exports.js +1 -1
- package/dist/collection/components/accordion-panel/accordion-panel.js +1 -1
- package/dist/collection/components/accordion-section/accordion-section.js +1 -1
- package/dist/collection/components/accordion-trigger/accordion-trigger.css +0 -4
- package/dist/collection/components/accordion-trigger/accordion-trigger.js +4 -215
- package/dist/collection/components/alert/alert.css +58 -12
- package/dist/collection/components/alert/alert.js +92 -17
- package/dist/collection/components/alert/exports.js +1 -1
- package/dist/collection/components/badge/badge.js +1 -1
- package/dist/collection/components/button/button.css +6 -7
- package/dist/collection/components/button/button.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +121 -104
- package/dist/collection/components/checkbox-group/checkbox-group.js +48 -63
- package/dist/collection/components/dialog/dialog.css +1 -3
- package/dist/collection/components/dialog/dialog.js +2 -10
- package/dist/collection/components/hint/hint.js +2 -2
- 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/icon-button/icon-button.js +3 -3
- package/dist/collection/components/input/input.css +3 -0
- package/dist/collection/components/input/input.js +221 -378
- package/dist/collection/components/input-code/exports.js +2 -0
- package/dist/collection/components/input-code/input-code.js +335 -34
- package/dist/collection/components/input-date/input-date.js +237 -87
- package/dist/collection/components/input-password/exports.js +1 -0
- package/dist/collection/components/input-password/input-password.css +1 -0
- package/dist/collection/components/input-password/input-password.js +233 -75
- package/dist/collection/components/input-phone-number/input-phone-number.js +50 -85
- package/dist/collection/components/label/label.js +3 -113
- package/dist/collection/components/list-item/list-item/list-item.css +7 -7
- package/dist/collection/components/list-item/list-item/list-item.js +4 -26
- package/dist/collection/components/pagination/pagination.css +23 -23
- package/dist/collection/components/panel/panel.js +2 -2
- package/dist/collection/components/popover/exports.js +0 -1
- package/dist/collection/components/popover/popover.css +13 -13
- package/dist/collection/components/popover/popover.js +2 -55
- package/dist/collection/components/popover-action/popover-action.css +3 -5
- package/dist/collection/components/popover-action/popover-action.js +1 -1
- package/dist/collection/components/popover-content/popover-content.js +1 -1
- package/dist/collection/components/popover-headline/popover-headline.js +1 -1
- package/dist/collection/components/popover-trigger/popover-trigger.js +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +1 -1
- package/dist/collection/components/radio-button/radio-button.js +49 -12
- package/dist/collection/components/radio-button-description/radio-button-description.js +1 -1
- package/dist/collection/components/radio-button-leading/radio-button-leading.js +1 -1
- package/dist/collection/components/radio-button-title/radio-button-title.js +1 -1
- package/dist/collection/components/radio-button-trailing/radio-button-trailing.js +1 -1
- package/dist/collection/components/radio-group/radio-group.js +53 -135
- package/dist/collection/components/select/select.js +197 -349
- package/dist/collection/components/select-option/select-option.js +1 -1
- package/dist/collection/components/skip-link/skip-link.js +1 -1
- package/dist/collection/components/stepper/stepper.js +1 -1
- package/dist/collection/components/stepper-item/stepper-item.js +2 -2
- package/dist/collection/components/tab/tab.js +1 -1
- package/dist/collection/components/tab-panel/tab-panel.js +1 -1
- package/dist/collection/components/tabs/tabs.js +1 -1
- package/dist/collection/components/tabs-list/tabs-list.js +1 -1
- package/dist/collection/components/textarea/textarea.js +44 -163
- package/dist/collection/components/toast/toast.css +22 -14
- package/dist/collection/components/toast/toast.js +95 -43
- package/dist/collection/components/toast-group/toast-group.js +1 -1
- package/dist/collection/components/tooltip/tooltip.js +1 -1
- package/dist/esm/index-Da7qOBFr.js +6 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/r-accordion-panel.entry.js +1 -1
- package/dist/esm/r-accordion-section.entry.js +1 -1
- package/dist/esm/r-accordion-trigger.entry.js +5 -35
- package/dist/esm/r-accordion.entry.js +3 -7
- package/dist/esm/r-alert.entry.js +45 -14
- package/dist/esm/r-badge.entry.js +1 -1
- package/dist/esm/r-button.entry.js +2 -2
- package/dist/esm/r-checkbox-group.entry.js +28 -24
- package/dist/esm/r-checkbox.entry.js +97 -81
- package/dist/esm/r-dialog.entry.js +3 -11
- package/dist/esm/r-hint_2.entry.js +47 -0
- package/dist/esm/{r-hint_3.entry.js → r-icon-button_2.entry.js} +65 -51
- package/dist/esm/r-icon.entry.js +1 -1
- package/dist/esm/r-input-code.entry.js +133 -25
- package/dist/esm/r-input-date.entry.js +87 -23
- package/dist/esm/r-input-password.entry.js +34 -13
- package/dist/esm/r-input-phone-number.entry.js +30 -22
- package/dist/esm/r-input.entry.js +108 -49
- package/dist/esm/r-list-item.entry.js +5 -5
- package/dist/esm/r-pagination.entry.js +1 -1
- package/dist/esm/r-panel.entry.js +2 -2
- package/dist/esm/r-popover-action.entry.js +2 -2
- package/dist/esm/r-popover-content.entry.js +1 -1
- package/dist/esm/r-popover-headline.entry.js +1 -1
- package/dist/esm/r-popover-trigger.entry.js +1 -1
- package/dist/esm/r-popover.entry.js +3 -3
- package/dist/esm/r-progress-bar.entry.js +1 -1
- package/dist/esm/r-radio-button-description.entry.js +1 -1
- package/dist/esm/r-radio-button-leading.entry.js +1 -1
- package/dist/esm/r-radio-button-title.entry.js +1 -1
- package/dist/esm/r-radio-button-trailing.entry.js +1 -1
- package/dist/esm/r-radio-button.entry.js +29 -12
- package/dist/esm/r-radio-group.entry.js +32 -32
- package/dist/esm/r-select-option.entry.js +1 -1
- package/dist/esm/r-select.entry.js +116 -40
- package/dist/esm/r-skip-link.entry.js +1 -1
- package/dist/esm/r-stepper-item.entry.js +2 -2
- package/dist/esm/r-stepper.entry.js +1 -1
- package/dist/esm/r-tab-panel.entry.js +1 -1
- package/dist/esm/r-tab.entry.js +1 -1
- package/dist/esm/r-tabs-list.entry.js +1 -1
- package/dist/esm/r-tabs.entry.js +1 -1
- package/dist/esm/r-textarea.entry.js +24 -23
- package/dist/esm/r-toast-group.entry.js +1 -1
- package/dist/esm/r-toast.entry.js +51 -20
- package/dist/esm/web-components.js +1 -1
- package/dist/types/components/accordion/accordion.d.ts +1 -5
- package/dist/types/components/accordion/exports.d.ts +1 -1
- package/dist/types/components/accordion-trigger/accordion-trigger.d.ts +0 -36
- package/dist/types/components/alert/alert.d.ts +9 -1
- package/dist/types/components/alert/exports.d.ts +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +29 -34
- package/dist/types/components/checkbox-group/checkbox-group.d.ts +6 -11
- package/dist/types/components/dialog/dialog.d.ts +0 -2
- package/dist/types/components/input/input.d.ts +35 -72
- package/dist/types/components/input-code/exports.d.ts +4 -0
- package/dist/types/components/input-code/input-code.d.ts +54 -7
- package/dist/types/components/input-date/input-date.d.ts +30 -16
- package/dist/types/components/input-password/exports.d.ts +1 -0
- package/dist/types/components/input-password/input-password.d.ts +53 -16
- package/dist/types/components/input-phone-number/input-phone-number.d.ts +5 -16
- package/dist/types/components/label/label.d.ts +0 -18
- package/dist/types/components/list-item/list-item/list-item.d.ts +0 -6
- package/dist/types/components/popover/exports.d.ts +0 -2
- package/dist/types/components/popover/popover.d.ts +1 -14
- package/dist/types/components/radio-button/radio-button.d.ts +5 -0
- package/dist/types/components/radio-group/radio-group.d.ts +6 -28
- package/dist/types/components/select/select.d.ts +34 -52
- package/dist/types/components/textarea/textarea.d.ts +5 -32
- package/dist/types/components/toast/toast.d.ts +10 -7
- package/dist/types/components.d.ts +347 -647
- package/dist/web-components/bundled-icons/riverty-kit.json +1 -1
- package/dist/web-components/p-0347feff.entry.js +1 -0
- package/dist/web-components/p-05738503.entry.js +1 -0
- package/dist/web-components/p-0e4c8bf1.entry.js +1 -0
- package/dist/web-components/p-1da75540.entry.js +1 -0
- package/dist/web-components/p-26ef77d6.entry.js +1 -0
- package/dist/web-components/p-3884c6e7.entry.js +1 -0
- package/dist/web-components/p-3a5a67e7.entry.js +1 -0
- package/dist/web-components/p-3f60c6c0.entry.js +1 -0
- package/dist/web-components/p-4254a383.entry.js +1 -0
- package/dist/web-components/{p-87f39749.entry.js → p-4595fa8e.entry.js} +1 -1
- package/dist/web-components/{p-4e3df002.entry.js → p-4cc58c6a.entry.js} +1 -1
- package/dist/web-components/p-5441b746.entry.js +1 -0
- package/dist/web-components/{p-72fa1fd1.entry.js → p-550e2237.entry.js} +1 -1
- package/dist/web-components/p-589baaf9.entry.js +1 -0
- package/dist/web-components/p-60341de2.entry.js +1 -0
- package/dist/web-components/{p-4bd3e077.entry.js → p-60ca994e.entry.js} +1 -1
- package/dist/web-components/{p-44ae9f33.entry.js → p-62b788bf.entry.js} +1 -1
- package/dist/web-components/{p-2b2f581a.entry.js → p-6303b9fe.entry.js} +1 -1
- package/dist/web-components/p-63fd817d.entry.js +1 -0
- package/dist/web-components/{p-e0e2f2b2.entry.js → p-673dbfd0.entry.js} +1 -1
- package/dist/web-components/p-67fa3f84.entry.js +1 -0
- package/dist/web-components/p-6a4f3836.entry.js +1 -0
- package/dist/web-components/p-6cc2ea2c.entry.js +1 -0
- package/dist/web-components/p-70784685.entry.js +1 -0
- package/dist/web-components/{p-429213ea.entry.js → p-7fed6f4d.entry.js} +1 -1
- package/dist/web-components/p-8a66d20c.entry.js +1 -0
- package/dist/web-components/{p-0bb04d79.entry.js → p-8b4d2448.entry.js} +1 -1
- package/dist/web-components/{p-c7f8e59b.entry.js → p-8c31cbd5.entry.js} +1 -1
- package/dist/web-components/p-8dac326b.entry.js +1 -0
- package/dist/web-components/{p-1c2497de.entry.js → p-9ef1bbee.entry.js} +1 -1
- package/dist/web-components/p-a0dbde7c.entry.js +1 -0
- package/dist/web-components/{p-755cc697.entry.js → p-a71485d8.entry.js} +1 -1
- package/dist/web-components/p-a7d22c76.entry.js +1 -0
- package/dist/web-components/{p-85a9af42.entry.js → p-ae251d2f.entry.js} +1 -1
- package/dist/web-components/{p-77155630.entry.js → p-b98ab649.entry.js} +1 -1
- package/dist/web-components/p-b9e3b3d6.entry.js +1 -0
- package/dist/web-components/p-c1e748f2.entry.js +1 -0
- package/dist/web-components/p-c478712b.entry.js +1 -0
- package/dist/web-components/{p-72c0c0d8.entry.js → p-d054eb4d.entry.js} +1 -1
- package/dist/web-components/p-d433a828.entry.js +1 -0
- package/dist/web-components/p-d7726e46.entry.js +1 -0
- package/dist/web-components/p-d819c8e5.entry.js +1 -0
- package/dist/web-components/p-e2188953.entry.js +1 -0
- package/dist/web-components/{p-3b4e3faf.entry.js → p-e5945c01.entry.js} +1 -1
- package/dist/web-components/{p-d1379ac6.entry.js → p-f9d5004c.entry.js} +1 -1
- package/dist/web-components/web-components.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/r-accordion-item.cjs.entry.js +0 -78
- package/dist/cjs/r-icon-button.cjs.entry.js +0 -81
- package/dist/collection/components/accordion-item/accordion-item.css +0 -121
- package/dist/collection/components/accordion-item/accordion-item.js +0 -138
- package/dist/esm/r-accordion-item.entry.js +0 -76
- package/dist/esm/r-icon-button.entry.js +0 -79
- package/dist/types/components/accordion-item/accordion-item.d.ts +0 -26
- package/dist/web-components/p-00ca474f.entry.js +0 -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-3bc93d65.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-51a5804b.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-7ad8e78b.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-9e50120b.entry.js +0 -1
- package/dist/web-components/p-9eb1f262.entry.js +0 -1
- package/dist/web-components/p-a022f356.entry.js +0 -1
- package/dist/web-components/p-a7e7f8fa.entry.js +0 -1
- package/dist/web-components/p-b2f03016.entry.js +0 -1
- package/dist/web-components/p-c300c22f.entry.js +0 -1
- package/dist/web-components/p-c937bd92.entry.js +0 -1
- package/dist/web-components/p-cbcd7699.entry.js +0 -1
- package/dist/web-components/p-d93c240d.entry.js +0 -1
- package/dist/web-components/p-e4b66277.entry.js +0 -1
- package/dist/web-components/p-e6a31881.entry.js +0 -1
- package/dist/web-components/p-f6a92287.entry.js +0 -1
- package/dist/web-components/p-f770e22b.entry.js +0 -1
- package/dist/web-components/p-f952161b.entry.js +0 -1
|
@@ -22,6 +22,10 @@ export class InputDate {
|
|
|
22
22
|
this.validityState = '';
|
|
23
23
|
/** Validity message passed from validateFormElement function after validation */
|
|
24
24
|
this.validityMessage = '';
|
|
25
|
+
/** Defines if the component has been touched by user */
|
|
26
|
+
this.touched = false;
|
|
27
|
+
/** Defines if the value has been changed by user interaction */
|
|
28
|
+
this.dirty = false;
|
|
25
29
|
/**
|
|
26
30
|
* Initial attributes state
|
|
27
31
|
* */
|
|
@@ -112,6 +116,7 @@ export class InputDate {
|
|
|
112
116
|
if (this.readonly)
|
|
113
117
|
return;
|
|
114
118
|
if (event.code === 'Enter') {
|
|
119
|
+
this.touched = true;
|
|
115
120
|
this.validateFormElement(this.nativeElement);
|
|
116
121
|
if (this.invalid && !this.isNoValidate)
|
|
117
122
|
return;
|
|
@@ -162,6 +167,8 @@ export class InputDate {
|
|
|
162
167
|
if (this.readonly)
|
|
163
168
|
return;
|
|
164
169
|
this.value = event.clipboardData.getData('text');
|
|
170
|
+
this.touched = true;
|
|
171
|
+
this.dirty = true;
|
|
165
172
|
event.preventDefault();
|
|
166
173
|
};
|
|
167
174
|
this.createInputHandler = (input, index) => {
|
|
@@ -179,7 +186,10 @@ export class InputDate {
|
|
|
179
186
|
index < this.inputOrder.length - 1) {
|
|
180
187
|
(_c = this.inputs[index + 1]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
181
188
|
}
|
|
189
|
+
this.touched = true;
|
|
190
|
+
this.dirty = true;
|
|
182
191
|
this.rInput.emit({ element: this.host, value: this.value });
|
|
192
|
+
this.validateFormElement(this.nativeElement);
|
|
183
193
|
};
|
|
184
194
|
this.createChangeHandler = (input) => {
|
|
185
195
|
return (e) => this.handleChange(input, e);
|
|
@@ -192,29 +202,64 @@ export class InputDate {
|
|
|
192
202
|
event.target.value = value;
|
|
193
203
|
this.setDateComponent(input, value);
|
|
194
204
|
this.value = this.inputOrder.map((el) => this.getDateComponent(el)).join(this.delimiter);
|
|
205
|
+
this.touched = true;
|
|
206
|
+
this.dirty = true;
|
|
195
207
|
this.rChange.emit({ element: this.host, value: this.value });
|
|
196
208
|
this.validateFormElement(this.nativeElement);
|
|
197
209
|
};
|
|
210
|
+
this.handleBlur = () => {
|
|
211
|
+
this.touched = true;
|
|
212
|
+
this.validateFormElement(this.nativeElement);
|
|
213
|
+
};
|
|
198
214
|
this.getValidityStateData = (element) => {
|
|
215
|
+
let validityState = '';
|
|
216
|
+
let validityMessage = '';
|
|
199
217
|
if (this.required && element.value.length === 0) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
return;
|
|
218
|
+
validityState = 'valueMissing';
|
|
219
|
+
validityMessage = this.valueMissingMessage;
|
|
220
|
+
return { validityState, validityMessage };
|
|
203
221
|
}
|
|
204
|
-
const valid = dayjs(this.value, this.format, true).isValid();
|
|
222
|
+
const valid = this.value ? dayjs(this.value, this.format, true).isValid() : true;
|
|
205
223
|
if (!valid) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
return;
|
|
224
|
+
validityState = 'invalid';
|
|
225
|
+
validityMessage = this.invalidDateMessage;
|
|
226
|
+
return { validityState, validityMessage };
|
|
227
|
+
}
|
|
228
|
+
// Check min/max constraints only if date is valid and has a value
|
|
229
|
+
// Note: min and max are expected to be in the same format as this.format
|
|
230
|
+
// If format changes, the developer should update min/max accordingly
|
|
231
|
+
if (this.value && valid) {
|
|
232
|
+
const currentDate = dayjs(this.value, this.format, true);
|
|
233
|
+
// Check minimum date constraint
|
|
234
|
+
if (this.min) {
|
|
235
|
+
const minDate = dayjs(this.min, this.format, true);
|
|
236
|
+
if (minDate.isValid() && currentDate.isBefore(minDate, 'day')) {
|
|
237
|
+
validityState = 'rangeUnderflow';
|
|
238
|
+
validityMessage = this.rangeUnderflowMessage;
|
|
239
|
+
return { validityState, validityMessage };
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// Check maximum date constraint
|
|
243
|
+
if (this.max) {
|
|
244
|
+
const maxDate = dayjs(this.max, this.format, true);
|
|
245
|
+
if (maxDate.isValid() && currentDate.isAfter(maxDate, 'day')) {
|
|
246
|
+
validityState = 'rangeOverflow';
|
|
247
|
+
validityMessage = this.rangeOverflowMessage;
|
|
248
|
+
return { validityState, validityMessage };
|
|
249
|
+
}
|
|
250
|
+
}
|
|
209
251
|
}
|
|
210
|
-
|
|
252
|
+
validityState = 'valid';
|
|
253
|
+
return { validityState, validityMessage };
|
|
211
254
|
};
|
|
212
255
|
this.validateFormElement = (element) => {
|
|
213
256
|
if (element === null)
|
|
214
257
|
return;
|
|
215
258
|
if (this.isNoValidate)
|
|
216
259
|
return;
|
|
217
|
-
this.getValidityStateData(element);
|
|
260
|
+
const { validityState, validityMessage } = this.getValidityStateData(element);
|
|
261
|
+
this.validityState = validityState;
|
|
262
|
+
this.validityMessage = validityMessage;
|
|
218
263
|
const isValid = this.validityState === 'valid';
|
|
219
264
|
this.valid = isValid;
|
|
220
265
|
this.invalid = !isValid;
|
|
@@ -263,6 +308,8 @@ export class InputDate {
|
|
|
263
308
|
}
|
|
264
309
|
handleValueChange() {
|
|
265
310
|
this.setCurrentValues();
|
|
311
|
+
if (this.touched)
|
|
312
|
+
this.validateFormElement(this.nativeElement);
|
|
266
313
|
}
|
|
267
314
|
/** Get the date value */
|
|
268
315
|
async getValue() {
|
|
@@ -270,6 +317,7 @@ export class InputDate {
|
|
|
270
317
|
}
|
|
271
318
|
/** Sets the date value */
|
|
272
319
|
async setValue(value) {
|
|
320
|
+
this.nativeElement.value = value;
|
|
273
321
|
this.value = value;
|
|
274
322
|
}
|
|
275
323
|
/** Gets the current date format */
|
|
@@ -280,6 +328,19 @@ export class InputDate {
|
|
|
280
328
|
async setFormat(format) {
|
|
281
329
|
this.format = format;
|
|
282
330
|
}
|
|
331
|
+
/** Gets the touched state (whether user has interacted with the input) */
|
|
332
|
+
async isTouched() {
|
|
333
|
+
return this.touched;
|
|
334
|
+
}
|
|
335
|
+
/** Gets the dirty state (whether value has been changed by user) */
|
|
336
|
+
async isDirty() {
|
|
337
|
+
return this.dirty;
|
|
338
|
+
}
|
|
339
|
+
/** Resets touched and dirty states to pristine (untouched/clean) */
|
|
340
|
+
async markAsPristine() {
|
|
341
|
+
this.touched = false;
|
|
342
|
+
this.dirty = false;
|
|
343
|
+
}
|
|
283
344
|
/**
|
|
284
345
|
* Resets the component by clearing all input values and focusing the first input.
|
|
285
346
|
* @returns Promise that resolves when reset is complete
|
|
@@ -287,6 +348,7 @@ export class InputDate {
|
|
|
287
348
|
async reset() {
|
|
288
349
|
if (this.readonly)
|
|
289
350
|
return;
|
|
351
|
+
this.markAsPristine();
|
|
290
352
|
this.validityState = null;
|
|
291
353
|
this.validityMessage = null;
|
|
292
354
|
this.value = this.initial['value'];
|
|
@@ -294,6 +356,14 @@ export class InputDate {
|
|
|
294
356
|
this.format = this.initial['format'];
|
|
295
357
|
this.valid = !this.invalid;
|
|
296
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Validates the input date without triggering UI and returns a boolean indicating its validity.
|
|
361
|
+
* @returns A boolean indicating whether the input date is valid.
|
|
362
|
+
*/
|
|
363
|
+
async checkValidity() {
|
|
364
|
+
const { validityState } = this.getValidityStateData(this.nativeElement);
|
|
365
|
+
return validityState === 'valid';
|
|
366
|
+
}
|
|
297
367
|
get inputs() {
|
|
298
368
|
return Array.from(this.host.shadowRoot.querySelectorAll('input[data-date-type]'));
|
|
299
369
|
}
|
|
@@ -363,7 +433,7 @@ export class InputDate {
|
|
|
363
433
|
this.disconnectFormEventListeners();
|
|
364
434
|
}
|
|
365
435
|
render() {
|
|
366
|
-
const { form, name, required, disabled, label, fieldIndicator, hint,
|
|
436
|
+
const { form, name, required, disabled, label, fieldIndicator, hint, uniqueId, invalid, valid, readonly } = this;
|
|
367
437
|
const groupAttrs = {
|
|
368
438
|
'aria-invalid': `${invalid || false}`,
|
|
369
439
|
'aria-describedby': this.ariaDescribedBy
|
|
@@ -377,24 +447,18 @@ export class InputDate {
|
|
|
377
447
|
readonly,
|
|
378
448
|
'aria-describedby': this.ariaDescribedBy
|
|
379
449
|
};
|
|
380
|
-
// DEPRECATED: will be removed in November 2025 release.
|
|
381
|
-
const tooltipAttrs = tooltip ? {
|
|
382
|
-
tooltip,
|
|
383
|
-
'tooltip-icon': tooltipIcon,
|
|
384
|
-
'tooltip-icon-color': tooltipIconColor,
|
|
385
|
-
} : {};
|
|
386
450
|
const labelAttr = label ? {
|
|
387
451
|
id: `${uniqueId}-label`,
|
|
388
452
|
fieldIndicator
|
|
389
453
|
} : {};
|
|
390
|
-
return (h(Host, { key: '
|
|
391
|
-
h("r-label", Object.assign({}, labelAttr
|
|
454
|
+
return (h(Host, { key: '1a8a9175148f43758ec6b9d905c4bd2f619ffd7f', onClick: this.onHostClick, "data-touched": `${this.touched}`, "data-dirty": `${this.dirty}` }, h("fieldset", Object.assign({ key: 'fb004332d8578b8da74df643bd93f93d062973bb', class: "r-input-date" }, groupAttrs), h("div", { key: '128e65638dc21d95c8b4b92669b0bd6733a653f6', class: "r-input-date--legend-container" }, h("legend", { key: '63e7e858c38930fecbe71d819f1a0b49bf711911', class: "r-input-date--legend" }, h("label", { key: 'ccd6a5434f5df91bf9b2c121bb182c152302d864', htmlFor: uniqueId }, label ?
|
|
455
|
+
h("r-label", Object.assign({}, labelAttr), label)
|
|
392
456
|
:
|
|
393
|
-
h("slot", { name: "label" }))), h("slot", { key: '
|
|
394
|
-
h("r-hint", { key: '
|
|
395
|
-
h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), h("input", Object.assign({ key: '
|
|
396
|
-
h("r-icon", { key: '
|
|
397
|
-
h("r-icon", { key: '
|
|
457
|
+
h("slot", { name: "label" }))), h("slot", { key: '4be5c643d1b0532d27f4b82692cb6ca937291d6b', name: "popover" })), hint &&
|
|
458
|
+
h("r-hint", { key: '07a912c146dff97ef991a6e375f4aeb8cd0ba45e', id: `${uniqueId}-hint`, role: "note" }, hint), h("div", { key: '386dfb87cface9333c93d5fe8165cbe52a9a83c4', class: "r-input-date--container" }, h("r-icon", { key: '9ff075723ac54f6d7c2325ba59f833422404bee6', name: "calendar", size: "s", class: "r-input-date--calendar-icon" }), h("div", { key: 'ebcb76a92ab1591c3128a60d6620bea5b0c517ec', 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 &&
|
|
459
|
+
h("span", { "aria-hidden": "true", class: "r-input-date--delimiter" }, this.delimiter)))), h("input", Object.assign({ key: 'e5736ffa215662436c539332be1414cc409ce448', type: "hidden" }, dateInputAttrs, { value: this.value, ref: (el) => this.nativeElement = el }))), h("div", { key: '45ccffbb4111f2fd906d9b687f62f4adc83b62aa', class: "r-input-date--trailing" }, this.readonly &&
|
|
460
|
+
h("r-icon", { key: '3a5433e3d601a83154687bdd55feeeef0ef04215', class: "r-input-date--readonly-icon", name: "pen-disabled", size: "s" }), valid &&
|
|
461
|
+
h("r-icon", { key: '03de3e49b8b51690e4fb6c2edbb7a53ca1a71f76', name: "circled-check", size: "s", color: "var(--r-status-success-regular)" }), this.hasTrailingSlot && h("slot", { key: 'db4911a4421b296effdd37ca08c96d8a0096e5e6', name: "trailing" }))), h("div", { key: 'd21f19188462be93812487702eb8a07fd3a91cea', id: `${uniqueId}-message`, "aria-live": "polite", class: "r-input-date--message" }, this.hasMessage && h("r-hint", { key: '6937f2d48a634308c97d33e59daa0a7242bd39fd', variant: "error" }, this.message)))));
|
|
398
462
|
}
|
|
399
463
|
static get is() { return "r-input-date"; }
|
|
400
464
|
static get encapsulation() { return "shadow"; }
|
|
@@ -545,69 +609,6 @@ export class InputDate {
|
|
|
545
609
|
"setter": false,
|
|
546
610
|
"reflect": false
|
|
547
611
|
},
|
|
548
|
-
"tooltip": {
|
|
549
|
-
"type": "string",
|
|
550
|
-
"attribute": "tooltip",
|
|
551
|
-
"mutable": false,
|
|
552
|
-
"complexType": {
|
|
553
|
-
"original": "string",
|
|
554
|
-
"resolved": "string",
|
|
555
|
-
"references": {}
|
|
556
|
-
},
|
|
557
|
-
"required": false,
|
|
558
|
-
"optional": true,
|
|
559
|
-
"docs": {
|
|
560
|
-
"tags": [],
|
|
561
|
-
"text": "_DEPRECATED_ (Use popover slot instead. This property will be removed in November 2025 release.)\nLabel tooltip text"
|
|
562
|
-
},
|
|
563
|
-
"getter": false,
|
|
564
|
-
"setter": false,
|
|
565
|
-
"reflect": false
|
|
566
|
-
},
|
|
567
|
-
"tooltipIcon": {
|
|
568
|
-
"type": "string",
|
|
569
|
-
"attribute": "tooltip-icon",
|
|
570
|
-
"mutable": false,
|
|
571
|
-
"complexType": {
|
|
572
|
-
"original": "IconName",
|
|
573
|
-
"resolved": "string",
|
|
574
|
-
"references": {
|
|
575
|
-
"IconName": {
|
|
576
|
-
"location": "import",
|
|
577
|
-
"path": "../icon/exports",
|
|
578
|
-
"id": "src/components/icon/exports.ts::IconName"
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
},
|
|
582
|
-
"required": false,
|
|
583
|
-
"optional": true,
|
|
584
|
-
"docs": {
|
|
585
|
-
"tags": [],
|
|
586
|
-
"text": "_DEPRECATED_ (Use popover slot instead. This property will be removed in November 2025 release.)\nTooltip trigger icon by name from [Riverty icons set](https://storybook.riverty.design/?path=/story/components-icon--riverty-kit)"
|
|
587
|
-
},
|
|
588
|
-
"getter": false,
|
|
589
|
-
"setter": false,
|
|
590
|
-
"reflect": false
|
|
591
|
-
},
|
|
592
|
-
"tooltipIconColor": {
|
|
593
|
-
"type": "string",
|
|
594
|
-
"attribute": "tooltip-icon-color",
|
|
595
|
-
"mutable": false,
|
|
596
|
-
"complexType": {
|
|
597
|
-
"original": "string",
|
|
598
|
-
"resolved": "string",
|
|
599
|
-
"references": {}
|
|
600
|
-
},
|
|
601
|
-
"required": false,
|
|
602
|
-
"optional": true,
|
|
603
|
-
"docs": {
|
|
604
|
-
"tags": [],
|
|
605
|
-
"text": "_DEPRECATED_ (Use popover slot instead. This property will be removed in November 2025 release.)\nChange color of an icon that triggers tooltip to one of the Riverty color tokens"
|
|
606
|
-
},
|
|
607
|
-
"getter": false,
|
|
608
|
-
"setter": false,
|
|
609
|
-
"reflect": false
|
|
610
|
-
},
|
|
611
612
|
"hint": {
|
|
612
613
|
"type": "string",
|
|
613
614
|
"attribute": "hint",
|
|
@@ -858,6 +859,82 @@ export class InputDate {
|
|
|
858
859
|
"setter": false,
|
|
859
860
|
"reflect": false
|
|
860
861
|
},
|
|
862
|
+
"min": {
|
|
863
|
+
"type": "string",
|
|
864
|
+
"attribute": "min",
|
|
865
|
+
"mutable": false,
|
|
866
|
+
"complexType": {
|
|
867
|
+
"original": "string",
|
|
868
|
+
"resolved": "string",
|
|
869
|
+
"references": {}
|
|
870
|
+
},
|
|
871
|
+
"required": false,
|
|
872
|
+
"optional": true,
|
|
873
|
+
"docs": {
|
|
874
|
+
"tags": [],
|
|
875
|
+
"text": "Minimum date value (in the same format as the date input).\nNote: When changing the `format` prop, ensure `min` is also updated to match the new format."
|
|
876
|
+
},
|
|
877
|
+
"getter": false,
|
|
878
|
+
"setter": false,
|
|
879
|
+
"reflect": true
|
|
880
|
+
},
|
|
881
|
+
"max": {
|
|
882
|
+
"type": "string",
|
|
883
|
+
"attribute": "max",
|
|
884
|
+
"mutable": false,
|
|
885
|
+
"complexType": {
|
|
886
|
+
"original": "string",
|
|
887
|
+
"resolved": "string",
|
|
888
|
+
"references": {}
|
|
889
|
+
},
|
|
890
|
+
"required": false,
|
|
891
|
+
"optional": true,
|
|
892
|
+
"docs": {
|
|
893
|
+
"tags": [],
|
|
894
|
+
"text": "Maximum date value (in the same format as the date input).\nNote: When changing the `format` prop, ensure `max` is also updated to match the new format."
|
|
895
|
+
},
|
|
896
|
+
"getter": false,
|
|
897
|
+
"setter": false,
|
|
898
|
+
"reflect": true
|
|
899
|
+
},
|
|
900
|
+
"rangeUnderflowMessage": {
|
|
901
|
+
"type": "string",
|
|
902
|
+
"attribute": "range-underflow-message",
|
|
903
|
+
"mutable": false,
|
|
904
|
+
"complexType": {
|
|
905
|
+
"original": "string",
|
|
906
|
+
"resolved": "string",
|
|
907
|
+
"references": {}
|
|
908
|
+
},
|
|
909
|
+
"required": false,
|
|
910
|
+
"optional": true,
|
|
911
|
+
"docs": {
|
|
912
|
+
"tags": [],
|
|
913
|
+
"text": "Custom error message displayed when date is before the minimum date."
|
|
914
|
+
},
|
|
915
|
+
"getter": false,
|
|
916
|
+
"setter": false,
|
|
917
|
+
"reflect": false
|
|
918
|
+
},
|
|
919
|
+
"rangeOverflowMessage": {
|
|
920
|
+
"type": "string",
|
|
921
|
+
"attribute": "range-overflow-message",
|
|
922
|
+
"mutable": false,
|
|
923
|
+
"complexType": {
|
|
924
|
+
"original": "string",
|
|
925
|
+
"resolved": "string",
|
|
926
|
+
"references": {}
|
|
927
|
+
},
|
|
928
|
+
"required": false,
|
|
929
|
+
"optional": true,
|
|
930
|
+
"docs": {
|
|
931
|
+
"tags": [],
|
|
932
|
+
"text": "Custom error message displayed when date is after the maximum date."
|
|
933
|
+
},
|
|
934
|
+
"getter": false,
|
|
935
|
+
"setter": false,
|
|
936
|
+
"reflect": false
|
|
937
|
+
},
|
|
861
938
|
"customErrorMessage": {
|
|
862
939
|
"type": "string",
|
|
863
940
|
"attribute": "custom-error-message",
|
|
@@ -884,7 +961,9 @@ export class InputDate {
|
|
|
884
961
|
"currentValues": {},
|
|
885
962
|
"delimiter": {},
|
|
886
963
|
"validityState": {},
|
|
887
|
-
"validityMessage": {}
|
|
964
|
+
"validityMessage": {},
|
|
965
|
+
"touched": {},
|
|
966
|
+
"dirty": {}
|
|
888
967
|
};
|
|
889
968
|
}
|
|
890
969
|
static get events() {
|
|
@@ -1043,6 +1122,57 @@ export class InputDate {
|
|
|
1043
1122
|
"tags": []
|
|
1044
1123
|
}
|
|
1045
1124
|
},
|
|
1125
|
+
"isTouched": {
|
|
1126
|
+
"complexType": {
|
|
1127
|
+
"signature": "() => Promise<boolean>",
|
|
1128
|
+
"parameters": [],
|
|
1129
|
+
"references": {
|
|
1130
|
+
"Promise": {
|
|
1131
|
+
"location": "global",
|
|
1132
|
+
"id": "global::Promise"
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
"return": "Promise<boolean>"
|
|
1136
|
+
},
|
|
1137
|
+
"docs": {
|
|
1138
|
+
"text": "Gets the touched state (whether user has interacted with the input)",
|
|
1139
|
+
"tags": []
|
|
1140
|
+
}
|
|
1141
|
+
},
|
|
1142
|
+
"isDirty": {
|
|
1143
|
+
"complexType": {
|
|
1144
|
+
"signature": "() => Promise<boolean>",
|
|
1145
|
+
"parameters": [],
|
|
1146
|
+
"references": {
|
|
1147
|
+
"Promise": {
|
|
1148
|
+
"location": "global",
|
|
1149
|
+
"id": "global::Promise"
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
"return": "Promise<boolean>"
|
|
1153
|
+
},
|
|
1154
|
+
"docs": {
|
|
1155
|
+
"text": "Gets the dirty state (whether value has been changed by user)",
|
|
1156
|
+
"tags": []
|
|
1157
|
+
}
|
|
1158
|
+
},
|
|
1159
|
+
"markAsPristine": {
|
|
1160
|
+
"complexType": {
|
|
1161
|
+
"signature": "() => Promise<void>",
|
|
1162
|
+
"parameters": [],
|
|
1163
|
+
"references": {
|
|
1164
|
+
"Promise": {
|
|
1165
|
+
"location": "global",
|
|
1166
|
+
"id": "global::Promise"
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
"return": "Promise<void>"
|
|
1170
|
+
},
|
|
1171
|
+
"docs": {
|
|
1172
|
+
"text": "Resets touched and dirty states to pristine (untouched/clean)",
|
|
1173
|
+
"tags": []
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1046
1176
|
"reset": {
|
|
1047
1177
|
"complexType": {
|
|
1048
1178
|
"signature": "() => Promise<void>",
|
|
@@ -1062,6 +1192,26 @@ export class InputDate {
|
|
|
1062
1192
|
"text": "Promise that resolves when reset is complete"
|
|
1063
1193
|
}]
|
|
1064
1194
|
}
|
|
1195
|
+
},
|
|
1196
|
+
"checkValidity": {
|
|
1197
|
+
"complexType": {
|
|
1198
|
+
"signature": "() => Promise<boolean>",
|
|
1199
|
+
"parameters": [],
|
|
1200
|
+
"references": {
|
|
1201
|
+
"Promise": {
|
|
1202
|
+
"location": "global",
|
|
1203
|
+
"id": "global::Promise"
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
"return": "Promise<boolean>"
|
|
1207
|
+
},
|
|
1208
|
+
"docs": {
|
|
1209
|
+
"text": "Validates the input date without triggering UI and returns a boolean indicating its validity.",
|
|
1210
|
+
"tags": [{
|
|
1211
|
+
"name": "returns",
|
|
1212
|
+
"text": "A boolean indicating whether the input date is valid."
|
|
1213
|
+
}]
|
|
1214
|
+
}
|
|
1065
1215
|
}
|
|
1066
1216
|
};
|
|
1067
1217
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|