@gov-design-system-ce/components 0.0.67 → 0.0.70

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 (70) hide show
  1. package/dist/cjs/gov-app.cjs.entry.js +11 -3
  2. package/dist/cjs/gov-app.cjs.entry.js.map +1 -1
  3. package/dist/cjs/gov-form-multi-select.cjs.entry.js +36 -31
  4. package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
  5. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  6. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +44 -33
  7. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
  8. package/dist/collection/pages/Forms.js +11 -3
  9. package/dist/collection/pages/Forms.js.map +1 -1
  10. package/dist/components/gov-accordion-item.js +1 -1
  11. package/dist/components/gov-app.js +1 -1
  12. package/dist/components/gov-app.js.map +1 -1
  13. package/dist/components/gov-attachments-item.js +1 -1
  14. package/dist/components/gov-button.js +1 -1
  15. package/dist/components/gov-card.js +1 -1
  16. package/dist/components/gov-chip.js +1 -1
  17. package/dist/components/gov-form-autocomplete.js +1 -1
  18. package/dist/components/gov-form-checkbox.js +1 -1
  19. package/dist/components/gov-form-file.js +1 -1
  20. package/dist/components/gov-form-input.js +1 -1
  21. package/dist/components/gov-form-multi-select.js +1 -1
  22. package/dist/components/gov-form-multi-select.js.map +1 -1
  23. package/dist/components/gov-form-select.js +1 -1
  24. package/dist/components/gov-icon.js +1 -1
  25. package/dist/components/gov-infobar.js +1 -1
  26. package/dist/components/gov-loading.js +1 -1
  27. package/dist/components/gov-modal.js +1 -1
  28. package/dist/components/gov-pagination.js +1 -1
  29. package/dist/components/gov-prompt.js +1 -1
  30. package/dist/components/gov-side-nav-item.js +1 -1
  31. package/dist/components/gov-tabs.js +1 -1
  32. package/dist/components/gov-tag.js +1 -1
  33. package/dist/components/gov-tile.js +1 -1
  34. package/dist/components/gov-toast.js +1 -1
  35. package/dist/components/gov-tooltip-content.js +1 -1
  36. package/dist/components/gov-wizard-item.js +1 -1
  37. package/dist/components/{p-4fdfb242.js → p-4b5f8c6e.js} +2 -2
  38. package/dist/components/{p-a00cf51c.js → p-559d660f.js} +2 -2
  39. package/dist/components/{p-8cdad015.js → p-5d223502.js} +2 -2
  40. package/dist/components/{p-a0a3393f.js → p-8a8bb365.js} +2 -2
  41. package/dist/components/{p-464fc42a.js → p-a80377a8.js} +2 -2
  42. package/dist/components/{p-3e4eae42.js → p-b8fa0c35.js} +2 -2
  43. package/dist/components/{p-b07b6908.js → p-fb5194a6.js} +2 -2
  44. package/dist/core/core.esm.js +1 -1
  45. package/dist/core/{p-ea275d90.entry.js → p-24a60224.entry.js} +2 -2
  46. package/dist/core/p-24a60224.entry.js.map +1 -0
  47. package/dist/core/{p-fda41420.entry.js → p-3424977f.entry.js} +2 -2
  48. package/dist/core/{p-bf39d442.entry.js → p-fe3f57cc.entry.js} +2 -2
  49. package/dist/core/p-fe3f57cc.entry.js.map +1 -0
  50. package/dist/esm/gov-app.entry.js +11 -3
  51. package/dist/esm/gov-app.entry.js.map +1 -1
  52. package/dist/esm/gov-form-multi-select.entry.js +36 -31
  53. package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
  54. package/dist/esm/gov-icon.entry.js +1 -1
  55. package/dist/hydrate/index.js +47 -34
  56. package/dist/stencil.config.js +1 -0
  57. package/dist/stencil.config.js.map +1 -1
  58. package/dist/types/components/gov-form/multiselect/gov-form-multi-select.d.ts +3 -2
  59. package/dist/types/components.d.ts +2 -2
  60. package/package.json +2 -2
  61. package/dist/core/p-bf39d442.entry.js.map +0 -1
  62. package/dist/core/p-ea275d90.entry.js.map +0 -1
  63. /package/dist/components/{p-4fdfb242.js.map → p-4b5f8c6e.js.map} +0 -0
  64. /package/dist/components/{p-a00cf51c.js.map → p-559d660f.js.map} +0 -0
  65. /package/dist/components/{p-8cdad015.js.map → p-5d223502.js.map} +0 -0
  66. /package/dist/components/{p-a0a3393f.js.map → p-8a8bb365.js.map} +0 -0
  67. /package/dist/components/{p-464fc42a.js.map → p-a80377a8.js.map} +0 -0
  68. /package/dist/components/{p-3e4eae42.js.map → p-b8fa0c35.js.map} +0 -0
  69. /package/dist/components/{p-b07b6908.js.map → p-fb5194a6.js.map} +0 -0
  70. /package/dist/core/{p-fda41420.entry.js.map → p-3424977f.entry.js.map} +0 -0
@@ -113,65 +113,70 @@ const GovFormMultiSelect = class {
113
113
  getOptionElement(value) {
114
114
  return this.selectRef.querySelector('option[value="' + value.value + '"]');
115
115
  }
116
- selectOption(newOption) {
116
+ selectOption(newOption, notify = true) {
117
117
  const index = this.getOptionIndex(newOption);
118
118
  if (index === -1) {
119
119
  this.selectedOptions = [...this.selectedOptions, newOption];
120
- this.govChange.emit({
121
- component: form.FormMultiSelectClass.root,
122
- value: this.selectedOptions,
123
- });
124
- this.govSelect.emit({
125
- component: form.FormMultiSelectClass.root,
126
- value: this.selectedOptions,
127
- });
120
+ if (notify) {
121
+ this.govChange.emit({
122
+ component: form.FormMultiSelectClass.root,
123
+ value: this.selectedOptions,
124
+ });
125
+ this.govSelect.emit({
126
+ component: form.FormMultiSelectClass.root,
127
+ value: this.selectedOptions,
128
+ });
129
+ }
128
130
  const option = this.getOptionElement(newOption);
129
131
  if (option) {
130
132
  option.selected = true;
131
133
  }
132
134
  }
133
135
  }
134
- removeOption(removeOption) {
136
+ removeOption(removeOption, notify = true) {
135
137
  const index = this.getOptionIndex(removeOption);
136
138
  if (index !== -1) {
137
139
  this.selectedOptions.splice(index, 1);
138
140
  this.selectedOptions = [...this.selectedOptions];
139
- this.govChange.emit({
140
- component: form.FormMultiSelectClass.root,
141
- value: this.selectedOptions,
142
- });
143
- this.govRemove.emit({
144
- component: form.FormMultiSelectClass.root,
145
- value: this.selectedOptions,
146
- });
141
+ if (notify) {
142
+ this.govChange.emit({
143
+ component: form.FormMultiSelectClass.root,
144
+ value: this.selectedOptions,
145
+ });
146
+ this.govRemove.emit({
147
+ component: form.FormMultiSelectClass.root,
148
+ value: this.selectedOptions,
149
+ });
150
+ }
147
151
  const option = this.getOptionElement(removeOption);
148
152
  if (option) {
149
153
  option.selected = false;
150
154
  }
151
155
  }
152
156
  }
153
- async componentDidRender() {
157
+ async componentDidLoad() {
154
158
  this.initAutocomplete();
155
- await utils.delay(0);
159
+ if (win.canValidateWcagOnRender()) {
160
+ await utils.delay(500);
161
+ await this.validateWcag();
162
+ }
163
+ }
164
+ async componentDidRender() {
156
165
  this.selectRef.querySelectorAll('option').forEach((option) => {
157
166
  if (option.selected) {
158
167
  this.selectOption({
159
168
  name: option.textContent,
160
169
  value: option.value,
161
- });
170
+ }, false);
162
171
  }
163
172
  });
164
- if (win.canValidateWcagOnRender()) {
165
- await utils.delay(500);
166
- await this.validateWcag();
167
- }
168
173
  }
169
174
  render() {
170
175
  return (index.h(index.Host, { class: form.FormMultiSelectClass.root, size: this.size, variant: this.variant }, index.h("div", { class: form.FormMultiSelectClass.wrap }, index.h("div", { class: "element" }, index.h("gov-form-autocomplete", { value: this.value, disabled: this.disabled, identifier: this.identifier || this.selectId, required: false, size: this.size, variant: this.variant, placeholder: this.placeholder, "message-empty": this.messageEmpty, "message-loading": this.messageLoading, ref: el => (this.autocompleteRef = el), minlength: 0, wcagDescribedBy: this.wcagDescribedBy, wcagLabelledBy: this.wcagLabelledBy, wcagOwns: this.listId }), index.h("gov-icon", { slot: "right-icon", class: "icon-arrow", name: "chevron-down" }), this.h.hasSlot('right-icon') && !(this.success || this.invalid) && index.h("slot", { name: "right-icon" }), this.success && index.h("gov-icon", { slot: "right-icon", class: "icon-validation", name: "check-lg" }), this.invalid && index.h("gov-icon", { slot: "right-icon", class: "icon-validation", name: "exclamation-lg" }), index.h("select", { hidden: true, "aria-hidden": template.toBoolAttr(true), multiple: true, required: this.required, name: this.name, disabled: this.disabled, ref: el => (this.selectRef = el), "aria-disabled": template.toBoolAttrIfDefined(this.disabled), "aria-required": template.toBoolAttrIfDefined(this.required), "aria-invalid": template.toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-owns": this.wcagOwns }, index.h("slot", null), this.options.map((option) => {
171
176
  return (index.h("option", { value: option.value, selected: option.value === this.value, disabled: option === null || option === void 0 ? void 0 : option.disabled }, option.name));
172
- })))), index.h("ul", { role: "listbox", id: this.listId, class: form.FormMultiSelectClass.list }, this.selectedOptions.map(option => {
177
+ })))), this.hideSelectedList === false ? (index.h("ul", { role: "listbox", id: this.listId, class: form.FormMultiSelectClass.list }, this.selectedOptions.map(option => {
173
178
  return (index.h("li", { class: form.FormMultiSelectClass.item, role: "option" }, option.name, index.h("gov-button", { wcagLabel: 'Odebrat vybranou položku ' + option.name, variant: "primary", type: "base", size: "s", "on-gov-click": () => this.onTagRemove(option) }, index.h("gov-icon", { name: "x-lg" }))));
174
- }))));
179
+ }))) : null));
175
180
  }
