@roadtrip/components 3.32.4 → 3.32.5

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 (66) hide show
  1. package/dist/cjs/road-badge_14.cjs.entry.js +9 -12
  2. package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
  3. package/dist/collection/components/accordion/accordion.stories.js +38 -4
  4. package/dist/collection/components/alert/alert.stories.js +7 -0
  5. package/dist/collection/components/asset/asset.stories.js +6 -0
  6. package/dist/collection/components/autocomplete/autocomplete.stories.js +43 -47
  7. package/dist/collection/components/avatar/avatar.stories.js +6 -0
  8. package/dist/collection/components/badge/badge.stories.js +6 -0
  9. package/dist/collection/components/banner/banner.stories.js +33 -3
  10. package/dist/collection/components/button/button.stories.js +58 -67
  11. package/dist/collection/components/button-floating/button-floating.stories.js +32 -23
  12. package/dist/collection/components/card/card.stories.js +25 -15
  13. package/dist/collection/components/carousel/carousel.stories.js +72 -280
  14. package/dist/collection/components/checkbox/checkbox.stories.js +54 -33
  15. package/dist/collection/components/chip/chip.stories.js +32 -47
  16. package/dist/collection/components/collapse/collapse.stories.js +88 -78
  17. package/dist/collection/components/content-card/content-card.stories.js +30 -11
  18. package/dist/collection/components/counter/counter.stories.js +40 -11
  19. package/dist/collection/components/dialog/dialog.stories.js +37 -51
  20. package/dist/collection/components/drawer/drawer.js +9 -12
  21. package/dist/collection/components/drawer/drawer.js.map +1 -1
  22. package/dist/collection/components/drawer/drawer.stories.js +64 -134
  23. package/dist/collection/components/dropdown/dropdown.stories.js +69 -53
  24. package/dist/collection/components/duration/duration.stories.js +49 -45
  25. package/dist/collection/components/flap/flap.stories.js +22 -10
  26. package/dist/collection/components/input/input.stories.js +33 -0
  27. package/dist/collection/components/item/item.stories.js +25 -0
  28. package/dist/collection/components/list/list.stories.js +2 -0
  29. package/dist/collection/components/modal/modal.stories.js +14 -0
  30. package/dist/collection/components/navbar/navbar.stories.js +3 -0
  31. package/dist/collection/components/navbar-v2/navbar-v2.stories.js +4 -0
  32. package/dist/collection/components/phone-number-input/phone-number-input.stories.js +15 -1
  33. package/dist/collection/components/plate-number/plate-number.stories.js +13 -0
  34. package/dist/collection/components/profil-dropdown/profil-dropdown.stories.js +8 -0
  35. package/dist/collection/components/progress/progress.stories.js +12 -0
  36. package/dist/collection/components/progress-indicator-horizontal/progress-indicator-horizontal.stories.js +8 -0
  37. package/dist/collection/components/progress-indicator-vertical/progress-indicator-vertical.stories.js +1 -0
  38. package/dist/collection/components/progress-tracker/progress-tracker.stories.js +1 -0
  39. package/dist/collection/components/radio/radio.stories.js +13 -0
  40. package/dist/collection/components/range/range.stories.js +11 -0
  41. package/dist/collection/components/rating/rating.stories.js +7 -0
  42. package/dist/collection/components/segmented-buttons/segmented-buttons.stories.js +2 -0
  43. package/dist/collection/components/select/select.stories.js +13 -0
  44. package/dist/collection/components/select-filter/select-filter.stories.js +5 -0
  45. package/dist/collection/components/skeleton/skeleton.stories.js +2 -0
  46. package/dist/collection/components/spinner/spinner.stories.js +2 -0
  47. package/dist/collection/components/table/table.stories.js +1 -0
  48. package/dist/collection/components/tabs/tabs.stories.js +2 -0
  49. package/dist/collection/components/tag/tag.stories.js +3 -0
  50. package/dist/collection/components/text/text.stories.js +2 -0
  51. package/dist/collection/components/textarea/textarea.stories.js +26 -0
  52. package/dist/collection/components/toast/toast.stories.js +6 -0
  53. package/dist/collection/components/toggle/toggle.stories.js +14 -0
  54. package/dist/collection/components/toolbar/toolbar.stories.js +6 -0
  55. package/dist/collection/components/toolbar-v2/toolbar-v2.stories.js +5 -0
  56. package/dist/collection/components/tooltip/tooltip.stories.js +11 -0
  57. package/dist/esm/road-badge_14.entry.js +9 -12
  58. package/dist/esm/road-badge_14.entry.js.map +1 -1
  59. package/dist/roadtrip/{p-e2a00f9c.entry.js → p-b5c4455e.entry.js} +3 -3
  60. package/dist/roadtrip/p-b5c4455e.entry.js.map +1 -0
  61. package/dist/roadtrip/roadtrip.esm.js +1 -1
  62. package/dist/types/components/drawer/drawer.d.ts +0 -1
  63. package/hydrate/index.js +271 -255
  64. package/hydrate/index.mjs +271 -255
  65. package/package.json +1 -1
  66. package/dist/roadtrip/p-e2a00f9c.entry.js.map +0 -1
