@genesislcap/foundation-ui 14.447.1 → 14.448.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.
@@ -64,7 +64,6 @@ import type { Radio as RadioWC } from './radio/radio';
64
64
  import type { SchedulerCronBuilder as SchedulerCronBuilderWC } from './scheduler-cron-builder/scheduler-cron-builder';
65
65
  import type { SchedulerTimezone as SchedulerTimezoneWC } from './scheduler-timezone/scheduler-timezone';
66
66
  import type { Scheduler as SchedulerWC } from './scheduler/scheduler';
67
- import type { SearchBarCombobox as SearchBarComboboxWC } from './search-bar/search-bar-combobox';
68
67
  import type { SearchBar as SearchBarWC } from './search-bar/search-bar';
69
68
  import type { SectionNavigator as SectionNavigatorWC } from './section-navigator/section-navigator';
70
69
  import type { SegmentedControl as SegmentedControlWC } from './segmented-control/segmented-control';
@@ -149,23 +148,23 @@ export declare const AiCriteriaSearch: React.ForwardRefExoticComponent<
149
148
  >;
150
149
  export type AiCriteriaSearchRef = AiCriteriaSearchWC;
151
150
 
152
- export declare const Accordion: React.ForwardRefExoticComponent<
151
+ export declare const AiIndicator: React.ForwardRefExoticComponent<
153
152
  React.PropsWithChildren<
154
- Omit<PublicOf<AccordionWC>, 'children' | 'style'> &
153
+ Omit<PublicOf<AiIndicatorWC>, 'children' | 'style'> &
155
154
  HTMLWCProps & {
156
155
  }
157
- > & React.RefAttributes<AccordionWC>
156
+ > & React.RefAttributes<AiIndicatorWC>
158
157
  >;
159
- export type AccordionRef = AccordionWC;
158
+ export type AiIndicatorRef = AiIndicatorWC;
160
159
 
161
- export declare const AiIndicator: React.ForwardRefExoticComponent<
160
+ export declare const Accordion: React.ForwardRefExoticComponent<
162
161
  React.PropsWithChildren<
163
- Omit<PublicOf<AiIndicatorWC>, 'children' | 'style'> &
162
+ Omit<PublicOf<AccordionWC>, 'children' | 'style'> &
164
163
  HTMLWCProps & {
165
164
  }
166
- > & React.RefAttributes<AiIndicatorWC>
165
+ > & React.RefAttributes<AccordionWC>
167
166
  >;
168
- export type AiIndicatorRef = AiIndicatorWC;
167
+ export type AccordionRef = AccordionWC;
169
168
 
170
169
  export declare const Anchor: React.ForwardRefExoticComponent<
171
170
  React.PropsWithChildren<
@@ -685,16 +684,6 @@ export declare const SchedulerTimezone: React.ForwardRefExoticComponent<
685
684
  >;
686
685
  export type SchedulerTimezoneRef = SchedulerTimezoneWC;
687
686
 
688
- export declare const SearchBarCombobox: React.ForwardRefExoticComponent<
689
- React.PropsWithChildren<
690
- Omit<PublicOf<SearchBarComboboxWC>, 'children' | 'style'> &
691
- HTMLWCProps & {
692
- onInputdeleted?: (event: CustomEvent<unknown>) => void;
693
- }
694
- > & React.RefAttributes<SearchBarComboboxWC>
695
- >;
696
- export type SearchBarComboboxRef = SearchBarComboboxWC;
697
-
698
687
  export declare const SearchBar: React.ForwardRefExoticComponent<
699
688
  React.PropsWithChildren<
700
689
  Omit<PublicOf<SearchBarWC>, 'children' | 'style'> &
@@ -1,12 +1,11 @@
1
1
  import { Combobox } from '@microsoft/fast-components';
