@roadtrip/components 3.43.0 → 3.45.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 (44) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/road-badge_14.cjs.entry.js +10 -4
  3. package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
  4. package/dist/cjs/road-carousel.cjs.entry.js +27 -21
  5. package/dist/cjs/road-carousel.cjs.entry.js.map +1 -1
  6. package/dist/cjs/road-progress.cjs.entry.js +16 -5
  7. package/dist/cjs/road-progress.cjs.entry.js.map +1 -1
  8. package/dist/cjs/roadtrip.cjs.js +1 -1
  9. package/dist/collection/components/carousel/carousel.css +32 -15
  10. package/dist/collection/components/carousel/carousel.js +48 -22
  11. package/dist/collection/components/carousel/carousel.js.map +1 -1
  12. package/dist/collection/components/carousel/carousel.stories.js +135 -76
  13. package/dist/collection/components/drawer/drawer.js +12 -5
  14. package/dist/collection/components/drawer/drawer.js.map +1 -1
  15. package/dist/collection/components/progress/progress.js +40 -9
  16. package/dist/collection/components/progress/progress.js.map +1 -1
  17. package/dist/collection/components/progress/progress.stories.js +84 -17
  18. package/dist/esm/loader.js +1 -1
  19. package/dist/esm/road-badge_14.entry.js +10 -4
  20. package/dist/esm/road-badge_14.entry.js.map +1 -1
  21. package/dist/esm/road-carousel.entry.js +27 -21
  22. package/dist/esm/road-carousel.entry.js.map +1 -1
  23. package/dist/esm/road-progress.entry.js +16 -5
  24. package/dist/esm/road-progress.entry.js.map +1 -1
  25. package/dist/esm/roadtrip.js +1 -1
  26. package/dist/html.html-data.json +25 -1
  27. package/dist/roadtrip/{p-0bfff77d.entry.js → p-23315788.entry.js} +4 -4
  28. package/dist/roadtrip/p-23315788.entry.js.map +1 -0
  29. package/dist/roadtrip/{p-3dc22d00.entry.js → p-b889f575.entry.js} +2 -2
  30. package/dist/roadtrip/p-b889f575.entry.js.map +1 -0
  31. package/dist/roadtrip/{p-8a6fc539.entry.js → p-f89e588a.entry.js} +2 -2
  32. package/dist/roadtrip/p-f89e588a.entry.js.map +1 -0
  33. package/dist/roadtrip/roadtrip.esm.js +1 -1
  34. package/dist/roadtrip/roadtrip.esm.js.map +1 -1
  35. package/dist/types/components/carousel/carousel.d.ts +3 -1
  36. package/dist/types/components/drawer/drawer.d.ts +5 -0
  37. package/dist/types/components/progress/progress.d.ts +9 -2
  38. package/dist/types/components.d.ts +14 -4
  39. package/hydrate/index.js +70 -38
  40. package/hydrate/index.mjs +70 -38
  41. package/package.json +1 -1
  42. package/dist/roadtrip/p-0bfff77d.entry.js.map +0 -1
  43. package/dist/roadtrip/p-3dc22d00.entry.js.map +0 -1
  44. package/dist/roadtrip/p-8a6fc539.entry.js.map +0 -1
@@ -1,32 +1,31 @@
1
- import { html } from 'lit';
2
- import { ifDefined } from 'lit/directives/if-defined.js';
3
- import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
1
+ import { html } from "lit";
2
+ import { unsafeHTML } from "lit-html/directives/unsafe-html.js";
4
3
 
