@roadtrip/components 3.32.5 → 3.33.1
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/road-badge_14.cjs.entry.js +90 -32
- package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
- package/dist/cjs/road-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/road-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/road-phone-number-input.cjs.entry.js +21 -66
- package/dist/cjs/road-phone-number-input.cjs.entry.js.map +1 -1
- package/dist/cjs/road-plate-number.cjs.entry.js +2 -2
- package/dist/cjs/road-profil-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/road-progress-indicator-horizontal.cjs.entry.js +1 -1
- package/dist/cjs/road-progress-indicator-vertical-item.cjs.entry.js +1 -1
- package/dist/cjs/road-progress-indicator-vertical.cjs.entry.js +1 -1
- package/dist/cjs/road-progress-tracker-item.cjs.entry.js +1 -1
- package/dist/cjs/road-progress-tracker.cjs.entry.js +1 -1
- package/dist/cjs/road-progress.cjs.entry.js +1 -1
- package/dist/cjs/road-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/road-radio.cjs.entry.js +1 -1
- package/dist/cjs/road-range.cjs.entry.js +2 -2
- package/dist/cjs/road-rating.cjs.entry.js +1 -1
- package/dist/cjs/road-segmented-button-bar.cjs.entry.js +1 -1
- package/dist/cjs/road-segmented-button.cjs.entry.js +2 -2
- package/dist/cjs/road-segmented-buttons.cjs.entry.js +1 -1
- package/dist/cjs/road-select-filter.cjs.entry.js +2 -2
- package/dist/cjs/road-select.cjs.entry.js +1 -1
- package/dist/cjs/road-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/road-spinner.cjs.entry.js +1 -1
- package/dist/cjs/road-switch.cjs.entry.js +2 -2
- package/dist/cjs/road-tab-bar.cjs.entry.js +2 -2
- package/dist/cjs/road-tab-button.cjs.entry.js +2 -2
- package/dist/cjs/road-tab.cjs.entry.js +2 -2
- package/dist/cjs/road-table.cjs.entry.js +1 -1
- package/dist/cjs/road-tabs.cjs.entry.js +1 -1
- package/dist/cjs/road-tag.cjs.entry.js +1 -1
- package/dist/cjs/road-text.cjs.entry.js +1 -1
- package/dist/cjs/road-textarea.cjs.entry.js +1 -1
- package/dist/cjs/road-toast.cjs.entry.js +1 -1
- package/dist/cjs/road-toggle.cjs.entry.js +2 -2
- package/dist/cjs/road-toolbar-title-page.cjs.entry.js +1 -1
- package/dist/cjs/road-toolbar-title.cjs.entry.js +1 -1
- package/dist/cjs/road-toolbar-v2.cjs.entry.js +1 -1
- package/dist/cjs/road-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/roadtrip.cjs.js +1 -1
- package/dist/collection/components/drawer/drawer.css +17 -0
- package/dist/collection/components/drawer/drawer.js +26 -1
- package/dist/collection/components/drawer/drawer.js.map +1 -1
- package/dist/collection/components/drawer/drawer.stories.js +7 -1
- package/dist/collection/components/dropdown/dropdown.css +1 -1
- package/dist/collection/components/input/input.js +86 -23
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/input-group/input-group.css +10 -7
- package/dist/collection/components/input-group/input-group.js +19 -4
- package/dist/collection/components/input-group/input-group.js.map +1 -1
- package/dist/collection/components/phone-number-input/phone-number-input.css +198 -129
- package/dist/collection/components/phone-number-input/phone-number-input.js +20 -68
- package/dist/collection/components/phone-number-input/phone-number-input.js.map +1 -1
- package/dist/collection/components/plate-number/plate-number.js +2 -2
- package/dist/collection/components/profil-dropdown/profil-dropdown.js +1 -1
- package/dist/collection/components/progress/progress.js +1 -1
- package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.js +1 -1
- package/dist/collection/components/progress-indicator-vertical/progress-indicator-vertical.js +1 -1
- package/dist/collection/components/progress-indicator-vertical-item/progress-indicator-vertical-item.js +1 -1
- package/dist/collection/components/progress-tracker/progress-tracker.js +1 -1
- package/dist/collection/components/progress-tracker-item/progress-tracker-item.js +1 -1
- package/dist/collection/components/radio/radio.js +1 -1
- package/dist/collection/components/radio-group/radio-group.js +1 -1
- package/dist/collection/components/range/range.js +2 -2
- package/dist/collection/components/rating/rating.js +1 -1
- package/dist/collection/components/row/row.js +1 -1
- package/dist/collection/components/segmented-button/segmented-button.js +2 -2
- package/dist/collection/components/segmented-button-bar/segmented-button-bar.js +1 -1
- package/dist/collection/components/segmented-buttons/segmented-buttons.js +1 -1
- package/dist/collection/components/select/select.js +1 -1
- package/dist/collection/components/select-filter/select-filter.js +2 -2
- package/dist/collection/components/skeleton/skeleton.js +1 -1
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/switch/switch.js +2 -2
- package/dist/collection/components/tab/tab.js +2 -2
- package/dist/collection/components/tab-bar/tab-bar.js +2 -2
- package/dist/collection/components/tab-button/tab-button.js +2 -2
- package/dist/collection/components/table/table.js +1 -1
- package/dist/collection/components/tabs/tabs.js +1 -1
- package/dist/collection/components/tag/tag.js +1 -1
- package/dist/collection/components/text/text.js +1 -1
- package/dist/collection/components/textarea/textarea.js +1 -1
- package/dist/collection/components/toast/toast.js +1 -1
- package/dist/collection/components/toggle/toggle.js +2 -2
- package/dist/collection/components/toolbar/toolbar.js +1 -1
- package/dist/collection/components/toolbar-title/toolbar-title.js +1 -1
- package/dist/collection/components/toolbar-title-page/toolbar-title-page.js +1 -1
- package/dist/collection/components/toolbar-v2/toolbar-v2.js +1 -1
- package/dist/collection/components/tooltip/tooltip.js +3 -3
- package/dist/collection/components/utilities/text.stories.js +2 -0
- package/dist/collection/fonts/Muli-Black.woff +0 -0
- package/dist/collection/fonts/Muli-Black.woff2 +0 -0
- package/dist/collection/fonts/Muli-SemiBold.woff +0 -0
- package/dist/collection/fonts/Muli-SemiBold.woff2 +0 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/road-badge_14.entry.js +90 -32
- package/dist/esm/road-badge_14.entry.js.map +1 -1
- package/dist/esm/road-dropdown.entry.js +1 -1
- package/dist/esm/road-dropdown.entry.js.map +1 -1
- package/dist/esm/road-phone-number-input.entry.js +21 -66
- package/dist/esm/road-phone-number-input.entry.js.map +1 -1
- package/dist/esm/road-plate-number.entry.js +2 -2
- package/dist/esm/road-profil-dropdown.entry.js +1 -1
- package/dist/esm/road-progress-indicator-horizontal.entry.js +1 -1
- package/dist/esm/road-progress-indicator-vertical-item.entry.js +1 -1
- package/dist/esm/road-progress-indicator-vertical.entry.js +1 -1
- package/dist/esm/road-progress-tracker-item.entry.js +1 -1
- package/dist/esm/road-progress-tracker.entry.js +1 -1
- package/dist/esm/road-progress.entry.js +1 -1
- package/dist/esm/road-radio-group.entry.js +1 -1
- package/dist/esm/road-radio.entry.js +1 -1
- package/dist/esm/road-range.entry.js +2 -2
- package/dist/esm/road-rating.entry.js +1 -1
- package/dist/esm/road-segmented-button-bar.entry.js +1 -1
- package/dist/esm/road-segmented-button.entry.js +2 -2
- package/dist/esm/road-segmented-buttons.entry.js +1 -1
- package/dist/esm/road-select-filter.entry.js +2 -2
- package/dist/esm/road-select.entry.js +1 -1
- package/dist/esm/road-skeleton.entry.js +1 -1
- package/dist/esm/road-spinner.entry.js +1 -1
- package/dist/esm/road-switch.entry.js +2 -2
- package/dist/esm/road-tab-bar.entry.js +2 -2
- package/dist/esm/road-tab-button.entry.js +2 -2
- package/dist/esm/road-tab.entry.js +2 -2
- package/dist/esm/road-table.entry.js +1 -1
- package/dist/esm/road-tabs.entry.js +1 -1
- package/dist/esm/road-tag.entry.js +1 -1
- package/dist/esm/road-text.entry.js +1 -1
- package/dist/esm/road-textarea.entry.js +1 -1
- package/dist/esm/road-toast.entry.js +1 -1
- package/dist/esm/road-toggle.entry.js +2 -2
- package/dist/esm/road-toolbar-title-page.entry.js +1 -1
- package/dist/esm/road-toolbar-title.entry.js +1 -1
- package/dist/esm/road-toolbar-v2.entry.js +1 -1
- package/dist/esm/road-tooltip.entry.js +3 -3
- package/dist/esm/roadtrip.js +1 -1
- package/dist/html.html-data.json +4 -0
- package/dist/roadtrip/fonts/Muli-Black.woff +0 -0
- package/dist/roadtrip/fonts/Muli-Black.woff2 +0 -0
- package/dist/roadtrip/fonts/Muli-SemiBold.woff +0 -0
- package/dist/roadtrip/fonts/Muli-SemiBold.woff2 +0 -0
- package/dist/roadtrip/{p-c1e2aa67.entry.js → p-04913d58.entry.js} +2 -2
- package/dist/roadtrip/{p-494aab48.entry.js → p-06fbd2ea.entry.js} +2 -2
- package/dist/roadtrip/{p-2a4a0928.entry.js → p-167cd2fc.entry.js} +2 -2
- package/dist/roadtrip/p-215afdbd.entry.js +2 -0
- package/dist/roadtrip/{p-8f7375bc.entry.js → p-2e049c8e.entry.js} +2 -2
- package/dist/roadtrip/{p-8ca23318.entry.js → p-37430583.entry.js} +2 -2
- package/dist/roadtrip/{p-9fce16aa.entry.js → p-3dcaa947.entry.js} +2 -2
- package/dist/roadtrip/{p-b5c4455e.entry.js → p-3e36cd02.entry.js} +3 -3
- package/dist/roadtrip/p-3e36cd02.entry.js.map +1 -0
- package/dist/roadtrip/{p-1e61ca1f.entry.js → p-3f5dff96.entry.js} +2 -2
- package/dist/roadtrip/{p-f8817c0e.entry.js → p-449affa6.entry.js} +2 -2
- package/dist/roadtrip/p-4675ea6d.entry.js +2 -0
- package/dist/roadtrip/{p-4a47999a.entry.js → p-5fea6a74.entry.js} +2 -2
- package/dist/roadtrip/{p-f9754547.entry.js → p-60bd73ad.entry.js} +2 -2
- package/dist/roadtrip/p-65f9bd9c.entry.js +2 -0
- package/dist/roadtrip/{p-c68fc795.entry.js → p-6c617506.entry.js} +2 -2
- package/dist/roadtrip/{p-4e779fd6.entry.js → p-6ff3b37c.entry.js} +2 -2
- package/dist/roadtrip/p-85b1e505.entry.js +2 -0
- package/dist/roadtrip/{p-a990a8b6.entry.js → p-862c1831.entry.js} +2 -2
- package/dist/roadtrip/{p-a990a8b6.entry.js.map → p-862c1831.entry.js.map} +1 -1
- package/dist/roadtrip/p-8b04fc62.entry.js +2 -0
- package/dist/roadtrip/{p-0cacf829.entry.js → p-950b8a43.entry.js} +2 -2
- package/dist/roadtrip/p-950b8a43.entry.js.map +1 -0
- package/dist/roadtrip/{p-87c1ff76.entry.js → p-99a6faae.entry.js} +2 -2
- package/dist/roadtrip/{p-bba18327.entry.js → p-b5fa8c5a.entry.js} +2 -2
- package/dist/roadtrip/{p-db243855.entry.js → p-b8c5d292.entry.js} +2 -2
- package/dist/roadtrip/{p-d68e64a8.entry.js → p-c28e7add.entry.js} +2 -2
- package/dist/roadtrip/{p-10e65612.entry.js → p-c47ccbf2.entry.js} +2 -2
- package/dist/roadtrip/{p-c3ef32ef.entry.js → p-c6824205.entry.js} +2 -2
- package/dist/roadtrip/{p-833c1e78.entry.js → p-cfd2919e.entry.js} +2 -2
- package/dist/roadtrip/{p-a0a95c0a.entry.js → p-d80e7563.entry.js} +2 -2
- package/dist/roadtrip/p-db77c354.entry.js +2 -0
- package/dist/roadtrip/{p-5fab1bc3.entry.js.map → p-db77c354.entry.js.map} +1 -1
- package/dist/roadtrip/{p-4bbc889b.entry.js → p-e6c4c576.entry.js} +2 -2
- package/dist/roadtrip/{p-01be5517.entry.js → p-e6e9882b.entry.js} +2 -2
- package/dist/roadtrip/{p-5a6fbd7f.entry.js → p-e75ec60f.entry.js} +2 -2
- package/dist/roadtrip/{p-edbbe884.entry.js → p-ea1a175d.entry.js} +2 -2
- package/dist/roadtrip/{p-2903bdc0.entry.js → p-eac313e4.entry.js} +2 -2
- package/dist/roadtrip/{p-fb26ed7e.entry.js → p-f1b53143.entry.js} +2 -2
- package/dist/roadtrip/{p-b18cda16.entry.js → p-fd3c58b6.entry.js} +2 -2
- package/dist/roadtrip/{p-32845e72.entry.js → p-fe40ab3d.entry.js} +2 -2
- package/dist/roadtrip/roadtrip.css +1 -1
- package/dist/roadtrip/roadtrip.esm.js +1 -1
- package/dist/roadtrip/roadtrip.esm.js.map +1 -1
- package/dist/types/components/drawer/drawer.d.ts +4 -0
- package/dist/types/components/input/input.d.ts +1 -1
- package/dist/types/components/input-group/input-group.d.ts +4 -2
- package/dist/types/components/phone-number-input/phone-number-input.d.ts +3 -10
- package/dist/types/components-react.d.ts +4 -4
- package/dist/types/components.d.ts +17 -0
- package/hydrate/index.js +353 -357
- package/hydrate/index.mjs +353 -357
- package/package.json +1 -1
- package/dist/roadtrip/p-0cacf829.entry.js.map +0 -1
- package/dist/roadtrip/p-427bd935.entry.js +0 -2
- package/dist/roadtrip/p-5fab1bc3.entry.js +0 -2
- package/dist/roadtrip/p-78b51033.entry.js +0 -2
- package/dist/roadtrip/p-9737182c.entry.js +0 -2
- package/dist/roadtrip/p-a925ff64.entry.js +0 -2
- package/dist/roadtrip/p-b5c4455e.entry.js.map +0 -1
- package/dist/roadtrip/p-ee92b78d.entry.js +0 -2
- /package/dist/roadtrip/{p-c1e2aa67.entry.js.map → p-04913d58.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-494aab48.entry.js.map → p-06fbd2ea.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-2a4a0928.entry.js.map → p-167cd2fc.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-427bd935.entry.js.map → p-215afdbd.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-8f7375bc.entry.js.map → p-2e049c8e.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-8ca23318.entry.js.map → p-37430583.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-9fce16aa.entry.js.map → p-3dcaa947.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-1e61ca1f.entry.js.map → p-3f5dff96.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-f8817c0e.entry.js.map → p-449affa6.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-ee92b78d.entry.js.map → p-4675ea6d.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-4a47999a.entry.js.map → p-5fea6a74.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-f9754547.entry.js.map → p-60bd73ad.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-a925ff64.entry.js.map → p-65f9bd9c.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-c68fc795.entry.js.map → p-6c617506.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-4e779fd6.entry.js.map → p-6ff3b37c.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-9737182c.entry.js.map → p-85b1e505.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-78b51033.entry.js.map → p-8b04fc62.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-87c1ff76.entry.js.map → p-99a6faae.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-bba18327.entry.js.map → p-b5fa8c5a.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-db243855.entry.js.map → p-b8c5d292.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-d68e64a8.entry.js.map → p-c28e7add.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-10e65612.entry.js.map → p-c47ccbf2.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-c3ef32ef.entry.js.map → p-c6824205.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-833c1e78.entry.js.map → p-cfd2919e.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-a0a95c0a.entry.js.map → p-d80e7563.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-4bbc889b.entry.js.map → p-e6c4c576.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-01be5517.entry.js.map → p-e6e9882b.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-5a6fbd7f.entry.js.map → p-e75ec60f.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-edbbe884.entry.js.map → p-ea1a175d.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-2903bdc0.entry.js.map → p-eac313e4.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-fb26ed7e.entry.js.map → p-f1b53143.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-b18cda16.entry.js.map → p-fd3c58b6.entry.js.map} +0 -0
- /package/dist/roadtrip/{p-32845e72.entry.js.map → p-fe40ab3d.entry.js.map} +0 -0
|
@@ -47,16 +47,24 @@
|
|
|
47
47
|
|
|
48
48
|
::slotted([slot="prepend"]) {
|
|
49
49
|
margin-right: -3px;
|
|
50
|
-
border-color: var(--road-input-outline);
|
|
51
50
|
border-right-color: transparent;
|
|
51
|
+
border-color: var(--road-input-outline);
|
|
52
52
|
border-top-right-radius: 0;
|
|
53
53
|
border-bottom-right-radius: 0;
|
|
54
|
+
position: absolute;
|
|
55
|
+
left: 0;
|
|
56
|
+
top: 0;
|
|
57
|
+
bottom: 0;
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
::slotted([slot="append"]) {
|
|
57
61
|
margin-left: -0.25rem;
|
|
58
62
|
border-color: var(--road-input-outline);
|
|
59
63
|
border-left-width: 0;
|
|
64
|
+
position: absolute;
|
|
65
|
+
right: 0;
|
|
66
|
+
top: 0;
|
|
67
|
+
bottom: 0;
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
/**
|
|
@@ -140,6 +148,7 @@
|
|
|
140
148
|
.input-group-prepend {
|
|
141
149
|
z-index: 1;
|
|
142
150
|
order: -1;
|
|
151
|
+
position: relative;
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
.input-group-prepend ~ .form-label {
|
|
@@ -164,8 +173,6 @@
|
|
|
164
173
|
text-align: center;
|
|
165
174
|
white-space: nowrap;
|
|
166
175
|
cursor: text;
|
|
167
|
-
background: var(--road-surface);
|
|
168
|
-
border: 1px solid var(--road-input-outline);
|
|
169
176
|
border-radius: 0.25rem;
|
|
170
177
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
171
178
|
}
|
|
@@ -215,10 +222,6 @@
|
|
|
215
222
|
margin-right: calc(-1rem + 1px);
|
|
216
223
|
}
|
|
217
224
|
|
|
218
|
-
.input-group-append ::slotted(road-button) {
|
|
219
|
-
background-color: var(--road-surface);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
225
|
.input-group-append:hover ::slotted(road-button) {
|
|
223
226
|
background-color: var(--road-button-ghost-variant);
|
|
224
227
|
}
|
|
@@ -13,7 +13,7 @@ export class InputGroup {
|
|
|
13
13
|
handleDisabledChange(newValue) {
|
|
14
14
|
this.updateDisabledState(newValue);
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/** Applique le `disabled` aux enfants */
|
|
17
17
|
updateDisabledState(isDisabled) {
|
|
18
18
|
const children = this.el.querySelectorAll('road-input, road-button, road-select');
|
|
19
19
|
children.forEach(child => {
|
|
@@ -25,9 +25,24 @@ export class InputGroup {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
/** Vérifie et applique le `text-indent` si `prepend` est présent */
|
|
29
|
+
updateIndentation() {
|
|
30
|
+
const hasPrepend = !!this.el.querySelector('[slot="prepend"]');
|
|
31
|
+
const formControl = this.el.querySelector('.form-control');
|
|
32
|
+
const formLabel = this.el.querySelector('.form-label');
|
|
33
|
+
if (formControl) {
|
|
34
|
+
formControl.style.textIndent = hasPrepend ? '2rem' : '';
|
|
35
|
+
}
|
|
36
|
+
if (formLabel) {
|
|
37
|
+
formLabel.style.textIndent = hasPrepend ? '2.7rem' : '';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
componentDidLoad() {
|
|
30
41
|
this.updateDisabledState(this.disabled);
|
|
42
|
+
this.updateIndentation(); // Appliquer les styles au montage
|
|
43
|
+
// Observer les mutations (au cas où des éléments sont ajoutés dynamiquement)
|
|
44
|
+
const observer = new MutationObserver(() => this.updateIndentation());
|
|
45
|
+
observer.observe(this.el, { childList: true, subtree: true });
|
|
31
46
|
}
|
|
32
47
|
render() {
|
|
33
48
|
const errorClass = this.el.querySelector('road-input[error]') ? 'is-invalid' : '';
|
|
@@ -35,7 +50,7 @@ export class InputGroup {
|
|
|
35
50
|
? `size-${this.el.querySelector('road-input').sizes}`
|
|
36
51
|
: '';
|
|
37
52
|
const disabledClass = this.disabled ? 'is-disabled' : '';
|
|
38
|
-
return (h("div", { key: '
|
|
53
|
+
return (h("div", { key: 'd820b7eee7e4199722474ddb8a7e6dea5f3c1232', class: `input-group ${errorClass} ${disabledClass} ${sizeClass}` }, h("div", { key: 'ca3a4babe8c43a9d105bce56ff4d34bab501d916', class: "input-group-prepend" }, h("slot", { key: '85f0e1dacfa39a5e075edc6af93ad6b8233d55e3', name: "prepend" })), h("slot", { key: 'd1b3bc429d1388db53b32fabf24f9a8d3c24f1cd' }), h("div", { key: '557aff92ba2225803c997de830d60027e635be1a', class: "input-group-append" }, h("slot", { key: 'c4e7a0ba1ff5a766ba3d0683c6cfefd8e31afef9', name: "append" }))));
|
|
39
54
|
}
|
|
40
55
|
static get is() { return "road-input-group"; }
|
|
41
56
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group.js","sourceRoot":"","sources":["../../../src/components/input-group/input-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEnE;;;;GAIG;AAOH,MAAM,OAAO,UAAU;IALvB;QAQE,4EAA4E;QACpE,aAAQ,GAAY,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"input-group.js","sourceRoot":"","sources":["../../../src/components/input-group/input-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEnE;;;;GAIG;AAOH,MAAM,OAAO,UAAU;IALvB;QAQE,4EAA4E;QACpE,aAAQ,GAAY,KAAK,CAAC;KA8DnC;IA5DC,6EAA6E;IAE7E,oBAAoB,CAAC,QAAiB;QACpC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,yCAAyC;IACjC,mBAAmB,CAAC,UAAmB;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,sCAAsC,CAAC,CAAC;QAClF,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACvB,IAAI,UAAU,EAAE,CAAC;gBACf,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oEAAoE;IAC5D,iBAAiB;QACvB,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;QAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,eAAe,CAAgB,CAAC;QAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,aAAa,CAAgB,CAAC;QAEtE,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACd,SAAS,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,kCAAkC;QAE5D,6EAA6E;QAC7E,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACtE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM;QACJ,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;QAClF,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,mBAAmB,CAAC;YAC1D,CAAC,CAAC,QAAS,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,YAAY,CAA0B,CAAC,KAAK,EAAE;YAC/E,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;QAEzD,OAAO,CACL,4DAAK,KAAK,EAAE,eAAe,UAAU,IAAI,aAAa,IAAI,SAAS,EAAE;YACnE,4DAAK,KAAK,EAAC,qBAAqB;gBAC9B,6DAAM,IAAI,EAAC,SAAS,GAAG,CACnB;YACN,8DAAQ;YACR,4DAAK,KAAK,EAAC,oBAAoB;gBAC7B,6DAAM,IAAI,EAAC,QAAQ,GAAG,CAClB,CACF,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop, Watch } from '@stencil/core';\n\n/**\n * @slot prepend - Add icon or button before the field.\n * @slot - Add the road-input or road-select here.\n * @slot append - Add icon or button after the field.\n */\n\n@Component({\n tag: 'road-input-group',\n styleUrl: 'input-group.css',\n shadow: true,\n})\nexport class InputGroup {\n @Element() el!: HTMLRoadInputGroupElement;\n\n /** Disables the entire input group and propagates the state to children. */\n @Prop() disabled: boolean = false;\n\n /** Watches for changes in the `disabled` prop and updates child elements. */\n @Watch('disabled')\n handleDisabledChange(newValue: boolean) {\n this.updateDisabledState(newValue);\n }\n\n /** Applique le `disabled` aux enfants */\n private updateDisabledState(isDisabled: boolean) {\n const children = this.el.querySelectorAll('road-input, road-button, road-select');\n children.forEach(child => {\n if (isDisabled) {\n child.setAttribute('disabled', '');\n } else {\n child.removeAttribute('disabled');\n }\n });\n }\n\n /** Vérifie et applique le `text-indent` si `prepend` est présent */\n private updateIndentation() {\n const hasPrepend = !!this.el.querySelector('[slot=\"prepend\"]');\n const formControl = this.el.querySelector('.form-control') as HTMLElement;\n const formLabel = this.el.querySelector('.form-label') as HTMLElement;\n \n if (formControl) {\n formControl.style.textIndent = hasPrepend ? '2rem' : '';\n }\n if (formLabel) {\n formLabel.style.textIndent = hasPrepend ? '2.7rem' : '';\n }\n }\n\n componentDidLoad() {\n this.updateDisabledState(this.disabled);\n this.updateIndentation(); // Appliquer les styles au montage\n\n // Observer les mutations (au cas où des éléments sont ajoutés dynamiquement)\n const observer = new MutationObserver(() => this.updateIndentation());\n observer.observe(this.el, { childList: true, subtree: true });\n }\n\n render() {\n const errorClass = this.el.querySelector('road-input[error]') ? 'is-invalid' : '';\n const sizeClass = this.el.querySelector('road-input[sizes]') \n ? `size-${(this.el.querySelector('road-input') as HTMLRoadInputElement).sizes}` \n : '';\n const disabledClass = this.disabled ? 'is-disabled' : '';\n\n return (\n <div class={`input-group ${errorClass} ${disabledClass} ${sizeClass}`}>\n <div class=\"input-group-prepend\">\n <slot name=\"prepend\" />\n </div>\n <slot />\n <div class=\"input-group-append\">\n <slot name=\"append\" />\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
margin-left: -4.5rem;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.is-invalid .form-control.sc-road-input{
|
|
1
|
+
.is-invalid .phone-number-input-field.sc-road-input{
|
|
6
2
|
border-color: var(--road-danger-outline);
|
|
7
3
|
}
|
|
8
4
|
|
|
9
5
|
.road-phone-input-select {
|
|
10
6
|
position: relative;
|
|
11
7
|
display: block;
|
|
12
|
-
margin-bottom: 1rem;
|
|
13
8
|
font-family: var(--road-font, sans-serif);
|
|
14
9
|
color: var(--road-on-surface);
|
|
15
10
|
background-color: var(--road-surface);
|
|
@@ -53,154 +48,228 @@
|
|
|
53
48
|
cursor: pointer;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
.form-select-area:-moz-focusring {
|
|
52
|
+
color: transparent;
|
|
53
|
+
text-shadow: 0 0 0 #000000;
|
|
54
|
+
}
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
.form-select-area::-ms-expand { /* IE fix remove native arrow */
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
64
59
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Placeholder
|
|
62
|
+
*/
|
|
68
63
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
.form-select-area::placeholder {
|
|
65
|
+
color: var(--road-on-surface-extra-weak);
|
|
66
|
+
}
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Hover state
|
|
70
|
+
*/
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
@media (hover: hover) {
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
74
|
+
.form-select-area:not(:disabled):hover {
|
|
75
|
+
border-color: var(--road-input-outline-variant);
|
|
82
76
|
}
|
|
77
|
+
}
|
|
83
78
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Focus state
|
|
81
|
+
*/
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
.form-select-area:focus ~ .form-select-area-label,
|
|
84
|
+
.form-select-area[required]:valid ~ .form-select-area-label,
|
|
85
|
+
.form-select-area.has-value ~ .form-select-area-label {
|
|
86
|
+
transform: scale(0.625) translateY(-0.625rem);
|
|
87
|
+
}
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
.form-select-area:not(:disabled):focus {
|
|
90
|
+
border-color: var(--road-input-outline-variant);
|
|
91
|
+
}
|
|
97
92
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Disabled state
|
|
95
|
+
*/
|
|
101
96
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
.form-select-area:disabled,
|
|
98
|
+
.form-select-area[readonly] {
|
|
99
|
+
color: transparent;
|
|
100
|
+
cursor: not-allowed;
|
|
101
|
+
background: var(--road-surface-disabled);
|
|
102
|
+
opacity: 1;
|
|
103
|
+
}
|
|
109
104
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
.form-select-area-label {
|
|
114
|
-
position: absolute;
|
|
115
|
-
top: 0.9rem;
|
|
116
|
-
left: 1rem;
|
|
117
|
-
display: block;
|
|
118
|
-
font-size: var(--road-font-size-18);
|
|
119
|
-
line-height: 1.5;
|
|
120
|
-
color: var(--road-on-surface-extra-weak);
|
|
121
|
-
pointer-events: none;
|
|
122
|
-
transition: transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
123
|
-
transform-origin: 0 0;
|
|
124
|
-
}
|
|
105
|
+
/* LABEL
|
|
106
|
+
-------------------- */
|
|
125
107
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
108
|
+
.form-select-area-label {
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: 0.9rem;
|
|
111
|
+
left: 1rem;
|
|
112
|
+
display: block;
|
|
113
|
+
font-size: var(--road-font-size-18);
|
|
114
|
+
line-height: 1.5;
|
|
115
|
+
color: var(--road-on-surface-extra-weak);
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
transition: transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
118
|
+
transform-origin: 0 0;
|
|
119
|
+
}
|
|
130
120
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
position: absolute;
|
|
136
|
-
top: 1.4rem;
|
|
137
|
-
left: 1rem;
|
|
138
|
-
display: block;
|
|
139
|
-
font-size: var(--road-label-medium);
|
|
140
|
-
line-height: 1.5;
|
|
141
|
-
color: var(--road-on-surface);
|
|
142
|
-
pointer-events: none;
|
|
143
|
-
transition: transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
144
|
-
transform-origin: 0 0;
|
|
145
|
-
}
|
|
121
|
+
.form-select-area:required ~ .form-select-area-label::after{
|
|
122
|
+
color: var(--road-on-danger-surface);
|
|
123
|
+
content: " *";
|
|
124
|
+
}
|
|
146
125
|
|
|
126
|
+
/* Value
|
|
127
|
+
-------------------- */
|
|
147
128
|
|
|
148
|
-
|
|
149
|
-
|
|
129
|
+
.form-select-area-value {
|
|
130
|
+
position: absolute;
|
|
131
|
+
top: 1.4rem;
|
|
132
|
+
left: 1rem;
|
|
133
|
+
display: block;
|
|
134
|
+
font-size: var(--road-label-medium);
|
|
135
|
+
line-height: 1.5;
|
|
136
|
+
color: var(--road-on-surface);
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
transition: transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
139
|
+
transform-origin: 0 0;
|
|
140
|
+
}
|
|
150
141
|
|
|
151
|
-
:host(.select-xl) .form-select-area {
|
|
152
|
-
height: 3.5rem;
|
|
153
|
-
padding: 0.75rem 0 0 1rem;
|
|
154
|
-
}
|
|
155
142
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
143
|
+
/* SIZES
|
|
144
|
+
-------------------- */
|
|
159
145
|
|
|
160
|
-
|
|
161
|
-
:
|
|
162
|
-
:
|
|
163
|
-
|
|
164
|
-
:host(.select-xl) .form-select-area[type="time"] ~ .form-select-area-label {
|
|
165
|
-
transform: scale(0.75) translateY(-0.625rem);
|
|
166
|
-
}
|
|
146
|
+
:host(.select-xl) .form-select-area {
|
|
147
|
+
height: 3.5rem;
|
|
148
|
+
padding: 0.75rem 0 0 1rem;
|
|
149
|
+
}
|
|
167
150
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
151
|
+
.input-xl {
|
|
152
|
+
height: 3.5rem;
|
|
153
|
+
padding: 0.75rem 0 0 1rem;
|
|
154
|
+
}
|
|
171
155
|
|
|
172
|
-
|
|
173
|
-
|
|
156
|
+
:host(.select-xl) .form-select-area-label {
|
|
157
|
+
top: 1rem;
|
|
158
|
+
}
|
|
174
159
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
160
|
+
:host(.select-xl) .form-select-area:focus ~ .form-select-area-label,
|
|
161
|
+
:host(.select-xl) .form-select-area[required]:valid ~ .form-select-area-label,
|
|
162
|
+
:host(.select-xl) .form-select-area.has-value ~ .form-select-area-label,
|
|
163
|
+
:host(.select-xl) .form-select-area[type="date"] ~ .form-select-area-label,
|
|
164
|
+
:host(.select-xl) .form-select-area[type="time"] ~ .form-select-area-label {
|
|
165
|
+
transform: scale(0.75) translateY(-0.625rem);
|
|
166
|
+
}
|
|
182
167
|
|
|
183
|
-
|
|
184
|
-
.
|
|
185
|
-
|
|
186
|
-
}
|
|
168
|
+
:host(.select-xl) .form-select-area:placeholder-shown ~ .form-select-area-label {
|
|
169
|
+
transform: scale(0.75) translateY(-0.625rem);
|
|
170
|
+
}
|
|
187
171
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
display: block;
|
|
191
|
-
}
|
|
172
|
+
/* ERROR
|
|
173
|
+
-------------------- */
|
|
192
174
|
|
|
175
|
+
.invalid-feedback {
|
|
176
|
+
gap: .25rem;
|
|
177
|
+
display: flex;
|
|
178
|
+
width: 100%;
|
|
179
|
+
margin: 0.5rem 0;
|
|
180
|
+
font-size: var(--road-body-small);
|
|
181
|
+
color: var(--road-on-danger-surface);
|
|
182
|
+
}
|
|
193
183
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
content: attr(data-content);
|
|
199
|
-
}
|
|
184
|
+
.form-select-area.is-invalid,
|
|
185
|
+
.was-validated .form-select-area:invalid {
|
|
186
|
+
border-color: var(--road-on-danger-surface);
|
|
187
|
+
}
|
|
200
188
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
189
|
+
.form-select-area.is-invalid ~ .invalid-feedback,
|
|
190
|
+
.was-validated .form-select-area:invalid ~ .invalid-feedback {
|
|
191
|
+
display: block;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
.form-select-area option:checked::after {
|
|
196
|
+
position: absolute;
|
|
197
|
+
top: 0;
|
|
198
|
+
left: 0;
|
|
199
|
+
content: attr(data-content);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.form-select-area::after {
|
|
203
|
+
position: absolute;
|
|
204
|
+
top: 0;
|
|
205
|
+
left: 0;
|
|
206
|
+
content: var(--selected-content, '');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* -------------
|
|
210
|
+
INPUT FORM LABEL
|
|
211
|
+
--------------- */
|
|
212
|
+
|
|
213
|
+
.phone-number-input-label {
|
|
214
|
+
position: absolute;
|
|
215
|
+
top: 1rem;
|
|
216
|
+
left: 6rem;
|
|
217
|
+
display: block;
|
|
218
|
+
font-size: var(--road-body-medium);
|
|
219
|
+
line-height: 1.5;
|
|
220
|
+
color: var(--road-on-surface-weak);
|
|
221
|
+
pointer-events: none;
|
|
222
|
+
transition: transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
223
|
+
transform-origin: 0 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.phone-number-input-field:required ~ .phone-number-input-label::after{
|
|
227
|
+
color: var(--road-danger-default);
|
|
228
|
+
content: " *";
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Focus state
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
.phone-number-input-field:focus ~ .phone-number-input-label,
|
|
236
|
+
.phone-number-input-field[required]:valid ~ .phone-number-input-label,
|
|
237
|
+
.phone-number-input-field.has-value ~ .phone-number-input-label {
|
|
238
|
+
transform: scale(0.625) translateY(-0.625rem);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.phone-number-input-field:placeholder-shown ~ .phone-number-input-label {
|
|
242
|
+
transform: scale(0.625) translateY(-0.625rem);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* IE FIX */
|
|
246
|
+
|
|
247
|
+
.phone-number-input-field:-ms-input-placeholder ~ .phone-number-input-label {
|
|
248
|
+
transform: scale(0.625) translateY(-0.625rem);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.phone-number-inputs-container {
|
|
252
|
+
position: relative;
|
|
253
|
+
display: flex;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.road-phone-input-select {
|
|
257
|
+
margin-bottom: 1rem;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.is-error {
|
|
261
|
+
margin-bottom: 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* -------------
|
|
265
|
+
FORM INPUT FIELD
|
|
266
|
+
------------- */
|
|
267
|
+
|
|
268
|
+
.phone-number-input-field {
|
|
269
|
+
flex-grow: 1;
|
|
270
|
+
border: 1px solid var(--road-input-outline);
|
|
271
|
+
border-left: 0;
|
|
272
|
+
border-radius: 0.25rem;
|
|
273
|
+
border-bottom-left-radius: 0;
|
|
274
|
+
border-top-left-radius: 0;
|
|
275
|
+
}
|
|
@@ -26,12 +26,8 @@ export class RoadPhoneNumberInput {
|
|
|
26
26
|
phone: this.resetPhoneUtilData(),
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
updateMessagePosition() {
|
|
30
|
-
this.placeErrorMessage();
|
|
31
|
-
}
|
|
32
29
|
// On component load
|
|
33
30
|
componentWillLoad() {
|
|
34
|
-
this.placeErrorMessage();
|
|
35
31
|
let fromSelect = false;
|
|
36
32
|
if (this.phoneValue) {
|
|
37
33
|
this.phoneNumber = this.phoneValue;
|
|
@@ -48,35 +44,10 @@ export class RoadPhoneNumberInput {
|
|
|
48
44
|
}
|
|
49
45
|
// On user input
|
|
50
46
|
handleInput(event) {
|
|
51
|
-
|
|
47
|
+
const input = event.target;
|
|
48
|
+
this.phoneNumber = input.value;
|
|
52
49
|
this.createAndDispatchPhoneData();
|
|
53
50
|
}
|
|
54
|
-
// On user key down
|
|
55
|
-
handleKeyDown(event) {
|
|
56
|
-
// Liste des caractères interdits
|
|
57
|
-
const caracteresInterdits = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '=', '[', ']', '{', '}', '|', ';', ':', "'", '"', ',', '.', '<', '>', '/', '?'];
|
|
58
|
-
// Vérifier si la touche pressée est dans la liste des caractères interdits
|
|
59
|
-
if (caracteresInterdits.includes(event.key)) {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// On user key up
|
|
64
|
-
handleKeyUp(event) {
|
|
65
|
-
// Récupérer la valeur saisie
|
|
66
|
-
const inputValue = event.target.value || '';
|
|
67
|
-
// Vérifier si la valeur contient uniquement des chiffres ou le symbole "+"
|
|
68
|
-
const containsOnlyNumbersAndPlus = /^[0-9+]*$/.test(inputValue);
|
|
69
|
-
// Si la valeur ne contient pas uniquement des chiffres ou le symbole "+", réinitialiser le champ de saisie à son état précédent
|
|
70
|
-
if (!containsOnlyNumbersAndPlus) {
|
|
71
|
-
// Réinitialiser la valeur du champ de saisie à son état précédent
|
|
72
|
-
event.target.value = this.phoneNumber;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
// Si la valeur contient uniquement des chiffres ou le symbole "+", mettre à jour la valeur du numéro de téléphone
|
|
76
|
-
this.phoneNumber = inputValue;
|
|
77
|
-
this.createAndDispatchPhoneData();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
51
|
// On user select
|
|
81
52
|
handleSelect(event) {
|
|
82
53
|
const select = event.target;
|
|
@@ -88,6 +59,7 @@ export class RoadPhoneNumberInput {
|
|
|
88
59
|
this.updateCountryOptions();
|
|
89
60
|
}
|
|
90
61
|
createAndDispatchPhoneData(fromSelect) {
|
|
62
|
+
var _a;
|
|
91
63
|
// Init phone util
|
|
92
64
|
const phoneUtil = PhoneNumberUtil.getInstance();
|
|
93
65
|
const PNF = PhoneNumberFormat;
|
|
@@ -95,7 +67,7 @@ export class RoadPhoneNumberInput {
|
|
|
95
67
|
this.returnObject.phone = this.resetPhoneUtilData();
|
|
96
68
|
const tmpCountry = this.selectedCountry.length ? this.selectedCountry : this.countryData[0].countryCode;
|
|
97
69
|
try {
|
|
98
|
-
const parsedPhoneNumber = phoneUtil.parse(this.phoneNumber, tmpCountry);
|
|
70
|
+
const parsedPhoneNumber = phoneUtil.parse((_a = this.phoneNumber) !== null && _a !== void 0 ? _a : '', tmpCountry);
|
|
99
71
|
this.returnObject.isError = !phoneUtil.isValidNumber(parsedPhoneNumber) && !this.isEmptyPhoneNumber();
|
|
100
72
|
this.returnObject.phone.nationalNumber = phoneUtil.format(parsedPhoneNumber, PNF.NATIONAL);
|
|
101
73
|
this.returnObject.phone.internationalNumber = phoneUtil.format(parsedPhoneNumber, PNF.INTERNATIONAL);
|
|
@@ -117,7 +89,7 @@ export class RoadPhoneNumberInput {
|
|
|
117
89
|
const phoneType = Object.entries(PhoneNumberType).find(entry => entry[1] === phoneUtil.getNumberType(parsedPhoneNumber));
|
|
118
90
|
this.returnObject.phone.numberType = phoneType[0];
|
|
119
91
|
}
|
|
120
|
-
catch (
|
|
92
|
+
catch (_b) { }
|
|
121
93
|
finally {
|
|
122
94
|
this.roadPhoneNumberInput.emit(this.returnObject);
|
|
123
95
|
}
|
|
@@ -130,16 +102,18 @@ export class RoadPhoneNumberInput {
|
|
|
130
102
|
this.selectedCountry = value;
|
|
131
103
|
}
|
|
132
104
|
resetPhoneUtilData() {
|
|
105
|
+
var _a, _b;
|
|
133
106
|
return {
|
|
134
107
|
numberType: 'UNKNOWN',
|
|
135
108
|
countryCode: this.selectedCountry,
|
|
136
109
|
code: this.selectedCountryCode,
|
|
137
|
-
nationalNumber: this.phoneNumber,
|
|
138
|
-
internationalNumber: this.phoneNumber,
|
|
110
|
+
nationalNumber: (_a = this.phoneNumber) !== null && _a !== void 0 ? _a : '',
|
|
111
|
+
internationalNumber: (_b = this.phoneNumber) !== null && _b !== void 0 ? _b : '',
|
|
139
112
|
};
|
|
140
113
|
}
|
|
141
114
|
isEmptyPhoneNumber() {
|
|
142
|
-
|
|
115
|
+
var _a;
|
|
116
|
+
return !((_a = this.phoneNumber) === null || _a === void 0 ? void 0 : _a.length);
|
|
143
117
|
}
|
|
144
118
|
getPhoneCodeFromCountryCode(countryCode) {
|
|
145
119
|
var _a;
|
|
@@ -164,38 +138,22 @@ export class RoadPhoneNumberInput {
|
|
|
164
138
|
},
|
|
165
139
|
];
|
|
166
140
|
}
|
|
167
|
-
|
|
168
|
-
this.
|
|
169
|
-
messError.style.display = "flex";
|
|
170
|
-
messError.style.marginTop = "-0.5rem";
|
|
171
|
-
const phoneNumberInput = this.el;
|
|
172
|
-
phoneNumberInput.appendChild(messError);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
waitForElementToExist(selector) {
|
|
176
|
-
return new Promise(resolve => {
|
|
177
|
-
if (document.querySelector(selector)) {
|
|
178
|
-
return resolve(document.querySelector(selector));
|
|
179
|
-
}
|
|
180
|
-
const observer = new MutationObserver(() => {
|
|
181
|
-
if (document.querySelector(selector)) {
|
|
182
|
-
resolve(document.querySelector(selector));
|
|
183
|
-
observer.disconnect();
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
observer.observe(document.body, {
|
|
187
|
-
subtree: true,
|
|
188
|
-
childList: true,
|
|
189
|
-
});
|
|
190
|
-
});
|
|
141
|
+
hasValue() {
|
|
142
|
+
return this.phoneNumber !== '' && this.phoneNumber !== null;
|
|
191
143
|
}
|
|
192
144
|
render() {
|
|
193
|
-
const
|
|
145
|
+
const id = selectIds++;
|
|
146
|
+
const selectId = `road-phone-number-select-${id}`;
|
|
147
|
+
const inputId = `road-phone-number-input-${id}`;
|
|
194
148
|
const labelId = selectId + '-label';
|
|
195
149
|
const valueId = selectId + '-value';
|
|
196
150
|
const isInvalidClass = this.errorMessage.length ? 'is-invalid' : '';
|
|
197
151
|
const isErrorClass = this.errorMessage.length ? 'is-error' : '';
|
|
198
|
-
|
|
152
|
+
const hasValueClass = this.hasValue() ? 'has-value' : '';
|
|
153
|
+
const sizes = 'xl';
|
|
154
|
+
return (h(Host, { key: '7d65a01428b79587c98a5e399bab8403c0849a68' }, h("div", { key: 'b59d36be4bd2ecbe7469b37c194501d542895b29', class: 'phone-number-inputs-container' }, h("div", { key: '4cf3f4e60de5f861e09c8cbde5551fb95f209970', class: `road-phone-input-select ${isErrorClass} ${isInvalidClass}`, slot: "prepend" }, h("select", { key: '187f3724fcc9bf5c34c6490e61e5adee102ac052', id: selectId, class: `form-select-area has-value`, "aria-disabled": this.disabled ? 'true' : null, disabled: this.disabled, onChange: (event) => this.handleSelect(event), "aria-label": this.codeLabel, tabIndex: this.disabled ? -1 : 0 }, this.countryOptions && this.countryOptions.map(option => (h("option", { value: option.value, disabled: option.disabled, selected: option.selected }, option.label)))), h("label", { key: '8e867ef3d625b2e69246591cb8f84e7794ba1a7c', class: "form-select-area-label", id: labelId, htmlFor: selectId }, this.codeLabel), h("label", { key: '71ae31a4e0da49b93d28e433a41fbb40b74b603d', class: "form-select-area-value", id: valueId, htmlFor: selectId }, "+", this.selectedCountryCode)), h("input", { key: '289ac4032540c87f77784439864983ed5d544439', type: 'tel', id: inputId, class: `input-${sizes} phone-number-input-field ${hasValueClass} ${isErrorClass}`, value: this.phoneValue, required: this.required, tabIndex: 0, onInput: (event) => this.handleInput(event) }), h("label", { key: '60e9f10714d8807449534d1bce2f74f65a1646dc', class: "phone-number-input-label", id: labelId, htmlFor: inputId }, this.phoneLabel)), this.errorMessage
|
|
155
|
+
&& this.errorMessage !== ''
|
|
156
|
+
&& h("p", { key: 'b140351db845f88befd99aab39daa115c770732e', class: "invalid-feedback" }, h("road-icon", { key: 'ed89fc9c99493f67973448bbea8d7f0c20e0c455', slot: "start", color: 'danger', name: "alert-error-solid", "aria-hidden": "true", size: "sm" }), this.errorMessage)));
|
|
199
157
|
}
|
|
200
158
|
static get is() { return "road-phone-number-input"; }
|
|
201
159
|
static get encapsulation() { return "scoped"; }
|
|
@@ -423,11 +381,5 @@ export class RoadPhoneNumberInput {
|
|
|
423
381
|
}];
|
|
424
382
|
}
|
|
425
383
|
static get elementRef() { return "el"; }
|
|
426
|
-
static get watchers() {
|
|
427
|
-
return [{
|
|
428
|
-
"propName": "errorMessage",
|
|
429
|
-
"methodName": "updateMessagePosition"
|
|
430
|
-
}];
|
|
431
|
-
}
|
|
432
384
|
}
|
|
433
385
|
//# sourceMappingURL=phone-number-input.js.map
|