@haiilo/catalyst 5.2.3 → 5.4.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 (189) hide show
  1. package/dist/catalyst/catalyst.css +56 -39
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.cdn.js +1 -0
  5. package/dist/catalyst/index.esm.js +2 -2
  6. package/dist/catalyst/index.esm.js.map +1 -1
  7. package/dist/catalyst/p-34e0cbba.entry.js +10 -0
  8. package/dist/catalyst/p-34e0cbba.entry.js.map +1 -0
  9. package/dist/catalyst/{p-d1fb9d96.js → p-ce6a1db2.js} +1 -1
  10. package/dist/catalyst/p-ce6a1db2.js.map +1 -0
  11. package/dist/catalyst/p-cf32399c.js +2 -0
  12. package/dist/catalyst/p-cf32399c.js.map +1 -0
  13. package/dist/catalyst/scss/_snippets/_checkbox-hint.scss +20 -0
  14. package/dist/catalyst/scss/_snippets/_form-label.scss +2 -1
  15. package/dist/catalyst/scss/utils/_border.scss +14 -0
  16. package/dist/catalyst/scss/utils/_media.mixins.scss +0 -1
  17. package/dist/catalyst/scss/utils/_typography.mixins.scss +1 -0
  18. package/dist/cjs/{cat-alert_24.cjs.entry.js → cat-alert_27.cjs.entry.js} +3777 -192
  19. package/dist/cjs/cat-alert_27.cjs.entry.js.map +1 -0
  20. package/dist/cjs/{cat-icon-registry-671af264.js → cat-icon-registry-228164a1.js} +43 -2
  21. package/dist/cjs/cat-icon-registry-228164a1.js.map +1 -0
  22. package/dist/cjs/catalyst.cjs.js +3 -3
  23. package/dist/cjs/catalyst.cjs.js.map +1 -1
  24. package/dist/cjs/{index-01312a2e.js → index-4258b31e.js} +8 -1
  25. package/dist/{catalyst/p-d1fb9d96.js.map → cjs/index-4258b31e.js.map} +1 -1
  26. package/dist/cjs/index.cjs.js +2 -2
  27. package/dist/cjs/index.cjs.js.map +1 -1
  28. package/dist/cjs/loader.cjs.js +3 -3
  29. package/dist/cjs/loader.cjs.js.map +1 -1
  30. package/dist/collection/collection-manifest.json +5 -2
  31. package/dist/collection/components/cat-alert/cat-alert.js +5 -5
  32. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  33. package/dist/collection/components/cat-button/cat-button.css +27 -9
  34. package/dist/collection/components/cat-button/cat-button.js +27 -25
  35. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  36. package/dist/collection/components/cat-button-group/cat-button-group.css +15 -0
  37. package/dist/collection/components/cat-button-group/cat-button-group.js +51 -0
  38. package/dist/collection/components/cat-button-group/cat-button-group.js.map +1 -0
  39. package/dist/collection/components/cat-checkbox/cat-checkbox.css +24 -1
  40. package/dist/collection/components/cat-checkbox/cat-checkbox.js +8 -4
  41. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  42. package/dist/collection/components/cat-datepicker/cat-datepicker.css +381 -0
  43. package/dist/collection/components/cat-datepicker/cat-datepicker.js +873 -0
  44. package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -0
  45. package/dist/collection/components/cat-datepicker/datepicker-type.js +8 -0
  46. package/dist/collection/components/cat-datepicker/datepicker-type.js.map +1 -0
  47. package/dist/collection/components/cat-datepicker/dayjs.config.js +8 -0
  48. package/dist/collection/components/cat-datepicker/dayjs.config.js.map +1 -0
  49. package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js +46 -0
  50. package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js.map +1 -0
  51. package/dist/collection/components/cat-dropdown/cat-dropdown.css +1 -0
  52. package/dist/collection/components/cat-dropdown/cat-dropdown.js +26 -7
  53. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  54. package/dist/collection/components/cat-form-group/cat-form-group.js +29 -1
  55. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
  56. package/dist/collection/components/cat-icon/cat-icon-registry.js +29 -1
  57. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
  58. package/dist/collection/components/cat-input/cat-input.css +392 -15
  59. package/dist/collection/components/cat-input/cat-input.js +8 -4
  60. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  61. package/dist/collection/components/cat-label/cat-label.js +19 -0
  62. package/dist/collection/components/cat-label/cat-label.js.map +1 -1
  63. package/dist/collection/components/cat-notification/cat-notification.js +1 -1
  64. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  65. package/dist/collection/components/cat-pagination/cat-pagination.js +28 -6
  66. package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
  67. package/dist/collection/components/cat-radio/cat-radio.css +24 -1
  68. package/dist/collection/components/cat-radio/cat-radio.js +8 -4
  69. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  70. package/dist/collection/components/cat-radio-group/cat-radio-group.js +7 -3
  71. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  72. package/dist/collection/components/cat-scrollable/cat-scrollable.css +1 -4
  73. package/dist/collection/components/cat-select/cat-select.css +98 -11
  74. package/dist/collection/components/cat-select/cat-select.js +73 -23
  75. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  76. package/dist/collection/components/cat-skeleton/cat-skeleton.css +1 -1
  77. package/dist/collection/components/cat-textarea/cat-textarea.css +17 -16
  78. package/dist/collection/components/cat-textarea/cat-textarea.js +8 -4
  79. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  80. package/dist/collection/components/cat-timepicker/cat-timepicker.css +5 -0
  81. package/dist/collection/components/cat-timepicker/cat-timepicker.js +668 -0
  82. package/dist/collection/components/cat-timepicker/cat-timepicker.js.map +1 -0
  83. package/dist/collection/components/cat-toggle/cat-toggle.css +24 -1
  84. package/dist/collection/components/cat-toggle/cat-toggle.js +8 -4
  85. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  86. package/dist/collection/components/cat-tooltip/cat-tooltip.css +1 -8
  87. package/dist/collection/components/cat-tooltip/cat-tooltip.js +22 -18
  88. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  89. package/dist/collection/index.cdn.js +1 -0
  90. package/dist/collection/scss/_snippets/_checkbox-hint.scss +20 -0
  91. package/dist/collection/scss/_snippets/_form-label.scss +2 -1
  92. package/dist/collection/scss/utils/_border.scss +14 -0
  93. package/dist/collection/scss/utils/_media.mixins.scss +0 -1
  94. package/dist/collection/scss/utils/_typography.mixins.scss +1 -0
  95. package/dist/components/cat-alert.js +5 -5
  96. package/dist/components/cat-alert.js.map +1 -1
  97. package/dist/components/cat-button-group.d.ts +11 -0
  98. package/dist/components/cat-button-group.js +46 -0
  99. package/dist/components/cat-button-group.js.map +1 -0
  100. package/dist/components/cat-button2.js +12 -10
  101. package/dist/components/cat-button2.js.map +1 -1
  102. package/dist/components/cat-checkbox2.js +2 -2
  103. package/dist/components/cat-checkbox2.js.map +1 -1
  104. package/dist/components/cat-datepicker.d.ts +11 -0
  105. package/dist/components/cat-datepicker.js +3210 -0
  106. package/dist/components/cat-datepicker.js.map +1 -0
  107. package/dist/components/cat-dropdown2.js +640 -43
  108. package/dist/components/cat-dropdown2.js.map +1 -1
  109. package/dist/components/cat-form-group.js +11 -2
  110. package/dist/components/cat-form-group.js.map +1 -1
  111. package/dist/components/cat-icon-registry.js +42 -1
  112. package/dist/components/cat-icon-registry.js.map +1 -1
  113. package/dist/components/cat-input.js +1 -226
  114. package/dist/components/cat-input.js.map +1 -1
  115. package/dist/components/cat-input2.js +230 -0
  116. package/dist/components/cat-input2.js.map +1 -0
  117. package/dist/components/cat-label.js +2 -0
  118. package/dist/components/cat-label.js.map +1 -1
  119. package/dist/components/cat-pagination.js +10 -5
  120. package/dist/components/cat-pagination.js.map +1 -1
  121. package/dist/components/cat-radio-group.js.map +1 -1
  122. package/dist/components/cat-radio.js +2 -2
  123. package/dist/components/cat-radio.js.map +1 -1
  124. package/dist/components/cat-scrollable2.js +7 -5
  125. package/dist/components/cat-scrollable2.js.map +1 -1
  126. package/dist/components/cat-select-demo.js +2 -2
  127. package/dist/components/cat-select-demo.js.map +1 -1
  128. package/dist/components/cat-select2.js +46 -17
  129. package/dist/components/cat-select2.js.map +1 -1
  130. package/dist/components/cat-skeleton2.js +1 -1
  131. package/dist/components/cat-skeleton2.js.map +1 -1
  132. package/dist/components/cat-textarea.js +3 -3
  133. package/dist/components/cat-textarea.js.map +1 -1
  134. package/dist/components/cat-timepicker.d.ts +11 -0
  135. package/dist/components/cat-timepicker.js +258 -0
  136. package/dist/components/cat-timepicker.js.map +1 -0
  137. package/dist/components/cat-toggle.js +2 -2
  138. package/dist/components/cat-toggle.js.map +1 -1
  139. package/dist/components/cat-tooltip.js +24 -20
  140. package/dist/components/cat-tooltip.js.map +1 -1
  141. package/dist/components/floating-ui.dom.esm.js +142 -56
  142. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  143. package/dist/components/index.js +1 -1
  144. package/dist/components/index.js.map +1 -1
  145. package/dist/esm/{cat-alert_24.entry.js → cat-alert_27.entry.js} +3775 -193
  146. package/dist/esm/cat-alert_27.entry.js.map +1 -0
  147. package/dist/esm/{cat-icon-registry-d6b80490.js → cat-icon-registry-4bd597f4.js} +43 -2
  148. package/dist/esm/cat-icon-registry-4bd597f4.js.map +1 -0
  149. package/dist/esm/catalyst.js +4 -4
  150. package/dist/esm/catalyst.js.map +1 -1
  151. package/dist/esm/{index-fc2f91a4.js → index-636ce8d6.js} +8 -1
  152. package/dist/esm/index-636ce8d6.js.map +1 -0
  153. package/dist/esm/index.js +3 -3
  154. package/dist/esm/index.js.map +1 -1
  155. package/dist/esm/loader.js +4 -4
  156. package/dist/esm/loader.js.map +1 -1
  157. package/dist/types/components/cat-button/cat-button.d.ts +4 -5
  158. package/dist/types/components/cat-button-group/cat-button-group.d.ts +11 -0
  159. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +1 -1
  160. package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +187 -0
  161. package/dist/types/components/cat-datepicker/datepicker-type.d.ts +7 -0
  162. package/dist/types/components/cat-datepicker/datepicker.d.ts +1 -0
  163. package/dist/types/components/cat-datepicker/dayjs.config.d.ts +3 -0
  164. package/dist/types/components/cat-datepicker/vanillajs-datepicker.config.d.ts +4 -0
  165. package/dist/types/components/cat-form-group/cat-form-group.d.ts +5 -0
  166. package/dist/types/components/cat-input/cat-input.d.ts +1 -1
  167. package/dist/types/components/cat-label/cat-label.d.ts +4 -0
  168. package/dist/types/components/cat-pagination/cat-pagination.d.ts +6 -0
  169. package/dist/types/components/cat-radio/cat-radio.d.ts +1 -1
  170. package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +1 -1
  171. package/dist/types/components/cat-select/cat-select.d.ts +10 -1
  172. package/dist/types/components/cat-textarea/cat-textarea.d.ts +1 -1
  173. package/dist/types/components/cat-timepicker/cat-timepicker.d.ts +158 -0
  174. package/dist/types/components/cat-toggle/cat-toggle.d.ts +1 -1
  175. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +2 -2
  176. package/dist/types/components.d.ts +585 -17
  177. package/package.json +22 -18
  178. package/dist/catalyst/p-ccfebe33.js +0 -2
  179. package/dist/catalyst/p-ccfebe33.js.map +0 -1
  180. package/dist/catalyst/p-d135d677.entry.js +0 -10
  181. package/dist/catalyst/p-d135d677.entry.js.map +0 -1
  182. package/dist/cjs/cat-alert_24.cjs.entry.js.map +0 -1
  183. package/dist/cjs/cat-icon-registry-671af264.js.map +0 -1
  184. package/dist/cjs/index-01312a2e.js.map +0 -1
  185. package/dist/components/first-tabbable.js +0 -464
  186. package/dist/components/first-tabbable.js.map +0 -1
  187. package/dist/esm/cat-alert_24.entry.js.map +0 -1
  188. package/dist/esm/cat-icon-registry-d6b80490.js.map +0 -1
  189. package/dist/esm/index-fc2f91a4.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cat-timepicker.js","sourceRoot":"","sources":["../../../src/components/cat-timepicker/cat-timepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,K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CAAC,CAAC;EACzC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Prop, State } from '@stencil/core';\n// import log from 'loglevel';\nimport { ErrorMap } from '../cat-form-hint/cat-form-hint';\n// import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { of } from 'rxjs';\nimport { CatSelectMultipleTaggingValue, CatSelectState, CatSelectTaggingValue, Item } from '../cat-select/cat-select';\nimport { Placement } from '@floating-ui/dom';\n// import IMask from 'imask';\n\ninterface Time extends Item {\n hour: number;\n minutes: number;\n}\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-timepicker',\n styleUrl: 'cat-timepicker.scss',\n shadow: true\n})\nexport class CatTimepicker {\n private timeSelect?: HTMLCatSelectElement;\n // private timeMask?: IMask.InputMask<IMask.AnyMaskedOptions>;\n\n @Element() hostElement!: HTMLElement;\n\n @State() state?: CatSelectState;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n @State() errorMap?: ErrorMap;\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Enable multiple selection.\n */\n @Prop() multiple = false;\n\n /**\n * The placement of the select.\n */\n @Prop() placement: Placement = 'bottom-start';\n\n /**\n * The value of the select. <br />\n * <br />\n * The value of the select depends on whether it is allowed to choose a single item or several items. <br />\n * When only one item can be selected, the value is the id of the item, in case several items can be selected, the value is an array of ids of the selected items. <br />\n * <br />\n * In case the user can add new items to the select (tags activated), the value in the single select is an object (CatSelectTaggingValue) with the id of the item or the name of the created item,\n * in the case of multiple select, it is an object (CatSelectMultipleTaggingValue) with the array of the ids of the items selected and the array of the names of the items created\n */\n @Prop({ mutable: true }) value?: string | string[] | CatSelectTaggingValue | CatSelectMultipleTaggingValue;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The placeholder text to display within the select.\n */\n @Prop() placeholder?: string;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A value is required or must be checked for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Whether the select should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: string;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: string;\n\n /**\n * The text to display in the dropdown if no results are found.\n */\n @Prop() noItems?: string;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() minutesStep = 30;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() hourShort = this.isBrowserHour12();\n\n /**\n * Emitted when the select dropdown is opened.\n */\n @Event() catOpen!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the select dropdown is closed.\n */\n @Event() catClose!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the select loses the focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n }\n\n componentDidLoad(): void {\n this.timeSelect?.connect(this.timeConnector);\n\n // IMask spike\n // const input = this.hostElement.shadowRoot?.querySelector('cat-select')?.shadowRoot?.querySelector('input');\n // if (input) {\n // this.timeMask = this.getTimeMask(input);\n // }\n }\n\n render() {\n return (\n <Host>\n <cat-select\n requiredMarker={this.requiredMarker}\n horizontal={this.horizontal}\n clearable={this.clearable}\n disabled={this.disabled}\n hint={this.hint}\n identifier={this.identifier}\n label={this.label}\n labelHidden={this.labelHidden}\n name={this.name}\n multiple={this.multiple}\n placeholder={this.placeholder}\n placement={this.placement}\n required={this.required}\n noItems={this.noItems}\n ref={el => (this.timeSelect = el)}\n value={this.value}\n errors={this.errors}\n errorUpdate={this.errorUpdate}\n nativeAttributes={this.nativeAttributes}\n onCatChange={event => this.onCatChange(event)}\n onCatOpen={this.onCatOpen.bind(this)}\n onCatClose={this.onCatClose.bind(this)}\n onCatBlur={this.onCatBlur.bind(this)}\n >\n {this.hasSlottedLabel && (\n <span slot=\"label\">\n <slot name=\"label\"></slot>\n </span>\n )}\n {this.hasSlottedHint && (\n <span slot=\"hint\">\n <slot name=\"hint\"></slot>\n </span>\n )}\n </cat-select>\n </Host>\n );\n }\n\n private get timeConnector() {\n return {\n resolve: (times: string[]) => {\n return of(\n times.map(t =>\n this.timeArray.find(time => time.hour === this.getHour(t) && time.minutes === this.getMinutes(t))\n )\n );\n },\n retrieve: (term: string) => {\n const filteredTimeArray = this.timeArray.filter(t => {\n if (!term) return true;\n const formatedTime = this.hourShort ? this.formatAMPM(t.hour, t.minutes) : this.formatTime(t.hour, t.minutes);\n return formatedTime.toUpperCase().includes(term.toUpperCase());\n });\n return of({\n last: true,\n totalElements: filteredTimeArray.length,\n content: filteredTimeArray\n });\n },\n render: ({ hour, minutes }: Time) => ({\n label: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes)\n })\n };\n }\n\n private get timeArray() {\n const times: Time[] = [];\n for (let hour = 0; hour < 24; hour++) {\n for (let minutes = 0; minutes < 60; minutes += this.minutesStep) {\n if (this.isHigherThanMinValue(hour, minutes) && this.isLowerThanMaxValue(hour, minutes)) {\n times.push({\n id: this.hourShort ? this.formatAMPM(hour, minutes) : this.formatTime(hour, minutes),\n hour,\n minutes\n });\n }\n }\n }\n return times;\n }\n\n private isBrowserHour12() {\n const browserLanguage = window?.navigator?.language ?? 'en';\n const hour = new Intl.DateTimeFormat(browserLanguage, { hour: 'numeric' }).format(new Date().setHours(16));\n return hour.toLowerCase().includes('pm' || 'am');\n }\n\n private getHour(time: string) {\n let hour = Number(time.split(':')[0]);\n if (time.toLowerCase().includes('pm') && hour < 12) hour = hour + 12;\n if (time.toLowerCase().includes('am') && hour == 12) hour = hour - 12;\n\n return hour;\n }\n\n private getMinutes(time: string) {\n const minutes = time.match(/:(\\d+)/);\n return Number(minutes ? minutes[1] : 0);\n }\n\n private isHigherThanMinValue(hour: number, minutes: number) {\n if (this.min) {\n const minHour = this.getHour(this.min);\n const minMinutes = this.getMinutes(this.min);\n\n return hour > minHour || (hour === minHour && minutes >= minMinutes);\n }\n\n return true;\n }\n\n private isLowerThanMaxValue(hour: number, minutes: number) {\n if (this.max) {\n const maxHour = this.getHour(this.max);\n const maxMinutes = this.getMinutes(this.max);\n\n return hour < maxHour || (hour === maxHour && minutes <= maxMinutes);\n }\n\n return true;\n }\n\n private formatAMPM(hour: number, minutes: number) {\n if (hour === 0) {\n return `12:${minutes < 10 ? `0${minutes}` : minutes} AM`;\n } else if (hour < 12) {\n return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes} AM`;\n } else {\n return `${hour % 12 < 10 ? `0${hour % 12}` : hour % 12}:${minutes < 10 ? `0${minutes}` : minutes} PM`;\n }\n }\n\n private formatTime(hour: number, minutes: number) {\n return `${hour < 10 ? `0${hour}` : hour}:${minutes < 10 ? `0${minutes}` : minutes}`;\n }\n\n private onCatChange(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.value = this.timeSelect?.value;\n this.catChange.emit(event);\n }\n\n private onCatOpen(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catOpen.emit(event as FocusEvent);\n }\n\n private onCatClose(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catClose.emit(event as FocusEvent);\n }\n\n private onCatBlur(event: unknown) {\n (event as CustomEvent).stopPropagation();\n this.catBlur.emit(event as FocusEvent);\n }\n\n // IMask spike\n\n // private getTimeMask(element: HTMLInputElement): IMask.InputMask<IMask.AnyMaskedOptions> {\n // return IMask(element, {\n // mask: 'HH:MM[ PM]',\n // lazy: true,\n // blocks: {\n // HH: {\n // mask: IMask.MaskedRange,\n // from: 0,\n // to: 23\n // },\n\n // MM: {\n // mask: IMask.MaskedRange,\n // from: 0,\n // to: 59\n // },\n\n // PM: {\n // mask: IMask.MaskedEnum,\n // enum: ['AM', 'PM', 'am', 'pm']\n // }\n // }\n // });\n // }\n}\n"]}
