@ni/ok-components 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,32 @@
8
8
 
9
9
  <hr/>
10
10
 
11
+ ## class: `FvAccordionItem`
12
+
13
+ ### Superclass
14
+
15
+ | Name | Module | Package |
16
+ | ------------------- | ------ | ------------------- |
17
+ | `FoundationElement` | | @ni/fast-foundation |
18
+
19
+ ### Fields
20
+
21
+ | Name | Privacy | Type | Default | Description | Inherited From |
22
+ | ------------ | ------- | --------------------------- | ------- | ----------- | -------------- |
23
+ | `header` | public | `string` | `''` | | |
24
+ | `expanded` | public | `boolean` | `false` | | |
25
+ | `appearance` | public | `FvAccordionItemAppearance` | | | |
26
+
27
+ ### Attributes
28
+
29
+ | Name | Field | Inherited From |
30
+ | ------------ | ---------- | -------------- |
31
+ | `header` | header | |
32
+ | `expanded` | expanded | |
33
+ | `appearance` | appearance | |
34
+
35
+ <hr/>
36
+
11
37
  ## class: `FvBulkEditField`
12
38
 
13
39
  ### Superclass
@@ -65,32 +91,6 @@
65
91
 
66
92
  <hr/>
67
93
 
68
- ## class: `FvAccordionItem`
69
-
70
- ### Superclass
71
-
72
- | Name | Module | Package |
73
- | ------------------- | ------ | ------------------- |
74
- | `FoundationElement` | | @ni/fast-foundation |
75
-
76
- ### Fields
77
-
78
- | Name | Privacy | Type | Default | Description | Inherited From |
79
- | ------------ | ------- | --------------------------- | ------- | ----------- | -------------- |
80
- | `header` | public | `string` | `''` | | |
81
- | `expanded` | public | `boolean` | `false` | | |
82
- | `appearance` | public | `FvAccordionItemAppearance` | | | |
83
-
84
- ### Attributes
85
-
86
- | Name | Field | Inherited From |
87
- | ------------ | ---------- | -------------- |
88
- | `header` | header | |
89
- | `expanded` | expanded | |
90
- | `appearance` | appearance | |
91
-
92
- <hr/>
93
-
94
94
  ## class: `FvCard`
95
95
 
96
96
  ### Superclass
@@ -335,6 +335,40 @@
335
335
 
336
336
  <hr/>
337
337
 
338
+ ## class: `FvMultiSelect`
339
+
340
+ ### Superclass
341
+
342
+ | Name | Module | Package |
343
+ | --------------------------- | ------------------------------------------- | ------- |
344
+ | `FormAssociatedMultiSelect` | /src/fv/multi-select/models/form-associated | |
345
+
346
+ ### Fields
347
+
348
+ | Name | Privacy | Type | Default | Description | Inherited From |
349
+ | ---------------- | ------- | ----------------------- | ------- | ----------- | -------------- |
350
+ | `appearance` | public | `DropdownAppearance` | | | |
351
+ | `label` | public | `string` | `''` | | |
352
+ | `placeholder` | public | `string` | `''` | | |
353
+ | `filterable` | public | `boolean` | `false` | | |
354
+ | `clearable` | public | `boolean` | `false` | | |
355
+ | `open` | public | `boolean` | `false` | | |
356
+ | `options` | public | `FvMultiSelectOption[]` | `[]` | | |
357
+ | `selectedValues` | public | `string[]` | `[]` | | |
358
+
359
+ ### Attributes
360
+
361
+ | Name | Field | Inherited From |
362
+ | ------------- | ----------- | -------------- |
363
+ | `appearance` | appearance | |
364
+ | `label` | label | |
365
+ | `placeholder` | placeholder | |
366
+ | `filterable` | filterable | |
367
+ | `clearable` | clearable | |
368
+ | `open` | open | |
369
+
370
+ <hr/>
371
+
338
372
  ## class: `FvSearchInput`
339
373
 
340
374
  ### Superclass
@@ -532,7 +566,7 @@
532
566
 
533
567
  <hr/>
534
568
 
535
- ## class: `FvSummaryPanelTile`
569
+ ## class: `FvStickyHeader`
536
570
 
537
571
  ### Superclass
538
572
 
@@ -540,28 +574,6 @@
540
574
  | ------------------- | ------ | ------------------- |
541
575
  | `FoundationElement` | | @ni/fast-foundation |
542
576
 
