@roadtrip/components 3.14.3 → 3.16.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 (72) hide show
  1. package/dist/cjs/index-fb57f684.js.map +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/road-badge_14.cjs.entry.js +33 -6
  4. package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
  5. package/dist/cjs/road-dropdown.cjs.entry.js +15 -9
  6. package/dist/cjs/road-dropdown.cjs.entry.js.map +1 -1
  7. package/dist/cjs/road-toggle.cjs.entry.js +2 -4
  8. package/dist/cjs/road-toggle.cjs.entry.js.map +1 -1
  9. package/dist/cjs/roadtrip.cjs.js +1 -1
  10. package/dist/collection/components/carousel/carousel.stories.js +5 -5
  11. package/dist/collection/components/dropdown/dropdown.js +29 -19
  12. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  13. package/dist/collection/components/icon/svg/check-list-solid.svg +1 -0
  14. package/dist/collection/components/icon/svg/funding-refused-color.svg +1 -1
  15. package/dist/collection/components/icon/svg/funding-refused-outline.svg +1 -1
  16. package/dist/collection/components/icon/svg/funding-refused-solid.svg +1 -1
  17. package/dist/collection/components/icon/svg/vehicle-car-search-color.svg +1 -0
  18. package/dist/collection/components/icon/svg/world-solid.svg +1 -0
  19. package/dist/collection/components/input/input.js +30 -7
  20. package/dist/collection/components/input/input.js.map +1 -1
  21. package/dist/collection/components/item/item.css +47 -22
  22. package/dist/collection/components/item/item.js +60 -2
  23. package/dist/collection/components/item/item.js.map +1 -1
  24. package/dist/collection/components/item/item.stories.js +32 -15
  25. package/dist/collection/components/toggle/toggle.css +0 -35
  26. package/dist/collection/components/toggle/toggle.js +1 -27
  27. package/dist/collection/components/toggle/toggle.js.map +1 -1
  28. package/dist/collection/components/toggle/toggle.stories.js +0 -8
  29. package/dist/esm/index-891decf5.js.map +1 -1
  30. package/dist/esm/loader.js +1 -1
  31. package/dist/esm/road-badge_14.entry.js +33 -6
  32. package/dist/esm/road-badge_14.entry.js.map +1 -1
  33. package/dist/esm/road-dropdown.entry.js +16 -10
  34. package/dist/esm/road-dropdown.entry.js.map +1 -1
  35. package/dist/esm/road-toggle.entry.js +2 -4
  36. package/dist/esm/road-toggle.entry.js.map +1 -1
  37. package/dist/esm/roadtrip.js +1 -1
  38. package/dist/html.html-data.json +25 -23
  39. package/dist/icons/icons.svg +1 -1
  40. package/dist/icons/index.d.ts +3 -0
  41. package/dist/icons/index.js +6 -3
  42. package/dist/roadtrip/p-73fe2357.js.map +1 -1
  43. package/dist/roadtrip/{p-336f7def.entry.js → p-afe28f05.entry.js} +2 -2
  44. package/dist/roadtrip/p-afe28f05.entry.js.map +1 -0
  45. package/dist/roadtrip/p-c1dca3cc.entry.js +2 -0
  46. package/dist/roadtrip/p-c1dca3cc.entry.js.map +1 -0
  47. package/dist/roadtrip/p-faba450c.entry.js +2 -0
  48. package/dist/roadtrip/p-faba450c.entry.js.map +1 -0
  49. package/dist/roadtrip/roadtrip.css +1 -1
  50. package/dist/roadtrip/roadtrip.esm.js +1 -1
  51. package/dist/roadtrip/roadtrip.esm.js.map +1 -1
  52. package/dist/roadtrip/svg/check-list-solid.svg +1 -0
  53. package/dist/roadtrip/svg/funding-refused-color.svg +1 -1
  54. package/dist/roadtrip/svg/funding-refused-outline.svg +1 -1
  55. package/dist/roadtrip/svg/funding-refused-solid.svg +1 -1
  56. package/dist/roadtrip/svg/vehicle-car-search-color.svg +1 -0
  57. package/dist/roadtrip/svg/world-solid.svg +1 -0
  58. package/dist/types/components/dropdown/dropdown.d.ts +2 -23
  59. package/dist/types/components/input/input.d.ts +3 -2
  60. package/dist/types/components/item/item.d.ts +12 -0
  61. package/dist/types/components/toggle/toggle.d.ts +0 -5
  62. package/dist/types/components.d.ts +27 -41
  63. package/hydrate/index.js +54 -26
  64. package/icons/icons.svg +1 -1
  65. package/icons/index.d.ts +3 -0
  66. package/icons/index.js +6 -3
  67. package/package.json +1 -1
  68. package/dist/roadtrip/p-336f7def.entry.js.map +0 -1
  69. package/dist/roadtrip/p-64aa6fd0.entry.js +0 -2
  70. package/dist/roadtrip/p-64aa6fd0.entry.js.map +0 -1
  71. package/dist/roadtrip/p-9d62ca01.entry.js +0 -2
  72. package/dist/roadtrip/p-9d62ca01.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAIrF,MAAM,aAAa,GAAG,CAAC,KAAmB,EAAE,IAAY,EAAgB,EAAE;EACxE,MAAM,QAAQ,GAAI,KAAa,CAAC,SAAS,IAAI,KAAK,CAAC;EACnD,OAAO;IACL,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;GACnC,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,IAA8B,EAAE,IAAI,GAAG,CAAC,EAAE,EAAE;EAC5D,IAAI,KAAU,CAAC;EACf,OAAO,CAAC,GAAG,IAAW,EAAO,EAAE;IAC7B,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;EAC1C,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AAOH,MAAM,OAAO,KAAK;;IAkMR,YAAO,GAAG,CAAC,EAAS,EAAE,EAAE;MAC9B,MAAM,KAAK,GAAG,EAAE,CAAC,MAAiC,CAAC;MACnD,IAAI,KAAK,EAAE;QACT,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;OAChC;MACD,IAAI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C,IAAI,IAAI,UAAU;QACrC,YAAM,IAAI,EAAC,mBAAmB,GAAE,CAC3B,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,QAAQ,GAAG,CAAC,CAAC","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, Watch, h } from '@stencil/core';\n\nimport { AutocompleteTypes, TextFieldTypes } from '../../interface';\n\nconst debounceEvent = (event: EventEmitter, wait: number): EventEmitter => {\n const original = (event as any)._original || event;\n return {\n _original: event,\n emit: debounce(original.emit.bind(original), wait),\n } as EventEmitter;\n};\n\nconst debounce = (func: (...args: any[]) => void, wait = 0) => {\n let timer: any;\n return (...args: any[]): any => {\n clearTimeout(timer);\n timer = setTimeout(func, wait, ...args);\n };\n};\n\n/**\n * @slot checklistPassword - Content the checklist Password exemple.\n * `<div class=\"checklist-password mt-16\" slot=\"checklistPassword\">`\n ` <span class=\"checklist-password-label\"><strong>Low Safety</strong></span>`\n `<road-progress color=\"danger\" value=\"25\" class=\"mt-8 mb-16\"></road-progress>`\n `<p class=\"text-medium mb-8\">For optimal safety your password must have at least :</p>`\n `<ul class=\"m-0 pl-16\">`\n `<li id=\"letter\" class=\"invalid mb-8\">1 lowercase and 1 uppercase</li>`\n `<li id=\"number\" class=\"invalid mb-8\">1 digit</li>`\n `<li id=\"length\" class=\"invalid\">8 characters minimum</li>`\n `</ul>`\n `</div>`\n */\n\n@Component({\n tag: 'road-input',\n styleUrl: 'input.css',\n scoped: true,\n})\nexport class Input {\n\n /**\n * The id of input\n */\n @Prop() inputId: string = `road-input-${inputIds++}`;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n */\n @Prop() autocapitalize = 'off';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: AutocompleteTypes = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop() disabled = false;\n\n /**\n * A hint to the browser for which enter key to display.\n * Possible values: `\"enter\"`, `\"done\"`, `\"go\"`, `\"next\"`,\n * `\"previous\"`, `\"search\"`, and `\"send\"`.\n */\n @Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /**\n * A hint to the browser for which keyboard to display.\n * This attribute applies when the value of the type attribute is `\"text\"`, `\"password\"`, `\"email\"`, or `\"url\"`. Possible values are: `\"verbatim\"`, `\"latin\"`, `\"latin-name\"`, `\"latin-prose\"`, `\"full-width-latin\"`, `\"kana\"`, `\"katakana\"`, `\"numeric\"`, `\"tel\"`, `\"email\"`, `\"url\"`.\n */\n @Prop() inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The initial size of the control. This value is in pixels unless the value of the type attribute is `\"text\"` or `\"password\"`, in which case it is an integer number of characters. This attribute applies only when the `type` attribute is set to `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() size?: number;\n\n /**\n * The sizes of the input.\n */\n @Prop() sizes: 'lg' | 'xl' = 'lg';\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop() type: TextFieldTypes = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | number | null = '';\n\n /**\n * Label for the field\n */\n @Prop() label?: string = '';\n\n /**\n * Error message for the field\n */\n @Prop() error?: string;\n\n /**\n * Helper message for the field\n */\n @Prop() helper?: string;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `roadChange` event after each keystroke.\n */\n @Prop() debounce = 0;\n\n @Watch('debounce')\n protected debounceChanged() {\n this.roadchange = debounceEvent(this.roadchange, this.debounce);\n this.roadChange = debounceEvent(this.roadChange, this.debounce);\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.roadchange.emit({ value: this.value == null ? this.value : this.value.toString() });\n this.roadChange.emit({ value: this.value == null ? this.value : this.value.toString() });\n }\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() roadinput!: EventEmitter<KeyboardEvent>;\n /** @internal */\n @Event() roadInput!: EventEmitter<KeyboardEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() roadchange!: EventEmitter<{\n value: string | undefined | null;\n }>;\n /** @internal */\n @Event() roadChange!: EventEmitter<{\n value: string | undefined | null;\n }>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() roadblur!: EventEmitter<void>;\n /** @internal */\n @Event() roadBlur!: EventEmitter<void>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() roadfocus!: EventEmitter<void>;\n /** @internal */\n @Event() roadFocus!: EventEmitter<void>;\n\n private getValue(): string {\n return typeof this.value === 'number'\n ? this.value.toString()\n : (this.value || '').toString();\n }\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement | null;\n if (input) {\n this.value = input.value || \"\";\n }\n this.roadinput.emit(ev as KeyboardEvent);\n this.roadInput.emit(ev as KeyboardEvent);\n };\n\n private onBlur = () => {\n this.roadblur.emit();\n this.roadBlur.emit();\n };\n\n private onFocus = () => {\n this.roadfocus.emit();\n this.roadFocus.emit();\n };\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-label';\n const hasValueClass = this.value !== '' ? 'has-value' : '';\n const lessLabelClass = this.label !== '' ? '' : 'less-label';\n const isInvalidClass = this.error !== undefined && this.error !== '' ? 'is-invalid' : '';\n\n return (\n <Host aria-disabled={this.disabled ? 'true' : null} class={this.sizes && `input-${this.sizes}`}>\n <input\n class={`form-control ${hasValueClass} ${isInvalidClass} ${lessLabelClass}`}\n id={this.inputId}\n aria-disabled={this.disabled ? 'true' : null}\n aria-labelledby={labelId}\n disabled={this.disabled}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n enterKeyHint={this.enterkeyhint}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n size={this.size}\n type={this.type}\n value={value}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n data-cy='road-input'\n />\n <label class=\"form-label\" id={labelId} htmlFor={this.inputId}>{this.label}</label>\n {this.error && this.error !== '' && <p class=\"invalid-feedback\">{this.error}</p>}\n {this.helper && this.helper !== '' && <p class=\"helper\">{this.helper}</p>}\n {this.type && this.type == 'password' &&\n <slot name=\"checklistPassword\"/>}\n </Host>\n );\n }\n}\n\nlet inputIds = 0;\n"]}
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/input/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAIrF,MAAM,aAAa,GAAG,CAAC,KAAmB,EAAE,IAAY,EAAgB,EAAE;EACxE,MAAM,QAAQ,GAAI,KAAa,CAAC,SAAS,IAAI,KAAK,CAAC;E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AAED,IAAI,QAAQ,GAAG,CAAC,CAAC","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, Watch, h } from '@stencil/core';\n\nimport { AutocompleteTypes, TextFieldTypes } from '../../interface';\n\nconst debounceEvent = (event: EventEmitter, wait: number): EventEmitter => {\n const original = (event as any)._original || event;\n return {\n _original: event,\n emit: debounce(original.emit.bind(original), wait),\n } as EventEmitter;\n};\n\nconst debounce = (func: (...args: any[]) => void, wait = 0) => {\n let timer: any;\n return (...args: any[]): any => {\n clearTimeout(timer);\n timer = setTimeout(func, wait, ...args);\n };\n};\n\n/**\n * @slot checklistPassword - Content the checklist Password exemple.\n * `<div class=\"checklist-password mt-16\" slot=\"checklistPassword\">`\n ` <span class=\"checklist-password-label\"><strong>Low Safety</strong></span>`\n `<road-progress color=\"danger\" value=\"25\" class=\"mt-8 mb-16\"></road-progress>`\n `<p class=\"text-medium mb-8\">For optimal safety your password must have at least :</p>`\n `<ul class=\"m-0 pl-16\">`\n `<li id=\"letter\" class=\"invalid mb-8\">1 lowercase and 1 uppercase</li>`\n `<li id=\"number\" class=\"invalid mb-8\">1 digit</li>`\n `<li id=\"length\" class=\"invalid\">8 characters minimum</li>`\n `</ul>`\n `</div>`\n */\n\n@Component({\n tag: 'road-input',\n styleUrl: 'input.css',\n scoped: true,\n})\nexport class Input {\n\n /**\n * The id of input\n */\n @Prop() inputId: string = `road-input-${inputIds++}`;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n */\n @Prop() autocapitalize = 'off';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: AutocompleteTypes = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop() disabled = false;\n\n /**\n * A hint to the browser for which enter key to display.\n * Possible values: `\"enter\"`, `\"done\"`, `\"go\"`, `\"next\"`,\n * `\"previous\"`, `\"search\"`, and `\"send\"`.\n */\n @Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /**\n * A hint to the browser for which keyboard to display.\n * This attribute applies when the value of the type attribute is `\"text\"`, `\"password\"`, `\"email\"`, or `\"url\"`. Possible values are: `\"verbatim\"`, `\"latin\"`, `\"latin-name\"`, `\"latin-prose\"`, `\"full-width-latin\"`, `\"kana\"`, `\"katakana\"`, `\"numeric\"`, `\"tel\"`, `\"email\"`, `\"url\"`.\n */\n @Prop() inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The initial size of the control. This value is in pixels unless the value of the type attribute is `\"text\"` or `\"password\"`, in which case it is an integer number of characters. This attribute applies only when the `type` attribute is set to `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() size?: number;\n\n /**\n * The sizes of the input.\n */\n @Prop() sizes: 'lg' | 'xl' = 'lg';\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop() type: TextFieldTypes = 'text';\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | number | null = '';\n\n /**\n * Label for the field\n */\n @Prop() label?: string = '';\n\n /**\n * Error message for the field\n */\n @Prop() error?: string;\n\n /**\n * Helper message for the field\n */\n @Prop() helper?: string;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `roadChange` event after each keystroke.\n */\n @Prop() debounce = 0;\n\n @Watch('debounce')\n protected debounceChanged() {\n this.roadchange = debounceEvent(this.roadchange, this.debounce);\n this.roadChange = debounceEvent(this.roadChange, this.debounce);\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.roadchange.emit({ value: this.value == null ? this.value : this.value.toString() });\n this.roadChange.emit({ value: this.value == null ? this.value : this.value.toString() });\n }\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() roadinput!: EventEmitter<KeyboardEvent>;\n /** @internal */\n @Event() roadInput!: EventEmitter<KeyboardEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() roadchange!: EventEmitter<{\n value: string | undefined | null;\n }>;\n /** @internal */\n @Event() roadChange!: EventEmitter<{\n value: string | undefined | null;\n }>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() roadblur!: EventEmitter<string | null>; // Déclare roadblur pour transporter une valeur de type string ou null\n /** @internal */\n @Event() roadBlur!: EventEmitter<string | null>; // Déclare roadblur pour transporter une valeur de type string ou null\n\n /**\n * Emitted when the input has focus.\n */\n @Event() roadfocus!: EventEmitter<void>;\n /** @internal */\n @Event() roadFocus!: EventEmitter<void>;\n\n private getValue(): string {\n return typeof this.value === 'number'\n ? this.value.toString()\n : (this.value || '').toString();\n }\n\n private onInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement | null;\n if (input) {\n this.value = input.value || \"\";\n }\n this.roadinput.emit(ev as KeyboardEvent);\n this.roadInput.emit(ev as KeyboardEvent);\n };\n\n private onBlur = () => {\n let value = this.getValue();\n \n // Vérifier si les contraintes min et max sont définies\n if (this.min !== undefined && value !== '' && parseFloat(value) < parseFloat(this.min)) {\n value = this.min; // Ajuster la valeur à la valeur minimale\n }\n \n if (this.max !== undefined && value !== '' && parseFloat(value) > parseFloat(this.max)) {\n value = this.max; // Ajuster la valeur à la valeur maximale\n }\n \n this.value = value; // Mettre à jour la valeur avec la valeur ajustée\n \n // Émettre l'événement roadblur avec la valeur ajustée\n this.roadblur.emit(this.value);\n this.roadBlur.emit(this.value);\n };\n\n private onFocus = () => {\n this.roadfocus.emit();\n this.roadFocus.emit();\n };\n\n private enforceMinMax(el: HTMLInputElement): void {\n if (el.value !== \"\") {\n const value: number = parseInt(el.value);\n const minValue: number = parseInt(el.min);\n const maxValue: number = parseInt(el.max);\n\n if (value < minValue) {\n el.value = el.min;\n }\n\n if (value > maxValue) {\n el.value = el.max;\n }\n }\n}\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-label';\n const hasValueClass = this.value !== '' ? 'has-value' : '';\n const lessLabelClass = this.label !== '' ? '' : 'less-label';\n const isInvalidClass = this.error !== undefined && this.error !== '' ? 'is-invalid' : '';\n\n return (\n <Host aria-disabled={this.disabled ? 'true' : null} class={this.sizes && `input-${this.sizes}`} value={value}>\n <input\n class={`form-control ${hasValueClass} ${isInvalidClass} ${lessLabelClass}`}\n id={this.inputId}\n aria-disabled={this.disabled ? 'true' : null}\n aria-labelledby={labelId}\n disabled={this.disabled}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n enterKeyHint={this.enterkeyhint}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n size={this.size}\n type={this.type}\n value={value}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n onKeyUp={(event: Event) => this.enforceMinMax(event.target as HTMLInputElement)}\n data-cy='road-input'\n\n />\n <label class=\"form-label\" id={labelId} htmlFor={this.inputId}>{this.label}</label>\n {this.error && this.error !== '' && <p class=\"invalid-feedback\">{this.error}</p>}\n {this.helper && this.helper !== '' && <p class=\"helper\">{this.helper}</p>}\n {this.type && this.type == 'password' &&\n <slot name=\"checklistPassword\"/>}\n </Host>\n );\n }\n}\n\nlet inputIds = 0;\n"]}
@@ -20,12 +20,9 @@
20
20
  */