@@ -18,110 +18,96 @@ export default {
18
18
  argTypes: {
19
19
  'is-open': {
20
20
  control: 'boolean',
21
+ description: 'Defines whether the dialog is open or closed.',
21
22
  },
22
23
  'has-close-icon': {
23
24
  control: 'boolean',
25
+ description: 'Displays a close icon in the dialog header.',
24
26
  },
25
27
  color: {
26
28
  options: ['info', 'success', 'warning', 'danger'],
27
- control: {
28
- type: 'radio',
29
- },
29
+ control: { type: 'radio' },
30
+ description: 'Sets the color theme of the dialog.',
30
31
  },
31
32
  icon: {
32
33
  options: list,
33
- control: {
34
- type: 'select',
35
- },
34
+ control: { type: 'select' },
35
+ description: 'Defines the icon displayed in the dialog.',
36
36
  },
37
37
  label: {
38
38
  control: 'text',
39
+ description: 'Sets the dialog title.',
39
40
  },
40
41
  description: {
41
42
  control: 'text',
42
- },
43
- close: {
44
- control: {
45
- type: null,
46
- },
43
+ description: 'Defines the main text content of the dialog.',
47
44
  },
48
45
  ' ': {
49
46
  control: 'text',
47
+ description: 'Slot for additional content (buttons, links, etc.).',
50
48
  },
51
49
  '--z-index': {
52
- table: {
53
- defaultValue: { summary: '3' },
54
- },
55
- control: {
56
- type: null,
57
- },
58
- },
59
- 'dialog-icon': {
60
- control: {
61
- type: null,
62
- },
50
+ table: { defaultValue: { summary: '3' } },
51
+ control: 'text',
52
+ description: 'Defines the z-index of the dialog.',
63
53
  },
64
54
  },
55
+ args: {
56
+ 'is-open': true,
57
+ 'has-close-icon': true,
58
+ color: 'info',
59
+ label: 'Dialog title',
60
+ description: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.',
61
+ ' ': `<div class="road-button-group">
62
+ <road-button class="mb-0" color="primary" expand>Done</road-button>
63
+ </div>`,
64
+ },
65
65
  };
66
66
 
67
67
  const Template = (args) => html`
68
- <road-dialog
69
- is-open="${ifDefined(args['is-open'])}"
70
- color="${ifDefined(args.color)}"
71
- .icon="${ifDefined(args.icon)}"
72
- label="${ifDefined(args.label)}"
73
- description="${ifDefined(args.description)}"
74
- has-close-icon="${ifDefined(args['has-close-icon'])}"
75
- >
76
- ${unsafeHTML(args[' '])}
77
- </road-dialog>
68
+ <road-dialog
69
+ ?is-open="${args['is-open']}"
70
+ ?has-close-icon="${args['has-close-icon']}"
71
+ color="${ifDefined(args.color)}"
72
+ .icon="${ifDefined(args.icon)}"
73
+ label="${ifDefined(args.label)}"
74
+ description="${ifDefined(args.description)}"
75
+ style="--z-index: ${ifDefined(args['--z-index'])};"
76
+ >
77
+ ${unsafeHTML(args[' '])}
78
+ </road-dialog>
78
79
  `;