176
181
  onFocusHandler(e) {
177
182
  e.stopPropagation();
@@ -250,17 +255,17 @@ const GovFormMultiSelect = class {
250
255
  /**
251
256
  * To remove an option from the selected list
252
257
  */
253
- async removeSelectedOption(option) {
258
+ async removeSelectedOption(option, notify = false) {
254
259
  if (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {
255
- this.removeOption(option);
260
+ this.removeOption(option, notify);
256
261
  }
257
262
  }
258
263
  /**
259
264
  * Returns an instance of the native html select element
260
265
  */
261
- async setSelectedOption(option) {
266
+ async setSelectedOption(option, notify = false) {
262
267
  if (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {
263
- this.selectOption(option);
268
+ this.selectOption(option, notify);
264
269
  }
265
270
  }
266
271
  /**
@@ -1 +1 @@
1
- {"file":"gov-form-multi-select.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;AA+EO,MAAM,cAAc,GAAG,CAC7B,GAAM,EACN,IAAO;EAEP,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,G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,IAAI,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;MACpG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;KACzB;GACD;;;;EAMD,MAAM,iBAAiB,CAAC,MAA8B;IACrD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;MACpG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;KACzB;GACD;;;;EAMD,MAAM,YAAY;IACjBS,oBAAe,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAET,yBAAoB,CAAC,IAAI,CAAC,CAAA;IACrFS,oBAAe,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAET,yBAAoB,CAAC,IAAI,CAAC,CAAA;IACnFS,oBAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAET,yBAAoB,CAAC,IAAI,CAAC,CAAA;IACtEU,yBAAoB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAEV,yBAAoB,CAAC,IAAI,CAAC,CAAA;GACtG;;;;;;;;;;;;;;","names":["createID","govHost","govForm","validateProp","FormMultiselectVariants","FormMultiSelectClass","FormMultiselectSizes","toBoolAttr","removeDiacritics","delay","canValidateWcagOnRender","h","Host","toBoolAttrIfDefined","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/utils/helpers.types.ts","../../../packages/core/src/components/gov-form/multiselect/gov-form-multi-select.scss?tag=gov-form-multi-select","../../../packages/core/src/components/gov-form/multiselect/gov-form-multi-select.tsx"],"sourcesContent":["\nexport type Optional<T> = T | undefined;\nexport type Nullable<T> = T | null;\nexport type OptionalProperty<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\nexport type ValueOf<T> = T[keyof T];\n\nexport type DeepPartial<T> = {\n\t[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n\nexport type ObjectOrArrayType<T> = T | T[];\nexport const ObjectOrArray = {\n\tfirst: <T>(item: ObjectOrArrayType<T>): T => (Array.isArray(item) ? item[0] : item),\n\tarray: <T>(item: ObjectOrArrayType<T>): T[] => (Array.isArray(item) ? item : [item]),\n};\n\nexport const Omit = <T extends object, P extends keyof T, R extends Omit<T, P>>(properties: P[], object: T): R =>\n\tObject.entries(object).reduce(\n\t\t(all, [key, value]) => (properties.includes(key as P) ? all : { ...all, [key]: value }),\n\t\t{} as R\n\t);\n\nexport const whenDefined =\n\t<I, O>(fn: (input: I) => O) =>\n\t(value?: I): O | undefined =>\n\t\tvalue ? fn(value) : undefined;\n\n/**\n * Comparator function which defines the sort order\n * @example\n * ```\n * // sorts objects by `id` property\n * [{ id: 3 }, { id: 2 }, { id: 1 }].sort(compare(['id']))\n *\n * // sorts objects by `id` and `name` properties\n * [{ id: 3, name: 'b' }, { id: 2, name: 'a' }, { id: 1, name: 'b' }].sort(compare(['id', 'name']))\n * ```\n *\n * @param {Array<keyof T>} properties\n * @return {number}\n */\nexport const compare =\n\t<T extends object>(properties: Array<keyof T>) =>\n\t(a: T, b: T): number => {\n\t\tconst [property, ...rest] = properties;\n\t\tif (!property) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (a[property] < b[property]) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (a[property] > b[property]) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn rest.length > 0 ? compare(rest)(a, b) : 0;\n\t};\n\nexport const is = <T>(value: T | undefined | null): value is T => value !== undefined && value !== null;\n\nexport const has =\n\t<T extends object, P extends keyof T>(property: P) =>\n\t(object: OptionalProperty<T, P>): object is T => {\n\t\treturn !!object[property];\n\t};\n\nexport const equals =\n\t<A>(a?: A) =>\n\t(b?: A): boolean =>\n\t\ta === b;\nexport const prop =\n\t<T, P extends keyof T>(property: P) =>\n\t(object: T): T[P] =>\n\t\tobject[property];\n\nexport const propOptional =\n\t<T, P extends keyof T>(property: P) =>\n\t(object?: T): Optional<T[P]> =>\n\t\tobject ? object[property] : undefined;\n\nexport const hasOwnProperty = <X extends object, Y extends PropertyKey>(\n\tobj: X,\n\tprop: Y\n): obj is X & Record<Y, ValueOf<X>> => {\n\treturn Object.prototype.hasOwnProperty.call(obj, prop);\n};\n\nexport const isObject = <T extends object>(obj: unknown): obj is T => typeof obj === 'object';\nexport const isString = (input: unknown): input is string => is(input) && typeof input === 'string';\nexport const isNumber = (input: unknown): input is string => is(input) && typeof input === 'number';\n\ntype Entries<T> = {\n\t[K in keyof T]: [K, T[K]];\n}[keyof T][];\nexport const getEntries = <T extends object>(obj: T) => Object.entries(obj) as Entries<T>;\n\nexport const getKeys = <T extends object>(obj: T) => Object.keys(obj) as Array<keyof T>;\nexport const getValues = <T extends object>(obj: T) => Object.values(obj) as Array<ValueOf<T>>;\n\nexport const first = <T>(array: T[]): Optional<T> => array[0];\n\nexport const pairs = <T>(arr: T[]): Array<[string, string]> =>\n\tarr.flatMap((item1, index1) => arr.flatMap((item2, index2) => (index1 > index2 ? [[item1, item2]] : []))) as any;\n\nexport const find =\n\t<T, S extends T>(predicate: (item: T) => item is S) =>\n\t(array?: T[]): Optional<S> =>\n\t\t(array || []).find(predicate);\nexport const filter =\n\t<T, S extends T>(predicate: (item: T) => item is S) =>\n\t(array?: T[]): S[] =>\n\t\t(array || []).filter(predicate);\n","/*\n * Multiselect\n */\n\n@import \"../select/gov-form-select-core.scss\";\n$class: \".gov-form-multi-select\";\n\n#{$class} {\n\t@extend %form-select-core;\n\tflex-wrap: wrap;\n\t&__wrap {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\twidth: 100%;\n\t}\n\t&__list {\n\t\t@extend %reset-ul;\n\t\t@include typography($font-size-xs);\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\tflex-wrap: wrap;\n\t}\n\t&__list > &__item {\n\t\t@extend %reset-ul-li;\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\tflex: 0 0 auto;\n\t\talign-items: center;\n\t\tpadding: rem-calc(0 0 0 8);\n\t\tbackground: $form-multiselect-bg;\n\t\ttransition: $t linear background-color;\n\t}\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govForm} from '../../../helpers/Dom/form'\nimport {GovForm} from '../../../helpers/Dom/form.types'\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from '../../../helpers/Dom/template'\nimport {GovHost} from '../../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../../helpers/Dom/win'\nimport {validateProp} from '../../../helpers/Validate/props'\nimport {validateWcagLabelFor, validateWcagRef} from '../../../helpers/Validate/wcag'\nimport {Nullable} from '../../../types/interfaces'\nimport {createID, removeDiacritics} from '../../../utils/string.utils'\nimport {delay} from '../../../utils/utils'\nimport {FormAutocompleteEvent} from '../autocomplete/gov-form-autocomplete.types'\nimport {\n\tFormMultiSelectClass,\n\tFormMultiselectSizes,\n\tFormMultiselectSizesType,\n\tFormMultiselectVariants,\n\tFormMultiselectVariantType\n} from './constants'\nimport {FormMultiselectEvent, GovFormMultiSelectItem} from './gov-form-multi-select.types'\nimport {hasOwnProperty} from \"../../../utils/helpers.types\";\n\n@Component({\n\ttag: 'gov-form-multi-select',\n\tstyleUrl: 'gov-form-multi-select.scss',\n})\nexport class GovFormMultiSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate selectRef?: HTMLSelectElement\n\tprivate autocompleteRef?: HTMLGovFormAutocompleteElement\n\n\tprivate readonly selectId: string\n\tprivate readonly listId: string\n\n\tconstructor() {\n\t\tthis.selectId = createID('GovSelect')\n\t\tthis.listId = createID('GovMultiList')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'identifier'}) readonly identifier: string\n\t/**\n\t * Custom select placeholder.\n\t */\n\t@Prop({attribute: 'placeholder'}) readonly placeholder: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormMultiselectVariantType\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormMultiselectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Option to hide the list of selected items\n\t */\n\t@Prop({attribute: 'hide-selected-list'}) readonly hideSelectedList: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Custom message for when there is a blank sheet\n\t */\n\t@Prop({attribute: 'message-empty'}) readonly messageEmpty: string = 'Nebyly nalezeny žádné výsledky'\n\t/**\n\t * Custom message for when data is loaded\n\t */\n\t@Prop({attribute: 'message-loading'}) readonly messageLoading: string = 'Načítám...'\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-owns'}) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({eventName: 'gov-focus'}) govFocus: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({eventName: 'gov-blur'}) govBlur: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is selected\n\t */\n\t@Event({eventName: 'gov-select'}) govSelect: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is removed\n\t */\n\t@Event({eventName: 'gov-remove'}) govRemove: EventEmitter<FormMultiselectEvent>\n\n\t@State() focused: boolean\n\t@State() value: string\n\t@State() selectedOptions: GovFormMultiSelectItem[] = []\n\t@State() options: GovFormMultiSelectItem[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormMultiselectVariants, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormMultiselectSizes, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('disabled')\n\t@Watch('invalid')\n\t@Watch('success')\n\t@Watch('size')\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl('size', this.size)\n\t\tthis.f.passAttrToControl('disabled', toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl('invalid', toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl('success', toBoolAttr(this.success))\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.watchDisabled()\n\t}\n\n\tprivate getAvailableOptions(): GovFormMultiSelectItem[] {\n\t\tif (Array.isArray(this.options) && this.options.length) {\n\t\t\treturn this.options.filter((option) => {\n\t\t\t\tconst isSelected = this.selectedOptions.findIndex((selected) => selected.value === option.value)\n\t\t\t\treturn (isSelected !== -1 || option?.disabled) ? false : true\n\t\t\t})\n\t\t}\n\t\treturn Array.from(this.selectRef.querySelectorAll('option'))\n\t\t\t.filter((option: HTMLOptionElement) => !(option.disabled || option.selected))\n\t\t\t.map((option: HTMLOptionElement) => ({name: option.textContent, value: option.value}))\n\t}\n\n\tprivate initAutocomplete() {\n\t\tthis.autocompleteRef.addEventListener('gov-select', this.onSelectHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-input', this.onInputHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-focus', this.onFocusHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-blur', this.onBlurHandler.bind(this))\n\t\tthis.autocompleteRef\n\t\t\t.setSearchCallback(value => {\n\t\t\t\treturn new Promise(resolve => {\n\t\t\t\t\tconst data = this.getAvailableOptions()\n\t\t\t\t\tif (String(value).length === 0) {\n\t\t\t\t\t\treturn resolve(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(\n\t\t\t\t\t\tdata.filter(({name}) => {\n\t\t\t\t\t\t\tif (!name) return false\n\t\t\t\t\t\t\treturn removeDiacritics(name).toLowerCase().indexOf(removeDiacritics(value).toLowerCase()) > -1\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t})\n\t\t\t.then()\n\t}\n\n\tprivate getOptionIndex(value: GovFormMultiSelectItem): number {\n\t\treturn this.selectedOptions.findIndex(option => option.value === value.value && option.name === value.name)\n\t}\n\n\tprivate getOptionElement(value: GovFormMultiSelectItem): Nullable<HTMLOptionElement> {\n\t\treturn this.selectRef.querySelector('option[value=\"' + value.value + '\"]') as HTMLOptionElement\n\t}\n\n\tprivate selectOption(newOption: GovFormMultiSelectItem) {\n\t\tconst index = this.getOptionIndex(newOption)\n\t\tif (index === -1) {\n\t\t\tthis.selectedOptions = [...this.selectedOptions, newOption]\n\t\t\tthis.govChange.emit({\n\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\tvalue: this.selectedOptions,\n\t\t\t})\n\t\t\tthis.govSelect.emit({\n\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\tvalue: this.selectedOptions,\n\t\t\t})\n\t\t\tconst option = this.getOptionElement(newOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = true\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate removeOption(removeOption: GovFormMultiSelectItem) {\n\t\tconst index = this.getOptionIndex(removeOption)\n\t\tif (index !== -1) {\n\t\t\tthis.selectedOptions.splice(index, 1)\n\t\t\tthis.selectedOptions = [...this.selectedOptions]\n\t\t\tthis.govChange.emit({\n\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\tvalue: this.selectedOptions,\n\t\t\t})\n\t\t\tthis.govRemove.emit({\n\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\tvalue: this.selectedOptions,\n\t\t\t})\n\t\t\tconst option = this.getOptionElement(removeOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = false\n\t\t\t}\n\t\t}\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.initAutocomplete()\n\t\tawait delay(0)\n\t\tthis.selectRef.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.selected) {\n\t\t\t\tthis.selectOption({\n\t\t\t\t\tname: option.textContent,\n\t\t\t\t\tvalue: option.value,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormMultiSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t<div class={FormMultiSelectClass.wrap}>\n\t\t\t\t\t<div class=\"element\">\n\t\t\t\t\t\t<gov-form-autocomplete\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tidentifier={this.identifier || this.selectId}\n\t\t\t\t\t\t\trequired={false}\n\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\t\tmessage-empty={this.messageEmpty}\n\t\t\t\t\t\t\tmessage-loading={this.messageLoading}\n\t\t\t\t\t\t\tref={el => (this.autocompleteRef = el as HTMLGovFormAutocompleteElement)}\n\t\t\t\t\t\t\tminlength={0}\n\t\t\t\t\t\t\twcagDescribedBy={this.wcagDescribedBy}\n\t\t\t\t\t\t\twcagLabelledBy={this.wcagLabelledBy}\n\t\t\t\t\t\t\twcagOwns={this.listId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<gov-icon slot=\"right-icon\" class=\"icon-arrow\" name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\"/>}\n\t\t\t\t\t\t{this.success && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t\t{this.invalid && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t\t<select\n\t\t\t\t\t\t\thidden\n\t\t\t\t\t\t\taria-hidden={toBoolAttr(true)}\n\t\t\t\t\t\t\tmultiple\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t{this.options.map((option) => {\n\t\t\t\t\t\t\t\treturn (<option value={option.value} selected={option.value === this.value}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={option?.disabled}>{option.name}</option>)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<ul role=\"listbox\" id={this.listId} class={FormMultiSelectClass.list}>\n\t\t\t\t\t{this.selectedOptions.map(option => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<li class={FormMultiSelectClass.item} role=\"option\">\n\t\t\t\t\t\t\t\t{option.name}\n\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\twcagLabel={'Odebrat vybranou položku ' + option.name}\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onTagRemove(option)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</ul>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptions,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.stopPropagation()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptions,\n\t\t})\n\t}\n\n\tprivate onInputHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\tthis.value = e.detail.value\n\t\te.stopPropagation()\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\te.stopPropagation()\n\t\tconst value = e.detail.selected\n\t\tthis.selectOption(value as GovFormMultiSelectItem)\n\t\tthis.value = ''\n\t\tthis.autocompleteRef.clearValue()\n\t\tthis.autocompleteRef.focus()\n\t}\n\n\tprivate onTagRemove(removeOption: GovFormMultiSelectItem) {\n\t\tthis.removeOption(removeOption)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Returns a list of selected items\n\t */\n\t@Method()\n\tasync getSelectedOptions(): Promise<GovFormMultiSelectItem[]> {\n\t\treturn this.selectedOptions\n\t}\n\n\t/**\n\t * Setting a list of options to choose from\n\t */\n\t@Method()\n\tasync setOptions(options: GovFormMultiSelectItem[]): Promise<void> {\n\t\tif (Array.isArray(options)) {\n\t\t\tthis.options = options\n\t\t}\n\t}\n\n\t/**\n\t * Setting the list of selected options\n\t */\n\t@Method()\n\tasync setSelectedOptions(options: GovFormMultiSelectItem[]): Promise<void> {\n\t\tif (Array.isArray(options)) {\n\t\t\tthis.selectedOptions = options\n\t\t}\n\t}\n\n\t/**\n\t * To remove an option from the selected list\n\t */\n\t@Method()\n\tasync removeSelectedOption(option: GovFormMultiSelectItem): Promise<void> {\n\t\tif (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {\n\t\t\tthis.removeOption(option)\n\t\t}\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync setSelectedOption(option: GovFormMultiSelectItem): Promise<void> {\n\t\tif (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {\n\t\t\tthis.selectOption(option)\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormMultiSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormMultiSelectClass.root)\n\t}\n}\n"],"version":3}
1
+ {"file":"gov-form-multi-select.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;AA+EO,MAAM,cAAc,GAAG,CAC7B,GAAM,EACN,IAAO;EAEP,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACxD,CAAC;;ACpFD,MAAM,qBAAqB,GAAG,0iqBAA0iqB;;MC0B3jqB,kBAAkB;EAU9B;;;;;;;;;;gBAwBmD,GAAG;;4BAQwB,KAAK;oBAK9C,KAAK;oBAKL,KAAK;;;wBAY0B,gCAAgC;0BAI5B,YAAY;;;;;;2BAoC/B,EAAE;mBACV,EAAE;IA9F9C,IAAI,CAAC,QAAQ,GAAGA,qBAAQ,CAAC,WAAW,CAAC,CAAA;IACrC,IAAI,CAAC,MAAM,GAAGA,qBAAQ,CAAC,cAAc,CAAC,CAAA;IAEtC,IAAI,CAAC,CAAC,GAAGC,gBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,CAAC,GAAGC,YAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;GACxB;EA4FD,eAAe,CAAC,QAAgB;IAC/BC,kBAAY,CAACC,4BAAuB,EAAE,Q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,CAAC,eAAe,EAAE,mBAAmB,EAAET,yBAAoB,CAAC,IAAI,CAAC,CAAA;IACrFS,oBAAe,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAET,yBAAoB,CAAC,IAAI,CAAC,CAAA;IACnFS,oBAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAET,yBAAoB,CAAC,IAAI,CAAC,CAAA;IACtEU,yBAAoB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAEV,yBAAoB,CAAC,IAAI,CAAC,CAAA;GACtG;;;;;;;;;;;;;;","names":["createID","govHost","govForm","validateProp","FormMultiselectVariants","FormMultiSelectClass","FormMultiselectSizes","toBoolAttr","removeDiacritics","canValidateWcagOnRender","delay","h","Host","toBoolAttrIfDefined","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/utils/helpers.types.ts","../../../packages/core/src/components/gov-form/multiselect/gov-form-multi-select.scss?tag=gov-form-multi-select","../../../packages/core/src/components/gov-form/multiselect/gov-form-multi-select.tsx"],"sourcesContent":["\nexport type Optional<T> = T | undefined;\nexport type Nullable<T> = T | null;\nexport type OptionalProperty<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\nexport type ValueOf<T> = T[keyof T];\n\nexport type DeepPartial<T> = {\n\t[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n\nexport type ObjectOrArrayType<T> = T | T[];\nexport const ObjectOrArray = {\n\tfirst: <T>(item: ObjectOrArrayType<T>): T => (Array.isArray(item) ? item[0] : item),\n\tarray: <T>(item: ObjectOrArrayType<T>): T[] => (Array.isArray(item) ? item : [item]),\n};\n\nexport const Omit = <T extends object, P extends keyof T, R extends Omit<T, P>>(properties: P[], object: T): R =>\n\tObject.entries(object).reduce(\n\t\t(all, [key, value]) => (properties.includes(key as P) ? all : { ...all, [key]: value }),\n\t\t{} as R\n\t);\n\nexport const whenDefined =\n\t<I, O>(fn: (input: I) => O) =>\n\t(value?: I): O | undefined =>\n\t\tvalue ? fn(value) : undefined;\n\n/**\n * Comparator function which defines the sort order\n * @example\n * ```\n * // sorts objects by `id` property\n * [{ id: 3 }, { id: 2 }, { id: 1 }].sort(compare(['id']))\n *\n * // sorts objects by `id` and `name` properties\n * [{ id: 3, name: 'b' }, { id: 2, name: 'a' }, { id: 1, name: 'b' }].sort(compare(['id', 'name']))\n * ```\n *\n * @param {Array<keyof T>} properties\n * @return {number}\n */\nexport const compare =\n\t<T extends object>(properties: Array<keyof T>) =>\n\t(a: T, b: T): number => {\n\t\tconst [property, ...rest] = properties;\n\t\tif (!property) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (a[property] < b[property]) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (a[property] > b[property]) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn rest.length > 0 ? compare(rest)(a, b) : 0;\n\t};\n\nexport const is = <T>(value: T | undefined | null): value is T => value !== undefined && value !== null;\n\nexport const has =\n\t<T extends object, P extends keyof T>(property: P) =>\n\t(object: OptionalProperty<T, P>): object is T => {\n\t\treturn !!object[property];\n\t};\n\nexport const equals =\n\t<A>(a?: A) =>\n\t(b?: A): boolean =>\n\t\ta === b;\nexport const prop =\n\t<T, P extends keyof T>(property: P) =>\n\t(object: T): T[P] =>\n\t\tobject[property];\n\nexport const propOptional =\n\t<T, P extends keyof T>(property: P) =>\n\t(object?: T): Optional<T[P]> =>\n\t\tobject ? object[property] : undefined;\n\nexport const hasOwnProperty = <X extends object, Y extends PropertyKey>(\n\tobj: X,\n\tprop: Y\n): obj is X & Record<Y, ValueOf<X>> => {\n\treturn Object.prototype.hasOwnProperty.call(obj, prop);\n};\n\nexport const isObject = <T extends object>(obj: unknown): obj is T => typeof obj === 'object';\nexport const isString = (input: unknown): input is string => is(input) && typeof input === 'string';\nexport const isNumber = (input: unknown): input is string => is(input) && typeof input === 'number';\n\ntype Entries<T> = {\n\t[K in keyof T]: [K, T[K]];\n}[keyof T][];\nexport const getEntries = <T extends object>(obj: T) => Object.entries(obj) as Entries<T>;\n\nexport const getKeys = <T extends object>(obj: T) => Object.keys(obj) as Array<keyof T>;\nexport const getValues = <T extends object>(obj: T) => Object.values(obj) as Array<ValueOf<T>>;\n\nexport const first = <T>(array: T[]): Optional<T> => array[0];\n\nexport const pairs = <T>(arr: T[]): Array<[string, string]> =>\n\tarr.flatMap((item1, index1) => arr.flatMap((item2, index2) => (index1 > index2 ? [[item1, item2]] : []))) as any;\n\nexport const find =\n\t<T, S extends T>(predicate: (item: T) => item is S) =>\n\t(array?: T[]): Optional<S> =>\n\t\t(array || []).find(predicate);\nexport const filter =\n\t<T, S extends T>(predicate: (item: T) => item is S) =>\n\t(array?: T[]): S[] =>\n\t\t(array || []).filter(predicate);\n","/*\n * Multiselect\n */\n\n@import \"../select/gov-form-select-core.scss\";\n$class: \".gov-form-multi-select\";\n\n#{$class} {\n\t@extend %form-select-core;\n\tflex-wrap: wrap;\n\t&__wrap {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\twidth: 100%;\n\t}\n\t&__list {\n\t\t@extend %reset-ul;\n\t\t@include typography($font-size-xs);\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\tflex-wrap: wrap;\n\t}\n\t&__list > &__item {\n\t\t@extend %reset-ul-li;\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\tflex: 0 0 auto;\n\t\talign-items: center;\n\t\tpadding: rem-calc(0 0 0 8);\n\t\tbackground: $form-multiselect-bg;\n\t\ttransition: $t linear background-color;\n\t}\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govForm} from '../../../helpers/Dom/form'\nimport {GovForm} from '../../../helpers/Dom/form.types'\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from '../../../helpers/Dom/template'\nimport {GovHost} from '../../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../../helpers/Dom/win'\nimport {validateProp} from '../../../helpers/Validate/props'\nimport {validateWcagLabelFor, validateWcagRef} from '../../../helpers/Validate/wcag'\nimport {Nullable} from '../../../types/interfaces'\nimport {createID, removeDiacritics} from '../../../utils/string.utils'\nimport {delay} from '../../../utils/utils'\nimport {FormAutocompleteEvent} from '../autocomplete/gov-form-autocomplete.types'\nimport {\n\tFormMultiSelectClass,\n\tFormMultiselectSizes,\n\tFormMultiselectSizesType,\n\tFormMultiselectVariants,\n\tFormMultiselectVariantType\n} from './constants'\nimport {FormMultiselectEvent, GovFormMultiSelectItem} from './gov-form-multi-select.types'\nimport {hasOwnProperty} from \"../../../utils/helpers.types\";\n\n@Component({\n\ttag: 'gov-form-multi-select',\n\tstyleUrl: 'gov-form-multi-select.scss',\n})\nexport class GovFormMultiSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate selectRef?: HTMLSelectElement\n\tprivate autocompleteRef?: HTMLGovFormAutocompleteElement\n\n\tprivate readonly selectId: string\n\tprivate readonly listId: string\n\n\tconstructor() {\n\t\tthis.selectId = createID('GovSelect')\n\t\tthis.listId = createID('GovMultiList')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'identifier'}) readonly identifier: string\n\t/**\n\t * Custom select placeholder.\n\t */\n\t@Prop({attribute: 'placeholder'}) readonly placeholder: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormMultiselectVariantType\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormMultiselectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Option to hide the list of selected items\n\t */\n\t@Prop({attribute: 'hide-selected-list'}) readonly hideSelectedList: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Custom message for when there is a blank sheet\n\t */\n\t@Prop({attribute: 'message-empty'}) readonly messageEmpty: string = 'Nebyly nalezeny žádné výsledky'\n\t/**\n\t * Custom message for when data is loaded\n\t */\n\t@Prop({attribute: 'message-loading'}) readonly messageLoading: string = 'Načítám...'\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-owns'}) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({eventName: 'gov-focus'}) govFocus: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({eventName: 'gov-blur'}) govBlur: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is selected\n\t */\n\t@Event({eventName: 'gov-select'}) govSelect: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is removed\n\t */\n\t@Event({eventName: 'gov-remove'}) govRemove: EventEmitter<FormMultiselectEvent>\n\n\t@State() focused: boolean\n\t@State() value: string\n\t@State() selectedOptions: GovFormMultiSelectItem[] = []\n\t@State() options: GovFormMultiSelectItem[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormMultiselectVariants, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormMultiselectSizes, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('disabled')\n\t@Watch('invalid')\n\t@Watch('success')\n\t@Watch('size')\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl('size', this.size)\n\t\tthis.f.passAttrToControl('disabled', toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl('invalid', toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl('success', toBoolAttr(this.success))\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.watchDisabled()\n\t}\n\n\tprivate getAvailableOptions(): GovFormMultiSelectItem[] {\n\t\tif (Array.isArray(this.options) && this.options.length) {\n\t\t\treturn this.options.filter((option) => {\n\t\t\t\tconst isSelected = this.selectedOptions.findIndex((selected) => selected.value === option.value)\n\t\t\t\treturn (isSelected !== -1 || option?.disabled) ? false : true\n\t\t\t})\n\t\t}\n\t\treturn Array.from(this.selectRef.querySelectorAll('option'))\n\t\t\t.filter((option: HTMLOptionElement) => !(option.disabled || option.selected))\n\t\t\t.map((option: HTMLOptionElement) => ({name: option.textContent, value: option.value}))\n\t}\n\n\tprivate initAutocomplete() {\n\t\tthis.autocompleteRef.addEventListener('gov-select', this.onSelectHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-input', this.onInputHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-focus', this.onFocusHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-blur', this.onBlurHandler.bind(this))\n\t\tthis.autocompleteRef\n\t\t\t.setSearchCallback(value => {\n\t\t\t\treturn new Promise(resolve => {\n\t\t\t\t\tconst data = this.getAvailableOptions()\n\t\t\t\t\tif (String(value).length === 0) {\n\t\t\t\t\t\treturn resolve(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(\n\t\t\t\t\t\tdata.filter(({name}) => {\n\t\t\t\t\t\t\tif (!name) return false\n\t\t\t\t\t\t\treturn removeDiacritics(name).toLowerCase().indexOf(removeDiacritics(value).toLowerCase()) > -1\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t})\n\t\t\t.then()\n\t}\n\n\tprivate getOptionIndex(value: GovFormMultiSelectItem): number {\n\t\treturn this.selectedOptions.findIndex(option => option.value === value.value && option.name === value.name)\n\t}\n\n\tprivate getOptionElement(value: GovFormMultiSelectItem): Nullable<HTMLOptionElement> {\n\t\treturn this.selectRef.querySelector('option[value=\"' + value.value + '\"]') as HTMLOptionElement\n\t}\n\n\tprivate selectOption(newOption: GovFormMultiSelectItem, notify = true) {\n\t\tconst index = this.getOptionIndex(newOption)\n\t\tif (index === -1) {\n\t\t\tthis.selectedOptions = [...this.selectedOptions, newOption]\n\t\t\tif (notify) {\n\t\t\t\tthis.govChange.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptions,\n\t\t\t\t})\n\t\t\t\tthis.govSelect.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptions,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst option = this.getOptionElement(newOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = true\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate removeOption(removeOption: GovFormMultiSelectItem, notify = true) {\n\t\tconst index = this.getOptionIndex(removeOption)\n\t\tif (index !== -1) {\n\t\t\tthis.selectedOptions.splice(index, 1)\n\t\t\tthis.selectedOptions = [...this.selectedOptions]\n\t\t\tif(notify) {\n\t\t\t\tthis.govChange.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptions,\n\t\t\t\t})\n\t\t\t\tthis.govRemove.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptions,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst option = this.getOptionElement(removeOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = false\n\t\t\t}\n\t\t}\n\t}\n\n\tasync componentDidLoad() {\n\t\tthis.initAutocomplete()\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.selectRef.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.selected) {\n\t\t\t\tthis.selectOption({\n\t\t\t\t\tname: option.textContent,\n\t\t\t\t\tvalue: option.value,\n\t\t\t\t}, false)\n\t\t\t}\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormMultiSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t<div class={FormMultiSelectClass.wrap}>\n\t\t\t\t\t<div class=\"element\">\n\t\t\t\t\t\t<gov-form-autocomplete\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tidentifier={this.identifier || this.selectId}\n\t\t\t\t\t\t\trequired={false}\n\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\t\tmessage-empty={this.messageEmpty}\n\t\t\t\t\t\t\tmessage-loading={this.messageLoading}\n\t\t\t\t\t\t\tref={el => (this.autocompleteRef = el as HTMLGovFormAutocompleteElement)}\n\t\t\t\t\t\t\tminlength={0}\n\t\t\t\t\t\t\twcagDescribedBy={this.wcagDescribedBy}\n\t\t\t\t\t\t\twcagLabelledBy={this.wcagLabelledBy}\n\t\t\t\t\t\t\twcagOwns={this.listId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<gov-icon slot=\"right-icon\" class=\"icon-arrow\" name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\"/>}\n\t\t\t\t\t\t{this.success && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t\t{this.invalid && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t\t<select\n\t\t\t\t\t\t\thidden\n\t\t\t\t\t\t\taria-hidden={toBoolAttr(true)}\n\t\t\t\t\t\t\tmultiple\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t{this.options.map((option) => {\n\t\t\t\t\t\t\t\treturn (<option value={option.value} selected={option.value === this.value}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={option?.disabled}>{option.name}</option>)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t{this.hideSelectedList === false ? (\n\t\t\t\t\t<ul role=\"listbox\" id={this.listId} class={FormMultiSelectClass.list}>\n\t\t\t\t\t\t{this.selectedOptions.map(option => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<li class={FormMultiSelectClass.item} role=\"option\">\n\t\t\t\t\t\t\t\t\t{option.name}\n\t\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\t\twcagLabel={'Odebrat vybranou položku ' + option.name}\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onTagRemove(option)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t})}\n\t\t\t\t\t</ul>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptions,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.stopPropagation()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptions,\n\t\t})\n\t}\n\n\tprivate onInputHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\tthis.value = e.detail.value\n\t\te.stopPropagation()\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\te.stopPropagation()\n\t\tconst value = e.detail.selected\n\t\tthis.selectOption(value as GovFormMultiSelectItem)\n\t\tthis.value = ''\n\t\tthis.autocompleteRef.clearValue()\n\t\tthis.autocompleteRef.focus()\n\t}\n\n\tprivate onTagRemove(removeOption: GovFormMultiSelectItem) {\n\t\tthis.removeOption(removeOption)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Returns a list of selected items\n\t */\n\t@Method()\n\tasync getSelectedOptions(): Promise<GovFormMultiSelectItem[]> {\n\t\treturn this.selectedOptions\n\t}\n\n\t/**\n\t * Setting a list of options to choose from\n\t */\n\t@Method()\n\tasync setOptions(options: GovFormMultiSelectItem[]): Promise<void> {\n\t\tif (Array.isArray(options)) {\n\t\t\tthis.options = options\n\t\t}\n\t}\n\n\t/**\n\t * Setting the list of selected options\n\t */\n\t@Method()\n\tasync setSelectedOptions(options: GovFormMultiSelectItem[]): Promise<void> {\n\t\tif (Array.isArray(options)) {\n\t\t\tthis.selectedOptions = options\n\t\t}\n\t}\n\n\t/**\n\t * To remove an option from the selected list\n\t */\n\t@Method()\n\tasync removeSelectedOption(option: GovFormMultiSelectItem, notify = false): Promise<void> {\n\t\tif (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {\n\t\t\tthis.removeOption(option, notify)\n\t\t}\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync setSelectedOption(option: GovFormMultiSelectItem, notify = false): Promise<void> {\n\t\tif (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {\n\t\t\tthis.selectOption(option, notify)\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormMultiSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormMultiSelectClass.root)\n\t}\n}\n"],"version":3}
@@ -18,7 +18,7 @@ const IconClass = {
18
18
  holder: 'gov-icon__holder',
19
19
  };
20
20
 
21
- const version = "0.0.67";
21
+ const version = "0.0.70";
22
22
 
23
23
  const dsVersion = () => {
24
24
  return version;
@@ -92,65 +92,70 @@ export class GovFormMultiSelect {
92
92
  getOptionElement(value) {
93
93
  return this.selectRef.querySelector('option[value="' + value.value + '"]');
94
94
  }
95
- selectOption(newOption) {
95
+ selectOption(newOption, notify = true) {
96
96
  const index = this.getOptionIndex(newOption);
97
97
  if (index === -1) {
98
98
  this.selectedOptions = [...this.selectedOptions, newOption];
99
- this.govChange.emit({
100
- component: FormMultiSelectClass.root,
101
- value: this.selectedOptions,
102
- });
103
- this.govSelect.emit({
104
- component: FormMultiSelectClass.root,
105
- value: this.selectedOptions,
106
- });
99
+ if (notify) {
100
+ this.govChange.emit({
101
+ component: FormMultiSelectClass.root,
102
+ value: this.selectedOptions,
103
+ });
104
+ this.govSelect.emit({
105
+ component: FormMultiSelectClass.root,
106
+ value: this.selectedOptions,
107
+ });
108
+ }
107
109
  const option = this.getOptionElement(newOption);
108
110
  if (option) {
109
111
  option.selected = true;
110
112
  }
111
113
  }
112
114
  }
113
- removeOption(removeOption) {
115
+ removeOption(removeOption, notify = true) {
114
116
  const index = this.getOptionIndex(removeOption);
115
117
  if (index !== -1) {
116
118
  this.selectedOptions.splice(index, 1);
117
119
  this.selectedOptions = [...this.selectedOptions];
118
- this.govChange.emit({
119
- component: FormMultiSelectClass.root,
120
- value: this.selectedOptions,
121
- });
122
- this.govRemove.emit({
123
- component: FormMultiSelectClass.root,
124
- value: this.selectedOptions,
125
- });
120
+ if (notify) {
121
+ this.govChange.emit({
122
+ component: FormMultiSelectClass.root,
123
+ value: this.selectedOptions,
124
+ });
125
+ this.govRemove.emit({
126
+ component: FormMultiSelectClass.root,
127
+ value: this.selectedOptions,
128
+ });
129
+ }
126
130
  const option = this.getOptionElement(removeOption);
127
131
  if (option) {
128
132
  option.selected = false;
129
133
  }
130
134
  }
131
135
  }
132
- async componentDidRender() {
136
+ async componentDidLoad() {
133
137
  this.initAutocomplete();
134
- await delay(0);
138
+ if (canValidateWcagOnRender()) {
139
+ await delay(500);
140
+ await this.validateWcag();
141
+ }
142
+ }
143
+ async componentDidRender() {
135
144
  this.selectRef.querySelectorAll('option').forEach((option) => {
136
145
  if (option.selected) {
137
146
  this.selectOption({
138
147
  name: option.textContent,
139
148
  value: option.value,
140
- });
149
+ }, false);
141
150
  }
142
151
  });
143
- if (canValidateWcagOnRender()) {
144
- await delay(500);
145
- await this.validateWcag();
146
- }
147
152
  }
148
153
  render() {
149
154
  return (h(Host, { class: FormMultiSelectClass.root, size: this.size, variant: this.variant }, h("div", { class: FormMultiSelectClass.wrap }, h("div", { class: "element" }, h("gov-form-autocomplete", { value: this.value, disabled: this.disabled, identifier: this.identifier || this.selectId, required: false, size: this.size, variant: this.variant, placeholder: this.placeholder, "message-empty": this.messageEmpty, "message-loading": this.messageLoading, ref: el => (this.autocompleteRef = el), minlength: 0, wcagDescribedBy: this.wcagDescribedBy, wcagLabelledBy: this.wcagLabelledBy, wcagOwns: this.listId }), h("gov-icon", { slot: "right-icon", class: "icon-arrow", name: "chevron-down" }), this.h.hasSlot('right-icon') && !(this.success || this.invalid) && h("slot", { name: "right-icon" }), this.success && h("gov-icon", { slot: "right-icon", class: "icon-validation", name: "check-lg" }), this.invalid && h("gov-icon", { slot: "right-icon", class: "icon-validation", name: "exclamation-lg" }), h("select", { hidden: true, "aria-hidden": toBoolAttr(true), multiple: true, required: this.required, name: this.name, disabled: this.disabled, ref: el => (this.selectRef = el), "aria-disabled": toBoolAttrIfDefined(this.disabled), "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-owns": this.wcagOwns }, h("slot", null), this.options.map((option) => {
150
155
  return (h("option", { value: option.value, selected: option.value === this.value, disabled: option === null || option === void 0 ? void 0 : option.disabled }, option.name));
151
- })))), h("ul", { role: "listbox", id: this.listId, class: FormMultiSelectClass.list }, this.selectedOptions.map(option => {
156
+ })))), this.hideSelectedList === false ? (h("ul", { role: "listbox", id: this.listId, class: FormMultiSelectClass.list }, this.selectedOptions.map(option => {
152
157
  return (h("li", { class: FormMultiSelectClass.item, role: "option" }, option.name, h("gov-button", { wcagLabel: 'Odebrat vybranou položku ' + option.name, variant: "primary", type: "base", size: "s", "on-gov-click": () => this.onTagRemove(option) }, h("gov-icon", { name: "x-lg" }))));
153
- }))));
158
+ }))) : null));
154
159
  }
