@roadtrip/components 3.51.3 → 3.53.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.
Files changed (174) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/road-badge_14.cjs.entry.js +70 -14
  3. package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
  4. package/dist/cjs/road-card.cjs.entry.js +12 -2
  5. package/dist/cjs/road-card.cjs.entry.js.map +1 -1
  6. package/dist/cjs/road-segmented-button-bar.cjs.entry.js +1 -1
  7. package/dist/cjs/road-segmented-button.cjs.entry.js +4 -3
  8. package/dist/cjs/road-segmented-button.cjs.entry.js.map +1 -1
  9. package/dist/cjs/road-segmented-buttons.cjs.entry.js +1 -1
  10. package/dist/cjs/road-select-filter.cjs.entry.js +1 -1
  11. package/dist/cjs/road-select.cjs.entry.js +1 -1
  12. package/dist/cjs/road-skeleton.cjs.entry.js +1 -1
  13. package/dist/cjs/road-spinner.cjs.entry.js +1 -1
  14. package/dist/cjs/road-status-chip.cjs.entry.js +1 -1
  15. package/dist/cjs/road-switch.cjs.entry.js +2 -2
  16. package/dist/cjs/road-tab-bar.cjs.entry.js +2 -2
  17. package/dist/cjs/road-tab-button.cjs.entry.js +2 -2
  18. package/dist/cjs/road-tab.cjs.entry.js +2 -2
  19. package/dist/cjs/road-table.cjs.entry.js +1 -1
  20. package/dist/cjs/road-tabs.cjs.entry.js +1 -1
  21. package/dist/cjs/road-tag.cjs.entry.js +1 -1
  22. package/dist/cjs/road-text.cjs.entry.js +1 -1
  23. package/dist/cjs/road-textarea.cjs.entry.js +1 -1
  24. package/dist/cjs/road-time-range-picker.cjs.entry.js +1 -1
  25. package/dist/cjs/road-toast.cjs.entry.js +1 -1
  26. package/dist/cjs/road-toast.cjs.entry.js.map +1 -1
  27. package/dist/cjs/road-toggle.cjs.entry.js +2 -2
  28. package/dist/cjs/road-toolbar-title-page.cjs.entry.js +1 -1
  29. package/dist/cjs/road-toolbar-title.cjs.entry.js +1 -1
  30. package/dist/cjs/road-toolbar-v2.cjs.entry.js +1 -1
  31. package/dist/cjs/road-tooltip.cjs.entry.js +3 -3
  32. package/dist/cjs/roadtrip.cjs.js +1 -1
  33. package/dist/collection/components/badge/badge.css +9 -1
  34. package/dist/collection/components/badge/badge.js +1 -1
  35. package/dist/collection/components/badge/badge.stories.js +1 -1
  36. package/dist/collection/components/card/card.css +10 -0
  37. package/dist/collection/components/card/card.js +31 -1
  38. package/dist/collection/components/card/card.js.map +1 -1
  39. package/dist/collection/components/card/card.stories.js +16 -0
  40. package/dist/collection/components/drawer/drawer.css +41 -3
  41. package/dist/collection/components/drawer/drawer.js +113 -12
  42. package/dist/collection/components/drawer/drawer.js.map +1 -1
  43. package/dist/collection/components/icon/icon.js +1 -1
  44. package/dist/collection/components/segmented-button/segmented-button.css +14 -1
  45. package/dist/collection/components/segmented-button/segmented-button.js +24 -4
  46. package/dist/collection/components/segmented-button/segmented-button.js.map +1 -1
  47. package/dist/collection/components/segmented-button-bar/segmented-button-bar.js +1 -1
  48. package/dist/collection/components/segmented-buttons/segmented-buttons.js +1 -1
  49. package/dist/collection/components/segmented-buttons/segmented-buttons.stories.js +39 -0
  50. package/dist/collection/components/select/select.js +1 -1
  51. package/dist/collection/components/select-filter/select-filter.js +1 -1
  52. package/dist/collection/components/skeleton/skeleton.js +1 -1
  53. package/dist/collection/components/spinner/spinner.js +1 -1
  54. package/dist/collection/components/status-chip/status-chip.js +1 -1
  55. package/dist/collection/components/switch/switch.js +2 -2
  56. package/dist/collection/components/tab/tab.js +2 -2
  57. package/dist/collection/components/tab-bar/tab-bar.js +2 -2
  58. package/dist/collection/components/tab-button/tab-button.js +2 -2
  59. package/dist/collection/components/table/table.js +1 -1
  60. package/dist/collection/components/tabs/tabs.js +1 -1
  61. package/dist/collection/components/tag/tag.js +1 -1
  62. package/dist/collection/components/text/text.js +1 -1
  63. package/dist/collection/components/textarea/textarea.js +1 -1
  64. package/dist/collection/components/time-range-picker/time-range-picker.js +1 -1
  65. package/dist/collection/components/toast/toast.js +1 -1
  66. package/dist/collection/components/toast/toast.js.map +1 -1
  67. package/dist/collection/components/toggle/toggle.js +2 -2
  68. package/dist/collection/components/toolbar/toolbar.js +1 -1
  69. package/dist/collection/components/toolbar-title/toolbar-title.js +1 -1
  70. package/dist/collection/components/toolbar-title-page/toolbar-title-page.js +1 -1
  71. package/dist/collection/components/toolbar-v2/toolbar-v2.js +1 -1
  72. package/dist/collection/components/tooltip/tooltip.js +3 -3
  73. package/dist/esm/loader.js +1 -1
  74. package/dist/esm/road-badge_14.entry.js +70 -14
  75. package/dist/esm/road-badge_14.entry.js.map +1 -1
  76. package/dist/esm/road-card.entry.js +12 -2
  77. package/dist/esm/road-card.entry.js.map +1 -1
  78. package/dist/esm/road-segmented-button-bar.entry.js +1 -1
  79. package/dist/esm/road-segmented-button.entry.js +4 -3
  80. package/dist/esm/road-segmented-button.entry.js.map +1 -1
  81. package/dist/esm/road-segmented-buttons.entry.js +1 -1
  82. package/dist/esm/road-select-filter.entry.js +1 -1
  83. package/dist/esm/road-select.entry.js +1 -1
  84. package/dist/esm/road-skeleton.entry.js +1 -1
  85. package/dist/esm/road-spinner.entry.js +1 -1
  86. package/dist/esm/road-status-chip.entry.js +1 -1
  87. package/dist/esm/road-switch.entry.js +2 -2
  88. package/dist/esm/road-tab-bar.entry.js +2 -2
  89. package/dist/esm/road-tab-button.entry.js +2 -2
  90. package/dist/esm/road-tab.entry.js +2 -2
  91. package/dist/esm/road-table.entry.js +1 -1
  92. package/dist/esm/road-tabs.entry.js +1 -1
  93. package/dist/esm/road-tag.entry.js +1 -1
  94. package/dist/esm/road-text.entry.js +1 -1
  95. package/dist/esm/road-textarea.entry.js +1 -1
  96. package/dist/esm/road-time-range-picker.entry.js +1 -1
  97. package/dist/esm/road-toast.entry.js +1 -1
  98. package/dist/esm/road-toast.entry.js.map +1 -1
  99. package/dist/esm/road-toggle.entry.js +2 -2
  100. package/dist/esm/road-toolbar-title-page.entry.js +1 -1
  101. package/dist/esm/road-toolbar-title.entry.js +1 -1
  102. package/dist/esm/road-toolbar-v2.entry.js +1 -1
  103. package/dist/esm/road-tooltip.entry.js +3 -3
  104. package/dist/esm/roadtrip.js +1 -1
  105. package/dist/html.html-data.json +25 -0
  106. package/dist/roadtrip/{p-0c6ad72e.entry.js → p-19ff95e3.entry.js} +2 -2
  107. package/dist/roadtrip/{p-3dfa5636.entry.js → p-22de5cde.entry.js} +2 -2
  108. package/dist/roadtrip/{p-ac64606d.entry.js → p-2b2749da.entry.js} +2 -2
  109. package/dist/roadtrip/{p-ce281723.entry.js → p-319a0ef7.entry.js} +5 -5
  110. package/dist/roadtrip/p-319a0ef7.entry.js.map +1 -0
  111. package/dist/roadtrip/{p-9b1fa6a6.entry.js → p-320b58c5.entry.js} +2 -2
  112. package/dist/roadtrip/p-3444d6fe.entry.js +2 -0
  113. package/dist/roadtrip/p-3444d6fe.entry.js.map +1 -0
  114. package/dist/roadtrip/{p-4374d63f.entry.js → p-3646f072.entry.js} +2 -2
  115. package/dist/roadtrip/{p-4374d63f.entry.js.map → p-3646f072.entry.js.map} +1 -1
  116. package/dist/roadtrip/{p-335498ee.entry.js → p-368b36e3.entry.js} +2 -2
  117. package/dist/roadtrip/p-3d30fba4.entry.js +2 -0
  118. package/dist/roadtrip/{p-1f1021bc.entry.js → p-41aa8071.entry.js} +2 -2
  119. package/dist/roadtrip/p-41dbdb75.entry.js +2 -0
  120. package/dist/roadtrip/p-41dbdb75.entry.js.map +1 -0
  121. package/dist/roadtrip/{p-456f66fc.entry.js → p-54ccd027.entry.js} +2 -2
  122. package/dist/roadtrip/{p-187ab5f5.entry.js → p-579fce4c.entry.js} +2 -2
  123. package/dist/roadtrip/p-7563a0f9.entry.js +2 -0
  124. package/dist/roadtrip/{p-7aceed1a.entry.js.map → p-7563a0f9.entry.js.map} +1 -1
  125. package/dist/roadtrip/{p-dbb675a2.entry.js → p-77578033.entry.js} +2 -2
  126. package/dist/roadtrip/{p-543ef281.entry.js → p-93ffbb6e.entry.js} +2 -2
  127. package/dist/roadtrip/{p-6311f3f0.entry.js → p-9ecf3634.entry.js} +2 -2
  128. package/dist/roadtrip/{p-718c6406.entry.js → p-a25cdb1f.entry.js} +2 -2
  129. package/dist/roadtrip/{p-83f9db8d.entry.js → p-ae250ecf.entry.js} +2 -2
  130. package/dist/roadtrip/{p-3d4cd373.entry.js → p-ae53bc43.entry.js} +2 -2
  131. package/dist/roadtrip/{p-61190b12.entry.js → p-bfc2379c.entry.js} +2 -2
  132. package/dist/roadtrip/{p-da0a75ff.entry.js → p-c6206416.entry.js} +2 -2
  133. package/dist/roadtrip/{p-85e18b2f.entry.js → p-d42b2603.entry.js} +2 -2
  134. package/dist/roadtrip/{p-5381957c.entry.js → p-fb7caf90.entry.js} +2 -2
  135. package/dist/roadtrip/{p-d1de4eb6.entry.js → p-fba1b425.entry.js} +2 -2
  136. package/dist/roadtrip/{p-ceb904c0.entry.js → p-fc261f58.entry.js} +2 -2
  137. package/dist/roadtrip/roadtrip.esm.js +1 -1
  138. package/dist/roadtrip/roadtrip.esm.js.map +1 -1
  139. package/dist/types/components/card/card.d.ts +6 -0
  140. package/dist/types/components/drawer/drawer.d.ts +16 -0
  141. package/dist/types/components/segmented-button/segmented-button.d.ts +5 -1
  142. package/dist/types/components.d.ts +38 -2
  143. package/dist/types/interface.d.ts +1 -1
  144. package/hydrate/index.js +124 -52
  145. package/hydrate/index.mjs +124 -52
  146. package/package.json +1 -1
  147. package/dist/roadtrip/p-249b8592.entry.js +0 -2
  148. package/dist/roadtrip/p-4bbe3312.entry.js +0 -2
  149. package/dist/roadtrip/p-4bbe3312.entry.js.map +0 -1
  150. package/dist/roadtrip/p-7aceed1a.entry.js +0 -2
  151. package/dist/roadtrip/p-ce281723.entry.js.map +0 -1
  152. package/dist/roadtrip/p-f0d930e5.entry.js +0 -2
  153. package/dist/roadtrip/p-f0d930e5.entry.js.map +0 -1
  154. /package/dist/roadtrip/{p-0c6ad72e.entry.js.map → p-19ff95e3.entry.js.map} +0 -0
  155. /package/dist/roadtrip/{p-3dfa5636.entry.js.map → p-22de5cde.entry.js.map} +0 -0
  156. /package/dist/roadtrip/{p-ac64606d.entry.js.map → p-2b2749da.entry.js.map} +0 -0
  157. /package/dist/roadtrip/{p-9b1fa6a6.entry.js.map → p-320b58c5.entry.js.map} +0 -0
  158. /package/dist/roadtrip/{p-335498ee.entry.js.map → p-368b36e3.entry.js.map} +0 -0
  159. /package/dist/roadtrip/{p-249b8592.entry.js.map → p-3d30fba4.entry.js.map} +0 -0
  160. /package/dist/roadtrip/{p-1f1021bc.entry.js.map → p-41aa8071.entry.js.map} +0 -0
  161. /package/dist/roadtrip/{p-456f66fc.entry.js.map → p-54ccd027.entry.js.map} +0 -0
  162. /package/dist/roadtrip/{p-187ab5f5.entry.js.map → p-579fce4c.entry.js.map} +0 -0
  163. /package/dist/roadtrip/{p-dbb675a2.entry.js.map → p-77578033.entry.js.map} +0 -0
  164. /package/dist/roadtrip/{p-543ef281.entry.js.map → p-93ffbb6e.entry.js.map} +0 -0
  165. /package/dist/roadtrip/{p-6311f3f0.entry.js.map → p-9ecf3634.entry.js.map} +0 -0
  166. /package/dist/roadtrip/{p-718c6406.entry.js.map → p-a25cdb1f.entry.js.map} +0 -0
  167. /package/dist/roadtrip/{p-83f9db8d.entry.js.map → p-ae250ecf.entry.js.map} +0 -0
  168. /package/dist/roadtrip/{p-3d4cd373.entry.js.map → p-ae53bc43.entry.js.map} +0 -0
  169. /package/dist/roadtrip/{p-61190b12.entry.js.map → p-bfc2379c.entry.js.map} +0 -0
  170. /package/dist/roadtrip/{p-da0a75ff.entry.js.map → p-c6206416.entry.js.map} +0 -0
  171. /package/dist/roadtrip/{p-85e18b2f.entry.js.map → p-d42b2603.entry.js.map} +0 -0
  172. /package/dist/roadtrip/{p-5381957c.entry.js.map → p-fb7caf90.entry.js.map} +0 -0
  173. /package/dist/roadtrip/{p-d1de4eb6.entry.js.map → p-fba1b425.entry.js.map} +0 -0
  174. /package/dist/roadtrip/{p-ceb904c0.entry.js.map → p-fc261f58.entry.js.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import { navigationClose, navigationChevron } from "../../../icons";
3
3
  import { createFocusTrap } from "focus-trap";
4
+ import { tabbable } from "tabbable";
4
5
  /**
5
6
  * @slot - Content of the drawer.
6
7
  * @slot title - replace the title with a custom title section when `'drawerTitle'` is not set
@@ -44,10 +45,19 @@ export class Drawer {
44
45
  * Override focus trap
45
46
  */
46
47
  this.enabledFocusTrap = true;
48
+ /**
49
+ * whitelisted selectors
50
+ */
51
+ this.whitelistSelectors = [];
47
52
  /**
48
53
  * Footer Content state
49
54
  */
50
55
  this.hasFooterContent = false;
56
+ /**
57
+ * Used to ensure open transitions run when the drawer
58
+ * is initially mounted with `isOpen=true`.
59
+ */
60
+ this.hasMounted = false;
51
61
  this.onFooterSlotChange = (event) => {
52
62
  const slot = event.target;
53
63
  this.hasFooterContent = slot.assignedElements().length > 0;
@@ -100,6 +110,35 @@ export class Drawer {
100
110
  async back() {
101
111
  this.onBack.emit();
102
112
  }
113
+ /**
114
+ * Update the whitelist selectors at runtime and recreate the focus trap.
115
+ * Use this instead of updating the prop directly to ensure the change is detected,
116
+ * since Stencil compares arrays by reference.
117
+ */
118
+ async updateWhitelistSelectors(selectors) {
119
+ var _a;
120
+ this.whitelistSelectors = selectors;
121
+ const containers = [];
122
+ this.whitelistSelectors.forEach(selector => {
123
+ const el = document.querySelector(selector);
124
+ if (el)
125
+ containers.push(el);
126
+ });
127
+ const drawerContent = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".road-drawer-wrapper");
128
+ if (drawerContent)
129
+ containers.push(drawerContent);
130
+ this.resetFocusTrap(containers);
131
+ }
132
+ resetFocusTrap(elements) {
133
+ if (this.focusTrap) {
134
+ const isActive = this.focusTrap.active;
135
+ this.focusTrap.deactivate();
136
+ this.focusTrap = undefined;
137
+ if (isActive) {
138
+ this.getOrCreateFocusTrap(elements).activate();
139
+ }
140
+ }
141
+ }
103
142
  /**
104
143
  * Enable/disable focus trap so it can be overrided by the client in case of something appearing over the drawer like a modal for example
105
144
  */
@@ -115,18 +154,19 @@ export class Drawer {
115
154
  }, 100); // Timeout is used to ensure the drawer has been rendered when client wants to update the property at the same time
116
155
  }
