@haiilo/catalyst 0.10.0 → 0.10.1

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 (58) hide show
  1. package/dist/catalyst/catalyst.esm.js +1 -1
  2. package/dist/catalyst/catalyst.esm.js.map +1 -1
  3. package/dist/catalyst/{p-a21823c9.entry.js → p-b58ac55c.entry.js} +5 -5
  4. package/dist/catalyst/p-b58ac55c.entry.js.map +1 -0
  5. package/dist/catalyst/scss/_variables.scss +1 -0
  6. package/dist/cjs/{cat-alert_20.cjs.entry.js → cat-alert_21.cjs.entry.js} +141 -19
  7. package/dist/cjs/cat-alert_21.cjs.entry.js.map +1 -0
  8. package/dist/cjs/catalyst.cjs.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/collection-manifest.json +1 -0
  11. package/dist/collection/components/cat-button/cat-button.css +2 -1
  12. package/dist/collection/components/cat-checkbox/cat-checkbox.css +4 -0
  13. package/dist/collection/components/cat-checkbox/cat-checkbox.js +23 -1
  14. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  15. package/dist/collection/components/cat-radio/cat-radio.css +7 -0
  16. package/dist/collection/components/cat-radio/cat-radio.js +25 -2
  17. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  18. package/dist/collection/components/cat-radio-group/cat-radio-group.css +12 -0
  19. package/dist/collection/components/cat-radio-group/cat-radio-group.js +179 -0
  20. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -0
  21. package/dist/collection/components/cat-select/cat-select.js +49 -10
  22. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  23. package/dist/collection/components/cat-toggle/cat-toggle.css +4 -0
  24. package/dist/collection/components/cat-toggle/cat-toggle.js +25 -3
  25. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  26. package/dist/collection/index.js.map +1 -1
  27. package/dist/collection/scss/_variables.scss +1 -0
  28. package/dist/components/cat-button2.js +1 -1
  29. package/dist/components/cat-button2.js.map +1 -1
  30. package/dist/components/cat-checkbox.js +7 -2
  31. package/dist/components/cat-checkbox.js.map +1 -1
  32. package/dist/components/cat-radio-group.d.ts +11 -0
  33. package/dist/components/cat-radio-group.js +111 -0
  34. package/dist/components/cat-radio-group.js.map +1 -0
  35. package/dist/components/cat-radio.js +9 -3
  36. package/dist/components/cat-radio.js.map +1 -1
  37. package/dist/components/cat-select.js +35 -10
  38. package/dist/components/cat-select.js.map +1 -1
  39. package/dist/components/cat-toggle.js +8 -3
  40. package/dist/components/cat-toggle.js.map +1 -1
  41. package/dist/components/index.d.ts +1 -0
  42. package/dist/components/index.js +1 -0
  43. package/dist/components/index.js.map +1 -1
  44. package/dist/esm/{cat-alert_20.entry.js → cat-alert_21.entry.js} +141 -20
  45. package/dist/esm/cat-alert_21.entry.js.map +1 -0
  46. package/dist/esm/catalyst.js +1 -1
  47. package/dist/esm/loader.js +1 -1
  48. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +4 -0
  49. package/dist/types/components/cat-radio/cat-radio.d.ts +4 -0
  50. package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +29 -0
  51. package/dist/types/components/cat-select/cat-select.d.ts +6 -0
  52. package/dist/types/components/cat-toggle/cat-toggle.d.ts +5 -1
  53. package/dist/types/components.d.ts +75 -2
  54. package/dist/types/index.d.ts +1 -0
  55. package/package.json +2 -2
  56. package/dist/catalyst/p-a21823c9.entry.js.map +0 -1
  57. package/dist/cjs/cat-alert_20.cjs.entry.js.map +0 -1
  58. package/dist/esm/cat-alert_20.entry.js.map +0 -1
