@haiilo/catalyst 6.2.0 → 6.2.2

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 (54) hide show
  1. package/dist/catalyst/catalyst.css +18 -18
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/p-cd1f4492.entry.js +10 -0
  4. package/dist/catalyst/p-cd1f4492.entry.js.map +1 -0
  5. package/dist/catalyst/scss/_snippets/_form-label.scss +4 -4
  6. package/dist/cjs/cat-alert_25.cjs.entry.js +72 -60
  7. package/dist/cjs/cat-alert_25.cjs.entry.js.map +1 -1
  8. package/dist/collection/components/cat-alert/cat-alert.css +1 -1
  9. package/dist/collection/components/cat-badge/cat-badge.css +1 -1
  10. package/dist/collection/components/cat-button/cat-button.css +2 -2
  11. package/dist/collection/components/cat-checkbox/cat-checkbox.css +2 -2
  12. package/dist/collection/components/cat-dropdown/cat-dropdown.css +2 -2
  13. package/dist/collection/components/cat-input/cat-input.css +21 -21
  14. package/dist/collection/components/cat-input/cat-input.js +1 -4
  15. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  16. package/dist/collection/components/cat-radio-group/cat-radio-group.js +4 -2
  17. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  18. package/dist/collection/components/cat-select/cat-select.css +27 -23
  19. package/dist/collection/components/cat-select/cat-select.js +7 -7
  20. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  21. package/dist/collection/components/cat-textarea/cat-textarea.css +21 -21
  22. package/dist/collection/components/cat-textarea/cat-textarea.js +1 -4
  23. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  24. package/dist/collection/components/cat-toggle/cat-toggle.css +2 -2
  25. package/dist/collection/components/cat-tooltip/cat-tooltip.css +1 -1
  26. package/dist/collection/components/cat-tooltip/cat-tooltip.js +50 -34
  27. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  28. package/dist/collection/scss/_snippets/_form-label.scss +4 -4
  29. package/dist/components/cat-alert.js +1 -1
  30. package/dist/components/cat-alert.js.map +1 -1
  31. package/dist/components/cat-badge.js +1 -1
  32. package/dist/components/cat-badge.js.map +1 -1
  33. package/dist/components/cat-button2.js +1 -1
  34. package/dist/components/cat-button2.js.map +1 -1
  35. package/dist/components/cat-checkbox2.js +1 -1
  36. package/dist/components/cat-dropdown2.js +1 -1
  37. package/dist/components/cat-dropdown2.js.map +1 -1
  38. package/dist/components/cat-input2.js +2 -5
  39. package/dist/components/cat-input2.js.map +1 -1
  40. package/dist/components/cat-radio-group.js +4 -2
  41. package/dist/components/cat-radio-group.js.map +1 -1
  42. package/dist/components/cat-select2.js +8 -8
  43. package/dist/components/cat-select2.js.map +1 -1
  44. package/dist/components/cat-textarea.js +2 -5
  45. package/dist/components/cat-textarea.js.map +1 -1
  46. package/dist/components/cat-toggle.js +1 -1
  47. package/dist/components/cat-tooltip.js +51 -35
  48. package/dist/components/cat-tooltip.js.map +1 -1
  49. package/dist/esm/cat-alert_25.entry.js +72 -60
  50. package/dist/esm/cat-alert_25.entry.js.map +1 -1
  51. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +6 -0
  52. package/package.json +2 -2
  53. package/dist/catalyst/p-570a1382.entry.js +0 -10
  54. package/dist/catalyst/p-570a1382.entry.js.map +0 -1
@@ -43,7 +43,7 @@
43
43
  }
44
44
 
45
45
  :host([color=success]) {
46
- background-color: rgba(var(--cat-success-bg-, 0, 132, 88), 0.1);
46
+ background-color: rgba(var(--cat-success-bg, 0, 132, 88), 0.1);
47
47
  }
48
48
  :host([color=success]) cat-icon {
49
49
  color: #008458;
@@ -59,7 +59,7 @@
59
59
  }
60
60
 
61
61
  :host([color=success]) {
62
- --bg: var(--cat-success-bg-, 0, 132, 88);
62
+ --bg: var(--cat-success-bg, 0, 132, 88);
63
63
  --fill: var(--cat-success-fill, 255, 255, 255);
64
64
  --text: var(--cat-success-text, 0, 132, 88);
65
65
  --border: var(--cat-success-text, 0, 132, 88);
@@ -30,7 +30,7 @@
30
30
  width: 100%;
31
31
  box-sizing: border-box;
32
32
  cursor: pointer;
33
- transition: color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear;
33
+ transition: color 125ms linear, border-color 125ms linear, background-color 125ms linear, box-shadow 125ms linear;
34
34
  }
35
35
  .cat-button:focus-visible {
36
36
  outline: 2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));
@@ -168,7 +168,7 @@
168
168
  }
169
169
 