5
4
  export default {
6
- title: 'Listing/Carousel',
7
- component: 'road-carousel',
5
+ title: "Listing/Carousel",
6
+ component: "road-carousel",
8
7
  subcomponents: {
9
- 'road-carousel-item': 'road-carousel-item',
8
+ "road-carousel-item": "road-carousel-item",
10
9
  },
11
10
  parameters: {
12
11
  actions: {
13
12
  handles: [
14
- 'roadslidesdidload',
15
- 'roadslidetap',
16
- 'roadslidedoubletap',
17
- 'roadslidewillchange',
18
- 'roadslidedidchange',
19
- 'roadslidenextstart',
20
- 'roadslideprevstart',
21
- 'roadslidenextend',
22
- 'roadslideprevend',
23
- 'roadslidetransitionstart',
24
- 'roadslidetransitionend',
25
- 'roadslidedrag',
26
- 'roadslidereachstart',
27
- 'roadslidereachend',
28
- 'roadslidetouchstart',
29
- 'roadslidetouchend',
13
+ "roadslidesdidload",
14
+ "roadslidetap",
15
+ "roadslidedoubletap",
16
+ "roadslidewillchange",
17
+ "roadslidedidchange",
18
+ "roadslidenextstart",
19
+ "roadslideprevstart",
20
+ "roadslidenextend",
21
+ "roadslideprevend",
22
+ "roadslidetransitionstart",
23
+ "roadslidetransitionend",
24
+ "roadslidedrag",
25
+ "roadslidereachstart",
26
+ "roadslidereachend",
27
+ "roadslidetouchstart",
28
+ "roadslidetouchend",
30
29
  ],
31
30
  },
32
31
  docs: {
@@ -37,112 +36,172 @@ export default {
37
36
  },
38
37
  argTypes: {
39
38
  pager: {
40
- control: 'boolean',
41
- description: 'Shows pagination bullets below the carousel.',
39
+ control: "boolean",
40
+ description: "Shows pagination bullets below the carousel.",
41
+ },
42
+ pagertype: {
43
+ description: "Progress calculation base for step display.\n",
44
+ options: ["bullets", "fraction"],
45
+ control: {
46
+ type: "select",
47
+ },
48
+ table: {
49
+ defaultValue: { summary: "bullets" },
50
+ },
42
51
  },
43
52
  arrows: {
44
- control: 'boolean',
45
- description: 'Displays navigation arrows for manual slide transitions.',
53
+ control: "boolean",
54
+ description: "Displays navigation arrows for manual slide transitions.",
46
55
  },
47
56
  options: {
48
- control: 'object',
49
- description: 'Configuration object for the Swiper instance.',
57
+ control: "object",
58
+ description: "Configuration object for the Swiper instance.",
50
59
  },
51
- ' ': {
52
- control: 'text',
53
- description: 'Content inside the carousel, usually multiple `<road-carousel-item>` elements.',
60
+ " ": {
61
+ control: "text",
62
+ description:
63
+ "Content inside the carousel, usually multiple `<road-carousel-item>` elements.",
54
64
  },
55
65
  // 🔹 Méthodes accessibles depuis Storybook
56
66
  getActiveIndex: {
57
- description: 'Returns the index of the active slide.',
58
- table: { category: 'Methods', type: { summary: '() => Promise<number>' } },
67
+ description: "Returns the index of the active slide.",
68
+ table: {
69
+ category: "Methods",
70
+ type: { summary: "() => Promise<number>" },
71
+ },
59
72
  },
60
73
  getPreviousIndex: {
61
- description: 'Returns the index of the previous slide.',
62
- table: { category: 'Methods', type: { summary: '() => Promise<number>' } },
74
+ description: "Returns the index of the previous slide.",
75
+ table: {
76
+ category: "Methods",
77
+ type: { summary: "() => Promise<number>" },
78
+ },
63
79
  },
64
80
  getSwiper: {
65
- description: 'Returns the Swiper instance. See Swiper API for more details.',
66
- table: { category: 'Methods', type: { summary: '() => Promise<any>' } },
81
+ description:
82
+ "Returns the Swiper instance. See Swiper API for more details.",
83
+ table: { category: "Methods", type: { summary: "() => Promise<any>" } },
67
84
  },
68
85
  isBeginning: {
69
- description: 'Checks if the current slide is the first slide.',
70
- table: { category: 'Methods', type: { summary: '() => Promise<boolean>' } },
86
+ description: "Checks if the current slide is the first slide.",
87
+ table: {
88
+ category: "Methods",
89
+ type: { summary: "() => Promise<boolean>" },
90
+ },
71
91
  },
72
92
  isEnd: {
73
- description: 'Checks if the current slide is the last slide.',
74
- table: { category: 'Methods', type: { summary: '() => Promise<boolean>' } },
93
+ description: "Checks if the current slide is the last slide.",
94
+ table: {
95
+ category: "Methods",
96
+ type: { summary: "() => Promise<boolean>" },
97
+ },
75
98
  },
76
99
  length: {
77
- description: 'Returns the total number of slides.',
78
- table: { category: 'Methods', type: { summary: '() => Promise<number>' } },
100
+ description: "Returns the total number of slides.",
101
+ table: {
102
+ category: "Methods",
103
+ type: { summary: "() => Promise<number>" },
104
+ },
79
105
  },
80
106
  lockSwipeToNext: {
81
- description: 'Locks the ability to slide to the next slide.',
82
- table: { category: 'Methods', type: { summary: '(lock: boolean) => Promise<void>' } },
107
+ description: "Locks the ability to slide to the next slide.",
108
+ table: {
109
+ category: "Methods",
110
+ type: { summary: "(lock: boolean) => Promise<void>" },
111
+ },
83
112
  },
84
113
  lockSwipeToPrev: {
85
- description: 'Locks the ability to slide to the previous slide.',
86
- table: { category: 'Methods', type: { summary: '(lock: boolean) => Promise<void>' } },
114
+ description: "Locks the ability to slide to the previous slide.",
115
+ table: {
116
+ category: "Methods",
117
+ type: { summary: "(lock: boolean) => Promise<void>" },
118
+ },
87
119
  },
88
120
  lockSwipes: {
89
- description: 'Locks the ability to swipe in either direction.',
90
- table: { category: 'Methods', type: { summary: '(lock: boolean) => Promise<void>' } },
121
+ description: "Locks the ability to swipe in either direction.",
122
+ table: {
123
+ category: "Methods",
124
+ type: { summary: "(lock: boolean) => Promise<void>" },
125
+ },
91
126
  },
92
127
  slideNext: {
93
- description: 'Transitions to the next slide.',
94
- table: { category: 'Methods', type: { summary: '(speed?: number, runCallbacks?: boolean) => Promise<void>' } },
128
+ description: "Transitions to the next slide.",
129
+ table: {
130
+ category: "Methods",
131
+ type: {
132
+ summary: "(speed?: number, runCallbacks?: boolean) => Promise<void>",
133
+ },
134
+ },
95
135
  },
96
136
  slidePrev: {
97
- description: 'Transitions to the previous slide.',
98
- table: { category: 'Methods', type: { summary: '(speed?: number, runCallbacks?: boolean) => Promise<void>' } },
137
+ description: "Transitions to the previous slide.",
138
+ table: {
139
+ category: "Methods",
140
+ type: {
141
+ summary: "(speed?: number, runCallbacks?: boolean) => Promise<void>",
142
+ },
143
+ },
99
144
  },
100
145
  slideTo: {
101
- description: 'Transitions to a specified slide index.',
102
- table: { category: 'Methods', type: { summary: '(index: number, speed?: number, runCallbacks?: boolean) => Promise<void>' } },
146
+ description: "Transitions to a specified slide index.",
147
+ table: {
148
+ category: "Methods",
149
+ type: {
150
+ summary:
151
+ "(index: number, speed?: number, runCallbacks?: boolean) => Promise<void>",
152
+ },
153
+ },
103
154
  },
104
155
  startAutoplay: {
105
- description: 'Starts automatic slide transition.',
106
- table: { category: 'Methods', type: { summary: '() => Promise<void>' } },
156
+ description: "Starts automatic slide transition.",
157
+ table: { category: "Methods", type: { summary: "() => Promise<void>" } },
107
158
  },
108
159
  stopAutoplay: {
109
- description: 'Stops automatic slide transition.',
110
- table: { category: 'Methods', type: { summary: '() => Promise<void>' } },
160
+ description: "Stops automatic slide transition.",
161
+ table: { category: "Methods", type: { summary: "() => Promise<void>" } },
111
162
  },
112
163
  update: {
113
- description: 'Updates the carousel when slides are added or removed.',
114
- table: { category: 'Methods', type: { summary: '() => Promise<void>' } },
164
+ description: "Updates the carousel when slides are added or removed.",
165
+ table: { category: "Methods", type: { summary: "() => Promise<void>" } },
115
166
  },
116
167
  updateAutoHeight: {
117
- description: 'Updates carousel height when `autoHeight` is enabled.',
118
- table: { category: 'Methods', type: { summary: '(speed?: number) => Promise<void>' } },
168
+ description: "Updates carousel height when `autoHeight` is enabled.",
169
+ table: {
170
+ category: "Methods",
171
+ type: { summary: "(speed?: number) => Promise<void>" },
172
+ },
119
173
  },
120
174
  },
121
175
  args: {
122
- pager: false,
176
+ pager: true,
177
+ pagertype: "fraction",
123
178
  arrows: false,
124
- ' ': `
179
+ " ": `
125
180
  <road-carousel-item>
126
- <road-img src="https://via.placeholder.com/800x400?text=Slide+1" alt="Slide 1"></road-img>
181
+ <road-img src="https://placehold.co/800x400?text=Slide+1" alt="Slide 1"></road-img>
127
182
  </road-carousel-item>
128
183
  <road-carousel-item>
129
- <road-img src="https://via.placeholder.com/800x400?text=Slide+2" alt="Slide 2"></road-img>
184
+ <road-img src="https://placehold.co/800x400?text=Slide+2" alt="Slide 2"></road-img>
130
185
  </road-carousel-item>
131
186
  <road-carousel-item>
132
- <road-img src="https://via.placeholder.com/800x400?text=Slide+3" alt="Slide 3"></road-img>
187
+ <road-img src="https://placehold.co/800x400?text=Slide+3" alt="Slide 3"></road-img>
133
188
  </road-carousel-item>
134
189
  `,
135
190
  },
136
191
  };
137
192
 
138
- const Template = (args) => html`
139
- <road-carousel
140
- ?pager="${args.pager}"
141
- ?arrows="${args.arrows}"
142
- .options="${args.options}">
143
- ${unsafeHTML(args[' '])}
144
- </road-carousel>
145
- `;
193
+ const Template = (args) => {
194
+ return html`
195
+ <road-carousel
196
+ pager="${args.pager}"
197
+ pagertype="${args.pagertype}"
198
+ arrows="${args.arrows}"
199
+ options="${args.options}"
200
+ >
201
+ ${unsafeHTML(args[" "])}
202
+ </road-carousel>
203
+ `;
204
+ };
146
205
 
147
206
  export const Playground = Template.bind({});
148
207
 
@@ -40,6 +40,14 @@ export class Drawer {
40
40
  * Show / hide close icon
41
41
  */
42
42
  this.hasCloseIcon = true;
43
+ /**
44
+ * Footer Content state
45
+ */
46
+ this.hasFooterContent = false;
47
+ this.onFooterSlotChange = (event) => {
48
+ const slot = event.target;
49
+ this.hasFooterContent = slot.assignedElements().length > 0;
50
+ };
43
51
  /**
44
52
  * Close the dialog when clicking on the cross or layer
45
53
  */
@@ -141,7 +149,7 @@ export class Drawer {
141
149
  });
142
150
  }
143
151
  render() {
144
- var _a, _b, _c, _d;
152
+ var _a, _b, _c;
145
153
  const drawerIsOpenClass = this.isOpen ? 'drawer-open' : '';
146
154
  const removePaddingClass = this.removePadding ? 'remove-padding' : '';
147
155
  const inverseHeaderClass = this.hasInverseHeader ? 'drawer-header-inverse' : '';
@@ -152,9 +160,7 @@ export class Drawer {
152
160
  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;
153
161
  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;
154
162
  const drawerWidthValue = this.position === 'bottom' ? '100%' : `${this.drawerWidth}px`;
155
- const footerSlotElement = (_d = this.el.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('slot[name="footer"]');
156
- const hasFooterContent = footerSlotElement instanceof HTMLSlotElement && footerSlotElement.assignedNodes().length > 0;
157
- return (h(Host, { key: 'a2f62ec1ecc2d5452041c1aef21c219dfb7d37e5', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": ariaLabel }, h("div", { key: '483e792abee343f79a36594eb391203521dac055', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), h("div", { key: 'b0692ac024a6f402915f482177b867f1d3fa5144', class: "drawer-dialog", style: { maxWidth: drawerWidthValue }, role: "document", tabindex: "0" }, h("div", { key: '6afd92780745fe0f6817adb5fba8649a9de0cdd9', class: "drawer-content" }, h("header", { key: '5248706c77aeaa4ce3332acfe7f3b605cbe7fd54', 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: '42ade4a899a1f381af1463ac5217c245de22c241', class: `drawer-body ${removePaddingClass}` }, h("slot", { key: 'adb1a893b61941e6488ba3bc233540ca18d90252' })), h("footer", { key: '7fb54e5564e98777a3fbf3474d323f7fe1eb0e07', class: `drawer-footer ${removePaddingClass}`, style: { display: hasFooterContent ? 'block' : 'none' } }, h("slot", { key: '37f2d0ec86cccc74795bc9a8fb509c5ded347f92', name: "footer" }))))));
163
+ return (h(Host, { key: '926b41433f3cb5e9648d2b3a85e3617e0b088f73', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": ariaLabel }, h("div", { key: '6a50b5ae4172dfa5b46c95e5ff8d88addc699865', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), h("div", { key: 'b7a8d8295683575eda145c38b89a677b796e47c3', class: "drawer-dialog", style: { maxWidth: drawerWidthValue }, role: "document", tabindex: "0" }, h("div", { key: '334b88b55f8f99fcec5ed0a8d08110280210a9d0', class: "drawer-content" }, h("header", { key: '565780f8b032e0e13d7da8539bd9eee6eedf08d9', 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: 'ef60feb331d03b9f0c6119aa1eea39e65a83816b', class: `drawer-body ${removePaddingClass}` }, h("slot", { key: 'fc14602ad66a21a4feeb128f5ed945900b18ef0d' })), h("footer", { key: '60a25c658b4d65263c8143f270e90b4adb8d879f', class: `drawer-footer ${removePaddingClass}`, hidden: !this.hasFooterContent }, h("slot", { key: 'cff20e77ebc9e0e5efd2b1c8347078976117e23d', name: "footer", onSlotchange: this.onFooterSlotChange }))))));
158
164
  }
159
165
  static get is() { return "road-drawer"; }
160
166
  static get encapsulation() { return "shadow"; }
@@ -409,7 +415,8 @@ export class Drawer {
409
415
  }
410
416
  static get states() {
411
417
  return {
412
- "focusTrap": {}
418
+ "focusTrap": {},
419
+ "hasFooterContent": {}
413
420
  };
414
421
  }
415
422
  static get events() {
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACrH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AAExD;;;;;;;;GAQG;AAQH,MAAM,OAAO,MAAM;IALnB;QAYE;;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;QAyFrC;;WAEG;QACK,YAAO,GAAG,CAAC,EAAW,EAAE,EAAE;YAChC,EAAE,CAAC,eAAe,EAAE,CAAC;YACrB,EAAE,CAAC,cAAc,EAAE,CAAC;YAEpB,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC;QAEF;;WAEG;QACK,gBAAW,GAAG,CAAC,KAAiB,EAAE,EAA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MAAM,EAAE;wBAC3G,6DAAM,IAAI,EAAC,QAAQ,GAAG,CACf,CACL,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Element, Event, EventEmitter, Listen, Method, Prop, h, Host, Watch, State } 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\n@Component({\n tag: 'road-drawer',\n styleUrl: 'drawer.css',\n shadow: true,\n})\nexport class Drawer {\n\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 * 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 * 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 // @Watch('isOpen')\n // handleOpen(openValue: boolean) {\n // if(openValue === true) {\n // this.onOpen.emit();\n // } else {\n // this.el.addEventListener('transitionend', () => {\n // this.onClose.emit();\n // this.el.shadowRoot && ((this.el.shadowRoot.querySelector('.drawer-body') as HTMLElement).scrollTop = 0);\n // }, { once: true});\n // }\n // }\n\n\n @Watch('isOpen')\n handleOpen(openValue: boolean) {\n if(openValue === true) {\n this.onOpen.emit();\n // Focus the first button element after the drawer is opened then focus trap\n setTimeout(() => {\n this.focusFirstElement();\n this.focusTrap?.activate();\n }, 50); // Add a slight delay to ensure the element is rendered\n } else {\n this.el.addEventListener('transitionend', () => {\n this.focusTrap?.deactivate();\n this.onClose.emit();\n this.el.shadowRoot && ((this.el.shadowRoot.querySelector('.drawer-body') as HTMLElement).scrollTop = 0);\n }, { once: true });\n }\n }\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 /**\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 /**\n * Call close function when clicking an element with data-dismiss=\"modal\" attribute\n */\n componentDidLoad() {\n this.el.querySelectorAll('[data-dismiss=\"modal\"]').forEach(item => {\n item.addEventListener('click', () => this.close());\n });\n\n const drawerContent = this.el.shadowRoot?.querySelector(\".drawer-dialog\");\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 });\n }\n\n render() {\n const drawerIsOpenClass = this.isOpen ? 'drawer-open' : '';\n const removePaddingClass = this.removePadding ? 'remove-padding' : '';\n const inverseHeaderClass = this.hasInverseHeader ? 'drawer-header-inverse' : '';\n const ariaLabel = this.ariaLabel ?? 'drawer';\n const ariaLabelBack = this.ariaLabelBack ?? 'Back';\n const ariaLabelClose = this.ariaLabelClose ?? 'Close';\n const drawerDelimiterClass = this.drawerTitle && !this.hasInverseHeader ? 'drawer-delimiter' : '';\n const backIconElement = this.hasBackIcon ? (\n <button type=\"button\" class=\"drawer-action\" aria-label={ariaLabelBack} onClick={this.onClickBack}>\n <road-icon icon={navigationChevron} rotate=\"180\"></road-icon>\n {this.backText}\n </button>\n ) : null;\n const closeIconElement = this.hasCloseIcon ? (\n <button type=\"button\" class=\"drawer-close\" onClick={this.onClick} aria-label={ariaLabelClose}>\n <road-icon icon={navigationClose} aria-hidden=\"true\"></road-icon>\n </button>\n ) : null;\n const drawerWidthValue = this.position === 'bottom' ? '100%' : `${this.drawerWidth}px`;\n \n const footerSlotElement = this.el.shadowRoot?.querySelector('slot[name=\"footer\"]');\n const hasFooterContent = footerSlotElement instanceof HTMLSlotElement && footerSlotElement.assignedNodes().length > 0;\n \n return (\n <Host class={`${drawerIsOpenClass} drawer-${this.position}`} tabindex=\"0\" role=\"dialog\" aria-label={ariaLabel}>\n <div class=\"drawer-overlay\" onClick={this.onClick} tabindex=\"-1\"></div>\n <div class=\"drawer-dialog\" style={{ maxWidth: drawerWidthValue }} role=\"document\" tabindex=\"0\">\n <div class=\"drawer-content\">\n <header class={`drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}`}>\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 class={`drawer-footer ${removePaddingClass}`} style={{ display: hasFooterContent ? 'block' : 'none' }}>\n <slot name=\"footer\" />\n </footer>\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,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Element, Event, EventEmitter, Listen, Method, Prop, h, Host, Watch, State } 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\n@Component({\n tag: 'road-drawer',\n styleUrl: 'drawer.css',\n shadow: true,\n})\nexport class Drawer {\n\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 * 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 // @Watch('isOpen')\n // handleOpen(openValue: boolean) {\n // if(openValue === true) {\n // this.onOpen.emit();\n // } else {\n // this.el.addEventListener('transitionend', () => {\n // this.onClose.emit();\n // this.el.shadowRoot && ((this.el.shadowRoot.querySelector('.drawer-body') as HTMLElement).scrollTop = 0);\n // }, { once: true});\n // }\n // }\n\n\n @Watch('isOpen')\n handleOpen(openValue: boolean) {\n if(openValue === true) {\n this.onOpen.emit();\n // Focus the first button element after the drawer is opened then focus trap\n setTimeout(() => {\n this.focusFirstElement();\n this.focusTrap?.activate();\n }, 50); // Add a slight delay to ensure the element is rendered\n } else {\n this.el.addEventListener('transitionend', () => {\n this.focusTrap?.deactivate();\n this.onClose.emit();\n this.el.shadowRoot && ((this.el.shadowRoot.querySelector('.drawer-body') as HTMLElement).scrollTop = 0);\n }, { once: true });\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 /**\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 /**\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 /**\n * Call close function when clicking an element with data-dismiss=\"modal\" attribute\n */\n componentDidLoad() {\n this.el.querySelectorAll('[data-dismiss=\"modal\"]').forEach(item => {\n item.addEventListener('click', () => this.close());\n });\n\n const drawerContent = this.el.shadowRoot?.querySelector(\".drawer-dialog\");\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 });\n }\n\n render() {\n const drawerIsOpenClass = this.isOpen ? 'drawer-open' : '';\n const removePaddingClass = this.removePadding ? 'remove-padding' : '';\n const inverseHeaderClass = this.hasInverseHeader ? 'drawer-header-inverse' : '';\n const ariaLabel = this.ariaLabel ?? 'drawer';\n const ariaLabelBack = this.ariaLabelBack ?? 'Back';\n const ariaLabelClose = this.ariaLabelClose ?? 'Close';\n const drawerDelimiterClass = this.drawerTitle && !this.hasInverseHeader ? 'drawer-delimiter' : '';\n const backIconElement = this.hasBackIcon ? (\n <button type=\"button\" class=\"drawer-action\" aria-label={ariaLabelBack} onClick={this.onClickBack}>\n <road-icon icon={navigationChevron} rotate=\"180\"></road-icon>\n {this.backText}\n </button>\n ) : null;\n const closeIconElement = this.hasCloseIcon ? (\n <button type=\"button\" class=\"drawer-close\" onClick={this.onClick} aria-label={ariaLabelClose}>\n <road-icon icon={navigationClose} aria-hidden=\"true\"></road-icon>\n </button>\n ) : null;\n const drawerWidthValue = this.position === 'bottom' ? '100%' : `${this.drawerWidth}px`;\n \n return (\n <Host class={`${drawerIsOpenClass} drawer-${this.position}`} tabindex=\"0\" role=\"dialog\" aria-label={ariaLabel}>\n <div class=\"drawer-overlay\" onClick={this.onClick} tabindex=\"-1\"></div>\n <div class=\"drawer-dialog\" style={{ maxWidth: drawerWidthValue }} role=\"document\" tabindex=\"0\">\n <div class=\"drawer-content\">\n <header class={`drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}`}>\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 </Host>\n );\n }\n \n}"]}
@@ -7,9 +7,9 @@ export class ProgressBar {
7
7
  */
8
8
  this.value = 0;
9
9
  /**
10
- * The number of steps should be 4 or 5.
10
+ * The number of steps.
11
11
  */
12
- this.numbersteps = 9;
12
+ this.numbersteps = 0;
13
13
  /**
14
14
  * Label display in progress bar
15
15
  */
@@ -34,16 +34,27 @@ export class ProgressBar {
34
34
  * The color to use from your application's color palette.
35
35
  */
36
36
  this.color = "primary";
37
+ /**
38
+ * Progress calculation base for step display
39
+ * - previous: step is calculated based on the previous completed step
40
+ * - current: step is calculated based on the current progress
41
+ * Default is 'current'
42
+ */
43
+ this.progresscalculationbase = "current";
37
44
  }
38
45
  render() {
39
- const steps = this.numbersteps;
40
- const valueRound = Math.round((this.value / 100) * steps);
41
46
  const fullwidth = this.fullwidth
42
47
  ? "progress-element-info-full-width"
43
48
  : "progress-element-info";
44
49
  const light = this.light ? "progress progress-light" : "progress";
45
50
  const animation = this.animation ? "animation" : "";
46
- return (h(Host, { key: '545f84051240cbd0f58b74971dc2092066b8f473', class: "progress-element" }, h("div", { key: '7a09889955c9f8dce9521d30afe97890f9a27380', class: `${light} progress-${this.color} ${animation}` }, h("div", { key: '12bd04b41b952b3648ce823d35f3261fee236c14', class: "progress-bar", role: "progressbar", style: { width: `${this.value}%` }, "aria-valuenow": this.value, "aria-valuemin": "0", "aria-valuemax": "100", "aria-label": "progress bar" })), h("div", { key: '31b58e77438d128939167db44bf83c53885bb8a9', class: `${fullwidth}` }, h("span", { key: '244e25f42355c7af0d414c5100cfdf329bb32d54', class: "progress-element-label" }, this.label), this.showstep && (h("span", { key: 'ce858c7a9a25527ac4d5984210fa4c8c408aeb2c', class: "progress-element-step" }, valueRound, "/", this.numbersteps)))));
51
+ const offset = this.progresscalculationbase === "current" ? 0 : -1;
52
+ const percentagePerStep = 100 / this.numbersteps;
53
+ const progressBarFilledPercentage = this.value + (this.numbersteps ? percentagePerStep * offset : 0);
54
+ let step = Math.ceil((this.value / 100) * this.numbersteps);
55
+ step = Math.min(step, this.numbersteps);
56
+ step = Math.max(step, 0);
57
+ return (h(Host, { key: 'b95f31407c58d8d7d6a25044b76c8f2f233d74d1', class: "progress-element" }, h("div", { key: 'dfa03b1cbb5e4c417eed00d25b394fd7208e0f14', class: `${light} progress-${this.color} ${animation}` }, h("div", { key: '7f0ca4d17c77c88d24457ac9b5a5112ff11ddbf2', class: "progress-bar", role: "progressbar", style: { width: `${progressBarFilledPercentage}%` }, "aria-valuenow": progressBarFilledPercentage, "aria-valuemin": "0", "aria-valuemax": "100", "aria-labelledby": "loadinglabel", "aria-label": "progress bar" })), h("div", { key: '45cc2ee26a70152ada39408101f675ffb3470fc2', class: `${fullwidth}` }, h("span", { key: '545f2ab462c04d2f3b38b0c2de1b067f639e864a', id: "loadinglabel", class: "progress-element-label" }, this.label), this.showstep && (h("span", { key: '2d79c6432b78f9f4cbb2ae4c4afcf2a4de9c0a3a', class: "progress-element-step" }, step, "/", this.numbersteps)))));
47
58
  }
48
59
  static get is() { return "road-progress"; }
49
60
  static get encapsulation() { return "shadow"; }
@@ -83,21 +94,21 @@ export class ProgressBar {
83
94
  "type": "number",
84
95
  "mutable": false,
85
96
  "complexType": {
86
- "original": "2 | 3 | 4 | 5 | 6 | 7 | 8 | 9",
87
- "resolved": "2 | 3 | 4 | 5 | 6 | 7 | 8 | 9",
97
+ "original": "number",
98
+ "resolved": "number",
88
99
  "references": {}
89
100
  },
90
101
  "required": false,
91
102
  "optional": false,
92
103
  "docs": {
93
104
  "tags": [],
94
- "text": "The number of steps should be 4 or 5."
105
+ "text": "The number of steps."
95
106
  },
96
107
  "getter": false,
97
108
  "setter": false,
98
109
  "attribute": "numbersteps",
99
110
  "reflect": false,
100
- "defaultValue": "9"
111
+ "defaultValue": "0"
101
112
  },
102
113
  "label": {
103
114
  "type": "string",
@@ -218,6 +229,26 @@ export class ProgressBar {
218
229
  "attribute": "color",
219
230
  "reflect": false,
220
231
  "defaultValue": "\"primary\""
232
+ },
233
+ "progresscalculationbase": {
234
+ "type": "string",
235
+ "mutable": false,
236
+ "complexType": {
237
+ "original": "\"previous\" | \"current\"",
238
+ "resolved": "\"current\" | \"previous\"",
239
+ "references": {}
240
+ },
241
+ "required": false,
242
+ "optional": false,
243
+ "docs": {
244
+ "tags": [],
245
+ "text": "Progress calculation base for step display\n- previous: step is calculated based on the previous completed step\n- current: step is calculated based on the current progress\nDefault is 'current'"
246
+ },
247
+ "getter": false,
248
+ "setter": false,
249
+ "attribute": "progresscalculationbase",
250
+ "reflect": false,
251
+ "defaultValue": "\"current\""
221
252
  }
222
253
  };
223
254
  }
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/components/progress/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOzD,MAAM,OAAO,WAAW;IALxB;QAME;;;WAGG;Q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,IAAE,IAAI,CAAC,KAAK,CAAQ;gBACvD,IAAI,CAAC,QAAQ,IAAI,CAChB,6DAAM,KAAK,EAAC,uBAAuB;oBAChC,UAAU;;oBAAG,IAAI,CAAC,WAAW,CACzB,CACR,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: \"road-progress\",\n styleUrl: \"progress.css\",\n shadow: true,\n})\nexport class ProgressBar {\n /**\n * The value determines how much of the active bar should display.\n * The value should be between [0, 100].\n */\n @Prop() value: number = 0;\n\n /**\n * The number of steps should be 4 or 5.\n */\n @Prop() numbersteps: 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 = 9;\n\n /**\n * Label display in progress bar\n */\n @Prop() label: string = \"\";\n\n /**\n * Show step\n */\n @Prop() showstep: boolean = false;\n\n /**\n * Animation progress bar\n */\n @Prop() animation: boolean = false;\n\n /**\n * Light progress background\n */\n @Prop() light: boolean = false;\n\n /**\n * Add padding if the progress is full width\n */\n @Prop() fullwidth: boolean = false;\n\n /**\n * The color to use from your application's color palette.\n */\n @Prop() color:\n | \"primary\"\n | \"secondary\"\n | \"info\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"rating\" = \"primary\";\n\n render() {\n const steps = this.numbersteps;\n const valueRound = Math.round((this.value / 100) * steps);\n const fullwidth = this.fullwidth\n ? \"progress-element-info-full-width\"\n : \"progress-element-info\";\n const light = this.light ? \"progress progress-light\" : \"progress\";\n const animation = this.animation ? \"animation\" : \"\";\n\n return (\n <Host class=\"progress-element\">\n <div class={`${light} progress-${this.color} ${animation}`}>\n <div\n class=\"progress-bar\"\n role=\"progressbar\"\n style={{ width: `${this.value}%` }}\n aria-valuenow={this.value}\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-label=\"progress bar\"\n ></div>\n </div>\n <div class={`${fullwidth}`}>\n <span class=\"progress-element-label\">{this.label}</span>\n {this.showstep && (\n <span class=\"progress-element-step\">\n {valueRound}/{this.numbersteps}\n </span>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/components/progress/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOzD,MAAM,OAAO,WAAW;IALxB;QAME;;;WAGG;QACK,UAAK,GAAW,CAAC,CAAC;QAE1B;;WAEG;QACK,gBAAW,GAAW,CAAC,CAAC;QAEhC;;WAEG;QACK,UAAK,GAAW,EAAE,CAAC;QAE3B;;WAEG;QACK,aAAQ,GAAY,KAAK,CAAC;QAElC;;WAEG;QACK,cAAS,GAAY,KAAK,CAAC;QAEnC;;WAEG;QACK,UAAK,GAAY,KAAK,CAAC;QAE/B;;WAEG;QACK,cAAS,GAAY,KAAK,CAAC;QAEnC;;WAEG;QACK,UAAK,GAOE,SAAS,CAAC;QAEzB;;;;;WAKG;QACK,4BAAuB,GAA2B,SAAS,CAAC;KA6CrE;IA3CC,MAAM;QACJ,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS;YAC9B,CAAC,CAAC,kCAAkC;YACpC,CAAC,CAAC,uBAAuB,CAAC;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,UAAU,CAAC;QAClE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAEpD,MAAM,MAAM,GAAW,IAAI,CAAC,uBAAuB,KAAK,SAAS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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Prop, h } from \"@stencil/core\";\n\n@Component({\n tag: \"road-progress\",\n styleUrl: \"progress.css\",\n shadow: true,\n})\nexport class ProgressBar {\n /**\n * The value determines how much of the active bar should display.\n * The value should be between [0, 100].\n */\n @Prop() value: number = 0;\n\n /**\n * The number of steps.\n */\n @Prop() numbersteps: number = 0;\n\n /**\n * Label display in progress bar\n */\n @Prop() label: string = \"\";\n\n /**\n * Show step\n */\n @Prop() showstep: boolean = false;\n\n /**\n * Animation progress bar\n */\n @Prop() animation: boolean = false;\n\n /**\n * Light progress background\n */\n @Prop() light: boolean = false;\n\n /**\n * Add padding if the progress is full width\n */\n @Prop() fullwidth: boolean = false;\n\n /**\n * The color to use from your application's color palette.\n */\n @Prop() color:\n | \"primary\"\n | \"secondary\"\n | \"info\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"rating\" = \"primary\";\n\n /**\n * Progress calculation base for step display\n * - previous: step is calculated based on the previous completed step\n * - current: step is calculated based on the current progress\n * Default is 'current'\n */\n @Prop() progresscalculationbase: \"previous\" | \"current\" = \"current\";\n\n render() {\n const fullwidth = this.fullwidth\n ? \"progress-element-info-full-width\"\n : \"progress-element-info\";\n const light = this.light ? \"progress progress-light\" : \"progress\";\n const animation = this.animation ? \"animation\" : \"\";\n\n const offset: number = this.progresscalculationbase === \"current\" ? 0 : -1;\n const percentagePerStep = 100 / this.numbersteps;\n const progressBarFilledPercentage =\n this.value + (this.numbersteps ? percentagePerStep * offset : 0);\n\n let step = Math.ceil((this.value / 100) * this.numbersteps);\n step = Math.min(step, this.numbersteps);\n step = Math.max(step, 0);\n\n return (\n <Host class=\"progress-element\">\n <div class={`${light} progress-${this.color} ${animation}`}>\n <div\n class=\"progress-bar\"\n role=\"progressbar\"\n style={{ width: `${progressBarFilledPercentage}%` }}\n aria-valuenow={progressBarFilledPercentage}\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-labelledby=\"loadinglabel\"\n aria-label=\"progress bar\"\n ></div>\n </div>\n <div class={`${fullwidth}`}>\n <span id=\"loadinglabel\" class=\"progress-element-label\">\n {this.label}\n </span>\n {this.showstep && (\n <span class=\"progress-element-step\">\n {step}/{this.numbersteps}\n </span>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}