21
21
 
22
22
  :host {
23
- --border-radius: 0.25rem;
24
- --background-color: transparent;
23
+ --border-radius: var(--road-spacing-02);
24
+ --background-color: var(--road-surface);
25
25
  --detail-color: var(--road-icon);
26
- --inner-padding: 1rem 0.5rem 1rem 0;
27
- --min-height: 3.5rem;
28
- --padding-left: 1rem;
29
26
 
30
27
  position: relative;
31
28
  box-sizing: border-box;
@@ -33,10 +30,21 @@
33
30
  align-items: center;
34
31
  justify-content: space-between;
35
32
  overflow: hidden;
33
+ font-size: var(--road-font-size-14);
36
34
  text-decoration: none;
37
35
  outline: none;
38
36
  }
39
37
 
38
+ .layout-vertical{
39
+ display: flex;
40
+ flex-direction: column;
41
+ max-width: 224px;
42
+ }
43
+
44
+ .layout-vertical .item-inner {
45
+ align-items: flex-start;
46
+ }
47
+
40
48
  /* NATIVE
41
49
  -------------------- */
42
50
 
@@ -47,18 +55,15 @@
47
55
  display: flex;
48
56
  align-items: inherit;
49
57
  justify-content: inherit;
50
- width: 100%;
51
- min-height: var(--min-height);
52
- padding: 0 0 0 var(--padding-left);
58
+ padding: var(--road-spacing-05);
53
59
  margin: 0;
