@oiz/stzh-components 2.6.0 → 2.7.0-beta

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 (188) hide show
  1. package/dist/cjs/{app-globals-4dcdf160.js → app-globals-d0d1f796.js} +2 -2
  2. package/dist/cjs/{app-globals-4dcdf160.js.map → app-globals-d0d1f796.js.map} +1 -1
  3. package/dist/cjs/index.cjs.js.map +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/stzh-amount.cjs.entry.js +30 -79
  6. package/dist/cjs/stzh-amount.cjs.entry.js.map +1 -1
  7. package/dist/cjs/stzh-components.cjs.js +2 -2
  8. package/dist/cjs/stzh-datepicker_3.cjs.entry.js.map +1 -1
  9. package/dist/cjs/stzh-dropdown.cjs.entry.js +60 -25
  10. package/dist/cjs/stzh-dropdown.cjs.entry.js.map +1 -1
  11. package/dist/cjs/stzh-monthyearpicker.cjs.entry.js +191 -0
  12. package/dist/cjs/stzh-monthyearpicker.cjs.entry.js.map +1 -0
  13. package/dist/cjs/stzh-pagetitle.cjs.entry.js +1 -1
  14. package/dist/cjs/stzh-pagetitle.cjs.entry.js.map +1 -1
  15. package/dist/cjs/stzh-skin-portal-mitwirken.cjs.entry.js +1 -1
  16. package/dist/cjs/stzh-skin-portal-mitwirken.cjs.entry.js.map +1 -1
  17. package/dist/cjs/stzh-timepicker.cjs.entry.js +82 -0
  18. package/dist/cjs/stzh-timepicker.cjs.entry.js.map +1 -0
  19. package/dist/cjs/translation-utils-73073e44.js.map +1 -1
  20. package/dist/collection/assets/i18n/de.json +10 -7
  21. package/dist/collection/assets/i18n/en.json +8 -5
  22. package/dist/collection/collection-manifest.json +2 -0
  23. package/dist/collection/components/stzh-amount/stzh-amount.js +32 -85
  24. package/dist/collection/components/stzh-amount/stzh-amount.js.map +1 -1
  25. package/dist/collection/components/stzh-amount/stzh-amount.localization.js.map +1 -1
  26. package/dist/collection/components/stzh-amount/stzh-amount.stories.js +1 -1
  27. package/dist/collection/components/stzh-card/stzh-card.stories.js +5 -5
  28. package/dist/collection/components/stzh-datepicker/stzh-datepicker.js +1 -1
  29. package/dist/collection/components/stzh-datepicker/stzh-datepicker.js.map +1 -1
  30. package/dist/collection/components/stzh-datepicker/stzh-datepicker.stories.js +3 -0
  31. package/dist/collection/components/stzh-dropdown/stzh-dropdown.css +32 -20
  32. package/dist/collection/components/stzh-dropdown/stzh-dropdown.js +40 -9
  33. package/dist/collection/components/stzh-dropdown/stzh-dropdown.js.map +1 -1
  34. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.css +123 -0
  35. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.js +724 -0
  36. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.js.map +1 -0
  37. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.js +2 -0
  38. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.js.map +1 -0
  39. package/dist/collection/components/stzh-monthyearpicker/stzh-monthyearpicker.stories.js +61 -0
  40. package/dist/collection/components/stzh-pagetitle/stzh-pagetitle.css +3 -0
  41. package/dist/collection/components/stzh-skin-portal-mitwirken/stzh-skin-portal-mitwirken.css +1 -1
  42. package/dist/collection/components/stzh-timepicker/stzh-timepicker.css +109 -0
  43. package/dist/collection/components/stzh-timepicker/stzh-timepicker.js +438 -0
  44. package/dist/collection/components/stzh-timepicker/stzh-timepicker.js.map +1 -0
  45. package/dist/collection/components/stzh-timepicker/stzh-timepicker.localization.js +2 -0
  46. package/dist/collection/components/stzh-timepicker/stzh-timepicker.localization.js.map +1 -0
  47. package/dist/collection/components/stzh-timepicker/stzh-timepicker.stories.js +45 -0
  48. package/dist/collection/components/stzh-upload/stzh-upload.stories.js +2 -2
  49. package/dist/collection/index.js.map +1 -1
  50. package/dist/collection/libraries/tom-select/cjs/tom-select.complete.js +47 -18
  51. package/dist/collection/libraries/tom-select/cjs/tom-select.js +47 -18
  52. package/dist/collection/libraries/tom-select/cjs/tom-select.popular.js +47 -18
  53. package/dist/collection/libraries/tom-select/esm/tom-select.complete.js +47 -18
  54. package/dist/collection/libraries/tom-select/esm/tom-select.js +47 -18
  55. package/dist/collection/libraries/tom-select/esm/tom-select.popular.js +47 -18
  56. package/dist/collection/libraries/tom-select/js/tom-select.base.js +47 -18
  57. package/dist/collection/libraries/tom-select/js/tom-select.base.min.js +16 -17
  58. package/dist/collection/libraries/tom-select/js/tom-select.complete.js +47 -18
  59. package/dist/collection/libraries/tom-select/js/tom-select.complete.min.js +12 -13
  60. package/dist/collection/libraries/tom-select/js/tom-select.popular.js +47 -18
  61. package/dist/collection/libraries/tom-select/js/tom-select.popular.min.js +21 -22
  62. package/dist/collection/utils/translation-utils.js.map +1 -1
  63. package/dist/components/index.js +1 -1
  64. package/dist/components/index2.js.map +1 -1
  65. package/dist/components/stzh-amount.js +40 -83
  66. package/dist/components/stzh-amount.js.map +1 -1
  67. package/dist/components/stzh-buttongroup.js +1 -31
  68. package/dist/components/stzh-buttongroup.js.map +1 -1
  69. package/dist/components/stzh-buttongroup2.js +35 -0
  70. package/dist/components/stzh-buttongroup2.js.map +1 -0
  71. package/dist/components/stzh-datepicker2.js.map +1 -1
  72. package/dist/components/stzh-dropdown2.js +61 -25
  73. package/dist/components/stzh-dropdown2.js.map +1 -1
  74. package/dist/components/stzh-monthyearpicker.d.ts +11 -0
  75. package/dist/components/stzh-monthyearpicker.js +251 -0
  76. package/dist/components/stzh-monthyearpicker.js.map +1 -0
  77. package/dist/components/stzh-pagetitle.js +1 -1
  78. package/dist/components/stzh-pagetitle.js.map +1 -1
  79. package/dist/components/stzh-skin-portal-mitwirken.js +1 -1
  80. package/dist/components/stzh-skin-portal-mitwirken.js.map +1 -1
  81. package/dist/components/stzh-timepicker.d.ts +11 -0
  82. package/dist/components/stzh-timepicker.js +132 -0
  83. package/dist/components/stzh-timepicker.js.map +1 -0
  84. package/dist/components/translation-utils.js.map +1 -1
  85. package/dist/esm/{app-globals-91875913.js → app-globals-bd1f456b.js} +2 -2
  86. package/dist/esm/{app-globals-91875913.js.map → app-globals-bd1f456b.js.map} +1 -1
  87. package/dist/esm/index.js.map +1 -1
  88. package/dist/esm/loader.js +2 -2
  89. package/dist/esm/stzh-amount.entry.js +30 -79
  90. package/dist/esm/stzh-amount.entry.js.map +1 -1
  91. package/dist/esm/stzh-components.js +2 -2
  92. package/dist/esm/stzh-datepicker_3.entry.js.map +1 -1
  93. package/dist/esm/stzh-dropdown.entry.js +60 -25
  94. package/dist/esm/stzh-dropdown.entry.js.map +1 -1
  95. package/dist/esm/stzh-monthyearpicker.entry.js +187 -0
  96. package/dist/esm/stzh-monthyearpicker.entry.js.map +1 -0
  97. package/dist/esm/stzh-pagetitle.entry.js +1 -1
  98. package/dist/esm/stzh-pagetitle.entry.js.map +1 -1
  99. package/dist/esm/stzh-skin-portal-mitwirken.entry.js +1 -1
  100. package/dist/esm/stzh-skin-portal-mitwirken.entry.js.map +1 -1
  101. package/dist/esm/stzh-timepicker.entry.js +78 -0
  102. package/dist/esm/stzh-timepicker.entry.js.map +1 -0
  103. package/dist/esm/translation-utils-2623783f.js.map +1 -1
  104. package/dist/esm-es5/{app-globals-91875913.js → app-globals-bd1f456b.js} +2 -2
  105. package/dist/esm-es5/{app-globals-91875913.js.map → app-globals-bd1f456b.js.map} +1 -1
  106. package/dist/esm-es5/index.js.map +1 -1
  107. package/dist/esm-es5/loader.js +1 -1
  108. package/dist/esm-es5/loader.js.map +1 -1
  109. package/dist/esm-es5/stzh-amount.entry.js +1 -1
  110. package/dist/esm-es5/stzh-amount.entry.js.map +1 -1
  111. package/dist/esm-es5/stzh-components.js +1 -1
  112. package/dist/esm-es5/stzh-components.js.map +1 -1
  113. package/dist/esm-es5/stzh-datepicker_3.entry.js.map +1 -1
  114. package/dist/esm-es5/stzh-dropdown.entry.js +2 -2
  115. package/dist/esm-es5/stzh-dropdown.entry.js.map +1 -1
  116. package/dist/esm-es5/stzh-monthyearpicker.entry.js +2 -0
  117. package/dist/esm-es5/stzh-monthyearpicker.entry.js.map +1 -0
  118. package/dist/esm-es5/stzh-pagetitle.entry.js +1 -1
  119. package/dist/esm-es5/stzh-pagetitle.entry.js.map +1 -1
  120. package/dist/esm-es5/stzh-skin-portal-mitwirken.entry.js +1 -1
  121. package/dist/esm-es5/stzh-skin-portal-mitwirken.entry.js.map +1 -1
  122. package/dist/esm-es5/stzh-timepicker.entry.js +2 -0
  123. package/dist/esm-es5/stzh-timepicker.entry.js.map +1 -0
  124. package/dist/esm-es5/translation-utils-2623783f.js.map +1 -1
  125. package/dist/stzh-components/assets/i18n/de.json +10 -7
  126. package/dist/stzh-components/assets/i18n/en.json +8 -5
  127. package/dist/stzh-components/index.esm.js.map +1 -1
  128. package/dist/stzh-components/p-14e782cb.entry.js +2 -0
  129. package/dist/stzh-components/{p-85504842.entry.js.map → p-14e782cb.entry.js.map} +1 -1
  130. package/dist/stzh-components/p-25a09313.js.map +1 -1
  131. package/dist/stzh-components/p-51f1714c.system.entry.js +2 -0
  132. package/dist/stzh-components/p-51f1714c.system.entry.js.map +1 -0
  133. package/dist/stzh-components/p-5aa96b49.system.entry.js +2 -0
  134. package/dist/stzh-components/p-5aa96b49.system.entry.js.map +1 -0
  135. package/dist/stzh-components/{p-1ef5420a.entry.js → p-6c219530.entry.js} +2 -2
  136. package/dist/stzh-components/p-6c219530.entry.js.map +1 -0
  137. package/dist/stzh-components/p-7b297848.system.entry.js +2 -0
  138. package/dist/stzh-components/p-7b297848.system.entry.js.map +1 -0
  139. package/dist/stzh-components/p-82e886d4.entry.js.map +1 -1
  140. package/dist/stzh-components/p-9f31cf7d.entry.js +2 -0
  141. package/dist/stzh-components/p-9f31cf7d.entry.js.map +1 -0
  142. package/dist/stzh-components/p-9fe69be8.system.entry.js +2 -0
  143. package/dist/stzh-components/{p-479a02fb.system.entry.js.map → p-9fe69be8.system.entry.js.map} +1 -1
  144. package/dist/stzh-components/{p-61b66e55.system.js → p-a1be7b8e.system.js} +2 -2
  145. package/dist/stzh-components/{p-61b66e55.system.js.map → p-a1be7b8e.system.js.map} +1 -1
  146. package/dist/stzh-components/p-a408bfba.system.js.map +1 -1
  147. package/dist/stzh-components/p-ad33db31.entry.js +2 -0
  148. package/dist/stzh-components/p-ad33db31.entry.js.map +1 -0
  149. package/dist/stzh-components/p-b5cda655.entry.js +2 -0
  150. package/dist/stzh-components/p-b5cda655.entry.js.map +1 -0
  151. package/dist/stzh-components/p-c0f971f2.entry.js +9 -0
  152. package/dist/stzh-components/p-c0f971f2.entry.js.map +1 -0
  153. package/dist/stzh-components/p-c901fe72.system.entry.js +9 -0
  154. package/dist/stzh-components/p-c901fe72.system.entry.js.map +1 -0
  155. package/dist/stzh-components/{p-362af013.js → p-cb675f5e.js} +2 -2
  156. package/dist/stzh-components/{p-362af013.js.map → p-cb675f5e.js.map} +1 -1
  157. package/dist/stzh-components/p-daf83e0b.system.js +2 -0
  158. package/dist/stzh-components/{p-3e10addb.system.js.map → p-daf83e0b.system.js.map} +1 -1
  159. package/dist/stzh-components/p-e8545386.system.entry.js +2 -0
  160. package/dist/stzh-components/p-e8545386.system.entry.js.map +1 -0
  161. package/dist/stzh-components/p-eaa65f52.system.js.map +1 -1
  162. package/dist/stzh-components/p-f2d74491.system.entry.js.map +1 -1
  163. package/dist/stzh-components/stzh-components.css +1 -1
  164. package/dist/stzh-components/stzh-components.esm.js +1 -1
  165. package/dist/stzh-components/stzh-components.esm.js.map +1 -1
  166. package/dist/stzh-components/stzh-components.js +1 -1
  167. package/dist/types/components/stzh-amount/stzh-amount.localization.d.ts +0 -2
  168. package/dist/types/components/stzh-monthyearpicker/stzh-monthyearpicker.localization.d.ts +5 -0
  169. package/dist/types/components/stzh-timepicker/stzh-timepicker.localization.d.ts +2 -0
  170. package/dist/types/components.d.ts +428 -6
  171. package/dist/types/index.d.ts +14 -0
  172. package/dist/types/utils/translation-utils.d.ts +1 -0
  173. package/dist/vscode-data.json +263 -1
  174. package/package.json +1 -1
  175. package/dist/stzh-components/p-1cc48f98.entry.js +0 -9
  176. package/dist/stzh-components/p-1cc48f98.entry.js.map +0 -1
  177. package/dist/stzh-components/p-1ef5420a.entry.js.map +0 -1
  178. package/dist/stzh-components/p-3e10addb.system.js +0 -2
  179. package/dist/stzh-components/p-479a02fb.system.entry.js +0 -2
  180. package/dist/stzh-components/p-67b11b03.system.entry.js +0 -2
  181. package/dist/stzh-components/p-67b11b03.system.entry.js.map +0 -1
  182. package/dist/stzh-components/p-6bb83b30.system.entry.js +0 -9
  183. package/dist/stzh-components/p-6bb83b30.system.entry.js.map +0 -1
  184. package/dist/stzh-components/p-7605ae9a.system.entry.js +0 -2
  185. package/dist/stzh-components/p-7605ae9a.system.entry.js.map +0 -1
  186. package/dist/stzh-components/p-85504842.entry.js +0 -2
  187. package/dist/stzh-components/p-c94f7331.entry.js +0 -2
  188. package/dist/stzh-components/p-c94f7331.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"stzh-amount.js","sourceRoot":"","sources":["../../../src/components/stzh-amount/stzh-amount.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,KAAK,EACL,OAAO,EACP,KAAK,EAEN,MAAM,eAAe,CAAC;AAUvB,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAEhE,MAAM,+BAA+B,GAAG,mCAAmC,CAAA;AAE3E,IAAI,aAAa,GAAG,CAAC,CAAC;AAMtB,MAAM,OAAO,UAAU;;IAYb,kBAAa,GAAY,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC;SACxG,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;IAkHnD,0GAA0G;IAClG,qBAAgB,GAAG,CAAC,KAAuD,EAAE,EAAE;MACrF,IAAI,KAAK,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MACtC,0BAA0B,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ;KAC5C,CAAC;IAEF,OAAO,CACL,EAAC,IAAI;MACH,WACE,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,IAAI,CAAC,QAAQ,IAGf,IAAI,CAAC,aAAa,CAAC,CAAC;QACpB,IAAI,CAAC,cAAc,EAAE;QACrB,CAAC;UACD,IAAI,CAAC,kBAAkB,EAAE,CAEvB,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Prop,\n h,\n Watch,\n Element,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhAmountChangeEvent,\n StzhDropdownChangeEvent,\n StzhDropdownCustomEvent,\n StzhInputChangeEvent,\n StzhInputCustomEvent,\n} from \"../../index\";\nimport { StzhAmountLocalizedText } from './stzh-amount.localization';\nimport {fetchTranslations} from '../../utils/translation-utils';\n\nconst DROPDOWN_ITEM_PLUS_OPTION_VALUE = \"stzh-amount__dropdown-plus-option\"\n\nlet amountCounter = 0;\n\n@Component({\n tag: \"stzh-amount\",\n styleUrl: \"stzh-amount.scss\"\n})\nexport class StzhAmount {\n /** The lowest allowed amount (can be negative). */\n @Prop() minValue: number = -9007199254740991;\n\n /** The highest allowed amount. */\n @Prop() maxValue: number = 9007199254740991;\n\n /** The lowest amount as option in the dropdown. Needs to be set to initially display a dropdown. */\n @Prop() minValueDropdown: number | null = null;\n\n /** The highest amount as option in the dropdown. Needs to be set to initially display a dropdown. */\n @Prop() maxValueDropdown: number | null = null;\n private _showDropdown: boolean = !Number.isNaN(this.minValueDropdown) && !Number.isNaN(this.maxValueDropdown)\n && this.minValueDropdown < this.maxValueDropdown;\n\n private _dropdownOptions: string;\n\n /** The initial value of the amount element */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** The step the amount can be increased or decreased */\n @Prop() step: number = 1;\n\n /** Name of the element (hidden select element in case of dropdown) */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Whether the amount component is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Popover placement for the dropdown (if applicable) */\n @Prop({ reflect: true }) popoverPlacement: \"bottom\" | \"bottom-end\" | \"bottom-center\" | \"top\" | \"top-end\" | \"top-center\" = \"bottom\";\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Whether clearable button is showing for the input field (does not apply to dropdown) */\n @Prop({ reflect: true }) clearable: boolean = false;\n\n /** Show text in label depending on whether field is optional/required */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** Description placed below the amount */\n @Prop() description: string;\n\n /** Long description message appearing in a popover */\n @Prop() descriptionLong: string;\n\n /** One or multiple error message(s) */\n @Prop({ mutable: true }) error: string | string[];\n private _error: string[];\n\n /** Id of the element which describes the input (this will be overwritten if description prop is used) */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = '';\n\n /** Translation strings. */\n @Prop() localization: StzhAmountLocalizedText;\n\n @Watch(\"minValueDropdown\")\n minValueDropdownWatcher() {\n this.setDropdownOptions();\n }\n\n @Watch(\"maxValueDropdown\")\n maxValueDropdownWatcher() {\n this.setDropdownOptions();\n }\n\n @Watch(\"error\")\n errorWatcher(newValue: string | string[]) {\n if (typeof newValue === \"string\") {\n try {\n this._error = JSON.parse(newValue);\n } catch (e) {\n if (newValue) {\n this._error = [newValue];\n } else {\n this._error = [];\n }\n }\n } else {\n this._error = newValue || [];\n }\n\n this.invalid = this._error.length > 0;\n }\n\n /** Update stepper button a11y-labels when value has changed */\n @Watch(\"value\")\n valueWatcher(newValue: string) {\n if (!this._showDropdown) {\n this.handleOutOfRangeValue(newValue);\n }\n }\n\n /** Amount change event */\n @Event() stzhChange: EventEmitter<StzhAmountChangeEvent>;\n\n @Element() element: HTMLStzhAmountElement;\n\n private amountId: string;\n private stepperInputId: string;\n\n /** Fill the dropdown with options according to maxValueDropdown & minValueDropdown. */\n private setDropdownOptions(): void {\n if (this._showDropdown) {\n const options = [];\n\n for (let i = this.minValueDropdown; i <= this.maxValueDropdown; i++) {\n options.push({text: i.toString(), value: i.toString()});\n }\n if (this.maxValue != undefined && this.maxValue > this.maxValueDropdown) {\n options.push({text: `${this.maxValueDropdown.toString()}+`, value: DROPDOWN_ITEM_PLUS_OPTION_VALUE})\n }\n\n this._dropdownOptions = JSON.stringify(options);\n }\n }\n\n /** Handling dropdown changes (switch to input stepper if the plus option is selected in the dropdown). */\n private onDropdownChange = (event: StzhDropdownCustomEvent<StzhDropdownChangeEvent>) => {\n if (event.detail.value === DROPDOWN_ITEM_PLUS_OPTION_VALUE) {\n this._showDropdown = false;\n this.value = (this.maxValueDropdown + this.step).toString();\n } else {\n this.value = (+event.detail.value).toString();\n }\n\n this.stzhChange.emit({\n component: \"stzh-amount\",\n value: this.value\n });\n }\n\n /** Handling the minus button. */\n private onInputMinusStepClick = () => {\n this.value = (+this.value - this.step).toString();\n this.value = this.roundToStep(+this.value).toString();\n\n this.stzhChange.emit({\n component: \"stzh-amount\",\n value: this.value\n });\n }\n\n /** Handling the plus button. */\n private onInputPlusStepClick = () => {\n this.value = (+this.value + this.step).toString();\n this.value = this.roundToStep(+this.value).toString();\n\n this.stzhChange.emit({\n component: \"stzh-amount\",\n value: this.value\n })\n }\n\n /** Handling manual value change of the stepper input. */\n private handleOutOfRangeValue(newValue: string): void {\n if (!this.localization) {\n return;\n }\n\n let currentErrors: string[] = [];\n\n if (typeof this.error === \"string\") {\n currentErrors.push(this.error);\n } else if (this.error) {\n currentErrors = [...this.error];\n }\n\n const maxValueError = this.localization.amountTooGreatError?.replace(/{maxValue}/gi, this.maxValue.toString());\n const minValueError = this.localization.amountTooSmallError?.replace(/{minValue}/gi, this.minValue.toString());\n\n if (+newValue > this.maxValue) {\n if (!currentErrors.includes(maxValueError)) {\n currentErrors.push(maxValueError);\n }\n } else if (+newValue < this.minValue) {\n if (!currentErrors.includes(minValueError)) {\n currentErrors.push(minValueError);\n }\n } else {\n currentErrors = currentErrors.filter(e => e !== maxValueError && e !== minValueError);\n }\n\n this.error = currentErrors.length > 0 ? currentErrors : [];\n }\n\n /** Handling manual value change of the stepper input. */\n private onStepperInputChange = (event: StzhInputCustomEvent<StzhInputChangeEvent>) => {\n this.value = event.detail.value;\n\n this.stzhChange.emit({\n component: \"stzh-amount\",\n value: this.value\n });\n }\n\n /** Making sure, that the value is rounded correctly according to the step */\n private roundToStep(input: number): number {\n const decimals = Math.max(0, -Math.floor(Math.log10(this.step)));\n const factor = Math.pow(10, decimals);\n const rounded = Math.round(input / this.step) * this.step;\n return Number((rounded * factor / factor).toFixed(decimals));\n }\n\n async componentWillLoad() {\n this.errorWatcher(this.error);\n this.valueWatcher(this.value);\n\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"amount\");\n }\n\n this.amountId = `stzh-amount-${amountCounter++}`;\n\n if (this._showDropdown) {\n this.setDropdownOptions()\n } else {\n this.stepperInputId = `${this.amountId}-stepper-input`\n }\n }\n\n private renderDropdown(): HTMLDivElement {\n const classes = {\n \"stzh-amount__dropdown\": true,\n [`stzh-amount--popover-placement-${this.popoverPlacement}`]: !!this.popoverPlacement,\n };\n return (\n <div class={classes}>\n <stzh-dropdown\n options={this._dropdownOptions}\n items={[this.value]}\n label={this.label}\n required={this.required}\n disabled={this.disabled}\n description={this.description}\n descriptionLong={this.descriptionLong}\n error={this.error}\n popoverPlacement={this.popoverPlacement}\n a11yDescribedby={this.a11yDescribedby}\n name={this.name}\n size={this.size}\n invalid={this.invalid}\n showMarker={this.showMarker}\n onStzhChange={this.onDropdownChange}\n ></stzh-dropdown>\n </div>\n );\n }\n\n private renderInputStepper(): HTMLDivElement {\n return (\n <div class=\"stzh-amount__stepper\">\n <div class=\"stzh-amount__stepper-wrapper\">\n <stzh-button\n class=\"stzh-amount__stepper-minus\"\n onClick={this.onInputMinusStepClick}\n variant=\"secondary\"\n icon=\"minus\"\n iconOnly={true}\n a11yControls={this.stepperInputId}\n a11yDescribedby={this.a11yDescribedby}\n a11yLabel={`${this.label} ${this.localization.stepperMinusLabel}, ${this.localization.selectedAmountMessage} ${this.value}`}\n size={this.size}\n disabled={+this.value <= +this.minValue || this.disabled}\n tabindex={this.disabled ? null : \"-1\"}\n ></stzh-button>\n <stzh-input\n class=\"stzh-amount__stepper-input\"\n value={this.value}\n type=\"number\"\n label={this.label}\n min={this.minValue}\n max={this.maxValue}\n invalid={this.invalid}\n error={this._error}\n required={this.required}\n name={this.name}\n id={this.stepperInputId}\n size={this.size}\n step={this.step}\n showMarker={this.showMarker}\n description={this.description}\n descriptionLong={this.descriptionLong}\n clearable={this.clearable}\n disabled={this.disabled}\n a11yDescribedby={this.a11yDescribedby}\n onStzhChange={this.onStepperInputChange}\n ></stzh-input>\n <stzh-button\n class=\"stzh-amount__stepper-plus\"\n onClick={this.onInputPlusStepClick}\n variant=\"secondary\"\n icon=\"plus\"\n iconOnly={true}\n a11yControls={this.stepperInputId}\n a11yDescribedby={this.a11yDescribedby}\n a11yLabel={`${this.label} ${this.localization.stepperPlusLabel}, ${this.localization.selectedAmountMessage} ${this.value}`}\n size={this.size}\n disabled={+this.value >= +this.maxValue || this.disabled}\n tabindex={this.disabled ? null : \"-1\"}\n ></stzh-button>\n </div>\n </div>\n );\n }\n\n render() {\n const classes = {\n \"stzh-amount\": true,\n \"stzh-amount--has-description\": !!this.description,\n \"stzh-amount--has-description-long\": !!this.descriptionLong,\n \"stzh-amount--has-error\": !!this.error,\n \"stzh-amount--is-required\": !!this.required,\n };\n\n return (\n <Host>\n <div\n class={classes}\n id={this.amountId}\n >\n {\n this._showDropdown ?\n this.renderDropdown()\n :\n this.renderInputStepper()\n }\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"stzh-amount.js","sourceRoot":"","sources":["../../../src/components/stzh-amount/stzh-amount.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,CAAC,EACD,KAAK,EACL,OAAO,EACP,KAAK,EAEN,MAAM,eAAe,CAAC;AAUvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,+BAA+B,GAAG,mCAAmC,CAAA;AAE3E,IAAI,aAAa,GAAG,CAAC,CAAC;AAMtB,MAAM,OAAO,UAAU;;IAYb,kBAAa,GAAY,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC;SACxG,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;IAmE3C,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;OACvB;IACH,CAAC,CAAA;IAoBD,0GAA0G;IAClG,qBAAgB,GAAG,CAAC,KAA2C,EAAE,EAAE;MACzE,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,+BAA+B,EAAE;QAC1D,IAAI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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Host,\n Prop,\n h,\n Watch,\n Element,\n Event,\n EventEmitter\n} from \"@stencil/core\";\n\nimport {\n StzhDropdownOption,\n StzhAmountChangeEvent,\n StzhDropdownChangeEvent,\n StzhInputChangeEvent,\n} from \"../../index\";\n\nimport { StzhAmountLocalizedText } from './stzh-amount.localization';\nimport { fetchTranslations } from '../../utils/translation-utils';\n\nconst DROPDOWN_ITEM_PLUS_OPTION_VALUE = \"stzh-amount__dropdown-plus-option\"\n\nlet amountCounter = 0;\n\n@Component({\n tag: \"stzh-amount\",\n styleUrl: \"stzh-amount.scss\"\n})\nexport class StzhAmount {\n /** The lowest allowed amount (can be negative). */\n @Prop() minValue: number = -9007199254740991;\n\n /** The highest allowed amount. */\n @Prop() maxValue: number = 9007199254740991;\n\n /** The lowest amount as option in the dropdown. Needs to be set to initially display a dropdown. */\n @Prop() minValueDropdown: number | null = null;\n\n /** The highest amount as option in the dropdown. Needs to be set to initially display a dropdown. */\n @Prop() maxValueDropdown: number | null = null;\n private _showDropdown: boolean = !Number.isNaN(this.minValueDropdown) && !Number.isNaN(this.maxValueDropdown)\n && this.minValueDropdown < this.maxValueDropdown;\n\n private _dropdownOptions: StzhDropdownOption[];\n\n /** The initial value of the amount element */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** The step the amount can be increased or decreased */\n @Prop() step: number = 1;\n\n /** Name of the element (hidden select element in case of dropdown) */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Whether the amount component is disabled */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Popover placement for the dropdown (if applicable) */\n @Prop({ reflect: true }) popoverPlacement: \"bottom\" | \"bottom-end\" | \"bottom-center\" | \"top\" | \"top-end\" | \"top-center\" = \"bottom\";\n\n /** Label */\n @Prop() label: string = \"\";\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Whether clearable button is showing for the input field (does not apply to dropdown) */\n @Prop({ reflect: true }) clearable: boolean = false;\n\n /** Show text in label depending on whether field is optional/required */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** Description placed below the amount */\n @Prop() description: string;\n\n /** Long description message appearing in a popover */\n @Prop() descriptionLong: string;\n\n /** One or multiple error message(s) */\n @Prop({ mutable: true }) error: string | string[];\n\n /** Id of the element which describes the input */\n @Prop({ attribute: \"a11y-describedby\" }) a11yDescribedby: string = '';\n\n /** Translation strings. */\n @Prop() localization: StzhAmountLocalizedText;\n\n @Watch(\"minValueDropdown\")\n @Watch(\"maxValueDropdown\")\n minMaxValueDropdownWatcher() {\n this.setDropdownOptions();\n }\n\n /** Amount change event */\n @Event() stzhChange: EventEmitter<StzhAmountChangeEvent>;\n\n @Element() element: HTMLStzhAmountElement;\n\n private amountId: string;\n private stepperInputId: string;\n private input: HTMLStzhInputElement | HTMLStzhDropdownElement;\n\n private onRootFocus = () => {\n if (this.input) {\n this.input.setFocus();\n }\n }\n\n /** Fill the dropdown with options according to maxValueDropdown & minValueDropdown. */\n private setDropdownOptions() {\n if (!this._showDropdown) {\n return;\n }\n\n const options = [];\n\n for (let i = this.minValueDropdown; i <= this.maxValueDropdown; i++) {\n options.push({text: i.toString(), value: i.toString()});\n }\n if (this.maxValue != undefined && this.maxValue > this.maxValueDropdown) {\n options.push({text: `${this.maxValueDropdown.toString()}+`, value: DROPDOWN_ITEM_PLUS_OPTION_VALUE})\n }\n\n this._dropdownOptions = options;\n }\n\n /** Handling dropdown changes (switch to input stepper if the plus option is selected in the dropdown). */\n private onDropdownChange = (event: CustomEvent<StzhDropdownChangeEvent>) => {\n if (event.detail.value === DROPDOWN_ITEM_PLUS_OPTION_VALUE) {\n this._showDropdown = false;\n this.value = (this.maxValueDropdown + this.step).toString();\n } else {\n this.value = event.detail.value;\n }\n\n this.stzhChange.emit({\n component: \"stzh-amount\",\n value: this.value\n });\n }\n\n /** Handling the minus button. */\n private onInputMinusStepClick = () => {\n if (Number(this.value) <= this.minValue) {\n return;\n }\n\n this.value = (Number(this.value) - this.step).toString();\n this.value = this.roundToStep(Number(this.value)).toString();\n\n this.stzhChange.emit({\n component: \"stzh-amount\",\n value: this.value\n });\n }\n\n /** Handling the plus button. */\n private onInputPlusStepClick = () => {\n if (Number(this.value) >= this.maxValue) {\n return;\n }\n\n this.value = (Number(this.value) + this.step).toString();\n this.value = this.roundToStep(Number(this.value)).toString();\n\n this.stzhChange.emit({\n component: \"stzh-amount\",\n value: this.value\n })\n }\n\n /** Handling manual value change of the stepper input. */\n private onStepperInputChange = (event: CustomEvent<StzhInputChangeEvent>) => {\n this.value = event.detail.value;\n\n this.stzhChange.emit({\n component: \"stzh-amount\",\n value: this.value\n });\n }\n\n /** Making sure, that the value is rounded correctly according to the step */\n private roundToStep(input: number): number {\n const decimals = Math.max(0, -Math.floor(Math.log10(this.step)));\n const factor = Math.pow(10, decimals);\n const rounded = Math.round(input / this.step) * this.step;\n return Number((rounded * factor / factor).toFixed(decimals));\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"amount\");\n }\n\n this.amountId = `stzh-amount-${amountCounter++}`;\n\n if (this._showDropdown) {\n this.setDropdownOptions()\n } else {\n this.stepperInputId = `${this.amountId}-stepper-input`\n }\n }\n\n private renderDropdown(): HTMLDivElement {\n const classes = {\n \"stzh-amount__dropdown\": true,\n [`stzh-amount--popover-placement-${this.popoverPlacement}`]: !!this.popoverPlacement,\n };\n return (\n <div class={classes}>\n <stzh-dropdown\n ref={(el) => (this.input = el as HTMLStzhDropdownElement)}\n options={this._dropdownOptions}\n items={[this.value]}\n label={this.label}\n required={this.required}\n disabled={this.disabled}\n description={this.description}\n descriptionLong={this.descriptionLong}\n error={this.error}\n invalid={this.invalid}\n popoverPlacement={this.popoverPlacement}\n a11yDescribedby={this.a11yDescribedby}\n name={this.name}\n size={this.size}\n showMarker={this.showMarker}\n onStzhChange={this.onDropdownChange}\n ></stzh-dropdown>\n </div>\n );\n }\n\n private renderInputStepper(): HTMLDivElement {\n return (\n <div class=\"stzh-amount__stepper\">\n <div class=\"stzh-amount__stepper-wrapper\">\n <stzh-input\n ref={(el) => (this.input = el as HTMLStzhInputElement)}\n class=\"stzh-amount__stepper-input\"\n value={this.value}\n type=\"number\"\n label={this.label}\n min={this.minValue}\n max={this.maxValue}\n error={this.error}\n invalid={this.invalid}\n required={this.required}\n name={this.name}\n id={this.stepperInputId}\n size={this.size}\n step={this.step}\n showMarker={this.showMarker}\n description={this.description}\n descriptionLong={this.descriptionLong}\n clearable={this.clearable}\n disabled={this.disabled}\n a11yDescribedby={this.a11yDescribedby}\n onStzhChange={this.onStepperInputChange}\n ></stzh-input>\n <stzh-buttongroup>\n <stzh-button\n class=\"stzh-amount__stepper-minus\"\n onClick={this.onInputMinusStepClick}\n variant=\"secondary\"\n icon=\"minus\"\n iconOnly={true}\n a11yControls={this.stepperInputId}\n a11yDescribedby={this.a11yDescribedby}\n a11yLabel={`${this.label} ${this.localization.stepperMinusLabel}, ${this.localization.selectedAmountMessage} ${this.value}`}\n size={this.size}\n a11yDisabled={Number(this.value) <= this.minValue || this.disabled}\n disabled={this.disabled}\n ></stzh-button>\n <stzh-button\n class=\"stzh-amount__stepper-plus\"\n onClick={this.onInputPlusStepClick}\n variant=\"secondary\"\n icon=\"plus\"\n iconOnly={true}\n a11yControls={this.stepperInputId}\n a11yDescribedby={this.a11yDescribedby}\n a11yLabel={`${this.label} ${this.localization.stepperPlusLabel}, ${this.localization.selectedAmountMessage} ${this.value}`}\n size={this.size}\n a11yDisabled={Number(this.value) >= this.maxValue || this.disabled}\n disabled={this.disabled}\n ></stzh-button>\n </stzh-buttongroup>\n </div>\n </div>\n );\n }\n\n render() {\n const classes = {\n \"stzh-amount\": true,\n \"stzh-amount--has-description\": !!this.description,\n \"stzh-amount--has-description-long\": !!this.descriptionLong,\n \"stzh-amount--has-error\": !!this.error,\n \"stzh-amount--is-required\": !!this.required,\n \"stzh-amount--is-disabled\": !!this.disabled\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes} id={this.amountId}>\n {\n this._showDropdown ?\n this.renderDropdown()\n :\n this.renderInputStepper()\n }\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stzh-amount.localization.js","sourceRoot":"","sources":["../../../src/components/stzh-amount/stzh-amount.localization.ts"],"names":[],"mappings":"","sourcesContent":["import { StzhLocaleComponent } from \"../../utils/translation-utils\";\n\nexport type StzhAmountLocalizedText = StzhLocaleComponent & {\n stepperMinusLabel: string,\n stepperPlusLabel: string,\n selectedAmountMessage: string,\n amountTooSmallError: string,\n amountTooGreatError: string\n}\n"]}