79
80
 
80
81
  export const Playground = Template.bind({});
81
- Playground.args = {
82
- 'is-open': true,
83
- label: 'Dialog title',
84
- description: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.',
85
- ' ': `<road-button class="mb-0" color="primary" expand>Done</road-button>`,
86
- };
87
82
 
88
83
  export const SideActions = Template.bind({});
89
84
  SideActions.args = {
90
- 'is-open': true,
91
- label: 'Dialog title',
92
- description: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.',
93
- ' ': `<road-button class="mb-0" outline expand data-dismiss="modal">Cancel</road-button>
94
- <road-button class="mb-0" color="primary" expand style="margin-left: 1rem;">Done</road-button>`,
85
+ ' ': `<div class="road-button-group">
86
+ <road-button class="mb-0" outline expand data-dismiss="modal">Cancel</road-button>
87
+ <road-button class="mb-0" color="primary" expand style="margin-left: 1rem;">Done</road-button>
88
+ </div>`,
95
89
  };
96
90
 
97
91
  export const Info = Template.bind({});
98
92
  Info.args = {
99
- 'is-open': true,
100
93
  color: 'info',
101
94
  label: 'Information',
102
- description: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.',
103
95
  };
104
96
 
105
97
  export const Success = Template.bind({});
106
98
  Success.args = {
107
- 'is-open': true,
108
99
  color: 'success',
109
100
  label: 'Success',
110
- description: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.',
111
101
  };
112
102
 
113
103
  export const Warning = Template.bind({});
114
104
  Warning.args = {
115
- 'is-open': true,
116
105
  color: 'warning',
117
106
  label: 'Warning',
118
- description: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.',
119
107
  };
120
108
 
121
109
  export const Danger = Template.bind({});
122
110
  Danger.args = {
123
- 'is-open': true,
124
111
  color: 'danger',
125
112
  label: 'Danger',
126
- description: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.',
127
113
  };
@@ -120,21 +120,18 @@ export class Drawer {
120
120
  item.addEventListener('click', () => this.close());
121
121
  });
122
122
  }