54
60
  overflow: inherit;
55
61
  font-family: inherit;
56
62
  font-size: inherit;
57
63
  color: var(--road-on-surface);
64
+ text-align: left;
58
65
  background-color: var(--background-color);
59
- border-color: var(--road-grey-70);
60
- border-style: solid;
61
- border-width: var(--border-width, 0);
66
+ border: 1px solid var(--road-outline-weak);
62
67
  border-radius: var(--border-radius);
63
68
  outline: none;
64
69
  transition: background 0.15s ease-in-out;
@@ -70,7 +75,7 @@
70
75
  */
71
76
 
72
77
  .item-active {
73
- background-color: var(--road-grey-90);
78
+ border: 2px solid var(--road-outline-variant);
74
79
  }
75
80
 
76
81
  /**
@@ -79,7 +84,7 @@
79
84
 
80
85
  button.item-native:not(:disabled):not(.item-active):hover,
81
86
  button.item-native:not(:disabled):not(.item-active):focus {
82
- background-color: var(--road-grey-90);
87
+ border: 2px solid var(--road-outline-variant);
83
88
  }
84
89
 
85
90
  /**
@@ -136,7 +141,21 @@ a {
136
141
  text-overflow: ellipsis;
137
142
  }
138
143
 
139
- /* ICONS
144
+ .input-wrapper-info-title {
145
+ font-size: var(--road-font-size-16);
146
+ font-weight: 700;
147
+
148
+ }
149
+
150
+ .input-wrapper-info-text {
151
+ margin: 0;
152
+ font-size: var(--road-font-size-16);
153
+ font-weight: 400;
154
+ color: var(--road-on-surface-weak);
155
+ }
156
+
157
+
158
+ /* ICONS /IMG
140
159
  -------------------- */
