vira 31.31.0 → 31.31.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.js +57 -55
- package/dist/elements/pop-up/vira-menu.element.js +33 -31
- package/dist/elements/pop-up/vira-pop-up-trigger.element.js +57 -55
- package/dist/elements/vira-absolute-time.element.d.ts +3 -3
- package/dist/elements/vira-bold-text.element.js +35 -33
- package/dist/elements/vira-button.element.js +6 -2
- package/dist/elements/vira-card.element.js +16 -14
- package/dist/elements/vira-checkbox.element.js +95 -93
- package/dist/elements/vira-collapsible-card.element.js +63 -61
- package/dist/elements/vira-collapsible-wrapper.element.js +38 -36
- package/dist/elements/vira-date-input.element.d.ts +3 -3
- package/dist/elements/vira-date-input.element.js +37 -35
- package/dist/elements/vira-drawer.element.js +93 -91
- package/dist/elements/vira-error.element.js +8 -6
- package/dist/elements/vira-icon.element.js +23 -21
- package/dist/elements/vira-image.element.js +44 -42
- package/dist/elements/vira-json-form.element.js +7 -3
- package/dist/elements/vira-link.element.js +26 -24
- package/dist/elements/vira-modal.element.js +95 -80
- package/dist/elements/vira-progress.element.js +23 -21
- package/dist/elements/vira-relative-time.element.d.ts +2 -2
- package/dist/elements/vira-select.element.js +127 -122
- package/dist/elements/vira-tabs.element.js +17 -7
- package/dist/elements/vira-tag.element.js +3 -1
- package/dist/elements/vira-text-area.element.js +92 -90
- package/dist/icons/lucide-icons.js +7 -5
- package/dist/util/shared-text-input-logic.js +6 -4
- package/dist/util/vira-form-fields.d.ts +2 -2
- package/dist/util/vira-json-schema.js +24 -16
- package/package.json +11 -11
|
@@ -47,105 +47,118 @@ export const ViraModal = defineViraElement()({
|
|
|
47
47
|
'vira-modal-backdrop-filter': 'blur(3px)',
|
|
48
48
|
'vira-modal-border-radius': '8px',
|
|
49
49
|
},
|
|
50
|
-
styles: ({ hostClasses, cssVars }) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
h1 {
|
|
58
|
-
${noNativeSpacing};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
dialog {
|
|
62
|
-
${colorCss(viraTheme.colors[themeDefaultKey])}
|
|
63
|
-
border: none;
|
|
64
|
-
flex-direction: column;
|
|
65
|
-
border-radius: inherit;
|
|
66
|
-
padding: 0;
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
min-width: inherit;
|
|
69
|
-
min-height: inherit;
|
|
70
|
-
max-width: calc(100dvw - 100px);
|
|
71
|
-
max-height: calc(100dvh - 100px);
|
|
72
|
-
${viraShadows.modal}
|
|
73
|
-
|
|
74
|
-
&[open] {
|
|
75
|
-
display: flex;
|
|
50
|
+
styles: ({ hostClasses, cssVars }) => {
|
|
51
|
+
return css `
|
|
52
|
+
:host {
|
|
53
|
+
display: contents;
|
|
54
|
+
min-width: 280px;
|
|
55
|
+
border-radius: ${cssVars['vira-modal-border-radius'].value};
|
|
76
56
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
57
|
+
|
|
58
|
+
h1 {
|
|
59
|
+
${noNativeSpacing};
|
|
80
60
|
}
|
|
81
61
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
62
|
+
dialog {
|
|
63
|
+
${colorCss(viraTheme.colors[themeDefaultKey])}
|
|
64
|
+
border: none;
|
|
85
65
|
flex-direction: column;
|
|
66
|
+
border-radius: inherit;
|
|
67
|
+
padding: 0;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
min-width: inherit;
|
|
70
|
+
min-height: inherit;
|
|
71
|
+
max-width: calc(100dvw - 100px);
|
|
72
|
+
max-height: calc(100dvh - 100px);
|
|
73
|
+
${viraShadows.modal}
|
|
86
74
|
|
|
87
|
-
&
|
|
88
|
-
padding: 16px 24px;
|
|
75
|
+
&[open] {
|
|
89
76
|
display: flex;
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
}
|
|
78
|
+
&::backdrop {
|
|
79
|
+
background: ${viraFormCssVars['vira-form-modal-backdrop-color'].value};
|
|
80
|
+
backdrop-filter: ${cssVars['vira-modal-backdrop-filter'].value};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
& .modal-content-wrapper {
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
92
87
|
|
|
93
|
-
& .header
|
|
88
|
+
& .header {
|
|
89
|
+
padding: 16px 24px;
|
|
94
90
|
display: flex;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
align-self: center;
|
|
98
|
-
margin-right: auto;
|
|
99
|
-
overflow: hidden;
|
|
91
|
+
gap: 16px;
|
|
92
|
+
align-items: flex-start;
|
|
100
93
|
|
|
101
|
-
&
|
|
102
|
-
|
|
103
|
-
|
|
94
|
+
& .header-text-wrapper {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
gap: 4px;
|
|
98
|
+
align-self: center;
|
|
99
|
+
margin-right: auto;
|
|
100
|
+
overflow: hidden;
|
|
104
101
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
& h1 {
|
|
103
|
+
font-size: 24px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
& sub {
|
|
107
|
+
font-size: 16px;
|
|
108
|
+
color: ${viraFormCssVars['vira-form-secondary-body-foreground']
|
|
109
|
+
.value};
|
|
110
|
+
}
|
|
108
111
|
}
|
|
109
|
-
}
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
& button.close {
|
|
114
|
+
${noNativeFormStyles};
|
|
115
|
+
flex-shrink: 0;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
padding: 4px;
|
|
118
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
120
|
+
&:hover {
|
|
121
|
+
background-color: ${viraFormCssVars['vira-form-selection-hover-color'].value};
|
|
122
|
+
}
|
|
122
123
|
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
& ${ViraIcon} {
|
|
125
|
+
display: flex;
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
& .body {
|
|
130
|
+
padding: 16px 24px;
|
|
131
|
+
overflow: auto;
|
|
132
|
+
overscroll-behavior: contain;
|
|
133
|
+
}
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
|
-
}
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
${hostClasses['vira-modal-phone-size'].selector} {
|
|
138
|
+
& dialog {
|
|
139
|
+
width: 100dvw;
|
|
140
|
+
max-width: 100dvw;
|
|
141
|
+
/* Phones have little vertical space to spare, so nearly all of it goes to the
|
|
142
|
+
modal instead of the desktop-sized gap above and below it. */
|
|
143
|
+
max-height: calc(100dvh - 24px);
|
|
144
|
+
|
|
145
|
+
& .modal-content-wrapper {
|
|
146
|
+
& .header,
|
|
147
|
+
& .body {
|
|
148
|
+
padding: 12px 16px;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
139
152
|
}
|
|
140
|
-
}
|
|
141
153
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
154
|
+
/* Placed last so it also overrides the phone-size body padding above. */
|
|
155
|
+
${hostClasses['vira-modal-no-content-padding'].selector} {
|
|
156
|
+
& dialog .modal-content-wrapper .body {
|
|
157
|
+
padding: 0;
|
|
158
|
+
}
|
|
146
159
|
}
|
|
147
|
-
|
|
148
|
-
|
|
160
|
+
`;
|
|
161
|
+
},
|
|
149
162
|
render({ inputs, state, updateState, events, dispatch, slotNames }) {
|
|
150
163
|
if (state.dialogElement && inputs.open !== state.dialogElement.open) {
|
|
151
164
|
if (inputs.open) {
|
|
@@ -161,9 +174,11 @@ export const ViraModal = defineViraElement()({
|
|
|
161
174
|
previousOpenValue: inputs.open,
|
|
162
175
|
});
|
|
163
176
|
if (inputs.open) {
|
|
164
|
-
const removers = globalEventsToCloseModalOn.map((eventName) =>
|
|
165
|
-
|
|
166
|
-
|
|
177
|
+
const removers = globalEventsToCloseModalOn.map((eventName) => {
|
|
178
|
+
return listenToGlobal(eventName, () => {
|
|
179
|
+
dispatch(new events.modalClose());
|
|
180
|
+
});
|
|
181
|
+
});
|
|
167
182
|
updateState({
|
|
168
183
|
cleanupListeners: () => {
|
|
169
184
|
removers.forEach((remover) => remover());
|
|
@@ -22,29 +22,31 @@ export const ViraProgress = defineViraElement()({
|
|
|
22
22
|
'vira-progress-border-radius': '99999999px',
|
|
23
23
|
'vira-progress-height': '8px',
|
|
24
24
|
},
|
|
25
|
-
styles: ({ cssVars }) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
styles: ({ cssVars }) => {
|
|
26
|
+
return css `
|
|
27
|
+
:host {
|
|
28
|
+
/* Default width that can easily be overridden because it's applied on the host. */
|
|
29
|
+
width: 100px;
|
|
30
|
+
height: ${cssVars['vira-progress-height'].value};
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
border-radius: ${cssVars['vira-progress-border-radius'].value};
|
|
34
|
+
color: ${viraFormCssVars['vira-form-accent-primary-color'].value};
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
.progress-bar {
|
|
39
|
+
background-color: currentColor;
|
|
40
|
+
height: 100%;
|
|
41
|
+
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
.background-bar {
|
|
44
|
+
background-color: ${viraFormCssVars['vira-form-filled-background-color'].value};
|
|
45
|
+
height: 100%;
|
|
46
|
+
flex-grow: 1;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
},
|
|
48
50
|
render({ inputs, host }) {
|
|
49
51
|
const min = inputs.min || 0;
|
|
50
52
|
const max = inputs.max || 100;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
-
import { type AtLeastOneDuration, type FullDate } from 'date-vir';
|
|
2
|
+
import { type AtLeastOneDuration, type FullDate, type Timezone } from 'date-vir';
|
|
3
3
|
/**
|
|
4
4
|
* Displays a date/time as a live, relative timestamp (for example `5 minutes ago`). The relative
|
|
5
5
|
* string automatically updates over time. Optionally renders the absolute timestamp beneath the
|
|
@@ -26,7 +26,7 @@ export declare const ViraRelativeTime: import("element-vir").DeclarativeElementD
|
|
|
26
26
|
* stored at midnight UTC), where converting to the user's timezone would shift the
|
|
27
27
|
* displayed date/time.
|
|
28
28
|
*/
|
|
29
|
-
timezone:
|
|
29
|
+
timezone: Timezone;
|
|
30
30
|
}>, {
|
|
31
31
|
now: {
|
|
32
32
|
hour: import("date-vir").Hour;
|
|
@@ -57,158 +57,163 @@ export const ViraSelect = defineViraElement()({
|
|
|
57
57
|
'vira-select-error': ({ inputs }) => !!inputs.hasError,
|
|
58
58
|
'vira-select-not-raw': ({ inputs }) => !inputs.rawSelect,
|
|
59
59
|
},
|
|
60
|
-
styles: ({ hostClasses, cssVars }) =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.select-wrapper {
|
|
70
|
-
${noNativeFormStyles};
|
|
71
|
-
max-width: 100%;
|
|
72
|
-
flex-grow: 1;
|
|
73
|
-
display: inline-flex;
|
|
74
|
-
box-sizing: border-box;
|
|
75
|
-
align-items: center;
|
|
76
|
-
position: relative;
|
|
77
|
-
cursor: pointer;
|
|
60
|
+
styles: ({ hostClasses, cssVars }) => {
|
|
61
|
+
return css `
|
|
62
|
+
:host {
|
|
63
|
+
position: relative;
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
width: 223px;
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
color: ${viraFormCssVars['vira-form-foreground-color'].value};
|
|
68
|
+
}
|
|
78
69
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
border: none;
|
|
88
|
-
background: none;
|
|
89
|
-
border-radius: inherit;
|
|
70
|
+
.select-wrapper {
|
|
71
|
+
${noNativeFormStyles};
|
|
72
|
+
max-width: 100%;
|
|
73
|
+
flex-grow: 1;
|
|
74
|
+
display: inline-flex;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
align-items: center;
|
|
77
|
+
position: relative;
|
|
90
78
|
cursor: pointer;
|
|
91
|
-
/* Prevent the left pixel of text getting cut off. */
|
|
92
|
-
padding-left: 0.5px;
|
|
93
|
-
padding-right: 28px;
|
|
94
|
-
overflow: hidden;
|
|
95
|
-
text-overflow: ellipsis;
|
|
96
79
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
80
|
+
& select {
|
|
81
|
+
appearance: none;
|
|
82
|
+
-webkit-appearance: none;
|
|
83
|
+
-moz-appearance: none;
|
|
84
|
+
color: inherit;
|
|
85
|
+
font: inherit;
|
|
86
|
+
outline: none;
|
|
87
|
+
width: 100%;
|
|
88
|
+
border: none;
|
|
89
|
+
background: none;
|
|
90
|
+
border-radius: inherit;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
/* Prevent the left pixel of text getting cut off. */
|
|
93
|
+
padding-left: 0.5px;
|
|
94
|
+
padding-right: 28px;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
|
|
98
|
+
&.placeholder {
|
|
99
|
+
color: ${viraFormCssVars['vira-form-placeholder-color'].value};
|
|
100
|
+
}
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
&.with-icon {
|
|
103
|
+
padding-left: ${cssVars['vira-select-icon-padding'].value};
|
|
104
|
+
}
|
|
103
105
|
}
|
|
104
|
-
}
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
& ${ViraIcon} {
|
|
108
|
+
position: absolute;
|
|
109
|
+
pointer-events: none;
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
&.trigger-icon {
|
|
112
|
+
transform: rotate(180deg);
|
|
113
|
+
right: 3px;
|
|
114
|
+
}
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
&.input-icon {
|
|
117
|
+
left: 10px;
|
|
118
|
+
}
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
|
-
}
|
|
120
121
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
.trigger-icon {
|
|
123
|
+
width: 24px;
|
|
124
|
+
aspect-ratio: 1;
|
|
125
|
+
}
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
${hostClasses['vira-select-not-raw'].selector} {
|
|
128
|
+
.select-wrapper {
|
|
129
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
130
|
+
color: ${viraFormCssVars['vira-form-foreground-color'].value};
|
|
131
|
+
background-color: ${viraFormCssVars['vira-form-background-color'].value};
|
|
132
|
+
/*
|
|
132
133
|
Border colors are actually applied via the .wrapper-border class. However, we must
|
|
133
134
|
apply a border here still so that it takes up space.
|
|
134
135
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
border: 1px solid transparent;
|
|
137
|
+
cursor: pointer;
|
|
137
138
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
& select {
|
|
140
|
+
padding: ${cssVars['vira-select-padding-vertical'].value} 31px
|
|
141
|
+
${cssVars['vira-select-padding-vertical'].value}
|
|
142
|
+
${cssVars['vira-select-padding-horizontal'].value};
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
&:focus:focus-visible:not([aria-disabled='true']) ~ .focus-border {
|
|
145
|
+
${createFocusStyles({
|
|
146
|
+
elementBorderSize: '1px',
|
|
147
|
+
noNesting: true,
|
|
148
|
+
})}
|
|
149
|
+
}
|
|
148
150
|
}
|
|
149
|
-
}
|
|
150
151
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
& .border-style {
|
|
153
|
+
position: absolute;
|
|
154
|
+
top: 0;
|
|
155
|
+
left: 0;
|
|
156
|
+
width: 100%;
|
|
157
|
+
height: 100%;
|
|
158
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
159
|
+
z-index: 0;
|
|
160
|
+
pointer-events: none;
|
|
161
|
+
}
|
|
161
162
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
& .wrapper-border {
|
|
164
|
+
top: -1px;
|
|
165
|
+
left: -1px;
|
|
166
|
+
border: 1px solid ${viraFormCssVars['vira-form-border-color'].value};
|
|
167
|
+
transition: border
|
|
168
|
+
${viraAnimationDurations['vira-interaction-animation-duration'].value};
|
|
169
|
+
}
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
|
-
}
|
|
171
172
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
label {
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
justify-content: flex-start;
|
|
177
|
+
gap: 2px;
|
|
178
|
+
width: 100%;
|
|
179
|
+
max-width: 100%;
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
& .select-label {
|
|
182
|
+
font-weight: ${viraFormCssVars['vira-form-label-font-weight'].value};
|
|
183
|
+
text-align: left;
|
|
184
|
+
flex-shrink: 0;
|
|
185
|
+
flex-wrap: wrap;
|
|
186
|
+
}
|
|
185
187
|
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.readonly-value {
|
|
189
|
-
overflow-wrap: anywhere;
|
|
190
|
-
}
|
|
191
188
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
& select,
|
|
196
|
-
& .wrapper-border {
|
|
197
|
-
${viraDisabledStyles}
|
|
198
|
-
}
|
|
199
|
-
${ViraIcon} {
|
|
200
|
-
${viraDisabledStyles}
|
|
189
|
+
.readonly-value {
|
|
190
|
+
overflow-wrap: anywhere;
|
|
201
191
|
}
|
|
202
|
-
|
|
192
|
+
|
|
193
|
+
${hostClasses['vira-select-disabled'].selector} {
|
|
203
194
|
cursor: not-allowed;
|
|
195
|
+
|
|
196
|
+
& select,
|
|
197
|
+
& .wrapper-border {
|
|
198
|
+
${viraDisabledStyles}
|
|
199
|
+
}
|
|
200
|
+
${ViraIcon} {
|
|
201
|
+
${viraDisabledStyles}
|
|
202
|
+
}
|
|
203
|
+
& * {
|
|
204
|
+
cursor: not-allowed;
|
|
205
|
+
}
|
|
204
206
|
}
|
|
205
|
-
}
|
|
206
207
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
:host(
|
|
209
|
+
.${hostClasses['vira-select-not-raw'].name}.${hostClasses['vira-select-error']
|
|
210
|
+
.name}
|
|
211
|
+
)
|
|
212
|
+
.wrapper-border {
|
|
213
|
+
border-color: ${viraFormCssVars['vira-form-error-color'].value};
|
|
214
|
+
}
|
|
215
|
+
`;
|
|
216
|
+
},
|
|
212
217
|
init({ state, updateState, host }) {
|
|
213
218
|
state.cleanupListeners?.();
|
|
214
219
|
function getSelectElement() {
|
|
@@ -127,7 +127,9 @@ export const ViraTabs = defineViraElement()({
|
|
|
127
127
|
},
|
|
128
128
|
hostClasses: {
|
|
129
129
|
'vira-tabs-bar-top': ({ inputs }) => inputs.barDirection === ViraTabsBarDirection.Top,
|
|
130
|
-
'vira-tabs-bar-bottom': ({ inputs }) =>
|
|
130
|
+
'vira-tabs-bar-bottom': ({ inputs }) => {
|
|
131
|
+
return !inputs.barDirection || inputs.barDirection === ViraTabsBarDirection.Bottom;
|
|
132
|
+
},
|
|
131
133
|
'vira-tabs-bar-left': ({ inputs }) => inputs.barDirection === ViraTabsBarDirection.Left,
|
|
132
134
|
'vira-tabs-bar-right': ({ inputs }) => inputs.barDirection === ViraTabsBarDirection.Right,
|
|
133
135
|
...arrayToObject(getObjectTypedKeys(viraColorVariantToHostClassKey), (colorVariant) => {
|
|
@@ -153,8 +155,12 @@ export const ViraTabs = defineViraElement()({
|
|
|
153
155
|
}, {
|
|
154
156
|
useRequired: true,
|
|
155
157
|
}),
|
|
156
|
-
'vira-tabs-icon-layout-vertical': ({ inputs }) =>
|
|
157
|
-
|
|
158
|
+
'vira-tabs-icon-layout-vertical': ({ inputs }) => {
|
|
159
|
+
return !inputs.iconLayout || inputs.iconLayout === ViraTabsIconLayout.Vertical;
|
|
160
|
+
},
|
|
161
|
+
'vira-tabs-icon-layout-horizontal': ({ inputs }) => {
|
|
162
|
+
return inputs.iconLayout === ViraTabsIconLayout.Horizontal;
|
|
163
|
+
},
|
|
158
164
|
'vira-tabs-fill-width': ({ inputs }) => !!inputs.shouldFillWidth,
|
|
159
165
|
},
|
|
160
166
|
cssVars: {
|
|
@@ -638,7 +644,9 @@ export const ViraTabs = defineViraElement()({
|
|
|
638
644
|
*/
|
|
639
645
|
function maxInlineForReserve(reservePx) {
|
|
640
646
|
const limit = availableWidth - reservePx;
|
|
641
|
-
return tabElements.reduce((fittingCount, _tabElement, index) =>
|
|
647
|
+
return tabElements.reduce((fittingCount, _tabElement, index) => {
|
|
648
|
+
return inlineWidthForCount(index + 1) <= limit ? index + 1 : fittingCount;
|
|
649
|
+
}, 0);
|
|
642
650
|
}
|
|
643
651
|
/** When every tab fits on its own, there is no overflow and no "more" button. */
|
|
644
652
|
if (totalWidth <= availableWidth) {
|
|
@@ -717,9 +725,11 @@ export const ViraTabs = defineViraElement()({
|
|
|
717
725
|
const inlineCount = visibleTabs.length - overflowCount;
|
|
718
726
|
const inlineTabs = visibleTabs.slice(0, inlineCount);
|
|
719
727
|
const overflowTabs = visibleTabs.slice(inlineCount);
|
|
720
|
-
const selectedIndex = visibleTabs.findIndex((tab) =>
|
|
721
|
-
|
|
722
|
-
|
|
728
|
+
const selectedIndex = visibleTabs.findIndex((tab) => {
|
|
729
|
+
return routeHasPaths(inputs.currentRoute, tab.paths, {
|
|
730
|
+
exactMatch: tab.exactMatch,
|
|
731
|
+
});
|
|
732
|
+
});
|
|
723
733
|
const selectedTab = selectedIndex >= 0 ? visibleTabs[selectedIndex] : undefined;
|
|
724
734
|
/** Whether the selected tab is currently collapsed into the overflow menu. */
|
|
725
735
|
const selectedIsCollapsed = selectedIndex >= 0 && selectedIndex >= inlineCount;
|
|
@@ -170,7 +170,9 @@ export const ViraTag = defineViraElement()({
|
|
|
170
170
|
'vira-tag-size-large': ({ inputs }) => inputs.size === ViraSize.Large,
|
|
171
171
|
'vira-tag-size-medium': ({ inputs }) => !inputs.size || inputs.size === ViraSize.Medium,
|
|
172
172
|
'vira-tag-size-small': ({ inputs }) => inputs.size === ViraSize.Small,
|
|
173
|
-
'vira-tag-emphasis-standard': ({ inputs }) =>
|
|
173
|
+
'vira-tag-emphasis-standard': ({ inputs }) => {
|
|
174
|
+
return !inputs.emphasis || inputs.emphasis === ViraEmphasis.Standard;
|
|
175
|
+
},
|
|
174
176
|
'vira-tag-emphasis-subtle': ({ inputs }) => inputs.emphasis === ViraEmphasis.Subtle,
|
|
175
177
|
...arrayToObject(getObjectTypedKeys(viraColorVariantToHostClassKey), (colorVariant) => {
|
|
176
178
|
const colorKey = viraColorVariantToHostClassKey[colorVariant];
|