123
- hasFooterContent() {
124
- const footerSlot = this.el.querySelector('[slot="footer"]');
125
- return footerSlot !== null && footerSlot.childElementCount > 0;
126
- }
127
123
  render() {
124
+ var _a, _b, _c;
128
125
  const drawerIsOpenClass = this.isOpen ? 'drawer-open' : '';
129
126
  const inverseHeaderClass = this.hasInverseHeader ? 'drawer-header-inverse' : '';
130
- const ariaLabel = this.ariaLabel !== undefined ? this.ariaLabel : 'drawer';
131
- const ariaLabelBack = this.ariaLabelBack !== undefined ? this.ariaLabelBack : 'Back';
132
- const ariaLabelClose = this.ariaLabelClose !== undefined ? this.ariaLabelClose : 'Close';
133
- const drawerDelimiterClass = this.drawerTitle !== undefined && !this.hasInverseHeader ? 'drawer-delimiter' : '';
134
- 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) : '';
135
- 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" })) : '';
136
- const drawerWidthValue = this.position === 'bottom' ? '100%' : this.drawerWidth + 'px';
137
- return (h(Host, { key: '61d6f770f9f56ddb21b19f1f8577f5e518325790', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": `${ariaLabel}` }, h("div", { key: 'e04193694e300e84f773d731619db83e1513a4db', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), h("div", { key: '5b19f360e5db980562ccd3991823a31161f5349b', class: "drawer-dialog", style: { maxWidth: `${drawerWidthValue}` }, role: "document", tabindex: "0" }, h("div", { key: '09320757e8c8fdda7770160241f3d185ac933d14', class: "drawer-content" }, h("header", { key: '1b37b3c4e8ec75391f5c068585ecbe22c4c39ddd', class: `drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}` }, backIconElement, this.drawerTitle !== undefined ? h("h2", { class: "drawer-title" }, this.drawerTitle) : h("div", { class: "drawer-title" }, h("slot", { name: "title" })), closeIconElement), h("div", { key: '84ee063113d185a40f869ecee89db960d530a59f', class: "drawer-body" }, h("slot", { key: 'dd1b3ed184198ffe6ccd83f4c5698577933a55e7' })), this.hasFooterContent() && (h("footer", { key: '7e0c367c1a8309464e2ffaefaf759cd5162172c7', class: "drawer-footer" }, h("slot", { key: '1fb2d6fc4e20b8853b0a1d95a9a7169defc4a5ae', name: "footer" })))))));
127
+ const ariaLabel = (_a = this.ariaLabel) !== null && _a !== void 0 ? _a : 'drawer';
128
+ const ariaLabelBack = (_b = this.ariaLabelBack) !== null && _b !== void 0 ? _b : 'Back';
129
+ const ariaLabelClose = (_c = this.ariaLabelClose) !== null && _c !== void 0 ? _c : 'Close';
130
+ const drawerDelimiterClass = this.drawerTitle && !this.hasInverseHeader ? 'drawer-delimiter' : '';
131
+ 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;
132
+ 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;
133
+ const drawerWidthValue = this.position === 'bottom' ? '100%' : `${this.drawerWidth}px`;
134
+ return (h(Host, { key: 'fd9a5a869879812bd6abeba3ae3da032bf188e1e', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": ariaLabel }, h("div", { key: 'fcf28c064fc710f7c5a38bb98d56799d2f367cfd', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), h("div", { key: 'a8e366d98d6d686cde4fbeb1c99080ca4f3cb317', class: "drawer-dialog", style: { maxWidth: drawerWidthValue }, role: "document", tabindex: "0" }, h("div", { key: '9a67f4e0e4080d2933b6fce68cc0ea38a9bc301e', class: "drawer-content" }, h("header", { key: '9c04a1b883cb9437212aeb07de19725d5fb98266', 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: 'f182bf146ffd3153bfb5b0faaa51fe8ac7b8627e', class: "drawer-body" }, h("slot", { key: 'da7ef62fdb134dad252ba7cbcc831584ac98552b' })), h("footer", { key: 'cf8ee470742208e0523eecb97dd74b9ec4303127', class: "drawer-footer" }, h("slot", { key: '50c4ed9e0e0f7dd98124a273a7af85aa8f89f319', name: "footer" }))))));
138
135
  }
139
136
  static get is() { return "road-drawer"; }
140
137
  static get encapsulation() { return "shadow"; }
@@ -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,EAA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E,IAAI,CAC1B,+DAAQ,KAAK,EAAC,eAAe;wBAC3B,6DAAM,IAAI,EAAC,QAAQ,GAAE,CACd,CACV,CACG,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Listen, Method, Prop, h, Host, Watch } from '@stencil/core';\nimport { navigationClose, navigationChevron } from '../../../icons';\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 * 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 * 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\n setTimeout(() => this.focusFirstButton(), 50); // Add a slight delay to ensure the element is rendered\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 * Find and focus the first button element in the drawer\n */\n private focusFirstButton() {\n const buttonElement = this.el.shadowRoot?.querySelector('button') as HTMLElement;\n \n if (buttonElement) {\n buttonElement.focus(); // Focus the first button element\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\n private hasFooterContent(): boolean {\n const footerSlot = this.el.querySelector('[slot=\"footer\"]');\n return footerSlot !== null && footerSlot.childElementCount > 0;\n }\n\n render() {\n const drawerIsOpenClass = this.isOpen ? 'drawer-open' : '';\n const inverseHeaderClass = this.hasInverseHeader ? 'drawer-header-inverse' : '';\n const ariaLabel = this.ariaLabel !== undefined ? this.ariaLabel : 'drawer';\n const ariaLabelBack = this.ariaLabelBack !== undefined ? this.ariaLabelBack : 'Back';\n const ariaLabelClose = this.ariaLabelClose !== undefined ? this.ariaLabelClose : 'Close';\n const drawerDelimiterClass = this.drawerTitle !== undefined && !this.hasInverseHeader ? 'drawer-delimiter' : '';\n const backIconElement = this.hasBackIcon ? <button type=\"button\" class=\"drawer-action\" aria-label={`${ariaLabelBack}`} onClick={this.onClickBack}><road-icon icon={navigationChevron} rotate=\"180\"></road-icon>{this.backText}</button> : '';\n const closeIconElement = this.hasCloseIcon ? <button type=\"button\" class=\"drawer-close\" onClick={this.onClick} aria-label={`${ariaLabelClose}`}><road-icon icon={navigationClose} aria-hidden=\"true\"></road-icon></button> : '';\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 !== undefined ? <h2 class=\"drawer-title\">{this.drawerTitle}</h2> : <div class=\"drawer-title\"><slot name=\"title\" /></div>}\n {closeIconElement}\n </header>\n <div class=\"drawer-body\">\n <slot/>\n </div>\n {this.hasFooterContent() && (\n <footer class=\"drawer-footer\">\n <slot name=\"footer\"/>\n </footer>\n )}\n </div>\n </div>\n </Host>\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,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9G,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;;;;;;;GAQG;AAQH,MAAM,OAAO,MAAM;IALnB;QAYE;;WAEG;QACsB,WAAM,GAAY,KAAK,CAAC;QAEjD;;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;QAgFrC;;WAEG;QACK,YAAO,GAAG,CAAC,EAAW,EAAE,EAAE;YAChC,EAAE,CAAC,eAAe,EAAE,CAAC;YACrB,EAAE,CAAC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B,IAAI,oBAAoB,EAAE;wBACzE,eAAe;wBACf,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;4BACvB,YAAM,IAAI,EAAC,OAAO,GAAG,CACjB,CACP;wBACA,gBAAgB,CACV;oBACT,4DAAK,KAAK,EAAC,aAAa;wBACtB,8DAAQ,CACJ;oBACN,+DAAQ,KAAK,EAAC,eAAe;wBAC3B,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 } from '@stencil/core';\nimport { navigationClose, navigationChevron } from '../../../icons';\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 * 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 * 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\n setTimeout(() => this.focusFirstButton(), 50); // Add a slight delay to ensure the element is rendered\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 * Find and focus the first button element in the drawer\n */\n private focusFirstButton() {\n const buttonElement = this.el.shadowRoot?.querySelector('button') as HTMLElement;\n \n if (buttonElement) {\n buttonElement.focus(); // Focus the first button element\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\n render() {\n const drawerIsOpenClass = this.isOpen ? 'drawer-open' : '';\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\">\n <slot />\n </div>\n <footer class=\"drawer-footer\">\n <slot name=\"footer\" />\n </footer>\n </div>\n </div>\n </Host>\n );\n }\n \n}"]}
@@ -17,198 +17,129 @@ export default {
17
17
  argTypes: {
18
18
  'is-open': {
19
19
  control: 'boolean',
20
+ description: 'Defines whether the drawer is open or closed.',
20
21
  },
21
22
  'has-back-icon': {
22
23
  control: 'boolean',
24
+ description: 'Displays a back arrow icon in the header.',
23
25
  },
24
26
  'back-text': {
25
27
  control: 'text',
28
+ description: 'Text label for the back button.',
26
29
  },
27
30
  'has-close-icon': {
28
31
  control: 'boolean',
32
+ description: 'Displays a close (X) icon in the header.',
29
33
  },
30
34
  'has-inverse-header': {
31
35
  control: 'boolean',
36
+ description: 'Uses an inverse color scheme for the header.',
32
37
  },
33
38
  position: {
34
39
  options: ['left', 'bottom', 'right'],
35
- control: {
36
- type: 'radio',
37
- },
40
+ control: { type: 'radio' },
41
+ description: 'Defines the drawer position.',
38
42
  },
39
43
  'drawer-width': {
40
44
  control: 'number',
41
- min: 0,
45
+ description: 'Sets the width of the drawer (only applicable for side drawers).',
46
+ table: {
47
+ defaultValue: { summary: 480 },
48
+ },
42
49
  },
43
50
  'drawer-title': {
44
51
  control: 'text',
52
+ description: 'Defines the title displayed in the drawer header.',
45
53
  },
46
- 'footer': {
54
+ footer: {
47
55
  control: 'text',
56
+ description: ' `<div slot="footer"><road-button color="primary" outline="true" expand="true">Annuler</road-button>`\n` <road-button color="primary" expand="true">Envoyer</road-button></div>`',
48
57
  },
49
- // mode: {
50
- // options: ['light', 'dark'],
51
- // control: {
52
- // type: null,
53
- // },
54
- // },
55
- 'title': {
58
+ title: {
56
59
  control: 'text',
60
+ description: 'Custom title slot for advanced customization.',
57
61
  },
58
62
  'aria-label': {
59
63
  control: 'text',
64
+ description: 'ARIA label for accessibility.',
60
65
  },
61
66
  'aria-label-back': {
62
67
  control: 'text',
68
+ description: 'ARIA label for the back button.',
63
69
  },
64
70
  'aria-label-close': {
65
71
  control: 'text',
72
+ description: 'ARIA label for the close button.',
66
73
  },
67
74
  ' ': {
68
75
  control: 'text',
76
+ description: 'Main content inside the drawer.',
69
77
  },
70
- open: {
71
- control: {
72
- type: null,
73
- },
74
- },
75
- close: {
76
- control: {
77
- type: null,
78
- },
79
- },
80
- back: {
81
- control: {
82
- type: null,
83
- },
78
+ '--z-index': {
79
+ table: { defaultValue: { summary: '10' } },
80
+ control: 'text',
81
+ description: 'Defines the z-index of the drawer.',
84
82
  },
85
83
  '--background': {
86
- table: {
87
- defaultValue: { summary: 'var(--road-grey-000)' },
88
- },
89
- control: {
90
- type: null,
91
- },
92
- },
93
- '--color': {
94
- table: {
95
- defaultValue: { summary: 'var(--road-grey-900)' },
96
- },
97
- control: {
98
- type: null,
99
- },
100
- },
101
- '--header-icon': {
102
- table: {
103
- defaultValue: { summary: 'var(--road-grey-900)' },
104
- },
105
- control: {
106
- type: null,
107
- },
108
- },
109
- '--header-color': {
110
- table: {
111
- defaultValue: { summary: 'var(--road-grey-900)' },
112
- },
113
- control: {
114
- type: null,
115
- },
116
- },
117
- '--header-background': {
118
- table: {
119
- defaultValue: { summary: 'var(--road-grey-000)' },
120
- },
121
- control: {
122
- type: null,
123
- },
124
- },
125
- '--header-delimiter': {
126
- table: {
127
- defaultValue: { summary: '0' },
128
- },
129
- control: {
130
- type: null,
131
- },
132
- },
133
- '--back-chevron-color': {
134
- table: {
135
- defaultValue: { summary: 'var(--road-grey-900)' },
136
- },
137
- control: {
138
- type: null,
139
- },
140
- },
141
- '--max-height': {
142
- table: {
143
- defaultValue: { summary: 'auto' },
144
- },
145
- control: {
146
- type: null,
147
- },
148
- },
149
- '--z-index': {
150
- table: {
151
- defaultValue: { summary: '10' },
152
- },
153
- control: {
154
- type: null,
155
- },
84
+ table: { defaultValue: { summary: 'var(--road-grey-000)' } },
85
+ control: 'text',
86
+ description: 'Sets the background color of the drawer.',
156
87
  },
157
88
  },
158
89
  args: {
159
90
  'is-open': true,
160
- position: null,
161
- 'drawer-width': null,
162
- 'has-inverse-header': null,
163
- 'has-back-icon': null,
164
- 'has-close-icon': undefined,
91
+ position: 'right',
92
+ 'drawer-width': 480,
93
+ 'has-inverse-header': false,
94
+ 'has-back-icon': false,
95
+ 'has-close-icon': true,
96
+ 'drawer-title': 'Drawer title',
97
+ ' ': `<div class="p-16">
98
+ <p>This is the drawer content.</p>
99
+ <road-button color="primary" expand>Confirm</road-button>
100
+ </div>`,
165
101
  },
166
102
  };
167
103
 
168
104
  const Template = (args) => html`
169
- <road-drawer
170
- is-open="${ifDefined(args['is-open'])}"
171
- position="${ifDefined(args.position)}"
172
- has-back-icon="${ifDefined(args['has-back-icon'])}"
173
- back-text="${ifDefined(args['back-text'])}"
174
- has-close-icon="${ifDefined(args['has-close-icon'])}"
175
- has-inverse-header="${ifDefined(args['has-inverse-header'])}"
176
- drawer-width="${ifDefined(args['drawer-width'])}"
177
- drawer-title="${ifDefined(args['drawer-title'])}"
178
- aria-label="${ifDefined(args['aria-label'])}"
179
- aria-label-back="${ifDefined(args['aria-label-back'])}"
180
- aria-label-close="${ifDefined(args['aria-label-close'])}"
181
- >
182
- ${unsafeHTML(args['title'])}
183
- ${unsafeHTML(args[' '])}
184
- ${unsafeHTML(args.footer)}
185
- </road-drawer>
105
+ <road-drawer
106
+ ?is-open="${args['is-open']}"
107
+ ?has-back-icon="${args['has-back-icon']}"
108
+ ?has-close-icon="${args['has-close-icon']}"
109
+ ?has-inverse-header="${args['has-inverse-header']}"
110
+ position="${ifDefined(args.position)}"
111
+ drawer-width="${ifDefined(args['drawer-width'])}"
112
+ drawer-title="${ifDefined(args['drawer-title'])}"
113
+ back-text="${ifDefined(args['back-text'])}"
114
+ aria-label="${ifDefined(args['aria-label'])}"
115
+ aria-label-back="${ifDefined(args['aria-label-back'])}"
116
+ aria-label-close="${ifDefined(args['aria-label-close'])}"
117
+ style="
118
+ --z-index: ${ifDefined(args['--z-index'])};
119
+ --background: ${ifDefined(args['--background'])};
120
+ "
121
+ >
122
+ ${unsafeHTML(args.title)}
123
+ ${unsafeHTML(args[' '])}
124
+ ${unsafeHTML(args.footer)}
125
+ </road-drawer>
186
126
  `;
187
127
 
188
128
  export const Playground = Template.bind({});
189
129
 
190
130
  export const HeaderInverse = Template.bind({});
191
131
  HeaderInverse.args = {
192
- 'is-open': true,
193
- position: 'right',
194
- 'drawer-width': 480,
195
- 'drawer-title': 'Drawer title',
132
+ 'has-inverse-header': true,
196
133
  };
197
134
 
198
135
  export const WithBackButton = Template.bind({});
199
136
  WithBackButton.args = {
200
- 'is-open': true,
201
- position: 'right',
202
- 'drawer-width': 480,
203
- 'drawer-title': 'Drawer title',
204
137
  'has-back-icon': true,
138
+ 'back-text': 'Back',
205
139
  };
206
140
 
207
- export const customTitle = Template.bind({});
208
- customTitle.args = {
209
- 'is-open': true,
210
- position: 'right',
211
- 'drawer-width': 480,
141
+ export const CustomTitle = Template.bind({});
142
+ CustomTitle.args = {
212
143
  title: `<div slot="title" class="d-flex align-items-center">
213
144
  <road-icon name="key" color="secondary" class="mr-16" role="img"></road-icon>
214
145
  <road-text color="secondary">618</road-text>
@@ -216,9 +147,8 @@ customTitle.args = {
216
147
  </div>`,
217
148
  };
218
149
 
219
- export const bottomDrawer = Template.bind({});
220
- bottomDrawer.args = {
221
- 'is-open': true,
150
+ export const BottomDrawer = Template.bind({});
151
+ BottomDrawer.args = {
222
152
  position: 'bottom',
223
153
  title: `<strong slot="title">Contact by SMS</strong>`,
224
154
  ' ': `<div class="bg-light p-16">