141
160
 
142
161
  .item-detail-icon {
@@ -148,18 +167,24 @@ a {
148
167
  margin-right: 0.5rem;
149
168
  }
150
169
 
151
- /* IMAGE
152
- -------------------- */
153
-
154
170
  ::slotted(road-img) {
155
171
  flex-shrink: 0;
156
- width: 3rem;
157
- height: 3rem;
158
- object-fit: cover;
159
- min-height: inherit;
160
- margin-right: 1rem;
172
+ margin-right: 0.5rem;
173
+ }
174
+
175
+ .layout-vertical ::slotted(road-img) {
176
+ margin-bottom: 0.5rem;
161
177
  }
162
178
 
179
+ ::slotted(road-label) p{
180
+ color: var(--road-on-surface-weak);
181
+ }
182
+
183
+ /* IMAGE
184
+ -------------------- */
185
+
186
+
187
+
163
188
  /* BUTTONS
164
189
  -------------------- */
165
190
 
@@ -10,6 +10,8 @@ import { navigationChevron } from "../../../icons";
10
10
  export class Item {
11
11
  constructor() {
12
12
  this.multipleInputs = false;
13
+ this.titleItem = '';
14
+ this.text = '';
13
15
  this.button = false;
14
16
  this.detail = undefined;
15
17
  this.active = undefined;
@@ -19,6 +21,7 @@ export class Item {
19
21
  this.href = undefined;
20
22
  this.rel = undefined;
21
23
  this.lines = undefined;
24
+ this.layout = 'horizontal';
22
25
  this.target = undefined;
23
26
  this.type = 'button';
24
27
  }
@@ -28,7 +31,7 @@ export class Item {
28
31
  return (this.href !== undefined || this.button);
29
32
  }
30
33
  render() {
31
- const { detail, detailIcon, download, lines, disabled, href, rel, target } = this;
34
+ const { detail, detailIcon, download, layout, lines, disabled, href, rel, target } = this;
32
35
  const clickable = this.isClickable();
33
36
  const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div';
34
37
  const attrs = (TagType === 'button')
@@ -45,7 +48,8 @@ export class Item {
45
48
  } }, h(TagType, Object.assign({}, attrs, { class: {
46
49
  'item-native': true,
47
50
  'item-active': this.active,
48
- }, part: "native", disabled: disabled }), h("slot", { name: "start" }), h("div", { class: "item-inner" }, h("div", { class: "input-wrapper" }, h("slot", null)), h("slot", { name: "end" }), showDetail && h("road-icon", { icon: detailIcon, lazy: false, class: "item-detail-icon" })))));
51
+ [`layout-${layout}`]: layout !== undefined,
52
+ }, part: "native", disabled: disabled }), h("slot", { name: "start" }), h("div", { class: "item-inner" }, h("div", { class: "input-wrapper" }, h("slot", null), h("div", { class: "input-wrapper-info" }, h("road-label", { class: "input-wrapper-info-title" }, this.titleItem), h("p", { class: "input-wrapper-info-text" }, this.text))), h("slot", { name: "end" }), showDetail && h("road-icon", { icon: detailIcon, lazy: false, class: "item-detail-icon" })))));
49
53
  }
