@genesislcap/foundation-ui 14.447.1 → 14.448.0-canary.wealth

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 (31) hide show
  1. package/dist/custom-elements.json +1534 -962
  2. package/dist/dts/date-picker/date-picker.d.ts +63 -0
  3. package/dist/dts/date-picker/date-picker.d.ts.map +1 -1
  4. package/dist/dts/date-picker/date-picker.template.d.ts.map +1 -1
  5. package/dist/dts/date-picker/date-picker.util.d.ts +37 -0
  6. package/dist/dts/date-picker/date-picker.util.d.ts.map +1 -0
  7. package/dist/dts/date-picker/index.d.ts +1 -0
  8. package/dist/dts/date-picker/index.d.ts.map +1 -1
  9. package/dist/dts/react.d.ts +9 -20
  10. package/dist/dts/search-bar/search-bar-combobox.d.ts +5 -6
  11. package/dist/dts/search-bar/search-bar-combobox.d.ts.map +1 -1
  12. package/dist/dts/search-bar/search-bar-combobox.styles.d.ts.map +1 -1
  13. package/dist/dts/search-bar/search-bar.d.ts +31 -0
  14. package/dist/dts/search-bar/search-bar.d.ts.map +1 -1
  15. package/dist/dts/search-bar/search-bar.styles.d.ts.map +1 -1
  16. package/dist/dts/search-bar/search-bar.template.d.ts.map +1 -1
  17. package/dist/dts/search-bar/search-bar.types.d.ts +1 -1
  18. package/dist/dts/search-bar/search-bar.types.d.ts.map +1 -1
  19. package/dist/esm/date-picker/date-picker.js +264 -17
  20. package/dist/esm/date-picker/date-picker.template.js +9 -1
  21. package/dist/esm/date-picker/date-picker.util.js +92 -0
  22. package/dist/esm/date-picker/index.js +1 -0
  23. package/dist/esm/search-bar/search-bar-combobox.js +31 -1
  24. package/dist/esm/search-bar/search-bar-combobox.styles.js +15 -0
  25. package/dist/esm/search-bar/search-bar-combobox.template.js +1 -1
  26. package/dist/esm/search-bar/search-bar.js +81 -1
  27. package/dist/esm/search-bar/search-bar.styles.js +0 -17
  28. package/dist/esm/search-bar/search-bar.template.js +27 -26
  29. package/dist/react.cjs +6 -25
  30. package/dist/react.mjs +5 -23
  31. package/package.json +19 -19
@@ -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');
@@ -102,6 +101,11 @@ function _mergeRefs(...refs) {
102
101
  };
103
102
  }
104
103
 