543
- ### Fields
544
-
545
- | Name | Privacy | Type | Default | Description | Inherited From |
546
- | -------------- | ------- | ------------------------------------ | ------- | ----------- | -------------- |
547
- | `count` | public | `string` | `''` | | |
548
- | `label` | public | `string` | `''` | | |
549
- | `legacyStyle` | public | `boolean` | `false` | | |
550
- | `size` | public | `FvSummaryPanelSizeType` | | | |
551
- | `selected` | public | `boolean` | `false` | | |
552
- | `textPosition` | public | `FvSummaryPanelTileTextPositionType` | | | |
553
-
554
- ### Attributes
555
-
556
- | Name | Field | Inherited From |
557
- | --------------- | ------------ | -------------- |
558
- | `count` | count | |
559
- | `label` | label | |
560
- | `legacy-style` | legacyStyle | |
561
- | `size` | size | |
562
- | `selected` | selected | |
563
- | `text-position` | textPosition | |
564
-
565
577
  <hr/>
566
578
 
567
579
  ## class: `FvSummaryPanel`
@@ -598,7 +610,7 @@
598
610
 
599
611
  <hr/>
600
612
 
601
- ## class: `FvStickyHeader`
613
+ ## class: `FvSummaryPanelTile`
602
614
 
603
615
  ### Superclass
604
616
 
@@ -606,6 +618,28 @@
606
618
  | ------------------- | ------ | ------------------- |
607
619
  | `FoundationElement` | | @ni/fast-foundation |
608
620
 
621
+ ### Fields
622
+
623
+ | Name | Privacy | Type | Default | Description | Inherited From |
624
+ | -------------- | ------- | ------------------------------------ | ------- | ----------- | -------------- |
625
+ | `count` | public | `string` | `''` | | |
626
+ | `label` | public | `string` | `''` | | |
627
+ | `legacyStyle` | public | `boolean` | `false` | | |
628
+ | `size` | public | `FvSummaryPanelSizeType` | | | |
629
+ | `selected` | public | `boolean` | `false` | | |
630
+ | `textPosition` | public | `FvSummaryPanelTileTextPositionType` | | | |
631
+
632
+ ### Attributes
633
+
634
+ | Name | Field | Inherited From |
635
+ | --------------- | ------------ | -------------- |
636
+ | `count` | count | |
637
+ | `label` | label | |
638
+ | `legacy-style` | legacyStyle | |
639
+ | `size` | size | |
640
+ | `selected` | selected | |
641
+ | `text-position` | textPosition | |
642
+
609
643
  <hr/>
610
644
 
611
645
  ## class: `FvToolbar`
@@ -7,6 +7,7 @@ import './edit-commit-bar';
7
7
  import './filter-bar';
8
8
  import './master-detail-list-item';
9
9
  import './master-detail-list';
10
+ import './multi-select';
10
11
  import './split-button';
11
12
  import './split-button-anchor';
12
13
  import './sticky-header';
@@ -7,6 +7,7 @@ import './edit-commit-bar';
7
7
  import './filter-bar';
8
8
  import './master-detail-list-item';
9
9
  import './master-detail-list';
10
+ import './multi-select';
10
11
  import './split-button';
11
12
  import './split-button-anchor';
12
13
  import './sticky-header';