50
54
  static get is() { return "road-item"; }
51
55
  static get encapsulation() { return "shadow"; }
@@ -61,6 +65,42 @@ export class Item {
61
65
  }
62
66
  static get properties() {
63
67
  return {
68
+ "titleItem": {
69
+ "type": "string",
70
+ "mutable": false,
71
+ "complexType": {
72
+ "original": "string",
73
+ "resolved": "string | undefined",
74
+ "references": {}
75
+ },
76
+ "required": false,
77
+ "optional": true,
78
+ "docs": {
79
+ "tags": [],
80
+ "text": "Title for the item"
81
+ },
82
+ "attribute": "title-item",
83
+ "reflect": false,
84
+ "defaultValue": "''"
85
+ },
86
+ "text": {
87
+ "type": "string",
88
+ "mutable": false,
89
+ "complexType": {
90
+ "original": "string",
91
+ "resolved": "string | undefined",
92
+ "references": {}
93
+ },
94
+ "required": false,
95
+ "optional": true,
96
+ "docs": {
97
+ "tags": [],
98
+ "text": "Description for the item"
99
+ },
100
+ "attribute": "text",
101
+ "reflect": false,
102
+ "defaultValue": "''"
103
+ },
64
104
  "button": {
65
105
  "type": "boolean",
66
106
  "mutable": false,
@@ -217,6 +257,24 @@ export class Item {
217
257
  "attribute": "lines",
218
258
  "reflect": false
219
259
  },
260
+ "layout": {
261
+ "type": "string",
262
+ "mutable": false,
263
+ "complexType": {
264
+ "original": "'horizontal' | 'vertical'",
265
+ "resolved": "\"horizontal\" | \"vertical\" | undefined",
266
+ "references": {}
267
+ },
268
+ "required": false,
269
+ "optional": true,
270
+ "docs": {
271
+ "tags": [],
272
+ "text": "How the bottom border should be displayed on the item."
273
+ },
274
+ "attribute": "layout",
275
+ "reflect": false,
276
+ "defaultValue": "'horizontal'"
277
+ },
220
278
  "target": {
221
279
  "type": "string",
222
280
  "mutable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../src/components/item/item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;GAMG;AAOH,MAAM,OAAO,IAAI;;0BAIW,KAAK;kBAKd,KAAK;;;sBAgBD,iBAAiB;oBAKnB,KAAK;;;;;;gBAqCsB,QAAQ;;EAEtD,qEAAqE;EACrE,qCAAqC;EAC7B,WAAW;IACjB,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;EAClD,CAAC;EAED,MAAM;IACJ,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClF,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAY,CAAC;IACjF,MAAM,KAAK,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC;MAClC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;MACrB,CAAC,CAAC;QACA,QAAQ;QACR,IAAI;QACJ,GAAG;QACH,MAAM;OACP,CAAC;IACJ,MAAM,UAAU,GAAG,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC;IAElD,OAAO,CACL,EAAC,IAAI,qBACY,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EACvC,KAAK,EAAE;QACL,CAAC,cAAc,KAAK,EAAE,CAAC,EAAE,KAAK,KAAK,SAAS;OAC7C;MAED,EAAC,OAAO,oBACF,KAAK,IACT,KAAK,EAAE;UACL,aAAa,EAAE,IAAI;UACnB,aAAa,EAAE,IAAI,CAAC,MAAM;SAC3B,EACD,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,QAAQ;QAElB,YAAM,IAAI,EAAC,OAAO,GAAE;QACpB,WAAK,KAAK,EAAC,YAAY;UACrB,WAAK,KAAK,EAAC,eAAe;YACxB,eAAO,CACH;UACN,YAAM,IAAI,EAAC,KAAK,GAAE;UACjB,UAAU,IAAI,iBAAW,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAC,kBAAkB,GAAa,CAC1F,CACE,CACL,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport { navigationChevron } from '../../../icons';\n\n/**\n * @slot start - Placed to the left of all other content.\n * @slot - Content of the item.\n * @slot end - Placed to the right of all other content.\n *\n * @part native - The native HTML button, anchor or div element that wraps all child elements.\n */\n\n@Component({\n tag: 'road-item',\n styleUrl: 'item.css',\n shadow: true,\n})\nexport class Item {\n\n @Element() el!: HTMLRoadItemElement;\n\n @State() multipleInputs = false;\n\n /**\n * If `true`, a button tag will be rendered and the item will be tappable.\n */\n @Prop() button = false;\n\n /**\n * If `true`, a detail arrow will appear on the item. Defaults to `false` unless the `mode`\n * is `ios` and an `href` or `button` property is present.\n */\n @Prop() detail?: boolean;\n\n /**\n * If `true`, display an active state item\n */\n @Prop() active?: boolean;\n\n /**\n * The icon to use when `detail` is set to `true`.\n */\n @Prop() detailIcon = navigationChevron;\n\n /**\n * If `true`, the user cannot interact with the item.\n */\n @Prop() disabled = false;\n\n /**\n * This attribute instructs browsers to download a URL instead of navigating to\n * it, so the user will be prompted to save it as a local file. If the attribute\n * has a value, it is used as the pre-filled file name in the Save prompt\n * (the user can still change the file name if they want).\n */\n @Prop() download: string | undefined;\n\n /**\n * Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered.\n */\n @Prop() href: string | undefined;\n\n /**\n * Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types).\n */\n @Prop() rel: string | undefined;\n\n /**\n * How the bottom border should be displayed on the item.\n */\n @Prop() lines?: 'full' | 'inset' | 'none';\n\n /**\n * Specifies where to display the linked URL.\n * Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`.\n */\n @Prop() target: string | undefined;\n\n /**\n * The type of the button. Only used when an `onclick` or `button` property is present.\n */\n @Prop() type: 'submit' | 'reset' | 'button' = 'button';\n\n // If the item has an href or button property it will render a native\n // anchor or button that is clickable\n private isClickable(): boolean {\n return (this.href !== undefined || this.button);\n }\n\n render() {\n const { detail, detailIcon, download, lines, disabled, href, rel, target } = this;\n const clickable = this.isClickable();\n const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div' as any;\n const attrs = (TagType === 'button')\n ? { type: this.type }\n : {\n download,\n href,\n rel,\n target,\n };\n const showDetail = detail !== undefined && detail;\n\n return (\n <Host\n aria-disabled={disabled ? 'true' : null}\n class={{\n [`item-lines-${lines}`]: lines !== undefined,\n }}\n >\n <TagType\n {...attrs}\n class={{\n 'item-native': true,\n 'item-active': this.active,\n }}\n part=\"native\"\n disabled={disabled}\n >\n <slot name=\"start\"/>\n <div class=\"item-inner\">\n <div class=\"input-wrapper\">\n <slot/>\n </div>\n <slot name=\"end\"/>\n {showDetail && <road-icon icon={detailIcon} lazy={false} class=\"item-detail-icon\"></road-icon>}\n </div>\n </TagType>\n </Host>\n );\n }\n\n}\n"]}
1
+ {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../src/components/item/item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;GAMG;AAOH,MAAM,OAAO,IAAI;;0BAIW,KAAK;qBAKA,EAAE;gBAKP,EAAE;kBAKX,KAAK;;;sBAgBD,iBAAiB;oBAKnB,KAAK;;;;;kBA8BqB,YAAY;;gBAYX,QAAQ;;EAEtD,qEAAqE;EACrE,qCAAqC;EAC7B,WAAW;IACjB,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;EAClD,CAAC;EAED,MAAM;IACJ,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1F,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAY,CAAC;IACjF,M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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\nimport { navigationChevron } from '../../../icons';\n\n/**\n * @slot start - Placed to the left of all other content.\n * @slot - Content of the item.\n * @slot end - Placed to the right of all other content.\n *\n * @part native - The native HTML button, anchor or div element that wraps all child elements.\n */\n\n@Component({\n tag: 'road-item',\n styleUrl: 'item.css',\n shadow: true,\n})\nexport class Item {\n\n @Element() el!: HTMLRoadItemElement;\n\n @State() multipleInputs = false;\n\n /**\n * Title for the item\n */\n @Prop() titleItem?: string = '';\n\n /**\n * Description for the item\n */\n @Prop() text?: string = '';\n\n /**\n * If `true`, a button tag will be rendered and the item will be tappable.\n */\n @Prop() button = false;\n\n /**\n * If `true`, a detail arrow will appear on the item. Defaults to `false` unless the `mode`\n * is `ios` and an `href` or `button` property is present.\n */\n @Prop() detail?: boolean;\n\n /**\n * If `true`, display an active state item\n */\n @Prop() active?: boolean;\n\n /**\n * The icon to use when `detail` is set to `true`.\n */\n @Prop() detailIcon = navigationChevron;\n\n /**\n * If `true`, the user cannot interact with the item.\n */\n @Prop() disabled = false;\n\n /**\n * This attribute instructs browsers to download a URL instead of navigating to\n * it, so the user will be prompted to save it as a local file. If the attribute\n * has a value, it is used as the pre-filled file name in the Save prompt\n * (the user can still change the file name if they want).\n */\n @Prop() download: string | undefined;\n\n /**\n * Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered.\n */\n @Prop() href: string | undefined;\n\n /**\n * Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types).\n */\n @Prop() rel: string | undefined;\n\n /**\n * How the bottom border should be displayed on the item.\n */\n @Prop() lines?: 'full' | 'inset' | 'none';\n \n /**\n * How the bottom border should be displayed on the item.\n */\n @Prop() layout?: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Specifies where to display the linked URL.\n * Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`.\n */\n @Prop() target: string | undefined;\n\n /**\n * The type of the button. Only used when an `onclick` or `button` property is present.\n */\n @Prop() type: 'submit' | 'reset' | 'button' = 'button';\n\n // If the item has an href or button property it will render a native\n // anchor or button that is clickable\n private isClickable(): boolean {\n return (this.href !== undefined || this.button);\n }\n\n render() {\n const { detail, detailIcon, download, layout, lines, disabled, href, rel, target } = this;\n const clickable = this.isClickable();\n const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div' as any;\n const attrs = (TagType === 'button')\n ? { type: this.type }\n : {\n download,\n href,\n rel,\n target,\n };\n const showDetail = detail !== undefined && detail;\n\n return (\n <Host\n aria-disabled={disabled ? 'true' : null}\n class={{\n [`item-lines-${lines}`]: lines !== undefined,\n }}\n >\n <TagType\n {...attrs}\n class={{\n 'item-native': true,\n 'item-active': this.active,\n [`layout-${layout}`]: layout !== undefined,\n }}\n part=\"native\"\n disabled={disabled}\n >\n <slot name=\"start\"/>\n <div class=\"item-inner\">\n <div class=\"input-wrapper\">\n <slot/>\n <div class=\"input-wrapper-info\">\n <road-label class=\"input-wrapper-info-title\">{this.titleItem}</road-label>\n <p class=\"input-wrapper-info-text\">{this.text}</p>\n </div>\n </div>\n <slot name=\"end\"/>\n {showDetail && <road-icon icon={detailIcon} lazy={false} class=\"item-detail-icon\"></road-icon>}\n </div>\n </TagType>\n </Host>\n );\n }\n\n}\n"]}
@@ -15,13 +15,15 @@ export default {
15
15
 
16
16
  export const Playground = (args) => html`
17
17
  <road-item
18
- class="bg-white"
19
18
  button="${ifDefined(args.button)}"
20
19
  detail="${ifDefined(args.detail)}"
21
20
  detail-icon="${ifDefined(args['detail-icon'])}"
22
- active="${ifDefined(args.active)}"
21
+ active="${ifDefined(args.active)}"
22
+ layout="${ifDefined(args.layout)}"
23
23
  lines="${ifDefined(args.lines)}"
24
24
  disabled="${ifDefined(args.disabled)}"
25
+ title-item="${ifDefined(args['title-item'])}"
26
+ text="${ifDefined(args.text)}"
25
27
  >
26
28
  ${unsafeHTML(args.start)}
27
29
  ${unsafeHTML(args[' '])}
@@ -32,11 +34,14 @@ Playground.args = {
32
34
  button: null,
33
35
  detail: null,
34
36
  active: null,
37
+ layout: undefined,
35
38
  lines: undefined,
36
39
  'detail-icon': undefined,
37
40
  disabled: null,
38
41
  start: '<road-icon name="shipping"></road-icon>',
39
- ' ': 'Mes achats',
42
+ 'title-item': 'OPEL Insignia',
43
+ text: 'hatchback 2.0 CDTI 16V 130 cv',
44
+ ' ': ``,
40
45
  };
41
46
  Playground.argTypes = {
42
47
  button: {
@@ -48,6 +53,12 @@ Playground.argTypes = {
48
53
  active: {
49
54
  control: 'boolean',
50
55
  },
56
+ layout: {
57
+ options: ['horizontal', 'vertical'],
58
+ control: {
59
+ type: 'radio',
60
+ },
61
+ },
51
62
  lines: {
52
63
  options: ['full', 'inset', 'none'],
53
64
  control: {
@@ -68,6 +79,12 @@ Playground.argTypes = {
68
79
  type: null,
69
80
  },
70
81
  },
82
+ 'title-item': {
83
+ control: 'text',
84
+ },
85
+ text: {
86
+ control: 'text',
87
+ },
71
88
  href: {
72
89
  control: {
73
90
  type: null,
@@ -153,16 +170,16 @@ Playground.argTypes = {
153
170
  };
154
171
 
155
172
  export const Compatibility = () => html`
156
- <road-item class="mb-16" style="--border-width: 1px;--background-color: var(--road-grey-000)">
173
+ <road-item class="mb-16">
157
174
  <road-label>
158
175
  <p class="h8 my-4">OPEL Insignia</p>
159
176
  <p class="text-small text-truncate m-0">hatchback 2.0 CDTI 16V 130 cv</p>
160
177
  </road-label>
161
178
 
162
- <road-button slot="end" size="sm" color="secondary" class="mr-8">Modify</road-button>
179
+ <road-button slot="end" size="sm" color="secondary" class="ml-16">Modify</road-button>
163
180
  </road-item>
164
181
 
165
- <road-item class="mb-16" style="--border-width: 1px;--background-color: var(--road-grey-000)">
182
+ <road-item class="mb-16">
166
183
  <road-icon slot="start" name="alert-valid-outline" color="success" class="mr-16"></road-icon>
167
184
 
168
185
  <road-label>
@@ -171,10 +188,10 @@ export const Compatibility = () => html`
171
188
  <p class="text-small text-truncate m-0">hatchback 2.0 CDTI 16V 130 cv</p>
172
189
  </road-label>
173
190
 
174
- <road-button slot="end" size="sm" color="secondary" class="mr-8">Modify</road-button>
191
+ <road-button slot="end" size="sm" color="secondary" class="ml-16">Modify</road-button>
175
192
  </road-item>
176
193
 
177
- <road-item class="mb-16" style="--border-width: 1px;--background-color: var(--road-grey-000)">
194
+ <road-item class="mb-16">
178
195
  <road-icon slot="start" name="alert-error-outline" color="danger" class="mr-16"></road-icon>
179
196
 
180
197
  <road-label>
@@ -184,12 +201,12 @@ export const Compatibility = () => html`
184
201
  <a href="#" class="link">See compatible products</a>
185
202
  </road-label>
186
203
 
187
- <road-button slot="end" size="sm" color="secondary" class="mr-8">Modify</road-button>
204
+ <road-button slot="end" size="sm" color="secondary" class="ml-16">Modify</road-button>
188
205
  </road-item>
189
206
  `;
190
207
 
191
208
  export const ShoppingGuides = () => html`
192
- <road-item class="mb-16" style="--border-width: 1px;--background-color: var(--road-grey-000)">
209
+ <road-item class="mb-16">
193
210
  <road-icon slot="start" name="vehicle-car-outline" class="mr-16"></road-icon>
194
211
 
195
212
  <road-label>
@@ -197,10 +214,10 @@ export const ShoppingGuides = () => html`
197
214
  <p class="text-small text-truncate m-0">hatchback 2.0 CDTI 16V 130 cv</p>
198
215
  </road-label>
199
216
 
200
- <road-icon slot="end" name="edit" color="secondary" size="sm" class="mr-8"></road-icon>
217
+ <road-icon slot="end" name="edit" color="secondary" size="sm" class="ml-16"></road-icon>
201
218
  </road-item>
202
219
 
203
- <road-item class="mb-16" style="--border-width: 1px;--background-color: var(--road-grey-000)">
220
+ <road-item class="mb-16">
204
221
  <road-icon slot="start" name="vehicle-car-outline-front" class="mr-16"></road-icon>
205
222
 
206
223
  <road-label>
@@ -208,10 +225,10 @@ export const ShoppingGuides = () => html`
208
225
  <p class="h8 m-0">Front lighting</p>
209
226
  </road-label>
210
227
 
211
- <road-icon slot="end" name="edit" color="secondary" size="sm" class="mr-8"></road-icon>
228
+ <road-icon slot="end" name="edit" color="secondary" size="sm" class="ml-16"></road-icon>
212
229
  </road-item>
213
230
 
214
- <road-item class="mb-16" style="--border-width: 1px;--background-color: var(--road-grey-000)">
231
+ <road-item class="mb-16">
215
232
  <road-icon slot="start" name="light" class="mr-16"></road-icon>
216
233
 
217
234
  <road-label>
@@ -219,6 +236,6 @@ export const ShoppingGuides = () => html`
219
236
  <p class="h8 m-0">Position light</p>
220
237
  </road-label>
221
238
 
222
- <road-icon slot="end" name="edit" color="secondary" size="sm" class="mr-8"></road-icon>
239
+ <road-icon slot="end" name="edit" color="secondary" size="sm" class="ml-16"></road-icon>
223
240
  </road-item>
224
241
  `;
@@ -146,18 +146,6 @@
146
146
  color: var(--road-surface);
147
147
  }
148
148
 
149
- /**
150
- * Info
151
- */
152
-
153
- .form-toggle-input:checked ~ .form-toggle-info .form-toggle-lever {
154
- background: var(--road-info-surface-inverse);
155
- }
156
-
157
- .form-toggle-input:checked ~ .form-toggle-info .form-toggle-lever::before {
158
- color: var(--road-surface);
159
- }
160
-
161
149
  /**
162
150
  * Success
163
151
  */
@@ -170,29 +158,6 @@
170
158
  color: var(--road-surface);
171
159
  }
172
160
 
173
- /**
174
- * Warning
175
- */
176
-
177
- .form-toggle-input:checked ~ .form-toggle-warning .form-toggle-lever {
178
- background: var(--road-warning-surface-inverse);
179
- }
180
-
181
- .form-toggle-input:checked ~ .form-toggle-warning .form-toggle-lever::before {
182
- color: var(--road-on-warning-surface-inverse);
183
- }
184
-
185
- /**
186
- * Danger
187
- */
188
-
189
- .form-toggle-input:checked ~ .form-toggle-danger .form-toggle-lever {
190
- background: var(--road-danger-surface-inverse);
191
- }
192
-
193
- .form-toggle-input:checked ~ .form-toggle-danger .form-toggle-lever::before {
194
- color: var(--road-surface);
195
- }
196
161
 
197
162
  /* POSITION
198
163
  -------------------- */
@@ -18,7 +18,6 @@ export class toggle {
18
18
  this.checked = false;
19
19
  this.disabled = false;
20
20
  this.label = `${this.toggleId}-label`;
21
- this.color = 'success';
22
21
  this.hasLeftLabel = false;
23
22
  this.isSpaced = false;
24
23
  this.value = 'on';
@@ -38,10 +37,9 @@ export class toggle {
38
37
  render() {
39
38
  const labelId = this.toggleId + '-label';
40
39
  const textLabel = h("label", { class: "form-toggle-label", id: labelId, htmlFor: this.toggleId }, this.label);
41
- const colorClass = this.color !== undefined ? 'form-toggle-' + this.color : '';
42
40
  const isSpacedClass = this.isSpaced && 'form-toggle-spaced';
43
41
  const righttoggleClass = this.hasLeftLabel ? 'form-toggle-right' : '';
44
- 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} ${colorClass}`, 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
+ 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)));
45
43
  }
46
44
  static get is() { return "road-toggle"; }
47
45
  static get encapsulation() { return "scoped"; }
@@ -147,30 +145,6 @@ export class toggle {
147
145
  "reflect": false,
148
146
  "defaultValue": "`${this.toggleId}-label`"
149
147
  },
150
- "color": {
151
- "type": "string",
152
- "mutable": false,
153
- "complexType": {
154
- "original": "'success' | FeedbackColors",
155
- "resolved": "\"danger\" | \"info\" | \"success\" | \"warning\" | undefined",
156
- "references": {
157
- "FeedbackColors": {
158
- "location": "import",
159
- "path": "../../interface",
160
- "id": "src/interface.d.ts::FeedbackColors"
161
- }
162
- }
163
- },
164
- "required": false,
165
- "optional": true,
166
- "docs": {
167
- "tags": [],
168
- "text": "Set the color of alert. e.g. info, success, warning, danger"
169
- },
170
- "attribute": "color",
171
- "reflect": false,
172
- "defaultValue": "'success'"
173
- },
174
148
  "hasLeftLabel": {
175
149
  "type": "boolean",
176
150
  "mutable": false,
@@ -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;AAS9B,MAAM,OAAO,MAAM;;IAgGT,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;oBAvGyB,eAAe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B,KAAK,EAAE,IAAI,CAAC,KAAK,kBACH,GAAG,IAAI,CAAC,OAAO,EAAE,mBAChB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,qBAC3B,OAAO,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,IAAI,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ;QACrF,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\nimport { FeedbackColors } from '../../interface';\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 * Set the color of alert. e.g. info, success, warning, danger\n */\n @Prop() color?: 'success' | FeedbackColors = 'success';\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 colorClass = this.color !== undefined ? 'form-toggle-' + this.color : '';\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} ${colorClass}`} 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;oBAl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IAAI,qBAC3B,OAAO,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"]}
@@ -34,12 +34,6 @@ export default {
34
34
  on: {
35
35
  control: 'text',
36
36
  },
37
- color: {
38
- options: ['secondary', 'info', 'success', 'danger', 'warning'],
39
- control: {
40
- type: 'radio',
41
- },
42
- },
43
37
  'has-left-label': {
44
38
  control: 'boolean',
45
39
  },
@@ -73,7 +67,6 @@ export default {
73
67
  },
74
68
  args: {
75
69
  checked: null,
76
- color: null,
77
70
  'has-left-label': null,
78
71
  'is-spaced': null,
79
72
  label: 'Label',
@@ -88,7 +81,6 @@ const Template = (args) => html`
88
81
  <road-toggle
89
82
  checked="${ifDefined(args.checked)}"
90
83
  disabled="${ifDefined(args.disabled)}"
91
- color="${ifDefined(args.color)}"
92
84
  label="${ifDefined(args.label)}"
93
85
  name="${ifDefined(args.name)}"
94
86
  value="${ifDefined(args.value)}"