104
+ const Accordion = React.forwardRef(function Accordion(props, ref) {
105
+ const { children, ...rest } = props;
106
+ return React.createElement(customElements.getName(AccordionWC) ?? '%%prefix%%-accordion', { ...rest, ref }, children);
107
+ });
108
+
105
109
  const AccordionItem = React.forwardRef(function AccordionItem(props, ref) {
106
110
  const { children, ...rest } = props;
107
111
  return React.createElement(customElements.getName(AccordionItemWC) ?? '%%prefix%%-accordion-item', { ...rest, ref }, children);
@@ -134,11 +138,6 @@ const AiCriteriaSearch = React.forwardRef(function AiCriteriaSearch(props, ref)
134
138
  return React.createElement(customElements.getName(AiCriteriaSearchWC) ?? '%%prefix%%-ai-criteria-search', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
135
139
  });
136
140
 
137
- const Accordion = React.forwardRef(function Accordion(props, ref) {
138
- const { children, ...rest } = props;
139
- return React.createElement(customElements.getName(AccordionWC) ?? '%%prefix%%-accordion', { ...rest, ref }, children);
140
- });
141
-
142
141
  const AiIndicator = React.forwardRef(function AiIndicator(props, ref) {
143
142
  const { children, ...rest } = props;
144
143
  return React.createElement(customElements.getName(AiIndicatorWC) ?? '%%prefix%%-ai-indicator', { ...rest, ref }, children);
@@ -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);
@@ -877,10 +859,10 @@ const UrlInput = React.forwardRef(function UrlInput(props, ref) {
877
859
  });
878
860
 
879
861
  module.exports = {
862
+ Accordion,
880
863
  AccordionItem,
881
864
  ActionsMenu,
882
865
  AiCriteriaSearch,
883
- Accordion,
884
866
  AiIndicator,
885
867
  Anchor,
886
868
  AnchoredRegion,
@@ -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';
@@ -100,6 +99,11 @@ function _mergeRefs(...refs) {
100
99
  };
101
100
  }
102
101
 
102
+ export const Accordion = React.forwardRef(function Accordion(props, ref) {
103
+ const { children, ...rest } = props;
104
+ return React.createElement(customElements.getName(AccordionWC) ?? '%%prefix%%-accordion', { ...rest, ref }, children);
105
+ });
106
+
103
107
  export const AccordionItem = React.forwardRef(function AccordionItem(props, ref) {
104
108
  const { children, ...rest } = props;
105
109
  return React.createElement(customElements.getName(AccordionItemWC) ?? '%%prefix%%-accordion-item', { ...rest, ref }, children);
@@ -132,11 +136,6 @@ export const AiCriteriaSearch = React.forwardRef(function AiCriteriaSearch(props
132
136
  return React.createElement(customElements.getName(AiCriteriaSearchWC) ?? '%%prefix%%-ai-criteria-search', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
133
137
  });
134
138
 
135
- export const Accordion = React.forwardRef(function Accordion(props, ref) {
136
- const { children, ...rest } = props;
137
- return React.createElement(customElements.getName(AccordionWC) ?? '%%prefix%%-accordion', { ...rest, ref }, children);
138
- });
139
-
140
139
  export const AiIndicator = React.forwardRef(function AiIndicator(props, ref) {
141
140
  const { children, ...rest } = props;
142
141
  return React.createElement(customElements.getName(AiIndicatorWC) ?? '%%prefix%%-ai-indicator', { ...rest, ref }, children);
@@ -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);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ui",
3
3
  "description": "Genesis Foundation UI",
4
- "version": "14.447.1",
4
+ "version": "14.448.0-canary.wealth",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -85,13 +85,13 @@
85
85
  }
86
86
  },
87
87
  "devDependencies": {
88
- "@genesislcap/foundation-testing": "14.447.1",
89
- "@genesislcap/genx": "14.447.1",
90
- "@genesislcap/rollup-builder": "14.447.1",
91
- "@genesislcap/ts-builder": "14.447.1",
92
- "@genesislcap/uvu-playwright-builder": "14.447.1",
93
- "@genesislcap/vite-builder": "14.447.1",
94
- "@genesislcap/webpack-builder": "14.447.1",
88
+ "@genesislcap/foundation-testing": "14.448.0-canary.wealth",
89
+ "@genesislcap/genx": "14.448.0-canary.wealth",
90
+ "@genesislcap/rollup-builder": "14.448.0-canary.wealth",
91
+ "@genesislcap/ts-builder": "14.448.0-canary.wealth",
92
+ "@genesislcap/uvu-playwright-builder": "14.448.0-canary.wealth",
93
+ "@genesislcap/vite-builder": "14.448.0-canary.wealth",
94
+ "@genesislcap/webpack-builder": "14.448.0-canary.wealth",
95
95
  "copyfiles": "^2.4.1"
96
96
  },
97
97
  "dependencies": {
@@ -100,16 +100,16 @@
100
100
  "@fortawesome/free-regular-svg-icons": "^6.2.1",
101
101
  "@fortawesome/free-solid-svg-icons": "^6.2.1",
102
102
  "@genesiscommunitysuccess/analyzer-import-alias-plugin": "^5.0.3",
103
- "@genesislcap/expression-builder": "14.447.1",
104
- "@genesislcap/foundation-ai": "14.447.1",
105
- "@genesislcap/foundation-comms": "14.447.1",
106
- "@genesislcap/foundation-criteria": "14.447.1",
107
- "@genesislcap/foundation-errors": "14.447.1",
108
- "@genesislcap/foundation-events": "14.447.1",
109
- "@genesislcap/foundation-logger": "14.447.1",
110
- "@genesislcap/foundation-notifications": "14.447.1",
111
- "@genesislcap/foundation-user": "14.447.1",
112
- "@genesislcap/foundation-utils": "14.447.1",
103
+ "@genesislcap/expression-builder": "14.448.0-canary.wealth",
104
+ "@genesislcap/foundation-ai": "14.448.0-canary.wealth",
105
+ "@genesislcap/foundation-comms": "14.448.0-canary.wealth",
106
+ "@genesislcap/foundation-criteria": "14.448.0-canary.wealth",
107
+ "@genesislcap/foundation-errors": "14.448.0-canary.wealth",
108
+ "@genesislcap/foundation-events": "14.448.0-canary.wealth",
109
+ "@genesislcap/foundation-logger": "14.448.0-canary.wealth",
110
+ "@genesislcap/foundation-notifications": "14.448.0-canary.wealth",
111
+ "@genesislcap/foundation-user": "14.448.0-canary.wealth",
112
+ "@genesislcap/foundation-utils": "14.448.0-canary.wealth",
113
113
  "@microsoft/fast-colors": "5.3.1",
114
114
  "@microsoft/fast-components": "2.30.6",
115
115
  "@microsoft/fast-element": "1.14.0",
@@ -142,5 +142,5 @@
142
142
  "require": "./dist/react.cjs"
143
143
  }
144
144
  },
145
- "gitHead": "e265cb98c173fe6e51a94b5f31e653384c4f2d8e"
145
+ "gitHead": "dd463812d10b19835162f58c2c04624fe52c6a36"
146
146
  }