@@ -0,0 +1,111 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+
3
+ const catRadioGroupCss = ":host{display:block}:host([hidden]){display:none}";
4
+
5
+ const CatRadioGroup$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ this.catRadioGroup = [];
11
+ /**
12
+ * Whether this radio group is disabled.
13
+ */
14
+ this.disabled = false;
15
+ /**
16
+ * Whether the label of the radios should appear to the left of them.
17
+ */
18
+ this.labelLeft = false;
19
+ }
20
+ onNameChanged(newName) {
21
+ this.catRadioGroup.forEach(catRadio => {
22
+ catRadio.name = newName;
23
+ });
24
+ }
25
+ onDisabledChanged(disabled) {
26
+ this.catRadioGroup.forEach(catRadio => {
27
+ if (disabled) {
28
+ catRadio.disabled = disabled;
29
+ }
30
+ });
31
+ }
32
+ onLabelLeftChanged(labelLeft) {
33
+ this.catRadioGroup.forEach(catRadio => {
34
+ if (labelLeft) {
35
+ catRadio.labelLeft = labelLeft;
36
+ }
37
+ });
38
+ }
39
+ componentDidLoad() {
40
+ this.catRadioGroup = Array.from(this.hostElement.querySelectorAll(`cat-radio`));
41
+ this.onNameChanged(this.name);
42
+ this.onDisabledChanged(this.disabled);
43
+ this.onLabelLeftChanged(this.labelLeft);
44
+ this.updateTabIndex();
45
+ }
46
+ onKeydown(event) {
47
+ var _a, _b;
48
+ if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key) && this.catRadioGroup.length) {
49
+ const targetElements = this.catRadioGroup.filter(catRadio => !catRadio.disabled);
50
+ const activeElement = document.activeElement;
51
+ const activeIdx = this.catRadioGroup.findIndex(catRadio => catRadio === activeElement);
52
+ const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;
53
+ const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
54
+ targetElements[targetIdx].setFocus();
55
+ (_b = (_a = targetElements[targetIdx].shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.click();
56
+ this.updateTabIndex();
57
+ event.preventDefault();
58
+ }
59
+ }
60
+ onInput(event) {
61
+ const catRadioElement = this.catRadioGroup.find(value => value === event.target);
62
+ if (catRadioElement && catRadioElement.checked) {
63
+ const catRadioElements = this.catRadioGroup.filter(value => value !== catRadioElement);
64
+ catRadioElements.forEach(value => (value.checked = false));
65
+ this.updateTabIndex();
66
+ }
67
+ }
68
+ render() {
69
+ return (h("div", { role: "radiogroup", "aria-label": this.a11yLabel }, h("slot", null)));
70
+ }
71
+ updateTabIndex() {
72
+ var _a, _b;
73
+ if (this.catRadioGroup.length) {
74
+ this.catRadioGroup.forEach(value => { var _a, _b; return (_b = (_a = value.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.setAttribute('tabindex', '-1'); });
75
+ const checkedRadioIndex = this.catRadioGroup.findIndex(value => value.checked);
76
+ (_b = (_a = this.catRadioGroup[checkedRadioIndex >= 0 ? checkedRadioIndex : 0].shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.setAttribute('tabindex', '0');
77
+ }
78
+ }
79
+ get hostElement() { return this; }
80
+ static get watchers() { return {
81
+ "name": ["onNameChanged"],
82
+ "disabled": ["onDisabledChanged"],
83
+ "labelLeft": ["onLabelLeftChanged"]
84
+ }; }
85
+ static get style() { return catRadioGroupCss; }
86
+ }, [1, "cat-radio-group", {
87
+ "name": [1],
88
+ "disabled": [4],
89
+ "a11yLabel": [1, "a11y-label"],
90
+ "labelLeft": [4, "label-left"]
91
+ }, [[0, "keydown", "onKeydown"], [0, "input", "onInput"]]]);
92
+ function defineCustomElement$1() {
93
+ if (typeof customElements === "undefined") {
94
+ return;
95
+ }
96
+ const components = ["cat-radio-group"];
97
+ components.forEach(tagName => { switch (tagName) {
98
+ case "cat-radio-group":
99
+ if (!customElements.get(tagName)) {
100
+ customElements.define(tagName, CatRadioGroup$1);
101
+ }
102
+ break;
103
+ } });
104
+ }
105
+
106
+ const CatRadioGroup = CatRadioGroup$1;
107
+ const defineCustomElement = defineCustomElement$1;
108
+
109
+ export { CatRadioGroup, defineCustomElement };
110
+
111
+ //# sourceMappingURL=cat-radio-group.js.map
@@ -0,0 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ACF;EAED,MAAM;IACJ,QACE,WAAK,IAAI,EAAC,YAAY,gBAAa,IAAI,CAAC,SAAS,IAC/C,eAAa,CACT,EACN;GACH;EAEO,cAAc;;IACpB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;MAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,kBAAI,OAAA,MAAA,MAAA,KAAK,CAAC,UAAU,0CAAE,aAAa,CAAC,OAAO,CAAC,0CAAE,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA,EAAA,CAAC,CAAC;MAC9G,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;MAC/E,MAAA,MAAA,IAAI,CAAC,aAAa,CAAC,iBAAiB,IAAI,CAAC,GAAG,iBAAiB,GAAG,CAAC,CAAC,CAAC,UAAU,0CACzE,aAAa,CAAC,OAAO,CAAC,0CACtB,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;KACnC;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatRadioGroup"],"sources":["./src/components/cat-radio-group/cat-radio-group.scss?tag=cat-radio-group&encapsulation=shadow","./src/components/cat-radio-group/cat-radio-group.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n","import { Component, h, Prop, Element, Listen, Watch } from '@stencil/core';\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 * 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 @Watch('name')\n onNameChanged(newName?: string) {\n this.catRadioGroup.forEach(catRadio => {\n catRadio.name = newName;\n });\n }\n\n @Watch('disabled')\n onDisabledChanged(disabled: boolean) {\n this.catRadioGroup.forEach(catRadio => {\n if (disabled) {\n catRadio.disabled = disabled;\n }\n });\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.onDisabledChanged(this.disabled);\n this.onLabelLeftChanged(this.labelLeft);\n this.updateTabIndex();\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].setFocus();\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 catRadioElement = this.catRadioGroup.find(value => value === event.target);\n if (catRadioElement && catRadioElement.checked) {\n const catRadioElements = this.catRadioGroup.filter(value => value !== catRadioElement);\n catRadioElements.forEach(value => (value.checked = false));\n this.updateTabIndex();\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"],"version":3}
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
2
2
  import { l as loglevel } from './loglevel.js';
3
3
  import { C as CatFormHint } from './cat-form-hint.js';
4
4
 
5
- const catRadioCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;margin:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;cursor:pointer}.radio{display:flex;position:relative}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid #d7dbe0;border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 32, 127, 138))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.is-disabled input{background-color:#f8f8fb}.is-disabled input:checked{border-color:#d7dbe0}.is-disabled .circle{background-color:#d7dbe0}";
5
+ const catRadioCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;margin:0}:host{display:flex;flex-direction:column;gap:0.5rem;margin-bottom:1rem}:host([hidden]){display:none}label{display:flex;gap:0.5rem;font-size:0.9375rem;line-height:1.25rem;cursor:pointer}.label-left{flex-direction:row-reverse}.radio{display:flex;position:relative}.circle{position:absolute;width:0.75rem;height:0.75rem;background-color:rgb(var(--cat-primary-bg, 32, 127, 138));border-radius:10rem;top:calc(50% - 0.375rem);left:calc(50% - 0.375rem);visibility:hidden}input{margin:0;width:1.25rem;height:1.25rem;appearance:none;background-color:white;border:1px solid #d7dbe0;border-radius:10rem;cursor:inherit}input:checked{border-color:rgb(var(--cat-primary-bg, 32, 127, 138))}input:checked+.circle{visibility:visible}input:focus-visible{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.label{flex:1 1 auto}.is-hidden .label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.is-disabled{cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.is-disabled input{background-color:#f8f8fb}.is-disabled input:checked{border-color:#d7dbe0}.is-disabled .circle{background-color:#d7dbe0}";
6
6
 
7
7
  let nextUniqueId = 0;
8
8
  const CatRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -35,6 +35,10 @@ const CatRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
35
35
  * Whether the radio is required.
36
36
  */
37
37
  this.required = false;
38
+ /**
39
+ * Whether the label should appear to the left of the radio component.
40
+ */
41
+ this.labelLeft = false;
38
42
  }
39
43
  componentWillRender() {
40
44
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
@@ -52,13 +56,14 @@ const CatRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
52
56
  this.input.focus(options);
53
57
  }
54
58
  render() {
55
- return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } }, h("span", { class: "radio" }, h("input", { ref: el => (this.input = el), id: this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), this.hintSection));
59
+ return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, h("span", { class: "radio" }, h("input", { ref: el => (this.input = el), id: this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), this.hintSection));
56
60
  }