117
156
  handleOpen(openValue) {
118
- var _a;
157
+ var _a, _b;
158
+ const dialog = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.drawer-dialog');
119
159
  if (openValue === true) {
120
160
  this.onOpen.emit();
121
- this.el.addEventListener("transitionend", () => {
161
+ dialog === null || dialog === void 0 ? void 0 : dialog.addEventListener("transitionend", () => {
122
162
  if (this.enabledFocusTrap) {
123
163
  this.getOrCreateFocusTrap().activate();
124
164
  }
125
165
  }, { once: true });
126
166
  }
127
167
  else {
128
- (_a = this.focusTrap) === null || _a === void 0 ? void 0 : _a.deactivate();
129
- this.el.addEventListener("transitionend", () => {
168
+ (_b = this.focusTrap) === null || _b === void 0 ? void 0 : _b.deactivate();
169
+ dialog === null || dialog === void 0 ? void 0 : dialog.addEventListener("transitionend", () => {
130
170
  this.onClose.emit();
131
171
  this.el.shadowRoot &&
132
172
  (this.el.shadowRoot.querySelector(".drawer-body").scrollTop = 0);
@@ -145,20 +185,36 @@ export class Drawer {
145
185
  this.el.querySelectorAll('[data-dismiss="modal"]').forEach((item) => {
146
186
  item.addEventListener("click", () => this.close());
147
187
  });
148
- if (this.isOpen) {
149
- this.handleOpen(true);
150
- }
188
+ // Wait for the first paint so the "closed" transform can be applied,
189
+ // then open on the next frame to allow CSS transitions to run.
190
+ requestAnimationFrame(() => {
191
+ this.hasMounted = true;
192
+ if (this.isOpen) {
193
+ this.handleOpen(true);
194
+ }
195
+ });
151
196
  }
152
- getOrCreateFocusTrap() {
197
+ getOrCreateFocusTrap(elements) {
153
198
  var _a;
154
199
  if (!this.focusTrap) {
155
200
  const drawerContent = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".road-drawer-wrapper");
156
- this.focusTrap = createFocusTrap(drawerContent, {
201
+ const elmt = (elements === null || elements === void 0 ? void 0 : elements.length) ? elements : [drawerContent];
202
+ this.focusTrap = createFocusTrap(elmt, {
203
+ initialFocus: () => {
204
+ if (!elmt.length)
205
+ return undefined;
206
+ const allTabbables = tabbable(elmt[0], { getShadowRoot: true });
207
+ return allTabbables[0];
208
+ },
157
209
  onActivate: () => drawerContent === null || drawerContent === void 0 ? void 0 : drawerContent.classList.add("focus-trapped"),
158
210
  onDeactivate: () => drawerContent === null || drawerContent === void 0 ? void 0 : drawerContent.classList.remove("focus-trapped"),
211
+ allowOutsideClick: (event) => {
212
+ return this.whitelistSelectors.some(s => event.target.closest(s));
213
+ },
159
214
  tabbableOptions: {
160
215
  getShadowRoot: true,
161
216
  },
217
+ fallbackFocus: this.el,
162
218
  preventScroll: true,
163
219
  });
164
220
  }
@@ -166,7 +222,8 @@ export class Drawer {
166
222
  }
167
223
  render() {
168
224
  var _a, _b, _c;
169
- const drawerIsOpenClass = this.isOpen ? "drawer-open" : "";
225
+ const isEffectivelyOpen = this.isOpen && this.hasMounted;
226
+ const drawerIsOpenClass = isEffectivelyOpen ? "drawer-open" : "";
170
227
  const removePaddingClass = this.removePadding ? "remove-padding" : "";
171
228
  const inverseHeaderClass = this.hasInverseHeader
172
229
  ? "drawer-header-inverse"
@@ -178,7 +235,7 @@ export class Drawer {
178
235
  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;
179
236
  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;
180
237
  const drawerWidthValue = this.position === "bottom" ? "100%" : `${this.drawerWidth}px`;
181
- return (h(Host, { key: 'f3f7bb36db4476325b4e7a879a739529bc79d964', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": ariaLabel }, h("div", { key: '407cd4cc74d0f94f43cb306e8e7c819b771493dd', class: "road-drawer-wrapper" }, h("div", { key: '2f09ca1bfff5bf81ed94a277910dbb6017d0b984', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), h("div", { key: 'ae71f5011512dd1dd2a3cdd69b7ca6c8838b787f', class: "drawer-dialog", style: { maxWidth: drawerWidthValue }, role: "document" }, h("div", { key: '94cf3ed5d1a5e62cf15ec3a20a6bb786a240d61a', class: "drawer-content" }, h("header", { key: '58c9716838a98d57a0f147aed96c7b06d98ac9cf', 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: '5d97f008d5514de90fac3c7d6c517882216aee00', class: `drawer-body ${removePaddingClass}` }, h("slot", { key: '53a401cd8b6295017d4903e7626d2ab643ad8b26' })), h("footer", { key: 'e1c65d15af977b46484d35c6b93def36c3523fdb', class: `drawer-footer ${removePaddingClass}`, hidden: !this.hasFooterContent }, h("slot", { key: 'c7b7694a70fb98a9057d5292acbf6bdda42267c5', name: "footer", onSlotchange: this.onFooterSlotChange })))))));
238
+ 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 })))))));
182
239
  }
183
240
  static get is() { return "road-drawer"; }
184
241
  static get encapsulation() { return "shadow"; }
@@ -448,13 +505,32 @@ export class Drawer {
448
505
  "attribute": "enabled-focus-trap",
449
506
  "reflect": false,
450
507
  "defaultValue": "true"
508
+ },
509
+ "whitelistSelectors": {
510
+ "type": "unknown",
511
+ "mutable": true,
512
+ "complexType": {
513
+ "original": "string[]",
514
+ "resolved": "string[]",
515
+ "references": {}
516
+ },
517
+ "required": false,
518
+ "optional": false,
519
+ "docs": {
520
+ "tags": [],
521
+ "text": "whitelisted selectors"
522
+ },
523
+ "getter": false,
524
+ "setter": false,
525
+ "defaultValue": "[]"
451
526
  }
452
527
  };
453
528
  }
454
529
  static get states() {
455
530
  return {
456
531
  "focusTrap": {},
457
- "hasFooterContent": {}
532
+ "hasFooterContent": {},
533
+ "hasMounted": {}
458
534
  };
459
535
  }
460
536
  static get events() {
@@ -557,6 +633,31 @@ export class Drawer {
557
633
  "text": "Return to previous state of the drawer content",
558
634
  "tags": []
559
635
  }
636
+ },
637
+ "updateWhitelistSelectors": {
638
+ "complexType": {
639
+ "signature": "(selectors: string[]) => Promise<void>",
640
+ "parameters": [{
641
+ "name": "selectors",
642
+ "type": "string[]",
643
+ "docs": ""
644
+ }],
645
+ "references": {
646
+ "Promise": {
647
+ "location": "global",
648
+ "id": "global::Promise"
649
+ },
650
+ "HTMLElement": {
651
+ "location": "global",
652
+ "id": "global::HTMLElement"
653
+ }
654
+ },
655
+ "return": "Promise<void>"
656
+ },
657
+ "docs": {
658
+ "text": "Update the whitelist selectors at runtime and recreate the focus trap.\nUse this instead of updating the prop directly to ensure the change is detected,\nsince Stencil compares arrays by reference.",
659
+ "tags": []
660
+ }
560
661
  }
561
662
  };
562
663
  }
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AAExD;;;;;;;;GAQG;AAOH,MAAM,OAAO,MAAM;IALnB;QAWE;;WAEG;QACsB,WAAM,GAAY,KAAK,CAAC;QAEjD;;WAEG;QACsB,kBAAa,GAAY,KAAK,CAAC;QAExD;;WAEG;QACK,aAAQ,GAAW,MAAM,CAAC;QAElC;;WAEG;QACK,gBAAW,GAAW,GAAG,CAAC;QAElC;;WAEG;QACK,qBAAgB,GAAY,KAAK,CAAC;QAE1C;;WAEG;QACK,gBAAW,GAAY,KAAK,CAAC;QA2BrC;;WAEG;QACK,iBAAY,GAAY,IAAI,CAAC;QAErC;;WAEG;QACK,qBAAgB,GAAY,IAAI,CAAC;QAsBzC;;WAEG;QACM,qBAAgB,GAAG,KAAK,CAAC;QAmE1B,uBAAkB,GAAG,CAAC,KAAY,EAAE,EAAE;YA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BACzB,+DACE,KAAK,EAAE,iBAAiB,kBAAkB,IAAI,oBAAoB,EAAE;4BAEnE,eAAe;4BACf,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAClB,UAAI,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAM,CACjD,CAAC,CAAC,CAAC,CACF,WAAK,KAAK,EAAC,cAAc;gCACvB,YAAM,IAAI,EAAC,OAAO,GAAG,CACjB,CACP;4BACA,gBAAgB,CACV;wBACT,4DAAK,KAAK,EAAE,eAAe,kBAAkB,EAAE;4BAC7C,8DAAQ,CACJ;wBACN,+DACE,KAAK,EAAE,iBAAiB,kBAAkB,EAAE,EAC5C,MAAM,EAAE,CAAC,IAAI,CAAC,gBAAgB;4BAE9B,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,kBAAkB,GAAI,CACtD,CACL,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Listen,\n Method,\n Prop,\n h,\n Host,\n Watch,\n State,\n} from \"@stencil/core\";\nimport { navigationClose, navigationChevron } from \"../../../icons\";\nimport { createFocusTrap, FocusTrap } from \"focus-trap\";\n\n/**\n * @slot - Content of the drawer.\n * @slot title - replace the title with a custom title section when `'drawerTitle'` is not set\n * @slot footer - footer of the drawer\n * `<div slot=\"footer\">`\n `<road-button color=\"primary\" outline=\"true\" expand=\"true\">Annuler</road-button>`\n `<road-button color=\"primary\" expand=\"true\" class=\"mb-0\">Valider</road-button>`\n ` </div>`\n */\n\n@Component({\n tag: \"road-drawer\",\n styleUrl: \"drawer.css\",\n shadow: true,\n})\nexport class Drawer {\n /**\n * Current reference of the drawer\n */\n @Element() el!: HTMLRoadDrawerElement;\n\n /**\n * Set isOpen property to true to open the drawer\n */\n @Prop({ mutable: true }) isOpen: boolean = false;\n\n /**\n * Set removePadding property to true to remove padding for drawer body\n */\n @Prop({ mutable: true }) removePadding: boolean = false;\n\n /**\n * position of the drawer. e.g. left, right, bottom\n */\n @Prop() position: string = \"left\";\n\n /**\n * Width of the drawer\n */\n @Prop() drawerWidth: number = 480;\n\n /**\n * Inverse header colors\n */\n @Prop() hasInverseHeader: boolean = false;\n\n /**\n * Show / hide back icon\n */\n @Prop() hasBackIcon: boolean = false;\n\n /**\n * Show / hide back icon\n */\n @Prop() backText?: string;\n\n /**\n * Title of the drawer in the header bar\n */\n @Prop() drawerTitle?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabel?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabelBack?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabelClose?: string;\n\n /**\n * Show / hide close icon\n */\n @Prop() hasCloseIcon: boolean = true;\n\n /**\n * Override focus trap\n */\n @Prop() enabledFocusTrap: boolean = true;\n\n /**\n * Indicate when opening the drawer\n */\n @Event({ eventName: \"open\" }) onOpen!: EventEmitter<void>;\n\n /**\n * Indicate when closing the drawer\n */\n @Event({ eventName: \"close\" }) onClose!: EventEmitter<void>;\n\n /**\n * Indicate when return to previous state of the drawer content\n */\n @Event({ eventName: \"back\" }) onBack!: EventEmitter<void>;\n\n /**\n * Focus trap state\n */\n @State() focusTrap?: FocusTrap;\n\n /**\n * Footer Content state\n */\n @State() hasFooterContent = false;\n\n /**\n * Open the drawer\n */\n @Method()\n async open() {\n this.isOpen = true;\n }\n\n /**\n * Close the drawer\n */\n @Method()\n async close() {\n this.isOpen = false;\n }\n\n /**\n * Return to previous state of the drawer content\n */\n @Method()\n async back() {\n this.onBack.emit();\n }\n\n /**\n * Enable/disable focus trap so it can be overrided by the client in case of something appearing over the drawer like a modal for example\n */\n @Watch(\"enabledFocusTrap\")\n handleFocusTrapProp(value: boolean) {\n setTimeout(() => {\n if (value) {\n this.focusTrap?.unpause();\n } else {\n this.focusTrap?.pause();\n }\n }, 100); // Timeout is used to ensure the drawer has been rendered when client wants to update the property at the same time\n }\n\n@Watch(\"isOpen\")\nhandleOpen(openValue: boolean) {\n if (openValue === true) {\n this.onOpen.emit();\n this.el.addEventListener(\n \"transitionend\",\n () => {\n if (this.enabledFocusTrap) {\n this.getOrCreateFocusTrap().activate();\n }\n },\n { once: true },\n );\n } else {\n this.focusTrap?.deactivate();\n this.el.addEventListener(\n \"transitionend\",\n () => {\n this.onClose.emit();\n this.el.shadowRoot &&\n ((this.el.shadowRoot.querySelector(\".drawer-body\") as HTMLElement).scrollTop = 0);\n },\n { once: true },\n );\n }\n}\n\n private onFooterSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n this.hasFooterContent = slot.assignedElements().length > 0;\n };\n\n /**\n * Find and focus the first element in the drawer\n */\n /**\n * Find and focus the first element in the drawer\n */\n // private focusFirstElement() {\n // const firstElement = this.el.shadowRoot?.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], [tabindex]:not([tabindex=\"-1\"])')[0] as HTMLElement;\n //\n // if (firstElement) {\n // firstElement.focus();\n // }\n // }\n\n /**\n * Close the dialog when clicking on the cross or layer\n */\n private onClick = (ev: UIEvent) => {\n ev.stopPropagation();\n ev.preventDefault();\n\n this.close();\n };\n\n /**\n * Close the dialog when clicking on the cross or layer\n */\n private onClickBack = (event: MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n this.back();\n };\n\n /**\n * Close the dialog when press Escape key\n */\n @Listen(\"keyup\", { target: \"document\" })\n onEscape(event: KeyboardEvent) {\n if (event.key === \"Escape\" || event.key === \"Esc\") {\n this.close();\n }\n }\n\n componentDidLoad() {\n this.el.querySelectorAll('[data-dismiss=\"modal\"]').forEach((item) => {\n item.addEventListener(\"click\", () => this.close());\n });\n\n if (this.isOpen) {\n this.handleOpen(true);\n }\n}\n\nprivate getOrCreateFocusTrap(): FocusTrap {\n if (!this.focusTrap) {\n const drawerContent = this.el.shadowRoot?.querySelector(\".road-drawer-wrapper\");\n this.focusTrap = createFocusTrap(drawerContent as HTMLElement, {\n onActivate: () => drawerContent?.classList.add(\"focus-trapped\"),\n onDeactivate: () => drawerContent?.classList.remove(\"focus-trapped\"),\n tabbableOptions: {\n getShadowRoot: true,\n },\n preventScroll: true,\n });\n }\n return this.focusTrap;\n}\n\n render() {\n const drawerIsOpenClass = this.isOpen ? \"drawer-open\" : \"\";\n const removePaddingClass = this.removePadding ? \"remove-padding\" : \"\";\n const inverseHeaderClass = this.hasInverseHeader\n ? \"drawer-header-inverse\"\n : \"\";\n const ariaLabel = this.ariaLabel ?? \"drawer\";\n const ariaLabelBack = this.ariaLabelBack ?? \"Back\";\n const ariaLabelClose = this.ariaLabelClose ?? \"Close\";\n const drawerDelimiterClass =\n this.drawerTitle && !this.hasInverseHeader ? \"drawer-delimiter\" : \"\";\n const backIconElement = this.hasBackIcon ? (\n <button\n type=\"button\"\n class=\"drawer-action\"\n aria-label={ariaLabelBack}\n onClick={this.onClickBack}\n >\n <road-icon icon={navigationChevron} rotate=\"180\"></road-icon>\n {this.backText}\n </button>\n ) : null;\n const closeIconElement = this.hasCloseIcon ? (\n <button\n type=\"button\"\n class=\"drawer-close\"\n onClick={this.onClick}\n aria-label={ariaLabelClose}\n >\n <road-icon icon={navigationClose} aria-hidden=\"true\"></road-icon>\n </button>\n ) : null;\n const drawerWidthValue =\n this.position === \"bottom\" ? \"100%\" : `${this.drawerWidth}px`;\n\n return (\n <Host\n class={`${drawerIsOpenClass} drawer-${this.position}`}\n tabindex=\"0\"\n role=\"dialog\"\n aria-label={ariaLabel}\n >\n <div class=\"road-drawer-wrapper\">\n <div\n class=\"drawer-overlay\"\n onClick={this.onClick}\n tabindex=\"-1\"\n ></div>\n <div\n class=\"drawer-dialog\"\n style={{ maxWidth: drawerWidthValue }}\n role=\"document\"\n >\n <div class=\"drawer-content\">\n <header\n class={`drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}`}\n >\n {backIconElement}\n {this.drawerTitle ? (\n <h2 class=\"drawer-title\">{this.drawerTitle}</h2>\n ) : (\n <div class=\"drawer-title\">\n <slot name=\"title\" />\n </div>\n )}\n {closeIconElement}\n </header>\n <div class={`drawer-body ${removePaddingClass}`}>\n <slot />\n </div>\n <footer\n class={`drawer-footer ${removePaddingClass}`}\n hidden={!this.hasFooterContent}\n >\n <slot name=\"footer\" onSlotchange={this.onFooterSlotChange} />\n </footer>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;;;;GAQG;AAOH,MAAM,OAAO,MAAM;IALnB;QAWE;;WAEG;QACsB,WAAM,GAAY,KAAK,CAAC;QAEjD;;WAEG;QACsB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nE,eAAe;4BACf,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAClB,UAAI,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAM,CACjD,CAAC,CAAC,CAAC,CACF,WAAK,KAAK,EAAC,cAAc;gCACvB,YAAM,IAAI,EAAC,OAAO,GAAG,CACjB,CACP;4BACA,gBAAgB,CACV;wBACT,4DAAK,KAAK,EAAE,eAAe,kBAAkB,EAAE;4BAC7C,8DAAQ,CACJ;wBACN,+DACE,KAAK,EAAE,iBAAiB,kBAAkB,EAAE,EAC5C,MAAM,EAAE,CAAC,IAAI,CAAC,gBAAgB;4BAE9B,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,kBAAkB,GAAI,CACtD,CACL,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Listen,\n Method,\n Prop,\n h,\n Host,\n Watch,\n State,\n} from \"@stencil/core\";\nimport { navigationClose, navigationChevron } from \"../../../icons\";\nimport { createFocusTrap, FocusTrap } from \"focus-trap\";\nimport { tabbable } from 'tabbable';\n\n/**\n * @slot - Content of the drawer.\n * @slot title - replace the title with a custom title section when `'drawerTitle'` is not set\n * @slot footer - footer of the drawer\n * `<div slot=\"footer\">`\n `<road-button color=\"primary\" outline=\"true\" expand=\"true\">Annuler</road-button>`\n `<road-button color=\"primary\" expand=\"true\" class=\"mb-0\">Valider</road-button>`\n ` </div>`\n */\n\n@Component({\n tag: \"road-drawer\",\n styleUrl: \"drawer.css\",\n shadow: true,\n})\nexport class Drawer {\n /**\n * Current reference of the drawer\n */\n @Element() el!: HTMLRoadDrawerElement;\n\n /**\n * Set isOpen property to true to open the drawer\n */\n @Prop({ mutable: true }) isOpen: boolean = false;\n\n /**\n * Set removePadding property to true to remove padding for drawer body\n */\n @Prop({ mutable: true }) removePadding: boolean = false;\n\n /**\n * position of the drawer. e.g. left, right, bottom\n */\n @Prop() position: string = \"left\";\n\n /**\n * Width of the drawer\n */\n @Prop() drawerWidth: number = 480;\n\n /**\n * Inverse header colors\n */\n @Prop() hasInverseHeader: boolean = false;\n\n /**\n * Show / hide back icon\n */\n @Prop() hasBackIcon: boolean = false;\n\n /**\n * Show / hide back icon\n */\n @Prop() backText?: string;\n\n /**\n * Title of the drawer in the header bar\n */\n @Prop() drawerTitle?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabel?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabelBack?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabelClose?: string;\n\n /**\n * Show / hide close icon\n */\n @Prop() hasCloseIcon: boolean = true;\n\n /**\n * Override focus trap\n */\n @Prop() enabledFocusTrap: boolean = true;\n\n /**\n * whitelisted selectors\n */\n @Prop({ mutable: true }) whitelistSelectors: string[] = [];\n\n /**\n * Indicate when opening the drawer\n */\n @Event({ eventName: \"open\" }) onOpen!: EventEmitter<void>;\n\n /**\n * Indicate when closing the drawer\n */\n @Event({ eventName: \"close\" }) onClose!: EventEmitter<void>;\n\n /**\n * Indicate when return to previous state of the drawer content\n */\n @Event({ eventName: \"back\" }) onBack!: EventEmitter<void>;\n\n /**\n * Focus trap state\n */\n @State() focusTrap?: FocusTrap;\n\n /**\n * Footer Content state\n */\n @State() hasFooterContent = false;\n\n /**\n * Used to ensure open transitions run when the drawer\n * is initially mounted with `isOpen=true`.\n */\n @State() hasMounted = false;\n\n /**\n * Open the drawer\n */\n @Method()\n async open() {\n this.isOpen = true;\n }\n\n /**\n * Close the drawer\n */\n @Method()\n async close() {\n this.isOpen = false;\n }\n\n /**\n * Return to previous state of the drawer content\n */\n @Method()\n async back() {\n this.onBack.emit();\n }\n\n /**\n * Update the whitelist selectors at runtime and recreate the focus trap.\n * Use this instead of updating the prop directly to ensure the change is detected,\n * since Stencil compares arrays by reference.\n */\n @Method()\n async updateWhitelistSelectors(selectors: string[]) {\n this.whitelistSelectors = selectors;\n const containers: HTMLElement[] = [];\n\n this.whitelistSelectors.forEach(selector => {\n const el = document.querySelector(selector);\n if (el) containers.push(el as HTMLElement);\n });\n\n const drawerContent = this.el.shadowRoot?.querySelector(\".road-drawer-wrapper\");\n if (drawerContent) containers.push(drawerContent as HTMLElement);\n\n this.resetFocusTrap(containers);\n }\n\n resetFocusTrap(elements?: HTMLElement[]) {\n if (this.focusTrap) {\n const isActive = this.focusTrap.active;\n this.focusTrap.deactivate();\n this.focusTrap = undefined;\n if (isActive) {\n this.getOrCreateFocusTrap(elements).activate();\n }\n }\n }\n\n /**\n * Enable/disable focus trap so it can be overrided by the client in case of something appearing over the drawer like a modal for example\n */\n @Watch(\"enabledFocusTrap\")\n handleFocusTrapProp(value: boolean) {\n setTimeout(() => {\n if (value) {\n this.focusTrap?.unpause();\n } else {\n this.focusTrap?.pause();\n }\n }, 100); // Timeout is used to ensure the drawer has been rendered when client wants to update the property at the same time\n }\n\n @Watch(\"isOpen\")\n handleOpen(openValue: boolean) {\n const dialog = this.el.shadowRoot?.querySelector('.drawer-dialog')\n\n if (openValue === true) {\n this.onOpen.emit();\n dialog?.addEventListener(\n \"transitionend\",\n () => {\n if (this.enabledFocusTrap) {\n this.getOrCreateFocusTrap().activate();\n }\n },\n { once: true },\n );\n } else {\n this.focusTrap?.deactivate();\n dialog?.addEventListener(\n \"transitionend\",\n () => {\n this.onClose.emit();\n this.el.shadowRoot &&\n ((this.el.shadowRoot.querySelector(\".drawer-body\") as HTMLElement).scrollTop = 0);\n },\n { once: true },\n );\n }\n }\n\n private onFooterSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n this.hasFooterContent = slot.assignedElements().length > 0;\n };\n\n /**\n * Find and focus the first element in the drawer\n */\n /**\n * Find and focus the first element in the drawer\n */\n // private focusFirstElement() {\n // const firstElement = this.el.shadowRoot?.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], [tabindex]:not([tabindex=\"-1\"])')[0] as HTMLElement;\n //\n // if (firstElement) {\n // firstElement.focus();\n // }\n // }\n\n /**\n * Close the dialog when clicking on the cross or layer\n */\n private onClick = (ev: UIEvent) => {\n ev.stopPropagation();\n ev.preventDefault();\n\n this.close();\n };\n\n /**\n * Close the dialog when clicking on the cross or layer\n */\n private onClickBack = (event: MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n this.back();\n };\n\n /**\n * Close the dialog when press Escape key\n */\n @Listen(\"keyup\", { target: \"document\" })\n onEscape(event: KeyboardEvent) {\n if (event.key === \"Escape\" || event.key === \"Esc\") {\n this.close();\n }\n }\n\n componentDidLoad() {\n this.el.querySelectorAll('[data-dismiss=\"modal\"]').forEach((item) => {\n item.addEventListener(\"click\", () => this.close());\n });\n\n // Wait for the first paint so the \"closed\" transform can be applied,\n // then open on the next frame to allow CSS transitions to run.\n requestAnimationFrame(() => {\n this.hasMounted = true;\n if (this.isOpen) {\n this.handleOpen(true);\n }\n });\n}\n\nprivate getOrCreateFocusTrap(elements?: HTMLElement[]): FocusTrap {\n if (!this.focusTrap) {\n const drawerContent = this.el.shadowRoot?.querySelector(\".road-drawer-wrapper\");\n const elmt = elements?.length ? elements : [drawerContent];\n this.focusTrap = createFocusTrap(elmt as HTMLElement[], {\n initialFocus: () => {\n if (!elmt.length) return undefined;\n\n const allTabbables = tabbable(elmt[0]!, { getShadowRoot: true });\n return allTabbables[0];\n },\n onActivate: () => drawerContent?.classList.add(\"focus-trapped\"),\n onDeactivate: () => drawerContent?.classList.remove(\"focus-trapped\"),\n allowOutsideClick: (event) => {\n return this.whitelistSelectors.some(s => (event.target as HTMLElement).closest(s));\n },\n tabbableOptions: {\n getShadowRoot: true,\n },\n fallbackFocus: this.el as HTMLElement,\n preventScroll: true,\n });\n }\n return this.focusTrap;\n}\n\n render() {\n const isEffectivelyOpen = this.isOpen && this.hasMounted;\n const drawerIsOpenClass = isEffectivelyOpen ? \"drawer-open\" : \"\";\n const removePaddingClass = this.removePadding ? \"remove-padding\" : \"\";\n const inverseHeaderClass = this.hasInverseHeader\n ? \"drawer-header-inverse\"\n : \"\";\n const ariaLabel = this.ariaLabel ?? \"drawer\";\n const ariaLabelBack = this.ariaLabelBack ?? \"Back\";\n const ariaLabelClose = this.ariaLabelClose ?? \"Close\";\n const drawerDelimiterClass =\n this.drawerTitle && !this.hasInverseHeader ? \"drawer-delimiter\" : \"\";\n const backIconElement = this.hasBackIcon ? (\n <button\n type=\"button\"\n class=\"drawer-action\"\n aria-label={ariaLabelBack}\n onClick={this.onClickBack}\n >\n <road-icon icon={navigationChevron} rotate=\"180\"></road-icon>\n {this.backText}\n </button>\n ) : null;\n const closeIconElement = this.hasCloseIcon ? (\n <button\n type=\"button\"\n class=\"drawer-close\"\n onClick={this.onClick}\n aria-label={ariaLabelClose}\n >\n <road-icon icon={navigationClose} aria-hidden=\"true\"></road-icon>\n </button>\n ) : null;\n const drawerWidthValue =\n this.position === \"bottom\" ? \"100%\" : `${this.drawerWidth}px`;\n\n return (\n <Host\n class={`${drawerIsOpenClass} drawer-${this.position}`}\n tabindex=\"0\"\n role=\"dialog\"\n aria-label={ariaLabel}\n >\n <div class=\"road-drawer-wrapper\">\n <div\n class=\"drawer-overlay\"\n onClick={this.onClick}\n tabindex=\"-1\"\n ></div>\n <div\n class=\"drawer-dialog\"\n style={{ maxWidth: drawerWidthValue }}\n role=\"document\"\n >\n <div class=\"drawer-content\">\n <header\n class={`drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}`}\n >\n {backIconElement}\n {this.drawerTitle ? (\n <h2 class=\"drawer-title\">{this.drawerTitle}</h2>\n ) : (\n <div class=\"drawer-title\">\n <slot name=\"title\" />\n </div>\n )}\n {closeIconElement}\n </header>\n <div class={`drawer-body ${removePaddingClass}`}>\n <slot />\n </div>\n <footer\n class={`drawer-footer ${removePaddingClass}`}\n hidden={!this.hasFooterContent}\n >\n <slot name=\"footer\" onSlotchange={this.onFooterSlotChange} />\n </footer>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -103,7 +103,7 @@ export class Icon {
103
103
  "mutable": false,
104
104
  "complexType": {
105
105
  "original": "Color | 'white'",
106
- "resolved": "\"accent\" | \"danger\" | \"default\" | \"info\" | \"primary\" | \"secondary\" | \"success\" | \"warning\" | \"white\" | undefined",
106
+ "resolved": "\"accent\" | \"danger\" | \"default\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\" | \"white\" | undefined",
107
107
  "references": {
108
108
  "Color": {
109
109
  "location": "import",
@@ -17,7 +17,7 @@
17
17
  flex: 1;
18
18
  align-items: center;
19
19
  justify-content: center;
20
- max-height: 2.75rem;
20
+ max-height: 3rem;
21
21
  font-size: var(--road-button-medium);
22
22
  font-weight: 700;
23
23
  color: var(--road-on-surface-weak);
@@ -51,6 +51,14 @@
51
51
  height: 2.75rem;
52
52
  }
53
53
 
54
+ /**
55
+ * medium
56
+ */
57
+
58
+ :host(.btn-lg) {
59
+ height: 3rem;
60
+ }
61
+
54
62
  /**
55
63
  * Active state
56
64
  */
@@ -136,5 +144,10 @@
136
144
  text-overflow: ellipsis;
137
145
  white-space: nowrap;
138
146
  min-width: 0;
147
+ display: flex;
148
+ align-items: center;
149
+ }
150
+ .button-content-badge{
151
+ margin-left: var(--road-spacing-03);
139
152
  }
140
153
 
@@ -52,10 +52,11 @@ export class SegmentedButton {
52
52
  render() {
53
53
  const { tabIndex, selected, tab } = this;
54
54
  const sizeClass = this.size !== undefined ? `btn-${this.size}` : '';
55
- return (h(Host, { key: '20194d71e8ca1c839c4a6287511fcb9ad1318e67', onClick: this.onClick, onKeyup: this.onKeyUp, role: "tab", tabindex: tabIndex, "aria-selected": selected ? 'true' : null, id: tab !== undefined ? `tab-button-${tab}` : null, class: {
55
+ return (h(Host, { key: 'c32084087edad1374074d06d73fe718361396247', onClick: this.onClick, onKeyup: this.onKeyUp, role: "tab", tabindex: tabIndex, "aria-selected": selected ? 'true' : null, id: tab !== undefined ? `tab-button-${tab}` : null, class: {
56
56
  'tab-selected': selected,
57
57
  [`${sizeClass}`]: true,
58
- } }, h("span", { key: 'cf51481805c04571bc3ef97a150b011bd8c0e79e', tabIndex: -1, class: "button-native", part: "native", "aria-hidden": "true" }, h("span", { key: '595aae2ef9621aa6a39ef2388373ec3708972bbb', class: "button-content" }, h("slot", { key: '9b6e874b79e88265b6c56465e9f84a5849363016' })))));
58
+ } }, h("span", { key: '55c39f3b6508f33537a0d0e243bc61a700d5c533', tabIndex: -1, class: "button-native", part: "native", "aria-hidden": "true" }, h("span", { key: 'fa599539a08ff52bbfe0c479e809926aecabc85a', class: "button-content" }, h("slot", { key: '044b41c9a2217d62aa30f4221d4a5670105e7bd5' }), this.badge &&
59
+ h("road-badge", { key: '35a10d98aa0149976dcb21c4f7cb546753ed933f', color: this.selected ? 'primary' : 'neutral', class: "button-content-badge" }, this.badge)))));
59
60
  }
60
61
  static get is() { return "road-segmented-button"; }
61
62
  static get encapsulation() { return "shadow"; }
@@ -75,8 +76,8 @@ export class SegmentedButton {
75
76
  "type": "string",
76
77
  "mutable": false,
77
78
  "complexType": {
78
- "original": "'sm' | 'md'",
79
- "resolved": "\"md\" | \"sm\" | undefined",
79
+ "original": "'sm' | 'md' | 'lg'",
80
+ "resolved": "\"lg\" | \"md\" | \"sm\" | undefined",
80
81
  "references": {}
81
82
  },
82
83
  "required": false,
@@ -129,6 +130,25 @@ export class SegmentedButton {
129
130
  "setter": false,
130
131
  "attribute": "tab",
131
132
  "reflect": false
133
+ },
134
+ "badge": {
135
+ "type": "string",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "string",
139
+ "resolved": "string | undefined",
140
+ "references": {}
141
+ },
142
+ "required": false,
143
+ "optional": true,
144
+ "docs": {
145
+ "tags": [],
146
+ "text": "A badge can be added to the segmented button by providing a string value to this property."
147
+ },
148
+ "getter": false,
149
+ "setter": false,
150
+ "attribute": "badge",
151
+ "reflect": false
132
152
  }
133
153
  };
134
154
  }
@@ -1 +1 @@
1
- {"version":3,"file":"segmented-button.js","sourceRoot":"","sources":["../../../src/components/segmented-button/segmented-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE/F;;;GAGG;AAOH,MAAM,OAAO,eAAe;IAL5B;QASE;;YAEI;QACK,SAAI,GAAiB,IAAI,CAAC;QAEnC;;WAEG;QACsB,aAAQ,GAAG,KAAK,CAAC;QAmDlC,YAAO,GAAG,CAAC,EAAiB,EAAE,EAAE;YACtC,IAAI,EAAE,CAAC,GAAG,KAAK,OAAO,IAAI,EAAE,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gBACzC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CAAC;QAEM,YAAO,GAAG,CAAC,EAAS,EAAE,EAAE;YAC9B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,CAAC;KA6BH;IAvEC,kBAAkB,CAAC,EAAe;QAChC,MAAM,cA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I,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAGpE,OAAO,CACL,EAAC,IAAI,qDACH,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAC,KAAK,EACV,QAAQ,EAAE,QAAQ,mBACH,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EACvC,EAAE,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,EAClD,KAAK,EAAE;gBACL,cAAc,EAAE,QAAQ;gBACxB,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,IAAI;aACvB;YAED,6DAAM,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAC,eAAe,EAAC,IAAI,EAAC,QAAQ,iBAAa,MAAM;gBACxE,6DAAM,KAAK,EAAC,gBAAgB;oBAC1B,8DAAO,CACF,CACF,CACF,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, Listen, Prop, h } from '@stencil/core';\n\n/**\n *\n * @part native - The native HTML anchor element that wraps all child elements.\n */\n\n@Component({\n tag: 'road-segmented-button',\n styleUrl: 'segmented-button.css',\n shadow: true,\n})\nexport class SegmentedButton {\n\n @Element() el!: HTMLRoadSegmentedButtonElement;\n\n /**\n * The Segmented buttons size.\n */\n @Prop() size?: 'sm' | 'md' = 'md';\n\n /**\n * The selected tab component\n */\n @Prop({ mutable: true }) selected = false;\n\n /**\n * A tab id must be provided for each `road-tab`. It's used internally to reference\n */\n @Prop() tab?: string;\n\n /**\n * Emitted when the tab bar is clicked\n * @internal\n */\n @Event() roadsegmentedbuttonclick!: EventEmitter;\n /** @internal */\n @Event() roadSegmentedButtonClick!: EventEmitter;\n\n @Listen('roadSegmentedButtonBarChanged', { target: 'window' })\n @Listen('roadSegmentedButtonbarchanged', { target: 'window' })\n onButtonBarChanged(ev: CustomEvent) {\n const dispatchedFrom = ev.target as HTMLElement;\n const parent = this.el.parentElement as EventTarget;\n\n if ((ev.composedPath && ev.composedPath().includes(parent)) || (dispatchedFrom && dispatchedFrom.contains(this.el))) {\n this.selected = this.tab === ev.detail.tab;\n }\n }\n\n private selectTab(ev: Event | KeyboardEvent) {\n if (this.tab !== undefined) {\n this.roadsegmentedbuttonclick.emit({\n tab: this.tab,\n selected: this.selected,\n });\n this.roadSegmentedButtonClick.emit({\n tab: this.tab,\n selected: this.selected,\n });\n\n ev.preventDefault();\n }\n }\n\n private get tabIndex() {\n const hasTabIndex = this.el.hasAttribute('tabindex');\n\n if (hasTabIndex) {\n return this.el.getAttribute('tabindex');\n }\n\n return 0;\n }\n\n private onKeyUp = (ev: KeyboardEvent) => {\n if (ev.key === 'Enter' || ev.key === ' ') {\n this.selectTab(ev);\n }\n };\n\n private onClick = (ev: Event) => {\n this.selectTab(ev);\n };\n\n render() {\n const { tabIndex, selected, tab } = this;\n\n const sizeClass = this.size !== undefined ? `btn-${this.size}` : '';\n\n\n return (\n <Host\n onClick={this.onClick}\n onKeyup={this.onKeyUp}\n role=\"tab\"\n tabindex={tabIndex}\n aria-selected={selected ? 'true' : null}\n id={tab !== undefined ? `tab-button-${tab}` : null}\n class={{\n 'tab-selected': selected,\n [`${sizeClass}`]: true,\n }}\n >\n <span tabIndex={-1} class=\"button-native\" part=\"native\" aria-hidden=\"true\">\n <span class=\"button-content\">\n <slot/>\n </span>\n </span>\n </Host>\n );\n }\n}"]}
1
+ {"version":3,"file":"segmented-button.js","sourceRoot":"","sources":["../../../src/components/segmented-button/segmented-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI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,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,EAAC,sBAAsB,IAAE,IAAI,CAAC,KAAK,CAAc,CAC7G,CACF,CACF,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, Listen, Prop, h } from '@stencil/core';\n\n/**\n *\n * @part native - The native HTML anchor element that wraps all child elements.\n */\n\n@Component({\n tag: 'road-segmented-button',\n styleUrl: 'segmented-button.css',\n shadow: true,\n})\nexport class SegmentedButton {\n\n @Element() el!: HTMLRoadSegmentedButtonElement;\n\n /**\n * The Segmented buttons size.\n */\n @Prop() size?: 'sm' | 'md' | 'lg' = 'md';\n\n /**\n * The selected tab component\n */\n @Prop({ mutable: true }) selected = false;\n\n /**\n * A tab id must be provided for each `road-tab`. It's used internally to reference\n */\n @Prop() tab?: string;\n\n /**\n * A badge can be added to the segmented button by providing a string value to this property.\n */\n @Prop() badge?:string;\n\n /**\n * Emitted when the tab bar is clicked\n * @internal\n */\n @Event() roadsegmentedbuttonclick!: EventEmitter;\n /** @internal */\n @Event() roadSegmentedButtonClick!: EventEmitter;\n\n @Listen('roadSegmentedButtonBarChanged', { target: 'window' })\n @Listen('roadSegmentedButtonbarchanged', { target: 'window' })\n onButtonBarChanged(ev: CustomEvent) {\n const dispatchedFrom = ev.target as HTMLElement;\n const parent = this.el.parentElement as EventTarget;\n\n if ((ev.composedPath && ev.composedPath().includes(parent)) || (dispatchedFrom && dispatchedFrom.contains(this.el))) {\n this.selected = this.tab === ev.detail.tab;\n }\n }\n\n private selectTab(ev: Event | KeyboardEvent) {\n if (this.tab !== undefined) {\n this.roadsegmentedbuttonclick.emit({\n tab: this.tab,\n selected: this.selected,\n });\n this.roadSegmentedButtonClick.emit({\n tab: this.tab,\n selected: this.selected,\n });\n\n ev.preventDefault();\n }\n }\n\n private get tabIndex() {\n const hasTabIndex = this.el.hasAttribute('tabindex');\n\n if (hasTabIndex) {\n return this.el.getAttribute('tabindex');\n }\n\n return 0;\n }\n\n private onKeyUp = (ev: KeyboardEvent) => {\n if (ev.key === 'Enter' || ev.key === ' ') {\n this.selectTab(ev);\n }\n };\n\n private onClick = (ev: Event) => {\n this.selectTab(ev);\n };\n\n render() {\n const { tabIndex, selected, tab } = this;\n\n const sizeClass = this.size !== undefined ? `btn-${this.size}` : '';\n\n\n return (\n <Host\n onClick={this.onClick}\n onKeyup={this.onKeyUp}\n role=\"tab\"\n tabindex={tabIndex}\n aria-selected={selected ? 'true' : null}\n id={tab !== undefined ? `tab-button-${tab}` : null}\n class={{\n 'tab-selected': selected,\n [`${sizeClass}`]: true,\n }}\n >\n <span tabIndex={-1} class=\"button-native\" part=\"native\" aria-hidden=\"true\">\n <span class=\"button-content\">\n <slot/>\n {this.badge &&\n <road-badge color={this.selected ? 'primary' : 'neutral'} class=\"button-content-badge\">{this.badge}</road-badge>}\n </span>\n </span>\n </Host>\n );\n }\n}\n"]}
@@ -18,7 +18,7 @@ export class ButtonBar {
18
18
  this.selectedTabChanged();
19
19
  }
20
20
  render() {
21
- return (h(Host, { key: '9d6937fa6b2840970dd93648f1e79724562d91bf', role: "tablist" }, h("slot", { key: '63de3253cb8eb6e9d4fa2374a1fab04ff64b174a' })));
21
+ return (h(Host, { key: '76466abd7a912ac1a0df83853216c3f20ac3086a', role: "tablist" }, h("slot", { key: '04290019d2aea356a7fd24739b68c371455e3b70' })));
22
22
  }
23
23
  static get is() { return "road-segmented-button-bar"; }
24
24
  static get encapsulation() { return "shadow"; }
@@ -86,7 +86,7 @@ export class Tabs {
86
86
  return Array.from(this.el.querySelectorAll('road-tab'));
87
87
  }
88
88
  render() {
89
- return (h(Host, { key: 'df0d2cbe2bf0647686439e58ab7e47067bb85a18', onRoadSegmentedButtonClick: this.onTabClicked }, h("slot", { key: '0181d346ee8cf63cab8eac42c8932e1f5477288f', name: "top" }), h("slot", { key: 'c3c0f5c41618721ace911e149d1218b0f8412369' })));
89
+ return (h(Host, { key: '74762d3d2e76c9926a2344182debdd17dbf3c011', onRoadSegmentedButtonClick: this.onTabClicked }, h("slot", { key: 'f4d5f461a7fe74ebc76c181b185932759ceb0f34', name: "top" }), h("slot", { key: '6b99ef4524d2aa3f55b95b33b7028097abb03712' })));
90
90
  }
91
91
  static get is() { return "road-segmented-buttons"; }
92
92
  static get encapsulation() { return "shadow"; }
@@ -123,4 +123,43 @@ Small.args = {
123
123
  </road-tab>`,
124
124
  };
125
125
 
126
+ export const Large = Template.bind({});
127
+ Large.args = {
128
+ top: `<road-segmented-button-bar slot="top" selected-tab="tab-description">
129
+ <road-segmented-button tab="tab-description" size="lg">
130
+ Description
131
+ </road-segmented-button>
132
+
133
+ <road-segmented-button tab="tab-services" size="lg">
134
+ Services
135
+ </road-segmented-button>
136
+ </road-segmented-button-bar>`,
137
+ ' ': `<road-tab tab="tab-description">
138
+ Description
139
+ </road-tab>
140
+
141
+ <road-tab tab="tab-services">
142
+ Services
143
+ </road-tab>`,
144
+ };
145
+
146
+ export const Badge = Template.bind({});
147
+ Badge.args = {
148
+ top: `<road-segmented-button-bar slot="top" selected-tab="tab-description">
149
+ <road-segmented-button tab="tab-description" size="md" badge="i">
150
+ Description
151
+ </road-segmented-button>
152
+
153
+ <road-segmented-button tab="tab-services" size="md" badge="3">
154
+ Services
155
+ </road-segmented-button>
156
+ </road-segmented-button-bar>`,
157
+ ' ': `<road-tab tab="tab-description">
158
+ Description
159
+ </road-tab>
160
+
161
+ <road-tab tab="tab-services">
162
+ Services
163
+ </road-tab>`,
164
+ };
126
165
 
@@ -92,7 +92,7 @@ export class Select {
92
92
  const labelId = this.selectId + '-label';
93
93
  const hasValueClass = this.value && this.value !== '' ? 'has-value' : '';
94
94
  const isInvalidClass = this.error !== undefined && this.error !== '' ? 'is-invalid' : '';
95
- return (h(Host, { key: 'e86d30d1fe1fd95d7b70140a57d76f3992cbc035', class: this.sizes && `select-${this.sizes}` }, h("select", { key: '9a438873eedc20213b7e6c8bae2c648c9c1e0ad1', class: `form-select ${hasValueClass} ${isInvalidClass}`, id: this.selectId, "aria-disabled": this.disabled ? 'true' : null, autoFocus: this.autofocus, disabled: this.disabled, name: this.name, required: this.required, size: this.size, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur }, h("option", { key: '67d63f752f9f0fa2d48ee4ec07029c7e43706729', selected: !this.value, disabled: true, hidden: true, style: { display: 'none' }, value: "" }), this.options && this.options.map(option => (h("option", { value: option.value, selected: this.value !== null && option.value == this.value }, option.label)))), h("label", { key: 'c07e091eb4b6da4ab793c2056131c16bf9ee4723', class: "form-select-label", id: labelId, htmlFor: this.selectId }, this.label), this.error && this.error !== '' && h("p", { key: 'd01132cad717c35ca5a5afe2ad8effb697037a13', class: "invalid-feedback" }, this.error), this.helper && this.helper !== '' && h("p", { key: '2f884ebd87cf990ab093ee5a023cd698c6883a8f', class: "helper" }, this.helper)));
95
+ return (h(Host, { key: '5bb29d6c8e7ed03e244ec3fdd239589bab5cabe0', class: this.sizes && `select-${this.sizes}` }, h("select", { key: '2493089b1bb3c57c3af43ebbb5daff18ae4744e0', class: `form-select ${hasValueClass} ${isInvalidClass}`, id: this.selectId, "aria-disabled": this.disabled ? 'true' : null, autoFocus: this.autofocus, disabled: this.disabled, name: this.name, required: this.required, size: this.size, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur }, h("option", { key: 'e2bf03909eac53047f830ce9a655a643690f918e', selected: !this.value, disabled: true, hidden: true, style: { display: 'none' }, value: "" }), this.options && this.options.map(option => (h("option", { value: option.value, selected: this.value !== null && option.value == this.value }, option.label)))), h("label", { key: '8a8ad20b057bec306e122587b24f5ffbcb79a3de', class: "form-select-label", id: labelId, htmlFor: this.selectId }, this.label), this.error && this.error !== '' && h("p", { key: '1d5648a6e2fb46921900ff639b17ac5cc536350e', class: "invalid-feedback" }, this.error), this.helper && this.helper !== '' && h("p", { key: '88a14e5d848bda00fea2088013037f37559387f0', class: "helper" }, this.helper)));
96
96
  }
97
97
  static get is() { return "road-select"; }
98
98
  static get encapsulation() { return "scoped"; }
@@ -179,7 +179,7 @@ export class SelectFilter {
179
179
  const options = this.filteredOptions;
180
180
  const isActive = this.isActive ? 'true' : 'false';
181
181
  const notActive = this.isActive ? '' : 'not-active';
182
- return (h(Host, { key: '5d0540d59c53f2506b97fdaa40a1fae6381098f5', "is-active": isActive }, h("slot", { key: 'e7b5e449426fe5364b5a12a5aa408a98a033869e' }), this.isOpen && (h("div", { key: '01f532bba66042887e23c5892609e4dd174d8330', class: `${notActive} select-filter-list`, role: "listbox", onMouseLeave: this.handleMouseLeave }, options.length === 0 ? (h("div", { class: "select-filter-empty" }, "Aucune option")) : (h("ul", { class: "pl-0" }, options.map((option, idx) => (h("li", { class: `select-filter-item ${this.activeIndex === idx ? 'active' : ''}`, role: "option", "aria-selected": this.activeIndex === idx ? 'true' : 'false', onClick: (e) => this.handleOptionClick(option.item.value, option.item.label.replace(/(<([^>]+)>)/gi, ''), e), onMouseOver: () => this.handleOptionMouseOver(idx), innerHTML: option.item.label, tabindex: this.activeIndex === idx ? 0 : -1 })))))))));
182
+ return (h(Host, { key: '7fdfb3dadc614f4e851891dceb20e19f33074443', "is-active": isActive }, h("slot", { key: 'e2be686790e0ad87e002c8f393cee0ac0864d532' }), this.isOpen && (h("div", { key: '155ccb2711eaa3f8e92f25a3d3b7b9dfa34d4021', class: `${notActive} select-filter-list`, role: "listbox", onMouseLeave: this.handleMouseLeave }, options.length === 0 ? (h("div", { class: "select-filter-empty" }, "Aucune option")) : (h("ul", { class: "pl-0" }, options.map((option, idx) => (h("li", { class: `select-filter-item ${this.activeIndex === idx ? 'active' : ''}`, role: "option", "aria-selected": this.activeIndex === idx ? 'true' : 'false', onClick: (e) => this.handleOptionClick(option.item.value, option.item.label.replace(/(<([^>]+)>)/gi, ''), e), onMouseOver: () => this.handleOptionMouseOver(idx), innerHTML: option.item.label, tabindex: this.activeIndex === idx ? 0 : -1 })))))))));
183
183
  }
184
184
  static get is() { return "road-select-filter"; }
185
185
  static get encapsulation() { return "scoped"; }
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  export class Skeleton {
3
3
  render() {
4
- return (h("span", { key: 'ec2419ddcf62a6b2aeedd68ec0c1eb8e430f8185' }, "\u00A0"));
4
+ return (h("span", { key: 'eecb6ba03a976649272ec4df632022afa71b4a1e' }, "\u00A0"));
5
5
  }
6
6
  static get is() { return "road-skeleton"; }
7
7
  static get encapsulation() { return "shadow"; }
@@ -13,7 +13,7 @@ export class Spinner {
13
13
  render() {
14
14
  const sizeClass = this.size !== undefined ? `spinner spinner--${this.size}` : 'spinner';
15
15
  const colorClass = this.size !== undefined ? `spinner-circle spinner-circle--${this.color}` : 'spinner-circle';
16
- return (h("svg", { key: 'fc286db53f3b74155c3221474abb9472d774e89d', class: `${sizeClass}`, viewBox: "25 25 50 50" }, h("circle", { key: 'a40ef2366ff12fe69486f3db0d92b7d49affd370', class: `${colorClass}`, cx: "50", cy: "50", r: "20" })));
16
+ return (h("svg", { key: 'eb559d1ad35ed62c6c4cb1e7280faf29e52fe2f6', class: `${sizeClass}`, viewBox: "25 25 50 50" }, h("circle", { key: '8faa4a39732b5b882a2c76abed424d95846c3083', class: `${colorClass}`, cx: "50", cy: "50", r: "20" })));
17
17
  }
18
18
  static get is() { return "road-spinner"; }
19
19
  static get encapsulation() { return "shadow"; }
@@ -21,7 +21,7 @@ export class StatusChip {
21
21
  };
22
22
  }
23
23
  render() {
24
- return (h(Host, { key: '178e109ebeac6b66b105e3aa12cfc1cd942e83cc', class: `chip-${this.size}`, tabindex: "0", role: "button", onClick: this.onActivate, onKeyDown: this.onKeyDown }, h("div", { key: '5904c24f62ed7636205a0bf05431f698930ae615', class: "chip-description" }, h("road-icon", { key: '5a6767d216edc33ba42b6788102e90469c276a7e', class: "chip-icon", color: "info", icon: alertInfoSolid }), h("slot", { key: '03dfda63fce2ecbfeac0b16e1f54157f75bbe156' }))));
24
+ return (h(Host, { key: 'f261ddcd3afd748b815d63d973724d0898b48cd7', class: `chip-${this.size}`, tabindex: "0", role: "button", onClick: this.onActivate, onKeyDown: this.onKeyDown }, h("div", { key: '1a6fdaf843be1db93ee850456d662c98c6ab182b', class: "chip-description" }, h("road-icon", { key: '169dc92bb2d1ef16083019799ba80573731464f4', class: "chip-icon", color: "info", icon: alertInfoSolid }), h("slot", { key: '4e24bd7b4a140a532970959e5c2140a54910feb6' }))));
25
25
  }
26
26
  static get is() { return "road-status-chip"; }
27
27
  static get encapsulation() { return "shadow"; }
@@ -70,11 +70,11 @@ export class Switch {
70
70
  }
71
71
  render() {
72
72
  const labelId = this.switchId + '-label';
73
- const textLabel = h("label", { key: '22fa2b6f8be006647d123f0fc8eb077afad13aca', class: "form-switch-label", id: labelId, htmlFor: this.switchId }, this.label);
73
+ const textLabel = h("label", { key: 'c232e4f3505aa5d27a54077cf9883fef864efc4d', class: "form-switch-label", id: labelId, htmlFor: this.switchId }, this.label);
74
74
  const colorClass = this.color !== undefined ? 'form-switch-' + this.color : '';
75
75
  const isSpacedClass = this.isSpaced && 'form-switch-spaced';
76
76
  const rightSwitchClass = this.hasLeftLabel ? 'form-switch-right' : '';
77
- return (h(Host, { key: 'afcb3cea4c1ee2740769cc1364d9175d5a144ba7' }, h("input", { key: '2dace2130557a4c73b79dcd494cc33a7541e6737', class: "form-switch-input", type: "checkbox", id: this.switchId, name: this.name, checked: this.checked, disabled: this.disabled, value: this.value, "aria-checked": `${this.checked}`, "aria-disabled": this.disabled ? 'true' : null, "aria-labelledby": labelId, onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur }), h("label", { key: '81450123a463b3619774e65b7e49c3637b5d0037', class: `form-switch-label ${isSpacedClass} ${colorClass}`, htmlFor: this.switchId }, this.hasLeftLabel && textLabel, h("div", { key: '4bf60bf353f80414ac1bba264966b0ca00405b07', class: `form-switch-lever ${rightSwitchClass}`, "data-off": this.off, "data-on": this.on }), this.hasLeftLabel ? '' : textLabel)));
77
+ return (h(Host, { key: '3d93be9bb557c13028dabaef2e82a1e53b814c56' }, h("input", { key: '9682f18c59fa23c8bdaeb30c27ea0aea4c37b2e2', class: "form-switch-input", type: "checkbox", id: this.switchId, name: this.name, checked: this.checked, disabled: this.disabled, value: this.value, "aria-checked": `${this.checked}`, "aria-disabled": this.disabled ? 'true' : null, "aria-labelledby": labelId, onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur }), h("label", { key: '30340789f9d2d0182d478f7e840d705afcb4cf13', class: `form-switch-label ${isSpacedClass} ${colorClass}`, htmlFor: this.switchId }, this.hasLeftLabel && textLabel, h("div", { key: '7dd93e85e3a444f92dbfb524e5ba401e1f5ecb7d', class: `form-switch-lever ${rightSwitchClass}`, "data-off": this.off, "data-on": this.on }), this.hasLeftLabel ? '' : textLabel)));
78
78
  }
79
79
  static get is() { return "road-switch"; }
80
80
  static get encapsulation() { return "scoped"; }
@@ -21,9 +21,9 @@ export class Tab {
21
21
  }
22
22
  render() {
23
23
  const { tab, active } = this;
24
- return (h(Host, { key: '1f2746fc33e9b879bc8558f18685bdf2f243fdf1', role: "tabpanel", "aria-hidden": !active ? 'true' : null, "aria-labelledby": `tab-button-${tab}`, class: {
24
+ return (h(Host, { key: 'e5f32c9c796b1a798eca2d24a7a660d808d060f8', role: "tabpanel", "aria-hidden": !active ? 'true' : null, "aria-labelledby": `tab-button-${tab}`, class: {
25
25
  'tab-hidden': !active,
26
- } }, h("slot", { key: '38d4df4049aa57b8160855d33990f1b2db21d259' })));
26
+ } }, h("slot", { key: '018740decce73c280c77ba78216623ac0f842e9d' })));
27
27
  }
28
28
  static get is() { return "road-tab"; }
29
29
  static get encapsulation() { return "shadow"; }
@@ -36,11 +36,11 @@ export class TabBar {
36
36
  }
37
37
  render() {
38
38
  const { expand, center, secondary } = this;
39
- return (h(Host, { key: 'c44503ddd4b988d4c35891794c92998299811acb', role: "tablist", class: {
39
+ return (h(Host, { key: '598640b2a0d7bfc657df37e30deff1a0aee2698c', role: "tablist", class: {
40
40
  'tab-expand': expand,
41
41
  'tab-center': center,
42
42
  'tab-secondary': secondary,
43
- } }, h("slot", { key: '356756006ef297ea0933437004f703dc8eccacf9' })));
43
+ } }, h("slot", { key: '2f8c35375effb72f15d0b37d80ff3dd3a2779b22' })));
44
44
  }
45
45
  static get is() { return "road-tab-bar"; }
46
46
  static get encapsulation() { return "shadow"; }