@roadtrip/components 3.28.0 → 3.30.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 (60) hide show
  1. package/dist/cjs/road-badge_14.cjs.entry.js +15 -4
  2. package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
  3. package/dist/cjs/road-phone-number-input.cjs.entry.js +1 -1
  4. package/dist/cjs/road-phone-number-input.cjs.entry.js.map +1 -1
  5. package/dist/cjs/road-tab-button.cjs.entry.js +1 -1
  6. package/dist/cjs/road-tab-button.cjs.entry.js.map +1 -1
  7. package/dist/cjs/road-toggle.cjs.entry.js +3 -2
  8. package/dist/cjs/road-toggle.cjs.entry.js.map +1 -1
  9. package/dist/cjs/road-tooltip.cjs.entry.js +23 -3
  10. package/dist/cjs/road-tooltip.cjs.entry.js.map +1 -1
  11. package/dist/collection/components/button/button.css +42 -2
  12. package/dist/collection/components/button/button.stories.js +13 -1
  13. package/dist/collection/components/drawer/drawer.css +8 -0
  14. package/dist/collection/components/input/input.js +12 -1
  15. package/dist/collection/components/input/input.js.map +1 -1
  16. package/dist/collection/components/input-group/input-group.css +9 -0
  17. package/dist/collection/components/input-group/input-group.stories.js +1 -1
  18. package/dist/collection/components/phone-number-input/phone-number-input.js +1 -1
  19. package/dist/collection/components/phone-number-input/phone-number-input.js.map +1 -1
  20. package/dist/collection/components/tab-button/tab-button.css +3 -2
  21. package/dist/collection/components/toggle/toggle.css +4 -0
  22. package/dist/collection/components/toggle/toggle.js +2 -1
  23. package/dist/collection/components/toggle/toggle.js.map +1 -1
  24. package/dist/collection/components/tooltip/tooltip.css +2 -0
  25. package/dist/collection/components/tooltip/tooltip.js +22 -2
  26. package/dist/collection/components/tooltip/tooltip.js.map +1 -1
  27. package/dist/esm/road-badge_14.entry.js +15 -4
  28. package/dist/esm/road-badge_14.entry.js.map +1 -1
  29. package/dist/esm/road-phone-number-input.entry.js +1 -1
  30. package/dist/esm/road-phone-number-input.entry.js.map +1 -1
  31. package/dist/esm/road-tab-button.entry.js +1 -1
  32. package/dist/esm/road-tab-button.entry.js.map +1 -1
  33. package/dist/esm/road-toggle.entry.js +3 -2
  34. package/dist/esm/road-toggle.entry.js.map +1 -1
  35. package/dist/esm/road-tooltip.entry.js +23 -3
  36. package/dist/esm/road-tooltip.entry.js.map +1 -1
  37. package/dist/roadtrip/p-1115f970.entry.js +2 -0
  38. package/dist/roadtrip/p-1115f970.entry.js.map +1 -0
  39. package/dist/roadtrip/p-2e7d3440.entry.js +2 -0
  40. package/dist/roadtrip/p-2e7d3440.entry.js.map +1 -0
  41. package/dist/roadtrip/p-36895fa7.entry.js +2 -0
  42. package/dist/roadtrip/p-36895fa7.entry.js.map +1 -0
  43. package/dist/roadtrip/p-37563bb6.entry.js +2 -0
  44. package/dist/roadtrip/p-37563bb6.entry.js.map +1 -0
  45. package/dist/roadtrip/{p-026e28b6.entry.js → p-8ac960ce.entry.js} +2 -2
  46. package/dist/roadtrip/{p-026e28b6.entry.js.map → p-8ac960ce.entry.js.map} +1 -1
  47. package/dist/roadtrip/roadtrip.css +1 -1
  48. package/dist/roadtrip/roadtrip.esm.js +1 -1
  49. package/dist/types/components/input/input.d.ts +1 -0
  50. package/dist/types/components/tooltip/tooltip.d.ts +6 -0
  51. package/hydrate/index.js +44 -12
  52. package/package.json +1 -1
  53. package/dist/roadtrip/p-49025654.entry.js +0 -2
  54. package/dist/roadtrip/p-49025654.entry.js.map +0 -1
  55. package/dist/roadtrip/p-a77727f2.entry.js +0 -2
  56. package/dist/roadtrip/p-a77727f2.entry.js.map +0 -1
  57. package/dist/roadtrip/p-c1dca3cc.entry.js +0 -2
  58. package/dist/roadtrip/p-c1dca3cc.entry.js.map +0 -1
  59. package/dist/roadtrip/p-f09d5d41.entry.js +0 -2
  60. package/dist/roadtrip/p-f09d5d41.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"phone-number-input.js","sourceRoot":"","sources":["../../../src/components/phone-number-input/phone-number-input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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Element, Host, State, h, Event, EventEmitter, Watch } from '@stencil/core';\nimport { PhoneNumberFormat, PhoneNumberType, PhoneNumberUtil } from 'google-libphonenumber';\nimport { CountryOption, CountryType, PhoneReturnType, ReturnObject } from './interfaces';\nimport { RoadInputCustomEvent } from '../../components';\n\nlet selectIds = 0;\n\n@Component({\n tag: 'road-phone-number-input',\n styleUrl: 'phone-number-input.css',\n scoped: true,\n})\nexport class RoadPhoneNumberInput {\n\n /** Computed phone data */\n @Event() roadPhoneNumberInput!: EventEmitter<{\n isError: boolean;\n phone: {\n numberType: string;\n countryCode: string;\n nationalNumber: string;\n code: string;\n internationalNumber: string;\n };\n }>;\n\n @Element() el!: HTMLRoadPhoneNumberInputElement;\n\n /** Disable both fields */\n @Prop() disabled: boolean = false;\n\n /** List of countries displayed in the country selection. Countries will be automatically sorted by alphabetical order (see format in example) */\n @Prop() countryData: CountryType[] = [];\n\n /** Used to display countries with the right language */\n @Prop() language: string = 'fr';\n\n /** Country selection placeHolder */\n @Prop() codeLabel: string = '';\n\n /** Phone input placeHolder */\n @Prop() phoneLabel: string = '';\n\n /** Value displayed in the phone input */\n @Prop() phoneValue?: string;\n\n /** Selected country code */\n @Prop() countryCode?: string;\n\n /** Error message (displayed only if ther is a message) */\n @Prop() errorMessage: string = '';\n\n /** Add a star in the phone input */\n @Prop() required = false;\n\n @State() selectedCountry: string = this.countryData[0].countryCode;\n @State() selectedCountryCode: string = this.countryData[0].phoneCode;\n @State() phoneNumber: string = '';\n @State() countryOptions: CountryOption[] = [];\n @State() returnObject: ReturnObject = {\n isError: false,\n phone: this.resetPhoneUtilData(),\n };\n\n @Watch('errorMessage')\n updateMessagePosition() {\n this.placeErrorMessage();\n }\n\n // On component load\n componentWillLoad() {\n this.placeErrorMessage();\n let fromSelect = false;\n\n if (this.phoneValue) {\n this.phoneNumber = this.phoneValue;\n }\n\n if (this.countryCode) {\n this.selectedCountry = this.countryCode;\n if (this.getPhoneCodeFromCountryCode(this.countryCode)) {\n this.updateSelectedCountryCode(this.getPhoneCodeFromCountryCode(this.countryCode)!);\n fromSelect = true;\n }\n }\n\n this.updateCountryOptions();\n this.createAndDispatchPhoneData(fromSelect);\n }\n\n // On user input\n handleInput(event: RoadInputCustomEvent<{\n value: string | null | undefined;\n }>) {\n this.phoneNumber = event.detail.value!;\n this.createAndDispatchPhoneData();\n }\n \n\n // On user key down\n handleKeyDown(event: KeyboardEvent) {\n // Liste des caractères interdits\n const caracteresInterdits = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z','!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '=', '[', ']', '{', '}', '|', ';', ':', \"'\", '\"', ',', '.', '<', '>', '/', '?'];\n \n // Vérifier si la touche pressée est dans la liste des caractères interdits\n if (caracteresInterdits.includes(event.key)) {\n event.preventDefault();\n }\n }\n\n // On user key up\n handleKeyUp(event: KeyboardEvent) {\n // Récupérer la valeur saisie\n const inputValue = (event.target as HTMLInputElement).value || '';\n\n // Vérifier si la valeur contient uniquement des chiffres ou le symbole \"+\"\n const containsOnlyNumbersAndPlus = /^[0-9+]*$/.test(inputValue);\n\n // Si la valeur ne contient pas uniquement des chiffres ou le symbole \"+\", réinitialiser le champ de saisie à son état précédent\n if (!containsOnlyNumbersAndPlus) {\n // Réinitialiser la valeur du champ de saisie à son état précédent\n (event.target as HTMLInputElement).value = this.phoneNumber;\n } else {\n // Si la valeur contient uniquement des chiffres ou le symbole \"+\", mettre à jour la valeur du numéro de téléphone\n this.phoneNumber = inputValue;\n this.createAndDispatchPhoneData();\n }\n }\n\n // On user select\n handleSelect(event: Event) {\n const select = event.target as HTMLSelectElement | null;\n if (select) {\n this.updateSelectedCountry(select.value);\n this.updateSelectedCountryCode(this.getPhoneCodeFromCountryCode(this.selectedCountry)!);\n }\n this.createAndDispatchPhoneData(true);\n this.updateCountryOptions();\n }\n\n createAndDispatchPhoneData(fromSelect?: boolean) {\n // Init phone util\n const phoneUtil = PhoneNumberUtil.getInstance();\n const PNF = PhoneNumberFormat;\n\n // Reset the return object data\n this.returnObject.phone = this.resetPhoneUtilData();\n\n const tmpCountry = this.selectedCountry.length ? this.selectedCountry : this.countryData[0].countryCode;\n\n try {\n const parsedPhoneNumber = phoneUtil.parse(this.phoneNumber, tmpCountry);\n this.returnObject.isError = !phoneUtil.isValidNumber(parsedPhoneNumber) && !this.isEmptyPhoneNumber();\n this.returnObject.phone.nationalNumber = phoneUtil.format(parsedPhoneNumber, PNF.NATIONAL);\n this.returnObject.phone.internationalNumber = phoneUtil.format(parsedPhoneNumber, PNF.INTERNATIONAL);\n\n // Set the country code values depending on the event origin\n if (phoneUtil.getRegionCodeForNumber(parsedPhoneNumber)) {\n if (fromSelect) {\n this.returnObject.isError = !(\n phoneUtil.isValidNumber(parsedPhoneNumber) &&\n phoneUtil.isValidNumberForRegion(parsedPhoneNumber, this.selectedCountry) &&\n !this.isEmptyPhoneNumber()\n );\n } else {\n this.updateSelectedCountryCode(parsedPhoneNumber.getCountryCode()!.toString());\n this.updateSelectedCountry(phoneUtil.getRegionCodeForNumber(parsedPhoneNumber)!);\n\n this.returnObject.phone.countryCode = this.selectedCountry;\n this.returnObject.phone.code = this.selectedCountryCode;\n }\n this.updateCountryOptions();\n }\n\n const phoneType = Object.entries(PhoneNumberType).find(entry => entry[1] === phoneUtil.getNumberType(parsedPhoneNumber))!;\n this.returnObject.phone.numberType = phoneType[0];\n } catch {} finally {\n this.roadPhoneNumberInput.emit(this.returnObject);\n }\n }\n\n // utils\n\n updateSelectedCountryCode(countryCode: string) {\n this.selectedCountryCode = countryCode;\n }\n\n updateSelectedCountry(value: string) {\n this.selectedCountry = value;\n }\n\n resetPhoneUtilData(): PhoneReturnType {\n return {\n numberType: 'UNKNOWN',\n countryCode: this.selectedCountry,\n code: this.selectedCountryCode,\n nationalNumber: this.phoneNumber,\n internationalNumber: this.phoneNumber,\n };\n }\n\n isEmptyPhoneNumber(): boolean {\n return !this.phoneNumber.length;\n }\n\n getPhoneCodeFromCountryCode(countryCode: string): string | undefined {\n return this.countryData.find(country => country.countryCode === countryCode)?.phoneCode;\n }\n\n updateCountryOptions() {\n const validLanguage = this.countryData[0].translations[this.language] ? this.language : 'fr';\n this.countryOptions = [\n ...this.countryData\n .sort((a, b) => a.translations[validLanguage].localeCompare(b.translations[validLanguage]))\n .map(country => ({\n value: country.countryCode,\n label: `${country.translations[validLanguage]} (+${country.phoneCode})`,\n selected: country.countryCode === this.selectedCountry,\n disabled: false,\n })\n ),\n {\n value: '',\n label: '--',\n selected: this.countryData.every((country) => country.countryCode !== this.selectedCountry),\n disabled: true,\n },\n ];\n }\n\n placeErrorMessage() {\n this.waitForElementToExist('.invalid-feedback').then((messError: HTMLElement) => {\n messError.style.display = \"flex\";\n messError.style.marginTop = \"-0.5rem\";\n const phoneNumberInput = (this.el as HTMLRoadPhoneNumberInputElement);\n phoneNumberInput.appendChild(messError);\n });\n }\n\n waitForElementToExist(selector: string): Promise<HTMLElement> {\n return new Promise(resolve => {\n if (document.querySelector(selector)) {\n return resolve(document.querySelector(selector) as HTMLElement);\n }\n\n const observer = new MutationObserver(() => {\n if (document.querySelector(selector)) {\n resolve(document.querySelector(selector) as HTMLElement);\n observer.disconnect();\n }\n });\n\n observer.observe(document.body, {\n subtree: true,\n childList: true,\n });\n });\n }\n\n render() {\n const selectId = `road-select-${selectIds++}`;\n const labelId = selectId + '-label';\n const valueId = selectId + '-value';\n const isInvalidClass = this.errorMessage.length ? 'is-invalid' : '';\n const isErrorClass = this.errorMessage.length ? 'is-error' : '';\n\n return (\n <Host>\n <road-input-group>\n <div class={`road-phone-input-select ${isErrorClass}`} slot=\"prepend\">\n <select\n id='phone-number-input'\n class={`form-select-area has-value ${isInvalidClass}`}\n aria-disabled={this.disabled ? 'true' : null}\n disabled={this.disabled}\n onChange={(event) => this.handleSelect(event)}\n aria-label={this.codeLabel}\n tabIndex={this.disabled ? -1 : 0}\n >\n {this.countryOptions && this.countryOptions.map(option => (\n <option value={option.value} disabled={option.disabled} selected={option.selected}>{option.label}</option>\n ))}\n </select>\n <label class=\"form-select-area-label\" id={labelId} htmlFor={selectId}>{this.codeLabel}</label>\n <label class=\"form-select-area-value\" id={valueId} htmlFor={selectId}>+{this.selectedCountryCode}</label>\n </div>\n <road-input\n id=\"phone-number\"\n sizes=\"xl\"\n label={this.phoneLabel}\n value={this.phoneValue}\n onRoadChange={(event) => this.handleInput(event)}\n required={this.required}\n error={this.errorMessage}\n onKeyDown={(event) => this.handleKeyDown(event)} // Lier la fonction handleKeyDown à l'événement onKeyDown\n tabIndex={0}\n >\n </road-input>\n </road-input-group>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"phone-number-input.js","sourceRoot":"","sources":["../../../src/components/phone-number-input/phone-number-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI5F,IAAI,SAAS,GAAG,CAAC,CAAC;AAOlB,MAAM,OAAO,oBAAoB;;oBAiBH,KAAK;uBAGI,EAAE;oBAGZ,IAAI;qBAGH,EAAE;sBAGD,EAAE;;;wBASA,EAAE;oBAGd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,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAG,MAAM,CAAC,KAAK,CAAU,CAC3G,CAAC,CACK;UACT,aAAO,KAAK,EAAC,wBAAwB,EAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,IAAG,IAAI,CAAC,SAAS,CAAS;UAC9F,aAAO,KAAK,EAAC,wBAAwB,EAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ;;YAAI,IAAI,CAAC,mBAAmB,CAAS,CACrG;QACN,kBACE,IAAI,EAAC,KAAK,EACV,EAAE,EAAC,cAAc,EACjB,KAAK,EAAC,IAAI,EACV,KAAK,EAAE,IAAI,CAAC,UAAU,EACtB,KAAK,EAAE,IAAI,CAAC,UAAU,EACtB,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAChD,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,KAAK,EAAE,IAAI,CAAC,YAAY,EACxB,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAC/C,QAAQ,EAAE,CAAC,GAEA,CACI,CACd,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Element, Host, State, h, Event, EventEmitter, Watch } from '@stencil/core';\nimport { PhoneNumberFormat, PhoneNumberType, PhoneNumberUtil } from 'google-libphonenumber';\nimport { CountryOption, CountryType, PhoneReturnType, ReturnObject } from './interfaces';\nimport { RoadInputCustomEvent } from '../../components';\n\nlet selectIds = 0;\n\n@Component({\n tag: 'road-phone-number-input',\n styleUrl: 'phone-number-input.css',\n scoped: true,\n})\nexport class RoadPhoneNumberInput {\n\n /** Computed phone data */\n @Event() roadPhoneNumberInput!: EventEmitter<{\n isError: boolean;\n phone: {\n numberType: string;\n countryCode: string;\n nationalNumber: string;\n code: string;\n internationalNumber: string;\n };\n }>;\n\n @Element() el!: HTMLRoadPhoneNumberInputElement;\n\n /** Disable both fields */\n @Prop() disabled: boolean = false;\n\n /** List of countries displayed in the country selection. Countries will be automatically sorted by alphabetical order (see format in example) */\n @Prop() countryData: CountryType[] = [];\n\n /** Used to display countries with the right language */\n @Prop() language: string = 'fr';\n\n /** Country selection placeHolder */\n @Prop() codeLabel: string = '';\n\n /** Phone input placeHolder */\n @Prop() phoneLabel: string = '';\n\n /** Value displayed in the phone input */\n @Prop() phoneValue?: string;\n\n /** Selected country code */\n @Prop() countryCode?: string;\n\n /** Error message (displayed only if ther is a message) */\n @Prop() errorMessage: string = '';\n\n /** Add a star in the phone input */\n @Prop() required = false;\n\n @State() selectedCountry: string = this.countryData[0].countryCode;\n @State() selectedCountryCode: string = this.countryData[0].phoneCode;\n @State() phoneNumber: string = '';\n @State() countryOptions: CountryOption[] = [];\n @State() returnObject: ReturnObject = {\n isError: false,\n phone: this.resetPhoneUtilData(),\n };\n\n @Watch('errorMessage')\n updateMessagePosition() {\n this.placeErrorMessage();\n }\n\n // On component load\n componentWillLoad() {\n this.placeErrorMessage();\n let fromSelect = false;\n\n if (this.phoneValue) {\n this.phoneNumber = this.phoneValue;\n }\n\n if (this.countryCode) {\n this.selectedCountry = this.countryCode;\n if (this.getPhoneCodeFromCountryCode(this.countryCode)) {\n this.updateSelectedCountryCode(this.getPhoneCodeFromCountryCode(this.countryCode)!);\n fromSelect = true;\n }\n }\n\n this.updateCountryOptions();\n this.createAndDispatchPhoneData(fromSelect);\n }\n\n // On user input\n handleInput(event: RoadInputCustomEvent<{\n value: string | null | undefined;\n }>) {\n this.phoneNumber = event.detail.value!;\n this.createAndDispatchPhoneData();\n }\n \n\n // On user key down\n handleKeyDown(event: KeyboardEvent) {\n // Liste des caractères interdits\n const caracteresInterdits = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z','!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '=', '[', ']', '{', '}', '|', ';', ':', \"'\", '\"', ',', '.', '<', '>', '/', '?'];\n \n // Vérifier si la touche pressée est dans la liste des caractères interdits\n if (caracteresInterdits.includes(event.key)) {\n event.preventDefault();\n }\n }\n\n // On user key up\n handleKeyUp(event: KeyboardEvent) {\n // Récupérer la valeur saisie\n const inputValue = (event.target as HTMLInputElement).value || '';\n\n // Vérifier si la valeur contient uniquement des chiffres ou le symbole \"+\"\n const containsOnlyNumbersAndPlus = /^[0-9+]*$/.test(inputValue);\n\n // Si la valeur ne contient pas uniquement des chiffres ou le symbole \"+\", réinitialiser le champ de saisie à son état précédent\n if (!containsOnlyNumbersAndPlus) {\n // Réinitialiser la valeur du champ de saisie à son état précédent\n (event.target as HTMLInputElement).value = this.phoneNumber;\n } else {\n // Si la valeur contient uniquement des chiffres ou le symbole \"+\", mettre à jour la valeur du numéro de téléphone\n this.phoneNumber = inputValue;\n this.createAndDispatchPhoneData();\n }\n }\n\n // On user select\n handleSelect(event: Event) {\n const select = event.target as HTMLSelectElement | null;\n if (select) {\n this.updateSelectedCountry(select.value);\n this.updateSelectedCountryCode(this.getPhoneCodeFromCountryCode(this.selectedCountry)!);\n }\n this.createAndDispatchPhoneData(true);\n this.updateCountryOptions();\n }\n\n createAndDispatchPhoneData(fromSelect?: boolean) {\n // Init phone util\n const phoneUtil = PhoneNumberUtil.getInstance();\n const PNF = PhoneNumberFormat;\n\n // Reset the return object data\n this.returnObject.phone = this.resetPhoneUtilData();\n\n const tmpCountry = this.selectedCountry.length ? this.selectedCountry : this.countryData[0].countryCode;\n\n try {\n const parsedPhoneNumber = phoneUtil.parse(this.phoneNumber, tmpCountry);\n this.returnObject.isError = !phoneUtil.isValidNumber(parsedPhoneNumber) && !this.isEmptyPhoneNumber();\n this.returnObject.phone.nationalNumber = phoneUtil.format(parsedPhoneNumber, PNF.NATIONAL);\n this.returnObject.phone.internationalNumber = phoneUtil.format(parsedPhoneNumber, PNF.INTERNATIONAL);\n\n // Set the country code values depending on the event origin\n if (phoneUtil.getRegionCodeForNumber(parsedPhoneNumber)) {\n if (fromSelect) {\n this.returnObject.isError = !(\n phoneUtil.isValidNumber(parsedPhoneNumber) &&\n phoneUtil.isValidNumberForRegion(parsedPhoneNumber, this.selectedCountry) &&\n !this.isEmptyPhoneNumber()\n );\n } else {\n this.updateSelectedCountryCode(parsedPhoneNumber.getCountryCode()!.toString());\n this.updateSelectedCountry(phoneUtil.getRegionCodeForNumber(parsedPhoneNumber)!);\n\n this.returnObject.phone.countryCode = this.selectedCountry;\n this.returnObject.phone.code = this.selectedCountryCode;\n }\n this.updateCountryOptions();\n }\n\n const phoneType = Object.entries(PhoneNumberType).find(entry => entry[1] === phoneUtil.getNumberType(parsedPhoneNumber))!;\n this.returnObject.phone.numberType = phoneType[0];\n } catch {} finally {\n this.roadPhoneNumberInput.emit(this.returnObject);\n }\n }\n\n // utils\n\n updateSelectedCountryCode(countryCode: string) {\n this.selectedCountryCode = countryCode;\n }\n\n updateSelectedCountry(value: string) {\n this.selectedCountry = value;\n }\n\n resetPhoneUtilData(): PhoneReturnType {\n return {\n numberType: 'UNKNOWN',\n countryCode: this.selectedCountry,\n code: this.selectedCountryCode,\n nationalNumber: this.phoneNumber,\n internationalNumber: this.phoneNumber,\n };\n }\n\n isEmptyPhoneNumber(): boolean {\n return !this.phoneNumber.length;\n }\n\n getPhoneCodeFromCountryCode(countryCode: string): string | undefined {\n return this.countryData.find(country => country.countryCode === countryCode)?.phoneCode;\n }\n\n updateCountryOptions() {\n const validLanguage = this.countryData[0].translations[this.language] ? this.language : 'fr';\n this.countryOptions = [\n ...this.countryData\n .sort((a, b) => a.translations[validLanguage].localeCompare(b.translations[validLanguage]))\n .map(country => ({\n value: country.countryCode,\n label: `${country.translations[validLanguage]} (+${country.phoneCode})`,\n selected: country.countryCode === this.selectedCountry,\n disabled: false,\n })\n ),\n {\n value: '',\n label: '--',\n selected: this.countryData.every((country) => country.countryCode !== this.selectedCountry),\n disabled: true,\n },\n ];\n }\n\n placeErrorMessage() {\n this.waitForElementToExist('.invalid-feedback').then((messError: HTMLElement) => {\n messError.style.display = \"flex\";\n messError.style.marginTop = \"-0.5rem\";\n const phoneNumberInput = (this.el as HTMLRoadPhoneNumberInputElement);\n phoneNumberInput.appendChild(messError);\n });\n }\n\n waitForElementToExist(selector: string): Promise<HTMLElement> {\n return new Promise(resolve => {\n if (document.querySelector(selector)) {\n return resolve(document.querySelector(selector) as HTMLElement);\n }\n\n const observer = new MutationObserver(() => {\n if (document.querySelector(selector)) {\n resolve(document.querySelector(selector) as HTMLElement);\n observer.disconnect();\n }\n });\n\n observer.observe(document.body, {\n subtree: true,\n childList: true,\n });\n });\n }\n\n render() {\n const selectId = `road-select-${selectIds++}`;\n const labelId = selectId + '-label';\n const valueId = selectId + '-value';\n const isInvalidClass = this.errorMessage.length ? 'is-invalid' : '';\n const isErrorClass = this.errorMessage.length ? 'is-error' : '';\n\n return (\n <Host>\n <road-input-group>\n <div class={`road-phone-input-select ${isErrorClass}`} slot=\"prepend\">\n <select\n id='phone-number-input'\n class={`form-select-area has-value ${isInvalidClass}`}\n aria-disabled={this.disabled ? 'true' : null}\n disabled={this.disabled}\n onChange={(event) => this.handleSelect(event)}\n aria-label={this.codeLabel}\n tabIndex={this.disabled ? -1 : 0}\n >\n {this.countryOptions && this.countryOptions.map(option => (\n <option value={option.value} disabled={option.disabled} selected={option.selected}>{option.label}</option>\n ))}\n </select>\n <label class=\"form-select-area-label\" id={labelId} htmlFor={selectId}>{this.codeLabel}</label>\n <label class=\"form-select-area-value\" id={valueId} htmlFor={selectId}>+{this.selectedCountryCode}</label>\n </div>\n <road-input\n type=\"tel\"\n id=\"phone-number\"\n sizes=\"xl\"\n label={this.phoneLabel}\n value={this.phoneValue}\n onRoadChange={(event) => this.handleInput(event)}\n required={this.required}\n error={this.errorMessage}\n onKeyDown={(event) => this.handleKeyDown(event)} // Lier la fonction handleKeyDown à l'événement onKeyDown\n tabIndex={0}\n >\n </road-input>\n </road-input-group>\n </Host>\n );\n }\n}\n"]}
@@ -140,9 +140,10 @@
140
140
  width: 100%;
141
141
  height: 2px;
142
142
  content: "";
143
- opacity: 0;
143
+ background-color: var(--road-input-outline);
144
+ opacity: 1;
144
145
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
145
- transform: scaleX(0);
146
+ transform: none;
146
147
  transform-origin: center;
147
148
  }
