vira 31.18.2 → 31.19.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/elements/pop-up/vira-menu-trigger.element.d.ts +2 -2
- package/dist/elements/pop-up/vira-menu-trigger.element.js +6 -3
- package/dist/elements/pop-up/vira-pop-up-trigger.element.d.ts +2 -2
- package/dist/elements/pop-up/vira-pop-up-trigger.element.js +4 -4
- package/dist/elements/vira-collapsible-card.element.d.ts +2 -2
- package/dist/elements/vira-collapsible-card.element.js +8 -3
- package/dist/elements/vira-collapsible-wrapper.element.d.ts +2 -2
- package/dist/elements/vira-collapsible-wrapper.element.js +2 -2
- package/dist/elements/vira-drawer.element.d.ts +2 -2
- package/dist/elements/vira-drawer.element.js +4 -2
- package/dist/elements/vira-dropdown.element.d.ts +6 -0
- package/dist/elements/vira-dropdown.element.js +38 -4
- package/dist/elements/vira-image.element.d.ts +2 -2
- package/dist/elements/vira-image.element.js +4 -4
- package/dist/elements/vira-modal.element.d.ts +2 -2
- package/dist/elements/vira-modal.element.js +6 -2
- package/dist/elements/vira-tabs.element.js +9 -2
- package/dist/util/define-vira-element.js +1 -1
- package/dist/util/overflow-observer.d.ts +8 -1
- package/dist/util/overflow-observer.js +10 -2
- package/package.json +8 -8
|
@@ -17,7 +17,7 @@ export declare const viraMenuTriggerTestIds: {
|
|
|
17
17
|
* @category PopUp
|
|
18
18
|
* @category Elements
|
|
19
19
|
*/
|
|
20
|
-
export declare const ViraMenuTrigger: import("element-vir").DeclarativeElementDefinition
|
|
20
|
+
export declare const ViraMenuTrigger: import("element-vir").DeclarativeElementDefinition<`vira-${string}`, PartialWithUndefined<{
|
|
21
21
|
isDisabled: boolean;
|
|
22
22
|
z_debug_forceOpenState: boolean;
|
|
23
23
|
popUpOffset: PopUpOffset;
|
|
@@ -42,4 +42,4 @@ export declare const ViraMenuTrigger: import("element-vir").DeclarativeElementDe
|
|
|
42
42
|
showPopUpResult: ShowPopUpResult | undefined;
|
|
43
43
|
}, {
|
|
44
44
|
openChange: import("element-vir").DefineEvent<ShowPopUpResult | undefined>;
|
|
45
|
-
},
|
|
45
|
+
}, `vira-${string}-`, `vira-${string}-`, readonly ["vira-menu-trigger-trigger"], readonly []>;
|
|
@@ -19,7 +19,7 @@ export const viraMenuTriggerTestIds = {
|
|
|
19
19
|
export const ViraMenuTrigger = defineViraElement()({
|
|
20
20
|
tagName: 'vira-menu-trigger',
|
|
21
21
|
slotNames: [
|
|
22
|
-
'trigger',
|
|
22
|
+
'vira-menu-trigger-trigger',
|
|
23
23
|
],
|
|
24
24
|
styles: css `
|
|
25
25
|
:host {
|
|
@@ -71,7 +71,10 @@ export const ViraMenuTrigger = defineViraElement()({
|
|
|
71
71
|
});
|
|
72
72
|
})}
|
|
73
73
|
>
|
|
74
|
-
<slot
|
|
74
|
+
<slot
|
|
75
|
+
name=${slotNames['vira-menu-trigger-trigger']}
|
|
76
|
+
slot=${ViraPopUpTrigger.slotNames['vira-pop-up-trigger-trigger']}
|
|
77
|
+
></slot>
|
|
75
78
|
${state.navController && state.showPopUpResult
|
|
76
79
|
? html `
|
|
77
80
|
<${ViraMenu.assign({
|
|
@@ -80,7 +83,7 @@ export const ViraMenuTrigger = defineViraElement()({
|
|
|
80
83
|
: ViraMenuPopUpDirection.Upwards,
|
|
81
84
|
cornerStyle: inputs.menuCornerStyle,
|
|
82
85
|
})}
|
|
83
|
-
slot=${ViraPopUpTrigger.slotNames
|
|
86
|
+
slot=${ViraPopUpTrigger.slotNames['vira-pop-up-trigger-pop-up']}
|
|
84
87
|
class=${classMap({
|
|
85
88
|
'full-width-menu': inputs.horizontalAnchor === HorizontalAnchor.Both,
|
|
86
89
|
})}
|
|
@@ -79,7 +79,7 @@ export type PopUpTriggerPosition = {
|
|
|
79
79
|
* @category Elements
|
|
80
80
|
* @see https://electrovir.github.io/vira/book/elements/vira-pop-up-trigger
|
|
81
81
|
*/
|
|
82
|
-
export declare const ViraPopUpTrigger: import("element-vir").DeclarativeElementDefinition
|
|
82
|
+
export declare const ViraPopUpTrigger: import("element-vir").DeclarativeElementDefinition<`vira-${string}`, PartialWithUndefined<PopUpTriggerPosition & {
|
|
83
83
|
isDisabled: boolean;
|
|
84
84
|
/** For debugging purposes only. Very bad for actual production code use. */
|
|
85
85
|
z_debug_forceOpenState: boolean;
|
|
@@ -106,4 +106,4 @@ export declare const ViraPopUpTrigger: import("element-vir").DeclarativeElementD
|
|
|
106
106
|
navController: NavController;
|
|
107
107
|
popUpManager: PopUpManager;
|
|
108
108
|
}>;
|
|
109
|
-
}, "vira-pop-up-trigger-disabled" | "vira-pop-up-trigger-inside-focus" | "vira-pop-up-trigger-outside-focus", "vira-pop-up-trigger-",
|
|
109
|
+
}, "vira-pop-up-trigger-disabled" | "vira-pop-up-trigger-inside-focus" | "vira-pop-up-trigger-outside-focus", `vira-${string}-`, readonly ["vira-pop-up-trigger-trigger", "vira-pop-up-trigger-pop-up"], readonly []>;
|
|
@@ -53,8 +53,8 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
53
53
|
};
|
|
54
54
|
},
|
|
55
55
|
slotNames: [
|
|
56
|
-
'trigger',
|
|
57
|
-
'
|
|
56
|
+
'vira-pop-up-trigger-trigger',
|
|
57
|
+
'vira-pop-up-trigger-pop-up',
|
|
58
58
|
],
|
|
59
59
|
hostClasses: {
|
|
60
60
|
'vira-pop-up-trigger-disabled': ({ inputs }) => !!inputs.isDisabled,
|
|
@@ -362,7 +362,7 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
362
362
|
})}
|
|
363
363
|
>
|
|
364
364
|
<div class="dropdown-trigger">
|
|
365
|
-
<slot name=${slotNames
|
|
365
|
+
<slot name=${slotNames['vira-pop-up-trigger-trigger']}></slot>
|
|
366
366
|
</div>
|
|
367
367
|
|
|
368
368
|
<div
|
|
@@ -372,7 +372,7 @@ export const ViraPopUpTrigger = defineViraElement()({
|
|
|
372
372
|
style=${positionerStyles}
|
|
373
373
|
>
|
|
374
374
|
${renderIf(!!state.showPopUpResult, html `
|
|
375
|
-
<slot name=${slotNames
|
|
375
|
+
<slot name=${slotNames['vira-pop-up-trigger-pop-up']}></slot>
|
|
376
376
|
`)}
|
|
377
377
|
</div>
|
|
378
378
|
</button>
|
|
@@ -5,7 +5,7 @@ import { type PartialWithUndefined } from '@augment-vir/common';
|
|
|
5
5
|
* @category Elements
|
|
6
6
|
* @see https://electrovir.github.io/vira/book/elements/vira-checkbox
|
|
7
7
|
*/
|
|
8
|
-
export declare const ViraCollapsibleCard: import("element-vir").DeclarativeElementDefinition
|
|
8
|
+
export declare const ViraCollapsibleCard: import("element-vir").DeclarativeElementDefinition<`vira-${string}`, PartialWithUndefined<{
|
|
9
9
|
/**
|
|
10
10
|
* When set to `true`, the card styles are diminished so you can still use this element in
|
|
11
11
|
* more flexible ways.
|
|
@@ -33,4 +33,4 @@ export declare const ViraCollapsibleCard: import("element-vir").DeclarativeEleme
|
|
|
33
33
|
isExpanded: boolean;
|
|
34
34
|
}, {
|
|
35
35
|
expandToggle: import("element-vir").DefineEvent<boolean>;
|
|
36
|
-
}, "vira-collapsible-card-expanded" | "vira-collapsible-card-expansion-blocked" | "vira-collapsible-card-card-styles", "vira-collapsible-card-content-gap", readonly ["header"], readonly ["openCaret"]>;
|
|
36
|
+
}, "vira-collapsible-card-expanded" | "vira-collapsible-card-expansion-blocked" | "vira-collapsible-card-card-styles", "vira-collapsible-card-content-gap", readonly ["vira-collapsible-card-header"], readonly ["openCaret"]>;
|
|
@@ -110,7 +110,7 @@ export const ViraCollapsibleCard = defineViraElement()({
|
|
|
110
110
|
}
|
|
111
111
|
`,
|
|
112
112
|
slotNames: [
|
|
113
|
-
'header',
|
|
113
|
+
'vira-collapsible-card-header',
|
|
114
114
|
],
|
|
115
115
|
render({ inputs, slotNames, state, updateState, testIds, dispatch, events }) {
|
|
116
116
|
if (inputs.blockExpansion) {
|
|
@@ -127,7 +127,9 @@ export const ViraCollapsibleCard = defineViraElement()({
|
|
|
127
127
|
? nothing
|
|
128
128
|
: html `
|
|
129
129
|
<div class="card-header">
|
|
130
|
-
<slot name=${slotNames
|
|
130
|
+
<slot name=${slotNames['vira-collapsible-card-header']}>
|
|
131
|
+
<div class="header-filler"></div>
|
|
132
|
+
</slot>
|
|
131
133
|
|
|
132
134
|
${inputs.blockExpansion
|
|
133
135
|
? nothing
|
|
@@ -158,7 +160,10 @@ export const ViraCollapsibleCard = defineViraElement()({
|
|
|
158
160
|
dispatch(new events.expandToggle(event.detail));
|
|
159
161
|
})}
|
|
160
162
|
>
|
|
161
|
-
<div
|
|
163
|
+
<div
|
|
164
|
+
class="header-wrapper"
|
|
165
|
+
slot=${ViraCollapsibleWrapper.slotNames['vira-collapsible-wrapper-header']}
|
|
166
|
+
>
|
|
162
167
|
${wrapperHeaderTemplate}
|
|
163
168
|
</div>
|
|
164
169
|
${wrapperContentTemplate}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @category Elements
|
|
6
6
|
* @see https://electrovir.github.io/vira/book/elements/vira-collapsible-wrapper
|
|
7
7
|
*/
|
|
8
|
-
export declare const ViraCollapsibleWrapper: import("element-vir").DeclarativeElementDefinition
|
|
8
|
+
export declare const ViraCollapsibleWrapper: import("element-vir").DeclarativeElementDefinition<`vira-${string}`, {
|
|
9
9
|
expanded: boolean;
|
|
10
10
|
/** When true, forces the content to expand when printing regardless of collapsed state. */
|
|
11
11
|
expandOnPrint?: boolean;
|
|
@@ -13,4 +13,4 @@ export declare const ViraCollapsibleWrapper: import("element-vir").DeclarativeEl
|
|
|
13
13
|
contentHeight: number;
|
|
14
14
|
}, {
|
|
15
15
|
expandChange: import("element-vir").DefineEvent<boolean>;
|
|
16
|
-
}, "vira-collapsible-wrapper-expand-on-print", "vira-collapsible-wrapper-
|
|
16
|
+
}, "vira-collapsible-wrapper-expand-on-print", `vira-${string}-`, readonly ["vira-collapsible-wrapper-header"], readonly []>;
|
|
@@ -18,7 +18,7 @@ export const ViraCollapsibleWrapper = defineViraElement()({
|
|
|
18
18
|
hostClasses: {
|
|
19
19
|
'vira-collapsible-wrapper-expand-on-print': ({ inputs }) => !!inputs.expandOnPrint,
|
|
20
20
|
},
|
|
21
|
-
slotNames: ['header'],
|
|
21
|
+
slotNames: ['vira-collapsible-wrapper-header'],
|
|
22
22
|
styles: ({ hostClasses }) => css `
|
|
23
23
|
:host {
|
|
24
24
|
display: flex;
|
|
@@ -75,7 +75,7 @@ export const ViraCollapsibleWrapper = defineViraElement()({
|
|
|
75
75
|
dispatch(new events.expandChange(!inputs.expanded));
|
|
76
76
|
})}
|
|
77
77
|
>
|
|
78
|
-
<slot name=${slotNames
|
|
78
|
+
<slot name=${slotNames['vira-collapsible-wrapper-header']}>Header</slot>
|
|
79
79
|
</button>
|
|
80
80
|
|
|
81
81
|
<div
|
|
@@ -4,7 +4,7 @@ import { type PartialWithUndefined } from '@augment-vir/common';
|
|
|
4
4
|
*
|
|
5
5
|
* @category Elements
|
|
6
6
|
*/
|
|
7
|
-
export declare const ViraDrawer: import("element-vir").DeclarativeElementDefinition
|
|
7
|
+
export declare const ViraDrawer: import("element-vir").DeclarativeElementDefinition<`vira-${string}`, {
|
|
8
8
|
open: boolean;
|
|
9
9
|
} & PartialWithUndefined<{
|
|
10
10
|
/** If this isn't set, make sure to use the drawer title slot to fill it in. */
|
|
@@ -21,4 +21,4 @@ export declare const ViraDrawer: import("element-vir").DeclarativeElementDefinit
|
|
|
21
21
|
dragCurrentY: number;
|
|
22
22
|
}, {
|
|
23
23
|
drawerClose: import("element-vir").DefineEvent<void>;
|
|
24
|
-
}, "vira-drawer-dragging" | "vira-drawer-no-content-padding", "vira-drawer-backdrop-filter" | "vira-drawer-max-height", readonly ["
|
|
24
|
+
}, "vira-drawer-dragging" | "vira-drawer-no-content-padding", "vira-drawer-backdrop-filter" | "vira-drawer-max-height", readonly ["vira-drawer-drawer-title"], readonly []>;
|
|
@@ -48,7 +48,7 @@ export const ViraDrawer = defineViraElement()({
|
|
|
48
48
|
'vira-drawer-dragging': ({ state }) => state.isDragging,
|
|
49
49
|
'vira-drawer-no-content-padding': ({ inputs }) => !!inputs.noContentPadding,
|
|
50
50
|
},
|
|
51
|
-
slotNames: ['
|
|
51
|
+
slotNames: ['vira-drawer-drawer-title'],
|
|
52
52
|
cssVars: {
|
|
53
53
|
'vira-drawer-backdrop-filter': 'blur(3px)',
|
|
54
54
|
'vira-drawer-max-height': '80dvh',
|
|
@@ -275,7 +275,9 @@ export const ViraDrawer = defineViraElement()({
|
|
|
275
275
|
<div class="header">
|
|
276
276
|
<div class="header-text-wrapper">
|
|
277
277
|
<h1>
|
|
278
|
-
<slot name=${slotNames
|
|
278
|
+
<slot name=${slotNames['vira-drawer-drawer-title']}>
|
|
279
|
+
${inputs.drawerTitle}
|
|
280
|
+
</slot>
|
|
279
281
|
</h1>
|
|
280
282
|
</div>
|
|
281
283
|
<button
|
|
@@ -25,11 +25,17 @@ export declare const ViraDropdown: import("element-vir").DeclarativeElementDefin
|
|
|
25
25
|
icon: ViraIconSvg;
|
|
26
26
|
selectionPrefix: string;
|
|
27
27
|
isDisabled: boolean;
|
|
28
|
+
label: string;
|
|
28
29
|
/** For debugging purposes only. Very bad for actual production code use. */
|
|
29
30
|
z_debug_forceOpenState: boolean;
|
|
30
31
|
} & PopUpTriggerPosition>, {
|
|
31
32
|
/** `undefined` means the pop up is not currently showing. */
|
|
32
33
|
showPopUpResult: ShowPopUpResult | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Used to couple the label and trigger together. This is not applied if no label is
|
|
36
|
+
* provided.
|
|
37
|
+
*/
|
|
38
|
+
randomId: string;
|
|
33
39
|
}, {
|
|
34
40
|
selectedChange: import("element-vir").DefineEvent<string[]>;
|
|
35
41
|
openChange: import("element-vir").DefineEvent<ShowPopUpResult | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { check } from '@augment-vir/assert';
|
|
2
|
-
import { filterMap } from '@augment-vir/common';
|
|
2
|
+
import { filterMap, randomString } from '@augment-vir/common';
|
|
3
3
|
import { classMap, css, defineElementEvent, html, ifDefined, listen, nothing, testId, } from 'element-vir';
|
|
4
4
|
import { ChevronUp16Icon } from '../icons/index.js';
|
|
5
5
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
@@ -92,6 +92,22 @@ export const ViraDropdown = defineViraElement()({
|
|
|
92
92
|
.using-placeholder {
|
|
93
93
|
opacity: 0.4;
|
|
94
94
|
}
|
|
95
|
+
|
|
96
|
+
label {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
justify-content: flex-start;
|
|
100
|
+
gap: 2px;
|
|
101
|
+
width: 100%;
|
|
102
|
+
max-width: 100%;
|
|
103
|
+
|
|
104
|
+
& .dropdown-label {
|
|
105
|
+
font-weight: ${viraFormCssVars['vira-form-label-font-weight'].value};
|
|
106
|
+
text-align: left;
|
|
107
|
+
flex-shrink: 0;
|
|
108
|
+
flex-wrap: wrap;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
95
111
|
`,
|
|
96
112
|
events: {
|
|
97
113
|
selectedChange: defineElementEvent(),
|
|
@@ -101,6 +117,11 @@ export const ViraDropdown = defineViraElement()({
|
|
|
101
117
|
return {
|
|
102
118
|
/** `undefined` means the pop up is not currently showing. */
|
|
103
119
|
showPopUpResult: undefined,
|
|
120
|
+
/**
|
|
121
|
+
* Used to couple the label and trigger together. This is not applied if no label is
|
|
122
|
+
* provided.
|
|
123
|
+
*/
|
|
124
|
+
randomId: randomString(32),
|
|
104
125
|
};
|
|
105
126
|
},
|
|
106
127
|
render({ state, inputs, dispatch, events, updateState, testIds }) {
|
|
@@ -133,7 +154,7 @@ export const ViraDropdown = defineViraElement()({
|
|
|
133
154
|
? ViraMenuPopUpDirection.Downwards
|
|
134
155
|
: ViraMenuPopUpDirection.Upwards,
|
|
135
156
|
})}
|
|
136
|
-
slot=${ViraPopUpTrigger.slotNames
|
|
157
|
+
slot=${ViraPopUpTrigger.slotNames['vira-pop-up-trigger-pop-up']}
|
|
137
158
|
>
|
|
138
159
|
${renderMenuItemEntries(inputs.options.map((option) => {
|
|
139
160
|
return {
|
|
@@ -147,7 +168,7 @@ export const ViraDropdown = defineViraElement()({
|
|
|
147
168
|
}))}
|
|
148
169
|
</${ViraMenu}>
|
|
149
170
|
`;
|
|
150
|
-
|
|
171
|
+
const triggerTemplate = html `
|
|
151
172
|
<${ViraPopUpTrigger.assign({
|
|
152
173
|
...inputs,
|
|
153
174
|
focusOnClose: true,
|
|
@@ -171,7 +192,9 @@ export const ViraDropdown = defineViraElement()({
|
|
|
171
192
|
open: !!state.showPopUpResult,
|
|
172
193
|
'open-upwards': !state.showPopUpResult?.popDown,
|
|
173
194
|
})}"
|
|
174
|
-
slot=${ViraPopUpTrigger.slotNames
|
|
195
|
+
slot=${ViraPopUpTrigger.slotNames['vira-pop-up-trigger-trigger']}
|
|
196
|
+
id=${ifDefined(inputs.label ? state.randomId : undefined)}
|
|
197
|
+
aria-label=${ifDefined(inputs.label || undefined)}
|
|
175
198
|
${testId(testIds.trigger)}
|
|
176
199
|
>
|
|
177
200
|
${leadingIconTemplate}
|
|
@@ -195,5 +218,16 @@ export const ViraDropdown = defineViraElement()({
|
|
|
195
218
|
${state.showPopUpResult ? menuTemplate : nothing}
|
|
196
219
|
</${ViraPopUpTrigger}>
|
|
197
220
|
`;
|
|
221
|
+
if (inputs.label) {
|
|
222
|
+
return html `
|
|
223
|
+
<label for=${state.randomId}>
|
|
224
|
+
<span class="dropdown-label">${inputs.label}</span>
|
|
225
|
+
${triggerTemplate}
|
|
226
|
+
</label>
|
|
227
|
+
`;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
return triggerTemplate;
|
|
231
|
+
}
|
|
198
232
|
},
|
|
199
233
|
});
|
|
@@ -11,7 +11,7 @@ import { type Duration, type DurationUnit } from 'date-vir';
|
|
|
11
11
|
* @category Elements
|
|
12
12
|
* @see https://electrovir.github.io/vira/book/elements/vira-image
|
|
13
13
|
*/
|
|
14
|
-
export declare const ViraImage: import("element-vir").DeclarativeElementDefinition
|
|
14
|
+
export declare const ViraImage: import("element-vir").DeclarativeElementDefinition<`vira-${string}`, {
|
|
15
15
|
/** The URL of the image to load. This is passed directly to the `<img>` element. */
|
|
16
16
|
imageUrl: string;
|
|
17
17
|
/**
|
|
@@ -42,4 +42,4 @@ export declare const ViraImage: import("element-vir").DeclarativeElementDefiniti
|
|
|
42
42
|
}, {
|
|
43
43
|
imageLoad: import("element-vir").DefineEvent<void>;
|
|
44
44
|
imageError: import("element-vir").DefineEvent<unknown>;
|
|
45
|
-
}, "vira-image-height-constrained",
|
|
45
|
+
}, "vira-image-height-constrained", `vira-${string}-`, readonly ["vira-image-loading", "vira-image-error"], readonly []>;
|
|
@@ -34,8 +34,8 @@ export const ViraImage = defineViraElement()({
|
|
|
34
34
|
'vira-image-height-constrained': ({ inputs }) => inputs.dominantDimension === 'height',
|
|
35
35
|
},
|
|
36
36
|
slotNames: [
|
|
37
|
-
'loading',
|
|
38
|
-
'error',
|
|
37
|
+
'vira-image-loading',
|
|
38
|
+
'vira-image-error',
|
|
39
39
|
],
|
|
40
40
|
events: {
|
|
41
41
|
imageLoad: defineElementEvent(),
|
|
@@ -96,7 +96,7 @@ export const ViraImage = defineViraElement()({
|
|
|
96
96
|
const imageUrl = inputs.imageUrl;
|
|
97
97
|
const statusTemplate = state.erroredUrls[imageUrl]
|
|
98
98
|
? html `
|
|
99
|
-
<slot class="status-wrapper" name=${slotNames
|
|
99
|
+
<slot class="status-wrapper" name=${slotNames['vira-image-error']}>
|
|
100
100
|
<${ViraIcon.assign({
|
|
101
101
|
icon: StatusFailure24Icon,
|
|
102
102
|
})}
|
|
@@ -107,7 +107,7 @@ export const ViraImage = defineViraElement()({
|
|
|
107
107
|
: state.loadedUrls[imageUrl]
|
|
108
108
|
? undefined
|
|
109
109
|
: html `
|
|
110
|
-
<slot class="status-wrapper" name=${slotNames
|
|
110
|
+
<slot class="status-wrapper" name=${slotNames['vira-image-loading']}>
|
|
111
111
|
<${ViraIcon.assign({
|
|
112
112
|
icon: LoaderAnimated24Icon,
|
|
113
113
|
})}></${ViraIcon}>
|
|
@@ -5,7 +5,7 @@ import { type PartialWithUndefined } from '@augment-vir/common';
|
|
|
5
5
|
* @category Elements
|
|
6
6
|
* @see https://electrovir.github.io/vira/book/elements/vira-modal
|
|
7
7
|
*/
|
|
8
|
-
export declare const ViraModal: import("element-vir").DeclarativeElementDefinition
|
|
8
|
+
export declare const ViraModal: import("element-vir").DeclarativeElementDefinition<`vira-${string}`, {
|
|
9
9
|
open: boolean;
|
|
10
10
|
} & PartialWithUndefined<{
|
|
11
11
|
/** If this isn't set, make sure to use the modal title slot to fill it in. */
|
|
@@ -37,4 +37,4 @@ export declare const ViraModal: import("element-vir").DeclarativeElementDefiniti
|
|
|
37
37
|
cleanupListeners: undefined | (() => void);
|
|
38
38
|
}, {
|
|
39
39
|
modalClose: import("element-vir").DefineEvent<void>;
|
|
40
|
-
}, "vira-modal-phone-size" | "vira-modal-no-content-padding", "vira-modal-backdrop-filter", readonly ["
|
|
40
|
+
}, "vira-modal-phone-size" | "vira-modal-no-content-padding", "vira-modal-backdrop-filter", readonly ["vira-modal-modal-title"], readonly []>;
|
|
@@ -42,7 +42,7 @@ export const ViraModal = defineViraElement()({
|
|
|
42
42
|
'vira-modal-phone-size': ({ inputs }) => !!inputs.isMobileSize,
|
|
43
43
|
'vira-modal-no-content-padding': ({ inputs }) => !!inputs.noContentPadding,
|
|
44
44
|
},
|
|
45
|
-
slotNames: ['
|
|
45
|
+
slotNames: ['vira-modal-modal-title'],
|
|
46
46
|
cssVars: {
|
|
47
47
|
'vira-modal-backdrop-filter': 'blur(3px)',
|
|
48
48
|
},
|
|
@@ -205,7 +205,11 @@ export const ViraModal = defineViraElement()({
|
|
|
205
205
|
>
|
|
206
206
|
<div class="header">
|
|
207
207
|
<div class="header-text-wrapper">
|
|
208
|
-
<h1
|
|
208
|
+
<h1>
|
|
209
|
+
<slot name=${slotNames['vira-modal-modal-title']}>
|
|
210
|
+
${inputs.modalTitle}
|
|
211
|
+
</slot>
|
|
212
|
+
</h1>
|
|
209
213
|
${inputs.modalSubtitle
|
|
210
214
|
? html `
|
|
211
215
|
<sub>${inputs.modalSubtitle}</sub>
|
|
@@ -13,6 +13,7 @@ import { createOverflowObserver } from '../util/overflow-observer.js';
|
|
|
13
13
|
import { renderMenuItemEntries } from '../util/pop-up-helpers.js';
|
|
14
14
|
import { ViraMenuTrigger } from './pop-up/vira-menu-trigger.element.js';
|
|
15
15
|
import { ViraMenuCornerStyle } from './pop-up/vira-menu.element.js';
|
|
16
|
+
import { ViraBoldText } from './vira-bold-text.element.js';
|
|
16
17
|
import { ViraButton } from './vira-button.element.js';
|
|
17
18
|
import { ViraIcon } from './vira-icon.element.js';
|
|
18
19
|
import { ViraLink } from './vira-link.element.js';
|
|
@@ -387,7 +388,12 @@ export const ViraTabs = defineViraElement()({
|
|
|
387
388
|
})}>
|
|
388
389
|
<span class="tab-content">
|
|
389
390
|
${iconTemplate}
|
|
390
|
-
|
|
391
|
+
<${ViraBoldText.assign({
|
|
392
|
+
text: tab.label,
|
|
393
|
+
bold: isSelected,
|
|
394
|
+
})}
|
|
395
|
+
class="tab-label"
|
|
396
|
+
></${ViraBoldText}>
|
|
391
397
|
</span>
|
|
392
398
|
</${ViraLink}>
|
|
393
399
|
</li>
|
|
@@ -441,7 +447,7 @@ export const ViraTabs = defineViraElement()({
|
|
|
441
447
|
showMenuCaret: true,
|
|
442
448
|
color: ViraColorVariant.Neutral,
|
|
443
449
|
})}
|
|
444
|
-
slot=${ViraMenuTrigger.slotNames
|
|
450
|
+
slot=${ViraMenuTrigger.slotNames['vira-menu-trigger-trigger']}
|
|
445
451
|
></${ViraButton}>
|
|
446
452
|
${menuItems}
|
|
447
453
|
</${ViraMenuTrigger}>
|
|
@@ -454,6 +460,7 @@ export const ViraTabs = defineViraElement()({
|
|
|
454
460
|
cleanupObserver: createOverflowObserver({
|
|
455
461
|
element: tabsElement,
|
|
456
462
|
widthElement: host,
|
|
463
|
+
hysteresisPx: 16,
|
|
457
464
|
onChange(isOverflowing) {
|
|
458
465
|
updateState({
|
|
459
466
|
isOverflowing,
|
|
@@ -4,7 +4,7 @@ import { wrapDefineElement } from 'element-vir';
|
|
|
4
4
|
*
|
|
5
5
|
* @category Internal
|
|
6
6
|
*/
|
|
7
|
-
export const ViraTagNamePrefix =
|
|
7
|
+
export const ViraTagNamePrefix = 'vira-';
|
|
8
8
|
/**
|
|
9
9
|
* Define a vira element with custom requirements (like the `vira-` element tag prefix).
|
|
10
10
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @returns A cleanup function that disconnects all observers.
|
|
6
6
|
*/
|
|
7
|
-
export declare function createOverflowObserver({ element, widthElement, onChange, }: Readonly<{
|
|
7
|
+
export declare function createOverflowObserver({ element, widthElement, onChange, hysteresisPx, }: Readonly<{
|
|
8
8
|
/** The element whose `scrollWidth` is measured for content size. */
|
|
9
9
|
element: Element;
|
|
10
10
|
/**
|
|
@@ -14,4 +14,11 @@ export declare function createOverflowObserver({ element, widthElement, onChange
|
|
|
14
14
|
*/
|
|
15
15
|
widthElement?: Element | undefined;
|
|
16
16
|
onChange: (isOverflowing: boolean) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Pixel margin required to flip the overflow state. Once overflowing, the content must fit
|
|
19
|
+
* within `availableWidth - hysteresisPx` to flip back; once not overflowing, the content must
|
|
20
|
+
* exceed `availableWidth + hysteresisPx` to flip on. Prevents rapid toggling from minute size
|
|
21
|
+
* changes.
|
|
22
|
+
*/
|
|
23
|
+
hysteresisPx?: number | undefined;
|
|
17
24
|
}>): () => void;
|
|
@@ -4,10 +4,18 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @returns A cleanup function that disconnects all observers.
|
|
6
6
|
*/
|
|
7
|
-
export function createOverflowObserver({ element, widthElement, onChange, }) {
|
|
7
|
+
export function createOverflowObserver({ element, widthElement, onChange, hysteresisPx = 0, }) {
|
|
8
8
|
const availableWidthElement = widthElement || element;
|
|
9
|
+
let isOverflowing = false;
|
|
9
10
|
function checkOverflow() {
|
|
10
|
-
|
|
11
|
+
const contentWidth = element.scrollWidth;
|
|
12
|
+
const availableWidth = availableWidthElement.clientWidth;
|
|
13
|
+
const threshold = isOverflowing ? -hysteresisPx : hysteresisPx;
|
|
14
|
+
const nextOverflowing = contentWidth > availableWidth + threshold;
|
|
15
|
+
if (nextOverflowing !== isOverflowing) {
|
|
16
|
+
isOverflowing = nextOverflowing;
|
|
17
|
+
onChange(isOverflowing);
|
|
18
|
+
}
|
|
11
19
|
}
|
|
12
20
|
const resizeObserver = new ResizeObserver(checkOverflow);
|
|
13
21
|
resizeObserver.observe(element);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.19.0",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -38,9 +38,9 @@
|
|
|
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.70.1",
|
|
42
|
+
"@augment-vir/common": "^31.70.1",
|
|
43
|
+
"@augment-vir/web": "^31.70.1",
|
|
44
44
|
"@electrovir/color": "^1.7.9",
|
|
45
45
|
"date-vir": "^8.3.2",
|
|
46
46
|
"device-navigation": "^4.5.5",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"lit-css-vars": "^3.6.2",
|
|
49
49
|
"observavir": "^2.3.2",
|
|
50
50
|
"page-active": "^1.0.3",
|
|
51
|
-
"spa-router-vir": "^6.
|
|
51
|
+
"spa-router-vir": "^6.6.0",
|
|
52
52
|
"type-fest": "^5.6.0",
|
|
53
53
|
"typed-event-target": "^4.3.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@augment-vir/test": "^31.
|
|
56
|
+
"@augment-vir/test": "^31.70.1",
|
|
57
57
|
"@web/dev-server-esbuild": "^1.0.5",
|
|
58
58
|
"@web/test-runner": "^0.20.2",
|
|
59
59
|
"@web/test-runner-commands": "^0.9.0",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"@web/test-runner-visual-regression": "^0.10.0",
|
|
62
62
|
"esbuild": "^0.28.0",
|
|
63
63
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
64
|
-
"lucide-static": "^1.
|
|
64
|
+
"lucide-static": "^1.16.0",
|
|
65
65
|
"markdown-code-example-inserter": "^3.0.5",
|
|
66
66
|
"theme-vir": "^28.25.0",
|
|
67
67
|
"typedoc": "^0.28.19",
|
|
68
68
|
"typescript": "5.9.3",
|
|
69
|
-
"vite": "^8.0.
|
|
69
|
+
"vite": "^8.0.14",
|
|
70
70
|
"vite-tsconfig-paths": "^6.1.1"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|