vira 30.1.0 → 30.1.2
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/elements/pop-up/vira-menu-item.element.d.ts +4 -1
- package/dist/elements/pop-up/vira-menu-item.element.js +59 -11
- package/dist/elements/pop-up/vira-pop-up-trigger.element.js +36 -10
- package/dist/elements/vira-checkbox.element.js +3 -1
- package/dist/elements/vira-collapsible-card.element.js +0 -1
- package/dist/elements/vira-collapsible-wrapper.element.js +3 -1
- package/dist/elements/vira-dropdown.element.js +6 -2
- package/dist/elements/vira-form.element.js +3 -1
- package/dist/elements/vira-image.element.js +8 -2
- package/dist/elements/vira-input.element.js +14 -4
- package/dist/elements/vira-link.element.d.ts +4 -1
- package/dist/elements/vira-link.element.js +39 -0
- package/dist/elements/vira-modal.element.js +6 -2
- package/dist/elements/vira-overflow-switch.element.js +3 -1
- package/dist/elements/vira-progress.element.js +4 -1
- package/dist/elements/vira-select.element.js +10 -2
- package/dist/util/pop-up-manager.js +17 -5
- package/dist/util/shared-text-input-logic.js +12 -3
- package/dist/util/vira-form-fields.js +4 -1
- package/package.json +8 -8
|
@@ -19,4 +19,7 @@ export declare const ViraMenuItem: import("element-vir").DeclarativeElementDefin
|
|
|
19
19
|
* _always_ be shown, even if `selected` is set to `false`.
|
|
20
20
|
*/
|
|
21
21
|
iconOverride: ViraIconSvg;
|
|
22
|
-
}>, {
|
|
22
|
+
}>, {
|
|
23
|
+
/** Removes event listeners registered during init. */
|
|
24
|
+
cleanup: undefined | (() => void);
|
|
25
|
+
}, {}, "vira-menu-item-selected" | "vira-menu-item-disabled" | "vira-menu-item-enabled" | "vira-menu-item-default-icon" | "vira-menu-item-default-styles", "vira-menu-item-", readonly [], readonly []>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { assertWrap } from '@augment-vir/assert';
|
|
1
2
|
import { css, html } from 'element-vir';
|
|
3
|
+
import { listenTo } from 'typed-event-target';
|
|
2
4
|
import { Check24Icon } from '../../icons/icon-svgs/check-24.icon.js';
|
|
3
5
|
import { viraFormCssVars } from '../../styles/form-styles.js';
|
|
4
6
|
import { noUserSelect } from '../../styles/index.js';
|
|
@@ -12,6 +14,12 @@ import { ViraIcon } from '../vira-icon.element.js';
|
|
|
12
14
|
*/
|
|
13
15
|
export const ViraMenuItem = defineViraElement()({
|
|
14
16
|
tagName: 'vira-menu-item',
|
|
17
|
+
state() {
|
|
18
|
+
return {
|
|
19
|
+
/** Removes event listeners registered during init. */
|
|
20
|
+
cleanup: undefined,
|
|
21
|
+
};
|
|
22
|
+
},
|
|
15
23
|
hostClasses: {
|
|
16
24
|
'vira-menu-item-selected': ({ inputs }) => !!inputs.selected || !!inputs.iconOverride,
|
|
17
25
|
'vira-menu-item-disabled': ({ inputs }) => !!inputs.disabled,
|
|
@@ -74,21 +82,61 @@ export const ViraMenuItem = defineViraElement()({
|
|
|
74
82
|
min-width: 0;
|
|
75
83
|
}
|
|
76
84
|
`,
|
|
77
|
-
init({ host, inputs }) {
|
|
85
|
+
init({ state, updateState, host, inputs }) {
|
|
78
86
|
host.setAttribute('role', 'menuitem');
|
|
79
87
|
host.setAttribute('tabindex', inputs.disabled ? '-1' : '0');
|
|
80
88
|
host.setAttribute('aria-selected', String(!!inputs.selected));
|
|
81
89
|
host.setAttribute('aria-disabled', String(!!inputs.disabled));
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
state.cleanup?.();
|
|
91
|
+
let propagating = false;
|
|
92
|
+
const listenerRemovers = [
|
|
93
|
+
listenTo(host, 'click', (event) => {
|
|
94
|
+
if (propagating) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
else if (inputs.disabled) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const slotElement = assertWrap.instanceOf(host.shadowRoot.querySelector('slot'), HTMLSlotElement);
|
|
103
|
+
slotElement
|
|
104
|
+
.assignedElements({
|
|
105
|
+
flatten: true,
|
|
106
|
+
})
|
|
107
|
+
.forEach((element) => {
|
|
108
|
+
if (element instanceof HTMLElement &&
|
|
109
|
+
!event.composedPath().includes(element)) {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
event.stopPropagation();
|
|
112
|
+
propagating = true;
|
|
113
|
+
element.dispatchEvent(new MouseEvent(event.type, event));
|
|
114
|
+
propagating = false;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}),
|
|
118
|
+
listenTo(host, 'mouseenter', () => {
|
|
119
|
+
if (!inputs.disabled) {
|
|
120
|
+
host.focus();
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
listenTo(host, 'mouseleave', () => {
|
|
124
|
+
if (!inputs.disabled) {
|
|
125
|
+
host.blur();
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
];
|
|
129
|
+
updateState({
|
|
130
|
+
cleanup: () => {
|
|
131
|
+
listenerRemovers.forEach((remover) => remover());
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
cleanup({ state, updateState }) {
|
|
136
|
+
state.cleanup?.();
|
|
137
|
+
updateState({
|
|
138
|
+
cleanup: undefined,
|
|
139
|
+
});
|
|
92
140
|
},
|
|
93
141
|
render({ inputs }) {
|
|
94
142
|
return html `
|
|
@@ -47,7 +47,9 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
47
47
|
return {
|
|
48
48
|
/** `undefined` means the pop up is not currently showing. */
|
|
49
49
|
showPopUpResult: undefined,
|
|
50
|
-
popUpManager: new PopUpManager(new NavController(host, {
|
|
50
|
+
popUpManager: new PopUpManager(new NavController(host, {
|
|
51
|
+
activateOnMouseUp: true,
|
|
52
|
+
})),
|
|
51
53
|
};
|
|
52
54
|
},
|
|
53
55
|
slotNames: [
|
|
@@ -128,13 +130,17 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
128
130
|
init: defineElementEvent(),
|
|
129
131
|
},
|
|
130
132
|
cleanup({ state, updateState }) {
|
|
131
|
-
updateState({
|
|
133
|
+
updateState({
|
|
134
|
+
showPopUpResult: undefined,
|
|
135
|
+
});
|
|
132
136
|
state.popUpManager.destroy();
|
|
133
137
|
},
|
|
134
138
|
init({ state, updateState, host, inputs, dispatch, events }) {
|
|
135
139
|
/** Refocus the trigger and set the result to `undefined` when the pop up closes. */
|
|
136
140
|
state.popUpManager.listen(HidePopUpEvent, () => {
|
|
137
|
-
updateState({
|
|
141
|
+
updateState({
|
|
142
|
+
showPopUpResult: undefined,
|
|
143
|
+
});
|
|
138
144
|
dispatch(new events.openChange(undefined));
|
|
139
145
|
if (!inputs.isDisabled) {
|
|
140
146
|
const dropdownWrapper = host.shadowRoot.querySelector('.dropdown-wrapper');
|
|
@@ -177,7 +183,9 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
177
183
|
triggerPopUpState({
|
|
178
184
|
open,
|
|
179
185
|
callback(showPopUpResult) {
|
|
180
|
-
updateState({
|
|
186
|
+
updateState({
|
|
187
|
+
showPopUpResult,
|
|
188
|
+
});
|
|
181
189
|
if (emitEvent) {
|
|
182
190
|
dispatch(new events.openChange(showPopUpResult));
|
|
183
191
|
}
|
|
@@ -187,14 +195,23 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
187
195
|
});
|
|
188
196
|
}
|
|
189
197
|
if (inputs.isDisabled) {
|
|
190
|
-
triggerPopUp({
|
|
198
|
+
triggerPopUp({
|
|
199
|
+
open: false,
|
|
200
|
+
emitEvent: false,
|
|
201
|
+
}, undefined);
|
|
191
202
|
}
|
|
192
203
|
else if (inputs.z_debug_forceOpenState != undefined) {
|
|
193
204
|
if (!inputs.z_debug_forceOpenState && state.showPopUpResult) {
|
|
194
|
-
triggerPopUp({
|
|
205
|
+
triggerPopUp({
|
|
206
|
+
emitEvent: false,
|
|
207
|
+
open: false,
|
|
208
|
+
}, undefined);
|
|
195
209
|
}
|
|
196
210
|
else if (inputs.z_debug_forceOpenState && !state.showPopUpResult) {
|
|
197
|
-
triggerPopUp({
|
|
211
|
+
triggerPopUp({
|
|
212
|
+
emitEvent: false,
|
|
213
|
+
open: true,
|
|
214
|
+
}, undefined);
|
|
198
215
|
}
|
|
199
216
|
}
|
|
200
217
|
/**
|
|
@@ -267,7 +284,10 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
267
284
|
`
|
|
268
285
|
: undefined;
|
|
269
286
|
function respondToClick(event) {
|
|
270
|
-
triggerPopUp({
|
|
287
|
+
triggerPopUp({
|
|
288
|
+
emitEvent: true,
|
|
289
|
+
open: !state.showPopUpResult,
|
|
290
|
+
}, event);
|
|
271
291
|
}
|
|
272
292
|
return html `
|
|
273
293
|
<button
|
|
@@ -280,7 +300,10 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
280
300
|
aria-expanded=${!!state.showPopUpResult}
|
|
281
301
|
${listen('keydown', (event) => {
|
|
282
302
|
if (!state.showPopUpResult && event.code.startsWith('Arrow')) {
|
|
283
|
-
triggerPopUp({
|
|
303
|
+
triggerPopUp({
|
|
304
|
+
emitEvent: true,
|
|
305
|
+
open: true,
|
|
306
|
+
}, event);
|
|
284
307
|
}
|
|
285
308
|
})}
|
|
286
309
|
${listen('click', (event) => {
|
|
@@ -309,7 +332,10 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
309
332
|
* open/close toggling for the trigger itself.
|
|
310
333
|
*/
|
|
311
334
|
if (dropdownTrigger && !event.composedPath().includes(dropdownTrigger)) {
|
|
312
|
-
triggerPopUp({
|
|
335
|
+
triggerPopUp({
|
|
336
|
+
emitEvent: true,
|
|
337
|
+
open: false,
|
|
338
|
+
}, event);
|
|
313
339
|
}
|
|
314
340
|
}
|
|
315
341
|
})}
|
|
@@ -106,7 +106,9 @@ export const ViraCheckbox = defineViraElement()({
|
|
|
106
106
|
position: relative;
|
|
107
107
|
cursor: pointer;
|
|
108
108
|
|
|
109
|
-
${createFocusStyles({
|
|
109
|
+
${createFocusStyles({
|
|
110
|
+
elementBorderSize: 1,
|
|
111
|
+
})}
|
|
110
112
|
|
|
111
113
|
&.checked {
|
|
112
114
|
& ${ViraIcon} {
|
|
@@ -85,7 +85,9 @@ export const ViraCollapsibleWrapper = defineViraElement()({
|
|
|
85
85
|
>
|
|
86
86
|
<div
|
|
87
87
|
${onResize(({ contentRect }) => {
|
|
88
|
-
updateState({
|
|
88
|
+
updateState({
|
|
89
|
+
contentHeight: contentRect.height,
|
|
90
|
+
});
|
|
89
91
|
})}
|
|
90
92
|
class="content-wrapper"
|
|
91
93
|
>
|
|
@@ -158,7 +158,9 @@ export const ViraDropdown = defineViraElement()({
|
|
|
158
158
|
if (!!state.showPopUpResult !== !!event.detail) {
|
|
159
159
|
dispatch(new events.openChange(event.detail));
|
|
160
160
|
}
|
|
161
|
-
updateState({
|
|
161
|
+
updateState({
|
|
162
|
+
showPopUpResult: event.detail,
|
|
163
|
+
});
|
|
162
164
|
})}
|
|
163
165
|
>
|
|
164
166
|
<div
|
|
@@ -180,7 +182,9 @@ export const ViraDropdown = defineViraElement()({
|
|
|
180
182
|
</span>
|
|
181
183
|
|
|
182
184
|
<span class="trigger-icon-wrapper">
|
|
183
|
-
<${ViraIcon.assign({
|
|
185
|
+
<${ViraIcon.assign({
|
|
186
|
+
icon: ChevronUp24Icon,
|
|
187
|
+
})}
|
|
184
188
|
class="trigger-icon"
|
|
185
189
|
></${ViraIcon}>
|
|
186
190
|
</span>
|
|
@@ -45,7 +45,9 @@ export const ViraForm = defineViraElement()({
|
|
|
45
45
|
updateState({
|
|
46
46
|
lastIsValid: currentIsValid,
|
|
47
47
|
});
|
|
48
|
-
dispatch(new events.validChange({
|
|
48
|
+
dispatch(new events.validChange({
|
|
49
|
+
allFieldsAreValid: currentIsValid,
|
|
50
|
+
}));
|
|
49
51
|
}
|
|
50
52
|
const formFieldTemplates = getObjectTypedEntries(inputs.fields).map(([key, field,]) => {
|
|
51
53
|
if (field.isHidden) {
|
|
@@ -97,14 +97,20 @@ export const ViraImage = defineViraElement()({
|
|
|
97
97
|
const statusTemplate = state.erroredUrls[imageUrl]
|
|
98
98
|
? html `
|
|
99
99
|
<slot class="status-wrapper" name=${slotNames.error}>
|
|
100
|
-
<${ViraIcon.assign({
|
|
100
|
+
<${ViraIcon.assign({
|
|
101
|
+
icon: StatusFailure24Icon,
|
|
102
|
+
})}
|
|
103
|
+
class="error"
|
|
104
|
+
></${ViraIcon}>
|
|
101
105
|
</slot>
|
|
102
106
|
`
|
|
103
107
|
: state.loadedUrls[imageUrl]
|
|
104
108
|
? undefined
|
|
105
109
|
: html `
|
|
106
110
|
<slot class="status-wrapper" name=${slotNames.loading}>
|
|
107
|
-
<${ViraIcon.assign({
|
|
111
|
+
<${ViraIcon.assign({
|
|
112
|
+
icon: LoaderAnimated24Icon,
|
|
113
|
+
})}></${ViraIcon}>
|
|
108
114
|
</slot>
|
|
109
115
|
`;
|
|
110
116
|
return html `
|
|
@@ -295,7 +295,11 @@ export const ViraInput = defineViraElement()({
|
|
|
295
295
|
});
|
|
296
296
|
const iconTemplate = inputs.icon
|
|
297
297
|
? html `
|
|
298
|
-
<${ViraIcon.assign({
|
|
298
|
+
<${ViraIcon.assign({
|
|
299
|
+
icon: inputs.icon,
|
|
300
|
+
})}
|
|
301
|
+
class="left-side-icon"
|
|
302
|
+
></${ViraIcon}>
|
|
299
303
|
`
|
|
300
304
|
: nothing;
|
|
301
305
|
const forcedInputWidthStyles = inputs.fitText
|
|
@@ -326,7 +330,9 @@ export const ViraInput = defineViraElement()({
|
|
|
326
330
|
<span
|
|
327
331
|
class="size-span"
|
|
328
332
|
${onResize(({ contentRect }) => {
|
|
329
|
-
updateState({
|
|
333
|
+
updateState({
|
|
334
|
+
forcedInputWidth: contentRect.width,
|
|
335
|
+
});
|
|
330
336
|
})}
|
|
331
337
|
>
|
|
332
338
|
<pre>${filteredValue || inputs.placeholder || nothing}</pre>
|
|
@@ -377,7 +383,9 @@ export const ViraInput = defineViraElement()({
|
|
|
377
383
|
dispatch(new events.valueChange(''));
|
|
378
384
|
})}
|
|
379
385
|
>
|
|
380
|
-
<${ViraIcon.assign({
|
|
386
|
+
<${ViraIcon.assign({
|
|
387
|
+
icon: CloseX24Icon,
|
|
388
|
+
})}></${ViraIcon}>
|
|
381
389
|
</button>
|
|
382
390
|
`)}
|
|
383
391
|
${renderIf(inputs.type === ViraInputType.Password, html `
|
|
@@ -390,7 +398,9 @@ export const ViraInput = defineViraElement()({
|
|
|
390
398
|
event.preventDefault();
|
|
391
399
|
})}
|
|
392
400
|
${listen('click', () => {
|
|
393
|
-
updateState({
|
|
401
|
+
updateState({
|
|
402
|
+
showPassword: !state.showPassword,
|
|
403
|
+
});
|
|
394
404
|
})}
|
|
395
405
|
>
|
|
396
406
|
<${ViraIcon.assign({
|
|
@@ -72,4 +72,7 @@ export declare const ViraLink: import("element-vir").DeclarativeElementDefinitio
|
|
|
72
72
|
}>>;
|
|
73
73
|
/** If set to true, internal link styles are not applied. */
|
|
74
74
|
disableLinkStyles: boolean;
|
|
75
|
-
}>, {
|
|
75
|
+
}>, {
|
|
76
|
+
/** Removes event listeners registered during init. */
|
|
77
|
+
cleanup: undefined | (() => void);
|
|
78
|
+
}, {}, "vira-link-link-styles", "vira-link-", readonly [], readonly []>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { assertWrap } from '@augment-vir/assert';
|
|
1
2
|
import { attributes, css, html, ifDefined, listen, } from 'element-vir';
|
|
3
|
+
import { listenTo } from 'typed-event-target';
|
|
2
4
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
3
5
|
import { defineViraElement } from '../util/define-vira-element.js';
|
|
4
6
|
/**
|
|
@@ -11,6 +13,12 @@ import { defineViraElement } from '../util/define-vira-element.js';
|
|
|
11
13
|
*/
|
|
12
14
|
export const ViraLink = defineViraElement()({
|
|
13
15
|
tagName: 'vira-link',
|
|
16
|
+
state() {
|
|
17
|
+
return {
|
|
18
|
+
/** Removes event listeners registered during init. */
|
|
19
|
+
cleanup: undefined,
|
|
20
|
+
};
|
|
21
|
+
},
|
|
14
22
|
hostClasses: {
|
|
15
23
|
'vira-link-link-styles': ({ inputs }) => !inputs.disableLinkStyles,
|
|
16
24
|
},
|
|
@@ -42,6 +50,37 @@ export const ViraLink = defineViraElement()({
|
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
`,
|
|
53
|
+
init({ state, updateState, host }) {
|
|
54
|
+
state.cleanup?.();
|
|
55
|
+
let propagating = false;
|
|
56
|
+
const listenerRemovers = [
|
|
57
|
+
listenTo(host, 'click', (event) => {
|
|
58
|
+
if (propagating) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const anchorElement = assertWrap.instanceOf(host.shadowRoot.querySelector('a'), HTMLAnchorElement);
|
|
62
|
+
if (event.composedPath().includes(anchorElement)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
event.stopPropagation();
|
|
67
|
+
propagating = true;
|
|
68
|
+
anchorElement.dispatchEvent(new MouseEvent(event.type, event));
|
|
69
|
+
propagating = false;
|
|
70
|
+
}),
|
|
71
|
+
];
|
|
72
|
+
updateState({
|
|
73
|
+
cleanup: () => {
|
|
74
|
+
listenerRemovers.forEach((remover) => remover());
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
cleanup({ state, updateState }) {
|
|
79
|
+
state.cleanup?.();
|
|
80
|
+
updateState({
|
|
81
|
+
cleanup: undefined,
|
|
82
|
+
});
|
|
83
|
+
},
|
|
45
84
|
render({ inputs }) {
|
|
46
85
|
function clickCallback(event) {
|
|
47
86
|
if (!inputs.route) {
|
|
@@ -143,7 +143,9 @@ export const ViraModal = defineViraElement()({
|
|
|
143
143
|
}
|
|
144
144
|
if (state.previousOpenValue !== inputs.open) {
|
|
145
145
|
state.cleanup?.();
|
|
146
|
-
updateState({
|
|
146
|
+
updateState({
|
|
147
|
+
previousOpenValue: inputs.open,
|
|
148
|
+
});
|
|
147
149
|
if (inputs.open) {
|
|
148
150
|
const removers = globalEventsToCloseModalOn.map((eventName) => listenToGlobal(eventName, () => {
|
|
149
151
|
dispatch(new events.modalClose());
|
|
@@ -164,7 +166,9 @@ export const ViraModal = defineViraElement()({
|
|
|
164
166
|
return html `
|
|
165
167
|
<dialog
|
|
166
168
|
${onDomCreated((element) => {
|
|
167
|
-
updateState({
|
|
169
|
+
updateState({
|
|
170
|
+
dialogElement: assertWrap.instanceOf(element, HTMLDialogElement),
|
|
171
|
+
});
|
|
168
172
|
})}
|
|
169
173
|
${listen('close', () => {
|
|
170
174
|
close();
|
|
@@ -106,5 +106,7 @@ export const ViraOverflowSwitch = defineViraElement()({
|
|
|
106
106
|
});
|
|
107
107
|
function updateOverflowing({ elementToTest, host, updateState, }) {
|
|
108
108
|
const isOverflowing = elementToTest.scrollWidth > host.clientWidth;
|
|
109
|
-
updateState({
|
|
109
|
+
updateState({
|
|
110
|
+
isOverflowing,
|
|
111
|
+
});
|
|
110
112
|
}
|
|
@@ -50,7 +50,10 @@ export const ViraProgress = defineViraElement()({
|
|
|
50
50
|
const max = inputs.max || 100;
|
|
51
51
|
const totalRange = max - min;
|
|
52
52
|
const value = inputs.value - min;
|
|
53
|
-
const percentFull = clamp(Math.round((value / totalRange) * 100), {
|
|
53
|
+
const percentFull = clamp(Math.round((value / totalRange) * 100), {
|
|
54
|
+
min: 0,
|
|
55
|
+
max: 100,
|
|
56
|
+
});
|
|
54
57
|
applyAttributes(host, {
|
|
55
58
|
'aria-valuemin': inputs.min,
|
|
56
59
|
'aria-valuemax': inputs.max,
|
|
@@ -236,8 +236,16 @@ export const ViraSelect = defineViraElement()({
|
|
|
236
236
|
|
|
237
237
|
<div class="border-style wrapper-border"></div>
|
|
238
238
|
|
|
239
|
-
<${ViraIcon.assign({
|
|
240
|
-
|
|
239
|
+
<${ViraIcon.assign({
|
|
240
|
+
icon: inputs.icon,
|
|
241
|
+
})}
|
|
242
|
+
class="input-icon"
|
|
243
|
+
></${ViraIcon}>
|
|
244
|
+
<${ViraIcon.assign({
|
|
245
|
+
icon: ChevronUp24Icon,
|
|
246
|
+
})}
|
|
247
|
+
class="trigger-icon"
|
|
248
|
+
></${ViraIcon}>
|
|
241
249
|
</span>
|
|
242
250
|
`;
|
|
243
251
|
if (inputs.label) {
|
|
@@ -66,7 +66,10 @@ export class PopUpManager {
|
|
|
66
66
|
lastRootElement;
|
|
67
67
|
constructor(navController, options) {
|
|
68
68
|
this.navController = navController;
|
|
69
|
-
this.options = {
|
|
69
|
+
this.options = {
|
|
70
|
+
...this.options,
|
|
71
|
+
...options,
|
|
72
|
+
};
|
|
70
73
|
}
|
|
71
74
|
attachGlobalListeners() {
|
|
72
75
|
this.cleanupCallbacks = [
|
|
@@ -81,7 +84,9 @@ export class PopUpManager {
|
|
|
81
84
|
return;
|
|
82
85
|
}
|
|
83
86
|
if (event.detail.success) {
|
|
84
|
-
this.listenTarget.dispatch(new NavSelectEvent({
|
|
87
|
+
this.listenTarget.dispatch(new NavSelectEvent({
|
|
88
|
+
detail: event.detail.coords,
|
|
89
|
+
}));
|
|
85
90
|
this.navController.currentNavEntry?.entry.focus(true);
|
|
86
91
|
event.stopImmediatePropagation();
|
|
87
92
|
event.preventDefault();
|
|
@@ -94,7 +99,9 @@ export class PopUpManager {
|
|
|
94
99
|
return;
|
|
95
100
|
}
|
|
96
101
|
this.removePopUp();
|
|
97
|
-
}, {
|
|
102
|
+
}, {
|
|
103
|
+
passive: true,
|
|
104
|
+
}),
|
|
98
105
|
listenToGlobal('keydown', (event) => {
|
|
99
106
|
const keyCode = event.code;
|
|
100
107
|
if (keyCode === 'Escape') {
|
|
@@ -138,7 +145,9 @@ export class PopUpManager {
|
|
|
138
145
|
});
|
|
139
146
|
}
|
|
140
147
|
else if ((keyCode === 'Enter' || keyCode === 'Return' || keyCode === 'Space') &&
|
|
141
|
-
this.navController.enterInto({
|
|
148
|
+
this.navController.enterInto({
|
|
149
|
+
fallbackToActivate: true,
|
|
150
|
+
}).success) {
|
|
142
151
|
event.stopImmediatePropagation();
|
|
143
152
|
event.preventDefault();
|
|
144
153
|
}
|
|
@@ -158,7 +167,10 @@ export class PopUpManager {
|
|
|
158
167
|
/** Trigger showing the pop up. */
|
|
159
168
|
showPopUp(rootElement, options) {
|
|
160
169
|
this.lastRootElement = rootElement;
|
|
161
|
-
const currentOptions = {
|
|
170
|
+
const currentOptions = {
|
|
171
|
+
...this.options,
|
|
172
|
+
...options,
|
|
173
|
+
};
|
|
162
174
|
const container = findOverflowAncestor(rootElement);
|
|
163
175
|
assert.instanceOf(container, HTMLElement);
|
|
164
176
|
const rootRect = rootElement.getBoundingClientRect();
|
|
@@ -5,7 +5,10 @@ function doesMatch({ input, matcher }) {
|
|
|
5
5
|
return true;
|
|
6
6
|
}
|
|
7
7
|
if (input.length > 1) {
|
|
8
|
-
return input.split('').every((singleInput) => doesMatch({
|
|
8
|
+
return input.split('').every((singleInput) => doesMatch({
|
|
9
|
+
input: singleInput,
|
|
10
|
+
matcher,
|
|
11
|
+
}));
|
|
9
12
|
}
|
|
10
13
|
if (matcher instanceof RegExp) {
|
|
11
14
|
return !!input.match(matcher);
|
|
@@ -38,10 +41,16 @@ function isAllowed({ value: rawValue, allowed, blocked }) {
|
|
|
38
41
|
export function filterTextInputValue(inputs) {
|
|
39
42
|
const value = String(inputs.value);
|
|
40
43
|
if (!inputs.value) {
|
|
41
|
-
return {
|
|
44
|
+
return {
|
|
45
|
+
filtered: value,
|
|
46
|
+
blocked: '',
|
|
47
|
+
};
|
|
42
48
|
}
|
|
43
49
|
const { filtered, blocked } = value.split('').reduce((accum, letter) => {
|
|
44
|
-
const allowed = isAllowed({
|
|
50
|
+
const allowed = isAllowed({
|
|
51
|
+
...inputs,
|
|
52
|
+
value: letter,
|
|
53
|
+
});
|
|
45
54
|
if (allowed) {
|
|
46
55
|
accum.filtered.push(letter);
|
|
47
56
|
}
|
|
@@ -27,7 +27,10 @@ export var ViraFormFieldType;
|
|
|
27
27
|
export function applyRequiredLabel(label, isRequired) {
|
|
28
28
|
if (label) {
|
|
29
29
|
if (isRequired) {
|
|
30
|
-
return addSuffix({
|
|
30
|
+
return addSuffix({
|
|
31
|
+
value: label,
|
|
32
|
+
suffix: '*',
|
|
33
|
+
});
|
|
31
34
|
}
|
|
32
35
|
else {
|
|
33
36
|
return label;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "30.1.
|
|
3
|
+
"version": "30.1.2",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"test:docs": "virmator docs check"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@augment-vir/assert": "^31.
|
|
42
|
-
"@augment-vir/common": "^31.
|
|
43
|
-
"@augment-vir/web": "^31.
|
|
41
|
+
"@augment-vir/assert": "^31.67.0",
|
|
42
|
+
"@augment-vir/common": "^31.67.0",
|
|
43
|
+
"@augment-vir/web": "^31.67.0",
|
|
44
44
|
"@electrovir/color": "^1.7.8",
|
|
45
|
-
"date-vir": "^8.
|
|
45
|
+
"date-vir": "^8.2.0",
|
|
46
46
|
"device-navigation": "^4.5.5",
|
|
47
47
|
"lit-css-vars": "^3.5.0",
|
|
48
|
-
"observavir": "^2.3.
|
|
48
|
+
"observavir": "^2.3.2",
|
|
49
49
|
"page-active": "^1.0.3",
|
|
50
50
|
"spa-router-vir": "^6.4.1",
|
|
51
51
|
"type-fest": "^5.4.4",
|
|
52
52
|
"typed-event-target": "^4.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@augment-vir/test": "^31.
|
|
55
|
+
"@augment-vir/test": "^31.67.0",
|
|
56
56
|
"@web/dev-server-esbuild": "^1.0.5",
|
|
57
57
|
"@web/test-runner": "^0.20.2",
|
|
58
58
|
"@web/test-runner-commands": "^0.9.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vite-tsconfig-paths": "^6.1.1"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"element-vir": "
|
|
71
|
+
"element-vir": ">=26",
|
|
72
72
|
"theme-vir": ">=28"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|