@ni/ok-components 1.13.0 → 1.15.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/all-components-bundle.js +587 -449
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +2814 -2902
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +433 -243
- package/dist/custom-elements.md +67 -44
- package/dist/esm/fv/all-fv.d.ts +1 -0
- package/dist/esm/fv/all-fv.js +1 -0
- package/dist/esm/fv/all-fv.js.map +1 -1
- package/dist/esm/fv/split-button/styles.js +45 -5
- package/dist/esm/fv/split-button/styles.js.map +1 -1
- package/dist/esm/fv/split-button/template.js +3 -1
- package/dist/esm/fv/split-button/template.js.map +1 -1
- package/dist/esm/fv/split-button-anchor/index.d.ts +2 -2
- package/dist/esm/fv/split-button-anchor/index.js +4 -4
- package/dist/esm/fv/split-button-anchor/index.js.map +1 -1
- package/dist/esm/fv/split-button-anchor/styles.d.ts +1 -1
- package/dist/esm/fv/split-button-anchor/styles.js +1 -227
- package/dist/esm/fv/split-button-anchor/styles.js.map +1 -1
- package/dist/esm/fv/split-button-anchor/template.js +9 -4
- package/dist/esm/fv/split-button-anchor/template.js.map +1 -1
- package/dist/esm/fv/toolbar/index.d.ts +36 -0
- package/dist/esm/fv/toolbar/index.js +253 -0
- package/dist/esm/fv/toolbar/index.js.map +1 -0
- package/dist/esm/fv/toolbar/styles.d.ts +1 -0
- package/dist/esm/fv/toolbar/styles.js +39 -0
- package/dist/esm/fv/toolbar/styles.js.map +1 -0
- package/dist/esm/fv/toolbar/template.d.ts +4 -0
- package/dist/esm/fv/toolbar/template.js +40 -0
- package/dist/esm/fv/toolbar/template.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,228 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { actionRgbPartialColor, borderHoverColor, borderRgbPartialColor, borderWidth, buttonAccentBlockFontColor, buttonAccentOutlineFontColor, buttonBorderAccentOutlineColor, buttonFillAccentColor, buttonFillPrimaryColor, buttonLabelDisabledFontColor, buttonLabelFont, buttonLabelFontColor, buttonPrimaryFontColor, controlHeight, fillSelectedColor, iconColor, smallDelay, standardPadding } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
|
|
3
|
-
import { display } from '../../utilities/style/display';
|
|
4
|
-
export const styles = css `
|
|
5
|
-
@layer base, hover, focusVisible, active, disabled, top;
|
|
6
|
-
|
|
7
|
-
@layer base {
|
|
8
|
-
${display('inline-block')}
|
|
9
|
-
|
|
10
|
-
:host {
|
|
11
|
-
--ni-private-ok-fv-split-button-anchor-background-image: none;
|
|
12
|
-
--ni-private-ok-fv-split-button-anchor-background-size: 100% 100%;
|
|
13
|
-
--ni-private-ok-fv-split-button-anchor-background-size-emphasis: 100% 100%;
|
|
14
|
-
--ni-private-ok-fv-split-button-anchor-border: rgba(${actionRgbPartialColor}, 0.3);
|
|
15
|
-
--ni-private-ok-fv-split-button-anchor-color: ${buttonLabelFontColor};
|
|
16
|
-
position: relative;
|
|
17
|
-
height: ${controlHeight};
|
|
18
|
-
vertical-align: middle;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
:host([appearance='ghost']) {
|
|
22
|
-
--ni-private-ok-fv-split-button-anchor-border: transparent;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
:host([appearance='block']) {
|
|
26
|
-
--ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
|
|
27
|
-
rgba(${borderRgbPartialColor}, 0.1),
|
|
28
|
-
rgba(${borderRgbPartialColor}, 0.1)
|
|
29
|
-
);
|
|
30
|
-
--ni-private-ok-fv-split-button-anchor-border: rgba(${borderRgbPartialColor}, 0.1);
|
|
31
|
-
--ni-private-ok-fv-split-button-anchor-background-size-emphasis: calc(100% - 4px) calc(100% - 4px);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host([appearance='outline'][appearance-variant='primary']) {
|
|
35
|
-
--ni-private-ok-fv-split-button-anchor-border: rgb(${actionRgbPartialColor});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
:host([appearance='outline'][appearance-variant='accent']) {
|
|
39
|
-
--ni-private-ok-fv-split-button-anchor-border: ${buttonBorderAccentOutlineColor};
|
|
40
|
-
--ni-private-ok-fv-split-button-anchor-color: ${buttonAccentOutlineFontColor};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host([appearance='block'][appearance-variant='primary']) {
|
|
44
|
-
--ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
|
|
45
|
-
${buttonFillPrimaryColor},
|
|
46
|
-
${buttonFillPrimaryColor}
|
|
47
|
-
);
|
|
48
|
-
--ni-private-ok-fv-split-button-anchor-border: ${buttonFillPrimaryColor};
|
|
49
|
-
--ni-private-ok-fv-split-button-anchor-color: ${buttonPrimaryFontColor};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host([appearance='block'][appearance-variant='accent']) {
|
|
53
|
-
--ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
|
|
54
|
-
${buttonFillAccentColor},
|
|
55
|
-
${buttonFillAccentColor}
|
|
56
|
-
);
|
|
57
|
-
--ni-private-ok-fv-split-button-anchor-border: ${buttonFillAccentColor};
|
|
58
|
-
--ni-private-ok-fv-split-button-anchor-color: ${buttonAccentBlockFontColor};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.split-button-container {
|
|
62
|
-
position: relative;
|
|
63
|
-
display: inline-flex;
|
|
64
|
-
align-items: stretch;
|
|
65
|
-
height: 100%;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.split-button-primary,
|
|
69
|
-
.split-button-toggle {
|
|
70
|
-
appearance: none;
|
|
71
|
-
position: relative;
|
|
72
|
-
z-index: 0;
|
|
73
|
-
height: 100%;
|
|
74
|
-
box-sizing: border-box;
|
|
75
|
-
margin: 0;
|
|
76
|
-
border: ${borderWidth} solid var(--ni-private-ok-fv-split-button-anchor-border);
|
|
77
|
-
background-color: transparent;
|
|
78
|
-
background-image: var(--ni-private-ok-fv-split-button-anchor-background-image);
|
|
79
|
-
background-position: center;
|
|
80
|
-
background-repeat: no-repeat;
|
|
81
|
-
background-size: var(--ni-private-ok-fv-split-button-anchor-background-size);
|
|
82
|
-
color: var(--ni-private-ok-fv-split-button-anchor-color);
|
|
83
|
-
fill: currentcolor;
|
|
84
|
-
font: ${buttonLabelFont};
|
|
85
|
-
cursor: pointer;
|
|
86
|
-
outline: none;
|
|
87
|
-
transition:
|
|
88
|
-
box-shadow ${smallDelay} ease-in-out,
|
|
89
|
-
border-color ${smallDelay} ease-in-out,
|
|
90
|
-
background-size ${smallDelay} ease-in-out;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.split-button-primary {
|
|
94
|
-
display: inline-flex;
|
|
95
|
-
align-items: center;
|
|
96
|
-
justify-content: center;
|
|
97
|
-
padding: 0 ${standardPadding};
|
|
98
|
-
border-inline-end-color: transparent;
|
|
99
|
-
white-space: nowrap;
|
|
100
|
-
text-decoration: none;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.split-button-primary::before,
|
|
104
|
-
.split-button-toggle::before {
|
|
105
|
-
content: '';
|
|
106
|
-
position: absolute;
|
|
107
|
-
inset: 0;
|
|
108
|
-
pointer-events: none;
|
|
109
|
-
outline: 0px solid transparent;
|
|
110
|
-
outline-offset: -3px;
|
|
111
|
-
transition: outline ${smallDelay} ease-in-out;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.split-button-toggle {
|
|
115
|
-
width: ${controlHeight};
|
|
116
|
-
min-width: ${controlHeight};
|
|
117
|
-
display: inline-flex;
|
|
118
|
-
align-items: center;
|
|
119
|
-
justify-content: center;
|
|
120
|
-
border-inline-start-color: var(--ni-private-ok-fv-split-button-anchor-border);
|
|
121
|
-
margin-inline-start: calc(-1 * ${borderWidth});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.split-button-toggle > * {
|
|
125
|
-
color: currentColor;
|
|
126
|
-
${iconColor.cssCustomProperty}: currentColor;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.split-button-primary-disabled {
|
|
130
|
-
cursor: default;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
:host([appearance='ghost']) .split-button-primary,
|
|
134
|
-
:host([appearance='ghost']) .split-button-toggle {
|
|
135
|
-
border-color: transparent;
|
|
136
|
-
box-shadow: none;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
slot[name='menu']::slotted(*) {
|
|
140
|
-
min-width: 100%;
|
|
141
|
-
margin: 4px 0 0;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
@layer hover {
|
|
146
|
-
.split-button-primary:hover,
|
|
147
|
-
.split-button-toggle:hover {
|
|
148
|
-
border-color: ${borderHoverColor};
|
|
149
|
-
box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
|
|
150
|
-
background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);
|
|
151
|
-
z-index: 1;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
:host([appearance='ghost']) .split-button-primary:hover,
|
|
155
|
-
:host([appearance='ghost']) .split-button-toggle:hover {
|
|
156
|
-
border-color: ${borderHoverColor};
|
|
157
|
-
box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
@layer focusVisible {
|
|
162
|
-
.split-button-primary:focus-visible,
|
|
163
|
-
.split-button-toggle:focus-visible {
|
|
164
|
-
border-color: ${borderHoverColor};
|
|
165
|
-
box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
|
|
166
|
-
background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);
|
|
167
|
-
z-index: 1;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.split-button-primary:focus-visible::before,
|
|
171
|
-
.split-button-toggle:focus-visible::before {
|
|
172
|
-
outline: ${borderWidth} solid ${borderHoverColor};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
:host([appearance='ghost']) .split-button-primary:focus-visible,
|
|
176
|
-
:host([appearance='ghost']) .split-button-toggle:focus-visible {
|
|
177
|
-
border-color: ${borderHoverColor};
|
|
178
|
-
box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
@layer active {
|
|
183
|
-
.split-button-primary:active,
|
|
184
|
-
.split-button-toggle:active,
|
|
185
|
-
:host([open]) .split-button-toggle {
|
|
186
|
-
border-color: ${borderHoverColor};
|
|
187
|
-
box-shadow: none;
|
|
188
|
-
background-image: linear-gradient(${fillSelectedColor}, ${fillSelectedColor});
|
|
189
|
-
background-size: calc(100% - 2px) calc(100% - 2px);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
:host([appearance='block']) .split-button-primary:active,
|
|
193
|
-
:host([appearance='block']) .split-button-toggle:active,
|
|
194
|
-
:host([appearance='block'][open]) .split-button-toggle {
|
|
195
|
-
background-size: calc(100% - 4px) calc(100% - 4px);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
:host([appearance='outline'][appearance-variant='accent']) .split-button-primary:active,
|
|
199
|
-
:host([appearance='outline'][appearance-variant='accent']) .split-button-toggle:active,
|
|
200
|
-
:host([appearance='outline'][appearance-variant='accent'][open]) .split-button-toggle {
|
|
201
|
-
color: ${buttonAccentOutlineFontColor};
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
@layer disabled {
|
|
206
|
-
:host([disabled]) {
|
|
207
|
-
--ni-private-ok-fv-split-button-anchor-color: ${buttonLabelDisabledFontColor};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
:host([disabled][appearance='outline']) {
|
|
211
|
-
--ni-private-ok-fv-split-button-anchor-border: rgba(${borderRgbPartialColor}, 0.3);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
:host([disabled]) .split-button-primary,
|
|
215
|
-
:host([disabled]) .split-button-toggle {
|
|
216
|
-
cursor: default;
|
|
217
|
-
box-shadow: none;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
:host([disabled][appearance='ghost']) .split-button-primary,
|
|
221
|
-
:host([disabled][appearance='ghost']) .split-button-toggle {
|
|
222
|
-
border-color: transparent;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
@layer top {}
|
|
227
|
-
`;
|
|
1
|
+
export { styles } from '../split-button/styles';
|
|
228
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,eAAe,EAClB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;UAIf,OAAO,CAAC,cAAc,CAAC;;;;;;kEAMiC,qBAAqB;4DAC3B,oBAAoB;;sBAE1D,aAAa;;;;;;;;;;uBAUZ,qBAAqB;uBACrB,qBAAqB;;kEAEsB,qBAAqB;;;;;iEAKtB,qBAAqB;;;;6DAIzB,8BAA8B;4DAC/B,4BAA4B;;;;;kBAKtE,sBAAsB;kBACtB,sBAAsB;;6DAEqB,sBAAsB;4DACvB,sBAAsB;;;;;kBAKhE,qBAAqB;kBACrB,qBAAqB;;6DAEsB,qBAAqB;4DACtB,0BAA0B;;;;;;;;;;;;;;;;;;sBAkBhE,WAAW;;;;;;;;oBAQb,eAAe;;;;6BAIN,UAAU;+BACR,UAAU;kCACP,UAAU;;;;;;;yBAOnB,eAAe;;;;;;;;;;;;;;kCAcN,UAAU;;;;qBAIvB,aAAa;yBACT,aAAa;;;;;6CAKO,WAAW;;;;;cAK1C,SAAS,CAAC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;4BAsBb,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;;;4BAOnC,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;;;4BAOnC,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;;;uBAOxC,WAAW,UAAU,gBAAgB;;;;;4BAKhC,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;;;;4BAQnC,gBAAgB;;gDAEI,iBAAiB,KAAK,iBAAiB;;;;;;;;;;;;;qBAalE,4BAA4B;;;;;;4DAMW,4BAA4B;;;;kEAItB,qBAAqB;;;;;;;;;;;;;;;;CAgBtF,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n actionRgbPartialColor,\n borderHoverColor,\n borderRgbPartialColor,\n borderWidth,\n buttonAccentBlockFontColor,\n buttonAccentOutlineFontColor,\n buttonBorderAccentOutlineColor,\n buttonFillAccentColor,\n buttonFillPrimaryColor,\n buttonLabelDisabledFontColor,\n buttonLabelFont,\n buttonLabelFontColor,\n buttonPrimaryFontColor,\n controlHeight,\n fillSelectedColor,\n iconColor,\n smallDelay,\n standardPadding\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n @layer base, hover, focusVisible, active, disabled, top;\n\n @layer base {\n ${display('inline-block')}\n\n :host {\n --ni-private-ok-fv-split-button-anchor-background-image: none;\n --ni-private-ok-fv-split-button-anchor-background-size: 100% 100%;\n --ni-private-ok-fv-split-button-anchor-background-size-emphasis: 100% 100%;\n --ni-private-ok-fv-split-button-anchor-border: rgba(${actionRgbPartialColor}, 0.3);\n --ni-private-ok-fv-split-button-anchor-color: ${buttonLabelFontColor};\n position: relative;\n height: ${controlHeight};\n vertical-align: middle;\n }\n\n :host([appearance='ghost']) {\n --ni-private-ok-fv-split-button-anchor-border: transparent;\n }\n\n :host([appearance='block']) {\n --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(\n rgba(${borderRgbPartialColor}, 0.1),\n rgba(${borderRgbPartialColor}, 0.1)\n );\n --ni-private-ok-fv-split-button-anchor-border: rgba(${borderRgbPartialColor}, 0.1);\n --ni-private-ok-fv-split-button-anchor-background-size-emphasis: calc(100% - 4px) calc(100% - 4px);\n }\n\n :host([appearance='outline'][appearance-variant='primary']) {\n --ni-private-ok-fv-split-button-anchor-border: rgb(${actionRgbPartialColor});\n }\n\n :host([appearance='outline'][appearance-variant='accent']) {\n --ni-private-ok-fv-split-button-anchor-border: ${buttonBorderAccentOutlineColor};\n --ni-private-ok-fv-split-button-anchor-color: ${buttonAccentOutlineFontColor};\n }\n\n :host([appearance='block'][appearance-variant='primary']) {\n --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(\n ${buttonFillPrimaryColor},\n ${buttonFillPrimaryColor}\n );\n --ni-private-ok-fv-split-button-anchor-border: ${buttonFillPrimaryColor};\n --ni-private-ok-fv-split-button-anchor-color: ${buttonPrimaryFontColor};\n }\n\n :host([appearance='block'][appearance-variant='accent']) {\n --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(\n ${buttonFillAccentColor},\n ${buttonFillAccentColor}\n );\n --ni-private-ok-fv-split-button-anchor-border: ${buttonFillAccentColor};\n --ni-private-ok-fv-split-button-anchor-color: ${buttonAccentBlockFontColor};\n }\n\n .split-button-container {\n position: relative;\n display: inline-flex;\n align-items: stretch;\n height: 100%;\n }\n\n .split-button-primary,\n .split-button-toggle {\n appearance: none;\n position: relative;\n z-index: 0;\n height: 100%;\n box-sizing: border-box;\n margin: 0;\n border: ${borderWidth} solid var(--ni-private-ok-fv-split-button-anchor-border);\n background-color: transparent;\n background-image: var(--ni-private-ok-fv-split-button-anchor-background-image);\n background-position: center;\n background-repeat: no-repeat;\n background-size: var(--ni-private-ok-fv-split-button-anchor-background-size);\n color: var(--ni-private-ok-fv-split-button-anchor-color);\n fill: currentcolor;\n font: ${buttonLabelFont};\n cursor: pointer;\n outline: none;\n transition:\n box-shadow ${smallDelay} ease-in-out,\n border-color ${smallDelay} ease-in-out,\n background-size ${smallDelay} ease-in-out;\n }\n\n .split-button-primary {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 0 ${standardPadding};\n border-inline-end-color: transparent;\n white-space: nowrap;\n text-decoration: none;\n }\n\n .split-button-primary::before,\n .split-button-toggle::before {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n outline: 0px solid transparent;\n outline-offset: -3px;\n transition: outline ${smallDelay} ease-in-out;\n }\n\n .split-button-toggle {\n width: ${controlHeight};\n min-width: ${controlHeight};\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-inline-start-color: var(--ni-private-ok-fv-split-button-anchor-border);\n margin-inline-start: calc(-1 * ${borderWidth});\n }\n\n .split-button-toggle > * {\n color: currentColor;\n ${iconColor.cssCustomProperty}: currentColor;\n }\n\n .split-button-primary-disabled {\n cursor: default;\n }\n\n :host([appearance='ghost']) .split-button-primary,\n :host([appearance='ghost']) .split-button-toggle {\n border-color: transparent;\n box-shadow: none;\n }\n\n slot[name='menu']::slotted(*) {\n min-width: 100%;\n margin: 4px 0 0;\n }\n }\n\n @layer hover {\n .split-button-primary:hover,\n .split-button-toggle:hover {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);\n z-index: 1;\n }\n\n :host([appearance='ghost']) .split-button-primary:hover,\n :host([appearance='ghost']) .split-button-toggle:hover {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n }\n }\n\n @layer focusVisible {\n .split-button-primary:focus-visible,\n .split-button-toggle:focus-visible {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);\n z-index: 1;\n }\n\n .split-button-primary:focus-visible::before,\n .split-button-toggle:focus-visible::before {\n outline: ${borderWidth} solid ${borderHoverColor};\n }\n\n :host([appearance='ghost']) .split-button-primary:focus-visible,\n :host([appearance='ghost']) .split-button-toggle:focus-visible {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n }\n }\n\n @layer active {\n .split-button-primary:active,\n .split-button-toggle:active,\n :host([open]) .split-button-toggle {\n border-color: ${borderHoverColor};\n box-shadow: none;\n background-image: linear-gradient(${fillSelectedColor}, ${fillSelectedColor});\n background-size: calc(100% - 2px) calc(100% - 2px);\n }\n\n :host([appearance='block']) .split-button-primary:active,\n :host([appearance='block']) .split-button-toggle:active,\n :host([appearance='block'][open]) .split-button-toggle {\n background-size: calc(100% - 4px) calc(100% - 4px);\n }\n\n :host([appearance='outline'][appearance-variant='accent']) .split-button-primary:active,\n :host([appearance='outline'][appearance-variant='accent']) .split-button-toggle:active,\n :host([appearance='outline'][appearance-variant='accent'][open]) .split-button-toggle {\n color: ${buttonAccentOutlineFontColor};\n }\n }\n\n @layer disabled {\n :host([disabled]) {\n --ni-private-ok-fv-split-button-anchor-color: ${buttonLabelDisabledFontColor};\n }\n\n :host([disabled][appearance='outline']) {\n --ni-private-ok-fv-split-button-anchor-border: rgba(${borderRgbPartialColor}, 0.3);\n }\n\n :host([disabled]) .split-button-primary,\n :host([disabled]) .split-button-toggle {\n cursor: default;\n box-shadow: none;\n }\n\n :host([disabled][appearance='ghost']) .split-button-primary,\n :host([disabled][appearance='ghost']) .split-button-toggle {\n border-color: transparent;\n }\n }\n\n @layer top {}\n`;"]}
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { styles } from '../split-button/styles';\n"]}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { html, ref, when } from '@ni/fast-element';
|
|
2
2
|
import { iconArrowExpanderDownTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-down';
|
|
3
3
|
import { anchoredRegionTag } from '@ni/nimble-components/dist/esm/anchored-region';
|
|
4
|
+
const primaryContent = html `
|
|
5
|
+
<slot name="start"></slot>
|
|
6
|
+
<span>${x => x.label}</span>
|
|
7
|
+
<slot name="end"></slot>
|
|
8
|
+
`;
|
|
4
9
|
export const template = html `
|
|
5
10
|
<div
|
|
6
11
|
class="split-button-container"
|
|
7
|
-
${ref('splitButtonContainer')}
|
|
8
12
|
>
|
|
9
13
|
${when(x => !x.disabled && x.href.length > 0, html `
|
|
10
14
|
<a
|
|
@@ -18,7 +22,7 @@ export const template = html `
|
|
|
18
22
|
return true;
|
|
19
23
|
}}"
|
|
20
24
|
>
|
|
21
|
-
${
|
|
25
|
+
${primaryContent}
|
|
22
26
|
</a>
|
|
23
27
|
`)}
|
|
24
28
|
${when(x => x.disabled || x.href.length === 0, html `
|
|
@@ -26,11 +30,12 @@ export const template = html `
|
|
|
26
30
|
class="split-button-primary split-button-primary-disabled"
|
|
27
31
|
aria-disabled="${x => x.disabled}"
|
|
28
32
|
>
|
|
29
|
-
${
|
|
33
|
+
${primaryContent}
|
|
30
34
|
</span>
|
|
31
35
|
`)}
|
|
32
36
|
<button
|
|
33
37
|
class="split-button-toggle"
|
|
38
|
+
${ref('toggleButton')}
|
|
34
39
|
type="button"
|
|
35
40
|
?disabled="${x => x.disabled}"
|
|
36
41
|
aria-label="${x => `More actions for ${x.label}`}"
|
|
@@ -50,9 +55,9 @@ export const template = html `
|
|
|
50
55
|
auto-update-mode="auto"
|
|
51
56
|
horizontal-inset
|
|
52
57
|
horizontal-positioning-mode="dynamic"
|
|
58
|
+
horizontal-default-position="end"
|
|
53
59
|
vertical-positioning-mode="locktodefault"
|
|
54
60
|
vertical-default-position="bottom"
|
|
55
|
-
horizontal-scaling="anchor"
|
|
56
61
|
${ref('region')}
|
|
57
62
|
>
|
|
58
63
|
<span part="menu">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF,MAAM,
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/fv/split-button-anchor/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF,MAAM,cAAc,GAAG,IAAI,CAAqB;;YAEpC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;;CAEvB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAqB;;;;UAIvC,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EACrC,IAAI,CAAqB;;;4BAGT,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;8BACT,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,SAAS;2BAC7B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS;gCAClB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,SAAS;8BAC9B,CAAC,CAAC,EAAE;IACV,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACvB,OAAO,IAAI,CAAC;AAChB,CAAC;;sBAEC,cAAc;;aAEvB,CACJ;UACC,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EACtC,IAAI,CAAqB;;;qCAGA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;;sBAE9B,cAAc;;aAEvB,CACJ;;;cAGK,GAAG,CAAC,cAAc,CAAC;;yBAER,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;0BACd,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE;6BAC/B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;;sBAElB,CAAC,CAAC,EAAE;IACV,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACtB,OAAO,IAAI,CAAC;AAChB,CAAC;;eAEE,wBAAwB,MAAM,wBAAwB;;;MAG/D,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EACX,IAAI,CAAqB;eAClB,iBAAiB;;;;;;;;kBAQd,GAAG,CAAC,QAAQ,CAAC;;;;;gBAKf,iBAAiB;SACxB,CACJ;CACJ,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { iconArrowExpanderDownTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-down';\nimport { anchoredRegionTag } from '@ni/nimble-components/dist/esm/anchored-region';\nimport type { FvSplitButtonAnchor } from '.';\n\nconst primaryContent = html<FvSplitButtonAnchor>`\n <slot name=\"start\"></slot>\n <span>${x => x.label}</span>\n <slot name=\"end\"></slot>\n`;\n\nexport const template = html<FvSplitButtonAnchor>`\n <div\n class=\"split-button-container\"\n >\n ${when(\n x => !x.disabled && x.href.length > 0,\n html<FvSplitButtonAnchor>`\n <a\n class=\"split-button-primary\"\n href=\"${x => x.href}\"\n target=\"${x => x.target || undefined}\"\n rel=\"${x => x.rel || undefined}\"\n download=\"${x => x.download || undefined}\"\n @click=\"${x => {\n x.handlePrimaryClick();\n return true;\n }}\"\n >\n ${primaryContent}\n </a>\n `\n )}\n ${when(\n x => x.disabled || x.href.length === 0,\n html<FvSplitButtonAnchor>`\n <span\n class=\"split-button-primary split-button-primary-disabled\"\n aria-disabled=\"${x => x.disabled}\"\n >\n ${primaryContent}\n </span>\n `\n )}\n <button\n class=\"split-button-toggle\"\n ${ref('toggleButton')}\n type=\"button\"\n ?disabled=\"${x => x.disabled}\"\n aria-label=\"${x => `More actions for ${x.label}`}\"\n aria-expanded=\"${x => x.open}\"\n aria-haspopup=\"menu\"\n @click=\"${x => {\n x.handleToggleClick();\n return true;\n }}\"\n >\n <${iconArrowExpanderDownTag}></${iconArrowExpanderDownTag}>\n </button>\n </div>\n ${when(\n x => x.open,\n html<FvSplitButtonAnchor>`\n <${anchoredRegionTag}\n fixed-placement\n auto-update-mode=\"auto\"\n horizontal-inset\n horizontal-positioning-mode=\"dynamic\"\n horizontal-default-position=\"end\"\n vertical-positioning-mode=\"locktodefault\"\n vertical-default-position=\"bottom\"\n ${ref('region')}\n >\n <span part=\"menu\">\n <slot name=\"menu\"></slot>\n </span>\n </${anchoredRegionTag}>\n `\n )}\n`;"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Toolbar } from '@ni/nimble-components/dist/esm/toolbar';
|
|
2
|
+
import type { MenuButton } from '@ni/nimble-components/dist/esm/menu-button';
|
|
3
|
+
import type { Menu } from '@ni/nimble-components/dist/esm/menu';
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'ok-fv-toolbar': FvToolbar;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A Nimble toolbar that automatically collapses declaratively configured actions.
|
|
11
|
+
*/
|
|
12
|
+
export declare class FvToolbar extends Toolbar {
|
|
13
|
+
overflowLabel: string;
|
|
14
|
+
/** @internal */
|
|
15
|
+
hasOverflow: boolean;
|
|
16
|
+
/** @internal */
|
|
17
|
+
overflowButton: MenuButton;
|
|
18
|
+
/** @internal */
|
|
19
|
+
overflowMenu: Menu;
|
|
20
|
+
private readonly items;
|
|
21
|
+
private readonly resizeObserver;
|
|
22
|
+
private readonly mutationObserver;
|
|
23
|
+
private readonly observedChildren;
|
|
24
|
+
private frame;
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
disconnectedCallback(): void;
|
|
27
|
+
protected get allSlottedItems(): (HTMLElement | Node)[];
|
|
28
|
+
private observeMutations;
|
|
29
|
+
private readonly scheduleLayout;
|
|
30
|
+
private restoreItem;
|
|
31
|
+
private syncItems;
|
|
32
|
+
private updateLayout;
|
|
33
|
+
private showOverflow;
|
|
34
|
+
private fits;
|
|
35
|
+
}
|
|
36
|
+
export declare const fvToolbarTag = "ok-fv-toolbar";
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable } from '@ni/fast-element';
|
|
3
|
+
import { DesignSystem } from '@ni/fast-foundation';
|
|
4
|
+
import { Toolbar } from '@ni/nimble-components/dist/esm/toolbar';
|
|
5
|
+
import { Button } from '@ni/nimble-components/dist/esm/button';
|
|
6
|
+
import { MenuItem, menuItemTag } from '@ni/nimble-components/dist/esm/menu-item';
|
|
7
|
+
import { styles } from './styles';
|
|
8
|
+
import { template } from './template';
|
|
9
|
+
/**
|
|
10
|
+
* A Nimble toolbar that automatically collapses declaratively configured actions.
|
|
11
|
+
*/
|
|
12
|
+
export class FvToolbar extends Toolbar {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.overflowLabel = 'More actions';
|
|
16
|
+
/** @internal */
|
|
17
|
+
this.hasOverflow = false;
|
|
18
|
+
this.items = new Map();
|
|
19
|
+
this.resizeObserver = new ResizeObserver(() => this.scheduleLayout());
|
|
20
|
+
this.mutationObserver = new MutationObserver(records => {
|
|
21
|
+
for (const record of records) {
|
|
22
|
+
const item = record.target instanceof Button ? this.items.get(record.target) : undefined;
|
|
23
|
+
if (item && record.attributeName === 'hidden') {
|
|
24
|
+
item.hidden = item.button.hidden;
|
|
25
|
+
}
|
|
26
|
+
if (item && record.attributeName === 'content-hidden') {
|
|
27
|
+
item.contentHidden = item.button.contentHidden;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
this.scheduleLayout();
|
|
31
|
+
});
|
|
32
|
+
this.observedChildren = new Set();
|
|
33
|
+
this.frame = 0;
|
|
34
|
+
this.scheduleLayout = () => {
|
|
35
|
+
if (!this.isConnected || this.frame !== 0) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.frame = requestAnimationFrame(() => {
|
|
39
|
+
this.frame = 0;
|
|
40
|
+
this.updateLayout();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
connectedCallback() {
|
|
45
|
+
super.connectedCallback();
|
|
46
|
+
this.resizeObserver.observe(this);
|
|
47
|
+
this.observeMutations();
|
|
48
|
+
this.ownerDocument.fonts.addEventListener('loadingdone', this.scheduleLayout);
|
|
49
|
+
this.scheduleLayout();
|
|
50
|
+
}
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
this.resizeObserver.disconnect();
|
|
53
|
+
this.mutationObserver.disconnect();
|
|
54
|
+
this.ownerDocument.fonts.removeEventListener('loadingdone', this.scheduleLayout);
|
|
55
|
+
cancelAnimationFrame(this.frame);
|
|
56
|
+
this.frame = 0;
|
|
57
|
+
for (const item of this.items.values()) {
|
|
58
|
+
this.restoreItem(item);
|
|
59
|
+
}
|
|
60
|
+
this.items.clear();
|
|
61
|
+
this.observedChildren.clear();
|
|
62
|
+
super.disconnectedCallback();
|
|
63
|
+
}
|
|
64
|
+
get allSlottedItems() {
|
|
65
|
+
return [
|
|
66
|
+
...super.allSlottedItems,
|
|
67
|
+
...(this.hasOverflow ? [this.overflowButton] : [])
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
observeMutations() {
|
|
71
|
+
this.mutationObserver.observe(this, {
|
|
72
|
+
subtree: true,
|
|
73
|
+
childList: true,
|
|
74
|
+
characterData: true,
|
|
75
|
+
attributes: true,
|
|
76
|
+
attributeFilter: [
|
|
77
|
+
'data-responsive', 'data-priority', 'disabled', 'hidden',
|
|
78
|
+
'content-hidden', 'aria-label', 'slot', 'class', 'style'
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
restoreItem(item) {
|
|
83
|
+
item.button.hidden = item.hidden;
|
|
84
|
+
item.button.toggleAttribute('content-hidden', item.contentHidden);
|
|
85
|
+
item.menuItem.remove();
|
|
86
|
+
}
|
|
87
|
+
syncItems() {
|
|
88
|
+
const buttons = Array.from(this.children).filter((child) => child instanceof Button && child.hasAttribute('data-responsive'));
|
|
89
|
+
for (const [button, item] of this.items) {
|
|
90
|
+
if (!buttons.includes(button)) {
|
|
91
|
+
this.restoreItem(item);
|
|
92
|
+
this.items.delete(button);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const button of buttons) {
|
|
96
|
+
const value = button.getAttribute('data-responsive')?.trim() ?? '';
|
|
97
|
+
const tokens = value.split(/\s+/);
|
|
98
|
+
const stages = ['label', 'icon', 'overflow'].filter(stage => tokens.includes(stage));
|
|
99
|
+
const priority = Number(button.getAttribute('data-priority') ?? 0);
|
|
100
|
+
if (stages.length === 0 || tokens.some(token => !stages.some(stage => stage === token))
|
|
101
|
+
|| !Number.isFinite(priority)
|
|
102
|
+
|| (stages.includes('icon') && !button.querySelector(':scope > [slot="start"]'))) {
|
|
103
|
+
throw new Error('ok-fv-toolbar requires valid data-responsive stages, a finite data-priority, and a direct start-slot icon for icon-only actions.');
|
|
104
|
+
}
|
|
105
|
+
let item = this.items.get(button);
|
|
106
|
+
if (!item) {
|
|
107
|
+
const menuItem = this.ownerDocument.createElement(menuItemTag);
|
|
108
|
+
menuItem.addEventListener('change', () => {
|
|
109
|
+
if (!button.disabled) {
|
|
110
|
+
button.click();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
item = {
|
|
114
|
+
button,
|
|
115
|
+
stages,
|
|
116
|
+
priority,
|
|
117
|
+
hidden: button.hidden,
|
|
118
|
+
contentHidden: button.contentHidden,
|
|
119
|
+
menuItem
|
|
120
|
+
};
|
|
121
|
+
this.items.set(button, item);
|
|
122
|
+
}
|
|
123
|
+
item.stages = stages;
|
|
124
|
+
item.priority = priority;
|
|
125
|
+
item.menuItem.disabled = button.disabled;
|
|
126
|
+
const label = (button.getAttribute('aria-label')
|
|
127
|
+
?? Array.from(button.childNodes)
|
|
128
|
+
.filter(node => node.nodeType === Node.TEXT_NODE
|
|
129
|
+
|| (node instanceof Element && !node.hasAttribute('slot')))
|
|
130
|
+
.map(node => node.textContent).join('')).trim();
|
|
131
|
+
if (!label) {
|
|
132
|
+
throw new Error('ok-fv-toolbar responsive actions require a text label or aria-label.');
|
|
133
|
+
}
|
|
134
|
+
if (item.menuItem.textContent !== label) {
|
|
135
|
+
item.menuItem.textContent = label;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return buttons.map(button => this.items.get(button));
|
|
139
|
+
}
|
|
140
|
+
updateLayout() {
|
|
141
|
+
// Ignore our own presentation mutations, not application changes.
|
|
142
|
+
this.mutationObserver.disconnect();
|
|
143
|
+
try {
|
|
144
|
+
const menuFocus = this.shadowRoot?.activeElement;
|
|
145
|
+
const menuHadFocus = menuFocus && this.overflowButton.contains(menuFocus);
|
|
146
|
+
const previousMenuItems = Array.from(this.overflowMenu.children);
|
|
147
|
+
const items = this.syncItems();
|
|
148
|
+
const root = this.getRootNode();
|
|
149
|
+
const activeElement = root instanceof ShadowRoot ? root.activeElement : this.ownerDocument.activeElement;
|
|
150
|
+
const focusedItem = items.find(item => item.button === activeElement);
|
|
151
|
+
for (const child of this.observedChildren) {
|
|
152
|
+
if (child.parentElement !== this) {
|
|
153
|
+
this.resizeObserver.unobserve(child);
|
|
154
|
+
this.observedChildren.delete(child);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
for (const child of this.children) {
|
|
158
|
+
if (!this.observedChildren.has(child)) {
|
|
159
|
+
this.resizeObserver.observe(child);
|
|
160
|
+
this.observedChildren.add(child);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const overflow = new Set();
|
|
164
|
+
for (const item of items) {
|
|
165
|
+
item.button.hidden = item.hidden;
|
|
166
|
+
item.button.toggleAttribute('content-hidden', item.stages[0] === 'icon');
|
|
167
|
+
if (!item.hidden && item.stages[0] === 'overflow') {
|
|
168
|
+
overflow.add(item);
|
|
169
|
+
item.button.hidden = true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
this.showOverflow(overflow.size > 0);
|
|
173
|
+
const ordered = items.filter(item => !item.hidden).reverse()
|
|
174
|
+
.sort((a, b) => a.priority - b.priority);
|
|
175
|
+
// ponytail: measure each transition; cache widths only if large toolbars make this costly.
|
|
176
|
+
for (const stage of ['icon', 'overflow']) {
|
|
177
|
+
for (const item of ordered) {
|
|
178
|
+
if (this.fits()) {
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
if (overflow.has(item) || !item.stages.includes(stage)) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (stage === 'icon') {
|
|
185
|
+
item.button.toggleAttribute('content-hidden', true);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
item.button.hidden = true;
|
|
189
|
+
overflow.add(item);
|
|
190
|
+
this.showOverflow(true);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const overflowItems = items.filter(item => overflow.has(item));
|
|
195
|
+
const nextMenuItems = overflowItems.map(item => item.menuItem);
|
|
196
|
+
if (nextMenuItems.length !== previousMenuItems.length
|
|
197
|
+
|| nextMenuItems.some((item, index) => previousMenuItems[index] !== item)) {
|
|
198
|
+
this.overflowButton.open = false;
|
|
199
|
+
this.overflowMenu.replaceChildren(...nextMenuItems);
|
|
200
|
+
}
|
|
201
|
+
if (!this.hasOverflow) {
|
|
202
|
+
this.overflowButton.open = false;
|
|
203
|
+
}
|
|
204
|
+
this.overflowButton.hidden = !this.hasOverflow;
|
|
205
|
+
this.overflowButton.classList.remove('unreserved');
|
|
206
|
+
this.reduceFocusableElements();
|
|
207
|
+
if (focusedItem && overflow.has(focusedItem)) {
|
|
208
|
+
this.overflowButton.focus();
|
|
209
|
+
}
|
|
210
|
+
else if (menuHadFocus) {
|
|
211
|
+
if (this.hasOverflow) {
|
|
212
|
+
if (this.overflowButton.open && menuFocus instanceof HTMLElement && menuFocus.isConnected) {
|
|
213
|
+
menuFocus.focus();
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.overflowButton.focus();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
Array.from(this.querySelectorAll('[tabindex="0"]'))
|
|
221
|
+
.find(control => !control.closest('[hidden], [disabled]'))?.focus();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
finally {
|
|
226
|
+
this.observeMutations();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
showOverflow(show) {
|
|
230
|
+
this.hasOverflow = show;
|
|
231
|
+
// Remove the trigger from width calculations without hiding its focused menu.
|
|
232
|
+
this.overflowButton.classList.toggle('unreserved', !show);
|
|
233
|
+
this.overflowButton.hidden = false;
|
|
234
|
+
}
|
|
235
|
+
fits() {
|
|
236
|
+
const region = this.shadowRoot.querySelector('.positioning-region');
|
|
237
|
+
return region.scrollWidth <= region.clientWidth;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
__decorate([
|
|
241
|
+
attr({ attribute: 'overflow-label' })
|
|
242
|
+
], FvToolbar.prototype, "overflowLabel", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
observable
|
|
245
|
+
], FvToolbar.prototype, "hasOverflow", void 0);
|
|
246
|
+
const okFvToolbar = FvToolbar.compose({
|
|
247
|
+
baseName: 'fv-toolbar',
|
|
248
|
+
template,
|
|
249
|
+
styles
|
|
250
|
+
});
|
|
251
|
+
DesignSystem.getOrCreate().withPrefix('ok').register(okFvToolbar());
|
|
252
|
+
export const fvToolbarTag = 'ok-fv-toolbar';
|
|
253
|
+
//# sourceMappingURL=index.js.map
|