@roadtrip/components 3.52.0 → 3.53.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-alert.cjs.entry.js +1 -1
- package/dist/cjs/road-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/road-badge_14.cjs.entry.js +62 -12
- package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
- package/dist/cjs/road-card.cjs.entry.js +12 -2
- package/dist/cjs/road-card.cjs.entry.js.map +1 -1
- package/dist/cjs/road-progress.cjs.entry.js +1 -1
- package/dist/cjs/road-progress.cjs.entry.js.map +1 -1
- package/dist/cjs/road-toast.cjs.entry.js +66 -16
- package/dist/cjs/road-toast.cjs.entry.js.map +1 -1
- package/dist/cjs/roadtrip.cjs.js +1 -1
- package/dist/collection/components/alert/alert.css +5 -1
- package/dist/collection/components/card/card.css +10 -0
- package/dist/collection/components/card/card.js +31 -1
- package/dist/collection/components/card/card.js.map +1 -1
- package/dist/collection/components/card/card.stories.js +16 -0
- package/dist/collection/components/counter/counter.js +128 -2
- package/dist/collection/components/counter/counter.js.map +1 -1
- package/dist/collection/components/counter/counter.stories.js +36 -0
- package/dist/collection/components/drawer/drawer.css +44 -6
- package/dist/collection/components/drawer/drawer.js +23 -10
- package/dist/collection/components/drawer/drawer.js.map +1 -1
- package/dist/collection/components/progress/progress.css +2 -1
- package/dist/collection/components/toast/toast.css +20 -1
- package/dist/collection/components/toast/toast.js +68 -14
- package/dist/collection/components/toast/toast.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/road-alert.entry.js +1 -1
- package/dist/esm/road-alert.entry.js.map +1 -1
- package/dist/esm/road-badge_14.entry.js +62 -12
- package/dist/esm/road-badge_14.entry.js.map +1 -1
- package/dist/esm/road-card.entry.js +12 -2
- package/dist/esm/road-card.entry.js.map +1 -1
- package/dist/esm/road-progress.entry.js +1 -1
- package/dist/esm/road-progress.entry.js.map +1 -1
- package/dist/esm/road-toast.entry.js +66 -16
- package/dist/esm/road-toast.entry.js.map +1 -1
- package/dist/esm/roadtrip.js +1 -1
- package/dist/html.html-data.json +28 -0
- package/dist/roadtrip/p-12f2b114.entry.js +2 -0
- package/dist/roadtrip/p-12f2b114.entry.js.map +1 -0
- package/dist/roadtrip/p-27dea4d1.entry.js +18 -0
- package/dist/roadtrip/p-27dea4d1.entry.js.map +1 -0
- package/dist/roadtrip/p-3444d6fe.entry.js +2 -0
- package/dist/roadtrip/p-3444d6fe.entry.js.map +1 -0
- package/dist/roadtrip/p-ad2f2c53.entry.js +2 -0
- package/dist/roadtrip/p-ad2f2c53.entry.js.map +1 -0
- package/dist/roadtrip/p-f94214a1.entry.js +2 -0
- package/dist/roadtrip/p-f94214a1.entry.js.map +1 -0
- package/dist/roadtrip/roadtrip.esm.js +1 -1
- package/dist/roadtrip/roadtrip.esm.js.map +1 -1
- package/dist/types/components/card/card.d.ts +6 -0
- package/dist/types/components/counter/counter.d.ts +20 -0
- package/dist/types/components/drawer/drawer.d.ts +5 -0
- package/dist/types/components/toast/toast.d.ts +12 -0
- package/dist/types/components.d.ts +80 -0
- package/hydrate/index.js +252 -131
- package/hydrate/index.mjs +252 -131
- package/package.json +1 -1
- package/dist/roadtrip/p-23b0d708.entry.js +0 -2
- package/dist/roadtrip/p-23b0d708.entry.js.map +0 -1
- package/dist/roadtrip/p-2fef9c0f.entry.js +0 -18
- package/dist/roadtrip/p-2fef9c0f.entry.js.map +0 -1
- package/dist/roadtrip/p-3646f072.entry.js +0 -2
- package/dist/roadtrip/p-3646f072.entry.js.map +0 -1
- package/dist/roadtrip/p-4bbe3312.entry.js +0 -2
- package/dist/roadtrip/p-4bbe3312.entry.js.map +0 -1
- package/dist/roadtrip/p-8630081f.entry.js +0 -2
- package/dist/roadtrip/p-8630081f.entry.js.map +0 -1
|
@@ -148,6 +148,8 @@ const Counter = class {
|
|
|
148
148
|
this.leftIconClasses = "";
|
|
149
149
|
this.rightIconClasses = "";
|
|
150
150
|
this.isDustbinVisible = false;
|
|
151
|
+
this.decreaseAriaLabel = "";
|
|
152
|
+
this.increaseAriaLabel = "";
|
|
151
153
|
/**
|
|
152
154
|
* The id of counter
|
|
153
155
|
*/
|
|
@@ -172,6 +174,22 @@ const Counter = class {
|
|
|
172
174
|
* Set to `true` to not modify the input field
|
|
173
175
|
*/
|
|
174
176
|
this.readonly = false;
|
|
177
|
+
/**
|
|
178
|
+
* Accessible label for the dustbin button when `dustbin` is enabled and value equals `min`.
|
|
179
|
+
*/
|
|
180
|
+
this.dustbinLabelA11y = "Supprimer l'article";
|
|
181
|
+
/**
|
|
182
|
+
* Accessible label for the decrease button (suffix `, minimum {min}` is appended when not in dustbin mode).
|
|
183
|
+
*/
|
|
184
|
+
this.decreaseLabelA11y = 'Diminuer la quantité';
|
|
185
|
+
/**
|
|
186
|
+
* Accessible label for the increase button (suffix `, maximum {max}` is appended when not in dustbin mode).
|
|
187
|
+
*/
|
|
188
|
+
this.increaseLabelA11y = 'Augmenter la quantité';
|
|
189
|
+
/**
|
|
190
|
+
* Accessible label for the input field.
|
|
191
|
+
*/
|
|
192
|
+
this.quantityLabelA11y = 'Quantité';
|
|
175
193
|
this.setIsDustbinVisible = (valueInput) => {
|
|
176
194
|
if (valueInput > this.min) {
|
|
177
195
|
this.isDustbinVisible = false;
|
|
@@ -243,6 +261,23 @@ const Counter = class {
|
|
|
243
261
|
onValueChange(valueInput) {
|
|
244
262
|
this.setIsDustbinVisible(valueInput);
|
|
245
263
|
this.setIconsClasses(valueInput);
|
|
264
|
+
this.updateAriaLabels(valueInput);
|
|
265
|
+
}
|
|
266
|
+
onA11yLabelChange() {
|
|
267
|
+
var _a, _b, _c;
|
|
268
|
+
const currentValue = parseInt((_c = (_b = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : String(this.value));
|
|
269
|
+
this.updateAriaLabels(currentValue);
|
|
270
|
+
}
|
|
271
|
+
updateAriaLabels(valueInput) {
|
|
272
|
+
const isDustbin = this.isDustbinVisible || (valueInput <= this.min && this.dustbin);
|
|
273
|
+
this.decreaseAriaLabel = isDustbin
|
|
274
|
+
? this.dustbinLabelA11y
|
|
275
|
+
: this.min > 0
|
|
276
|
+
? `${this.decreaseLabelA11y}, minimum ${this.min}`
|
|
277
|
+
: this.decreaseLabelA11y;
|
|
278
|
+
this.increaseAriaLabel = this.max
|
|
279
|
+
? `${this.increaseLabelA11y}, maximum ${this.max}`
|
|
280
|
+
: this.increaseLabelA11y;
|
|
246
281
|
}
|
|
247
282
|
setIconsClasses(valueInput) {
|
|
248
283
|
valueInput = valueInput !== null && valueInput !== void 0 ? valueInput : parseInt(this.inputElement.querySelector('input').value);
|
|
@@ -298,12 +333,15 @@ const Counter = class {
|
|
|
298
333
|
}
|
|
299
334
|
render() {
|
|
300
335
|
const dataCi = this.isDustbinVisible ? "road-dustbin" : "";
|
|
301
|
-
return (h("road-input-group", { key: '
|
|
336
|
+
return (h("road-input-group", { key: '59731a94e0d7c0d8774556692dbdc4b1f626e635', class: this.size && `counter-${this.size}` }, h("road-button", { key: '95dcb39bb1fb496f74786095af6b5e2d7a75da00', slot: "prepend", size: this.size, onClick: this.decrease, class: this.leftIconClasses, disabled: this.readonly || (this.leftIconClasses === "disabled"), "aria-label": this.decreaseAriaLabel, "data-cy": "road-decrease" }, h("road-icon", { key: '49146a633a0f249b8cc13df674ca8e4ed1825912', name: this.isDustbinVisible ? "delete-forever" : "navigation-add-less", ref: (el) => this.iconCounterLess = el, size: this.size, "data-cy": dataCi, "aria-hidden": "true" })), h("road-input", { key: 'c84bbe30befc22c50897a0765ea2364cd17f86f8', ref: (el) => this.inputElement = el, type: "number", min: this.min.toString(), max: (this.max && this.max.toString()), step: this.step, value: this.value, onRoadChange: this.onRoadChange, onKeyUp: this.checkValue, "data-cy": "road-input-counter", readonly: this.readonly, label: "Quantit\u00E9", "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max, "aria-label": this.quantityLabelA11y, "aria-live": "polite" }), h("road-button", { key: 'c6518e4cd30bed6667587766a950936e91e7bb9e', slot: "append", size: this.size, onClick: this.increase, class: this.rightIconClasses, disabled: this.readonly || (this.rightIconClasses === "disabled"), "aria-label": this.increaseAriaLabel, "data-cy": "road-increase" }, h("road-icon", { key: '285031ad919ebbb4b1659aba873f99a5748ef375', name: "navigation-add-more", size: this.size, "aria-hidden": "true" }))));
|
|
302
337
|
}
|
|
303
338
|
get el() { return getElement(this); }
|
|
304
339
|
static get watchers() { return {
|
|
305
340
|
"value": ["onValueChange"],
|
|
306
|
-
"readonly": ["onValueChange"]
|
|
341
|
+
"readonly": ["onValueChange"],
|
|
342
|
+
"decreaseLabelA11y": ["onA11yLabelChange"],
|
|
343
|
+
"increaseLabelA11y": ["onA11yLabelChange"],
|
|
344
|
+
"dustbinLabelA11y": ["onA11yLabelChange"]
|
|
307
345
|
}; }
|
|
308
346
|
};
|
|
309
347
|
let counterIds = 0;
|
|
@@ -1889,7 +1927,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1889
1927
|
return trap;
|
|
1890
1928
|
};
|
|
1891
1929
|
|
|
1892
|
-
const drawerCss = ":host{--background:var(--road-surface);--color:var(--road-on-surface);--header-icon:var(--road-on-surface);--header-color:var(--road-on-surface);--header-background:var(--road-surface);--header-delimiter:0;--back-chevron-color:var(--road-icon);--max-height:auto;--z-index:10;position:fixed;top:0;left:0;z-index:var(--z-index);display:flex;justify-content:flex-start;width:100%;height:100%;overflow:hidden;font-family:var(--road-font, sans-serif);line-height:1.5;color:var(--color);visibility:hidden !important;
|
|
1930
|
+
const drawerCss = ":host{--background:var(--road-surface);--color:var(--road-on-surface);--header-icon:var(--road-on-surface);--header-color:var(--road-on-surface);--header-background:var(--road-surface);--header-delimiter:0;--back-chevron-color:var(--road-icon);--max-height:auto;--z-index:10;position:fixed;top:0;left:0;z-index:var(--z-index);display:flex;justify-content:flex-start;width:100%;height:100%;overflow:hidden;font-family:var(--road-font, sans-serif);line-height:1.5;color:var(--color);visibility:hidden !important;transition:visibility 0s linear 0.3s}.drawer-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:block;touch-action:none;cursor:pointer;background:var(--road-overlay);opacity:0}.road-drawer-wrapper{width:100%}.road-drawer-wrapper .drawer-dialog{position:absolute;right:0;width:100%;pointer-events:none;transition:transform 0.3s ease-out;opacity:0;transform:none}:host(.drawer-right){justify-content:flex-end}:host(.drawer-right) .road-drawer-wrapper .drawer-dialog{transform:translateX(100%)}:host(.drawer-left) .road-drawer-wrapper .drawer-dialog{left:0;transform:translateX(-100%)}:host(.drawer-bottom){align-items:flex-end}:host(.drawer-bottom) .road-drawer-wrapper .drawer-dialog{width:100%;max-height:var(--max-height);bottom:0;transform:translateY(100%)}:host(.drawer-bottom) .drawer-content{height:auto}.drawer-content{position:relative;display:flex;flex-direction:column;width:100%;height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;pointer-events:auto;background-color:var(--background);background-clip:padding-box;box-shadow:var(--road-elevation-hight)}.drawer-header{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;color:var(--header-color);background:var(--header-background);border-color:var(--road-grey-300);border-style:solid;border-width:var(--header-delimiter)}.drawer-header road-icon{flex-shrink:0;color:var(--header-icon)}.drawer-footer{padding:var(--road-spacing-05);background-color:var(--road-surface)}.drawer-footer.remove-padding{padding:0}.drawer-header-inverse{--header-icon:var(--road-on-primary);--header-color:var(--road-on-primary);--header-background:var(--road-primary-variant);margin-bottom:2.5rem}.drawer-action,.drawer-close{display:flex;align-items:center;justify-content:center;padding:0.5rem;font-family:inherit;font-size:0.875rem;color:inherit;cursor:pointer;background:transparent;border:0;appearance:none;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.drawer-header:not(.drawer-header-inverse) .drawer-action road-icon{color:var(--back-chevron-color)}.drawer-action~.drawer-title,.drawer-close~.drawer-title{padding-left:0}.drawer-action-left,.drawer-close-left{margin-right:auto}.drawer-title{display:flex;flex-grow:1;align-items:center;justify-content:center;padding-left:3.5rem;margin:0;font-size:var(--road-body-medium)}.drawer-body{overflow-y:auto;padding:0 var(--road-spacing-05) var(--road-spacing-05)}.drawer-body.remove-padding{padding:0}:host(.drawer-right) .drawer-body,:host(.drawer-left) .drawer-body{height:calc(100vh - 3.5rem)}.drawer-inner{padding:0 1rem 2.5rem}@media (min-width: 768px){.drawer-inner{padding:0 2rem 2.5rem}.drawer-body{padding:0 var(--road-spacing-08) var(--road-spacing-05)}.drawer-body.remove-padding{padding:0}.drawer-footer{padding:var(--road-spacing-05) var(--road-spacing-08)}.drawer-footer.remove-padding{padding:0}}:host(.drawer-open){visibility:visible !important;transition:visibility 0s linear 0s}:host(.drawer-open) .drawer-overlay,:host(.drawer-open) .drawer-dialog,:host(.drawer-open) .road-drawer-wrapper .drawer-dialog{opacity:1;transform:translateY(0) translateX(0)}@media (prefers-reduced-motion: no-preference){:host(.drawer-open) .drawer-overlay,:host(.drawer-open) .drawer-dialog{animation:road-drawer-fade-in 0.3s ease-out both}.drawer-overlay,.drawer-dialog{animation:road-drawer-fade-out 0.3s ease-out both}@keyframes road-drawer-fade-in{from{opacity:0}to{opacity:1}}@keyframes road-drawer-fade-out{from{opacity:1}to{opacity:0}}}";
|
|
1893
1931
|
const RoadDrawerStyle0 = drawerCss;
|
|
1894
1932
|
|
|
1895
1933
|
const Drawer = class {
|
|
@@ -1938,6 +1976,11 @@ const Drawer = class {
|
|
|
1938
1976
|
* Footer Content state
|
|
1939
1977
|
*/
|
|
1940
1978
|
this.hasFooterContent = false;
|
|
1979
|
+
/**
|
|
1980
|
+
* Used to ensure open transitions run when the drawer
|
|
1981
|
+
* is initially mounted with `isOpen=true`.
|
|
1982
|
+
*/
|
|
1983
|
+
this.hasMounted = false;
|
|
1941
1984
|
this.onFooterSlotChange = (event) => {
|
|
1942
1985
|
const slot = event.target;
|
|
1943
1986
|
this.hasFooterContent = slot.assignedElements().length > 0;
|
|
@@ -2034,18 +2077,19 @@ const Drawer = class {
|
|
|
2034
2077
|
}, 100); // Timeout is used to ensure the drawer has been rendered when client wants to update the property at the same time
|
|
2035
2078
|
}
|
|
2036
2079
|
handleOpen(openValue) {
|
|
2037
|
-
var _a;
|
|
2080
|
+
var _a, _b;
|
|
2081
|
+
const dialog = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.drawer-dialog');
|
|
2038
2082
|
if (openValue === true) {
|
|
2039
2083
|
this.onOpen.emit();
|
|
2040
|
-
|
|
2084
|
+
dialog === null || dialog === void 0 ? void 0 : dialog.addEventListener("transitionend", () => {
|
|
2041
2085
|
if (this.enabledFocusTrap) {
|
|
2042
2086
|
this.getOrCreateFocusTrap().activate();
|
|
2043
2087
|
}
|
|
2044
2088
|
}, { once: true });
|
|
2045
2089
|
}
|
|
2046
2090
|
else {
|
|
2047
|
-
(
|
|
2048
|
-
|
|
2091
|
+
(_b = this.focusTrap) === null || _b === void 0 ? void 0 : _b.deactivate();
|
|
2092
|
+
dialog === null || dialog === void 0 ? void 0 : dialog.addEventListener("transitionend", () => {
|
|
2049
2093
|
this.onClose.emit();
|
|
2050
2094
|
this.el.shadowRoot &&
|
|
2051
2095
|
(this.el.shadowRoot.querySelector(".drawer-body").scrollTop = 0);
|
|
@@ -2064,9 +2108,14 @@ const Drawer = class {
|
|
|
2064
2108
|
this.el.querySelectorAll('[data-dismiss="modal"]').forEach((item) => {
|
|
2065
2109
|
item.addEventListener("click", () => this.close());
|
|
2066
2110
|
});
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2111
|
+
// Wait for the first paint so the "closed" transform can be applied,
|
|
2112
|
+
// then open on the next frame to allow CSS transitions to run.
|
|
2113
|
+
requestAnimationFrame(() => {
|
|
2114
|
+
this.hasMounted = true;
|
|
2115
|
+
if (this.isOpen) {
|
|
2116
|
+
this.handleOpen(true);
|
|
2117
|
+
}
|
|
2118
|
+
});
|
|
2070
2119
|
}
|
|
2071
2120
|
getOrCreateFocusTrap(elements) {
|
|
2072
2121
|
var _a;
|
|
@@ -2096,7 +2145,8 @@ const Drawer = class {
|
|
|
2096
2145
|
}
|
|
2097
2146
|
render() {
|
|
2098
2147
|
var _a, _b, _c;
|
|
2099
|
-
const
|
|
2148
|
+
const isEffectivelyOpen = this.isOpen && this.hasMounted;
|
|
2149
|
+
const drawerIsOpenClass = isEffectivelyOpen ? "drawer-open" : "";
|
|
2100
2150
|
const removePaddingClass = this.removePadding ? "remove-padding" : "";
|
|
2101
2151
|
const inverseHeaderClass = this.hasInverseHeader
|
|
2102
2152
|
? "drawer-header-inverse"
|
|
@@ -2108,7 +2158,7 @@ const Drawer = class {
|
|
|
2108
2158
|
const backIconElement = this.hasBackIcon ? (h("button", { type: "button", class: "drawer-action", "aria-label": ariaLabelBack, onClick: this.onClickBack }, h("road-icon", { icon: navigationChevron, rotate: "180" }), this.backText)) : null;
|
|
2109
2159
|
const closeIconElement = this.hasCloseIcon ? (h("button", { type: "button", class: "drawer-close", onClick: this.onClick, "aria-label": ariaLabelClose }, h("road-icon", { icon: navigationClose, "aria-hidden": "true" }))) : null;
|
|
2110
2160
|
const drawerWidthValue = this.position === "bottom" ? "100%" : `${this.drawerWidth}px`;
|
|
2111
|
-
return (h(Host, { key: '
|
|
2161
|
+
return (h(Host, { key: 'ecd747ab4372bed7cefb4647dfaf9404c7206b53', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": ariaLabel }, h("div", { key: '1d5760b82a095696e30867669f607d5c3608c308', class: "road-drawer-wrapper" }, h("div", { key: '4d519361b71dd228e7a35a1ee20f741911e0752f', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), h("div", { key: '36dc3dac85b6784b66f5a12476be608d2b43c40c', class: "drawer-dialog", style: { maxWidth: drawerWidthValue }, role: "document" }, h("div", { key: '74a7d03928a6919fa6cd95c6a66a61c9bf225e20', class: "drawer-content" }, h("header", { key: 'f4c543d1ea08ee62ea3a9f93e34499a7f5c81fa5', class: `drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}` }, backIconElement, this.drawerTitle ? (h("h2", { class: "drawer-title" }, this.drawerTitle)) : (h("div", { class: "drawer-title" }, h("slot", { name: "title" }))), closeIconElement), h("div", { key: '796030c5a5cf6661aa4c1f4c10cc039e0e550d4c', class: `drawer-body ${removePaddingClass}` }, h("slot", { key: '8c0bdfa660ace789ea5a01ada7ce3cd9c5cc3d4a' })), h("footer", { key: 'a52a747ea4c5de885fc440ac4f8247f5c9ab88b0', class: `drawer-footer ${removePaddingClass}`, hidden: !this.hasFooterContent }, h("slot", { key: '0bef80d08a9e6078f025768eb88f93df86517fb9', name: "footer", onSlotchange: this.onFooterSlotChange })))))));
|
|
2112
2162
|
}
|
|
2113
2163
|
get el() { return getElement(this); }
|
|
2114
2164
|
static get watchers() { return {
|