@@ -1 +1 @@
1
- {"version":3,"file":"all-fv.js","sourceRoot":"","sources":["../../../src/fv/all-fv.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,QAAQ,CAAC;AAChB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AACtB,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,YAAY,CAAC;AACpB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,CAAC","sourcesContent":["import './accordion-item';\nimport './card';\nimport './bulk-edit-field';\nimport './chip-selector';\nimport './context-help';\nimport './edit-commit-bar';\nimport './filter-bar';\nimport './master-detail-list-item';\nimport './master-detail-list';\nimport './split-button';\nimport './split-button-anchor';\nimport './sticky-header';\nimport './summary-panel';\nimport './summary-panel-tile';\nimport './search-input';\nimport './splitter';\nimport './split-layout';\nimport './toolbar';\n"]}
1
+ {"version":3,"file":"all-fv.js","sourceRoot":"","sources":["../../../src/fv/all-fv.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,QAAQ,CAAC;AAChB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AACtB,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,YAAY,CAAC;AACpB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,CAAC","sourcesContent":["import './accordion-item';\nimport './card';\nimport './bulk-edit-field';\nimport './chip-selector';\nimport './context-help';\nimport './edit-commit-bar';\nimport './filter-bar';\nimport './master-detail-list-item';\nimport './master-detail-list';\nimport './multi-select';\nimport './split-button';\nimport './split-button-anchor';\nimport './sticky-header';\nimport './summary-panel';\nimport './summary-panel-tile';\nimport './search-input';\nimport './splitter';\nimport './split-layout';\nimport './toolbar';\n"]}
@@ -0,0 +1,100 @@
1
+ import type { AnchoredRegion } from '@ni/nimble-components/dist/esm/anchored-region';
2
+ import { DropdownAppearance } from '@ni/nimble-components/dist/esm/patterns/dropdown/types';
3
+ import type { FvMultiSelectOption } from './types';
4
+ import { FormAssociatedMultiSelect } from './models/form-associated';
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'ok-fv-multi-select': FvMultiSelect;
8
+ }
9
+ }
10
+ /**
11
+ * A dropdown with checkbox options and optional local search.
12
+ */
13
+ export declare class FvMultiSelect extends FormAssociatedMultiSelect {
14
+ appearance: DropdownAppearance;
15
+ label: string;
16
+ placeholder: string;
17
+ filterable: boolean;
18
+ clearable: boolean;
19
+ open: boolean;
20
+ options: FvMultiSelectOption[];
21
+ selectedValues: string[];
22
+ /** @internal */
23
+ filter: string;
24
+ /** @internal */
25
+ activeIndex: number;
26
+ /** @internal */
27
+ keyboardNavigation: boolean;
28
+ /** @internal */
29
+ readonly controlId: string;
30
+ /** @internal */
31
+ readonly listboxId: string;
32
+ /** @internal */
33
+ control: HTMLButtonElement;
34
+ /** @internal */
35
+ controlField: HTMLDivElement;
36
+ /** @internal */
37
+ filterInput?: HTMLInputElement;
38
+ /** @internal */
39
+ listbox: HTMLDivElement;
40
+ /** @internal */
41
+ region: AnchoredRegion;
42
+ /** @internal */
43
+ formDisabled: boolean;
44
+ /** @internal */
45
+ get effectiveDisabled(): boolean;
46
+ private initialSelectedValues?;
47
+ /** @internal */
48
+ get visibleOptions(): FvMultiSelectOption[];
49
+ /** @internal */
50
+ get displayValue(): string;
51
+ /** @internal */
52
+ get activeOptionId(): string | null;
53
+ /** @internal */
54
+ connectedCallback(): void;
55
+ /** @internal */
56
+ disconnectedCallback(): void;
57
+ /** @internal */
58
+ disabledChanged(previous: boolean, next: boolean): void;
59
+ /** @internal */
60
+ formDisabledCallback(disabled: boolean): void;
61
+ /** @internal */
62
+ selectedValuesChanged(): void;
63
+ /** @internal */
64
+ nameChanged(previous: string, next: string): void;
65
+ /** @internal */
66
+ valueChanged(): void;
67
+ /** @internal */
68
+ validate(): void;
69
+ /** @internal */
70
+ formResetCallback(): void;
71
+ /** @internal */
72
+ openChanged(): Promise<void>;
73
+ /** @internal */
74
+ focusPopup(): void;
75
+ /** @internal */
76
+ optionsChanged(): void;
77
+ /** @internal */
78
+ filterChanged(): void;
79
+ /** @internal */
80
+ filterableChanged(): Promise<void>;
81
+ /** @internal */
82
+ toggleOption(option: FvMultiSelectOption): void;
83
+ /** @internal */
84
+ clearSelection(): void;
85
+ /** @internal */
86
+ handleInput(event: Event): void;
87
+ /** @internal */
88
+ handleControlKeydown(event: KeyboardEvent): boolean;
89
+ /** @internal */
90
+ handlePopupKeydown(event: KeyboardEvent): boolean;
91
+ /** @internal */
92
+ handleFocusout(event: FocusEvent): void;
93
+ private resetActiveOption;
94
+ private scrollActiveOptionIntoView;
95
+ private readonly updatePopupLayout;
96
+ private syncFormValue;
97
+ private moveActiveOption;
98
+ private readonly documentClickHandler;
99
+ }
100
+ export declare const fvMultiSelectTag = "ok-fv-multi-select";
@@ -0,0 +1,367 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr, DOM, observable, volatile } from '@ni/fast-element';
3
+ import { DesignSystem } from '@ni/fast-foundation';
4
+ import { uniqueId } from '@ni/fast-web-utilities';
5
+ import { DropdownAppearance } from '@ni/nimble-components/dist/esm/patterns/dropdown/types';
6
+ import { diacriticInsensitiveStringNormalizer } from '@ni/nimble-components/dist/esm/utilities/models/string-normalizers';
7
+ import { styles } from './styles';
8
+ import { template } from './template';
9
+ import { FormAssociatedMultiSelect } from './models/form-associated';
10
+ /**
11
+ * A dropdown with checkbox options and optional local search.
12
+ */
13
+ export class FvMultiSelect extends FormAssociatedMultiSelect {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.appearance = DropdownAppearance.underline;
17
+ this.label = '';
18
+ this.placeholder = '';
19
+ this.filterable = false;
20
+ this.clearable = false;
21
+ this.open = false;
22
+ this.options = [];
23
+ this.selectedValues = [];
24
+ /** @internal */
25
+ this.filter = '';
26
+ /** @internal */
27
+ this.activeIndex = -1;
28
+ /** @internal */
29
+ this.keyboardNavigation = false;
30
+ /** @internal */
31
+ this.controlId = uniqueId('ok-fv-multi-select-');
32
+ /** @internal */
33
+ this.listboxId = `${this.controlId}-listbox`;
34
+ /** @internal */
35
+ this.formDisabled = false;
36
+ this.updatePopupLayout = () => {
37
+ if (this.open && this.isConnected) {
38
+ const bounds = this.controlField.getBoundingClientRect();
39
+ const availableHeight = Math.max(0, bounds.top, window.innerHeight - bounds.bottom);
40
+ this.style.setProperty('--ok-fv-multi-select-available-height', `${availableHeight}px`);
41
+ this.region.update();
42
+ }
43
+ };
44
+ this.documentClickHandler = (event) => {
45
+ if (this.open && !event.composedPath().includes(this)) {
46
+ this.open = false;
47
+ }
48
+ };
49
+ }
50
+ /** @internal */
51
+ get effectiveDisabled() {
52
+ return this.disabled || this.formDisabled;
53
+ }
54
+ /** @internal */
55
+ get visibleOptions() {
56
+ const filter = diacriticInsensitiveStringNormalizer(this.filter);
57
+ return this.options.filter(option => !this.filterable
58
+ || diacriticInsensitiveStringNormalizer(option.label).includes(filter));
59
+ }
60
+ /** @internal */
61
+ get displayValue() {
62
+ return this.selectedValues
63
+ .map(value => this.options.find(option => option.value === value)?.label ?? value)
64
+ .join(', ');
65
+ }
66
+ /** @internal */
67
+ get activeOptionId() {
68
+ return this.open && this.activeIndex >= 0
69
+ ? `${this.listboxId}-${this.activeIndex}`
70
+ : null;
71
+ }
72
+ /** @internal */
73
+ connectedCallback() {
74
+ this.initialSelectedValues ?? (this.initialSelectedValues = [...this.selectedValues]);
75
+ super.connectedCallback();
76
+ this.syncFormValue();
77
+ document.addEventListener('click', this.documentClickHandler);
78
+ window.addEventListener('resize', this.updatePopupLayout);
79
+ window.addEventListener('scroll', this.updatePopupLayout, true);
80
+ this.resetActiveOption();
81
+ if (this.open) {
82
+ void this.openChanged();
83
+ }
84
+ }
85
+ /** @internal */
86
+ disconnectedCallback() {
87
+ document.removeEventListener('click', this.documentClickHandler);
88
+ window.removeEventListener('resize', this.updatePopupLayout);
89
+ window.removeEventListener('scroll', this.updatePopupLayout, true);
90
+ super.disconnectedCallback();
91
+ }
92
+ /** @internal */
93
+ disabledChanged(previous, next) {
94
+ super.disabledChanged?.(previous, next);
95
+ if (this.disabled) {
96
+ this.open = false;
97
+ }
98
+ this.syncFormValue();
99
+ }
100
+ /** @internal */
101
+ formDisabledCallback(disabled) {
102
+ this.formDisabled = disabled;
103
+ if (disabled) {
104
+ this.open = false;
105
+ }
106
+ this.syncFormValue();
107
+ }
108
+ /** @internal */
109
+ selectedValuesChanged() {
110
+ this.syncFormValue();
111
+ }
112
+ /** @internal */
113
+ nameChanged(previous, next) {
114
+ super.nameChanged?.(previous, next);
115
+ this.syncFormValue();
116
+ }
117
+ /** @internal */
118
+ valueChanged() {
119
+ this.syncFormValue();
120
+ }
121
+ /** @internal */
122
+ validate() {
123
+ if (this.effectiveDisabled) {
124
+ this.setValidity({});
125
+ }
126
+ else {
127
+ super.validate(this.control);
128
+ }
129
+ }
130
+ /** @internal */
131
+ formResetCallback() {
132
+ this.open = false;
133
+ this.selectedValues = [...(this.initialSelectedValues ?? [])];
134
+ }
135
+ /** @internal */
136
+ async openChanged() {
137
+ if (this.open && this.effectiveDisabled) {
138
+ this.open = false;
139
+ return;
140
+ }
141
+ if (!this.open) {
142
+ if (this.$fastController.isConnected) {
143
+ // Rebinding on opening waits for a fresh anchored-region layout.
144
+ this.region.anchorElement = null;
145
+ }
146
+ this.filter = '';
147
+ this.activeIndex = -1;
148
+ this.keyboardNavigation = false;
149
+ return;
150
+ }
151
+ if (!this.$fastController.isConnected) {
152
+ return;
153
+ }
154
+ this.region.anchorElement = this.controlField;
155
+ this.updatePopupLayout();
156
+ this.resetActiveOption();
157
+ await DOM.nextUpdate();
158
+ this.focusPopup();
159
+ }
160
+ /** @internal */
161
+ focusPopup() {
162
+ if (this.open && this.isConnected) {
163
+ (this.filterable ? this.filterInput : this.listbox)?.focus();
164
+ this.scrollActiveOptionIntoView();
165
+ }
166
+ }
167
+ /** @internal */
168
+ optionsChanged() {
169
+ this.resetActiveOption();
170
+ }
171
+ /** @internal */
172
+ filterChanged() {
173
+ this.resetActiveOption();
174
+ }
175
+ /** @internal */
176
+ async filterableChanged() {
177
+ this.filter = '';
178
+ if (this.open) {
179
+ this.resetActiveOption();
180
+ if (!this.filterable) {
181
+ this.listbox?.focus();
182
+ return;
183
+ }
184
+ await DOM.nextUpdate();
185
+ this.focusPopup();
186
+ }
187
+ }
188
+ /** @internal */
189
+ toggleOption(option) {
190
+ if (this.effectiveDisabled || option.disabled) {
191
+ return;
192
+ }
193
+ this.selectedValues = this.selectedValues.includes(option.value)
194
+ ? this.selectedValues.filter(value => value !== option.value)
195
+ : [...this.selectedValues, option.value];
196
+ this.$emit('input');
197
+ this.$emit('change');
198
+ }
199
+ /** @internal */
200
+ clearSelection() {
201
+ if (this.effectiveDisabled || !this.clearable || this.selectedValues.length === 0) {
202
+ return;
203
+ }
204
+ this.open = false;
205
+ this.selectedValues = [];
206
+ this.control.focus();
207
+ this.$emit('input');
208
+ this.$emit('change');
209
+ }
210
+ /** @internal */
211
+ handleInput(event) {
212
+ this.filter = event.target.value;
213
+ event.stopPropagation();
214
+ }
215
+ /** @internal */
216
+ handleControlKeydown(event) {
217
+ this.keyboardNavigation = true;
218
+ if (event.key === 'Escape' && !this.open) {
219
+ this.clearSelection();
220
+ }
221
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
222
+ this.open = !this.effectiveDisabled;
223
+ if (event.key === 'ArrowUp') {
224
+ this.moveActiveOption(-1, true);
225
+ }
226
+ return false;
227
+ }
228
+ return true;
229
+ }
230
+ /** @internal */
231
+ handlePopupKeydown(event) {
232
+ if (event.isComposing) {
233
+ return true;
234
+ }
235
+ if (event.key === 'Escape' || event.key === 'Tab') {
236
+ this.open = false;
237
+ // Hide the popup before the browser chooses the next native Tab stop.
238
+ DOM.processUpdates();
239
+ this.control.focus();
240
+ return event.key === 'Tab';
241
+ }
242
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
243
+ this.keyboardNavigation = true;
244
+ this.moveActiveOption(event.key === 'ArrowDown' ? 1 : -1);
245
+ return false;
246
+ }
247
+ const inSearch = event.target === this.filterInput;
248
+ if (!inSearch && (event.key === 'Home' || event.key === 'End')) {
249
+ this.keyboardNavigation = true;
250
+ this.moveActiveOption(event.key === 'Home' ? 1 : -1, true);
251
+ return false;
252
+ }
253
+ if (event.key === 'Enter' || (!inSearch && event.key === ' ')) {
254
+ const option = this.visibleOptions[this.activeIndex];
255
+ if (option) {
256
+ this.toggleOption(option);
257
+ }
258
+ return false;
259
+ }
260
+ return true;
261
+ }
262
+ /** @internal */
263
+ handleFocusout(event) {
264
+ const next = event.relatedTarget;
265
+ if (!(next instanceof Node)
266
+ || (!this.contains(next) && !this.shadowRoot?.contains(next))) {
267
+ this.open = false;
268
+ }
269
+ }
270
+ resetActiveOption() {
271
+ if (this.$fastController.isConnected) {
272
+ this.activeIndex = this.visibleOptions.findIndex(option => !option.disabled);
273
+ this.scrollActiveOptionIntoView();
274
+ }
275
+ }
276
+ scrollActiveOptionIntoView() {
277
+ requestAnimationFrame(() => {
278
+ if (this.open && this.isConnected) {
279
+ this.shadowRoot?.getElementById(this.activeOptionId ?? '')?.scrollIntoView({ block: 'nearest' });
280
+ }
281
+ });
282
+ }
283
+ syncFormValue() {
284
+ if (!this.$fastController.isConnected) {
285
+ return;
286
+ }
287
+ this.proxy.required = this.required;
288
+ this.proxy.disabled = this.effectiveDisabled;
289
+ this.proxy.replaceChildren(...this.selectedValues.map(value => new Option(value, value, false, true)));
290
+ const data = new FormData();
291
+ if (this.name) {
292
+ for (const value of this.selectedValues) {
293
+ data.append(this.name, value);
294
+ }
295
+ }
296
+ this.setFormValue(this.effectiveDisabled ? null : data);
297
+ this.validate();
298
+ }
299
+ moveActiveOption(direction, fromEdge = false) {
300
+ const options = this.visibleOptions;
301
+ let index = this.activeIndex;
302
+ if (fromEdge) {
303
+ index = direction > 0 ? -1 : options.length;
304
+ }
305
+ for (index += direction; index >= 0 && index < options.length; index += direction) {
306
+ if (!options[index].disabled) {
307
+ this.activeIndex = index;
308
+ this.scrollActiveOptionIntoView();
309
+ break;
310
+ }
311
+ }
312
+ }
313
+ }
314
+ __decorate([
315
+ attr
316
+ ], FvMultiSelect.prototype, "appearance", void 0);
317
+ __decorate([
318
+ attr
319
+ ], FvMultiSelect.prototype, "label", void 0);
320
+ __decorate([
321
+ attr
322
+ ], FvMultiSelect.prototype, "placeholder", void 0);
323
+ __decorate([
324
+ attr({ mode: 'boolean' })
325
+ ], FvMultiSelect.prototype, "filterable", void 0);
326
+ __decorate([
327
+ attr({ mode: 'boolean' })
328
+ ], FvMultiSelect.prototype, "clearable", void 0);
329
+ __decorate([
330
+ attr({ mode: 'boolean' })
331
+ ], FvMultiSelect.prototype, "open", void 0);
332
+ __decorate([
333
+ observable
334
+ ], FvMultiSelect.prototype, "options", void 0);
335
+ __decorate([
336
+ observable
337
+ ], FvMultiSelect.prototype, "selectedValues", void 0);
338
+ __decorate([
339
+ observable
340
+ ], FvMultiSelect.prototype, "filter", void 0);
341
+ __decorate([
342
+ observable
343
+ ], FvMultiSelect.prototype, "activeIndex", void 0);
344
+ __decorate([
345
+ observable
346
+ ], FvMultiSelect.prototype, "keyboardNavigation", void 0);
347
+ __decorate([
348
+ observable
349
+ ], FvMultiSelect.prototype, "formDisabled", void 0);
350
+ __decorate([
351
+ volatile
352
+ ], FvMultiSelect.prototype, "effectiveDisabled", null);
353
+ __decorate([
354
+ volatile
355
+ ], FvMultiSelect.prototype, "activeOptionId", null);
356
+ const okFvMultiSelect = FvMultiSelect.compose({
357
+ baseName: 'fv-multi-select',
358
+ baseClass: FormAssociatedMultiSelect,
359
+ template,
360
+ styles,
361
+ shadowOptions: {
362
+ delegatesFocus: true
363
+ }
364
+ });
365
+ DesignSystem.getOrCreate().withPrefix('ok').register(okFvMultiSelect());
366
+ export const fvMultiSelectTag = 'ok-fv-multi-select';
367
+ //# sourceMappingURL=index.js.map