155
160
  onFocusHandler(e) {
156
161
  e.stopPropagation();
@@ -229,17 +234,17 @@ export class GovFormMultiSelect {
229
234
  /**
230
235
  * To remove an option from the selected list
231
236
  */
232
- async removeSelectedOption(option) {
237
+ async removeSelectedOption(option, notify = false) {
233
238
  if (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {
234
- this.removeOption(option);
239
+ this.removeOption(option, notify);
235
240
  }
236
241
  }
237
242
  /**
238
243
  * Returns an instance of the native html select element
239
244
  */
240
- async setSelectedOption(option) {
245
+ async setSelectedOption(option, notify = false) {
241
246
  if (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {
242
- this.selectOption(option);
247
+ this.selectOption(option, notify);
243
248
  }
244
249
  }
245
250
  /**
@@ -796,10 +801,13 @@ export class GovFormMultiSelect {
796
801
  },
797
802
  "removeSelectedOption": {
798
803
  "complexType": {
799
- "signature": "(option: GovFormMultiSelectItem) => Promise<void>",
804
+ "signature": "(option: GovFormMultiSelectItem, notify?: boolean) => Promise<void>",
800
805
  "parameters": [{
801
806
  "tags": [],
802
807
  "text": ""
808
+ }, {
809
+ "tags": [],
810
+ "text": ""
803
811
  }],
804
812
  "references": {
805
813
  "Promise": {
@@ -821,10 +829,13 @@ export class GovFormMultiSelect {
821
829
  },
822
830
  "setSelectedOption": {
823
831
  "complexType": {
824
- "signature": "(option: GovFormMultiSelectItem) => Promise<void>",
832
+ "signature": "(option: GovFormMultiSelectItem, notify?: boolean) => Promise<void>",
825
833
  "parameters": [{
826
834
  "tags": [],
827
835
  "text": ""
836
+ }, {
837
+ "tags": [],
838
+ "text": ""
828
839
  }],
829
840
  "references": {
830
841
  "Promise": {
@@ -1 +1 @@
1
- {"version":3,"file":"gov-form-multi-select.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/multiselect/gov-form-multi-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,eAAe,CAAA;AAC1G,OAAO,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAA;AAEjD,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAC,MAAM,+BAA+B,CAAA;AAEtF,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAC,oBAAoB,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAA;AAEpF,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAC,KAAK,EAAC,MAAM,sBAAsB,CAAA;AAE1C,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EAEpB,uBAAuB,EAE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AAoB,CAAC,IAAI,CAAC,CAAA;EACvG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govForm} from '../../../helpers/Dom/form'\nimport {GovForm} from '../../../helpers/Dom/form.types'\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from '../../../helpers/Dom/template'\nimport {GovHost} from '../../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../../helpers/Dom/win'\nimport {validateProp} from '../../../helpers/Validate/props'\nimport {validateWcagLabelFor, validateWcagRef} from '../../../helpers/Validate/wcag'\nimport {Nullable} from '../../../types/interfaces'\nimport {createID, removeDiacritics} from '../../../utils/string.utils'\nimport {delay} from '../../../utils/utils'\nimport {FormAutocompleteEvent} from '../autocomplete/gov-form-autocomplete.types'\nimport {\n\tFormMultiSelectClass,\n\tFormMultiselectSizes,\n\tFormMultiselectSizesType,\n\tFormMultiselectVariants,\n\tFormMultiselectVariantType\n} from './constants'\nimport {FormMultiselectEvent, GovFormMultiSelectItem} from './gov-form-multi-select.types'\nimport {hasOwnProperty} from \"../../../utils/helpers.types\";\n\n@Component({\n\ttag: 'gov-form-multi-select',\n\tstyleUrl: 'gov-form-multi-select.scss',\n})\nexport class GovFormMultiSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate selectRef?: HTMLSelectElement\n\tprivate autocompleteRef?: HTMLGovFormAutocompleteElement\n\n\tprivate readonly selectId: string\n\tprivate readonly listId: string\n\n\tconstructor() {\n\t\tthis.selectId = createID('GovSelect')\n\t\tthis.listId = createID('GovMultiList')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'identifier'}) readonly identifier: string\n\t/**\n\t * Custom select placeholder.\n\t */\n\t@Prop({attribute: 'placeholder'}) readonly placeholder: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormMultiselectVariantType\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormMultiselectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Option to hide the list of selected items\n\t */\n\t@Prop({attribute: 'hide-selected-list'}) readonly hideSelectedList: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Custom message for when there is a blank sheet\n\t */\n\t@Prop({attribute: 'message-empty'}) readonly messageEmpty: string = 'Nebyly nalezeny žádné výsledky'\n\t/**\n\t * Custom message for when data is loaded\n\t */\n\t@Prop({attribute: 'message-loading'}) readonly messageLoading: string = 'Načítám...'\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-owns'}) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({eventName: 'gov-focus'}) govFocus: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({eventName: 'gov-blur'}) govBlur: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is selected\n\t */\n\t@Event({eventName: 'gov-select'}) govSelect: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is removed\n\t */\n\t@Event({eventName: 'gov-remove'}) govRemove: EventEmitter<FormMultiselectEvent>\n\n\t@State() focused: boolean\n\t@State() value: string\n\t@State() selectedOptions: GovFormMultiSelectItem[] = []\n\t@State() options: GovFormMultiSelectItem[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormMultiselectVariants, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormMultiselectSizes, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('disabled')\n\t@Watch('invalid')\n\t@Watch('success')\n\t@Watch('size')\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl('size', this.size)\n\t\tthis.f.passAttrToControl('disabled', toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl('invalid', toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl('success', toBoolAttr(this.success))\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.watchDisabled()\n\t}\n\n\tprivate getAvailableOptions(): GovFormMultiSelectItem[] {\n\t\tif (Array.isArray(this.options) && this.options.length) {\n\t\t\treturn this.options.filter((option) => {\n\t\t\t\tconst isSelected = this.selectedOptions.findIndex((selected) => selected.value === option.value)\n\t\t\t\treturn (isSelected !== -1 || option?.disabled) ? false : true\n\t\t\t})\n\t\t}\n\t\treturn Array.from(this.selectRef.querySelectorAll('option'))\n\t\t\t.filter((option: HTMLOptionElement) => !(option.disabled || option.selected))\n\t\t\t.map((option: HTMLOptionElement) => ({name: option.textContent, value: option.value}))\n\t}\n\n\tprivate initAutocomplete() {\n\t\tthis.autocompleteRef.addEventListener('gov-select', this.onSelectHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-input', this.onInputHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-focus', this.onFocusHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-blur', this.onBlurHandler.bind(this))\n\t\tthis.autocompleteRef\n\t\t\t.setSearchCallback(value => {\n\t\t\t\treturn new Promise(resolve => {\n\t\t\t\t\tconst data = this.getAvailableOptions()\n\t\t\t\t\tif (String(value).length === 0) {\n\t\t\t\t\t\treturn resolve(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(\n\t\t\t\t\t\tdata.filter(({name}) => {\n\t\t\t\t\t\t\tif (!name) return false\n\t\t\t\t\t\t\treturn removeDiacritics(name).toLowerCase().indexOf(removeDiacritics(value).toLowerCase()) > -1\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t})\n\t\t\t.then()\n\t}\n\n\tprivate getOptionIndex(value: GovFormMultiSelectItem): number {\n\t\treturn this.selectedOptions.findIndex(option => option.value === value.value && option.name === value.name)\n\t}\n\n\tprivate getOptionElement(value: GovFormMultiSelectItem): Nullable<HTMLOptionElement> {\n\t\treturn this.selectRef.querySelector('option[value=\"' + value.value + '\"]') as HTMLOptionElement\n\t}\n\n\tprivate selectOption(newOption: GovFormMultiSelectItem) {\n\t\tconst index = this.getOptionIndex(newOption)\n\t\tif (index === -1) {\n\t\t\tthis.selectedOptions = [...this.selectedOptions, newOption]\n\t\t\tthis.govChange.emit({\n\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\tvalue: this.selectedOptions,\n\t\t\t})\n\t\t\tthis.govSelect.emit({\n\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\tvalue: this.selectedOptions,\n\t\t\t})\n\t\t\tconst option = this.getOptionElement(newOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = true\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate removeOption(removeOption: GovFormMultiSelectItem) {\n\t\tconst index = this.getOptionIndex(removeOption)\n\t\tif (index !== -1) {\n\t\t\tthis.selectedOptions.splice(index, 1)\n\t\t\tthis.selectedOptions = [...this.selectedOptions]\n\t\t\tthis.govChange.emit({\n\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\tvalue: this.selectedOptions,\n\t\t\t})\n\t\t\tthis.govRemove.emit({\n\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\tvalue: this.selectedOptions,\n\t\t\t})\n\t\t\tconst option = this.getOptionElement(removeOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = false\n\t\t\t}\n\t\t}\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.initAutocomplete()\n\t\tawait delay(0)\n\t\tthis.selectRef.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.selected) {\n\t\t\t\tthis.selectOption({\n\t\t\t\t\tname: option.textContent,\n\t\t\t\t\tvalue: option.value,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormMultiSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t<div class={FormMultiSelectClass.wrap}>\n\t\t\t\t\t<div class=\"element\">\n\t\t\t\t\t\t<gov-form-autocomplete\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tidentifier={this.identifier || this.selectId}\n\t\t\t\t\t\t\trequired={false}\n\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\t\tmessage-empty={this.messageEmpty}\n\t\t\t\t\t\t\tmessage-loading={this.messageLoading}\n\t\t\t\t\t\t\tref={el => (this.autocompleteRef = el as HTMLGovFormAutocompleteElement)}\n\t\t\t\t\t\t\tminlength={0}\n\t\t\t\t\t\t\twcagDescribedBy={this.wcagDescribedBy}\n\t\t\t\t\t\t\twcagLabelledBy={this.wcagLabelledBy}\n\t\t\t\t\t\t\twcagOwns={this.listId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<gov-icon slot=\"right-icon\" class=\"icon-arrow\" name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\"/>}\n\t\t\t\t\t\t{this.success && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t\t{this.invalid && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t\t<select\n\t\t\t\t\t\t\thidden\n\t\t\t\t\t\t\taria-hidden={toBoolAttr(true)}\n\t\t\t\t\t\t\tmultiple\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t{this.options.map((option) => {\n\t\t\t\t\t\t\t\treturn (<option value={option.value} selected={option.value === this.value}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={option?.disabled}>{option.name}</option>)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<ul role=\"listbox\" id={this.listId} class={FormMultiSelectClass.list}>\n\t\t\t\t\t{this.selectedOptions.map(option => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<li class={FormMultiSelectClass.item} role=\"option\">\n\t\t\t\t\t\t\t\t{option.name}\n\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\twcagLabel={'Odebrat vybranou položku ' + option.name}\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onTagRemove(option)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</ul>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptions,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.stopPropagation()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptions,\n\t\t})\n\t}\n\n\tprivate onInputHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\tthis.value = e.detail.value\n\t\te.stopPropagation()\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\te.stopPropagation()\n\t\tconst value = e.detail.selected\n\t\tthis.selectOption(value as GovFormMultiSelectItem)\n\t\tthis.value = ''\n\t\tthis.autocompleteRef.clearValue()\n\t\tthis.autocompleteRef.focus()\n\t}\n\n\tprivate onTagRemove(removeOption: GovFormMultiSelectItem) {\n\t\tthis.removeOption(removeOption)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Returns a list of selected items\n\t */\n\t@Method()\n\tasync getSelectedOptions(): Promise<GovFormMultiSelectItem[]> {\n\t\treturn this.selectedOptions\n\t}\n\n\t/**\n\t * Setting a list of options to choose from\n\t */\n\t@Method()\n\tasync setOptions(options: GovFormMultiSelectItem[]): Promise<void> {\n\t\tif (Array.isArray(options)) {\n\t\t\tthis.options = options\n\t\t}\n\t}\n\n\t/**\n\t * Setting the list of selected options\n\t */\n\t@Method()\n\tasync setSelectedOptions(options: GovFormMultiSelectItem[]): Promise<void> {\n\t\tif (Array.isArray(options)) {\n\t\t\tthis.selectedOptions = options\n\t\t}\n\t}\n\n\t/**\n\t * To remove an option from the selected list\n\t */\n\t@Method()\n\tasync removeSelectedOption(option: GovFormMultiSelectItem): Promise<void> {\n\t\tif (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {\n\t\t\tthis.removeOption(option)\n\t\t}\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync setSelectedOption(option: GovFormMultiSelectItem): Promise<void> {\n\t\tif (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {\n\t\t\tthis.selectOption(option)\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormMultiSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormMultiSelectClass.root)\n\t}\n}\n"]}
1
+ {"version":3,"file":"gov-form-multi-select.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/multiselect/gov-form-multi-select.tsx"],"names":[],"mappings":"AA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govForm} from '../../../helpers/Dom/form'\nimport {GovForm} from '../../../helpers/Dom/form.types'\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from '../../../helpers/Dom/template'\nimport {GovHost} from '../../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../../helpers/Dom/win'\nimport {validateProp} from '../../../helpers/Validate/props'\nimport {validateWcagLabelFor, validateWcagRef} from '../../../helpers/Validate/wcag'\nimport {Nullable} from '../../../types/interfaces'\nimport {createID, removeDiacritics} from '../../../utils/string.utils'\nimport {delay} from '../../../utils/utils'\nimport {FormAutocompleteEvent} from '../autocomplete/gov-form-autocomplete.types'\nimport {\n\tFormMultiSelectClass,\n\tFormMultiselectSizes,\n\tFormMultiselectSizesType,\n\tFormMultiselectVariants,\n\tFormMultiselectVariantType\n} from './constants'\nimport {FormMultiselectEvent, GovFormMultiSelectItem} from './gov-form-multi-select.types'\nimport {hasOwnProperty} from \"../../../utils/helpers.types\";\n\n@Component({\n\ttag: 'gov-form-multi-select',\n\tstyleUrl: 'gov-form-multi-select.scss',\n})\nexport class GovFormMultiSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate selectRef?: HTMLSelectElement\n\tprivate autocompleteRef?: HTMLGovFormAutocompleteElement\n\n\tprivate readonly selectId: string\n\tprivate readonly listId: string\n\n\tconstructor() {\n\t\tthis.selectId = createID('GovSelect')\n\t\tthis.listId = createID('GovMultiList')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'identifier'}) readonly identifier: string\n\t/**\n\t * Custom select placeholder.\n\t */\n\t@Prop({attribute: 'placeholder'}) readonly placeholder: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormMultiselectVariantType\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormMultiselectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Option to hide the list of selected items\n\t */\n\t@Prop({attribute: 'hide-selected-list'}) readonly hideSelectedList: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Custom message for when there is a blank sheet\n\t */\n\t@Prop({attribute: 'message-empty'}) readonly messageEmpty: string = 'Nebyly nalezeny žádné výsledky'\n\t/**\n\t * Custom message for when data is loaded\n\t */\n\t@Prop({attribute: 'message-loading'}) readonly messageLoading: string = 'Načítám...'\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-owns'}) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({eventName: 'gov-focus'}) govFocus: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({eventName: 'gov-blur'}) govBlur: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is selected\n\t */\n\t@Event({eventName: 'gov-select'}) govSelect: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is removed\n\t */\n\t@Event({eventName: 'gov-remove'}) govRemove: EventEmitter<FormMultiselectEvent>\n\n\t@State() focused: boolean\n\t@State() value: string\n\t@State() selectedOptions: GovFormMultiSelectItem[] = []\n\t@State() options: GovFormMultiSelectItem[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormMultiselectVariants, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormMultiselectSizes, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('disabled')\n\t@Watch('invalid')\n\t@Watch('success')\n\t@Watch('size')\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl('size', this.size)\n\t\tthis.f.passAttrToControl('disabled', toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl('invalid', toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl('success', toBoolAttr(this.success))\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.watchDisabled()\n\t}\n\n\tprivate getAvailableOptions(): GovFormMultiSelectItem[] {\n\t\tif (Array.isArray(this.options) && this.options.length) {\n\t\t\treturn this.options.filter((option) => {\n\t\t\t\tconst isSelected = this.selectedOptions.findIndex((selected) => selected.value === option.value)\n\t\t\t\treturn (isSelected !== -1 || option?.disabled) ? false : true\n\t\t\t})\n\t\t}\n\t\treturn Array.from(this.selectRef.querySelectorAll('option'))\n\t\t\t.filter((option: HTMLOptionElement) => !(option.disabled || option.selected))\n\t\t\t.map((option: HTMLOptionElement) => ({name: option.textContent, value: option.value}))\n\t}\n\n\tprivate initAutocomplete() {\n\t\tthis.autocompleteRef.addEventListener('gov-select', this.onSelectHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-input', this.onInputHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-focus', this.onFocusHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-blur', this.onBlurHandler.bind(this))\n\t\tthis.autocompleteRef\n\t\t\t.setSearchCallback(value => {\n\t\t\t\treturn new Promise(resolve => {\n\t\t\t\t\tconst data = this.getAvailableOptions()\n\t\t\t\t\tif (String(value).length === 0) {\n\t\t\t\t\t\treturn resolve(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(\n\t\t\t\t\t\tdata.filter(({name}) => {\n\t\t\t\t\t\t\tif (!name) return false\n\t\t\t\t\t\t\treturn removeDiacritics(name).toLowerCase().indexOf(removeDiacritics(value).toLowerCase()) > -1\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t})\n\t\t\t.then()\n\t}\n\n\tprivate getOptionIndex(value: GovFormMultiSelectItem): number {\n\t\treturn this.selectedOptions.findIndex(option => option.value === value.value && option.name === value.name)\n\t}\n\n\tprivate getOptionElement(value: GovFormMultiSelectItem): Nullable<HTMLOptionElement> {\n\t\treturn this.selectRef.querySelector('option[value=\"' + value.value + '\"]') as HTMLOptionElement\n\t}\n\n\tprivate selectOption(newOption: GovFormMultiSelectItem, notify = true) {\n\t\tconst index = this.getOptionIndex(newOption)\n\t\tif (index === -1) {\n\t\t\tthis.selectedOptions = [...this.selectedOptions, newOption]\n\t\t\tif (notify) {\n\t\t\t\tthis.govChange.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptions,\n\t\t\t\t})\n\t\t\t\tthis.govSelect.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptions,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst option = this.getOptionElement(newOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = true\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate removeOption(removeOption: GovFormMultiSelectItem, notify = true) {\n\t\tconst index = this.getOptionIndex(removeOption)\n\t\tif (index !== -1) {\n\t\t\tthis.selectedOptions.splice(index, 1)\n\t\t\tthis.selectedOptions = [...this.selectedOptions]\n\t\t\tif(notify) {\n\t\t\t\tthis.govChange.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptions,\n\t\t\t\t})\n\t\t\t\tthis.govRemove.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptions,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst option = this.getOptionElement(removeOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = false\n\t\t\t}\n\t\t}\n\t}\n\n\tasync componentDidLoad() {\n\t\tthis.initAutocomplete()\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.selectRef.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.selected) {\n\t\t\t\tthis.selectOption({\n\t\t\t\t\tname: option.textContent,\n\t\t\t\t\tvalue: option.value,\n\t\t\t\t}, false)\n\t\t\t}\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormMultiSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t<div class={FormMultiSelectClass.wrap}>\n\t\t\t\t\t<div class=\"element\">\n\t\t\t\t\t\t<gov-form-autocomplete\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tidentifier={this.identifier || this.selectId}\n\t\t\t\t\t\t\trequired={false}\n\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\t\tmessage-empty={this.messageEmpty}\n\t\t\t\t\t\t\tmessage-loading={this.messageLoading}\n\t\t\t\t\t\t\tref={el => (this.autocompleteRef = el as HTMLGovFormAutocompleteElement)}\n\t\t\t\t\t\t\tminlength={0}\n\t\t\t\t\t\t\twcagDescribedBy={this.wcagDescribedBy}\n\t\t\t\t\t\t\twcagLabelledBy={this.wcagLabelledBy}\n\t\t\t\t\t\t\twcagOwns={this.listId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<gov-icon slot=\"right-icon\" class=\"icon-arrow\" name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\"/>}\n\t\t\t\t\t\t{this.success && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t\t{this.invalid && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t\t<select\n\t\t\t\t\t\t\thidden\n\t\t\t\t\t\t\taria-hidden={toBoolAttr(true)}\n\t\t\t\t\t\t\tmultiple\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t{this.options.map((option) => {\n\t\t\t\t\t\t\t\treturn (<option value={option.value} selected={option.value === this.value}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={option?.disabled}>{option.name}</option>)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t{this.hideSelectedList === false ? (\n\t\t\t\t\t<ul role=\"listbox\" id={this.listId} class={FormMultiSelectClass.list}>\n\t\t\t\t\t\t{this.selectedOptions.map(option => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<li class={FormMultiSelectClass.item} role=\"option\">\n\t\t\t\t\t\t\t\t\t{option.name}\n\t\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\t\twcagLabel={'Odebrat vybranou položku ' + option.name}\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onTagRemove(option)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t})}\n\t\t\t\t\t</ul>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptions,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.stopPropagation()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptions,\n\t\t})\n\t}\n\n\tprivate onInputHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\tthis.value = e.detail.value\n\t\te.stopPropagation()\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\te.stopPropagation()\n\t\tconst value = e.detail.selected\n\t\tthis.selectOption(value as GovFormMultiSelectItem)\n\t\tthis.value = ''\n\t\tthis.autocompleteRef.clearValue()\n\t\tthis.autocompleteRef.focus()\n\t}\n\n\tprivate onTagRemove(removeOption: GovFormMultiSelectItem) {\n\t\tthis.removeOption(removeOption)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Returns a list of selected items\n\t */\n\t@Method()\n\tasync getSelectedOptions(): Promise<GovFormMultiSelectItem[]> {\n\t\treturn this.selectedOptions\n\t}\n\n\t/**\n\t * Setting a list of options to choose from\n\t */\n\t@Method()\n\tasync setOptions(options: GovFormMultiSelectItem[]): Promise<void> {\n\t\tif (Array.isArray(options)) {\n\t\t\tthis.options = options\n\t\t}\n\t}\n\n\t/**\n\t * Setting the list of selected options\n\t */\n\t@Method()\n\tasync setSelectedOptions(options: GovFormMultiSelectItem[]): Promise<void> {\n\t\tif (Array.isArray(options)) {\n\t\t\tthis.selectedOptions = options\n\t\t}\n\t}\n\n\t/**\n\t * To remove an option from the selected list\n\t */\n\t@Method()\n\tasync removeSelectedOption(option: GovFormMultiSelectItem, notify = false): Promise<void> {\n\t\tif (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {\n\t\t\tthis.removeOption(option, notify)\n\t\t}\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync setSelectedOption(option: GovFormMultiSelectItem, notify = false): Promise<void> {\n\t\tif (typeof option === 'object' && hasOwnProperty(option, 'name') && hasOwnProperty(option, 'value')) {\n\t\t\tthis.selectOption(option, notify)\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormMultiSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormMultiSelectClass.root)\n\t}\n}\n"]}
@@ -69,10 +69,18 @@ class FormsPage extends HTMLElement {
69
69
  });
70
70
  }
71
71
  if (ms) {
72
- ms.setOptions([{ value: 'a', name: 'Aneta' }, { value: 'b', name: 'Beata' }, { value: 't', name: 'Tomáš' }]);
72
+ ms.addEventListener('gov-change', (e) => {
73
+ console.log('change', e);
74
+ });
75
+ setTimeout(() => {
76
+ ms.setOptions([{ value: 'a', name: 'Aneta' }, { value: 'b', name: 'Beata' }, { value: 't', name: 'Tomáš' }]);
77
+ console.log('impl');
78
+ //ms.getSelectedOptions().then((t) => console.log(t))
79
+ }, 2000);
73
80
  setTimeout(() => {
74
- ms.removeSelectedOption({ value: 'a', name: 'Aneta' });
75
- ms.getSelectedOptions().then((t) => console.log(t));
81
+ ms.setSelectedOption({ value: 'a', name: 'Aneta' });
82
+ console.log('sets');
83
+ //ms.getSelectedOptions().then((t) => console.log(t))
76
84
  }, 5000);
77
85
  }
78
86
  if (moja) {