57
61
  get hintSection() {
58
62
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
59
63
  return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
60
64
  }
61
65
  onChange(event) {
66
+ this.checked = true;
62
67
  this.value = this.input.value;
63
68
  this.catChange.emit(event);
64
69
  }
@@ -71,7 +76,7 @@ const CatRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
71
76
  get hostElement() { return this; }
72
77
  static get style() { return catRadioCss; }
73
78
  }, [1, "cat-radio", {
74
- "checked": [4],
79
+ "checked": [1028],
75
80
  "disabled": [4],
76
81
  "label": [1],
77
82
  "labelHidden": [4, "label-hidden"],
@@ -79,6 +84,7 @@ const CatRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
79
84
  "required": [4],
80
85
  "value": [1025],
81
86
  "hint": [1],
87
+ "labelLeft": [4, "label-left"],
82
88
  "hasSlottedLabel": [32],
83
89
  "setFocus": [64]
84
90
  }]);
@@ -1 +1 @@
1
- {"file":"cat-radio.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,44CAA44C;;ACIh6C,IAAI,YAAY,GAAG,CAAC,CAAC;MAeRA,UAAQ;EALrB;;;;;;;IAMmB,OAAE,GAAG,aAAa,EAAE,YAAY,EAAE,CAAC;IAK3C,oBAAe,GAAG,KAAK,CAAC;;;;IAKzB,YAAO,GAAG,KAAK,CAAC;;;;IAKhB,aAAQ,GAAG,KAAK,CAAC;;;;IAKjB,UAAK,GAAG,EAAE,CAAC;;;;IAKX,gBAAW,GAAG,KAAK,CAAC;;;;IAUpB,aAAQ,GAAG,KAAK,CAAC;GA+F1B;EApEC,mBAAmB;IACjB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1E,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;MACxCC,QAAG,CAAC,KAAK,CAAC,oCAAoC,EAAE,IAAI,CAAC,CAAC;KACvD;GACF;;;;;;;EASD,MAAM,QAAQ,CAAC,OAAsB;IACnC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;GAC3B;EAED,MAAM;IACJ,QACE,EAAC,IAAI,QACH,aAAO,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE,IAC7F,YAAM,KAAK,EAAC,OAAO,IACjB,aACE,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,KAAK,GAAG,EAAsB,CAAC,EAChD,EAAE,EAAE,IAAI,CA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AAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatRadio","log"],"sources":["./src/components/cat-radio/cat-radio.scss?tag=cat-radio&encapsulation=shadow","./src/components/cat-radio/cat-radio.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nlabel {\n display: flex;\n gap: 0.5rem;\n @include cat-body('m');\n cursor: pointer;\n}\n\n.radio {\n display: flex;\n position: relative;\n}\n\n.circle {\n position: absolute;\n width: calc(cat-size('xs') / 2);\n height: calc(cat-size('xs') / 2);\n background-color: cat-token('color.theme.primary.bg');\n border-radius: 10rem;\n top: calc(50% - cat-size('xs') / 4);\n left: calc(50% - cat-size('xs') / 4);\n visibility: hidden;\n}\n\ninput {\n margin: 0;\n width: calc(cat-size('m') / 2);\n height: calc(cat-size('m') / 2);\n appearance: none;\n background-color: cat-token('color.ui.background.input');\n border: 1px solid cat-token('color.ui.border.input');\n border-radius: 10rem;\n cursor: inherit;\n\n &:checked {\n border-color: cat-token('color.theme.primary.bg');\n\n + .circle {\n visibility: visible;\n }\n }\n\n &:focus-visible {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n }\n}\n\n.label {\n .is-hidden & {\n @include cat-visually-hidden;\n }\n}\n\n.is-disabled {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n\n input {\n background-color: cat-token('color.ui.background.inputDisabled');\n\n &:checked {\n border-color: cat-token('color.ui.border.input');\n }\n }\n\n .circle {\n background-color: cat-token('color.ui.border.input');\n }\n}\n","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 * Radio Buttons are graphical interface elements that allow user to choose\n * only one of a predefined set of mutually exclusive options.\n *\n * @slot hint - Optional hint element to be displayed with the radio.\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 */\n@Component({\n tag: 'cat-radio',\n styleUrl: 'cat-radio.scss',\n shadow: true\n})\nexport class CatRadio {\n private readonly id = `cat-radio-${++nextUniqueId}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Whether this radio is checked.\n */\n @Prop() checked = false;\n\n /**\n * Whether this radio is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The label of the radio 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 radio component.\n */\n @Prop() name?: string;\n\n /**\n * Whether the radio is required.\n */\n @Prop() required = false;\n\n /**\n * The value of the radio component.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Optional hint text(s) to be displayed with the radio.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Emitted when the radio is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the radio received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the radio loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on radio', this);\n }\n }\n\n /**\n * Sets focus on the radio. Use this method instead of `radio.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n render() {\n return (\n <Host>\n <label htmlFor={this.id} class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled }}>\n <span class=\"radio\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"radio\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onChange.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"circle\"></span>\n </span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onChange(event: Event) {\n this.value = this.input.value;\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"],"version":3}
1
+ {"file":"cat-radio.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,w8CAAw8C;;ACI59C,IAAI,YAAY,GAAG,CAAC,CAAC;MAeRA,UAAQ;EALrB;;;;;;;IAMmB,OAAE,GAAG,aAAa,EAAE,YAAY,EAAE,CAAC;IAK3C,oBAAe,GAAG,KAAK,CAAC;;;;IAKR,YAAO,GAAG,KAAK,CAAC;;;;IAKjC,aAAQ,GAAG,KAAK,CAAC;;;;IAKjB,UAAK,GAAG,EAAE,CAAC;;;;IAKX,gBAAW,GAAG,KAAK,CAAC;;;;IAUpB,aAAQ,GAAG,KAAK,CAAC;;;;IAejB,cAAS,GAAG,KAAK,CAAC;GA0F3B;EA1EC,mBAAmB;IACjB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC1E,IAAI,CAAC,IAAI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,IAAI,CAAC,KAAK,CAC9D,CACD,EACP,IAAI,CAAC,WAAW,CACZ,EACP;GACH;EAED,IAAY,WAAW;IACrB,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACzE,QACE,CAAC,IAAI,CAAC,IAAI,IAAI,cAAc,MAC1B,EAAC,WAAW,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,IAAI,YAAM,IAAI,EAAC,MAAM,GAAQ,GAAI,CAC3F,EACD;GACH;EAEO,QAAQ,CAAC,KAAY;IAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC5B;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC3B;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatRadio","log"],"sources":["./src/components/cat-radio/cat-radio.scss?tag=cat-radio&encapsulation=shadow","./src/components/cat-radio/cat-radio.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n@use 'src/components/cat-form-hint/cat-form-hint';\n\n:host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nlabel {\n display: flex;\n gap: 0.5rem;\n @include cat-body('m');\n cursor: pointer;\n}\n\n.label-left {\n flex-direction: row-reverse;\n}\n\n.radio {\n display: flex;\n position: relative;\n}\n\n.circle {\n position: absolute;\n width: calc(cat-size('xs') / 2);\n height: calc(cat-size('xs') / 2);\n background-color: cat-token('color.theme.primary.bg');\n border-radius: 10rem;\n top: calc(50% - cat-size('xs') / 4);\n left: calc(50% - cat-size('xs') / 4);\n visibility: hidden;\n}\n\ninput {\n margin: 0;\n width: calc(cat-size('m') / 2);\n height: calc(cat-size('m') / 2);\n appearance: none;\n background-color: cat-token('color.ui.background.input');\n border: 1px solid cat-token('color.ui.border.input');\n border-radius: 10rem;\n cursor: inherit;\n\n &:checked {\n border-color: cat-token('color.theme.primary.bg');\n\n + .circle {\n visibility: visible;\n }\n }\n\n &:focus-visible {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n }\n}\n\n.label {\n flex: 1 1 auto;\n\n .is-hidden & {\n @include cat-visually-hidden;\n }\n}\n\n.is-disabled {\n cursor: not-allowed;\n color: cat-token('color.ui.font.muted');\n\n input {\n background-color: cat-token('color.ui.background.inputDisabled');\n\n &:checked {\n border-color: cat-token('color.ui.border.input');\n }\n }\n\n .circle {\n background-color: cat-token('color.ui.border.input');\n }\n}\n","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 * Radio Buttons are graphical interface elements that allow user to choose\n * only one of a predefined set of mutually exclusive options.\n *\n * @slot hint - Optional hint element to be displayed with the radio.\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 */\n@Component({\n tag: 'cat-radio',\n styleUrl: 'cat-radio.scss',\n shadow: true\n})\nexport class CatRadio {\n private readonly id = `cat-radio-${++nextUniqueId}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Whether this radio is checked.\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Whether this radio is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * The label of the radio 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 radio component.\n */\n @Prop() name?: string;\n\n /**\n * Whether the radio is required.\n */\n @Prop() required = false;\n\n /**\n * The value of the radio component.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Optional hint text(s) to be displayed with the radio.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the radio component.\n */\n @Prop() labelLeft = false;\n /**\n * Emitted when the radio is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the radio received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the radio loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on radio', this);\n }\n }\n\n /**\n * Sets focus on the radio. Use this method instead of `radio.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\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 role=\"radio\"\n aria-checked={this.checked ? 'true' : 'false'}\n >\n <span class=\"radio\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"radio\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onChange.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"circle\"></span>\n </span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onChange(event: Event) {\n this.checked = true;\n this.value = this.input.value;\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"],"version":3}
@@ -7510,6 +7510,7 @@ const CatSelect$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1
7510
7510
  this.__attachShadow();
