@haiilo/catalyst 0.10.7 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/catalyst/catalyst.css +1 -1
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/{p-eddcea2b.entry.js → p-14edfc2b.entry.js} +5 -5
  5. package/dist/catalyst/p-14edfc2b.entry.js.map +1 -0
  6. package/dist/catalyst/p-5ba5e33c.entry.js +2 -0
  7. package/dist/catalyst/{p-c0b4200d.entry.js.map → p-5ba5e33c.entry.js.map} +1 -1
  8. package/dist/catalyst/scss/core/_base.scss +0 -1
  9. package/dist/catalyst/scss/index.scss +1 -1
  10. package/dist/catalyst/scss/utils/_layout.scss +4 -4
  11. package/dist/catalyst/scss/utils/_typography.mixins.scss +3 -3
  12. package/dist/cjs/cat-alert_21.cjs.entry.js +128 -105
  13. package/dist/cjs/cat-alert_21.cjs.entry.js.map +1 -1
  14. package/dist/cjs/cat-textarea.cjs.entry.js +1 -1
  15. package/dist/cjs/cat-textarea.cjs.entry.js.map +1 -1
  16. package/dist/cjs/catalyst.cjs.js +1 -1
  17. package/dist/cjs/loader.cjs.js +1 -1
  18. package/dist/collection/collection-manifest.json +1 -1
  19. package/dist/collection/components/cat-badge/cat-badge.css +15 -15
  20. package/dist/collection/components/cat-button/cat-button.css +185 -0
  21. package/dist/collection/components/cat-checkbox/cat-checkbox.css +16 -9
  22. package/dist/collection/components/cat-input/cat-input.css +3 -0
  23. package/dist/collection/components/cat-input/cat-input.js +1 -1
  24. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  25. package/dist/collection/components/cat-radio/cat-radio.css +4 -0
  26. package/dist/collection/components/cat-radio-group/cat-radio-group.js +62 -28
  27. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  28. package/dist/collection/components/cat-select/cat-select.css +4 -2
  29. package/dist/collection/components/cat-select/cat-select.js +136 -198
  30. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  31. package/dist/collection/components/cat-textarea/cat-textarea.css +3 -0
  32. package/dist/collection/components/cat-toggle/cat-toggle.css +9 -9
  33. package/dist/collection/components/cat-tooltip/cat-tooltip.css +2 -3
  34. package/dist/collection/index.js.map +1 -1
  35. package/dist/collection/scss/core/_base.scss +0 -1
  36. package/dist/collection/scss/index.scss +1 -1
  37. package/dist/collection/scss/utils/_layout.scss +4 -4
  38. package/dist/collection/scss/utils/_typography.mixins.scss +3 -3
  39. package/dist/components/cat-badge.js +1 -1
  40. package/dist/components/cat-badge.js.map +1 -1
  41. package/dist/components/cat-button2.js +1 -1
  42. package/dist/components/cat-button2.js.map +1 -1
  43. package/dist/components/cat-checkbox.js +1 -1
  44. package/dist/components/cat-checkbox.js.map +1 -1
  45. package/dist/components/cat-input.js +1 -1
  46. package/dist/components/cat-input.js.map +1 -1
  47. package/dist/components/cat-radio-group.js +18 -13
  48. package/dist/components/cat-radio-group.js.map +1 -1
  49. package/dist/components/cat-radio.js +1 -1
  50. package/dist/components/cat-radio.js.map +1 -1
  51. package/dist/components/cat-select.js +112 -98
  52. package/dist/components/cat-select.js.map +1 -1
  53. package/dist/components/cat-textarea.js +1 -1
  54. package/dist/components/cat-textarea.js.map +1 -1
  55. package/dist/components/cat-toggle.js +1 -1
  56. package/dist/components/cat-toggle.js.map +1 -1
  57. package/dist/components/cat-tooltip.js +1 -1
  58. package/dist/components/cat-tooltip.js.map +1 -1
  59. package/dist/esm/cat-alert_21.entry.js +128 -105
  60. package/dist/esm/cat-alert_21.entry.js.map +1 -1
  61. package/dist/esm/cat-textarea.entry.js +1 -1
  62. package/dist/esm/cat-textarea.entry.js.map +1 -1
  63. package/dist/esm/catalyst.js +1 -1
  64. package/dist/esm/loader.js +1 -1
  65. package/dist/types/components/cat-input/cat-input.d.ts +1 -1
  66. package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +17 -2
  67. package/dist/types/components/cat-select/cat-select.d.ts +22 -28
  68. package/dist/types/components.d.ts +36 -35
  69. package/dist/types/index.d.ts +1 -1
  70. package/package.json +2 -2
  71. package/dist/catalyst/p-c0b4200d.entry.js +0 -2
  72. package/dist/catalyst/p-eddcea2b.entry.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { Component, Element, Event, h, Host, Method, Prop, Watch, State } from '@stencil/core';
1
+ import { Component, Element, Event, h, Host, Prop, State, Watch, Listen } from '@stencil/core';
2
2
  import Choices from 'choices.js';