1
+ {"version":3,"file":"stzh-amount.localization.js","sourceRoot":"","sources":["../../../src/components/stzh-amount/stzh-amount.localization.ts"],"names":[],"mappings":"","sourcesContent":["import { StzhLocaleComponent } from \"../../utils/translation-utils\";\n\nexport type StzhAmountLocalizedText = StzhLocaleComponent & {\n stepperMinusLabel: string,\n stepperPlusLabel: string,\n selectedAmountMessage: string,\n // amountTooSmallError: string,\n // amountTooGreatError: string\n}\n"]}
@@ -13,7 +13,7 @@ const TEMPLATE = `
13
13
  `;
14
14
 
15
15
  export default {
16
- title: 'Components/Amount (Beta)',
16
+ title: 'Components/Amount',
17
17
  component: 'stzh-amount',
18
18
  parameters: {
19
19
  actions: {
@@ -108,8 +108,8 @@ export const Default = {
108
108
  args: {
109
109
  heading: 'Lorem ipsum',
110
110
  subtitle: 'Dolor si',
111
- 'header-actions': headerActions,
112
- 'footer-actions': [
111
+ headerActions: headerActions,
112
+ footerActions: [
113
113
  {
114
114
  "id": "action-1",
115
115
  "icon": "arrow-right",
@@ -129,7 +129,7 @@ export const Selectable = {
129
129
  selectable: true,
130
130
  name: 'card',
131
131
  value: '1',
132
- 'header-actions': headerActions
132
+ headerActions: headerActions
133
133
  }
134
134
  };
135
135
 
@@ -139,7 +139,7 @@ export const Starrable = {
139
139
  heading: 'Lorem ipsum',
140
140
  subtitle: 'Dolor si',
141
141
  starrable: true,
142
- 'header-actions': headerActions,
143
- 'footer-actions': footerActions
142
+ headerActions: headerActions,
143
+ footerActions: footerActions
144
144
  }
145
145
  };
@@ -3,7 +3,7 @@ import { fetchTranslations } from "../../utils/translation-utils";
3
3
  import { printISODate, parseISODate } from "../../utils/date-utils";
4
4
  import { createGlobalAdapter } from "../../utils/date-adapter";
5
5
  /**
6
- * @slot - Slot to place input, calendar and popover element inside
6
+ * @slot action - Slot for action below calendar (stzh-link element)
7
7
  */
8
8
  export class StzhDatepicker {
9
9
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"stzh-datepicker.js","sourceRoot":"","sources":["../../../src/components/stzh-datepicker/stzh-datepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,CAAC,EACD,KAAK,EAEL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACN,MAAM,eAAe,CAAC;AASvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAIjF;;GAEG;AAMH,MAAM,OAAO,cAAc;;IA+HjB,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AC,QAAQ,EACvB,SAAS,EAAE,IAAI,CAAC,WAAW,GAEf;cACd,WAAK,IAAI,EAAC,SAAS;gBACjB,qBACE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,EAA6B,CAAC,EAC5D,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAC3C,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAErB;gBAChB,WAAK,KAAK,EAAC,0BAA0B;kBACnC,YAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,CACF,CACO,CACJ,CAEX,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n Host,\n Element,\n h,\n Event,\n EventEmitter,\n Method,\n Watch,\n Fragment,\n State\n} from \"@stencil/core\";\n\nimport {\n StzhCalendarChangeEvent,\n StzhDatepickerChangeEvent\n} from \"../../index\";\n\nimport { StzhCalendarDateDisabledPredicate } from \"../../index\";\n\nimport { fetchTranslations } from \"../../utils/translation-utils\";\nimport { printISODate, parseISODate } from \"../../utils/date-utils\"\nimport { StzhLocaleAdapter, createGlobalAdapter } from \"../../utils/date-adapter\"\n\nimport { StzhDatepickerLocalizedText } from \"./stzh-datepicker.localization\";\n\n/**\n * @slot - Slot to place input, calendar and popover element inside\n */\n@Component({\n tag: \"stzh-datepicker\",\n styleUrl: \"stzh-datepicker.scss\",\n scoped: true\n})\nexport class StzhDatepicker {\n /**\n * Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the max property.\n */\n @Prop() calendarMin: string = \"\"\n\n /**\n * Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the min property.\n */\n @Prop() calendarMax: string = \"\"\n\n /**\n * Controls which days are disabled and therefore disallowed.\n * For example, this can be used to disallow selection of weekends.\n */\n @Prop() calendarIsDateDisabled: StzhCalendarDateDisabledPredicate = () => false\n\n /** Name of the hidden date picker input. */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Value of hidden date picker input (current selected date in ISO format). */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** Label for input field and popover */\n @Prop() label: string = \"\";\n\n /** Whether the element is readonly or not */\n @Prop({ reflect: true }) readonly: boolean = false;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Description message (use description slot as alternative) */\n @Prop() description: string;\n\n /** Long description message appearing in a popover (use description-long slot as alternative) */\n @Prop() descriptionLong: string;\n\n /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Show calendar inline */\n @Prop() inline: boolean = false;\n\n /**\n * Date adapter, for custom parsing/formatting.\n * Must be object with a `parse` function which accepts a `string` and returns a `Date`,\n * and a `format` function which accepts a `Date` and returns a `string`.\n */\n @Prop() dateAdapter: StzhLocaleAdapter;\n\n /** Translation strings. */\n @Prop() localization: StzhDatepickerLocalizedText;\n\n @State() buttonLabel: string;\n\n @Watch(\"localization\")\n createDateFormatters() {\n if (this.localization) {\n this.dateFormatLong = new Intl.DateTimeFormat(this.localization.$locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n })\n }\n }\n\n /** Update calendar and input when value prop has changed */\n @Watch(\"value\")\n valueWatcher(newValue: string) {\n const date = parseISODate(newValue);\n\n if (this.calendar) {\n this.calendar.value = newValue;\n }\n\n if (this.input) {\n this.input.value = this.dateAdapter.format(date, \"inputdate\");\n }\n\n this.updateButtonAccessibleLabel();\n }\n\n /** Set value by a JS Date object */\n @Method()\n async setDate(date: Date) {\n this.value = printISODate(date);\n }\n\n /** Return internal popover element */\n @Method()\n async getPopover(): Promise<HTMLStzhPopoverElement> {\n return this.popover;\n }\n\n /** Datepicker change event */\n @Event() stzhChange: EventEmitter<StzhDatepickerChangeEvent>;\n\n @Element() element: HTMLStzhDatepickerElement;\n\n /**\n * To format dates exclusively for the benefit of screen readers.\n *\n * We prefer DateTimeFormat over date.toLocaleDateString, as the former has\n * better performance when formatting large number of dates. See:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString#Performance\n */\n private dateFormatLong: Intl.DateTimeFormat\n\n private input: HTMLStzhInputElement;\n private popover: HTMLStzhPopoverElement;\n private calendar: HTMLStzhCalendarElement;\n\n private onRootFocus = () => {\n if (this.input) {\n this.input.setFocus();\n }\n }\n\n private onInputChange = () => {\n const parsedDate = this.dateAdapter.parse(this.input.value, \"inputdate\")\n\n if (this.input.value === \"\" || parsedDate) {\n const isoDate = printISODate(parsedDate);\n\n if (this.calendar) {\n this.calendar.value = isoDate;\n }\n\n this.value = isoDate;\n this.stzhChange.emit({\n component: \"stzh-datepicker\",\n value: this.value,\n valueAsDate: parsedDate,\n })\n }\n }\n\n private onCalendarChange = (event: CustomEvent<StzhCalendarChangeEvent>) => {\n this.value = event.detail.value;\n this.stzhChange.emit({\n component: \"stzh-datepicker\",\n value: this.value,\n valueAsDate: event.detail.valueAsDate,\n });\n\n if (this.input) {\n this.input.value = event.detail.valueAsDate\n && this.dateAdapter.format(event.detail.valueAsDate, \"inputdate\");\n }\n\n if (this.popover) {\n this.popover.hide();\n }\n }\n\n private updateButtonAccessibleLabel() {\n if (!this.localization) {\n return;\n }\n\n try {\n const valueAsDate = parseISODate(this.value);\n this.buttonLabel = `${this.localization.buttonLabel}, ${this.localization.selectedDateMessage} ${this.dateFormatLong.format(valueAsDate)}`;\n } catch (err) {\n this.buttonLabel = this.localization.buttonLabel;\n }\n }\n\n connectedCallback() {\n this.createDateFormatters();\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"datepicker\");\n }\n\n if (!this.dateAdapter) {\n this.dateAdapter = createGlobalAdapter(\n this.localization.$formats,\n this.localization.$globals\n );\n }\n }\n\n componentDidLoad() {\n this.valueWatcher(this.value);\n }\n\n render() {\n const classes = {\n \"stzh-datepicker\": true,\n \"stzh-datepicker--inline\": this.inline\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n <input\n type=\"hidden\"\n name={this.name}\n value={this.value}\n />\n\n {this.inline &&\n <Fragment>\n <stzh-calendar\n ref={(el) => (this.calendar = el as HTMLStzhCalendarElement)}\n isDateDisabled={this.calendarIsDateDisabled}\n min={this.calendarMin}\n max={this.calendarMax}\n onStzhChange={this.onCalendarChange}\n ></stzh-calendar>\n <div class=\"stzh-datepicker__actions\">\n <slot name=\"action\"></slot>\n </div>\n </Fragment>\n }\n\n {!this.inline &&\n <stzh-input\n label={this.label}\n ref={(el) => (this.input = el as HTMLStzhInputElement)}\n noAutocomplete\n onStzhChange={this.onInputChange}\n readonly={this.readonly}\n disabled={this.disabled}\n description={this.description}\n descriptionLong={this.descriptionLong}\n error={this.error}\n invalid={this.invalid}\n required={this.required}\n showMarker={this.showMarker}\n size={this.size}\n >\n <stzh-popover\n ref={(el) => (this.popover = el as HTMLStzhPopoverElement)}\n class=\"stzh-datepicker__popover\"\n slot=\"button-right\"\n placement=\"bottom-end\"\n label={this.label}\n >\n <stzh-button\n variant=\"input\"\n icon-only\n icon=\"calendar\"\n disabled={this.disabled}\n a11yLabel={this.buttonLabel}\n >\n </stzh-button>\n <div slot=\"content\">\n <stzh-calendar\n ref={(el) => (this.calendar = el as HTMLStzhCalendarElement)}\n isDateDisabled={this.calendarIsDateDisabled}\n min={this.calendarMin}\n max={this.calendarMax}\n onStzhChange={this.onCalendarChange}\n >\n </stzh-calendar>\n <div class=\"stzh-datepicker__actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n </stzh-popover>\n </stzh-input>\n }\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"stzh-datepicker.js","sourceRoot":"","sources":["../../../src/components/stzh-datepicker/stzh-datepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,CAAC,EACD,KAAK,EAEL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,EACN,MAAM,eAAe,CAAC;AASvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAIjF;;GAEG;AAMH,MAAM,OAAO,cAAc;;IA+HjB,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;OACvB;IACH,CAAC,CAAA;IAEO,kBAAa,GAAG,GAAG,EAAE;MAC3B,MAAM,UAA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,EAC5D,cAAc,EAAE,IAAI,CAAC,sBAAsB,EAC3C,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAErB;gBAChB,WAAK,KAAK,EAAC,0BAA0B;kBACnC,YAAM,IAAI,EAAC,QAAQ,GAAQ,CACvB,CACF,CACO,CACJ,CAEX,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n Host,\n Element,\n h,\n Event,\n EventEmitter,\n Method,\n Watch,\n Fragment,\n State\n} from \"@stencil/core\";\n\nimport {\n StzhCalendarChangeEvent,\n StzhDatepickerChangeEvent\n} from \"../../index\";\n\nimport { StzhCalendarDateDisabledPredicate } from \"../../index\";\n\nimport { fetchTranslations } from \"../../utils/translation-utils\";\nimport { printISODate, parseISODate } from \"../../utils/date-utils\"\nimport { StzhLocaleAdapter, createGlobalAdapter } from \"../../utils/date-adapter\"\n\nimport { StzhDatepickerLocalizedText } from \"./stzh-datepicker.localization\";\n\n/**\n * @slot action - Slot for action below calendar (stzh-link element)\n */\n@Component({\n tag: \"stzh-datepicker\",\n styleUrl: \"stzh-datepicker.scss\",\n scoped: true\n})\nexport class StzhDatepicker {\n /**\n * Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the max property.\n */\n @Prop() calendarMin: string = \"\"\n\n /**\n * Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the min property.\n */\n @Prop() calendarMax: string = \"\"\n\n /**\n * Controls which days are disabled and therefore disallowed.\n * For example, this can be used to disallow selection of weekends.\n */\n @Prop() calendarIsDateDisabled: StzhCalendarDateDisabledPredicate = () => false\n\n /** Name of the hidden date picker input. */\n @Prop({ reflect: true }) name: string = \"\";\n\n /** Value of hidden date picker input (current selected date in ISO format). */\n @Prop({ mutable: true }) value: string = \"\";\n\n /** Label for input field and popover */\n @Prop() label: string = \"\";\n\n /** Whether the element is readonly or not */\n @Prop({ reflect: true }) readonly: boolean = false;\n\n /** Whether the element is disabled or not */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /** Description message (use description slot as alternative) */\n @Prop() description: string;\n\n /** Long description message appearing in a popover (use description-long slot as alternative) */\n @Prop() descriptionLong: string;\n\n /** One or multiple error message (use error slot as alternative) */\n @Prop() error: string | string[];\n\n /** Invalid status */\n @Prop({ reflect: true }) invalid: boolean = false;\n\n /** Required status */\n @Prop({ reflect: true }) required: boolean = false;\n\n /** Append text to label depending if field is optional/required. true -> show \"(optional)\", false -> show nothing */\n @Prop({ reflect: true }) showMarker: boolean = false;\n\n /** Size variant */\n @Prop({ reflect: true }) size: \"default\" | \"small\" = \"default\";\n\n /** Show calendar inline */\n @Prop() inline: boolean = false;\n\n /**\n * Date adapter, for custom parsing/formatting.\n * Must be object with a `parse` function which accepts a `string` and returns a `Date`,\n * and a `format` function which accepts a `Date` and returns a `string`.\n */\n @Prop() dateAdapter: StzhLocaleAdapter;\n\n /** Translation strings. */\n @Prop() localization: StzhDatepickerLocalizedText;\n\n @State() buttonLabel: string;\n\n @Watch(\"localization\")\n createDateFormatters() {\n if (this.localization) {\n this.dateFormatLong = new Intl.DateTimeFormat(this.localization.$locale, {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n })\n }\n }\n\n /** Update calendar and input when value prop has changed */\n @Watch(\"value\")\n valueWatcher(newValue: string) {\n const date = parseISODate(newValue);\n\n if (this.calendar) {\n this.calendar.value = newValue;\n }\n\n if (this.input) {\n this.input.value = this.dateAdapter.format(date, \"inputdate\");\n }\n\n this.updateButtonAccessibleLabel();\n }\n\n /** Set value by a JS Date object */\n @Method()\n async setDate(date: Date) {\n this.value = printISODate(date);\n }\n\n /** Return internal popover element */\n @Method()\n async getPopover(): Promise<HTMLStzhPopoverElement> {\n return this.popover;\n }\n\n /** Datepicker change event */\n @Event() stzhChange: EventEmitter<StzhDatepickerChangeEvent>;\n\n @Element() element: HTMLStzhDatepickerElement;\n\n /**\n * To format dates exclusively for the benefit of screen readers.\n *\n * We prefer DateTimeFormat over date.toLocaleDateString, as the former has\n * better performance when formatting large number of dates. See:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString#Performance\n */\n private dateFormatLong: Intl.DateTimeFormat\n\n private input: HTMLStzhInputElement;\n private popover: HTMLStzhPopoverElement;\n private calendar: HTMLStzhCalendarElement;\n\n private onRootFocus = () => {\n if (this.input) {\n this.input.setFocus();\n }\n }\n\n private onInputChange = () => {\n const parsedDate = this.dateAdapter.parse(this.input.value, \"inputdate\")\n\n if (this.input.value === \"\" || parsedDate) {\n const isoDate = printISODate(parsedDate);\n\n if (this.calendar) {\n this.calendar.value = isoDate;\n }\n\n this.value = isoDate;\n this.stzhChange.emit({\n component: \"stzh-datepicker\",\n value: this.value,\n valueAsDate: parsedDate,\n })\n }\n }\n\n private onCalendarChange = (event: CustomEvent<StzhCalendarChangeEvent>) => {\n this.value = event.detail.value;\n this.stzhChange.emit({\n component: \"stzh-datepicker\",\n value: this.value,\n valueAsDate: event.detail.valueAsDate,\n });\n\n if (this.input) {\n this.input.value = event.detail.valueAsDate\n && this.dateAdapter.format(event.detail.valueAsDate, \"inputdate\");\n }\n\n if (this.popover) {\n this.popover.hide();\n }\n }\n\n private updateButtonAccessibleLabel() {\n if (!this.localization) {\n return;\n }\n\n try {\n const valueAsDate = parseISODate(this.value);\n this.buttonLabel = `${this.localization.buttonLabel}, ${this.localization.selectedDateMessage} ${this.dateFormatLong.format(valueAsDate)}`;\n } catch (err) {\n this.buttonLabel = this.localization.buttonLabel;\n }\n }\n\n connectedCallback() {\n this.createDateFormatters();\n }\n\n async componentWillLoad() {\n if (!this.localization) {\n this.localization = await fetchTranslations(this.element, \"datepicker\");\n }\n\n if (!this.dateAdapter) {\n this.dateAdapter = createGlobalAdapter(\n this.localization.$formats,\n this.localization.$globals\n );\n }\n }\n\n componentDidLoad() {\n this.valueWatcher(this.value);\n }\n\n render() {\n const classes = {\n \"stzh-datepicker\": true,\n \"stzh-datepicker--inline\": this.inline\n };\n\n return (\n <Host tabindex={this.disabled ? null : \"-1\"} onFocus={this.onRootFocus}>\n <div class={classes}>\n <input\n type=\"hidden\"\n name={this.name}\n value={this.value}\n />\n\n {this.inline &&\n <Fragment>\n <stzh-calendar\n ref={(el) => (this.calendar = el as HTMLStzhCalendarElement)}\n isDateDisabled={this.calendarIsDateDisabled}\n min={this.calendarMin}\n max={this.calendarMax}\n onStzhChange={this.onCalendarChange}\n ></stzh-calendar>\n <div class=\"stzh-datepicker__actions\">\n <slot name=\"action\"></slot>\n </div>\n </Fragment>\n }\n\n {!this.inline &&\n <stzh-input\n label={this.label}\n ref={(el) => (this.input = el as HTMLStzhInputElement)}\n noAutocomplete\n onStzhChange={this.onInputChange}\n readonly={this.readonly}\n disabled={this.disabled}\n description={this.description}\n descriptionLong={this.descriptionLong}\n error={this.error}\n invalid={this.invalid}\n required={this.required}\n showMarker={this.showMarker}\n size={this.size}\n >\n <stzh-popover\n ref={(el) => (this.popover = el as HTMLStzhPopoverElement)}\n class=\"stzh-datepicker__popover\"\n slot=\"button-right\"\n placement=\"bottom-end\"\n label={this.label}\n >\n <stzh-button\n variant=\"input\"\n icon-only\n icon=\"calendar\"\n disabled={this.disabled}\n a11yLabel={this.buttonLabel}\n >\n </stzh-button>\n <div slot=\"content\">\n <stzh-calendar\n ref={(el) => (this.calendar = el as HTMLStzhCalendarElement)}\n isDateDisabled={this.calendarIsDateDisabled}\n min={this.calendarMin}\n max={this.calendarMax}\n onStzhChange={this.onCalendarChange}\n >\n </stzh-calendar>\n <div class=\"stzh-datepicker__actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n </stzh-popover>\n </stzh-input>\n }\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -15,6 +15,9 @@ export default {
15
15
  title: 'Components/Datepicker',
16
16
  component: COMPONENT_NAME,
17
17
  parameters: {
18
+ actions: {
19
+ handles: ['stzhChange']
20
+ },
18
21
  docs: {
19
22
  description: {
20
23
  component: readme
@@ -1,3 +1,4 @@
1
+ @charset "UTF-8";
1
2
  /**
2
3
  * Colors
3
4
  */
@@ -113,12 +114,14 @@ stzh-dropdown {
113
114
  --background-color: var(--stzh-color-white);
114
115
  --label-background: var(--stzh-color-white);
115
116
  --icon-size: var(--stzh-icon-size-small);
117
+ --icon-angle-size: var(--stzh-icon-size-medium);
116
118
  --hover-color: var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));
117
119
  --hover-border-color: var(--hover-color);
118
120
  --popover-width: 100%;
119
121
  --popover-min-width: var(--stzh-popover-min-width);
120
122
  --popover-max-width: var(--stzh-popover-min-width);
121
123
  --popover-max-height: calc(6.5 * var(--stzh-menu-item-height));
124
+ --active-icon-angle-transform: rotate(180deg) translateY(50%);
122
125
  width: 100%;
123
126
  border-radius: var(--stzh-form-input-border-radius);
124
127
  /* Invalid */
@@ -141,6 +144,9 @@ stzh-dropdown[inline]:not([inline=false]) {
141
144
  --popover-width: auto;
142
145
  width: auto;
143
146
  }
147
+ stzh-dropdown[size=small] {
148
+ --icon-angle-size: var(--stzh-icon-size-small);
149
+ }
144
150
  stzh-dropdown[invalid]:not([invalid=false]) {
145
151
  --color: var(--stzh-color-error);
146
152
  --border-color: var(--stzh-color-error);
@@ -163,11 +169,6 @@ stzh-dropdown[disabled]:not([disabled=false])[variant=plain] {
163
169
  --background-color: transparent;
164
170
  }
165
171
 
166
- .stzh-dropdown__icon-wrapper stzh-icon,
167
- .stzh-dropdown__icon {
168
- --size: var(--icon-size);
169
- }
170
-
171
172
  .stzh-dropdown {
172
173
  /* Plugin: Input autogrow */
173
174
  /* Has Items */
@@ -363,14 +364,14 @@ stzh-dropdown[disabled]:not([disabled=false])[variant=plain] {
363
364
  .stzh-dropdown__icon-wrapper {
364
365
  position: absolute;
365
366
  }
366
- .stzh-dropdown__select .ts-control > input, .stzh-dropdown__select.single .stzh-dropdown__item, .stzh-dropdown__icon-wrapper, .stzh-dropdown__angle-icon {
367
+ .stzh-dropdown__select .ts-control > input, .stzh-dropdown__select.single .stzh-dropdown__item, .stzh-dropdown__icon-wrapper, .stzh-dropdown__icon-angle-wrapper {
367
368
  color: var(--color);
368
369
  transition: color var(--stzh-base-transition-animation-speed);
369
370
  }
370
371
  .stzh-dropdown__select.multi .stzh-dropdown__item {
371
372
  color: var(--stzh-color-primary, var(--stzh-color-zueriblue));
372
373
  }
373
- .stzh-dropdown__select:hover .ts-control > input, .stzh-dropdown__select:focus-within .ts-control > input, .stzh-dropdown__select.single:hover .stzh-dropdown__item, .stzh-dropdown__select.single:focus-within .stzh-dropdown__item, .stzh-dropdown__select:hover ~ .stzh-dropdown__icon-wrapper, .stzh-dropdown__select:focus-within ~ .stzh-dropdown__icon-wrapper, .stzh-dropdown__select:hover ~ .stzh-dropdown__angle-icon, .stzh-dropdown__select:focus-within ~ .stzh-dropdown__angle-icon, .stzh-dropdown__select:hover ~ .stzh-dropdown__label, .stzh-dropdown__select:focus-within ~ .stzh-dropdown__label {
374
+ .stzh-dropdown__select:hover .ts-control > input, .stzh-dropdown__select:focus-within .ts-control > input, .stzh-dropdown__select.single:hover .stzh-dropdown__item, .stzh-dropdown__select.single:focus-within .stzh-dropdown__item, .stzh-dropdown__select:hover ~ .stzh-dropdown__icon-wrapper, .stzh-dropdown__select:focus-within ~ .stzh-dropdown__icon-wrapper, .stzh-dropdown__select:hover ~ .stzh-dropdown__icon-angle-wrapper, .stzh-dropdown__select:focus-within ~ .stzh-dropdown__icon-angle-wrapper, .stzh-dropdown__select:hover ~ .stzh-dropdown__label, .stzh-dropdown__select:focus-within ~ .stzh-dropdown__label {
374
375
  color: var(--hover-color);
375
376
  }
376
377
  .stzh-dropdown__sizer {
@@ -398,22 +399,24 @@ stzh-dropdown[disabled]:not([disabled=false])[variant=plain] {
398
399
  padding: var(--stzh-space-xsmall) var(--stzh-space-medium);
399
400
  padding-right: calc(var(--stzh-icon-size-medium) + var(--stzh-space-medium) + var(--stzh-space-xsmall));
400
401
  }
401
- .stzh-dropdown__icon-wrapper, .stzh-dropdown__angle-icon {
402
+ .stzh-dropdown__icon-wrapper, .stzh-dropdown__icon-angle-wrapper {
403
+ display: flex;
402
404
  position: absolute;
403
405
  top: 50%;
404
406
  transform: translateY(-50%);
405
407
  pointer-events: none;
406
408
  }
407
409
  .stzh-dropdown__icon-wrapper {
408
- display: flex;
409
410
  left: var(--stzh-space-medium);
410
411
  }
411
- .stzh-dropdown stzh-icon.stzh-dropdown__angle-icon {
412
- --size: var(--stzh-icon-size-medium);
413
- }
414
- .stzh-dropdown__angle-icon {
412
+ .stzh-dropdown__icon-angle-wrapper {
415
413
  right: var(--stzh-space-medium);
416
- transform-origin: 50% 0%;
414
+ }
415
+ .stzh-dropdown__icon-wrapper stzh-icon, .stzh-dropdown__icon {
416
+ --size: var(--icon-size);
417
+ }
418
+ .stzh-dropdown__icon-angle-wrapper stzh-icon, .stzh-dropdown__icon-angle {
419
+ --size: var(--icon-angle-size);
417
420
  }
418
421
  .stzh-dropdown__label {
419
422
  font-family: var(--stzh-font-family-heavy);
@@ -512,6 +515,18 @@ stzh-dropdown[disabled]:not([disabled=false])[variant=plain] {
512
515
  display: none;
513
516
  color: var(--stzh-color-primary, var(--stzh-color-zueriblue));
514
517
  }
518
+ .stzh-dropdown__option.selected::before {
519
+ border: 0;
520
+ clip: rect(0 0 0 0);
521
+ -webkit-clip-path: inset(100%);
522
+ clip-path: inset(100%);
523
+ width: 0.0625rem;
524
+ height: 0.0625rem;
525
+ overflow: hidden;
526
+ padding: 0;
527
+ position: absolute;
528
+ content: "✓";
529
+ }
515
530
  .stzh-dropdown__option.selected:hover .stzh-dropdown__option-check, .stzh-dropdown__option.selected.active .stzh-dropdown__option-check {
516
531
  color: var(--stzh-color-primary-hover, var(--stzh-color-zueribluedark));
517
532
  }
@@ -577,8 +592,8 @@ stzh-dropdown[disabled]:not([disabled=false])[variant=plain] {
577
592
  .stzh-dropdown__select.has-items .ts-control > input:-ms-input-placeholder {
578
593
  color: transparent;
579
594
  }
580
- .stzh-dropdown__select.dropdown-active ~ .stzh-dropdown__angle-icon {
581
- transform: rotate(180deg) translateY(-50%);
595
+ .stzh-dropdown__select.dropdown-active ~ .stzh-dropdown__icon-angle-wrapper {
596
+ transform: var(--active-icon-angle-transform);
582
597
  }
583
598
  .stzh-dropdown--is-multiple .stzh-dropdown__option-check {
584
599
  display: inline-flex;
@@ -693,9 +708,6 @@ stzh-dropdown[disabled]:not([disabled=false])[variant=plain] {
693
708
  padding: var(--stzh-space-xxsmall) var(--stzh-space-medium);
694
709
  padding-right: calc(var(--stzh-icon-size-small) + var(--stzh-space-medium) + var(--stzh-space-xsmall));
695
710
  }
696
- .stzh-dropdown--size-small stzh-icon.stzh-dropdown__angle-icon {
697
- --size: var(--stzh-icon-size-small);
698
- }
699
711
  .stzh-dropdown--has-icon .stzh-dropdown__select.single .ts-control, .stzh-dropdown--has-icon .stzh-dropdown__select.multi .ts-control, .stzh-dropdown--has-icon .stzh-dropdown__sizer {
700
712
  padding-left: calc(var(--icon-size) + var(--stzh-space-medium) + var(--stzh-space-xsmall));
701
713
  }
@@ -710,7 +722,7 @@ stzh-dropdown[disabled]:not([disabled=false])[variant=plain] {
710
722
  .stzh-dropdown--plain .stzh-dropdown__icon-wrapper {
711
723
  left: 0;
712
724
  }
713
- .stzh-dropdown--plain .stzh-dropdown__angle-icon {
725
+ .stzh-dropdown--plain .stzh-dropdown__icon-angle-wrapper {
714
726
  right: 0;
715
727
  }
716
728
  .stzh-dropdown--plain .stzh-dropdown__label {
@@ -27,6 +27,8 @@ let dropdownCounter = 0;
27
27
  * @slot label - Slot for label content
28
28
  * @slot description - Slot for description
29
29
  * @slot description-long - Slot for long description (in popover)
30
+ * @slot icon - Slot for left icon
31
+ * @slot icon-angle - Slot for angle icon
30
32
  * @slot error - Slot for error
31
33
  */
32
34
  export class StzhDropdown {
@@ -68,6 +70,7 @@ export class StzhDropdown {
68
70
  this.popoverPlacement = "bottom";
69
71
  this.label = "";
70
72
  this.icon = "";
73
+ this.iconAngle = "angle-down";
71
74
  this.noSearch = false;
72
75
  this.noBackspaceDelete = false;
73
76
  this.invalid = false;
@@ -264,7 +267,7 @@ export class StzhDropdown {
264
267
  render: {
265
268
  option: (data, escape) => {
266
269
  return `
267
- <div class="stzh-dropdown__option" title="${escape(data[this.labelField])}">
270
+ <div class="stzh-dropdown__option">
268
271
  <stzh-icon name="checkmark" class="stzh-dropdown__option-check"></stzh-icon>
269
272
  <span class="stzh-dropdown__option-title">
270
273
  ${escape(data[this.labelField])}
@@ -288,13 +291,13 @@ export class StzhDropdown {
288
291
  },
289
292
  no_results: (data, escape) => {
290
293
  return `
291
- <div class="stzh-dropdown__no-results">
294
+ <div class="stzh-dropdown__no-results" id="${this.dropdownId}-no-results">
292
295
  ${this.localization.noResults.replace(/{x}/gi, escape(data.input))}
293
296
  </div>`;
294
297
  },
295
298
  not_loading: this.load === null ? null : (_data, escape) => {
296
299
  return `
297
- <div class="stzh-dropdown__not-loading">
300
+ <div class="stzh-dropdown__not-loading" id="${this.dropdownId}-not-loading">
298
301
  ${this.localization.notLoading.replace(/{x}/gi, escape(this.minCharacters.toString()))}
299
302
  </div>
300
303
  `;
@@ -470,15 +473,20 @@ export class StzhDropdown {
470
473
  [`stzh-dropdown--size-${this.size}`]: !!this.size,
471
474
  [`stzh-dropdown--${this.variant}`]: !!this.variant
472
475
  };
473
- return (h(Host, { tabindex: this.disabled ? null : "-1", onFocus: this.onRootFocus }, h("div", { class: classes, ref: (el) => (this.rootElement = el) }, h("div", { class: "stzh-dropdown__field-wrapper" }, h("select", { id: this.dropdownId, class: "stzh-dropdown__select", ref: (el) => (this.select = el), multiple: this.multiple, name: this.name, disabled: this.disabled }, h("slot", null)), h("stzh-icon", { name: "angle-down", class: "stzh-dropdown__angle-icon" }), h("div", { class: "stzh-dropdown__icon-wrapper" }, this.icon ?
476
+ return (h(Host, { tabindex: this.disabled ? null : "-1", onFocus: this.onRootFocus }, h("div", { class: classes, ref: (el) => (this.rootElement = el) }, h("div", { class: "stzh-dropdown__field-wrapper" }, h("select", { id: this.dropdownId, class: "stzh-dropdown__select", ref: (el) => (this.select = el), multiple: this.multiple, name: this.name, disabled: this.disabled, "aria-labelledby": `${this.dropdownId}-label ${this.dropdownId}-not-loading ${this.dropdownId}-no-results ${!this.showMarker && this.required && `${this.dropdownId}-required`} ${this.invalid && `${this.dropdownId}-invalid`} ${this.dropdownId}-description ${this.a11yDescribedby}` }, h("slot", null)), h("div", { class: "stzh-dropdown__icon-angle-wrapper" }, this.iconAngle ?
477
+ h("stzh-icon", { name: this.iconAngle, class: "stzh-dropdown__icon-angle" })
478
+ :
479
+ h("slot", { name: "icon-angle" })), h("div", { class: "stzh-dropdown__icon-wrapper" }, this.icon ?
474
480
  h("stzh-icon", { class: "stzh-dropdown__icon", name: this.icon })
475
481
  :
476
- h("slot", { name: "icon" })), h("label", { class: "stzh-dropdown__label", htmlFor: this.dropdownId, "aria-labelledby": `${this.dropdownId}-label-inner ${this.dropdownId}-description ${this.a11yDescribedby}`, "aria-describedby": `${this.dropdownId}-description ${this.a11yDescribedby}` }, h("span", { id: `${this.dropdownId}-label-inner` }, this.label ? this.label : h("slot", { name: "label" }), this.showMarker &&
482
+ h("slot", { name: "icon" })), h("label", { id: `${this.dropdownId}-label`, class: "stzh-dropdown__label", htmlFor: this.dropdownId }, this.label ? this.label : h("slot", { name: "label" }), this.showMarker &&
477
483
  h("span", { class: "stzh-dropdown__marker" }, h("span", { class: "stzh-dropdown__marker-symbol", "aria-hidden": "true" }, this.required
478
484
  ? this.localization.$globals.requiredFieldMarker
479
485
  : this.localization.$globals.optionalFieldMarker), h("span", { class: "stzh-dropdown__marker-text" }, this.required
480
486
  ? this.localization.$globals.requiredFieldText
481
- : this.localization.$globals.optionalFieldText)), h("span", { class: "stzh-dropdown__vhidden" }, ".")))), h(StzhInputDescription, { classPrefix: "stzh-dropdown", id: `${this.dropdownId}-description`, error: this._error, description: this.description, descriptionLong: this.descriptionLong, descriptionLongUsed: descriptionLongUsed, moreInfoButtonLabel: this.localization.$globals.moreInfoButtonLabel }))));
487
+ : this.localization.$globals.optionalFieldText))), !this.showMarker && this.required &&
488
+ h("div", { id: `${this.dropdownId}-required`, class: "stzh-dropdown__vhidden" }, this.localization.$globals.requiredFieldText), this.invalid &&
489
+ h("div", { id: `${this.dropdownId}-invalid`, class: "stzh-dropdown__vhidden" }, this.localization.$globals.invalidFieldText)), h(StzhInputDescription, { classPrefix: "stzh-dropdown", id: `${this.dropdownId}-description`, error: this._error, description: this.description, descriptionLong: this.descriptionLong, descriptionLongUsed: descriptionLongUsed, moreInfoButtonLabel: this.localization.$globals.moreInfoButtonLabel }))));
482
490
  }
483
491
  static get is() { return "stzh-dropdown"; }
484
492
  static get originalStyleUrls() {
@@ -497,9 +505,14 @@ export class StzhDropdown {
497
505
  "type": "string",
498
506
  "mutable": false,
499
507
  "complexType": {
500
- "original": "any[] | string",
501
- "resolved": "any[] | string",
502
- "references": {}
508
+ "original": "StzhDropdownOption[] | string",
509
+ "resolved": "StzhDropdownOption[] | string",
510
+ "references": {
511
+ "StzhDropdownOption": {
512
+ "location": "import",
513
+ "path": "../../index"
514
+ }
515
+ }
503
516
  },
504
517
  "required": false,
505
518
  "optional": false,
@@ -1031,6 +1044,24 @@ export class StzhDropdown {
1031
1044
  "reflect": false,
1032
1045
  "defaultValue": "\"\""
1033
1046
  },
1047
+ "iconAngle": {
1048
+ "type": "string",
1049
+ "mutable": false,
1050
+ "complexType": {
1051
+ "original": "string",
1052
+ "resolved": "string",
1053
+ "references": {}
1054
+ },
1055
+ "required": false,
1056
+ "optional": false,
1057
+ "docs": {
1058
+ "tags": [],
1059
+ "text": "Angle icon"
1060
+ },
1061
+ "attribute": "icon-angle",
1062
+ "reflect": false,
1063
+ "defaultValue": "\"angle-down\""
1064
+ },
1034
1065
  "noSearch": {
1035
1066
  "type": "boolean",
1036
1067
  "mutable": false,