@@ -12,11 +12,30 @@
12
12
  .hint-section .input-hint,
13
13
  .hint-section ::slotted([slot=hint]) {
14
14
  font-size: 0.875rem;
15
- line-height: 1rem;
15
+ line-height: 1.125rem;
16
16
  font-weight: var(--cat-font-weight-body, 400);
17
17
  margin: 0 !important;
18
18
  }
19
19
 
20
+ .hint-wrapper {
21
+ flex: 0 1 auto;
22
+ display: flex;
23
+ gap: 0.5rem;
24
+ }
25
+
26
+ .hint-section {
27
+ flex: 1 1 auto;
28
+ min-width: 0;
29
+ }
30
+
31
+ .input-hint,
32
+ ::slotted([slot=hint]) {
33
+ color: rgb(var(--cat-font-color-muted, 81, 92, 108));
34
+ line-height: 1.5;
35
+ flex: 1 1 auto;
36
+ min-width: 0;
37
+ }
38
+
20
39
  :host {
21
40
  display: flex;
22
41
  flex-direction: column;
@@ -56,6 +75,10 @@ input {
56
75
  cursor: inherit;
57
76
  }
58
77
 
78
+ .toggle-placeholder {
79
+ width: calc(2rem + 1px);
80
+ }
81
+
59
82
  .toggle {
60
83
  flex: 0 0 auto;
61
84
  display: flex;
@@ -62,7 +62,7 @@ export class CatToggle {
62
62
  this.input.click();
63
63
  }
64
64
  render() {
65
- return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value !== undefined ? String(this.value) : this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), h("span", { class: "toggle", part: "toggle" }), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) }))));
65
+ return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, h("input", Object.assign({}, this.nativeAttributes, { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value !== undefined ? String(this.value) : this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) })), h("span", { class: "toggle", part: "toggle" }), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), (this.hint || this.hasSlottedHint) && (h("div", { class: { 'hint-wrapper': true, 'label-left': this.labelLeft } }, h("div", { class: "toggle-placeholder" }), h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }) })))));
66
66
  }