2
- /**
3
- * @tagname %%prefix%%-search-bar-combobox
4
- *
5
- * @fires change - Fired when the combobox value changes
6
- * @fires inputdeleted - Fired when the input is cleared by the user
7
- */
8
2
  export declare class SearchBarCombobox extends Combobox {
9
3
  minlength: number;
4
+ /**
5
+ * When true, the user cannot type a new search term (e.g. all fields already have chips).
6
+ * @internal
7
+ */
8
+ inputLocked: boolean;
10
9
  private previousLength;
11
10
  private changeListener;
12
11
  connectedCallback(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"search-bar-combobox.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar-combobox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAOtD;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IACvC,SAAS,EAAE,MAAM,CAA0B;IAEjD,OAAO,CAAC,cAAc,CAAc;IAEpC,OAAO,CAAC,cAAc,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
- {"version":3,"file":"search-bar-combobox.styles.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar-combobox.styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AAGpC,eAAO,MAAM,iCAAiC,GAC5C,SAAS,wBAAwB,EACjC,YAAY,2BAA2B,KACtC,aAsBF,CAAC"}
1
+ {"version":3,"file":"search-bar-combobox.styles.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar-combobox.styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EACV,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AAGpC,eAAO,MAAM,iCAAiC,GAC5C,SAAS,wBAAwB,EACjC,YAAY,2BAA2B,KACtC,aAqCF,CAAC"}
@@ -17,12 +17,43 @@ export declare class SearchBar extends FoundationElement {
17
17
  position: Position;
18
18
  placeholder: string;
19
19
  disabled: boolean;
20
+ /**
21
+ * @attr clear-button - when true, shows the end clear control when there are chips or typed text. When false, use {@link SearchBar.clear} or {@link SearchBar.clearSearch} to reset programmatically.
22
+ * @default true
23
+ */
24
+ clearButton: boolean;
20
25
  loading: boolean;
21
26
  selectedOptions: SelectedOption[];
22
27
  filteredOptions: AvailableOption[];
23
28
  selectedOptionsDiv: HTMLDivElement;
29
+ /**
30
+ * Clears all search chips and the current input, and emits `selectionChange` with an empty array.
31
+ * @public
32
+ */
24
33
  clear(): void;
34
+ /**
35
+ * Alias for {@link SearchBar.clear}.
36
+ * @public
37
+ */
25
38
  clearSearch(): void;
39
+ /**
40
+ * @internal
41
+ */
42
+ get showClearAffordance(): boolean;
43
+ /**
44
+ * True when every configured search field already has a chip (one term per field).
45
+ * @internal
46
+ */
47
+ get allSearchFieldsUsed(): boolean;
48
+ /**
49
+ * Evaluates whether an option is currently selectable.
50
+ * Falls back to default behavior when no custom `isEnabled` is provided.
51
+ * @internal
52
+ */
53
+ isOptionEnabled(option: AvailableOption): boolean;
54
+ selectedOptionsChanged(): void;
55
+ optionsChanged(): void;
56
+ private applySearchInputLock;
26
57
  inputdeleted(): void;
27
58
  changeHandler(): void;
28
59
  pasteHandler(event: ClipboardEvent): void;
@@ -1 +1 @@
1
- {"version":3,"file":"search-bar.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,EACL,eAAe,EACf,cAAc,EAGf,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IACvC,QAAQ,EAAE,iBAAiB,CAAC;IACvB,mBAAmB,MAAC;IAEpB,OAAO,EAAE,eAAe,EAAE,CAAC;IAE3B,UAAU,EAAE,MAAM,CAAM;IAE9B,UAAU,EAAE,MAAM,CAAa;IAC/B,SAAS,EAAE,MAAM,CAAoB;IACrC,QAAQ,EAAE,QAAQ,CAAkB;IAEpC,WAAW,EAAE,MAAM,CAA4B;IAC/C,QAAQ,EAAE,OAAO,CAAC;IAEZ,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,cAAc,EAAE,CAAM;IACvC,eAAe,EAAE,eAAe,EAAE,CAAC;IAExC,kBAAkB,EAAE,cAAc,CAAC;IAEnC,KAAK;IAML,WAAW,IAAI,IAAI;IAInB,YAAY;IAMZ,aAAa;IAyCb,YAAY,CAAC,KAAK,EAAE,cAAc;IAclC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAM7C,cAAc,CAAC,MAAM,EAAE,GAAG;IAKpB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,IAAI,OAAO,CAOjC;IAED;;;;OAIG;IACH,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO;IAUjD,sBAAsB;IAItB,cAAc;IAId,OAAO,CAAC,oBAAoB;IAarB,YAAY;IAMZ,aAAa;IAyCb,YAAY,CAAC,KAAK,EAAE,cAAc;IAkBlC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAM7C,cAAc,CAAC,MAAM,EAAE,GAAG;IAKpB,YAAY;IAazB,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,kBAAkB,CAExB;IAEF,OAAO,CAAC,wBAAwB,CAQ9B;CACH;AAGD,eAAO,MAAM,gCAAgC,EAAE,cAA0B,CAAC;AAE1E,eAAO,MAAM,sBAAsB,IAAK,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;oBAM9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search-bar.styles.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,iDA6FrC,CAAC"}
1
+ {"version":3,"file":"search-bar.styles.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,iDA4ErC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search-bar.template.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,eAAO,MAAM,SAAS,GAAI,aAAc,WAMvC,CAAC;AAEF,eAAO,MAAM,QAAQ,cAGd,CAAC;AAER,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,mEA0FlD,CAAC;AAEF,eAAO,MAAM,2BAA2B,gEAEvC,CAAC"}
1
+ {"version":3,"file":"search-bar.template.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,eAAO,MAAM,SAAS,GAAI,aAAc,WAMvC,CAAC;AAEF,eAAO,MAAM,QAAQ,cAGd,CAAC;AAER,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,mEA8FlD,CAAC;AAEF,eAAO,MAAM,2BAA2B,gEAEvC,CAAC"}
@@ -15,7 +15,7 @@ export type AvailableOption<T extends string = string> = {
15
15
  label: (searchTerm: string) => string;
16
16
  resourceType?: ResourceType;
17
17
  createCriteria: CriteriaCreator;
18
- isEnabled: (searchTerm: string, selectedOptions: SelectedOption[]) => boolean;
18
+ isEnabled?: (searchTerm: string, selectedOptions: SelectedOption[], minLength?: number) => boolean;
19
19
  };
20
20
  export declare const getCriteriaBuilder: CriteriaCreator;
21
21
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"search-bar.types.d.ts","sourceRoot":"","sources":["../../../src/search-bar/search-bar.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,KAAK,eAAe,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAEpF,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IACtD,KAAK,EAAE,CAAC,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,cAAc,EAAE,eAAe,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,M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c,EAAE,EACjC,SAAS,CAAC,EAAE,MAAM,KACf,OAAO,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAUhC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { Combobox } from '@microsoft/fast-components';
3
- import { attr } from '@microsoft/fast-element';
3
+ import { attr, observable } from '@microsoft/fast-element';
4
4
  import { foundationSearchBarComboboxStyles } from './search-bar-combobox.styles';
5
5
  import { foundationSearchBarComboboxTemplate } from './search-bar-combobox.template';
6
6
  import { COMBO_INPUT_MIN_LENGTH } from './search-bar.types';
@@ -10,6 +10,18 @@ import { COMBO_INPUT_MIN_LENGTH } from './search-bar.types';
10
10
  * @fires change - Fired when the combobox value changes
11
11
  * @fires inputdeleted - Fired when the input is cleared by the user
12
12
  */
13
+ const INPUT_LOCK_ALLOWED_KEYS = new Set([
14
+ 'Backspace',
15
+ 'Delete',
16
+ 'Tab',
17
+ 'Escape',
18
+ 'ArrowUp',
19
+ 'ArrowDown',
20
+ 'ArrowLeft',
21
+ 'ArrowRight',
22
+ 'Home',
23
+ 'End',
24
+ ]);
13
25
  export class SearchBarCombobox extends Combobox {
14
26
  constructor() {
15
27
  super(...arguments);
@@ -70,6 +82,14 @@ export class SearchBarCombobox extends Combobox {
70
82
  }
71
83
  keydownHandler(e) {
72
84
  const key = e.key;
85
+ if (this.inputLocked) {
86
+ const isModifier = e.ctrlKey || e.metaKey || e.altKey;
87
+ const isAllowed = INPUT_LOCK_ALLOWED_KEYS.has(key) || isModifier;
88
+ if (!isAllowed) {
89
+ e.preventDefault();
90
+ return false;
91
+ }
92
+ }
73
93
  switch (key) {
74
94
  case 'ArrowUp':
75
95
  case 'ArrowDown': {
@@ -103,6 +123,13 @@ export class SearchBarCombobox extends Combobox {
103
123
  }
104
124
  }
105
125
  inputHandler(e) {
126
+ if (this.inputLocked) {
127
+ this.control.value = '';
128
+ this.value = '';
129
+ this.open = false;
130
+ e.stopImmediatePropagation();
131
+ return;
132
+ }
106
133
  if (this.control.value.length >= this.minlength) {
107
134
  this.open = true;
108
135
  }
@@ -128,6 +155,9 @@ export class SearchBarCombobox extends Combobox {
128
155
  __decorate([
129
156
  attr
130
157
  ], SearchBarCombobox.prototype, "minlength", void 0);
158
+ __decorate([
159
+ observable
160
+ ], SearchBarCombobox.prototype, "inputLocked", void 0);
131
161
  export const foundationSearchBarComboboxShadowOptions = {
132
162
  delegatesFocus: true,
133
163
  mode: 'open',
@@ -23,4 +23,19 @@ export const foundationSearchBarComboboxStyles = (context, definition) => css `
23
23
  min-width: 150px;
24
24
  max-width: 169px;
25
25
  }
26
+
27
+ .input-locked .control,
28
+ :host(.input-locked) .control {
29
+ width: 0;
30
+ min-width: 0;
31
+ padding: 0;
32
+ margin: 0;
33
+ overflow: hidden;
34
+ flex: 0;
35
+ }
36
+
37
+ .input-locked .selected-value,
38
+ :host(.input-locked) .selected-value {
39
+ display: none;
40
+ }
26
41
  `;
@@ -4,7 +4,7 @@ export const foundationSearchBarComboboxTemplate = (context, definition) => html
4
4
  <template
5
5
  aria-disabled="${(x) => x.ariaDisabled}"
6
6
  autocomplete="${(x) => x.autocomplete}"
7
- class="${(x) => (x.open ? 'open' : '')} ${(x) => (x.disabled ? 'disabled' : '')} ${(x) => x.position} body"
7
+ class="${(x) => (x.open ? 'open' : '')} ${(x) => (x.disabled ? 'disabled' : '')} ${(x) => x.position} ${(x) => (x.inputLocked ? 'input-locked' : '')} body"
8
8
  ?open="${(x) => x.open}"
9
9
  tabindex="${(x) => (!x.disabled ? '0' : null)}"
10
10
  @click="${(x, c) => x.clickHandler(c.event)}"
@@ -18,6 +18,11 @@ export class SearchBar extends FoundationElement {
18
18
  this.minlength = INPUT_MIN_LENGTH;
19
19
  this.position = Position.BELOW;
20
20
  this.placeholder = 'Start typing to search';
21
+ /**
22
+ * @attr clear-button - when true, shows the end clear control when there are chips or typed text. When false, use {@link SearchBar.clear} or {@link SearchBar.clearSearch} to reset programmatically.
23
+ * @default true
24
+ */
25
+ this.clearButton = true;
21
26
  this.selectedOptions = [];
22
27
  this.normalizeDelimiter = (inputString) => {
23
28
  return inputString.trim().replace(/\t|\r\n|\n|\r|,/g, ' ');
@@ -28,14 +33,78 @@ export class SearchBar extends FoundationElement {
28
33
  : previousText.concat(newText);
29
34
  };
30
35
  }
36
+ /**
37
+ * Clears all search chips and the current input, and emits `selectionChange` with an empty array.
38
+ * @public
39
+ */
31
40
  clear() {
32
41
  this.selectedOptions = [];
33
- this.combobox.currentValue = '';
42
+ this.searchTerm = '';
43
+ if (this.combobox) {
44
+ this.combobox.currentValue = '';
45
+ this.combobox.value = '';
46
+ }
34
47
  this.$emit('selectionChange', []);
35
48
  }
49
+ /**
50
+ * Alias for {@link SearchBar.clear}.
51
+ * @public
52
+ */
36
53
  clearSearch() {
37
54
  this.clear();
38
55
  }
56
+ /**
57
+ * @internal
58
+ */
59
+ get showClearAffordance() {
60
+ var _a, _b, _c;
61
+ if (!this.clearButton) {
62
+ return false;
63
+ }
64
+ const typed = ((_c = (_a = this.searchTerm) !== null && _a !== void 0 ? _a : (_b = this.combobox) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : '').trim();
65
+ return this.selectedOptions.length > 0 || typed.length > 0;
66
+ }
67
+ /**
68
+ * True when every configured search field already has a chip (one term per field).
69
+ * @internal
70
+ */
71
+ get allSearchFieldsUsed() {
72
+ var _a;
73
+ if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.length)) {
74
+ return false;
75
+ }
76
+ return this.options.every((option) => this.selectedOptions.some((selected) => selected.field === option.field));
77
+ }
78
+ /**
79
+ * Evaluates whether an option is currently selectable.
80
+ * Falls back to default behavior when no custom `isEnabled` is provided.
81
+ * @internal
82
+ */
83
+ isOptionEnabled(option) {
84
+ if (option.isEnabled) {
85
+ return option.isEnabled(this.searchTerm, this.selectedOptions, this.minlength);
86
+ }
87
+ return (this.searchTerm.length >= this.minlength &&
88
+ !this.selectedOptions.some((selected) => selected.field === option.field));
89
+ }
90
+ selectedOptionsChanged() {
91
+ this.applySearchInputLock();
92
+ }
93
+ optionsChanged() {
94
+ this.applySearchInputLock();
95
+ }
96
+ applySearchInputLock() {
97
+ if (!this.combobox) {
98
+ return;
99
+ }
100
+ if (this.allSearchFieldsUsed) {
101
+ this.searchTerm = '';
102
+ this.combobox.value = '';
103
+ this.combobox.currentValue = '';
104
+ this.combobox.open = false;
105
+ this.filteredOptions = [];
106
+ }
107
+ }
39
108
  inputdeleted() {
40
109
  if (this.selectedOptions.length > 0) {
41
110
  this.unselectOption(this.selectedOptions[this.selectedOptions.length - 1]);
@@ -70,6 +139,10 @@ export class SearchBar extends FoundationElement {
70
139
  }
71
140
  pasteHandler(event) {
72
141
  var _a;
142
+ if (this.allSearchFieldsUsed) {
143
+ event.preventDefault();
144
+ return;
145
+ }
73
146
  this.loading = true;
74
147
  const pastedText = event.clipboardData.getData('text/plain');
75
148
  const formattedText = this.normalizeDelimiter(pastedText);
@@ -93,6 +166,10 @@ export class SearchBar extends FoundationElement {
93
166
  }
94
167
  inputHandler() {
95
168
  return __awaiter(this, void 0, void 0, function* () {
169
+ if (this.allSearchFieldsUsed) {
170
+ this.applySearchInputLock();
171
+ return;
172
+ }
96
173
  this.loading = true;
97
174
  this.searchTerm = this.combobox.value;
98
175
  if (this.combobox.value.length >= this.minlength) {
@@ -129,6 +206,9 @@ __decorate([
129
206
  __decorate([
130
207
  attr
131
208
  ], SearchBar.prototype, "disabled", void 0);
209
+ __decorate([
210
+ attr({ attribute: 'clear-button', mode: 'boolean' })
211
+ ], SearchBar.prototype, "clearButton", void 0);
132
212
  __decorate([
133
213
  observable
134
214
  ], SearchBar.prototype, "loading", void 0);
@@ -73,23 +73,6 @@ export const foundationSearchBarStyles = css `
73
73
  justify-content: center;
74
74
  }
75
75
 
76
- .tooltip {
77
- position: absolute;
78
- z-index: 999;
79
- }
80
-
81
- .tooltip::part(tooltip) {
82
- background-color: rgb(18 18 18 / 100%);
83
- border: 1px solid #2e3339;
84
- display: flex;
85
- justify-content: center;
86
- align-items: center;
87
- box-shadow: 0 4px 10px rgb(0 0 0 / 25%);
88
- font-size: 10px;
89
- color: #f1f1f1;
90
- height: 26px;
91
- }
92
-
93
76
  .close-icon {
94
77
  color: var(--accent-fill-rest);
95
78
  }
@@ -1,4 +1,4 @@
1
- import { html, ref, repeat, slotted } from '@microsoft/fast-element';
1
+ import { html, ref, repeat, slotted, when } from '@microsoft/fast-element';
2
2
  import { whitespaceFilter } from '@microsoft/fast-foundation';
3
3
  import { classNames } from '@microsoft/fast-web-utilities';
4
4
  import { getPrefix } from '../utils';
@@ -30,6 +30,7 @@ export const getPrefixedSearchBar = (prefix) => html `
30
30
  position="${(x) => x.position}"
31
31
  placeholder=${(x) => x.placeholder}
32
32
  disabled=${(x) => x.disabled}
33
+ :inputLocked="${(x) => x.allSearchFieldsUsed}"
33
34
  autocomplete="none"
34
35
  minlength=${(x) => x.minlength}
35
36
  @inputdeleted=${(x) => x.inputdeleted()}
@@ -64,37 +65,37 @@ export const getPrefixedSearchBar = (prefix) => html `
64
65
  ${repeat((x) => x.filteredOptions, html `
65
66
  <${prefix}-option
66
67
  value="${(x) => x.field}"
67
- :disabled=${(x, ctx) => !x.isEnabled(ctx.parent.searchTerm, ctx.parent.selectedOptions)}
68
+ :disabled=${(x, ctx) => !ctx.parent.isOptionEnabled(x)}
68
69
  >
69
70
  ${(x, ctx) => x.label(ctx.parent.searchTerm)}
70
71
  </${prefix}-option>
71
72
  `)}
72
- <${prefix}-button
73
- class="search-clear-button"
74
- @click=${(x) => x.clearSearch()}
75
- id="search-clear-button"
76
- slot="end"
77
- data-test-id="clear-search"
78
- >
79
- <div class="svg-container">
80
- <svg
81
- xmlns="http://www.w3.org/2000/svg"
82
- fill="currentColor"
83
- width="26px"
84
- height="26px"
85
- class="bi bi-plus"
86
- viewBox="0 0 16 16"
73
+ ${when((x) => x.showClearAffordance, html `
74
+ <${prefix}-button
75
+ class="search-clear-button"
76
+ @click=${(x) => x.clearSearch()}
77
+ slot="end"
78
+ data-test-id="clear-search"
79
+ aria-label="Clear search terms"
80
+ title="Clear search terms"
87
81
  >
88
- <path
89
- d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"
90
- />
91
- </svg>
92
- </div>
93
- </${prefix}-button>
82
+ <div class="svg-container">
83
+ <svg
84
+ xmlns="http://www.w3.org/2000/svg"
85
+ fill="currentColor"
86
+ width="26px"
87
+ height="26px"
88
+ class="bi bi-plus"
89
+ viewBox="0 0 16 16"
90
+ >
91
+ <path
92
+ d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"
93
+ />
94
+ </svg>
95
+ </div>
96
+ </${prefix}-button>
97
+ `)}
94
98
  </${prefix}-search-bar-combobox>
95
- <${prefix}-tooltip class="tooltip" anchor="search-clear-button">
96
- Clear Search Terms
97
- </${prefix}-tooltip>
98
99
  `;
99
100
  export const foundationSearchBarTemplate = html `
100
101
  ${(x) => getPrefixedSearchBar(getPrefix(x))}
package/dist/react.cjs CHANGED
@@ -66,7 +66,6 @@ const { Radio: RadioWC } = require('./esm/radio/radio.js');
66
66
  const { SchedulerCronBuilder: SchedulerCronBuilderWC } = require('./esm/scheduler-cron-builder/scheduler-cron-builder.js');
67
67
  const { SchedulerTimezone: SchedulerTimezoneWC } = require('./esm/scheduler-timezone/scheduler-timezone.js');
68
68
  const { Scheduler: SchedulerWC } = require('./esm/scheduler/scheduler.js');
69
- const { SearchBarCombobox: SearchBarComboboxWC } = require('./esm/search-bar/search-bar-combobox.js');
70
69
  const { SearchBar: SearchBarWC } = require('./esm/search-bar/search-bar.js');
71
70
  const { SectionNavigator: SectionNavigatorWC } = require('./esm/section-navigator/section-navigator.js');
72
71
  const { SegmentedControl: SegmentedControlWC } = require('./esm/segmented-control/segmented-control.js');
@@ -134,14 +133,14 @@ const AiCriteriaSearch = React.forwardRef(function AiCriteriaSearch(props, ref)
134
133
  return React.createElement(customElements.getName(AiCriteriaSearchWC) ?? '%%prefix%%-ai-criteria-search', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
135
134
  });
136
135
 
137
- const Accordion = React.forwardRef(function Accordion(props, ref) {
136
+ const AiIndicator = React.forwardRef(function AiIndicator(props, ref) {
138
137
  const { children, ...rest } = props;
139
- return React.createElement(customElements.getName(AccordionWC) ?? '%%prefix%%-accordion', { ...rest, ref }, children);
138
+ return React.createElement(customElements.getName(AiIndicatorWC) ?? '%%prefix%%-ai-indicator', { ...rest, ref }, children);
140
139
  });
141
140
 
142
- const AiIndicator = React.forwardRef(function AiIndicator(props, ref) {
141
+ const Accordion = React.forwardRef(function Accordion(props, ref) {
143
142
  const { children, ...rest } = props;
144
- return React.createElement(customElements.getName(AiIndicatorWC) ?? '%%prefix%%-ai-indicator', { ...rest, ref }, children);
143
+ return React.createElement(customElements.getName(AccordionWC) ?? '%%prefix%%-accordion', { ...rest, ref }, children);
145
144
  });
146
145
 
147
146
  const Anchor = React.forwardRef(function Anchor(props, ref) {
@@ -632,23 +631,6 @@ const SchedulerTimezone = React.forwardRef(function SchedulerTimezone(props, ref
632
631
  return React.createElement(customElements.getName(SchedulerTimezoneWC) ?? '%%prefix%%-scheduler-timezone', { ...rest, ref }, children);
633
632
  });
634
633
 
635
- const SearchBarCombobox = React.forwardRef(function SearchBarCombobox(props, ref) {
636
- const { onInputdeleted, children, ...rest } = props;
637
- const _innerRef = React.useRef(null);
638
- const _onInputdeletedRef = React.useRef(onInputdeleted);
639
- _onInputdeletedRef.current = onInputdeleted;
640
- React.useLayoutEffect(() => {
641
- const el = _innerRef.current;
642
- if (!el) return;
643
- const _onInputdeletedFn = (e) => _onInputdeletedRef.current?.(e);
644
- el.addEventListener('inputdeleted', _onInputdeletedFn);
645
- return () => {
646
- el.removeEventListener('inputdeleted', _onInputdeletedFn);
647
- };
648
- }, []);
649
- return React.createElement(customElements.getName(SearchBarComboboxWC) ?? '%%prefix%%-search-bar-combobox', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
650
- });
651
-
652
634
  const SearchBar = React.forwardRef(function SearchBar(props, ref) {
653
635
  const { onSelectionChange, children, ...rest } = props;
654
636
  const _innerRef = React.useRef(null);
@@ -880,8 +862,8 @@ module.exports = {
880
862
  AccordionItem,
881
863
  ActionsMenu,
882
864
  AiCriteriaSearch,
883
- Accordion,
884
865
  AiIndicator,
866
+ Accordion,
885
867
  Anchor,
886
868
  AnchoredRegion,
887
869
  Avatar,
@@ -937,7 +919,6 @@ module.exports = {
937
919
  Scheduler,
938
920
  SchedulerCronBuilder,
939
921
  SchedulerTimezone,
940
- SearchBarCombobox,
941
922
  SearchBar,
942
923
  SectionNavigator,
943
924
  SegmentedControl,
package/dist/react.mjs CHANGED
@@ -64,7 +64,6 @@ import { Radio as RadioWC } from './esm/radio/radio.js';
64
64
  import { SchedulerCronBuilder as SchedulerCronBuilderWC } from './esm/scheduler-cron-builder/scheduler-cron-builder.js';
65
65
  import { SchedulerTimezone as SchedulerTimezoneWC } from './esm/scheduler-timezone/scheduler-timezone.js';
66
66
  import { Scheduler as SchedulerWC } from './esm/scheduler/scheduler.js';
67
- import { SearchBarCombobox as SearchBarComboboxWC } from './esm/search-bar/search-bar-combobox.js';
68
67
  import { SearchBar as SearchBarWC } from './esm/search-bar/search-bar.js';
69
68
  import { SectionNavigator as SectionNavigatorWC } from './esm/section-navigator/section-navigator.js';
70
69
  import { SegmentedControl as SegmentedControlWC } from './esm/segmented-control/segmented-control.js';
@@ -132,14 +131,14 @@ export const AiCriteriaSearch = React.forwardRef(function AiCriteriaSearch(props
132
131
  return React.createElement(customElements.getName(AiCriteriaSearchWC) ?? '%%prefix%%-ai-criteria-search', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
133
132
  });
134
133
 
135
- export const Accordion = React.forwardRef(function Accordion(props, ref) {
134
+ export const AiIndicator = React.forwardRef(function AiIndicator(props, ref) {
136
135
  const { children, ...rest } = props;
137
- return React.createElement(customElements.getName(AccordionWC) ?? '%%prefix%%-accordion', { ...rest, ref }, children);
136
+ return React.createElement(customElements.getName(AiIndicatorWC) ?? '%%prefix%%-ai-indicator', { ...rest, ref }, children);
138
137
  });
139
138
 
140
- export const AiIndicator = React.forwardRef(function AiIndicator(props, ref) {
139
+ export const Accordion = React.forwardRef(function Accordion(props, ref) {
141
140
  const { children, ...rest } = props;
142
- return React.createElement(customElements.getName(AiIndicatorWC) ?? '%%prefix%%-ai-indicator', { ...rest, ref }, children);
141
+ return React.createElement(customElements.getName(AccordionWC) ?? '%%prefix%%-accordion', { ...rest, ref }, children);
143
142
  });
144
143
 
145
144
  export const Anchor = React.forwardRef(function Anchor(props, ref) {
@@ -630,23 +629,6 @@ export const SchedulerTimezone = React.forwardRef(function SchedulerTimezone(pro
630
629
  return React.createElement(customElements.getName(SchedulerTimezoneWC) ?? '%%prefix%%-scheduler-timezone', { ...rest, ref }, children);
631
630
  });
632
631
 
633
- export const SearchBarCombobox = React.forwardRef(function SearchBarCombobox(props, ref) {
634
- const { onInputdeleted, children, ...rest } = props;
635
- const _innerRef = React.useRef(null);
636
- const _onInputdeletedRef = React.useRef(onInputdeleted);
637
- _onInputdeletedRef.current = onInputdeleted;
638
- React.useLayoutEffect(() => {
639
- const el = _innerRef.current;
640
- if (!el) return;
641
- const _onInputdeletedFn = (e) => _onInputdeletedRef.current?.(e);
642
- el.addEventListener('inputdeleted', _onInputdeletedFn);
643
- return () => {
644
- el.removeEventListener('inputdeleted', _onInputdeletedFn);
645
- };
646
- }, []);
647
- return React.createElement(customElements.getName(SearchBarComboboxWC) ?? '%%prefix%%-search-bar-combobox', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
648
- });
649
-
650
632
  export const SearchBar = React.forwardRef(function SearchBar(props, ref) {
651
633
  const { onSelectionChange, children, ...rest } = props;
652
634
  const _innerRef = React.useRef(null);