7511
7511
  this.catChange = createEvent(this, "catChange", 7);
7512
7512
  this.catSearch = createEvent(this, "catSearch", 7);
7513
+ this.catScrolledBottom = createEvent(this, "catScrolledBottom", 7);
7513
7514
  this.i18n = CatI18nRegistry.getInstance();
7514
7515
  this.id = `cat-select-${nextUniqueId++}`;
7515
7516
  this.hasSlottedLabel = false;
@@ -7569,29 +7570,36 @@ const CatSelect$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1
7569
7570
  }
7570
7571
  }
7571
7572
  componentDidLoad() {
7572
- var _a, _b, _c, _d, _e, _f, _g, _h;
7573
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
7573
7574
  this.init();
7574
- this.choiceInner = ((_c = (_b = (_a = this.hostElement).attachInternals) === null || _b === void 0 ? void 0 : _b.call(_a).shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.choices__inner')) || undefined;
7575
- (_d = this.choiceInner) === null || _d === void 0 ? void 0 : _d.addEventListener('click', this.showDropdownHandler.bind(this));
7576
- (_e = this.selectElement) === null || _e === void 0 ? void 0 : _e.addEventListener('addItem', this.onChange.bind(this));
7577
- (_f = this.selectElement) === null || _f === void 0 ? void 0 : _f.addEventListener('removeItem', this.onChange.bind(this));
7578
- (_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.addEventListener('search', this.onSearch.bind(this));
7575
+ const attachedInternals = (_b = (_a = this.hostElement).attachInternals) === null || _b === void 0 ? void 0 : _b.call(_a);
7576
+ if (attachedInternals) {
7577
+ this.choiceInner = ((_c = attachedInternals.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.choices__inner')) || undefined;
7578
+ this.choiceDropdown =
7579
+ ((_e = (_d = attachedInternals.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('.choices__list--dropdown')) === null || _e === void 0 ? void 0 : _e.firstElementChild) || undefined;
7580
+ }
7581
+ (_f = this.choiceInner) === null || _f === void 0 ? void 0 : _f.addEventListener('click', this.showDropdownHandler.bind(this));
7582
+ (_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.addEventListener('addItem', this.onChange.bind(this));
7583
+ (_h = this.selectElement) === null || _h === void 0 ? void 0 : _h.addEventListener('removeItem', this.onChange.bind(this));
7584
+ (_j = this.selectElement) === null || _j === void 0 ? void 0 : _j.addEventListener('search', this.onSearch.bind(this));
7585
+ (_k = this.choiceDropdown) === null || _k === void 0 ? void 0 : _k.addEventListener('scroll', this.onScrolledBottom.bind(this));
7579
7586
  if (this.multiple) {
7580
- (_h = this.selectElement) === null || _h === void 0 ? void 0 : _h.addEventListener('choice', this.onChoice.bind(this));
7587
+ (_l = this.selectElement) === null || _l === void 0 ? void 0 : _l.addEventListener('choice', this.onChoice.bind(this));
7581
7588
  this.createRemoveItemButton();
7582
7589
  }
7583
7590
  }
7584
7591
  disconnectedCallback() {
7585
- var _a, _b, _c, _d, _e, _f, _g;
7592
+ var _a, _b, _c, _d, _e, _f, _g, _h;
7586
7593
  (_a = this.choice) === null || _a === void 0 ? void 0 : _a.destroy();
7587
7594
  this.choice = undefined;
7588
7595
  (_b = this.choiceInner) === null || _b === void 0 ? void 0 : _b.removeEventListener('click', this.showDropdownHandler.bind(this));
7589
7596
  (_c = this.selectElement) === null || _c === void 0 ? void 0 : _c.removeEventListener('addItem', this.onChange.bind(this));
7590
7597
  (_d = this.selectElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('removeItem', this.onChange.bind(this));
7591
7598
  (_e = this.selectElement) === null || _e === void 0 ? void 0 : _e.removeEventListener('search', this.onSearch.bind(this));
7599
+ (_f = this.choiceDropdown) === null || _f === void 0 ? void 0 : _f.removeEventListener('scroll', this.onScrolledBottom.bind(this));
7592
7600
  if (this.multiple) {
7593
- (_f = this.selectElement) === null || _f === void 0 ? void 0 : _f.removeEventListener('choice', this.onChoice.bind(this));
7594
- (_g = this.removeElement) === null || _g === void 0 ? void 0 : _g.removeEventListener('click', this.onRemoveItemButtonClick.bind(this));
7601
+ (_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.removeEventListener('choice', this.onChoice.bind(this));
7602
+ (_h = this.removeElement) === null || _h === void 0 ? void 0 : _h.removeEventListener('click', this.onRemoveItemButtonClick.bind(this));
7595
7603
  }
7596
7604
  }
7597
7605
  /**
@@ -7635,6 +7643,7 @@ const CatSelect$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1
7635
7643
  }
7636
7644
  init() {
7637
7645
  const value = this.value || [];
7646
+ const removeItemText = (value) => this.i18n.t('select.removeItem', { value });
7638
7647
  const config = {
7639
7648
  allowHTML: true,
7640
7649
  items: Array.isArray(value) ? value : [value],
@@ -7670,6 +7679,10 @@ const CatSelect$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1
7670
7679
  return strToEl(`
7671
7680
  <div class="${classNames.item} ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable} ${data.placeholder ? classNames.placeholder : ''}" data-item data-id="${data.id}" data-value="${data.value}" ${data.active ? 'aria-selected="true"' : ''} ${data.disabled ? 'aria-disabled="true"' : ''}>
7672
7681
  <span>${template}</span> ${data.label}
7682
+ <button type="button"
7683
+ class="${classNames.button}"
7684
+ aria-label="${removeItemText(data.label)}"
7685
+ data-button>${removeItemText(data.label)}</button>
7673
7686
  </div>
7674
7687
  `);
7675
7688
  }
@@ -7694,6 +7707,10 @@ const CatSelect$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1
7694
7707
  ${data.disabled ? 'aria-disabled="true"' : ''}>
7695
7708
  ${template}
7696
7709
  ${data.label}
7710
+ <button type="button"
7711
+ class="${classNames.button}"
7712
+ aria-label="${removeItemText(data.label)}"
7713
+ data-button>${removeItemText(data.label)}</button>
7697
7714
  </div>`);
7698
7715
  },
7699
7716
  choice: function ({ classNames }, data) {
@@ -7733,6 +7750,14 @@ const CatSelect$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1
7733
7750
  const customEvent = event;
7734
7751
  this.catSearch.emit(customEvent.detail.value);
7735
7752
  }
7753
+ onScrolledBottom() {
7754
+ var _a, _b, _c;
7755
+ const scrolledBottom = ((_a = this.choiceDropdown) === null || _a === void 0 ? void 0 : _a.scrollHeight) ===
7756
+ (((_b = this.choiceDropdown) === null || _b === void 0 ? void 0 : _b.scrollTop) || 0) + (((_c = this.choiceDropdown) === null || _c === void 0 ? void 0 : _c.clientHeight) || 0);
7757
+ if (scrolledBottom) {
7758
+ this.catScrolledBottom.emit();
7759
+ }
7760
+ }
7736
7761
  onChoice(event) {
7737
7762
  var _a, _b;
7738
7763
  const customEvent = event;