67
67
  onInput(event) {
68
68
  this.checked = this.input.checked;
@@ -302,9 +302,13 @@ export class CatToggle {
302
302
  "text": "Emitted when the checked status of the toggle is changed."
303
303
  },
304
304
  "complexType": {
305
- "original": "any",
306
- "resolved": "any",
307
- "references": {}
305
+ "original": "InputEvent",
306
+ "resolved": "InputEvent",
307
+ "references": {
308
+ "InputEvent": {
309
+ "location": "global"
310
+ }
311
+ }
308
312
  }
309
313
  }, {
310
314
  "method": "catFocus",
@@ -1 +1 @@
1
- {"version":3,"file":"cat-toggle.js","sourceRoot":"","sources":["../../../src/components/cat-toggle/cat-toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,I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I,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CAC7G,CACI,CACR,CAAC;EACJ,CAAC;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAElC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;MAClD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC;KAC3B;IACD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC7B,CAAC;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Toggles are graphical interface switches that give user control over a\n * feature or option that can be turned on or off.\n *\n * @slot hint - Optional hint element to be displayed with the toggle.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part toggle - The toggle element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-toggle',\n styleUrls: ['cat-toggle.scss'],\n shadow: true\n})\nexport class CatToggle {\n private readonly _id = `cat-toggle-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n /**\n * Checked state of the toggle.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Disabled state of the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label of the toggle that is visible.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input\n */\n @Prop() name?: string;\n\n /**\n * Required state of the toggle.\n */\n @Prop() required = false;\n\n /**\n * The value of the toggle\n */\n @Prop({ mutable: true }) value?: string | boolean;\n\n /**\n * Optional hint text(s) to be displayed with the toggle.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the toggle.\n */\n @Prop() labelLeft = false;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the checked status of the toggle is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the toggle received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on toggle', this);\n }\n }\n\n /**\n * Programmatically move focus to the toggle. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Programmatically remove focus from the toggle. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Programmatically simulate a click on the toggle.\n */\n @Method()\n async doClick(): Promise<void> {\n this.input.click();\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value !== undefined ? String(this.value) : this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n class=\"form-check-input\"\n role=\"switch\"\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"toggle\" part=\"toggle\"></span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {(this.hint || this.hasSlottedHint) && (\n <CatFormHint id={this.id} hint={this.hint} slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>} />\n )}\n </Host>\n );\n }\n\n private onInput(event: InputEvent) {\n this.checked = this.input.checked;\n\n if (!this.value || typeof this.value === 'boolean') {\n this.value = this.checked;\n }\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
1
+ {"version":3,"file":"cat-toggle.js","sourceRoot":"","sources":["../../../src/components/cat-toggle/cat-toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EA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event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Toggles are graphical interface switches that give user control over a\n * feature or option that can be turned on or off.\n *\n * @slot hint - Optional hint element to be displayed with the toggle.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part toggle - The toggle element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-toggle',\n styleUrls: ['cat-toggle.scss'],\n shadow: true\n})\nexport class CatToggle {\n private readonly _id = `cat-toggle-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n /**\n * Checked state of the toggle.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Disabled state of the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label of the toggle that is visible.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input\n */\n @Prop() name?: string;\n\n /**\n * Required state of the toggle.\n */\n @Prop() required = false;\n\n /**\n * The value of the toggle\n */\n @Prop({ mutable: true }) value?: string | boolean;\n\n /**\n * Optional hint text(s) to be displayed with the toggle.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the toggle.\n */\n @Prop() labelLeft = false;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * Emitted when the checked status of the toggle is changed.\n */\n @Event() catChange!: EventEmitter<InputEvent>;\n\n /**\n * Emitted when the toggle received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.warn('[A11y] Missing ARIA label on toggle', this);\n }\n }\n\n /**\n * Programmatically move focus to the toggle. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Programmatically remove focus from the toggle. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Programmatically simulate a click on the toggle.\n */\n @Method()\n async doClick(): Promise<void> {\n this.input.click();\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value !== undefined ? String(this.value) : this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n class=\"form-check-input\"\n role=\"switch\"\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"toggle\" part=\"toggle\"></span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {(this.hint || this.hasSlottedHint) && (\n <div class={{ 'hint-wrapper': true, 'label-left': this.labelLeft }}>\n <div class=\"toggle-placeholder\"></div>\n <CatFormHint id={this.id} hint={this.hint} slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>} />\n </div>\n )}\n </Host>\n );\n }\n\n private onInput(event: InputEvent) {\n this.checked = this.input.checked;\n\n if (!this.value || typeof this.value === 'boolean') {\n this.value = this.checked;\n }\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
@@ -20,7 +20,7 @@
20
20
  left: 0;
21
21
  box-sizing: border-box;
22
22
  font-size: 0.875rem;
23
- line-height: 1rem;
23
+ line-height: 1.125rem;
24
24
  font-weight: 500;
25
25
  background-color: rgb(var(--cat-bg-tooltip, 0, 0, 0));
26
26
  border-radius: var(--cat-border-radius-m, 0.25rem);
@@ -71,11 +71,4 @@
71
71
  }
72
72
  .tooltip-l.tooltip-round {
73
73
  padding: 1rem 1.5rem;
74
- }
75
-
76
- .tooltip-trigger {
77
- display: inline-block;
78
- }
79
- .tooltip-trigger:focus {
80
- outline: none;
81
74
  }
@@ -1,6 +1,5 @@
1
1
  import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom';
2
2
  import { h, Host } from '@stencil/core';
3
- import firstTabbable from '../../utils/first-tabbable';
4
3
  import isTouchScreen from '../../utils/is-touch-screen';
5
4
  let nextUniqueId = 0;
6
5
  export class CatTooltip {
@@ -21,24 +20,22 @@ export class CatTooltip {
21
20
  key === 'Escape' && this.hideListener();
22
21
  }
23
22
  componentDidLoad() {
24
- var _a, _b, _c, _d, _e, _f, _g;
25
- this.trigger = firstTabbable(this.triggerElement) || this.triggerElement;
26
- if (!this.isTabbable) {
27
- (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('tabindex', '0');
28
- }
29
- if (this.trigger && this.tooltip) {
30
- autoUpdate(this.trigger, this.tooltip, () => this.update());
23
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
24
+ const slot = (_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
25
+ this.trigger = (_c = (_b = slot === null || slot === void 0 ? void 0 : slot.assignedElements) === null || _b === void 0 ? void 0 : _b.call(slot)) === null || _c === void 0 ? void 0 : _c[0];
26
+ if (this.trigger && !this.trigger.hasAttribute('aria-describedby')) {
27
+ this.trigger.setAttribute('aria-describedby', this.id);
31
28
  }
32
29
  if (isTouchScreen) {
33
30
  window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));
34
- (_b = this.trigger) === null || _b === void 0 ? void 0 : _b.addEventListener('touchstart', this.touchStartListener.bind(this));
35
- (_c = this.trigger) === null || _c === void 0 ? void 0 : _c.addEventListener('touchend', this.touchEndListener.bind(this));
31
+ (_d = this.trigger) === null || _d === void 0 ? void 0 : _d.addEventListener('touchstart', this.touchStartListener.bind(this));
32
+ (_e = this.trigger) === null || _e === void 0 ? void 0 : _e.addEventListener('touchend', this.touchEndListener.bind(this));
36
33
  }
37
34
  else {
38
- (_d = this.trigger) === null || _d === void 0 ? void 0 : _d.addEventListener('focusin', this.showListener.bind(this));
39
- (_e = this.trigger) === null || _e === void 0 ? void 0 : _e.addEventListener('focusout', this.hideListener.bind(this));
40
- (_f = this.trigger) === null || _f === void 0 ? void 0 : _f.addEventListener('mouseenter', this.showListener.bind(this));
41
- (_g = this.trigger) === null || _g === void 0 ? void 0 : _g.addEventListener('mouseleave', this.hideListener.bind(this));
35
+ (_f = this.trigger) === null || _f === void 0 ? void 0 : _f.addEventListener('focusin', this.showListener.bind(this));
36
+ (_g = this.trigger) === null || _g === void 0 ? void 0 : _g.addEventListener('focusout', this.hideListener.bind(this));
37
+ (_h = this.trigger) === null || _h === void 0 ? void 0 : _h.addEventListener('mouseenter', this.showListener.bind(this));
38
+ (_j = this.trigger) === null || _j === void 0 ? void 0 : _j.addEventListener('mouseleave', this.hideListener.bind(this));
42
39
  }
43
40
  }
44
41
  componentWillRender() {
@@ -60,16 +57,13 @@ export class CatTooltip {
60
57
  }
61
58
  }
62
59
  render() {
63
- return (h(Host, null, h("div", { ref: el => (this.triggerElement = el), "aria-describedby": this.id, class: "tooltip-trigger" }, h("slot", null)), h("div", { ref: el => (this.tooltip = el), id: this.id, "aria-hidden": this.hidden, class: {
60
+ return (h(Host, null, h("slot", null), h("div", { ref: el => (this.tooltip = el), id: this.id, "aria-hidden": this.hidden, class: {
64
61
  tooltip: true,
65
62
  'tooltip-hidden': this.hidden,
66
63
  'tooltip-round': this.round,
67
64
  [`tooltip-${this.size}`]: Boolean(this.size)
68
65
  } }, this.hasSlottedContent ? h("slot", { name: "content" }) : this.content)));
69
66
  }
70
- get isTabbable() {
71
- return firstTabbable(this.trigger);
72
- }
73
67
  async update() {
74
68
  if (this.trigger && this.tooltip) {
75
69
  await computePosition(this.trigger, this.tooltip, {
@@ -97,6 +91,7 @@ export class CatTooltip {
97
91
  this.hideTimeout = window.setTimeout(() => {
98
92
  var _a;
99
93
  (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.remove('tooltip-show');
94
+ this.hideTooltip();
100
95
  }, this.hideDelay);
101
96
  }
102
97
  touchStartListener(event) {
@@ -108,6 +103,7 @@ export class CatTooltip {
108
103
  touchEndListener() {
109
104
  if (this.touchTimeout) {
110
105
  window.clearTimeout(this.touchTimeout);
106
+ this.hideTooltip();
111
107
  }
112
108
  }
113
109
  windowTouchStartListener() {
@@ -116,8 +112,16 @@ export class CatTooltip {
116
112
  }
117
113
  showTooltip() {
118
114
  var _a;
115
+ if (this.trigger && this.tooltip) {
116
+ this.cleanupFloatingUi = autoUpdate(this.trigger, this.tooltip, () => this.update());
117
+ }
119
118
  !this.hidden && ((_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.classList.add('tooltip-show'));
120
119
  }
120
+ hideTooltip() {
121
+ if (this.cleanupFloatingUi) {
122
+ this.cleanupFloatingUi();
123
+ }
124
+ }
121
125
  static get is() { return "cat-tooltip"; }
122
126
  static get encapsulation() { return "shadow"; }
123
127
  static get originalStyleUrls() {
@@ -1 +1 @@
1
- {"version":3,"file":"cat-tooltip.js","sourceRoot":"","sources":["../../../src/components/cat-tooltip/cat-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAa,KAAK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I,CAAC,WAAW,CAAC,CAAC;IACtC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;;MACxC,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;EACrB,CAAC;EAEO,kBAAkB,CAAC,KAAY;IACrC,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;MACzC,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;EAC7B,CAAC;EAEO,gBAAgB;IACtB,IAAI,IAAI,CAAC,YAAY,EAAE;MACrB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACxC;EACH,CAAC;EAEO,wBAAwB;;IAC9B,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;EACjD,CAAC;EAEO,WAAW;;IACjB,CAAC,IAAI,CAAC,MAAM,KAAI,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA,CAAC;EAC9D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAlLuB,iBAAM,GAAG,CAAC,CAAC;AACX,wBAAa,GAAG,CAAC,CAAC","sourcesContent":["import { autoUpdate, computePosition, flip, offset, Placement, shift } from '@floating-ui/dom';\nimport { Component, Element, h, Host, Listen, Prop, State } from '@stencil/core';\nimport { FocusableElement } from 'tabbable';\nimport firstTabbable from '../../utils/first-tabbable';\nimport isTouchScreen from '../../utils/is-touch-screen';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-tooltip',\n styleUrl: 'cat-tooltip.scss',\n shadow: true\n})\nexport class CatTooltip {\n private static readonly OFFSET = 4;\n private static readonly SHIFT_PADDING = 4;\n private readonly id = `cat-tooltip-${nextUniqueId++}`;\n private tooltip?: HTMLElement;\n private triggerElement?: HTMLElement;\n private trigger?: FocusableElement;\n private showTimeout?: number;\n private hideTimeout?: number;\n private touchTimeout?: number;\n private hidden = false;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedContent = false;\n\n /**\n * The content of the tooltip.\n */\n @Prop() content = '';\n\n /**\n * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,\n * and invisible. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * The placement of the tooltip.\n */\n @Prop() placement: Placement = 'top';\n\n /**\n * Use round tooltip edges.\n */\n @Prop() round = false;\n\n /**\n * The size of the tooltip.\n */\n @Prop() size: 's' | 'm' | 'l' = 'm';\n\n /**\n * The delay time for showing tooltip in ms.\n */\n @Prop() showDelay = 250;\n\n /**\n * The delay time for hiding tooltip in ms.\n */\n @Prop() hideDelay = 0;\n\n /**\n * The duration of tap to show the tooltip.\n */\n @Prop() longTouchDuration = 1000;\n\n @Listen('keydown')\n handleKeyDown({ key }: KeyboardEvent) {\n key === 'Escape' && this.hideListener();\n }\n\n componentDidLoad(): void {\n this.trigger = firstTabbable(this.triggerElement) || this.triggerElement;\n if (!this.isTabbable) {\n this.trigger?.setAttribute('tabindex', '0');\n }\n\n if (this.trigger && this.tooltip) {\n autoUpdate(this.trigger, this.tooltip, () => this.update());\n }\n\n if (isTouchScreen) {\n window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));\n this.trigger?.addEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.addEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.addEventListener('focusin', this.showListener.bind(this));\n this.trigger?.addEventListener('focusout', this.hideListener.bind(this));\n this.trigger?.addEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.addEventListener('mouseleave', this.hideListener.bind(this));\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedContent = !!this.hostElement.querySelector('[slot=\"content\"]');\n this.hidden = this.disabled || (!this.content && !this.hasSlottedContent);\n }\n\n disconnectedCallback(): void {\n if (isTouchScreen) {\n window.removeEventListener('touchstart', this.windowTouchStartListener.bind(this));\n this.trigger?.removeEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.removeEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.removeEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.removeEventListener('mouseleave', this.hideListener.bind(this));\n this.trigger?.removeEventListener('focusin', this.showListener.bind(this));\n this.trigger?.removeEventListener('focusout', this.hideListener.bind(this));\n }\n }\n\n render() {\n return (\n <Host>\n <div ref={el => (this.triggerElement = el)} aria-describedby={this.id} class=\"tooltip-trigger\">\n <slot />\n </div>\n <div\n ref={el => (this.tooltip = el)}\n id={this.id}\n aria-hidden={this.hidden}\n class={{\n tooltip: true,\n 'tooltip-hidden': this.hidden,\n 'tooltip-round': this.round,\n [`tooltip-${this.size}`]: Boolean(this.size)\n }}\n >\n {this.hasSlottedContent ? <slot name=\"content\" /> : this.content}\n </div>\n </Host>\n );\n }\n\n private get isTabbable() {\n return firstTabbable(this.trigger);\n }\n\n private async update() {\n if (this.trigger && this.tooltip) {\n await computePosition(this.trigger, this.tooltip, {\n strategy: 'fixed',\n placement: this.placement,\n middleware: [offset(CatTooltip.OFFSET), flip(), shift({ padding: CatTooltip.SHIFT_PADDING })]\n }).then(({ x, y }) => {\n if (this.tooltip) {\n Object.assign(this.tooltip.style, {\n left: `${Math.max(0, x)}px`,\n top: `${y}px`\n });\n }\n });\n }\n }\n\n private showListener() {\n window.clearTimeout(this.hideTimeout);\n this.showTimeout = window.setTimeout(() => {\n this.showTooltip();\n }, this.showDelay);\n }\n\n private hideListener() {\n window.clearTimeout(this.showTimeout);\n this.hideTimeout = window.setTimeout(() => {\n this.tooltip?.classList.remove('tooltip-show');\n }, this.hideDelay);\n }\n\n private touchStartListener(event: Event) {\n event.stopPropagation();\n this.touchTimeout = window.setTimeout(() => {\n this.showTooltip();\n }, this.longTouchDuration);\n }\n\n private touchEndListener() {\n if (this.touchTimeout) {\n window.clearTimeout(this.touchTimeout);\n }\n }\n\n private windowTouchStartListener() {\n this.tooltip?.classList.remove('tooltip-show');\n }\n\n private showTooltip() {\n !this.hidden && this.tooltip?.classList.add('tooltip-show');\n }\n}\n"]}
1
+ {"version":3,"file":"cat-tooltip.js","sourceRoot":"","sources":["../../../src/components/cat-tooltip/cat-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAa,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,IAAI,YAAY,GAAG,CAAC,CAAC;AAOrB,MAAM,OAAO,UAAU;;IAGJ,OAAE,GAAG,eAAe,YAAY,EAAE,EAAE,CAAC;IAM9C,WAAM,GAAG,KAAK,CAAC;6BAKM,KAAK;mBAKhB,EAAE;oBAMD,KAAK;qBAKO,KAAK;iBAKpB,KAAK;gBAKW,GAAG;qBAKf,GAAG;qBAKH,CAAC;6BAKO,IAAI;;EAGhC,aAAa,CAAC,EAAE,GAAG,EAAiB;IAClC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;EAC1C,CAAC;EAED,gBAAgB;;IACd,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,WAAW,CAAC,UAAU,0CAAE,aAAa,CAAC,M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AAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;KACtF;IACD,CAAC,IAAI,CAAC,MAAM,KAAI,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA,CAAC;EAC9D,CAAC;EAEO,WAAW;IACjB,IAAI,IAAI,CAAC,iBAAiB,EAAE;MAC1B,IAAI,CAAC,iBAAiB,EAAE,CAAC;KAC1B;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AApLuB,iBAAM,GAAG,CAAC,CAAC;AACX,wBAAa,GAAG,CAAC,CAAC","sourcesContent":["import { autoUpdate, computePosition, flip, offset, Placement, shift } from '@floating-ui/dom';\nimport { Component, Element, h, Host, Listen, Prop, State } from '@stencil/core';\nimport isTouchScreen from '../../utils/is-touch-screen';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-tooltip',\n styleUrl: 'cat-tooltip.scss',\n shadow: true\n})\nexport class CatTooltip {\n private static readonly OFFSET = 4;\n private static readonly SHIFT_PADDING = 4;\n private readonly id = `cat-tooltip-${nextUniqueId++}`;\n private tooltip?: HTMLElement;\n private trigger?: Element;\n private showTimeout?: number;\n private hideTimeout?: number;\n private touchTimeout?: number;\n private hidden = false;\n private cleanupFloatingUi?: () => void;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedContent = false;\n\n /**\n * The content of the tooltip.\n */\n @Prop() content = '';\n\n /**\n * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,\n * and invisible. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * The placement of the tooltip.\n */\n @Prop() placement: Placement = 'top';\n\n /**\n * Use round tooltip edges.\n */\n @Prop() round = false;\n\n /**\n * The size of the tooltip.\n */\n @Prop() size: 's' | 'm' | 'l' = 'm';\n\n /**\n * The delay time for showing tooltip in ms.\n */\n @Prop() showDelay = 250;\n\n /**\n * The delay time for hiding tooltip in ms.\n */\n @Prop() hideDelay = 0;\n\n /**\n * The duration of tap to show the tooltip.\n */\n @Prop() longTouchDuration = 1000;\n\n @Listen('keydown')\n handleKeyDown({ key }: KeyboardEvent) {\n key === 'Escape' && this.hideListener();\n }\n\n componentDidLoad(): void {\n const slot = this.hostElement.shadowRoot?.querySelector('slot');\n this.trigger = slot?.assignedElements?.()?.[0];\n if (this.trigger && !this.trigger.hasAttribute('aria-describedby')) {\n this.trigger.setAttribute('aria-describedby', this.id);\n }\n\n if (isTouchScreen) {\n window.addEventListener('touchstart', this.windowTouchStartListener.bind(this));\n this.trigger?.addEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.addEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.addEventListener('focusin', this.showListener.bind(this));\n this.trigger?.addEventListener('focusout', this.hideListener.bind(this));\n this.trigger?.addEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.addEventListener('mouseleave', this.hideListener.bind(this));\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedContent = !!this.hostElement.querySelector('[slot=\"content\"]');\n this.hidden = this.disabled || (!this.content && !this.hasSlottedContent);\n }\n\n disconnectedCallback(): void {\n if (isTouchScreen) {\n window.removeEventListener('touchstart', this.windowTouchStartListener.bind(this));\n this.trigger?.removeEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.removeEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.removeEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.removeEventListener('mouseleave', this.hideListener.bind(this));\n this.trigger?.removeEventListener('focusin', this.showListener.bind(this));\n this.trigger?.removeEventListener('focusout', this.hideListener.bind(this));\n }\n }\n\n render() {\n return (\n <Host>\n <slot />\n <div\n ref={el => (this.tooltip = el)}\n id={this.id}\n aria-hidden={this.hidden}\n class={{\n tooltip: true,\n 'tooltip-hidden': this.hidden,\n 'tooltip-round': this.round,\n [`tooltip-${this.size}`]: Boolean(this.size)\n }}\n >\n {this.hasSlottedContent ? <slot name=\"content\" /> : this.content}\n </div>\n </Host>\n );\n }\n\n private async update() {\n if (this.trigger && this.tooltip) {\n await computePosition(this.trigger, this.tooltip, {\n strategy: 'fixed',\n placement: this.placement,\n middleware: [offset(CatTooltip.OFFSET), flip(), shift({ padding: CatTooltip.SHIFT_PADDING })]\n }).then(({ x, y }) => {\n if (this.tooltip) {\n Object.assign(this.tooltip.style, {\n left: `${Math.max(0, x)}px`,\n top: `${y}px`\n });\n }\n });\n }\n }\n\n private showListener() {\n window.clearTimeout(this.hideTimeout);\n this.showTimeout = window.setTimeout(() => {\n this.showTooltip();\n }, this.showDelay);\n }\n\n private hideListener() {\n window.clearTimeout(this.showTimeout);\n this.hideTimeout = window.setTimeout(() => {\n this.tooltip?.classList.remove('tooltip-show');\n this.hideTooltip();\n }, this.hideDelay);\n }\n\n private touchStartListener(event: Event) {\n event.stopPropagation();\n this.touchTimeout = window.setTimeout(() => {\n this.showTooltip();\n }, this.longTouchDuration);\n }\n\n private touchEndListener() {\n if (this.touchTimeout) {\n window.clearTimeout(this.touchTimeout);\n this.hideTooltip();\n }\n }\n\n private windowTouchStartListener() {\n this.tooltip?.classList.remove('tooltip-show');\n }\n\n private showTooltip() {\n if (this.trigger && this.tooltip) {\n this.cleanupFloatingUi = autoUpdate(this.trigger, this.tooltip, () => this.update());\n }\n !this.hidden && this.tooltip?.classList.add('tooltip-show');\n }\n\n private hideTooltip() {\n if (this.cleanupFloatingUi) {\n this.cleanupFloatingUi();\n }\n }\n}\n"]}
@@ -27,6 +27,7 @@
27
27
  'input.clear': 'Clear',
28
28
  'input.optional': 'Optional',
29
29
  'input.required': 'Required',
30
+ 'input.today': 'Today',
30
31
  'notification.dismiss': 'Dismiss',
31
32
  'pagination.prev': 'Previous',
32
33
  'pagination.page': 'Go to page {{page}}',
@@ -0,0 +1,20 @@
1
+ @use 'variables' as *;
2
+
3
+ .hint-wrapper {
4
+ flex: 0 1 auto;
5
+ display: flex;
6
+ gap: 0.5rem;
7
+ }
8
+
9
+ .hint-section {
10
+ flex: 1 1 auto;
11
+ min-width: 0;
12
+ }
13
+
14
+ .input-hint,
15
+ ::slotted([slot='hint']) {
16
+ color: cat-token('color.ui.font.muted');
17
+ line-height: 1.5;
18
+ flex: 1 1 auto;
19
+ min-width: 0;
20
+ }
@@ -47,7 +47,8 @@ $cat-input-height: 2.5rem;
47
47
  }
48
48
 
49
49
  .input-horizontal,
50
- .textarea-horizontal {
50
+ .textarea-horizontal,
51
+ .select-horizontal {
51
52
  .label-wrapper {
52
53
  flex-direction: column;
53
54
  }
@@ -27,6 +27,20 @@
27
27
  border: 1px solid cat-token('color.ui.border.default');
28
28
  }
29
29
 
30
+ @each $side in top, right, bottom, left {
31
+ .cat-border-#{$side} {
32
+ border-#{$side}: 1px solid cat-token('color.ui.border.default');
33
+
34
+ &-light {
35
+ border-#{$side}: 1px solid cat-token('color.ui.border.light');
36
+ }
37
+
38
+ &-dark {
39
+ border-#{$side}: 1px solid cat-token('color.ui.border.dark');
40
+ }
41
+ }
42
+ }
43
+
30
44
  .cat-border-dark {
31
45
  border: 1px solid cat-token('color.ui.border.dark');
32
46
  }
@@ -3,7 +3,6 @@
3
3
  // ---- Responsive
4
4
 
5
5
  @mixin until($size, $media-type: screen) {
6
- @debug 'until', $size;
7
6
  @media #{$media-type} and (max-width: #{cat-token('size.screen.#{$size}') - 1px}) {
8
7
  @content;
9
8
  }
@@ -27,6 +27,7 @@ $font-fallback-monospace: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation M
27
27
  line-height: cat-head-line-height($size);
28
28
  color: cat-token('color.ui.font.head');
29
29
  font-weight: $weight;
30
+ font-feature-settings: 'pnum';
30
31
  }
31
32
 
32
33
  // ---- Body
@@ -15,11 +15,11 @@ const CatAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
15
  this.__registerHost();
16
16
  this.__attachShadow();
17
17
  this.mapIcon = new Map([
18
- ['primary', 'star-circle-filled'],
19
- ['secondary', 'clock-filled'],
20
- ['success', 'check-circle-filled'],
21
- ['warning', 'danger-filled'],
22
- ['danger', 'cross-circle-filled']
18
+ ['primary', '$cat:alert-primary'],
19
+ ['secondary', '$cat:alert-secondary'],
20
+ ['success', '$cat:alert-success'],
21
+ ['warning', '$cat:alert-warning'],
22
+ ['danger', '$cat:alert-danger']
23
23
  ]);
24
24
  this.mapRole = new Map([
25
25
  ['primary', 'status'],
@@ -1 +1 @@
1
- {"file":"cat-alert.js","mappings":";;;SAAgB,mBAAmB,CACjC,IAAO,EACP,IAAY,EACZ,KAAc;EAEd,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE;IACzD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;GACpD;AACH;;ACRA,MAAM,WAAW,GAAG,sgCAAsgC;;MCY7gCA,UAAQ;;;;;IACF,YAAO,GAAwB,IAAI,GAAG,CAAC;MACtD,CAAC,SAAS,EAAE,oBAAoB,CAAC;MACjC,CAAC,WAAW,EAAE,cAAc,CAAC;MAC7B,CAAC,SAAS,EAAE,qBAAqB,CAAC;MAClC,CAAC,SAAS,EAAE,eAAe,CAAC;MAC5B,CAAC,QAAQ,EAAE,qBAAqB,CAAC;KAClC,CAAC,CAAC;IACc,YAAO,GAAwB,IAAI,GAAG,CAAC;MACtD,CAAC,SAAS,EAAE,QAAQ,CAAC;MACrB,CAAC,WAAW,EAAE,QAAQ,CAAC;MACvB,CAAC,SAAS,EAAE,QAAQ,CAAC;MACrB,CAAC,SAAS,EAAE,OAAO,CAAC;MACpB,CAAC,QAAQ,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;iBAO0F,SAAS;;kBAUrF,KAAK;;EAEtB,iBAAiB;IACf,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACzC,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;GACjE;EAED,MAAM;IACJ,QACE,EAAC,IAAI,QACF,CAAC,IAAI,CAAC,MAAM,IAAI,gBAAU,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAa,EAC3G,WAAK,KAAK,EAAC,SAAS,IAClB,eAAa,CACT,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatAlert"],"sources":["./src/utils/setDefault.ts","./src/components/cat-alert/cat-alert.scss?tag=cat-alert&encapsulation=shadow","./src/components/cat-alert/cat-alert.tsx"],"sourcesContent":["export function setAttributeDefault<T extends { hostElement: HTMLElement }>(\n host: T,\n attr: string,\n value: unknown\n): void {\n if (!host.hostElement.hasAttribute(attr) && value != null) {\n host.hostElement.setAttribute(attr, String(value));\n }\n}\n\nexport function setAttribute<T extends { hostElement: HTMLElement }>(host: T, attr: string, value: unknown): void {\n host.hostElement.setAttribute(attr, String(value));\n}\n","@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n// -----\n\n$-icon-colors: (\n 'primary': cat-token('color.theme.primary.text'),\n 'secondary': cat-token('color.base.neutral.400'),\n 'success': cat-token('color.base.green.400'),\n 'warning': cat-token('color.base.orange.400'),\n 'danger': cat-token('color.base.red.400')\n);\n\n// -----\n\n:host {\n display: flex;\n gap: 0.5rem;\n padding: 1.25rem;\n border-radius: cat-border-radius('l');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n:host(:focus-visible) {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n}\n\n.content {\n align-self: center;\n}\n\n::slotted(:last-child) {\n margin-bottom: 0 !important;\n}\n\n// ----- theme\n\n@mixin theme($theme) {\n :host([color='#{$theme}']) {\n background-color: cat-token('color.theme.#{$theme}.bg', 0.1);\n\n cat-icon {\n color: map.get($-icon-colors, $theme);\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n","import { Component, Element, h, Host, Prop } from '@stencil/core';\nimport { setAttributeDefault } from '../../utils/setDefault';\n\n/**\n * Informs user about important changes or conditions in the interface. Use this\n * component if you need to capture user’s attention in a prominent way.\n */\n@Component({\n tag: 'cat-alert',\n styleUrl: 'cat-alert.scss',\n shadow: true\n})\nexport class CatAlert {\n private readonly mapIcon: Map<string, string> = new Map([\n ['primary', 'star-circle-filled'],\n ['secondary', 'clock-filled'],\n ['success', 'check-circle-filled'],\n ['warning', 'danger-filled'],\n ['danger', 'cross-circle-filled']\n ]);\n private readonly mapRole: Map<string, string> = new Map([\n ['primary', 'status'],\n ['secondary', 'status'],\n ['success', 'status'],\n ['warning', 'alert'],\n ['danger', 'alert']\n ]);\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The color palette of the alert.\n */\n @Prop({ reflect: true }) color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The name of an icon to be displayed in the alert.\n */\n @Prop() icon?: string;\n\n /**\n * Whether the icon of the alert is deactivated.\n */\n @Prop() noIcon = false;\n\n connectedCallback() {\n setAttributeDefault(this, 'tabindex', 0);\n setAttributeDefault(this, 'role', this.mapRole.get(this.color));\n }\n\n render() {\n return (\n <Host>\n {!this.noIcon && <cat-icon size=\"l\" icon={this.icon ? this.icon : this.mapIcon.get(this.color)}></cat-icon>}\n <div class=\"content\">\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":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AO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAa,EAC3G,WAAK,KAAK,EAAC,SAAS,IAClB,eAAa,CACT,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatAlert"],"sources":["./src/utils/setDefault.ts","./src/components/cat-alert/cat-alert.scss?tag=cat-alert&encapsulation=shadow","./src/components/cat-alert/cat-alert.tsx"],"sourcesContent":["export function setAttributeDefault<T extends { hostElement: HTMLElement }>(\n host: T,\n attr: string,\n value: unknown\n): void {\n if (!host.hostElement.hasAttribute(attr) && value != null) {\n host.hostElement.setAttribute(attr, String(value));\n }\n}\n\nexport function setAttribute<T extends { hostElement: HTMLElement }>(host: T, attr: string, value: unknown): void {\n host.hostElement.setAttribute(attr, String(value));\n}\n","@use 'variables' as *;\n@use 'mixins' as *;\n@use 'sass:map';\n\n// -----\n\n$-icon-colors: (\n 'primary': cat-token('color.theme.primary.text'),\n 'secondary': cat-token('color.base.neutral.400'),\n 'success': cat-token('color.base.green.400'),\n 'warning': cat-token('color.base.orange.400'),\n 'danger': cat-token('color.base.red.400')\n);\n\n// -----\n\n:host {\n display: flex;\n gap: 0.5rem;\n padding: 1.25rem;\n border-radius: cat-border-radius('l');\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n:host(:focus-visible) {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n}\n\n.content {\n align-self: center;\n}\n\n::slotted(:last-child) {\n margin-bottom: 0 !important;\n}\n\n// ----- theme\n\n@mixin theme($theme) {\n :host([color='#{$theme}']) {\n background-color: cat-token('color.theme.#{$theme}.bg', 0.1);\n\n cat-icon {\n color: map.get($-icon-colors, $theme);\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n","import { Component, Element, h, Host, Prop } from '@stencil/core';\nimport { setAttributeDefault } from '../../utils/setDefault';\n\n/**\n * Informs user about important changes or conditions in the interface. Use this\n * component if you need to capture user’s attention in a prominent way.\n */\n@Component({\n tag: 'cat-alert',\n styleUrl: 'cat-alert.scss',\n shadow: true\n})\nexport class CatAlert {\n private readonly mapIcon: Map<string, string> = new Map([\n ['primary', '$cat:alert-primary'],\n ['secondary', '$cat:alert-secondary'],\n ['success', '$cat:alert-success'],\n ['warning', '$cat:alert-warning'],\n ['danger', '$cat:alert-danger']\n ]);\n private readonly mapRole: Map<string, string> = new Map([\n ['primary', 'status'],\n ['secondary', 'status'],\n ['success', 'status'],\n ['warning', 'alert'],\n ['danger', 'alert']\n ]);\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The color palette of the alert.\n */\n @Prop({ reflect: true }) color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The name of an icon to be displayed in the alert.\n */\n @Prop() icon?: string;\n\n /**\n * Whether the icon of the alert is deactivated.\n */\n @Prop() noIcon = false;\n\n connectedCallback() {\n setAttributeDefault(this, 'tabindex', 0);\n setAttributeDefault(this, 'role', this.mapRole.get(this.color));\n }\n\n render() {\n return (\n <Host>\n {!this.noIcon && <cat-icon size=\"l\" icon={this.icon ? this.icon : this.mapIcon.get(this.color)}></cat-icon>}\n <div class=\"content\">\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface CatButtonGroup extends Components.CatButtonGroup, HTMLElement {}
4
+ export const CatButtonGroup: {
5
+ prototype: CatButtonGroup;
6
+ new (): CatButtonGroup;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,46 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const catButtonGroupCss = ":host{position:relative;display:inline-flex;vertical-align:middle}::slotted(cat-button[variant=outlined]),::slotted(cat-button:not([variant])){margin-right:-1px}::slotted(cat-button[variant=outlined]:last-child),::slotted(cat-button:not([variant]):last-child){margin-right:0}";
4
+
5
+ const CatButtonGroup$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ this.formElements = [];
11
+ this.a11yLabel = undefined;
12
+ }
13
+ render() {
14
+ return (h(Host, { role: "group", "aria-label": this.a11yLabel }, h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
15
+ }
16
+ onSlotChange() {
17
+ this.formElements = Array.from(this.hostElement.querySelectorAll('cat-button'));
18
+ this.formElements.forEach((element, index) => {
19
+ element.buttonGroupPosition = index === 0 ? 'first' : index === this.formElements.length - 1 ? 'last' : 'middle';
20
+ });
21
+ }
22
+ get hostElement() { return this; }
23
+ static get style() { return catButtonGroupCss; }
24
+ }, [1, "cat-button-group", {
25
+ "a11yLabel": [1, "a11y-label"]
26
+ }]);
27
+ function defineCustomElement$1() {
28
+ if (typeof customElements === "undefined") {
29
+ return;
30
+ }
31
+ const components = ["cat-button-group"];
32
+ components.forEach(tagName => { switch (tagName) {
33
+ case "cat-button-group":
34
+ if (!customElements.get(tagName)) {
35
+ customElements.define(tagName, CatButtonGroup$1);
36
+ }
37
+ break;
38
+ } });
39
+ }
40
+
41
+ const CatButtonGroup = CatButtonGroup$1;
42
+ const defineCustomElement = defineCustomElement$1;
43
+
44
+ export { CatButtonGroup, defineCustomElement };
45
+
46
+ //# sourceMappingURL=cat-button-group.js.map
@@ -0,0 +1 @@
1
+ {"file":"cat-button-group.js","mappings":";;AAAA,MAAM,iBAAiB,GAAG,qRAAqR;;MCOlSA,gBAAc;;;;;IACjB,iBAAY,GAA2B,EAAE,CAAC;;;EAUlD,MAAM;IACJ,QACE,EAAC,IAAI,IAAC,IAAI,EAAC,OAAO,gBAAa,IAAI,CAAC,SAAS,IAC3C,YAAM,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAS,CACpD,EACP;GACH;EAEO,YAAY;IAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;IAEhF,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK;MACvC,OAAO,CAAC,mBAAmB,GAAG,KAAK,KAAK,CAAC,GAAG,OAAO,GAAG,KAAK,KAAK,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,QAAQ,CAAC;KAClH,CAAC,CAAC;GACJ;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatButtonGroup"],"sources":["./src/components/cat-button-group/cat-button-group.scss?tag=cat-button-group&encapsulation=shadow","./src/components/cat-button-group/cat-button-group.tsx"],"sourcesContent":[":host {\n position: relative;\n display: inline-flex;\n vertical-align: middle;\n}\n\n::slotted(cat-button[variant='outlined']),\n::slotted(cat-button:not([variant])) {\n margin-right: -1px;\n}\n\n::slotted(cat-button[variant='outlined']:last-child),\n::slotted(cat-button:not([variant]):last-child) {\n margin-right: 0;\n}\n","import { Component, Element, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'cat-button-group',\n styleUrl: 'cat-button-group.scss',\n shadow: true\n})\nexport class CatButtonGroup {\n private formElements: HTMLCatButtonElement[] = [];\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * Adds an accessible label for the button group that\n * it is only shown in assistive technologies, like screen readers.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n render() {\n return (\n <Host role=\"group\" aria-label={this.a11yLabel}>\n <slot onSlotchange={this.onSlotChange.bind(this)}></slot>\n </Host>\n );\n }\n\n private onSlotChange(): void {\n this.formElements = Array.from(this.hostElement.querySelectorAll('cat-button'));\n\n this.formElements.forEach((element, index) => {\n element.buttonGroupPosition = index === 0 ? 'first' : index === this.formElements.length - 1 ? 'last' : 'middle';\n });\n }\n}\n"],"version":3}