@genesislcap/foundation-ui 14.138.1 → 14.139.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.
- package/dist/custom-elements.json +1417 -1
- package/dist/dts/base-components.d.ts +12 -0
- package/dist/dts/base-components.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/search-bar/index.d.ts +8 -0
- package/dist/dts/search-bar/index.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar-combobox.d.ts +27 -0
- package/dist/dts/search-bar/search-bar-combobox.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar-combobox.styles.d.ts +4 -0
- package/dist/dts/search-bar/search-bar-combobox.styles.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar-combobox.template.d.ts +6 -0
- package/dist/dts/search-bar/search-bar-combobox.template.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar.d.ts +52 -0
- package/dist/dts/search-bar/search-bar.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar.styles.d.ts +2 -0
- package/dist/dts/search-bar/search-bar.styles.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar.template.d.ts +6 -0
- package/dist/dts/search-bar/search-bar.template.d.ts.map +1 -0
- package/dist/dts/search-bar/search-bar.types.d.ts +19 -0
- package/dist/dts/search-bar/search-bar.types.d.ts.map +1 -0
- package/dist/esm/base-components.js +4 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/search-bar/index.js +7 -0
- package/dist/esm/search-bar/search-bar-combobox.js +140 -0
- package/dist/esm/search-bar/search-bar-combobox.styles.js +26 -0
- package/dist/esm/search-bar/search-bar-combobox.template.js +60 -0
- package/dist/esm/search-bar/search-bar.js +144 -0
- package/dist/esm/search-bar/search-bar.styles.js +96 -0
- package/dist/esm/search-bar/search-bar.template.js +100 -0
- package/dist/esm/search-bar/search-bar.types.js +13 -0
- package/package.json +10 -10
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { designUnit } from '@microsoft/fast-components';
|
|
2
|
+
import { css } from '@microsoft/fast-element';
|
|
3
|
+
export const foundationSearchBarStyles = css `
|
|
4
|
+
.search-bar-combobox {
|
|
5
|
+
width: 100%;
|
|
6
|
+
min-width: auto;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.padding {
|
|
10
|
+
padding-left: calc(${designUnit} * 1px);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.selected-options {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
gap: calc(${designUnit} * 1px);
|
|
18
|
+
padding-right: calc(${designUnit} * 1px);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.selected-options:hover {
|
|
22
|
+
overflow-x: overlay;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.selected-options::-webkit-scrollbar {
|
|
26
|
+
height: 7px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.selected-options::-webkit-scrollbar-thumb {
|
|
30
|
+
border-radius: 10px;
|
|
31
|
+
box-shadow: inset 0 0 6px rgb(0 0 0 / 30%);
|
|
32
|
+
background-color: #484848;
|
|
33
|
+
border: 1px solid #7e7e7e;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.selected-options-divider {
|
|
37
|
+
border-right: calc(var(--stroke-width) * 1px) solid var(--neutral-fill-rest);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.options-button {
|
|
41
|
+
height: fit-content;
|
|
42
|
+
min-width: fit-content;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.label {
|
|
46
|
+
display: block;
|
|
47
|
+
font-size: var(--type-ramp-base-font-size);
|
|
48
|
+
margin: calc(${designUnit} * 2px) 2px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.label-hidden {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.search-clear-button {
|
|
56
|
+
min-width: 28px;
|
|
57
|
+
min-height: 28px;
|
|
58
|
+
height: 28px;
|
|
59
|
+
margin: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.search-clear-button svg {
|
|
63
|
+
rotate: 45deg;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.search-clear-button::part(control) {
|
|
67
|
+
padding: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.search-clear-button .svg-container {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
}
|
|
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
|
+
.close-icon {
|
|
94
|
+
color: var(--accent-fill-rest);
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { html, ref, repeat, slotted } from '@microsoft/fast-element';
|
|
2
|
+
import { whitespaceFilter } from '@microsoft/fast-foundation';
|
|
3
|
+
import { classNames } from '@microsoft/fast-web-utilities';
|
|
4
|
+
import { getPrefix } from '../utils';
|
|
5
|
+
export const crossIcon = (slot = 'start') => `
|
|
6
|
+
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1" width="10px" height="10px">
|
|
7
|
+
<g transform="matrix(1 0 0 1 -256 -14 )">
|
|
8
|
+
<path class="cross-icon" fill="white" d="M 9.9265625 8.865937499999998 L 6.060625000000001 5 L 9.265625 1.795 L 9.9265625 1.1340624999999993 C 10.0240625 1.0365624999999996 10.0240625 0.8781249999999996 9.9265625 0.7806249999999992 L 9.219375 0.07343749999999982 C 9.121875 -0.024062500000000542 8.9634375 -0.024062500000000542 8.8659375 0.07343749999999982 L 5 3.9393750000000005 L 1.1340625 0.073125 C 1.0365625 -0.02437500000000037 0.8781250000000002 -0.02437500000000037 0.7806249999999999 0.073125 L 0.073125 0.7803125 C -0.024375000000000008 0.8778124999999998 -0.024375000000000008 1.0362499999999997 0.073125 1.13375 L 3.9393750000000005 5 L 0.073125 8.865937499999998 C -0.024375000000000008 8.9634375 -0.024375000000000008 9.121875 0.073125 9.219375000000001 L 0.7803125 9.9265625 C 0.8778125000000001 10.0240625 1.03625 10.0240625 1.13375 9.9265625 L 5 6.060625 L 8.205 9.265625 L 8.8659375 9.9265625 C 8.9634375 10.0240625 9.121875 10.0240625 9.219375 9.9265625 L 9.9265625 9.219375000000001 C 10.0240625 9.121875 10.0240625 8.9634375 9.9265625 8.865937499999998 Z " fill-rule="nonzero" fill="#c9c9c9" stroke="none" fill-opacity="0.8" transform="matrix(1 0 0 1 256 14 )"/>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
11
|
+
`;
|
|
12
|
+
export const plusIcon = () => `
|
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="30px" height="30px" class="bi bi-plus" viewBox="0 0 16 16">
|
|
14
|
+
<path 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"/>
|
|
15
|
+
</svg>`;
|
|
16
|
+
export const getPrefixedSearchBar = (prefix) => html `
|
|
17
|
+
|
|
18
|
+
<label part="label" for="control" data-test-id="label" class=${(x) => { var _a; return classNames('label', ['label-hidden', !((_a = x.defaultSlottedNodes) === null || _a === void 0 ? void 0 : _a.length)]); }}
|
|
19
|
+
>
|
|
20
|
+
<slot
|
|
21
|
+
${slotted({
|
|
22
|
+
property: 'defaultSlottedNodes',
|
|
23
|
+
filter: whitespaceFilter,
|
|
24
|
+
})}
|
|
25
|
+
></slot>
|
|
26
|
+
</label>
|
|
27
|
+
|
|
28
|
+
<${prefix}-search-bar-combobox
|
|
29
|
+
${ref('combobox')}
|
|
30
|
+
placeholder=${(x) => x.placeholder}
|
|
31
|
+
disabled=${(x) => x.disabled}
|
|
32
|
+
autocomplete="none"
|
|
33
|
+
minlength=${(x) => x.minlength}
|
|
34
|
+
@inputdeleted=${(x) => x.inputdeleted()}
|
|
35
|
+
@change=${(x) => x.changeHandler()}
|
|
36
|
+
@input=${(x) => x.inputHandler()}
|
|
37
|
+
@paste=${(x, c) => x.pasteHandler(c.event)}
|
|
38
|
+
class="search-bar-combobox ${(x) => (x.selectedOptions.length > 0 ? 'padding' : null)}"
|
|
39
|
+
data-test-id="search-bar"
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
${ref('selectedOptionsDiv')}
|
|
43
|
+
slot="selectedOptions"
|
|
44
|
+
class="selected-options ${(x) => x.selectedOptions.length > 0 ? 'selected-options-divider' : null}"
|
|
45
|
+
>
|
|
46
|
+
${repeat((x) => x.selectedOptions, html `
|
|
47
|
+
<${prefix}-button
|
|
48
|
+
class="options-button"
|
|
49
|
+
appearance=${(x, c) => c.parent.appearance}
|
|
50
|
+
disabled=${(x, c) => c.parent.disabled}
|
|
51
|
+
@click=${(x, c) => c.parent.unselectOption(x)}
|
|
52
|
+
>
|
|
53
|
+
${(x) => x.label}
|
|
54
|
+
<${prefix}-icon
|
|
55
|
+
class="close-icon"
|
|
56
|
+
slot="end"
|
|
57
|
+
name="circle-xmark"
|
|
58
|
+
variant="regular"
|
|
59
|
+
></${prefix}-icon>
|
|
60
|
+
</${prefix}-button>
|
|
61
|
+
`)}
|
|
62
|
+
</div>
|
|
63
|
+
${repeat((x) => x.filteredOptions, html `
|
|
64
|
+
<${prefix}-option
|
|
65
|
+
value="${(x) => x.field}"
|
|
66
|
+
:disabled=${(x, ctx) => !x.isEnabled(ctx.parent.searchTerm, ctx.parent.selectedOptions)}
|
|
67
|
+
>
|
|
68
|
+
${(x, ctx) => x.label(ctx.parent.searchTerm)}
|
|
69
|
+
</${prefix}-option>
|
|
70
|
+
`)}
|
|
71
|
+
<${prefix}-button
|
|
72
|
+
class="search-clear-button"
|
|
73
|
+
@click=${(x) => x.clearSearch()}
|
|
74
|
+
id="search-clear-button"
|
|
75
|
+
slot="end"
|
|
76
|
+
data-test-id="clear-search"
|
|
77
|
+
>
|
|
78
|
+
<div class="svg-container">
|
|
79
|
+
<svg
|
|
80
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
81
|
+
fill="currentColor"
|
|
82
|
+
width="26px"
|
|
83
|
+
height="26px"
|
|
84
|
+
class="bi bi-plus"
|
|
85
|
+
viewBox="0 0 16 16"
|
|
86
|
+
>
|
|
87
|
+
<path
|
|
88
|
+
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"
|
|
89
|
+
/>
|
|
90
|
+
</svg>
|
|
91
|
+
</div>
|
|
92
|
+
</${prefix}-button>
|
|
93
|
+
</${prefix}-search-bar-combobox>
|
|
94
|
+
<${prefix}-tooltip class="tooltip" anchor="search-clear-button">
|
|
95
|
+
Clear Search Terms
|
|
96
|
+
</${prefix}-tooltip>
|
|
97
|
+
`;
|
|
98
|
+
export const foundationSearchBarTemplate = html `
|
|
99
|
+
${(x) => getPrefixedSearchBar(getPrefix(x))}
|
|
100
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CriteriaBuilder, ExpressionBuilder, Serialisers } from '@genesislcap/foundation-criteria';
|
|
2
|
+
export const SCROLL_TIMEOUT = 10;
|
|
3
|
+
export const INPUT_MIN_LENGTH = 3;
|
|
4
|
+
export const COMBO_INPUT_MIN_LENGTH = 1;
|
|
5
|
+
export const getCriteriaBuilder = (field, term) => {
|
|
6
|
+
return new CriteriaBuilder()
|
|
7
|
+
.withExpression(new ExpressionBuilder()
|
|
8
|
+
.withField(field)
|
|
9
|
+
.withValue(term)
|
|
10
|
+
.withSerialiser(Serialisers.containsIgnoreCase)
|
|
11
|
+
.build())
|
|
12
|
+
.build();
|
|
13
|
+
};
|
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.
|
|
4
|
+
"version": "14.139.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"test:debug": "genx test --debug"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@genesislcap/foundation-testing": "14.
|
|
78
|
-
"@genesislcap/genx": "14.
|
|
77
|
+
"@genesislcap/foundation-testing": "14.139.0",
|
|
78
|
+
"@genesislcap/genx": "14.139.0",
|
|
79
79
|
"copyfiles": "^2.4.1",
|
|
80
80
|
"rimraf": "^3.0.2",
|
|
81
81
|
"rxjs": "^7.5.4"
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
"@fortawesome/free-regular-svg-icons": "^6.2.1",
|
|
87
87
|
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
|
88
88
|
"@genesiscommunitysuccess/analyzer-import-alias-plugin": "^4.0.0",
|
|
89
|
-
"@genesislcap/foundation-comms": "14.
|
|
90
|
-
"@genesislcap/foundation-criteria": "14.
|
|
91
|
-
"@genesislcap/foundation-errors": "14.
|
|
92
|
-
"@genesislcap/foundation-logger": "14.
|
|
93
|
-
"@genesislcap/foundation-notifications": "14.
|
|
94
|
-
"@genesislcap/foundation-utils": "14.
|
|
89
|
+
"@genesislcap/foundation-comms": "14.139.0",
|
|
90
|
+
"@genesislcap/foundation-criteria": "14.139.0",
|
|
91
|
+
"@genesislcap/foundation-errors": "14.139.0",
|
|
92
|
+
"@genesislcap/foundation-logger": "14.139.0",
|
|
93
|
+
"@genesislcap/foundation-notifications": "14.139.0",
|
|
94
|
+
"@genesislcap/foundation-utils": "14.139.0",
|
|
95
95
|
"@microsoft/fast-colors": "^5.3.1",
|
|
96
96
|
"@microsoft/fast-components": "^2.30.6",
|
|
97
97
|
"@microsoft/fast-element": "^1.12.0",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"access": "public"
|
|
114
114
|
},
|
|
115
115
|
"customElements": "dist/custom-elements.json",
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "403107fcfb26a335c8db254a3327663e60e7af78"
|
|
117
117
|
}
|