3
- import { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';
4
3
  import log from 'loglevel';
5
4
  import { CatFormHint } from '../cat-form-hint/cat-form-hint';
5
+ import { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';
6
6
  let nextUniqueId = 0;
7
7
  const getOptionTemplate = (data) => {
8
8
  var _a;
@@ -29,6 +29,7 @@ export class CatSelect {
29
29
  constructor() {
30
30
  this.i18n = CatI18nRegistry.getInstance();
31
31
  this.id = `cat-select-${nextUniqueId++}`;
32
+ this.resetItemsOnNextValueChange = true;
32
33
  this.hasSlottedLabel = false;
33
34
  /**
34
35
  * The label for the select.
@@ -45,7 +46,7 @@ export class CatSelect {
45
46
  /**
46
47
  * The available options for the input.
47
48
  */
48
- this.choices = [];
49
+ this.items = [];
49
50
  /**
50
51
  * Disable the select.
51
52
  */
@@ -67,17 +68,41 @@ export class CatSelect {
67
68
  /**
68
69
  * Enable search for the select.
69
70
  */
70
- this.noSearch = false;
71
+ this.search = false;
71
72
  }
72
- setChoicesHandler(choices) {
73
- if (!(choices === null || choices === void 0 ? void 0 : choices.length))
74
- return;
75
- this.setChoices(choices, 'value', 'label', true);
73
+ setChoicesHandler(items) {
74
+ var _a, _b, _c, _d;
75
+ const isSelected = (item) => { var _a; return (_a = this.value) === null || _a === void 0 ? void 0 : _a.includes(item.value); };
76
+ const choices = items.map(item => (Object.assign(Object.assign({}, item), { selected: isSelected(item) })));
77
+ (_a = this.choice) === null || _a === void 0 ? void 0 : _a.setChoices(choices, 'value', 'label', true);
78
+ const vItems = ((_b = this.choice) === null || _b === void 0 ? void 0 : _b.getValue()) || [];
79
+ const vItemsArray = (Array.isArray(vItems) ? vItems : [vItems]);
80
+ const value = this.value || [];
81
+ const vItemValues = [...value];
82
+ // remove duplicate items
83
+ (_c = this.choice) === null || _c === void 0 ? void 0 : _c.unhighlightAll();
84
+ vItemsArray.forEach(vItem => {
85
+ var _a;
86
+ const index = vItemValues.indexOf(vItem.value);
87
+ if (index > -1) {
88
+ vItemValues.splice(index, 1);
89
+ }
90
+ else {
91
+ vItem.choiceId = -1; // disconnect item from choice
92
+ (_a = this.choice) === null || _a === void 0 ? void 0 : _a.highlightItem(vItem, false);
93
+ }
94
+ });
95
+ (_d = this.choice) === null || _d === void 0 ? void 0 : _d.removeHighlightedItems(false);
76
96
  }
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
98
  setValueHandler(value) {
78
- if (this.multiple)
79
- return;
80
- this.setValue(value || []);
99
+ var _a, _b;
100
+ if (this.resetItemsOnNextValueChange) {
101
+ (_a = this.choice) === null || _a === void 0 ? void 0 : _a.removeActiveItems(-1);
102
+ }
103
+ this.resetItemsOnNextValueChange = true;
104
+ (_b = this.choice) === null || _b === void 0 ? void 0 : _b.setChoiceByValue(value);
105
+ this.multiple && this.updateRemoveItemButtonVisibility();
81
106
  }
82
107
  componentWillRender() {
83
108
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
@@ -86,73 +111,46 @@ export class CatSelect {
86
111
  }
87
112
  }
88
113
  componentDidLoad() {
89
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
114
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
90
115
  this.init();
91
116
  const attachedInternals = (_b = (_a = this.hostElement).attachInternals) === null || _b === void 0 ? void 0 : _b.call(_a);
92
117
  if (attachedInternals) {
93
- this.choiceInner = ((_c = attachedInternals.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.choices__inner')) || undefined;
94
- this.choiceDropdown =
95
- ((_e = (_d = attachedInternals.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('.choices__list--dropdown')) === null || _e === void 0 ? void 0 : _e.firstElementChild) || undefined;
118
+ const root = attachedInternals.shadowRoot;
119
+ this.choicesElement = (root === null || root === void 0 ? void 0 : root.querySelector('.choices')) || undefined;
120
+ this.choiceInner = (root === null || root === void 0 ? void 0 : root.querySelector('.choices__inner')) || undefined;
121
+ this.choiceDropdown = ((_c = root === null || root === void 0 ? void 0 : root.querySelector('.choices__list--dropdown')) === null || _c === void 0 ? void 0 : _c.firstElementChild) || undefined;
96
122
  }
97
- (_f = this.choiceInner) === null || _f === void 0 ? void 0 : _f.addEventListener('click', this.showDropdownHandler.bind(this));
98
- (_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.addEventListener('addItem', this.onChange.bind(this));
99
- (_h = this.selectElement) === null || _h === void 0 ? void 0 : _h.addEventListener('removeItem', this.onChange.bind(this));
100
- (_j = this.selectElement) === null || _j === void 0 ? void 0 : _j.addEventListener('search', this.onSearch.bind(this));
101
- (_k = this.choiceDropdown) === null || _k === void 0 ? void 0 : _k.addEventListener('scroll', this.onScrolledBottom.bind(this));
123
+ (_d = this.choicesElement) === null || _d === void 0 ? void 0 : _d.addEventListener('click', this.resetFocus.bind(this));
124
+ (_e = this.choiceInner) === null || _e === void 0 ? void 0 : _e.addEventListener('click', this.showDropdownHandler.bind(this));
125
+ (_f = this.selectElement) === null || _f === void 0 ? void 0 : _f.addEventListener('hideDropdown', this.showMultipleFocus.bind(this));
126
+ (_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.addEventListener('showDropdown', this.showMultipleFocus.bind(this));
127
+ (_h = this.selectElement) === null || _h === void 0 ? void 0 : _h.addEventListener('removeItem', this.resetFocus.bind(this));
128
+ (_j = this.selectElement) === null || _j === void 0 ? void 0 : _j.addEventListener('change', this.onChange.bind(this));
129
+ (_k = this.selectElement) === null || _k === void 0 ? void 0 : _k.addEventListener('search', this.onSearch.bind(this));
130
+ (_l = this.choiceDropdown) === null || _l === void 0 ? void 0 : _l.addEventListener('scroll', this.onScrolledBottom.bind(this));
102
131
  if (this.multiple) {
103
- (_l = this.selectElement) === null || _l === void 0 ? void 0 : _l.addEventListener('choice', this.onChoice.bind(this));
132
+ (_m = this.selectElement) === null || _m === void 0 ? void 0 : _m.addEventListener('choice', this.onChoice.bind(this));
104
133
  this.createRemoveItemButton();
105
134
  }
106
135
  }
107
136
  disconnectedCallback() {
108
- var _a, _b, _c, _d, _e, _f, _g, _h;
137
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
109
138
  (_a = this.choice) === null || _a === void 0 ? void 0 : _a.destroy();
110
139
  this.choice = undefined;
111
- (_b = this.choiceInner) === null || _b === void 0 ? void 0 : _b.removeEventListener('click', this.showDropdownHandler.bind(this));
112
- (_c = this.selectElement) === null || _c === void 0 ? void 0 : _c.removeEventListener('addItem', this.onChange.bind(this));
113
- (_d = this.selectElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('removeItem', this.onChange.bind(this));
114
- (_e = this.selectElement) === null || _e === void 0 ? void 0 : _e.removeEventListener('search', this.onSearch.bind(this));
115
- (_f = this.choiceDropdown) === null || _f === void 0 ? void 0 : _f.removeEventListener('scroll', this.onScrolledBottom.bind(this));
140
+ (_b = this.choicesElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('click', this.resetFocus.bind(this));
141
+ (_c = this.choiceInner) === null || _c === void 0 ? void 0 : _c.removeEventListener('click', this.showDropdownHandler.bind(this));
142
+ (_d = this.selectElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('hideDropdown', this.showMultipleFocus.bind(this));
143
+ (_e = this.selectElement) === null || _e === void 0 ? void 0 : _e.removeEventListener('showDropdown', this.showMultipleFocus.bind(this));
144
+ (_f = this.selectElement) === null || _f === void 0 ? void 0 : _f.removeEventListener('removeItem', this.resetFocus.bind(this));
145
+ (_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.removeEventListener('change', this.onChange.bind(this));
146
+ (_h = this.selectElement) === null || _h === void 0 ? void 0 : _h.removeEventListener('search', this.onSearch.bind(this));
147
+ (_j = this.choiceDropdown) === null || _j === void 0 ? void 0 : _j.removeEventListener('scroll', this.onScrolledBottom.bind(this));
116
148
  if (this.multiple) {
117
- (_g = this.selectElement) === null || _g === void 0 ? void 0 : _g.removeEventListener('choice', this.onChoice.bind(this));
118
- (_h = this.removeElement) === null || _h === void 0 ? void 0 : _h.removeEventListener('click', this.onRemoveItemButtonClick.bind(this));
149
+ (_k = this.removeElement) === null || _k === void 0 ? void 0 : _k.removeEventListener('choice', this.onChoice.bind(this));
119
150
  }
120
151
  }
121
- /**
122
- * Set value of input based on an array of objects or strings. This behaves
123
- * exactly the same as passing items via the items option but can be called
124
- * after initialisation.
125
- */
126
- async setValue(args) {
127
- var _a;
128
- (_a = this.choice) === null || _a === void 0 ? void 0 : _a.setValue(args);
129
- return this;
130
- }
131
- /**
132
- * Set choices of select input via an array of objects (or function that
133
- * returns array of object or promise of it), a value field name and a label
134
- * field name.
135
- */
136
- async setChoices(choices, value, label, replaceChoices) {
137
- var _a;
138
- (_a = this.choice) === null || _a === void 0 ? void 0 : _a.setChoices(choices, value, label, replaceChoices);
139
- return this;
140
- }
141
- /**
142
- * Clear all choices from select.
143
- */
144
- async clearChoices() {
145
- var _a;
146
- (_a = this.choice) === null || _a === void 0 ? void 0 : _a.clearChoices();
147
- return this;
148
- }
149
- /**
150
- * Clear input of any user inputted text.
151
- */
152
- async clearInput() {
153
- var _a;
154
- (_a = this.choice) === null || _a === void 0 ? void 0 : _a.clearInput();
155
- return this;
152
+ onBlur(event) {
153
+ this.catBlur.emit(event);
156
154
  }
157
155
  render() {
158
156
  return (h(Host, null,
@@ -167,16 +165,15 @@ export class CatSelect {
167
165
  this.hintSection));
168
166
  }
169
167
  init() {
170
- const value = this.value || [];
168
+ const component = this; // eslint-disable-line @typescript-eslint/no-this-alias
171
169
  const removeItemText = (value) => this.i18n.t('select.removeItem', { value });
172
170
  const config = {
173
171
  allowHTML: true,
174
- items: Array.isArray(value) ? value : [value],
175
172
  removeItemButton: true,
176
173
  duplicateItemsAllowed: false,
177
174
  delimiter: '',
178
175
  paste: false,
179
- searchEnabled: !this.noSearch,
176
+ searchEnabled: this.search,
180
177
  searchChoices: false,
181
178
  position: this.position,
182
179
  resetScrollPosition: false,
@@ -191,7 +188,12 @@ export class CatSelect {
191
188
  addItemText: (value) => this.i18n.t('select.addItem', { value }),
192
189
  maxItemText: (maxItemCount) => this.i18n.t('select.maxItem', { maxItemCount }),
193
190
  uniqueItemText: this.i18n.t('select.uniqueItem'),
194
- customAddItemText: this.i18n.t('select.customAddItem')
191
+ customAddItemText: this.i18n.t('select.customAddItem'),
192
+ callbackOnInit: function () {
193
+ const choice = this;
194
+ choice.setChoices(component.items, 'value', 'label', true);
195
+ choice.setChoiceByValue(component.value);
196
+ }
195
197
  };
196
198
  const configSingle = {
197
199
  callbackOnCreateTemplates: (strToEl) => {
@@ -257,18 +259,42 @@ export class CatSelect {
257
259
  const settings = this.multiple
258
260
  ? Object.assign(Object.assign({}, config), configMultiple) : Object.assign(Object.assign({}, config), configSingle);
259
261
  this.choice = new Choices(this.selectElement, settings);
260
- this.choice.setChoices(this.choices);
261
262
  }
262
263
  get hintSection() {
263
264
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
264
265
  return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
265
266
  }
266
267
  onChange() {
268
+ var _a;
269
+ this.resetItemsOnNextValueChange = false;
270
+ this.value = (_a = this.choice) === null || _a === void 0 ? void 0 : _a.getValue(true);
271
+ this.catChange.emit(this.value);
272
+ }
273
+ showMultipleFocus() {
267
274
  var _a, _b;
268
- this.value = (_a = this.choice) === null || _a === void 0 ? void 0 : _a.getValue();
269
- this.catChange.emit((_b = this.choice) === null || _b === void 0 ? void 0 : _b.getValue());
270
- if (this.multiple) {
271
- this.updateRemoveItemButtonVisibility();
275
+ if (this.multiple && this.isFocused() && !((_a = this.choicesElement) === null || _a === void 0 ? void 0 : _a.classList.contains('is-focused'))) {
276
+ (_b = this.choicesElement) === null || _b === void 0 ? void 0 : _b.classList.add('is-focused');
277
+ }
278
+ }
279
+ resetFocus() {
280
+ var _a, _b, _c;
281
+ if (!this.isFocused()) {
282
+ if (!((_a = this.choicesElement) === null || _a === void 0 ? void 0 : _a.hasAttribute('tabindex'))) {
283
+ (_b = this.choicesElement) === null || _b === void 0 ? void 0 : _b.setAttribute('tabindex', '0');
284
+ }
285
+ (_c = this.choicesElement) === null || _c === void 0 ? void 0 : _c.focus();
286
+ }
287
+ }
288
+ isFocused() {
289
+ return document.activeElement === this.hostElement;
290
+ }
291
+ onChoice(event) {
292
+ var _a;
293
+ const customEvent = event;
294
+ const choice = customEvent.detail.choice;
295
+ if (choice.selected) {
296
+ (_a = this.choice) === null || _a === void 0 ? void 0 : _a.removeActiveItemsByValue(choice.value);
297
+ this.onChange();
272
298
  }
273
299
  }
274
300
  onSearch(event) {
@@ -283,20 +309,9 @@ export class CatSelect {
283
309
  this.catScrolledBottom.emit();
284
310
  }
285
311
  }
286
- onChoice(event) {
287
- var _a, _b;
288
- const customEvent = event;
289
- const items = Array.from((_a = this.choice) === null || _a === void 0 ? void 0 : _a.getValue());
290
- const item = items.find(value => value.choiceId === customEvent.detail.choice.id);
291
- if (item) {
292
- (_b = this.choice) === null || _b === void 0 ? void 0 : _b._removeItem(item);
293
- }
294
- }
295
312
  showDropdownHandler() {
296
313
  var _a;
297
- if (!this.disabled) {
298
- (_a = this.choice) === null || _a === void 0 ? void 0 : _a.showDropdown();
299
- }
314
+ !this.disabled && ((_a = this.choice) === null || _a === void 0 ? void 0 : _a.showDropdown());
300
315
  }
301
316
  createRemoveItemButton() {
302
317
  var _a;
@@ -314,7 +329,7 @@ export class CatSelect {
314
329
  if (items.length) {
315
330
  (_b = this.removeElement) === null || _b === void 0 ? void 0 : _b.removeAttribute('hidden');
316
331
  }
317
- else if (!items.length) {
332
+ else {
318
333
  (_c = this.removeElement) === null || _c === void 0 ? void 0 : _c.setAttribute('hidden', 'true');
319
334
  }
320
335
  }
@@ -322,6 +337,8 @@ export class CatSelect {
322
337
  var _a;
323
338
  event.stopPropagation();
324
339
  (_a = this.choice) === null || _a === void 0 ? void 0 : _a.removeActiveItems(-1);
340
+ this.updateRemoveItemButtonVisibility();
341
+ this.onChange();
325
342
  }
326
343
  static get is() { return "cat-select"; }
327
344
  static get encapsulation() { return "shadow"; }
@@ -386,16 +403,15 @@ export class CatSelect {
386
403
  "reflect": false,
387
404
  "defaultValue": "false"
388
405
  },
389
- "choices": {
406
+ "items": {
390
407
  "type": "unknown",
391
408
  "mutable": false,
392
409
  "complexType": {
393
- "original": "Choice[]",
394
- "resolved": "Choice[]",
410
+ "original": "CatSelectItem[]",
411
+ "resolved": "CatSelectItem[]",
395
412
  "references": {
396
- "Choice": {
397
- "location": "import",
398
- "path": "choices.js"
413
+ "CatSelectItem": {
414
+ "location": "local"
399
415
  }
400
416
  }
401
417
  },
@@ -408,23 +424,18 @@ export class CatSelect {
408
424
  "defaultValue": "[]"
409
425
  },
410
426
  "value": {
411
- "type": "string",
427
+ "type": "any",
412
428
  "mutable": true,
413
429
  "complexType": {
414
- "original": "string | string[] | Choice | Choice[]",
415
- "resolved": "Choice | Choice[] | string | string[] | undefined",
416
- "references": {
417
- "Choice": {
418
- "location": "import",
419
- "path": "choices.js"
420
- }
421
- }
430
+ "original": "any",
431
+ "resolved": "any",
432
+ "references": {}
422
433
  },
423
434
  "required": false,
424
435
  "optional": true,
425
436
  "docs": {
426
437
  "tags": [],
427
- "text": "The pre-selected items for the input."
438
+ "text": "The value of the select."
428
439
  },
429
440
  "attribute": "value",
430
441
  "reflect": false
@@ -501,7 +512,7 @@ export class CatSelect {
501
512
  "reflect": false,
502
513
  "defaultValue": "'auto'"
503
514
  },
504
- "noSearch": {
515
+ "search": {
505
516
  "type": "boolean",
506
517
  "mutable": false,
507
518
  "complexType": {
@@ -515,7 +526,7 @@ export class CatSelect {
515
526
  "tags": [],
516
527
  "text": "Enable search for the select."
517
528
  },
518
- "attribute": "no-search",
529
+ "attribute": "search",
519
530
  "reflect": false,
520
531
  "defaultValue": "false"
521
532
  },
@@ -585,113 +596,40 @@ export class CatSelect {
585
596
  "resolved": "any",
586
597
  "references": {}
587
598
  }
588
- }]; }
589
- static get methods() { return {
590
- "setValue": {
591
- "complexType": {
592
- "signature": "(args: Array<string> | Array<Item>) => Promise<this>",
593
- "parameters": [{
594
- "tags": [],
595
- "text": ""
596
- }],
597
- "references": {
598
- "Promise": {
599
- "location": "global"
600
- },
601
- "Array": {
602
- "location": "global"
603
- },
604
- "Item": {
605
- "location": "import",
606
- "path": "choices.js"
607
- }
608
- },
609
- "return": "Promise<this>"
610
- },
611
- "docs": {
612
- "text": "Set value of input based on an array of objects or strings. This behaves\nexactly the same as passing items via the items option but can be called\nafter initialisation.",
613
- "tags": []
614
- }
615
- },
616
- "setChoices": {
617
- "complexType": {
618
- "signature": "(choices: Array<Choice> | Array<Group>, value?: string | undefined, label?: string | undefined, replaceChoices?: boolean | undefined) => Promise<this>",
619
- "parameters": [{
620
- "tags": [],
621
- "text": ""
622
- }, {
623
- "tags": [],
624
- "text": ""
625
- }, {
626
- "tags": [],
627
- "text": ""
628
- }, {
629
- "tags": [],
630
- "text": ""
631
- }],
632
- "references": {
633
- "Promise": {
634
- "location": "global"
635
- },
636
- "Array": {
637
- "location": "global"
638
- },
639
- "Choice": {
640
- "location": "import",
641
- "path": "choices.js"
642
- },
643
- "Group": {
644
- "location": "import",
645
- "path": "choices.js"
646
- }
647
- },
648
- "return": "Promise<this>"
649
- },
599
+ }, {
600
+ "method": "catBlur",
601
+ "name": "catBlur",
602
+ "bubbles": true,
603
+ "cancelable": true,
604
+ "composed": true,
650
605
  "docs": {
651
- "text": "Set choices of select input via an array of objects (or function that\nreturns array of object or promise of it), a value field name and a label\nfield name.",
652
- "tags": []
653
- }
654
- },
655
- "clearChoices": {
656
- "complexType": {
657
- "signature": "() => Promise<this>",
658
- "parameters": [],
659
- "references": {
660
- "Promise": {
661
- "location": "global"
662
- }
663
- },
664
- "return": "Promise<this>"
606
+ "tags": [],
607
+ "text": "Emitted when the select loses focus."
665
608
  },
666
- "docs": {
667
- "text": "Clear all choices from select.",
668
- "tags": []
669
- }
670
- },
671
- "clearInput": {
672
609
  "complexType": {
673
- "signature": "() => Promise<this>",
674
- "parameters": [],
610
+ "original": "FocusEvent",
611
+ "resolved": "FocusEvent",
675
612
  "references": {
676
- "Promise": {
613
+ "FocusEvent": {
677
614
  "location": "global"
678
615
  }
679
- },
680
- "return": "Promise<this>"
681
- },
682
- "docs": {
683
- "text": "Clear input of any user inputted text.",
684
- "tags": []
616
+ }
685
617
  }
686
- }
687
- }; }
618
+ }]; }
688
619
  static get elementRef() { return "hostElement"; }
689
620
  static get watchers() { return [{
690
- "propName": "choices",
621
+ "propName": "items",
691
622
  "methodName": "setChoicesHandler"
692
623
  }, {
693
624
  "propName": "value",
694
625
  "methodName": "setValueHandler"
695
626
  }]; }
627
+ static get listeners() { return [{
628
+ "name": "blur",
629
+ "method": "onBlur",
630
+ "target": undefined,
631
+ "capture": true,
632
+ "passive": false
633
+ }]; }
696
634
  }
697
635
  //# sourceMappingURL=cat-select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-select.js","sourceRoot":"","sources":["../../../src/components/cat-select/cat-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,OAAqD,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,GAAG,MAAM,UAAU,CAAC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AAC,aAAa,0CAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;KAC/C;SAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;MACxB,MAAA,IAAI,CAAC,aAAa,0CAAE,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACpD;EACH,CAAC;EAEO,uBAAuB,CAAC,KAAY;;IAC1C,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,MAAA,IAAI,CAAC,MAAM,0CAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;EACrC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch, State } from '@stencil/core';\nimport Choices, { Choice, ClassNames, Group, Item, Options } from 'choices.js';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\nconst getOptionTemplate = (data: Item): string => {\n if (data.customProperties?.imageUrl) {\n return `\n <div class=\"d-flex align-items-center\">\n <img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem\" />\n ${data.label}\n </div>\n `;\n }\n return `<cat-checkbox label=\"${data.label}\" checked=\"${data.selected}\"></cat-checkbox>`;\n};\n\n/**\n * Select lets user choose one option from an options menu. Consider using\n * select when you have 6 or more options. Select component supports any content\n * type.\n *\n * @slot hint - Optional hint element to be displayed with the select.\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-select',\n styleUrl: 'cat-select.scss',\n shadow: true\n})\nexport class CatSelect {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-select-${nextUniqueId++}`;\n\n private choice?: Choices;\n private choiceInner?: Element;\n private choiceDropdown?: Element;\n private selectElement?: HTMLSelectElement;\n private removeElement?: HTMLCatButtonElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * The label for the select.\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 value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * The available options for the input.\n */\n @Prop() choices: Choice[] = [];\n\n /**\n * The pre-selected items for the input.\n */\n @Prop({ mutable: true }) value?: string | string[] | Choice | Choice[];\n\n /**\n * Disable the select.\n */\n @Prop() disabled = false;\n\n /**\n * Enable multiple selection.\n */\n @Prop() multiple = false;\n\n /**\n * The placeholder for the select.\n */\n @Prop() placeholder = '';\n\n /**\n * Whether the dropdown should appear above `(top)` or below `(bottom)` the\n * input. By default, if there is not enough space within the window the\n * dropdown will appear above the input, otherwise below it.\n */\n @Prop() position: 'auto' | 'top' | 'bottom' = 'auto';\n\n /**\n * Enable search for the select.\n */\n @Prop() noSearch = false;\n\n /**\n * Optional hint text(s) to be displayed with the select.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the search is triggered.\n */\n @Event() catSearch!: EventEmitter;\n\n /**\n * Emitted when scrolled to the bottom.\n */\n @Event() catScrolledBottom!: EventEmitter;\n\n @Watch('choices')\n setChoicesHandler(choices: Choice[]) {\n if (!choices?.length) return;\n\n this.setChoices(choices, 'value', 'label', true);\n }\n\n @Watch('value')\n setValueHandler(value?: string[] | Choice[]) {\n if (this.multiple) return;\n\n this.setValue(value || []);\n }\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 select', this);\n }\n }\n\n componentDidLoad(): void {\n this.init();\n const attachedInternals: ElementInternals | undefined = this.hostElement.attachInternals?.();\n if (attachedInternals) {\n this.choiceInner = attachedInternals.shadowRoot?.querySelector('.choices__inner') || undefined;\n this.choiceDropdown =\n attachedInternals.shadowRoot?.querySelector('.choices__list--dropdown')?.firstElementChild || undefined;\n }\n this.choiceInner?.addEventListener('click', this.showDropdownHandler.bind(this));\n this.selectElement?.addEventListener('addItem', this.onChange.bind(this));\n this.selectElement?.addEventListener('removeItem', this.onChange.bind(this));\n this.selectElement?.addEventListener('search', this.onSearch.bind(this));\n this.choiceDropdown?.addEventListener('scroll', this.onScrolledBottom.bind(this));\n if (this.multiple) {\n this.selectElement?.addEventListener('choice', this.onChoice.bind(this));\n this.createRemoveItemButton();\n }\n }\n\n disconnectedCallback(): void {\n this.choice?.destroy();\n this.choice = undefined;\n this.choiceInner?.removeEventListener('click', this.showDropdownHandler.bind(this));\n this.selectElement?.removeEventListener('addItem', this.onChange.bind(this));\n this.selectElement?.removeEventListener('removeItem', this.onChange.bind(this));\n this.selectElement?.removeEventListener('search', this.onSearch.bind(this));\n this.choiceDropdown?.removeEventListener('scroll', this.onScrolledBottom.bind(this));\n if (this.multiple) {\n this.selectElement?.removeEventListener('choice', this.onChoice.bind(this));\n this.removeElement?.removeEventListener('click', this.onRemoveItemButtonClick.bind(this));\n }\n }\n\n /**\n * Set value of input based on an array of objects or strings. This behaves\n * exactly the same as passing items via the items option but can be called\n * after initialisation.\n */\n @Method()\n async setValue(args: Array<string> | Array<Item>) {\n this.choice?.setValue(args);\n\n return this;\n }\n\n /**\n * Set choices of select input via an array of objects (or function that\n * returns array of object or promise of it), a value field name and a label\n * field name.\n */\n @Method()\n async setChoices(choices: Array<Choice> | Array<Group>, value?: string, label?: string, replaceChoices?: boolean) {\n this.choice?.setChoices(choices, value, label, replaceChoices);\n\n return this;\n }\n\n /**\n * Clear all choices from select.\n */\n @Method()\n async clearChoices() {\n this.choice?.clearChoices();\n\n return this;\n }\n\n /**\n * Clear input of any user inputted text.\n */\n @Method()\n async clearInput() {\n this.choice?.clearInput();\n\n return this;\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <select\n id={this.id}\n ref={el => (this.selectElement = el)}\n multiple={this.multiple}\n disabled={this.disabled}\n ></select>\n {this.hintSection}\n </Host>\n );\n }\n\n private init() {\n const value = this.value || [];\n const removeItemText = (value: string) => this.i18n.t('select.removeItem', { value });\n const config = {\n allowHTML: true,\n items: Array.isArray(value) ? value : ([value] as string[] | Choice[]),\n removeItemButton: true,\n duplicateItemsAllowed: false,\n delimiter: '',\n paste: false,\n searchEnabled: !this.noSearch,\n searchChoices: false,\n position: this.position,\n resetScrollPosition: false,\n placeholder: !!this.placeholder,\n placeholderValue: this.placeholder || '',\n searchPlaceholderValue: this.i18n.t('select.searchPlaceholder'),\n renderSelectedChoices: 'always' as 'auto' | 'always',\n loadingText: this.i18n.t('select.loading'),\n noResultsText: this.i18n.t('select.noResults'),\n noChoicesText: this.i18n.t('select.noChoices'),\n itemSelectText: this.i18n.t('select.selectItem'),\n addItemText: (value: string) => this.i18n.t('select.addItem', { value }),\n maxItemText: (maxItemCount: number) => this.i18n.t('select.maxItem', { maxItemCount }),\n uniqueItemText: this.i18n.t('select.uniqueItem'),\n customAddItemText: this.i18n.t('select.customAddItem')\n };\n\n const configSingle = {\n callbackOnCreateTemplates: (strToEl: (str: string) => HTMLElement) => {\n return {\n item: ({ classNames }: { classNames: ClassNames }, data: Item) => {\n const template = data.customProperties?.imageUrl\n ? `<img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem\" />`\n : '';\n return strToEl(\n `\n <div class=\"${classNames.item} ${\n data.highlighted ? classNames.highlightedState : classNames.itemSelectable\n } ${data.placeholder ? classNames.placeholder : ''}\" data-item data-id=\"${data.id}\" data-value=\"${\n data.value\n }\" ${data.active ? 'aria-selected=\"true\"' : ''} ${data.disabled ? 'aria-disabled=\"true\"' : ''}>\n <span>${template}</span> ${data.label}\n <button type=\"button\"\n class=\"${classNames.button}\"\n aria-label=\"${removeItemText(data.label)}\"\n data-button>${removeItemText(data.label)}</button>\n </div>\n `\n );\n }\n };\n }\n };\n\n const configMultiple = {\n callbackOnCreateTemplates: (strToEl: (str: string) => HTMLElement) => {\n const itemSelectText = config.itemSelectText;\n return {\n item: ({ classNames }: { classNames: ClassNames }, data: Item) => {\n const template = data.customProperties?.imageUrl\n ? `<img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem;\" />`\n : '';\n return strToEl(\n `<div class=\"\n ${classNames.item}\n ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable}\n ${data.placeholder ? classNames.placeholder : ''}\"\n data-item data-id=\"${data.id}\" data-value=\"${data.value}\"\n ${data.active ? 'aria-selected=\"true\"' : ''}\n ${data.disabled ? 'aria-disabled=\"true\"' : ''}>\n ${template}\n ${data.label}\n <button type=\"button\"\n class=\"${classNames.button}\"\n aria-label=\"${removeItemText(data.label)}\"\n data-button>${removeItemText(data.label)}</button>\n </div>`\n );\n },\n choice: function ({ classNames }: { classNames: ClassNames }, data: Item) {\n const template = getOptionTemplate(data);\n const className = `${String(classNames.item)} ${String(classNames.itemChoice)}\n ${String(data.disabled ? classNames.itemDisabled : classNames.itemSelectable)}\n ${data.selected ? 'choices__item--selected' : ''}`;\n return strToEl(\n `<div class=\"${className}\"\n data-select-text=\"${itemSelectText}\"\n data-choice data-id=\"${String(data.id)}\" data-value=\"${String(data.value)}\"\n ${data.disabled ? 'data-choice-disabled aria-disabled=\"true\"' : 'data-choice-selectable'}\n ${data.groupId && data.groupId > 0 ? 'role=\"treeitem\"' : 'role=\"option\"'}>\n ${template}\n </div>`\n );\n }\n };\n }\n };\n\n const settings: Partial<Options> = this.multiple\n ? { ...config, ...configMultiple }\n : { ...config, ...configSingle };\n this.choice = new Choices(this.selectElement, settings);\n this.choice.setChoices(this.choices);\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() {\n this.value = this.choice?.getValue();\n this.catChange.emit(this.choice?.getValue());\n if (this.multiple) {\n this.updateRemoveItemButtonVisibility();\n }\n }\n\n private onSearch(event: Event) {\n const customEvent = event as CustomEvent<{ value: string }>;\n this.catSearch.emit(customEvent.detail.value);\n }\n\n private onScrolledBottom() {\n const scrolledBottom: boolean =\n this.choiceDropdown?.scrollHeight ===\n (this.choiceDropdown?.scrollTop || 0) + (this.choiceDropdown?.clientHeight || 0);\n\n if (scrolledBottom) {\n this.catScrolledBottom.emit();\n }\n }\n\n private onChoice(event: Event) {\n const customEvent = event as CustomEvent<{ choice: Choice }>;\n const items = Array.from(this.choice?.getValue() as Item[]);\n const item = items.find(value => value.choiceId === customEvent.detail.choice.id);\n if (item) {\n this.choice?._removeItem(item);\n }\n }\n\n private showDropdownHandler() {\n if (!this.disabled) {\n this.choice?.showDropdown();\n }\n }\n\n private createRemoveItemButton() {\n this.removeElement = document.createElement('cat-button') as HTMLCatButtonElement;\n this.removeElement.icon = 'cross-circle-outlined';\n this.removeElement.iconOnly = true;\n this.removeElement.a11yLabel = this.i18n.t('select.removeItem');\n this.updateRemoveItemButtonVisibility();\n this.removeElement.addEventListener('click', this.onRemoveItemButtonClick.bind(this));\n this.choiceInner?.appendChild(this.removeElement);\n }\n\n private updateRemoveItemButtonVisibility() {\n const items = Array.from(this.choice?.getValue() as Item[]);\n if (items.length) {\n this.removeElement?.removeAttribute('hidden');\n } else if (!items.length) {\n this.removeElement?.setAttribute('hidden', 'true');\n }\n }\n\n private onRemoveItemButtonClick(event: Event) {\n event.stopPropagation();\n this.choice?.removeActiveItems(-1);\n }\n}\n"]}
1
+ {"version":3,"file":"cat-select.js","sourceRoot":"","sources":["../../../src/components/cat-select/cat-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,OAA8C,MAAM,YAAY,CAAC;AACxE,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB,MAAM,iBAAiB,GAAG,CAAC,IAAU,EAAU,EAAE;;EAC/C,IAAI,MAAA,IAAI,CAAC,gBAAgB,0CAAE,QAAQ,EAAE;IACnC,OAAO;;8CAEmC,IAAI,CAAC,gBAAgB,CAAC,QAAQ;QACpE,IAAI,CAAC,KAAK;;KAEb,CAAC;GACH;EACD,OAAO,wBAAwB,IAAI,CAAC,KAAK,cAAc,IAAI,CAAC,QAAQ,mBAAmB,CAAC;AAC1F,CAAC,CAAC;AAOF;;;;;;;;GAQG;AAMH,MAAM,OAAO,SAAS;EALtB;IAMmB,SAAI,GAAG,eAAe,CAAC,WAAW,EA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ices, { Choice, ClassNames, Item, Options } from 'choices.js';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\n\nlet nextUniqueId = 0;\n\nconst getOptionTemplate = (data: Item): string => {\n if (data.customProperties?.imageUrl) {\n return `\n <div class=\"d-flex align-items-center\">\n <img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem\" />\n ${data.label}\n </div>\n `;\n }\n return `<cat-checkbox label=\"${data.label}\" checked=\"${data.selected}\"></cat-checkbox>`;\n};\n\n/**\n * A single option in the select.\n */\nexport type CatSelectItem = Pick<Choice, 'label' | 'value' | 'customProperties'>;\n\n/**\n * Select lets user choose one option from an options menu. Consider using\n * select when you have 6 or more options. Select component supports any content\n * type.\n *\n * @slot hint - Optional hint element to be displayed with the select.\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-select',\n styleUrl: 'cat-select.scss',\n shadow: true\n})\nexport class CatSelect {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-select-${nextUniqueId++}`;\n private resetItemsOnNextValueChange = true;\n\n private choice?: Choices;\n private choicesElement?: HTMLElement;\n private choiceInner?: Element;\n private choiceDropdown?: Element;\n private selectElement?: HTMLSelectElement;\n private removeElement?: HTMLCatButtonElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * The label for the select.\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 value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * The available options for the input.\n */\n @Prop() items: CatSelectItem[] = [];\n\n /**\n * The value of the select.\n */\n @Prop({ mutable: true }) value?: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n\n /**\n * Disable the select.\n */\n @Prop() disabled = false;\n\n /**\n * Enable multiple selection.\n */\n @Prop() multiple = false;\n\n /**\n * The placeholder for the select.\n */\n @Prop() placeholder = '';\n\n /**\n * Whether the dropdown should appear above `(top)` or below `(bottom)` the\n * input. By default, if there is not enough space within the window the\n * dropdown will appear above the input, otherwise below it.\n */\n @Prop() position: 'auto' | 'top' | 'bottom' = 'auto';\n\n /**\n * Enable search for the select.\n */\n @Prop() search = false;\n\n /**\n * Optional hint text(s) to be displayed with the select.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the search is triggered.\n */\n @Event() catSearch!: EventEmitter;\n\n /**\n * Emitted when scrolled to the bottom.\n */\n @Event() catScrolledBottom!: EventEmitter;\n\n /**\n * Emitted when the select loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n @Watch('items')\n setChoicesHandler(items: CatSelectItem[]) {\n const isSelected = (item: CatSelectItem) => this.value?.includes(item.value);\n const choices = items.map(item => ({ ...item, selected: isSelected(item) }));\n this.choice?.setChoices(choices, 'value', 'label', true);\n\n const vItems = this.choice?.getValue() || [];\n const vItemsArray = (Array.isArray(vItems) ? vItems : [vItems]) as Item[];\n const value = this.value || [];\n const vItemValues = [...value];\n\n // remove duplicate items\n this.choice?.unhighlightAll();\n vItemsArray.forEach(vItem => {\n const index = vItemValues.indexOf(vItem.value);\n if (index > -1) {\n vItemValues.splice(index, 1);\n } else {\n vItem.choiceId = -1; // disconnect item from choice\n this.choice?.highlightItem(vItem, false);\n }\n });\n this.choice?.removeHighlightedItems(false);\n }\n\n @Watch('value')\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setValueHandler(value?: any) {\n if (this.resetItemsOnNextValueChange) {\n this.choice?.removeActiveItems(-1);\n }\n this.resetItemsOnNextValueChange = true;\n this.choice?.setChoiceByValue(value);\n this.multiple && this.updateRemoveItemButtonVisibility();\n }\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 select', this);\n }\n }\n\n componentDidLoad(): void {\n this.init();\n const attachedInternals: ElementInternals | undefined = this.hostElement.attachInternals?.();\n if (attachedInternals) {\n const root = attachedInternals.shadowRoot;\n this.choicesElement = root?.querySelector('.choices') || undefined;\n this.choiceInner = root?.querySelector('.choices__inner') || undefined;\n this.choiceDropdown = root?.querySelector('.choices__list--dropdown')?.firstElementChild || undefined;\n }\n this.choicesElement?.addEventListener('click', this.resetFocus.bind(this));\n this.choiceInner?.addEventListener('click', this.showDropdownHandler.bind(this));\n this.selectElement?.addEventListener('hideDropdown', this.showMultipleFocus.bind(this));\n this.selectElement?.addEventListener('showDropdown', this.showMultipleFocus.bind(this));\n this.selectElement?.addEventListener('removeItem', this.resetFocus.bind(this));\n this.selectElement?.addEventListener('change', this.onChange.bind(this));\n this.selectElement?.addEventListener('search', this.onSearch.bind(this));\n this.choiceDropdown?.addEventListener('scroll', this.onScrolledBottom.bind(this));\n if (this.multiple) {\n this.selectElement?.addEventListener('choice', this.onChoice.bind(this));\n this.createRemoveItemButton();\n }\n }\n\n disconnectedCallback(): void {\n this.choice?.destroy();\n this.choice = undefined;\n this.choicesElement?.removeEventListener('click', this.resetFocus.bind(this));\n this.choiceInner?.removeEventListener('click', this.showDropdownHandler.bind(this));\n this.selectElement?.removeEventListener('hideDropdown', this.showMultipleFocus.bind(this));\n this.selectElement?.removeEventListener('showDropdown', this.showMultipleFocus.bind(this));\n this.selectElement?.removeEventListener('removeItem', this.resetFocus.bind(this));\n this.selectElement?.removeEventListener('change', this.onChange.bind(this));\n this.selectElement?.removeEventListener('search', this.onSearch.bind(this));\n this.choiceDropdown?.removeEventListener('scroll', this.onScrolledBottom.bind(this));\n if (this.multiple) {\n this.removeElement?.removeEventListener('choice', this.onChoice.bind(this));\n }\n }\n\n @Listen('blur', { capture: true })\n onBlur(event: FocusEvent): void {\n this.catBlur.emit(event);\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <select\n id={this.id}\n ref={el => (this.selectElement = el)}\n multiple={this.multiple}\n disabled={this.disabled}\n ></select>\n {this.hintSection}\n </Host>\n );\n }\n\n private init() {\n const component = this; // eslint-disable-line @typescript-eslint/no-this-alias\n const removeItemText = (value: string) => this.i18n.t('select.removeItem', { value });\n const config = {\n allowHTML: true,\n removeItemButton: true,\n duplicateItemsAllowed: false,\n delimiter: '',\n paste: false,\n searchEnabled: this.search,\n searchChoices: false,\n position: this.position,\n resetScrollPosition: false,\n placeholder: !!this.placeholder,\n placeholderValue: this.placeholder || '',\n searchPlaceholderValue: this.i18n.t('select.searchPlaceholder'),\n renderSelectedChoices: 'always' as 'auto' | 'always',\n loadingText: this.i18n.t('select.loading'),\n noResultsText: this.i18n.t('select.noResults'),\n noChoicesText: this.i18n.t('select.noChoices'),\n itemSelectText: this.i18n.t('select.selectItem'),\n addItemText: (value: string) => this.i18n.t('select.addItem', { value }),\n maxItemText: (maxItemCount: number) => this.i18n.t('select.maxItem', { maxItemCount }),\n uniqueItemText: this.i18n.t('select.uniqueItem'),\n customAddItemText: this.i18n.t('select.customAddItem'),\n callbackOnInit: function () {\n const choice = this as unknown as Choices;\n choice.setChoices(component.items, 'value', 'label', true);\n choice.setChoiceByValue(component.value);\n }\n };\n\n const configSingle = {\n callbackOnCreateTemplates: (strToEl: (str: string) => HTMLElement) => {\n return {\n item: ({ classNames }: { classNames: ClassNames }, data: Item) => {\n const template = data.customProperties?.imageUrl\n ? `<img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem\" />`\n : '';\n return strToEl(\n `\n <div class=\"${classNames.item} ${\n data.highlighted ? classNames.highlightedState : classNames.itemSelectable\n } ${data.placeholder ? classNames.placeholder : ''}\" data-item data-id=\"${data.id}\" data-value=\"${\n data.value\n }\" ${data.active ? 'aria-selected=\"true\"' : ''} ${data.disabled ? 'aria-disabled=\"true\"' : ''}>\n <span>${template}</span> ${data.label}\n <button type=\"button\"\n class=\"${classNames.button}\"\n aria-label=\"${removeItemText(data.label)}\"\n data-button>${removeItemText(data.label)}</button>\n </div>\n `\n );\n }\n };\n }\n };\n\n const configMultiple = {\n callbackOnCreateTemplates: (strToEl: (str: string) => HTMLElement) => {\n const itemSelectText = config.itemSelectText;\n return {\n item: ({ classNames }: { classNames: ClassNames }, data: Item) => {\n const template = data.customProperties?.imageUrl\n ? `<img class=\"choices-option-icon\" src=\"${data.customProperties.imageUrl}\" style=\"margin-right: 0.5rem;\" />`\n : '';\n return strToEl(\n `<div class=\"\n ${classNames.item}\n ${data.highlighted ? classNames.highlightedState : classNames.itemSelectable}\n ${data.placeholder ? classNames.placeholder : ''}\"\n data-item data-id=\"${data.id}\" data-value=\"${data.value}\"\n ${data.active ? 'aria-selected=\"true\"' : ''}\n ${data.disabled ? 'aria-disabled=\"true\"' : ''}>\n ${template}\n ${data.label}\n <button type=\"button\"\n class=\"${classNames.button}\"\n aria-label=\"${removeItemText(data.label)}\"\n data-button>${removeItemText(data.label)}</button>\n </div>`\n );\n },\n choice: function ({ classNames }: { classNames: ClassNames }, data: Item) {\n const template = getOptionTemplate(data);\n const className = `${String(classNames.item)} ${String(classNames.itemChoice)}\n ${String(data.disabled ? classNames.itemDisabled : classNames.itemSelectable)}\n ${data.selected ? 'choices__item--selected' : ''}`;\n return strToEl(\n `<div class=\"${className}\"\n data-select-text=\"${itemSelectText}\"\n data-choice data-id=\"${String(data.id)}\" data-value=\"${String(data.value)}\"\n ${data.disabled ? 'data-choice-disabled aria-disabled=\"true\"' : 'data-choice-selectable'}\n ${data.groupId && data.groupId > 0 ? 'role=\"treeitem\"' : 'role=\"option\"'}>\n ${template}\n </div>`\n );\n }\n };\n }\n };\n\n const settings: Partial<Options> = this.multiple\n ? { ...config, ...configMultiple }\n : { ...config, ...configSingle };\n this.choice = new Choices(this.selectElement, settings);\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() {\n this.resetItemsOnNextValueChange = false;\n this.value = this.choice?.getValue(true);\n this.catChange.emit(this.value);\n }\n\n private showMultipleFocus() {\n if (this.multiple && this.isFocused() && !this.choicesElement?.classList.contains('is-focused')) {\n this.choicesElement?.classList.add('is-focused');\n }\n }\n\n private resetFocus() {\n if (!this.isFocused()) {\n if (!this.choicesElement?.hasAttribute('tabindex')) {\n this.choicesElement?.setAttribute('tabindex', '0');\n }\n this.choicesElement?.focus();\n }\n }\n\n private isFocused() {\n return document.activeElement === this.hostElement;\n }\n\n private onChoice(event: Event) {\n const customEvent = event as CustomEvent<{ choice: Choice }>;\n const choice = customEvent.detail.choice;\n if (choice.selected) {\n this.choice?.removeActiveItemsByValue(choice.value);\n this.onChange();\n }\n }\n\n private onSearch(event: Event) {\n const customEvent = event as CustomEvent<{ value: string }>;\n this.catSearch.emit(customEvent.detail.value);\n }\n\n private onScrolledBottom() {\n const scrolledBottom =\n this.choiceDropdown?.scrollHeight ===\n (this.choiceDropdown?.scrollTop || 0) + (this.choiceDropdown?.clientHeight || 0);\n if (scrolledBottom) {\n this.catScrolledBottom.emit();\n }\n }\n\n private showDropdownHandler() {\n !this.disabled && this.choice?.showDropdown();\n }\n\n private createRemoveItemButton() {\n this.removeElement = document.createElement('cat-button') as HTMLCatButtonElement;\n this.removeElement.icon = 'cross-circle-outlined';\n this.removeElement.iconOnly = true;\n this.removeElement.a11yLabel = this.i18n.t('select.removeItem');\n this.updateRemoveItemButtonVisibility();\n this.removeElement.addEventListener('click', this.onRemoveItemButtonClick.bind(this));\n this.choiceInner?.appendChild(this.removeElement);\n }\n\n private updateRemoveItemButtonVisibility() {\n const items = Array.from(this.choice?.getValue() as Item[]);\n if (items.length) {\n this.removeElement?.removeAttribute('hidden');\n } else {\n this.removeElement?.setAttribute('hidden', 'true');\n }\n }\n\n private onRemoveItemButtonClick(event: Event) {\n event.stopPropagation();\n this.choice?.removeActiveItems(-1);\n this.updateRemoveItemButtonVisibility();\n this.onChange();\n }\n}\n"]}