170
170
  .cat-button-success {
171
- --bg: var(--cat-success-bg-, 0, 132, 88);
171
+ --bg: var(--cat-success-bg, 0, 132, 88);
172
172
  --fill: var(--cat-success-fill, 255, 255, 255);
173
173
  --text: var(--cat-success-text, 0, 132, 88);
174
174
  --base: var(--cat-success-text, 0, 132, 88);
@@ -95,7 +95,7 @@ input {
95
95
  background-color: white;
96
96
  border: 1px solid rgb(var(--cat-border-color-dark, 215, 219, 224));
97
97
  border-radius: var(--cat-border-radius-s, 0.125rem);
98
- transition: background-color 0.13s ease, border-color 0.13s ease;
98
+ transition: background-color 125ms ease, border-color 125ms ease;
99
99
  pointer-events: none;
100
100
  }
101
101
  .box svg {
@@ -105,7 +105,7 @@ input {
105
105
  stroke-linejoin: round;
106
106
  stroke-dasharray: 16px;
107
107
  stroke-dashoffset: 16px;
108
- transition: all 0.13s ease;
108
+ transition: all 125ms ease;
109
109
  width: 50%;
110
110
  position: absolute;
111
111
  top: 50%;
@@ -33,7 +33,7 @@
33
33
  border: 1px solid rgb(var(--cat-border-color, 235, 236, 240));
34
34
  z-index: 100;
35
35
  opacity: 0;
36
- transition: transform 0.13s cubic-bezier(0.3, 0, 0.8, 0.15), opacity 0.13s cubic-bezier(0.3, 0, 0.8, 0.15);
36
+ transition: transform 125ms cubic-bezier(0.3, 0, 0.8, 0.15), opacity 125ms cubic-bezier(0.3, 0, 0.8, 0.15);
37
37
  }
38
38
  .content[data-placement^=top] {
39
39
  transform: translateY(1rem);
@@ -51,7 +51,7 @@
51
51
  opacity: 1;
52
52
  transform: translateX(0);
53
53
  transform: translateY(0);
54
- transition: transform 0.5s cubic-bezier(0.05, 0.7, 0.1, 1), opacity 0.5s cubic-bezier(0.05, 0.7, 0.1, 1);
54
+ transition: transform 500ms cubic-bezier(0.05, 0.7, 0.1, 1), opacity 500ms cubic-bezier(0.05, 0.7, 0.1, 1);
55
55
  }
56
56
  .content.overflow-auto {
57
57
  overflow: auto;
@@ -23,7 +23,7 @@
23
23
  }
24
24
 
25
25
  .cat-bg-primary-hover {
26
- transition: background-color 0.13s, color 0.13s;
26
+ transition: background-color 125ms, color 125ms;
27
27
  }
28
28
  .cat-bg-primary-hover:hover {
29
29
  background-color: rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;
@@ -37,7 +37,7 @@
37
37
 
38
38
  .cat-link-primary,
39
39
  .cat-text-primary-hover {
40
- transition: color 0.13s;
40
+ transition: color 125ms;
41
41
  }
42
42
  .cat-link-primary:hover,
43
43
  .cat-text-primary-hover:hover {
@@ -54,7 +54,7 @@
54
54
  }
55
55
 
56
56
  .cat-bg-primaryInverted-hover {
57
- transition: background-color 0.13s, color 0.13s;
57
+ transition: background-color 125ms, color 125ms;
58
58
  }
59
59
  .cat-bg-primaryInverted-hover:hover {
60
60
  background-color: #93b4f2 !important;
@@ -68,7 +68,7 @@
68
68
 
69
69
  .cat-link-primaryInverted,
70
70
  .cat-text-primaryInverted-hover {
71
- transition: color 0.13s;
71
+ transition: color 125ms;
72
72
  }
73
73
  .cat-link-primaryInverted:hover,
74
74
  .cat-text-primaryInverted-hover:hover {
@@ -85,7 +85,7 @@
85
85
  }
86
86
 
87
87
  .cat-bg-secondary-hover {
88
- transition: background-color 0.13s, color 0.13s;
88
+ transition: background-color 125ms, color 125ms;
89
89
  }
90
90
  .cat-bg-secondary-hover:hover {
91
91
  background-color: rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;
@@ -99,7 +99,7 @@
99
99
 
100
100
  .cat-link-secondary,
101
101
  .cat-text-secondary-hover {
102
- transition: color 0.13s;
102
+ transition: color 125ms;
103
103
  }
104
104
  .cat-link-secondary:hover,
105
105
  .cat-text-secondary-hover:hover {
@@ -116,7 +116,7 @@
116
116
  }
117
117
 
118
118
  .cat-bg-secondaryInverted-hover {
119
- transition: background-color 0.13s, color 0.13s;
119
+ transition: background-color 125ms, color 125ms;
120
120
  }
121
121
  .cat-bg-secondaryInverted-hover:hover {
122
122
  background-color: #697687 !important;
@@ -130,7 +130,7 @@
130
130
 
131
131
  .cat-link-secondaryInverted,
132
132
  .cat-text-secondaryInverted-hover {
133
- transition: color 0.13s;
133
+ transition: color 125ms;
134
134
  }
135
135
  .cat-link-secondaryInverted:hover,
136
136
  .cat-text-secondaryInverted-hover:hover {
@@ -142,12 +142,12 @@
142
142
  }
143
143
 
144
144
  .cat-bg-success {
145
- background-color: rgb(var(--cat-success-bg-, 0, 132, 88)) !important;
145
+ background-color: rgb(var(--cat-success-bg, 0, 132, 88)) !important;
146
146
  color: rgb(var(--cat-success-fill, 255, 255, 255)) !important;
147
147
  }
148
148
 
149
149
  .cat-bg-success-hover {
150
- transition: background-color 0.13s, color 0.13s;
150
+ transition: background-color 125ms, color 125ms;
151
151
  }
152
152
  .cat-bg-success-hover:hover {
153
153
  background-color: rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;
@@ -161,7 +161,7 @@
161
161
 
162
162
  .cat-link-success,
163
163
  .cat-text-success-hover {
164
- transition: color 0.13s;
164
+ transition: color 125ms;
165
165
  }
166
166
  .cat-link-success:hover,
167
167
  .cat-text-success-hover:hover {
@@ -178,7 +178,7 @@
178
178
  }
179
179
 
180
180
  .cat-bg-warning-hover {
181
- transition: background-color 0.13s, color 0.13s;
181
+ transition: background-color 125ms, color 125ms;
182
182
  }
183
183
  .cat-bg-warning-hover:hover {
184
184
  background-color: rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;
@@ -192,7 +192,7 @@
192
192
 
193
193
  .cat-link-warning,
194
194
  .cat-text-warning-hover {
195
- transition: color 0.13s;
195
+ transition: color 125ms;
196
196
  }
197
197
  .cat-link-warning:hover,
198
198
  .cat-text-warning-hover:hover {
@@ -209,7 +209,7 @@
209
209
  }
210
210
 
211
211
  .cat-bg-danger-hover {
212
- transition: background-color 0.13s, color 0.13s;
212
+ transition: background-color 125ms, color 125ms;
213
213
  }
214
214
  .cat-bg-danger-hover:hover {
215
215
  background-color: rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;
@@ -223,7 +223,7 @@
223
223
 
224
224
  .cat-link-danger,
225
225
  .cat-text-danger-hover {
226
- transition: color 0.13s;
226
+ transition: color 125ms;
227
227
  }
228
228
  .cat-link-danger:hover,
229
229
  .cat-text-danger-hover:hover {
@@ -260,7 +260,11 @@
260
260
  .label-container {
261
261
  flex-basis: var(--label-size, 33.33%);
262
262
  }
263
- .label-container.hidden {
263
+ .label-container .label-wrapper {
264
+ display: flex;
265
+ gap: 0.25rem;
266
+ }
267
+ .label-container .hidden {
264
268
  position: absolute !important;
265
269
  width: 1px !important;
266
270
  height: 1px !important;
@@ -271,10 +275,6 @@
271
275
  white-space: nowrap !important;
272
276
  border: 0 !important;
273
277
  }
274
- .label-container .label-wrapper {
275
- display: flex;
276
- gap: 0.25rem;
277
- }
278
278
 
279
279
  .label-metadata {
280
280
  display: flex;
@@ -363,7 +363,7 @@
363
363
  background: white;
364
364
  border-radius: var(--cat-border-radius-m, 0.25rem);
365
365
  box-shadow: inset 0 0 0 1px rgb(var(--border-color));
366
- transition: box-shadow 0.13s linear;
366
+ transition: box-shadow 125ms linear;
367
367
  --border-color: var(--cat-border-color-dark, 215, 219, 224);
368
368
  /* stylelint-disable property-no-vendor-prefix */
369
369
  /* stylelint-enable property-no-vendor-prefix */
@@ -101,10 +101,7 @@ export class CatInput {
101
101
  return (h("div", { class: {
102
102
  'input-field': true,
103
103
  'input-horizontal': this.horizontal
104
- } }, h("div", { class: {
105
- hidden: this.labelHidden,
106
- 'label-container': true
107
- } }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id }, h("span", { class: "label-wrapper", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, h("div", { class: "label-metadata" }, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.required'), ")")), this.maxLength && (h("div", { class: "label-character-count", "aria-hidden": "true" }, this.value?.toString().length ?? 0, "/", this.maxLength))))))), h("div", { class: "input-container" }, h("div", { class: {
104
+ } }, h("div", { class: "label-container" }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { class: "label-wrapper", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, h("div", { class: "label-metadata" }, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.required'), ")")), this.maxLength && (h("div", { class: "label-character-count", "aria-hidden": "true" }, this.value?.toString().length ?? 0, "/", this.maxLength))))))), h("div", { class: "input-container" }, h("div", { class: {
108
105
  'input-wrapper': true,
109
106
  'input-round': this.round,
110
107
  'input-disabled': this.disabled,
@@ -1 +1 @@
1
- {"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/cat-input/cat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAY,M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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { coerceBoolean, coerceNumber } from '../../utils/coerce';\nimport { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { InputType } from './input-type';\n\nlet nextUniqueId = 0;\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-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly _id = `cat-input-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n private errorMapSrc?: ErrorMap;\n\n @Element() hostElement!: HTMLElement;\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 * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\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 * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: number | string;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: number | string;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\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 * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: InputType = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: 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 * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<string>;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.watchErrorsHandler(this.errors);\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 input', this);\n }\n }\n\n /**\n * Programmatically move focus to the input. 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 input. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n this.catChange.emit(this.value);\n }\n\n @Watch('errors')\n watchErrorsHandler(value?: boolean | string[] | ErrorMap) {\n if (!coerceBoolean(this.errorUpdate)) {\n this.errorMap = undefined;\n } else {\n this.errorMapSrc = Array.isArray(value)\n ? (value as string[]).reduce((acc, err) => ({ ...acc, [err]: undefined }), {})\n : value === true\n ? {}\n : value || undefined;\n this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();\n }\n }\n\n render() {\n return (\n <div\n class={{\n 'input-field': true,\n 'input-horizontal': this.horizontal\n }}\n >\n <div\n class={{\n hidden: this.labelHidden,\n 'label-container': true\n }}\n >\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id}>\n <span class=\"label-wrapper\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n <div class=\"label-metadata\">\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n {this.maxLength && (\n <div class=\"label-character-count\" aria-hidden=\"true\">\n {this.value?.toString().length ?? 0}/{this.maxLength}\n </div>\n )}\n </div>\n </span>\n </label>\n )}\n </div>\n <div class=\"input-container\">\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled,\n 'input-invalid': this.invalid\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.min}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.hint?.length ? this.id + '-hint' : undefined}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"$cat:input-close\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {!this.invalid && this.icon && this.iconRight && (\n <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>\n )}\n {this.invalid && <cat-icon icon=\"$cat:input-error\" class=\"icon-suffix cat-text-danger\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {(this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (\n <CatFormHint\n id={this.id}\n hint={this.hint}\n slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>}\n errorMap={this.errorMap}\n />\n )}\n </div>\n </div>\n );\n }\n\n private get invalid() {\n return !!this.errorMap;\n }\n\n private onInput() {\n this.value = this.input.value;\n this.catChange.emit(this.value);\n this.showErrorsIfTimeout();\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 if (coerceBoolean(this.errorUpdate)) {\n this.showErrors();\n }\n }\n\n private showErrors() {\n this.errorMap = this.errorMapSrc;\n }\n\n private errorUpdateTimeoutId?: number;\n private showErrorsIfTimeout() {\n const errorUpdate = coerceNumber(this.errorUpdate, null);\n if (errorUpdate !== null) {\n typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);\n this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);\n return true;\n }\n return false;\n }\n\n private showErrorsIfNoFocus() {\n const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.input;\n if (!hasFocus) {\n this.showErrors();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/cat-input/cat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { coerceBoolean, coerceNumber } from '../../utils/coerce';\nimport { CatFormHint, ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { InputType } from './input-type';\n\nlet nextUniqueId = 0;\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-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly _id = `cat-input-${nextUniqueId++}`;\n private get id() {\n return this.identifier || this._id;\n }\n\n private input!: HTMLInputElement;\n private errorMapSrc?: ErrorMap;\n\n @Element() hostElement!: HTMLElement;\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 * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\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 * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: number | string;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: number | string;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\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 * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: InputType = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: 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 * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<string>;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.watchErrorsHandler(this.errors);\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 input', this);\n }\n }\n\n /**\n * Programmatically move focus to the input. 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 input. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input.blur();\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n this.catChange.emit(this.value);\n }\n\n @Watch('errors')\n watchErrorsHandler(value?: boolean | string[] | ErrorMap) {\n if (!coerceBoolean(this.errorUpdate)) {\n this.errorMap = undefined;\n } else {\n this.errorMapSrc = Array.isArray(value)\n ? (value as string[]).reduce((acc, err) => ({ ...acc, [err]: undefined }), {})\n : value === true\n ? {}\n : value || undefined;\n this.showErrorsIfTimeout() || this.showErrorsIfNoFocus();\n }\n }\n\n render() {\n return (\n <div\n class={{\n 'input-field': true,\n 'input-horizontal': this.horizontal\n }}\n >\n <div class=\"label-container\">\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span class=\"label-wrapper\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n <div class=\"label-metadata\">\n {!this.required && this.requiredMarker.startsWith('optional') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.optional')})\n </span>\n )}\n {this.required && this.requiredMarker.startsWith('required') && (\n <span class=\"label-optional\" aria-hidden=\"true\">\n ({i18n.t('input.required')})\n </span>\n )}\n {this.maxLength && (\n <div class=\"label-character-count\" aria-hidden=\"true\">\n {this.value?.toString().length ?? 0}/{this.maxLength}\n </div>\n )}\n </div>\n </span>\n </label>\n )}\n </div>\n <div class=\"input-container\">\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled,\n 'input-invalid': this.invalid\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n {...this.nativeAttributes}\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.min}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n aria-invalid={this.invalid ? 'true' : undefined}\n aria-describedby={this.hint?.length ? this.id + '-hint' : undefined}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"$cat:input-close\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {!this.invalid && this.icon && this.iconRight && (\n <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>\n )}\n {this.invalid && <cat-icon icon=\"$cat:input-error\" class=\"icon-suffix cat-text-danger\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {(this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (\n <CatFormHint\n id={this.id}\n hint={this.hint}\n slottedHint={this.hasSlottedHint && <slot name=\"hint\"></slot>}\n errorMap={this.errorMap}\n />\n )}\n </div>\n </div>\n );\n }\n\n private get invalid() {\n return !!this.errorMap;\n }\n\n private onInput() {\n this.value = this.input.value;\n this.catChange.emit(this.value);\n this.showErrorsIfTimeout();\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 if (coerceBoolean(this.errorUpdate)) {\n this.showErrors();\n }\n }\n\n private showErrors() {\n this.errorMap = this.errorMapSrc;\n }\n\n private errorUpdateTimeoutId?: number;\n private showErrorsIfTimeout() {\n const errorUpdate = coerceNumber(this.errorUpdate, null);\n if (errorUpdate !== null) {\n typeof this.errorUpdateTimeoutId === 'number' && window.clearTimeout(this.errorUpdateTimeoutId);\n this.errorUpdateTimeoutId = window.setTimeout(() => this.showErrors(), errorUpdate);\n return true;\n }\n return false;\n }\n\n private showErrorsIfNoFocus() {\n const hasFocus = document.activeElement === this.hostElement || document.activeElement === this.input;\n if (!hasFocus) {\n this.showErrors();\n }\n }\n}\n"]}
@@ -50,8 +50,10 @@ export class CatRadioGroup {
50
50
  }
51
51
  onInput(event) {
52
52
  const radio = this.catRadioGroup.find(radio => radio === event.target);
53
- this.value = radio?.checked ? radio?.value : undefined;
54
- this.catChange.emit(this.value);
53
+ if (radio?.localName === 'cat-radio') {
54
+ this.value = radio?.checked ? radio?.value : undefined;
55
+ this.catChange.emit(this.value);
56
+ }
55
57
  }
56
58
  onFocus(event) {
57
59
  if (!event.relatedTarget) {
@@ -1 +1 @@
1
- {"version":3,"file":"cat-radio-group.js","sourceRoot":"","sources":["../../../src/components/cat-radio-group/cat-radio-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEhG;;GAEG;AAMH,MAAM,OAAO,aAAa;;IAChB,kBAAa,GAA0B,EAAE,CAAC;;;oBAiB/B,KAAK;;qBAWJ,KAAK;;EAkBzB,aAAa,CAAC,OAAgB;IAC5B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;EACpE,CAAC;EAGD,cAAc,CAAC,QAAiB;IAC9B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;IACzF,IAAI,CAAC,cAAc,EAAE,CAAC;EACxB,CAAC;EAGD,iBAAiB,CAAC,QAAiB;IACjC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,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;MAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;MAC9G,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;MAC/E,IAAI,CAAC,aAAa,CAAC,iBAAiB,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU;QAC3E,EAAE,aAAa,CAAC,OAAO,CAAC;QACxB,EAAE,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;KACnC;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Listen, Prop, Watch } from '@stencil/core';\n\n/**\n * A group of radio buttons.\n */\n@Component({\n tag: 'cat-radio-group',\n styleUrl: 'cat-radio-group.scss',\n shadow: true\n})\nexport class CatRadioGroup {\n private catRadioGroup: HTMLCatRadioElement[] = [];\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The name of the radio group component.\n */\n @Prop() name?: string;\n\n /**\n * The value of the radio group.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Whether this radio group is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Adds an accessible label for the radio group that\n * it is only shown in assistive technologies, like screen readers.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n /**\n * Whether the label of the radios should appear to the left of them.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<boolean | string>;\n\n /**\n * Emitted when the radio group received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the radio group loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n @Watch('name')\n onNameChanged(newName?: string) {\n this.catRadioGroup.forEach(catRadio => (catRadio.name = newName));\n }\n\n @Watch('value')\n onValueChanged(newValue?: string) {\n this.catRadioGroup.forEach(catRadio => (catRadio.checked = catRadio.value === newValue));\n this.updateTabIndex();\n }\n\n @Watch('disabled')\n onDisabledChanged(disabled: boolean) {\n this.catRadioGroup.forEach(catRadio => (catRadio.disabled = disabled));\n }\n\n @Watch('labelLeft')\n onLabelLeftChanged(labelLeft: boolean) {\n this.catRadioGroup.forEach(catRadio => {\n if (labelLeft) {\n catRadio.labelLeft = labelLeft;\n }\n });\n }\n\n componentDidLoad(): void {\n this.catRadioGroup = Array.from(this.hostElement.querySelectorAll(`cat-radio`));\n this.onNameChanged(this.name);\n this.onValueChanged(this.value);\n this.onDisabledChanged(this.disabled);\n this.onLabelLeftChanged(this.labelLeft);\n }\n\n @Listen('keydown')\n onKeydown(event: KeyboardEvent): void {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key) && this.catRadioGroup.length) {\n const targetElements = this.catRadioGroup.filter(catRadio => !catRadio.disabled);\n const activeElement = document.activeElement as HTMLCatRadioElement;\n const activeIdx = this.catRadioGroup.findIndex(catRadio => catRadio === activeElement);\n const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].doFocus();\n targetElements[targetIdx].shadowRoot?.querySelector('input')?.click();\n this.updateTabIndex();\n event.preventDefault();\n }\n }\n\n @Listen('input')\n onInput(event: MouseEvent): void {\n const radio = this.catRadioGroup.find(radio => radio === event.target);\n this.value = radio?.checked ? radio?.value : undefined;\n this.catChange.emit(this.value);\n }\n\n @Listen('focus', { capture: true })\n onFocus(event: FocusEvent): void {\n if (!event.relatedTarget) {\n this.catBlur.emit(event);\n }\n }\n\n @Listen('blur', { capture: true })\n onBlur(event: FocusEvent): void {\n if (!event.relatedTarget) {\n this.catBlur.emit(event);\n }\n }\n\n render() {\n return (\n <div role=\"radiogroup\" aria-label={this.a11yLabel}>\n <slot></slot>\n </div>\n );\n }\n\n private updateTabIndex() {\n if (this.catRadioGroup.length) {\n this.catRadioGroup.forEach(value => value.shadowRoot?.querySelector('input')?.setAttribute('tabindex', '-1'));\n const checkedRadioIndex = this.catRadioGroup.findIndex(value => value.checked);\n this.catRadioGroup[checkedRadioIndex >= 0 ? checkedRadioIndex : 0].shadowRoot\n ?.querySelector('input')\n ?.setAttribute('tabindex', '0');\n }\n }\n}\n"]}
1
+ {"version":3,"file":"cat-radio-group.js","sourceRoot":"","sources":["../../../src/components/cat-radio-group/cat-radio-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEhG;;GAEG;AAMH,MAAM,OAAO,aAAa;;IAChB,kBAAa,GAA0B,EAAE,CAAC;;;oBAiB/B,KAAK;;qBAWJ,KAAK;;EAkBzB,aAAa,CAAC,OAAgB;IAC5B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;EACpE,CAAC;EAGD,cAAc,CAAC,QAAiB;IAC9B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,C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AI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC1B;EACH,CAAC;EAED,MAAM;IACJ,OAAO,CACL,WAAK,IAAI,EAAC,YAAY,gBAAa,IAAI,CAAC,SAAS;MAC/C,eAAa,CACT,CACP,CAAC;EACJ,CAAC;EAEO,cAAc;IACpB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;MAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;MAC9G,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;MAC/E,IAAI,CAAC,aAAa,CAAC,iBAAiB,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU;QAC3E,EAAE,aAAa,CAAC,OAAO,CAAC;QACxB,EAAE,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;KACnC;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Listen, Prop, Watch } from '@stencil/core';\n\n/**\n * A group of radio buttons.\n */\n@Component({\n tag: 'cat-radio-group',\n styleUrl: 'cat-radio-group.scss',\n shadow: true\n})\nexport class CatRadioGroup {\n private catRadioGroup: HTMLCatRadioElement[] = [];\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The name of the radio group component.\n */\n @Prop() name?: string;\n\n /**\n * The value of the radio group.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Whether this radio group is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Adds an accessible label for the radio group that\n * it is only shown in assistive technologies, like screen readers.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n /**\n * Whether the label of the radios should appear to the left of them.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<boolean | string>;\n\n /**\n * Emitted when the radio group received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the radio group loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n @Watch('name')\n onNameChanged(newName?: string) {\n this.catRadioGroup.forEach(catRadio => (catRadio.name = newName));\n }\n\n @Watch('value')\n onValueChanged(newValue?: string) {\n this.catRadioGroup.forEach(catRadio => (catRadio.checked = catRadio.value === newValue));\n this.updateTabIndex();\n }\n\n @Watch('disabled')\n onDisabledChanged(disabled: boolean) {\n this.catRadioGroup.forEach(catRadio => (catRadio.disabled = disabled));\n }\n\n @Watch('labelLeft')\n onLabelLeftChanged(labelLeft: boolean) {\n this.catRadioGroup.forEach(catRadio => {\n if (labelLeft) {\n catRadio.labelLeft = labelLeft;\n }\n });\n }\n\n componentDidLoad(): void {\n this.catRadioGroup = Array.from(this.hostElement.querySelectorAll(`cat-radio`));\n this.onNameChanged(this.name);\n this.onValueChanged(this.value);\n this.onDisabledChanged(this.disabled);\n this.onLabelLeftChanged(this.labelLeft);\n }\n\n @Listen('keydown')\n onKeydown(event: KeyboardEvent): void {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key) && this.catRadioGroup.length) {\n const targetElements = this.catRadioGroup.filter(catRadio => !catRadio.disabled);\n const activeElement = document.activeElement as HTMLCatRadioElement;\n const activeIdx = this.catRadioGroup.findIndex(catRadio => catRadio === activeElement);\n const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;\n const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;\n targetElements[targetIdx].doFocus();\n targetElements[targetIdx].shadowRoot?.querySelector('input')?.click();\n this.updateTabIndex();\n event.preventDefault();\n }\n }\n\n @Listen('input')\n onInput(event: MouseEvent): void {\n const radio = this.catRadioGroup.find(radio => radio === event.target);\n if (radio?.localName === 'cat-radio') {\n this.value = radio?.checked ? radio?.value : undefined;\n this.catChange.emit(this.value);\n }\n }\n\n @Listen('focus', { capture: true })\n onFocus(event: FocusEvent): void {\n if (!event.relatedTarget) {\n this.catBlur.emit(event);\n }\n }\n\n @Listen('blur', { capture: true })\n onBlur(event: FocusEvent): void {\n if (!event.relatedTarget) {\n this.catBlur.emit(event);\n }\n }\n\n render() {\n return (\n <div role=\"radiogroup\" aria-label={this.a11yLabel}>\n <slot></slot>\n </div>\n );\n }\n\n private updateTabIndex() {\n if (this.catRadioGroup.length) {\n this.catRadioGroup.forEach(value => value.shadowRoot?.querySelector('input')?.setAttribute('tabindex', '-1'));\n const checkedRadioIndex = this.catRadioGroup.findIndex(value => value.checked);\n this.catRadioGroup[checkedRadioIndex >= 0 ? checkedRadioIndex : 0].shadowRoot\n ?.querySelector('input')\n ?.setAttribute('tabindex', '0');\n }\n }\n}\n"]}
@@ -23,7 +23,7 @@
23
23
  }
24
24
 
25
25
  .cat-bg-primary-hover {
26
- transition: background-color 0.13s, color 0.13s;
26
+ transition: background-color 125ms, color 125ms;
27
27
  }
28
28
  .cat-bg-primary-hover:hover {
29
29
  background-color: rgb(var(--cat-primary-bg-hover, 1, 115, 132)) !important;
@@ -37,7 +37,7 @@
37
37
 
38
38
  .cat-link-primary,
39
39
  .cat-text-primary-hover {
40
- transition: color 0.13s;
40
+ transition: color 125ms;
41
41
  }
42
42
  .cat-link-primary:hover,
43
43
  .cat-text-primary-hover:hover {
@@ -54,7 +54,7 @@
54
54
  }
55
55
 
56
56
  .cat-bg-primaryInverted-hover {
57
- transition: background-color 0.13s, color 0.13s;
57
+ transition: background-color 125ms, color 125ms;
58
58
  }
59
59
  .cat-bg-primaryInverted-hover:hover {
60
60
  background-color: #93b4f2 !important;
@@ -68,7 +68,7 @@
68
68
 
69
69
  .cat-link-primaryInverted,
70
70
  .cat-text-primaryInverted-hover {
71
- transition: color 0.13s;
71
+ transition: color 125ms;
72
72
  }
73
73
  .cat-link-primaryInverted:hover,
74
74
  .cat-text-primaryInverted-hover:hover {
@@ -85,7 +85,7 @@
85
85
  }
86
86
 
87
87
  .cat-bg-secondary-hover {
88
- transition: background-color 0.13s, color 0.13s;
88
+ transition: background-color 125ms, color 125ms;
89
89
  }
90
90
  .cat-bg-secondary-hover:hover {
91
91
  background-color: rgb(var(--cat-secondary-bg-hover, 105, 118, 135)) !important;
@@ -99,7 +99,7 @@
99
99
 
100
100
  .cat-link-secondary,
101
101
  .cat-text-secondary-hover {
102
- transition: color 0.13s;
102
+ transition: color 125ms;
103
103
  }
104
104
  .cat-link-secondary:hover,
105
105
  .cat-text-secondary-hover:hover {
@@ -116,7 +116,7 @@
116
116
  }
117
117
 
118
118
  .cat-bg-secondaryInverted-hover {
119
- transition: background-color 0.13s, color 0.13s;
119
+ transition: background-color 125ms, color 125ms;
120
120
  }
121
121
  .cat-bg-secondaryInverted-hover:hover {
122
122
  background-color: #697687 !important;
@@ -130,7 +130,7 @@
130
130
 
131
131
  .cat-link-secondaryInverted,
132
132
  .cat-text-secondaryInverted-hover {
133
- transition: color 0.13s;
133
+ transition: color 125ms;
134
134
  }
135
135
  .cat-link-secondaryInverted:hover,
136
136
  .cat-text-secondaryInverted-hover:hover {
@@ -142,12 +142,12 @@
142
142
  }
143
143
 
144
144
  .cat-bg-success {
145
- background-color: rgb(var(--cat-success-bg-, 0, 132, 88)) !important;
145
+ background-color: rgb(var(--cat-success-bg, 0, 132, 88)) !important;
146
146
  color: rgb(var(--cat-success-fill, 255, 255, 255)) !important;
147
147
  }
148
148
 
149
149
  .cat-bg-success-hover {
150
- transition: background-color 0.13s, color 0.13s;
150
+ transition: background-color 125ms, color 125ms;
151
151
  }
152
152
  .cat-bg-success-hover:hover {
153
153
  background-color: rgb(var(--cat-success-bg-hover, 0, 117, 78)) !important;
@@ -161,7 +161,7 @@
161
161
 
162
162
  .cat-link-success,
163
163
  .cat-text-success-hover {
164
- transition: color 0.13s;
164
+ transition: color 125ms;
165
165
  }
166
166
  .cat-link-success:hover,
167
167
  .cat-text-success-hover:hover {
@@ -178,7 +178,7 @@
178
178
  }
179
179
 
180
180
  .cat-bg-warning-hover {
181
- transition: background-color 0.13s, color 0.13s;
181
+ transition: background-color 125ms, color 125ms;
182
182
  }
183
183
  .cat-bg-warning-hover:hover {
184
184
  background-color: rgb(var(--cat-warning-bg-hover, 255, 214, 148)) !important;
@@ -192,7 +192,7 @@
192
192
 
193
193
  .cat-link-warning,
194
194
  .cat-text-warning-hover {
195
- transition: color 0.13s;
195
+ transition: color 125ms;
196
196
  }
197
197
  .cat-link-warning:hover,
198
198
  .cat-text-warning-hover:hover {
@@ -209,7 +209,7 @@
209
209
  }
210
210
 
211
211
  .cat-bg-danger-hover {
212
- transition: background-color 0.13s, color 0.13s;
212
+ transition: background-color 125ms, color 125ms;
213
213
  }
214
214
  .cat-bg-danger-hover:hover {
215
215
  background-color: rgb(var(--cat-danger-bg-hover, 194, 46, 11)) !important;
@@ -223,7 +223,7 @@
223
223
 
224
224
  .cat-link-danger,
225
225
  .cat-text-danger-hover {
226
- transition: color 0.13s;
226
+ transition: color 125ms;
227
227
  }
228
228
  .cat-link-danger:hover,
229
229
  .cat-text-danger-hover:hover {
@@ -260,7 +260,11 @@
260
260
  .label-container {
261
261
  flex-basis: var(--label-size, 33.33%);
262
262
  }
263
- .label-container.hidden {
263
+ .label-container .label-wrapper {
264
+ display: flex;
265
+ gap: 0.25rem;
266
+ }
267
+ .label-container .hidden {
264
268
  position: absolute !important;
265
269
  width: 1px !important;
266
270
  height: 1px !important;
@@ -271,10 +275,6 @@
271
275
  white-space: nowrap !important;
272
276
  border: 0 !important;
273
277
  }
274
- .label-container .label-wrapper {
275
- display: flex;
276
- gap: 0.25rem;
277
- }
278
278
 
279
279
  .label-metadata {
280
280
  display: flex;
@@ -383,7 +383,7 @@ label.hidden {
383
383
  background: white;
384
384
  border-radius: var(--cat-border-radius-m, 0.25rem);
385
385
  box-shadow: inset 0 0 0 1px rgb(var(--border-color));
386
- transition: box-shadow 0.13s linear;
386
+ transition: box-shadow 125ms linear;
387
387
  padding: 0.25rem;
388
388
  --border-color: var(--cat-border-color-dark, 215, 219, 224);
389
389
  /* stylelint-disable property-no-vendor-prefix */
@@ -479,7 +479,7 @@ label.hidden {
479
479
  }
480
480
 
481
481
  .select-btn {
482
- transition: transform 0.13s linear;
482
+ transition: transform 125ms linear;
483
483
  }
484
484
  .select-btn::part(button) {
485
485
  outline: none;
@@ -498,7 +498,7 @@ cat-spinner {
498
498
  }
499
499
 
500
500
  .select-dropdown {
501
- position: absolute;
501
+ position: fixed;
502
502
  right: 0;
503
503
  background: white;
504
504
  display: none;
@@ -507,6 +507,10 @@ cat-spinner {
507
507
  border-radius: var(--cat-border-radius-m, 0.25rem);
508
508
  border: 1px solid rgb(var(--cat-border-color, 235, 236, 240));
509
509
  z-index: 100;
510
+ /* Avoid layout interference */
511
+ width: max-content;
512
+ top: 0;
513
+ left: 0;
510
514
  }
511
515
 
512
516
  .select-options-wrapper {
@@ -1,4 +1,4 @@
1
- import { autoUpdate, computePosition, offset } from "@floating-ui/dom";
1
+ import { autoUpdate, computePosition, flip, offset } from "@floating-ui/dom";
2
2
  import { h, Host } from "@stencil/core";
3
3
  import autosizeInput from "autosize-input";
4
4
  import log from "loglevel";
@@ -292,10 +292,7 @@ class CatSelect {
292
292
  return (h(Host, null, h("div", { class: {
293
293
  'select-field': true,
294
294
  'select-horizontal': this.horizontal
295
- } }, h("div", { class: {
296
- hidden: this.labelHidden,
297
- 'label-container': true
298
- } }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id }, h("span", { class: "label-wrapper", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, h("div", { class: "label-metadata" }, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.required'), ")"))))))), h("div", { class: "select-container" }, h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (h("span", { class: {
295
+ } }, h("div", { class: "label-container" }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { class: "label-wrapper", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, h("div", { class: "label-metadata" }, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", i18n.t('input.required'), ")"))))))), h("div", { class: "select-container" }, h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (h("span", { class: {
299
296
  pill: true,
300
297
  'select-no-open': true,
301
298
  'select-option-active': this.state.activeSelectionIndex === i
@@ -470,11 +467,14 @@ class CatSelect {
470
467
  update() {
471
468
  if (this.trigger && this.dropdown) {
472
469
  computePosition(this.trigger, this.dropdown, {
470
+ strategy: 'fixed',
473
471
  placement: this.placement,
474
- middleware: [offset(CatSelect.DROPDOWN_OFFSET)]
475
- }).then(({ x, y }) => {
472
+ middleware: [offset(CatSelect.DROPDOWN_OFFSET), flip()]
473
+ }).then(({ x, y, placement }) => {
476
474
  if (this.dropdown) {
475
+ this.dropdown.dataset.placement = placement;
477
476
  Object.assign(this.dropdown.style, {
477
+ width: `${this.trigger?.clientWidth}px`,
478
478
  left: `${x}px`,
479
479
  top: `${y}px`
480
480
  });