148
149
 
@@ -51,6 +51,10 @@
51
51
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
52
52
  }
53
53
 
54
+ .form-toggle-label.disabled{
55
+ cursor: not-allowed;
56
+ }
57
+
54
58
  /* LEVER
55
59
  -------------------- */
56
60
 
@@ -39,7 +39,8 @@ export class toggle {
39
39
  const textLabel = h("label", { class: "form-toggle-label", id: labelId, htmlFor: this.toggleId }, this.label);
40
40
  const isSpacedClass = this.isSpaced && 'form-toggle-spaced';
41
41
  const righttoggleClass = this.hasLeftLabel ? 'form-toggle-right' : '';
42
- return (h(Host, null, h("input", { class: "form-toggle-input", type: "checkbox", id: this.toggleId, 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", { class: `form-toggle-label ${isSpacedClass}`, htmlFor: this.toggleId }, this.hasLeftLabel && textLabel, h("div", { class: `form-toggle-lever ${righttoggleClass}`, "data-off": this.off, "data-on": this.on }), this.hasLeftLabel ? '' : textLabel)));
42
+ const disabledClass = this.disabled ? 'disabled' : '';
43
+ return (h(Host, null, h("input", { class: "form-toggle-input", type: "checkbox", id: this.toggleId, 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", { class: `form-toggle-label ${isSpacedClass} ${disabledClass}`, htmlFor: this.toggleId }, this.hasLeftLabel && textLabel, h("div", { class: `form-toggle-lever ${righttoggleClass}`, "data-off": this.off, "data-on": this.on }), this.hasLeftLabel ? '' : textLabel)));
43
44
  }
44
45
  static get is() { return "road-toggle"; }
45
46
  static get encapsulation() { return "scoped"; }
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../src/components/toggle/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,sBAAsB,CAAC;AAO9B,MAAM,OAAO,MAAM;;IA2FT,YAAO,GAAG,GAAG,EAAE;MACrB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC,CAAC;IAEM,YAAO,GAAG,GAAG,EAAE;MACrB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC;IAEM,WAAM,GAAG,GAAG,EAAE;MACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;MACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC,CAAC;oBAlGyB,eAAe,SAAS,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AO,EACxB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,GACnB;MACF,aAAO,KAAK,EAAE,qBAAqB,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ;QACvE,IAAI,CAAC,YAAY,IAAI,SAAS;QAC/B,WAAK,KAAK,EAAE,qBAAqB,gBAAgB,EAAE,cAAY,IAAI,CAAC,GAAG,aAAW,IAAI,CAAC,EAAE,GAAQ;QAChG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAC7B,CACH,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,SAAS,GAAG,CAAC,CAAC","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, Watch, h } from '@stencil/core';\nimport '../../utils/polyfill';\n\n@Component({\n tag: 'road-toggle',\n styleUrl: 'toggle.css',\n scoped: true,\n})\nexport class toggle {\n\n /**\n * The id of toggle\n */\n @Prop() toggleId: string = `road-toggle-${toggleIds++}`;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.toggleId;\n\n /**\n * If `true`, the toggle is checked.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * If `true`, the user cannot interact with the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * Label for the field\n */\n @Prop() label: string = `${this.toggleId}-label`;\n\n /**\n * If `true`, the label is at left of the toggle\n */\n @Prop() hasLeftLabel: boolean = false;\n\n /**\n * Add space between label and toggle element\n */\n @Prop() isSpaced: boolean = false;\n\n /**\n * Value the form will get\n */\n @Prop() value: string = 'on';\n\n /**\n * Text display for \"`on`\" state in the toggle lever\n */\n @Prop() on: string = \"yes\";\n\n /**\n * Text display for \"`off`\" state in the toggle lever\n */\n @Prop() off: string = \"no\";\n\n /**\n * Emitted when the checked property has changed.\n */\n @Event() roadchange!: EventEmitter<{\n checked: boolean;\n value: string | undefined | null\n }>;\n /** @internal */\n @Event() roadChange!: EventEmitter<{\n checked: boolean;\n value: string | undefined | null\n }>;\n\n /**\n * Emitted when the toggle has focus.\n */\n @Event() roadfocus!: EventEmitter<void>;\n /** @internal */\n @Event() roadFocus!: EventEmitter<void>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() roadblur!: EventEmitter<void>;\n /** @internal */\n @Event() roadBlur!: EventEmitter<void>;\n\n @Watch('checked')\n checkedChanged(isChecked: boolean) {\n this.roadchange.emit({\n checked: isChecked,\n value: this.value,\n });\n this.roadChange.emit({\n checked: isChecked,\n value: this.value,\n });\n }\n\n private onClick = () => {\n this.checked = !this.checked;\n };\n\n private onFocus = () => {\n this.roadfocus.emit();\n this.roadFocus.emit();\n };\n\n private onBlur = () => {\n this.roadBlur.emit();\n this.roadblur.emit();\n };\n\n render() {\n const labelId = this.toggleId + '-label';\n const textLabel = <label class=\"form-toggle-label\" id={labelId} htmlFor={this.toggleId}>{this.label}</label>;\n const isSpacedClass = this.isSpaced && 'form-toggle-spaced';\n const righttoggleClass = this.hasLeftLabel ? 'form-toggle-right' : '';\n\n return (\n <Host>\n <input\n class=\"form-toggle-input\"\n type=\"checkbox\"\n id={this.toggleId}\n name={this.name}\n checked={this.checked}\n disabled={this.disabled}\n value={this.value}\n aria-checked={`${this.checked}`}\n aria-disabled={this.disabled ? 'true' : null}\n aria-labelledby={labelId}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n />\n <label class={`form-toggle-label ${isSpacedClass}`} htmlFor={this.toggleId}>\n {this.hasLeftLabel && textLabel}\n <div class={`form-toggle-lever ${righttoggleClass}`} data-off={this.off} data-on={this.on}></div>\n {this.hasLeftLabel ? '' : textLabel}\n </label>\n </Host>\n );\n }\n}\n\nlet toggleIds = 0;\n"]}
1
+ {"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../src/components/toggle/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,sBAAsB,CAAC;AAO9B,MAAM,OAAO,MAAM;;IA2FT,YAAO,GAAG,GAAG,EAAE;MACrB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC,CAAC;IAEM,YAAO,GAAG,GAAG,EAAE;MACrB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;MACtB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC;IAEM,WAAM,GAAG,GAAG,EAAE;MACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;MACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC,CAAC;oBAlGyB,eAAe,SAAS,EAAE,EAAE;gBAKhC,IAAI,CAAC,QAAQ;mBAKD,KAAK;oBAKrB,KAAK;iBAKA,GAAG,IAAI,CAAC,QAAQ,QAAQ;wBAKhB,KAAK;oBAKT,KAAK;iBAKT,IAAI;cAKP,KAAK;eAKJ,IAAI;;EA8B1B,cAAc,CAAC,SAAkB;IAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;MACnB,OAAO,EAAE,SAAS;MAClB,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAC;IAC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YAAY,IAAI,SAAS;QAC/B,WAAK,KAAK,EAAE,qBAAqB,gBAAgB,EAAE,cAAY,IAAI,CAAC,GAAG,aAAW,IAAI,CAAC,EAAE,GAAQ;QAChG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAC7B,CACH,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,SAAS,GAAG,CAAC,CAAC","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, Watch, h } from '@stencil/core';\nimport '../../utils/polyfill';\n\n@Component({\n tag: 'road-toggle',\n styleUrl: 'toggle.css',\n scoped: true,\n})\nexport class toggle {\n\n /**\n * The id of toggle\n */\n @Prop() toggleId: string = `road-toggle-${toggleIds++}`;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.toggleId;\n\n /**\n * If `true`, the toggle is checked.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * If `true`, the user cannot interact with the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * Label for the field\n */\n @Prop() label: string = `${this.toggleId}-label`;\n\n /**\n * If `true`, the label is at left of the toggle\n */\n @Prop() hasLeftLabel: boolean = false;\n\n /**\n * Add space between label and toggle element\n */\n @Prop() isSpaced: boolean = false;\n\n /**\n * Value the form will get\n */\n @Prop() value: string = 'on';\n\n /**\n * Text display for \"`on`\" state in the toggle lever\n */\n @Prop() on: string = \"yes\";\n\n /**\n * Text display for \"`off`\" state in the toggle lever\n */\n @Prop() off: string = \"no\";\n\n /**\n * Emitted when the checked property has changed.\n */\n @Event() roadchange!: EventEmitter<{\n checked: boolean;\n value: string | undefined | null\n }>;\n /** @internal */\n @Event() roadChange!: EventEmitter<{\n checked: boolean;\n value: string | undefined | null\n }>;\n\n /**\n * Emitted when the toggle has focus.\n */\n @Event() roadfocus!: EventEmitter<void>;\n /** @internal */\n @Event() roadFocus!: EventEmitter<void>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() roadblur!: EventEmitter<void>;\n /** @internal */\n @Event() roadBlur!: EventEmitter<void>;\n\n @Watch('checked')\n checkedChanged(isChecked: boolean) {\n this.roadchange.emit({\n checked: isChecked,\n value: this.value,\n });\n this.roadChange.emit({\n checked: isChecked,\n value: this.value,\n });\n }\n\n private onClick = () => {\n this.checked = !this.checked;\n };\n\n private onFocus = () => {\n this.roadfocus.emit();\n this.roadFocus.emit();\n };\n\n private onBlur = () => {\n this.roadBlur.emit();\n this.roadblur.emit();\n };\n\n render() {\n const labelId = this.toggleId + '-label';\n const textLabel = <label class=\"form-toggle-label\" id={labelId} htmlFor={this.toggleId}>{this.label}</label>;\n const isSpacedClass = this.isSpaced && 'form-toggle-spaced';\n const righttoggleClass = this.hasLeftLabel ? 'form-toggle-right' : '';\n const disabledClass = this.disabled ? 'disabled' : '';\n\n return (\n <Host>\n <input\n class=\"form-toggle-input\"\n type=\"checkbox\"\n id={this.toggleId}\n name={this.name}\n checked={this.checked}\n disabled={this.disabled}\n value={this.value}\n aria-checked={`${this.checked}`}\n aria-disabled={this.disabled ? 'true' : null}\n aria-labelledby={labelId}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n />\n <label class={`form-toggle-label ${isSpacedClass} ${disabledClass}`} htmlFor={this.toggleId}>\n {this.hasLeftLabel && textLabel}\n <div class={`form-toggle-lever ${righttoggleClass}`} data-off={this.off} data-on={this.on}></div>\n {this.hasLeftLabel ? '' : textLabel}\n </label>\n </Host>\n );\n }\n}\n\nlet toggleIds = 0;\n"]}
@@ -72,9 +72,11 @@
72
72
  }
73
73
 
74
74
  .tooltip-open {
75
+ visibility: visible;
75
76
  opacity: 1;
76
77
  }
77
78
 
79
+
78
80
  /* POSITION
79
81
  -------------------- */
80
82
 
@@ -21,13 +21,20 @@ export class Tooltip {
21
21
  this.close();
22
22
  }
23
23
  };
24
+ this.isKeyboardNavigation = false;
25
+ this.handleKeyDown = () => {
26
+ this.isKeyboardNavigation = true;
27
+ };
28
+ this.handleMouseDown = () => {
29
+ this.isKeyboardNavigation = false;
30
+ };
24
31
  this.onFocus = () => {
25
- if (this.hasTrigger('focus') || this.hasTrigger('hover')) {
32
+ if (this.isKeyboardNavigation && this.hasTrigger('hover')) {
26
33
  this.open();
27
34
  }
28
35
  };
29
36
  this.onBlur = () => {
30
- if (this.hasTrigger('focus') || this.hasTrigger('hover')) {
37
+ if (this.isKeyboardNavigation && this.hasTrigger('hover')) {
31
38
  this.close();
32
39
  }
33
40
  };
@@ -50,6 +57,19 @@ export class Tooltip {
50
57
  async close() {
51
58
  this.isOpen = false;
52
59
  }
60
+ // Écoute les événements pour détecter le mode d'interaction
61
+ componentDidMount() {
62
+ document.addEventListener('keydown', this.handleKeyDown);
63
+ document.addEventListener('mousedown', this.handleMouseDown);
64
+ }
65
+ componentDidLoad() {
66
+ document.addEventListener('keydown', this.handleKeyDown);
67
+ document.addEventListener('mousedown', this.handleMouseDown);
68
+ }
69
+ componentWillUnmount() {
70
+ document.removeEventListener('keydown', this.handleKeyDown);
71
+ document.removeEventListener('mousedown', this.handleMouseDown);
72
+ }
53
73
  hasTrigger(triggerType) {
54
74
  const triggers = this.trigger.split(' ');
55
75
  return triggers.includes(triggerType);
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,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,CAAC,MAAM,GAAG,KAAK,CAAC;EACtB,CAAC;EAgCO,UAAU,CAAC,WAAmB;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;EACxC,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IACH,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAC,GAAG,CAAE,8BAA8B;iCACrB,IAAI,CAAC,QAAQ;MAEpC,gCAAwB,IAAI,CAAC,SAAS,GAAI;MAE1C,WACE,IAAI,EAAC,SAAS,EACd,EAAE,EAAE,IAAI,CAAC,SAAS,EAClB,KAAK,EAAE;UACL,OAAO,EAAE,IAAI;UACb,cAAc,EAAE,IAAI,CAAC,MAAM;SAC5B,EACD,IAAI,EAAC,SAAS,iBACD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QAE3C,IAAI,CAAC,OAAO;QACb,YAAM,IAAI,EAAC,iBAAiB,GAAG,CAC3B,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,UAAU,GAAG,CAAC,CAAC","sourcesContent":["import { Component, Host, h, Prop, Method, Element } from '@stencil/core';\n\n/**\n * @slot tooltip-content - content of the tooltip, if you need to add html content, use this slot, otherwise use directly the content prop.\n *\n * @part tooltip - tooltip container\n */\n\n@Component({\n tag: 'road-tooltip',\n styleUrl: 'tooltip.css',\n shadow: true,\n})\nexport class Tooltip {\n\n @Element() el!: HTMLRoadTooltipElement;\n\n /**\n * The id of tooltip\n */\n @Prop() tooltipId: string = `road-tooltip-${++tooltipIds}`;\n\n /**\n * The tooltip's content.\n */\n @Prop() content = '';\n\n /**\n * The position of the tooltip.\n */\n @Prop() position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n | 'left' = 'top';\n\n /**\n * The content align of the tooltip.\n */\n @Prop() contentAlign:\n | 'center'\n | 'left' = 'center';\n\n /**\n * Indicates whether or not the tooltip is open. You can use this or the open/close methods.\n */\n @Prop({ mutable: true }) isOpen = false;\n\n /**\n * Controls how the tooltip is activated. Possible options include `click`, `hover`, `focus`. Multiple\n * options can be passed by separating them with a space. When manual is used, the tooltip must be activated\n * programmatically.\n */\n @Prop() trigger: string = 'hover';\n\n /**\n * Open the tooltip.\n */\n @Method()\n async open() {\n this.isOpen = true;\n }\n\n /**\n * Close the tooltip.\n */\n @Method()\n async close() {\n this.isOpen = false;\n }\n\n private onClick = () => {\n if (this.hasTrigger('click')) {\n this.isOpen ? this.close() : this.open();\n }\n };\n\n private onMouseOver = () => {\n if (this.hasTrigger('hover')) {\n this.open();\n }\n };\n\n private onMouseOut = () => {\n if (this.hasTrigger('hover')) {\n this.close();\n }\n };\n\n private onFocus = () => {\n if (this.hasTrigger('focus') || this.hasTrigger('hover')) {\n this.open();\n }\n };\n\n private onBlur = () => {\n if (this.hasTrigger('focus') || this.hasTrigger('hover')) {\n this.close();\n }\n };\n\n private hasTrigger(triggerType: string) {\n const triggers = this.trigger.split(' ');\n return triggers.includes(triggerType);\n }\n\n render() {\n return (\n <Host\n onMouseOver={this.onMouseOver}\n onMouseOut={this.onMouseOut}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n tabindex=\"0\" // Makes the element focusable\n data-tooltip-position={this.position}\n >\n <slot aria-describedby={this.tooltipId} />\n\n <div\n part=\"tooltip\"\n id={this.tooltipId}\n class={{\n tooltip: true,\n 'tooltip-open': this.isOpen,\n }}\n role=\"tooltip\"\n aria-hidden={!this.isOpen ? 'true' : 'false'}\n >\n {this.content}\n <slot name=\"tooltip-content\" />\n </div>\n </Host>\n );\n }\n}\n\nlet tooltipIds = 0;\n"]}
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE1E;;;;GAIG;AAOH,MAAM,OAAO,OAAO;;IA8DV,YAAO,GAAG,GAAG,EAAE;MACrB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;OAC1C;IACH,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;OACb;IACH,CAAC,CAAC;IAEM,eAAU,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;OACd;IACH,CAAC,CAAC;IAEI,yBAAoB,GAAG,KAAK,CAAC;IAmB7B,kBAAa,GAAG,GAAG,EAAE;MAC3B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACnC,CAAC,CAAC;IAEM,oBAAe,GAAG,GAAG,EAAE;MAC7B,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACpC,CAAC,CAAC;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CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;EACxC,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IACH,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAC,GAAG,CAAE,8BAA8B;iCACrB,IAAI,CAAC,QAAQ;MAEpC,gCAAwB,IAAI,CAAC,SAAS,GAAI;MAE1C,WACE,IAAI,EAAC,SAAS,EACd,EAAE,EAAE,IAAI,CAAC,SAAS,EAClB,KAAK,EAAE;UACL,OAAO,EAAE,IAAI;UACb,cAAc,EAAE,IAAI,CAAC,MAAM;SAC5B,EACD,IAAI,EAAC,SAAS,iBACD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QAE3C,IAAI,CAAC,OAAO;QACb,YAAM,IAAI,EAAC,iBAAiB,GAAG,CAC3B,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,UAAU,GAAG,CAAC,CAAC","sourcesContent":["import { Component, Host, h, Prop, Method, Element } from '@stencil/core';\n\n/**\n * @slot tooltip-content - content of the tooltip, if you need to add html content, use this slot, otherwise use directly the content prop.\n *\n * @part tooltip - tooltip container\n */\n\n@Component({\n tag: 'road-tooltip',\n styleUrl: 'tooltip.css',\n shadow: true,\n})\nexport class Tooltip {\n\n @Element() el!: HTMLRoadTooltipElement;\n\n /**\n * The id of tooltip\n */\n @Prop() tooltipId: string = `road-tooltip-${++tooltipIds}`;\n\n /**\n * The tooltip's content.\n */\n @Prop() content = '';\n\n /**\n * The position of the tooltip.\n */\n @Prop() position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n | 'left' = 'top';\n\n /**\n * The content align of the tooltip.\n */\n @Prop() contentAlign:\n | 'center'\n | 'left' = 'center';\n\n /**\n * Indicates whether or not the tooltip is open. You can use this or the open/close methods.\n */\n @Prop({ mutable: true }) isOpen = false;\n\n /**\n * Controls how the tooltip is activated. Possible options include `click`, `hover`, `focus`. Multiple\n * options can be passed by separating them with a space. When manual is used, the tooltip must be activated\n * programmatically.\n */\n @Prop() trigger: string = 'hover';\n\n /**\n * Open the tooltip.\n */\n @Method()\n async open() {\n this.isOpen = true;\n }\n\n /**\n * Close the tooltip.\n */\n @Method()\n async close() {\n this.isOpen = false;\n }\n\n private onClick = () => {\n if (this.hasTrigger('click')) {\n this.isOpen ? this.close() : this.open();\n }\n };\n\n private onMouseOver = () => {\n if (this.hasTrigger('hover')) {\n this.open();\n }\n };\n\n private onMouseOut = () => {\n if (this.hasTrigger('hover')) {\n this.close();\n }\n };\n\nprivate isKeyboardNavigation = false;\n\n// Écoute les événements pour détecter le mode d'interaction\ncomponentDidMount() {\n document.addEventListener('keydown', this.handleKeyDown);\n document.addEventListener('mousedown', this.handleMouseDown);\n}\n\ncomponentDidLoad() {\n document.addEventListener('keydown', this.handleKeyDown);\n document.addEventListener('mousedown', this.handleMouseDown);\n}\n\ncomponentWillUnmount() {\n document.removeEventListener('keydown', this.handleKeyDown);\n document.removeEventListener('mousedown', this.handleMouseDown);\n}\n\n\nprivate handleKeyDown = () => {\n this.isKeyboardNavigation = true;\n};\n\nprivate handleMouseDown = () => {\n this.isKeyboardNavigation = false;\n};\n\nprivate onFocus = () => {\n if (this.isKeyboardNavigation && this.hasTrigger('hover')) {\n this.open();\n }\n};\n\n\n private onBlur = () => {\n if (this.isKeyboardNavigation && this.hasTrigger('hover')) {\n this.close();\n }\n };\n\n private hasTrigger(triggerType: string) {\n const triggers = this.trigger.split(' ');\n return triggers.includes(triggerType);\n }\n\n render() {\n return (\n <Host\n onMouseOver={this.onMouseOver}\n onMouseOut={this.onMouseOut}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n tabindex=\"0\" // Makes the element focusable\n data-tooltip-position={this.position}\n >\n <slot aria-describedby={this.tooltipId} />\n\n <div\n part=\"tooltip\"\n id={this.tooltipId}\n class={{\n tooltip: true,\n 'tooltip-open': this.isOpen,\n }}\n role=\"tooltip\"\n aria-hidden={!this.isOpen ? 'true' : 'false'}\n >\n {this.content}\n <slot name=\"tooltip-content\" />\n </div>\n </Host>\n );\n }\n}\n\nlet tooltipIds = 0;\n"]}
@@ -20,7 +20,7 @@ const Badge = class {
20
20
  };
21
21
  Badge.style = badgeCss;
22
22
 
23
- const buttonCss = ":host{--border-radius:0.25rem;--font-size:var(--road-button-medium);--margin-bottom:1rem;--padding-start:1.5rem;--padding-end:1.5rem;box-sizing:border-box;display:inline-flex;display:-webkit-inline-flex;align-items:center;justify-content:center;height:3rem;padding:0;margin-bottom:var(--margin-bottom);font-family:var(--road-font, sans-serif);font-size:var(--font-size);font-weight:700;line-height:1.375;color:var(--road-grey-10);text-decoration:none;white-space:nowrap;vertical-align:middle;background:transparent;border:1px solid transparent;border-radius:var(--border-radius);transition:background 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}:host(:hover){text-decoration:none}:host(.focus-visible){text-decoration:underline;outline:auto}.button-native{position:relative;display:flex;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;padding:0 var(--padding-end) 0 var(--padding-start);margin:0;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;color:inherit;text-align:inherit;text-decoration:none;text-indent:inherit;text-overflow:inherit;text-transform:inherit;letter-spacing:inherit;white-space:inherit;cursor:pointer;background:transparent;border:none;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}:host(.btn-default:not([disabled]).focus-visible){background:var(--road-grey-80)}:host(.btn-primary){color:var(--road-on-button-primary);background:var(--road-button-primary)}:host(.btn-primary) ::slotted(road-icon){color:var(--road-on-button-primary)}:host(.btn-primary:not([disabled]):hover),:host(.btn-primary:not([disabled]).focus-visible){background:var(--road-button-primary-variant);outline:0}:host(.btn-secondary){color:var(--road-on-button-secondary);background:var(--road-button-secondary)}:host(.btn-secondary) ::slotted(road-icon){color:var(--road-on-button-secondary)}:host(.btn-secondary:not([disabled]):hover),:host(.btn-secondary:not([disabled]).focus-visible){background:var(--road-button-secondary-variant)}:host(.btn-link){font-weight:400;color:var(--road-link-primary);text-decoration:underline;background:transparent}:host(.btn-link:not([disabled]):hover),:host(.btn-link:not([disabled]).focus-visible){color:var(--road-primary-30)}:host(.btn-outline-primary),:host(.btn-outline-secondary),:host(.btn-outline-default){background:transparent}:host(.btn-outline-default){color:var(--road-on-surface-weak);background:var(--road-surface);border-color:var(--road-input-outline)}:host(.btn-outline-default) ::slotted(road-icon){color:var(--road-on-surface-weak)}:host(.btn-outline-default:hover),:host(.btn-outline-default.focus-visible){background:var(--road-grey-80)}:host(.btn-ghost) ::slotted(road-icon){color:var(--road-icon)}:host(.btn-ghost:hover),:host(.btn-ghost.focus-visible){background:var(--road-button-ghost-variant)}:host([aria-disabled].btn-outline-primary){background:none}:host(.btn-outline-primary){color:var(--road-button-primary);border-color:var(--road-button-tertiary-outline)}:host(.btn-outline-primary) ::slotted(road-icon){color:var(--road-button-primary)}:host(.btn-outline-primary:hover),:host(.btn-outline-primary.focus-visible){background:var(--road-button-tertiary-variant)}:host(.btn-outline-secondary){color:var(--road-button-secondary);border-color:var(--road-button-secondary)}:host(.btn-outline-secondary) ::slotted(road-icon){color:var(--road-button-secondary)}:host(.btn-outline-secondary:hover),:host(.btn-outline-secondary.focus-visible){background:var(--road-button-tertiary-variant)}:host([aria-disabled]){color:var(--road-on-surface-disabled);pointer-events:none;cursor:not-allowed;background-color:var(--road-surface-disabled);border-color:1px solid var(--road-surface-disabled)}:host([aria-disabled]) ::slotted(road-icon){color:var(--road-on-surface-disabled)}.button-native:disabled{cursor:not-allowed}::slotted([slot=\"start\"]){margin-right:0.5rem}::slotted([slot=\"end\"]){margin-left:0.5rem}:host(.btn-xl){height:3.5rem}:host(.btn-xl) ::slotted(road-icon){width:2rem;height:2rem}:host(.btn-icon.btn-xl){width:56px}:host(.btn-lg){height:3rem}:host(.btn-lg) ::slotted(road-icon){width:2rem;height:2rem}:host(.btn-icon.btn-lg){width:48px}:host(.btn-md){--font-size:var(--road-font-size-14);height:2.5rem}:host(.btn-md) ::slotted(road-icon){width:1.5rem;height:1.5rem}:host(.btn-icon.btn-md){width:40px}:host(.btn-sm){--font-size:var(--road-font-size-14);height:2rem}:host(.btn-sm) ::slotted(road-icon){width:1.25rem;height:1.25rem}:host(.btn-icon.btn-sm){width:32px}:host(.btn-block){width:100%}:host(.btn-icon) .button-native{padding:0}::slotted(road-badge){position:absolute;top:4px;left:calc(50% + 0.375rem);box-sizing:border-box;height:auto}";
23
+ const buttonCss = ":host{--border-radius:0.25rem;--font-size:var(--road-button-medium);--margin-bottom:1rem;--padding-start:1.5rem;--padding-end:1.5rem;box-sizing:border-box;display:inline-flex;display:-webkit-inline-flex;align-items:center;justify-content:center;height:3rem;padding:0;margin-bottom:var(--margin-bottom);font-family:var(--road-font, sans-serif);font-size:var(--font-size);font-weight:700;line-height:1.375;color:var(--road-grey-10);text-decoration:none;white-space:nowrap;vertical-align:middle;background:transparent;border:1px solid transparent;border-radius:var(--border-radius);transition:background 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}:host(:hover){text-decoration:none}:host(.focus-visible){text-decoration:underline;outline:auto}.button-native{position:relative;display:flex;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;padding:0 var(--padding-end) 0 var(--padding-start);margin:0;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;color:inherit;text-align:inherit;text-decoration:none;text-indent:inherit;text-overflow:inherit;text-transform:inherit;letter-spacing:inherit;white-space:inherit;cursor:pointer;background:transparent;border:none;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}:host(.btn-default:not([disabled]).focus-visible){background:var(--road-grey-80)}:host(.btn-primary){color:var(--road-on-button-primary);background:var(--road-button-primary)}:host(.btn-primary) ::slotted(road-icon){color:var(--road-on-button-primary)}:host(.btn-primary:not([disabled]):hover),:host(.btn-primary:not([disabled]).focus-visible){background:var(--road-button-primary-variant);outline:0}:host(.btn-secondary){color:var(--road-on-button-secondary);background:var(--road-button-secondary)}:host(.btn-secondary) ::slotted(road-icon){color:var(--road-on-button-secondary)}:host(.btn-secondary:not([disabled]):hover),:host(.btn-secondary:not([disabled]).focus-visible){background:var(--road-button-secondary-variant)}:host(.btn-destructive){color:var(--road-on-button-destructive-primary);background:var(--road-button-destructive-primary)}:host(.btn-destructive) ::slotted(road-icon){color:var(--road-on-button-destructive-primary)}:host(.btn-destructive:not([disabled]):hover),:host(.btn-destructive:not([disabled]).focus-visible){background:var(--road-button-destructive-primary-variant)}:host(.btn-link){font-weight:400;color:var(--road-link-primary);text-decoration:underline;background:transparent}:host(.btn-link:not([disabled]):hover),:host(.btn-link:not([disabled]).focus-visible){color:var(--road-primary-30)}:host(.btn-outline-primary),:host(.btn-outline-secondary),:host(.btn-outline-default),:host(.btn-outline-destructive){background:transparent}:host(.btn-outline-default){color:var(--road-on-surface-weak);background:var(--road-surface);border-color:var(--road-input-outline)}:host(.btn-outline-default) ::slotted(road-icon){color:var(--road-on-surface-weak)}:host(.btn-outline-default:hover),:host(.btn-outline-default.focus-visible){background:var(--road-grey-80)}:host(.btn-ghost){color:var(--road-on-button-ghost)}:host(.btn-ghost) ::slotted(road-icon){color:var(--road-on-button-ghost)}:host(.btn-ghost:hover),:host(.btn-ghost.focus-visible){background:var(--road-button-ghost-variant)}:host([aria-disabled].btn-outline-primary){background:none}:host(.btn-outline-primary){color:var(--road-button-primary);border-color:var(--road-button-tertiary-outline)}:host(.btn-outline-primary) ::slotted(road-icon){color:var(--road-button-primary)}:host(.btn-outline-primary:hover),:host(.btn-outline-primary.focus-visible){background:var(--road-button-tertiary-variant)}:host(.btn-outline-secondary){color:var(--road-button-secondary);border-color:var(--road-button-secondary)}:host(.btn-outline-secondary) ::slotted(road-icon){color:var(--road-button-secondary)}:host(.btn-outline-secondary:hover),:host(.btn-outline-secondary.focus-visible){background:var(--road-button-tertiary-variant)}:host(.btn-outline-destructive){color:var(--road-on-button-destructive-secondary);border-color:var(--road-button-destructive-outline)}:host(.btn-outline-destructive) ::slotted(road-icon){color:var(--road-on-button-destructive-secondary)}:host(.btn-outline-destructive:hover),:host(.btn-outline-destructive.focus-visible){background:var(--road-button-destructive-secondary-variant)}:host([aria-disabled]){color:var(--road-on-surface-disabled);pointer-events:none;cursor:not-allowed;background-color:var(--road-surface-disabled);border-color:1px solid var(--road-surface-disabled)}:host([aria-disabled]) ::slotted(road-icon){color:var(--road-on-surface-disabled)}.button-native:disabled{cursor:not-allowed}::slotted([slot=\"start\"]){margin-right:0.5rem}::slotted([slot=\"end\"]){margin-left:0.5rem}:host(.btn-xl){height:3.5rem}:host(.btn-xl) ::slotted(road-icon){width:2rem;height:2rem}:host(.btn-icon.btn-xl){width:56px}:host(.btn-lg){height:3rem}:host(.btn-lg) ::slotted(road-icon){width:2rem;height:2rem}:host(.btn-icon.btn-lg){width:48px}:host(.btn-md){--font-size:var(--road-font-size-14);height:2.5rem}:host(.btn-md) ::slotted(road-icon){width:1.5rem;height:1.5rem}:host(.btn-icon.btn-md){width:40px}:host(.btn-sm){--font-size:var(--road-font-size-14);height:2rem}:host(.btn-sm) ::slotted(road-icon){width:1.25rem;height:1.25rem}:host(.btn-icon.btn-sm){width:32px}:host(.btn-block){width:100%}:host(.btn-icon) .button-native{padding:0}::slotted(road-badge){position:absolute;top:4px;left:calc(50% + 0.375rem);box-sizing:border-box;height:auto}";
24
24
 
25
25
  const Button = class {
26
26
  constructor(hostRef) {
@@ -237,7 +237,7 @@ const Counter = class {
237
237
  let counterIds = 0;
238
238
  Counter.style = counterCss;
239
239
 
240
- const drawerCss = ":host{--background:var(--road-surface);--color:var(--road-on-surface);--header-icon:var(--road-on-surface);--header-color:var(--road-on-surface);--header-background:var(--road-surface);--header-delimiter:0;--back-chevron-color:var(--road-icon);--max-height:auto;--z-index:10;position:fixed;top:0;left:0;z-index:var(--z-index);display:flex;justify-content:flex-start;width:100%;height:100%;overflow:hidden;font-family:var(--road-font, sans-serif);line-height:1.5;color:var(--color);visibility:hidden !important;opacity:0;transition:opacity 0.15s linear, visibility 0.15s}.drawer-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:block;touch-action:none;cursor:pointer;background:var(--road-overlay)}.drawer-dialog{position:relative;width:100%;pointer-events:none;transition:transform 0.3s ease-out;transform:translateX(-100%)}:host(.drawer-right){justify-content:flex-end}:host(.drawer-right) .drawer-dialog{transform:translateX(100%)}:host(.drawer-bottom){align-items:flex-end}:host(.drawer-bottom) .drawer-dialog{width:100%;max-height:var(--max-height);transform:translateY(100%)}:host(.drawer-bottom) .drawer-content{height:auto}.drawer-content{position:relative;display:flex;flex-direction:column;width:100%;height:100vh;pointer-events:auto;background-color:var(--background);background-clip:padding-box;box-shadow:var(--road-elevation-hight)}.drawer-header{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;height:3.5rem;color:var(--header-color);background:var(--header-background);border-color:var(--road-grey-300);border-style:solid;border-width:var(--header-delimiter)}.drawer-header road-icon{flex-shrink:0;color:var(--header-icon)}.drawer-footer{padding:var(--road-spacing-05)}.drawer-header-inverse{--header-icon:var(--road-on-primary);--header-color:var(--road-on-primary);--header-background:var(--road-primary-variant);margin-bottom:2.5rem}.drawer-action,.drawer-close{display:flex;align-items:center;justify-content:center;height:3.5rem;padding:0.5rem;font-family:inherit;font-size:0.875rem;color:inherit;cursor:pointer;background:transparent;border:0;appearance:none;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.drawer-header:not(.drawer-header-inverse) .drawer-action road-icon{color:var(--back-chevron-color)}.drawer-action~.drawer-title,.drawer-close~.drawer-title{padding-left:0}.drawer-action-left,.drawer-close-left{margin-right:auto}.drawer-title{display:flex;flex-grow:1;align-items:center;justify-content:center;height:3.5rem;padding-left:3.5rem;margin:0;font-size:var(--road-body-medium)}.drawer-body{overflow-y:auto}:host(.drawer-right) .drawer-body,:host(.drawer-left) .drawer-body{height:calc(100vh - 3.5rem)}.drawer-inner{padding:0 1rem 2.5rem}@media (min-width: 768px){.drawer-inner{padding:0 2rem 2.5rem}}:host(.drawer-open){visibility:visible !important;opacity:1}:host(.drawer-open) .drawer-dialog{transform:none}";
240
+ const drawerCss = ":host{--background:var(--road-surface);--color:var(--road-on-surface);--header-icon:var(--road-on-surface);--header-color:var(--road-on-surface);--header-background:var(--road-surface);--header-delimiter:0;--back-chevron-color:var(--road-icon);--max-height:auto;--z-index:10;position:fixed;top:0;left:0;z-index:var(--z-index);display:flex;justify-content:flex-start;width:100%;height:100%;overflow:hidden;font-family:var(--road-font, sans-serif);line-height:1.5;color:var(--color);visibility:hidden !important;opacity:0;transition:opacity 0.15s linear, visibility 0.15s}.drawer-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:block;touch-action:none;cursor:pointer;background:var(--road-overlay)}.drawer-dialog{position:relative;width:100%;pointer-events:none;transition:transform 0.3s ease-out;transform:translateX(-100%)}:host(.drawer-right){justify-content:flex-end}:host(.drawer-right) .drawer-dialog{transform:translateX(100%)}:host(.drawer-bottom){align-items:flex-end}:host(.drawer-bottom) .drawer-dialog{width:100%;max-height:var(--max-height);transform:translateY(100%)}:host(.drawer-bottom) .drawer-content{height:auto}.drawer-content{position:relative;display:flex;flex-direction:column;width:100%;height:100vh;pointer-events:auto;background-color:var(--background);background-clip:padding-box;box-shadow:var(--road-elevation-hight)}.drawer-header{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;height:3.5rem;color:var(--header-color);background:var(--header-background);border-color:var(--road-grey-300);border-style:solid;border-width:var(--header-delimiter)}.drawer-header road-icon{flex-shrink:0;color:var(--header-icon)}.drawer-footer{padding:var(--road-spacing-05)}.drawer-header-inverse{--header-icon:var(--road-on-primary);--header-color:var(--road-on-primary);--header-background:var(--road-primary-variant);margin-bottom:2.5rem}.drawer-action,.drawer-close{display:flex;align-items:center;justify-content:center;height:3.5rem;padding:0.5rem;font-family:inherit;font-size:0.875rem;color:inherit;cursor:pointer;background:transparent;border:0;appearance:none;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.drawer-header:not(.drawer-header-inverse) .drawer-action road-icon{color:var(--back-chevron-color)}.drawer-action~.drawer-title,.drawer-close~.drawer-title{padding-left:0}.drawer-action-left,.drawer-close-left{margin-right:auto}.drawer-title{display:flex;flex-grow:1;align-items:center;justify-content:center;height:3.5rem;padding-left:3.5rem;margin:0;font-size:var(--road-body-medium)}.drawer-body{overflow-y:auto}:host(.drawer-right) .drawer-body,:host(.drawer-left) .drawer-body{height:calc(100vh - 3.5rem)}.drawer-inner{padding:0 1rem 2.5rem}@media (min-width: 768px){.drawer-inner{padding:0 2rem 2.5rem}.drawer-body{padding:0 var(--road-spacing-08) var(--road-spacing-05)}.drawer-footer{padding:var(--road-spacing-05) var(--road-spacing-08)}}:host(.drawer-open){visibility:visible !important;opacity:1}:host(.drawer-open) .drawer-dialog{transform:none}";
241
241
 
242
242
  const Drawer = class {
243
243
  constructor(hostRef) {
@@ -17790,6 +17790,17 @@ const Input = class {
17790
17790
  this.helper = undefined;
17791
17791
  this.debounce = 0;
17792
17792
  }
17793
+ handleKeyDown(event) {
17794
+ // Vérifier que le type est "number" avant d'appliquer les restrictions
17795
+ if (this.type === 'number') {
17796
+ // Liste des caractères interdits
17797
+ const forbiddenKeys = ['e', '-', '.', ',', '¨', '^', '`', '+'];
17798
+ // Empêcher la saisie si la touche est interdite
17799
+ if (forbiddenKeys.includes(event.key)) {
17800
+ event.preventDefault();
17801
+ }
17802
+ }
17803
+ }
17793
17804
  createDebouncedRoadChange() {
17794
17805
  return lodash.debounce((value) => {
17795
17806
  this.roadChange.emit({ value: value == null ? value : value.toString() });
@@ -17832,7 +17843,7 @@ const Input = class {
17832
17843
  const hasValueClass = this.value !== '' && this.value !== null ? 'has-value' : '';
17833
17844
  const lessLabelClass = this.label !== '' ? '' : 'less-label';
17834
17845
  const isInvalidClass = this.error !== undefined && this.error !== '' ? 'is-invalid' : '';
17835
- return (h(Host, { "aria-disabled": this.disabled ? 'true' : null, class: this.sizes && `input-${this.sizes}`, value: value }, h("input", { class: `form-control ${hasValueClass} ${isInvalidClass} ${lessLabelClass}`, id: this.inputId, "aria-disabled": this.disabled ? 'true' : null, "aria-labelledby": labelId, disabled: this.disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, enterKeyHint: this.enterkeyhint, autoFocus: this.autofocus, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, name: this.name, pattern: this.pattern, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, size: this.size, type: this.type, value: value, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyUp: (event) => this.enforceMinMax(event.target), "data-cy": 'road-input' }), h("label", { class: "form-label", id: labelId, htmlFor: this.inputId }, this.label), this.error && this.error !== '' && h("p", { class: "invalid-feedback" }, h("road-icon", { slot: "start", name: "alert-error-solid", "aria-hidden": "true", size: "sm" }), this.error), this.helper && this.helper !== '' && h("p", { class: "helper" }, this.helper), this.type && this.type == 'password' && h("slot", { name: "checklistPassword" })));
17846
+ return (h(Host, { "aria-disabled": this.disabled ? 'true' : null, class: this.sizes && `input-${this.sizes}`, value: value }, h("input", { class: `form-control ${hasValueClass} ${isInvalidClass} ${lessLabelClass}`, id: this.inputId, "aria-disabled": this.disabled ? 'true' : null, "aria-labelledby": labelId, disabled: this.disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, enterKeyHint: this.enterkeyhint, autoFocus: this.autofocus, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, name: this.name, pattern: this.pattern, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, step: this.step, size: this.size, type: this.type, value: value, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.type === 'number' ? (event) => this.handleKeyDown(event) : undefined, onKeyUp: (event) => this.enforceMinMax(event.target), "data-cy": 'road-input' }), h("label", { class: "form-label", id: labelId, htmlFor: this.inputId }, this.label), this.error && this.error !== '' && h("p", { class: "invalid-feedback" }, h("road-icon", { slot: "start", name: "alert-error-solid", "aria-hidden": "true", size: "sm" }), this.error), this.helper && this.helper !== '' && h("p", { class: "helper" }, this.helper), this.type && this.type == 'password' && h("slot", { name: "checklistPassword" })));
17836
17847
  }
17837
17848
  static get watchers() { return {
17838
17849
  "debounce": ["debounceChanged"],
@@ -17842,7 +17853,7 @@ const Input = class {
17842
17853
  let inputIds = 0;
17843
17854
  Input.style = inputCss;
17844
17855
 
17845
- const inputGroupCss = ":host{display:block}.input-group{position:relative;display:flex;flex-wrap:wrap;align-items:stretch;width:100%;font-family:var(--road-font, sans-serif)}::slotted(road-input),::slotted(input),::slotted(textarea),::slotted(road-select){position:relative;flex:1 1 auto;width:1%;margin-bottom:0}::slotted([slot=\"prepend\"]){margin-right:-3px;border-color:var(--road-input-outline);border-right-color:transparent;border-top-right-radius:0;border-bottom-right-radius:0}::slotted([slot=\"append\"]){margin-left:-0.25rem;border-color:var(--road-input-outline);border-left-width:0}@media (hover: hover){.input-group:not(.is-disabled):hover ::slotted([slot=\"prepend\"]){border-color:var(--road-input-outline-variant);border-right-color:transparent}.input-group:not(.is-disabled):hover ::slotted([slot=\"append\"]){border-color:var(--road-input-outline-variant);border-left-color:transparent}:host(.phone-number-group) .input-group:not(.is-disabled):hover ::slotted([slot=\"prepend\"]){border-color:var(--road-input-outline-variant)}}.input-group:focus-within ::slotted([slot=\"prepend\"]),:host(.phone-number-group) .input-group:focus-within ::slotted([slot=\"prepend\"]){border-color:var(--road-grey-0);border-width:2px;border-right-color:transparent;outline:none;}.input-group:focus-within ::slotted([slot=\"append\"]){border-color:var(--road-grey-0);border-width:2px;border-left-color:transparent;outline:none;}.input-group:focus-within ::slotted(road-input):focus-visible{border-color:var(--road-grey-0);border-width:2px;outline:none;}.input-group-prepend,.input-group-append{display:flex;height:3rem}::slotted(road-button){--padding-start:0.5rem;--padding-end:0.5rem;position:relative;z-index:2;min-width:3rem;margin:0;font-size:var(--road-font-size-14)}.input-group-prepend{z-index:1;order:-1}.input-group-prepend~.form-label{left:calc(3rem + 1px)}.input-group-append{position:relative;z-index:1;border-radius:0 0.25rem 0.25rem 0}::slotted(label){display:flex;align-items:center;padding:0 0.5rem;margin-bottom:0;color:var(--road-on-surface);text-align:center;white-space:nowrap;cursor:text;background:var(--road-surface);border:1px solid var(--road-input-outline);border-radius:0.25rem;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}::slotted(road-label){display:flex;align-items:center;padding:0 0.5rem;margin-bottom:0;color:var(--road-on-surface);text-align:center;white-space:nowrap;cursor:text;background:var(--road-surface);border:1px solid var(--road-input-outline);border-radius:0.25rem;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}::slotted(road-input:not(:first-child)),::slotted(road-select:not(:first-child)){border-radius:0}.input-group-append ::slotted([slot=\"append\"]){border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.input-group-prepend ::slotted([slot=\"prepend\"]){border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}:host(.phone-number-group) .input-group-prepend ::slotted([slot=\"prepend\"]){border-right:1px solid var(--road-input-outline);border-top-right-radius:0;border-bottom-right-radius:0}.input-group-prepend ::slotted(label){margin-right:calc(-1rem + 1px)}.input-group-append ::slotted(road-button){background-color:var(--road-surface)}.size-xl .input-group-prepend,.size-xl .input-group-append{height:3.5rem}.size-xl ::slotted(road-button){height:3.5rem}.input-group.is-invalid ::slotted([slot=\"append\"]),.input-group.is-invalid ::slotted([slot=\"prepend\"]){border-color:var(--road-danger-outline)}:host(.phone-number-group) .input-group.is-invalid ::slotted([slot=\"prepend\"]){border-color:var(--road-danger-outline)}:host([disabled]){cursor:not-allowed}:host([disabled]) .input-group{pointer-events:none;}:host([disabled]) ::slotted([slot=\"append\"]),:host([disabled]) ::slotted([slot=\"prepend\"]){color:var(--road-on-surface-disabled);cursor:not-allowed;background:#e4e5e9}:host([disabled]) ::slotted([slot=\"append\"] road-icon),:host([disabled]) ::slotted([slot=\"prepend\"] road-icon){color:var(--road-on-surface-disabled)}:host([disabled]) road-icon{color:var(--road-on-surface-disabled)}";
17856
+ const inputGroupCss = ":host{display:block}.input-group{position:relative;display:flex;flex-wrap:wrap;align-items:stretch;width:100%;font-family:var(--road-font, sans-serif)}::slotted(road-input),::slotted(input),::slotted(textarea),::slotted(road-select){position:relative;flex:1 1 auto;width:1%;margin-bottom:0}::slotted([slot=\"prepend\"]){margin-right:-3px;border-color:var(--road-input-outline);border-right-color:transparent;border-top-right-radius:0;border-bottom-right-radius:0}::slotted([slot=\"append\"]){margin-left:-0.25rem;border-color:var(--road-input-outline);border-left-width:0}@media (hover: hover){.input-group:not(.is-disabled):hover ::slotted([slot=\"prepend\"]){border-color:var(--road-input-outline-variant);border-right-color:transparent}.input-group:not(.is-disabled):hover ::slotted([slot=\"append\"]){border-color:var(--road-input-outline-variant);border-left-color:transparent}:host(.phone-number-group) .input-group:not(.is-disabled):hover ::slotted([slot=\"prepend\"]){border-color:var(--road-input-outline-variant)}}.input-group:focus-within ::slotted([slot=\"prepend\"]),:host(.phone-number-group) .input-group:focus-within ::slotted([slot=\"prepend\"]){border-color:var(--road-grey-0);border-width:2px;border-right-color:transparent;outline:none;}.input-group:focus-within ::slotted([slot=\"append\"]){border-color:var(--road-grey-0);border-width:2px;border-left-color:transparent;outline:none;}.input-group:focus-within ::slotted(road-input):focus-visible{border-color:var(--road-grey-0);border-width:2px;outline:none;}.input-group-prepend,.input-group-append{display:flex;height:3rem}::slotted(road-button){--padding-start:0.5rem;--padding-end:0.5rem;position:relative;z-index:2;min-width:3rem;margin:0;font-size:var(--road-font-size-14)}::slotted(road-button):hover{background-color:var(--road-button-ghost-variant)}.input-group-prepend{z-index:1;order:-1}.input-group-prepend~.form-label{left:calc(3rem + 1px)}.input-group-append{position:relative;z-index:1;border-radius:0 0.25rem 0.25rem 0}::slotted(label){display:flex;align-items:center;padding:0 0.5rem;margin-bottom:0;color:var(--road-on-surface);text-align:center;white-space:nowrap;cursor:text;background:var(--road-surface);border:1px solid var(--road-input-outline);border-radius:0.25rem;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}::slotted(road-label){display:flex;align-items:center;padding:0 0.5rem;margin-bottom:0;color:var(--road-on-surface);text-align:center;white-space:nowrap;cursor:text;background:var(--road-surface);border:1px solid var(--road-input-outline);border-radius:0.25rem;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}::slotted(road-input:not(:first-child)),::slotted(road-select:not(:first-child)){border-radius:0}.input-group-append ::slotted([slot=\"append\"]){border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.input-group-prepend ::slotted([slot=\"prepend\"]){border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}:host(.phone-number-group) .input-group-prepend ::slotted([slot=\"prepend\"]){border-right:1px solid var(--road-input-outline);border-top-right-radius:0;border-bottom-right-radius:0}.input-group-prepend ::slotted(label){margin-right:calc(-1rem + 1px)}.input-group-append ::slotted(road-button){background-color:var(--road-surface)}.input-group-append:hover ::slotted(road-button){background-color:var(--road-button-ghost-variant)}.size-xl .input-group-prepend,.size-xl .input-group-append{height:3.5rem}.size-xl ::slotted(road-button){height:3.5rem}.input-group.is-invalid ::slotted([slot=\"append\"]),.input-group.is-invalid ::slotted([slot=\"prepend\"]){border-color:var(--road-danger-outline)}:host(.phone-number-group) .input-group.is-invalid ::slotted([slot=\"prepend\"]){border-color:var(--road-danger-outline)}:host([disabled]){cursor:not-allowed}:host([disabled]) .input-group{pointer-events:none;}:host([disabled]) ::slotted([slot=\"append\"]),:host([disabled]) ::slotted([slot=\"prepend\"]){color:var(--road-on-surface-disabled);cursor:not-allowed;background:#e4e5e9}:host([disabled]) ::slotted([slot=\"append\"] road-icon),:host([disabled]) ::slotted([slot=\"prepend\"] road-icon){color:var(--road-on-surface-disabled)}:host([disabled]) road-icon{color:var(--road-on-surface-disabled)}";
17846
17857
 
17847
17858
  const InputGroup = class {
17848
17859
  constructor(hostRef) {