vira 29.5.6 → 29.6.1
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/index.d.ts +1 -0
- package/dist/elements/index.js +1 -0
- package/dist/elements/vira-tag.element.d.ts +35 -0
- package/dist/elements/vira-tag.element.js +294 -0
- package/dist/icons/icon-svgs/check-16.icon.d.ts +8 -0
- package/dist/icons/icon-svgs/check-16.icon.js +23 -0
- package/dist/icons/icon-svgs/close-x-16.icon.d.ts +8 -0
- package/dist/icons/icon-svgs/close-x-16.icon.js +23 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +6 -0
- package/dist/styles/form-styles.d.ts +3 -0
- package/dist/styles/form-styles.js +3 -0
- package/dist/styles/form-variants.d.ts +93 -0
- package/dist/styles/form-variants.js +120 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/index.js +2 -0
- package/dist/styles/vira-color-theme-object.d.ts +63 -0
- package/dist/styles/vira-color-theme-object.js +60 -0
- package/dist/styles/vira-color-theme.d.ts +1 -1
- package/dist/styles/vira-color-theme.js +198 -193
- package/package.json +8 -7
package/dist/elements/index.d.ts
CHANGED
package/dist/elements/index.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
+
import { type Primitive, type RequireExactlyOne } from 'type-fest';
|
|
3
|
+
import { ViraColorVariant, ViraEmphasis, ViraSize } from '../styles/form-variants.js';
|
|
4
|
+
/**
|
|
5
|
+
* A "tag" or "label" or "pill" element. Supports many variations including non-clickable,
|
|
6
|
+
* selectable, and cancellable variations.
|
|
7
|
+
*
|
|
8
|
+
* @category Elements
|
|
9
|
+
* @see https://electrovir.github.io/vira/book/elements/vira-tag
|
|
10
|
+
*/
|
|
11
|
+
export declare const ViraTag: import("element-vir").DeclarativeElementDefinition<"vira-tag", Readonly<{
|
|
12
|
+
text: Primitive;
|
|
13
|
+
} & PartialWithUndefined<{
|
|
14
|
+
isClickable: RequireExactlyOne<{
|
|
15
|
+
/**
|
|
16
|
+
* If set, the tag can be toggled on and off. If toggled on, a checkmark is shown.
|
|
17
|
+
*
|
|
18
|
+
* - `true`: show a checkmark
|
|
19
|
+
* - `false`: hide the checkmark
|
|
20
|
+
*/
|
|
21
|
+
selected: boolean;
|
|
22
|
+
/** If set, the tag shows an x. Clicks indicate removing the tag entirely. */
|
|
23
|
+
cancellable: true;
|
|
24
|
+
}>;
|
|
25
|
+
/** @default ViraSize.Medium */
|
|
26
|
+
size: ViraSize;
|
|
27
|
+
/** @default ViraEmphasis.Standard */
|
|
28
|
+
emphasis: ViraEmphasis;
|
|
29
|
+
/** @default ViraColor.Accent */
|
|
30
|
+
color: ViraColorVariant;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
}>>, {}, {
|
|
33
|
+
toggle: import("element-vir").DefineEvent<boolean>;
|
|
34
|
+
cancel: import("element-vir").DefineEvent<void>;
|
|
35
|
+
}, "vira-tag-selectable" | "vira-tag-checked" | "vira-tag-not-checked" | "vira-tag-cancellable" | "vira-tag-not-clickable" | "vira-tag-disabled" | "vira-tag-size-large" | "vira-tag-size-medium" | "vira-tag-size-small" | "vira-tag-emphasis-standard" | "vira-tag-emphasis-subtle" | "vira-tag-color-accent" | "vira-tag-color-plain" | "vira-tag-color-neutral" | "vira-tag-color-danger" | "vira-tag-color-warning" | "vira-tag-color-positive", "vira-tag-text-color" | "vira-tag-background-color" | "vira-tag-border-radius" | "vira-tag-gap" | "vira-tag-horizontal-padding" | "vira-tag-border-width", readonly [], readonly []>;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { check } from '@augment-vir/assert';
|
|
2
|
+
import { colorCss, ContrastLevelName } from '@electrovir/color';
|
|
3
|
+
import { css, defineElementEvent, html, listen, unsafeCSS } from 'element-vir';
|
|
4
|
+
import { themeDefaultKey } from 'theme-vir';
|
|
5
|
+
import { Check16Icon } from '../icons/icon-svgs/check-16.icon.js';
|
|
6
|
+
import { CloseX16Icon } from '../icons/icon-svgs/close-x-16.icon.js';
|
|
7
|
+
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
8
|
+
import { ViraColorVariant, viraColorVariantToColorName, ViraEmphasis, ViraSize, viraSizeHeights, } from '../styles/form-variants.js';
|
|
9
|
+
import { noNativeFormStyles } from '../styles/native-styles.js';
|
|
10
|
+
import { noUserSelect } from '../styles/user-select.js';
|
|
11
|
+
import { viraThemeByKeys } from '../styles/vira-color-theme-object.js';
|
|
12
|
+
import { viraTheme } from '../styles/vira-color-theme.js';
|
|
13
|
+
import { defineViraElement } from './define-vira-element.js';
|
|
14
|
+
import { ViraIcon } from './vira-icon.element.js';
|
|
15
|
+
// need to add hover colors to unchecked tags
|
|
16
|
+
function generateThemeCss(colorVariant) {
|
|
17
|
+
if (!check.hasKey(viraColorVariantToColorName, colorVariant)) {
|
|
18
|
+
throw new Error(`No ViraTag color for variant '${colorVariant}'`);
|
|
19
|
+
}
|
|
20
|
+
const viraThemeColorKey = viraColorVariantToColorName[colorVariant];
|
|
21
|
+
return css `
|
|
22
|
+
:host(
|
|
23
|
+
.vira-tag-color-${unsafeCSS(colorVariant)}.vira-tag-emphasis-${unsafeCSS(ViraEmphasis.Standard)}
|
|
24
|
+
)
|
|
25
|
+
button {
|
|
26
|
+
${colorCss(viraThemeByKeys[viraThemeColorKey]['behind-bg'][ContrastLevelName.NonBodyText])}
|
|
27
|
+
border-color: ${viraThemeByKeys[viraThemeColorKey]['behind-bg'][ContrastLevelName.NonBodyText].background.value};
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
${colorCss(viraThemeByKeys[viraThemeColorKey]['behind-bg'][ContrastLevelName.Header])}
|
|
31
|
+
border-color: ${viraThemeByKeys[viraThemeColorKey]['behind-bg'][ContrastLevelName.Header].background.value};
|
|
32
|
+
}
|
|
33
|
+
&:active {
|
|
34
|
+
${colorCss(viraThemeByKeys[viraThemeColorKey]['behind-bg'][ContrastLevelName.NonBodyText])}
|
|
35
|
+
border-color: ${viraThemeByKeys[viraThemeColorKey]['behind-bg'][ContrastLevelName.NonBodyText].background.value};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
:host(
|
|
39
|
+
.vira-tag-color-${unsafeCSS(colorVariant)}.vira-tag-emphasis-${unsafeCSS(ViraEmphasis.Subtle)}
|
|
40
|
+
)
|
|
41
|
+
button {
|
|
42
|
+
${colorCss(viraThemeByKeys[viraThemeColorKey]['on-self'][ContrastLevelName.BodyText])}
|
|
43
|
+
border-color: ${viraThemeByKeys[viraThemeColorKey]['on-self'][ContrastLevelName.BodyText].background.value};
|
|
44
|
+
|
|
45
|
+
&:hover {
|
|
46
|
+
${colorCss(viraThemeByKeys[viraThemeColorKey]['on-self'][ContrastLevelName.NonBodyText])}
|
|
47
|
+
border-color: ${viraThemeByKeys[viraThemeColorKey]['on-self'][ContrastLevelName.NonBodyText].background.value};
|
|
48
|
+
}
|
|
49
|
+
&:active {
|
|
50
|
+
${colorCss(viraThemeByKeys[viraThemeColorKey]['on-self'][ContrastLevelName.BodyText])}
|
|
51
|
+
border-color: ${viraThemeByKeys[viraThemeColorKey]['on-self'][ContrastLevelName.BodyText].background.value};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
:host(
|
|
55
|
+
.vira-tag-color-${unsafeCSS(colorVariant)}.vira-tag-not-checked.vira-tag-not-checked.vira-tag-not-checked
|
|
56
|
+
)
|
|
57
|
+
button {
|
|
58
|
+
color: ${viraThemeByKeys[viraThemeColorKey]['on-self'][ContrastLevelName.BodyText]
|
|
59
|
+
.foreground.value};
|
|
60
|
+
background-color: transparent;
|
|
61
|
+
border-color: ${viraThemeByKeys[viraThemeColorKey]['on-self'][ContrastLevelName.BodyText].background.value};
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
background-color: ${viraThemeByKeys[viraThemeColorKey]['behind-bg'][ContrastLevelName.Invisible].background.value};
|
|
65
|
+
}
|
|
66
|
+
&:active {
|
|
67
|
+
background-color: ${viraThemeByKeys[viraThemeColorKey]['behind-bg'][ContrastLevelName.Decoration].background.value};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
function generateAutomaticViraTagThemeVariants() {
|
|
73
|
+
return unsafeCSS([
|
|
74
|
+
ViraColorVariant.Accent,
|
|
75
|
+
ViraColorVariant.Danger,
|
|
76
|
+
ViraColorVariant.Neutral,
|
|
77
|
+
ViraColorVariant.Positive,
|
|
78
|
+
ViraColorVariant.Warning,
|
|
79
|
+
]
|
|
80
|
+
.map((variant) => generateThemeCss(variant))
|
|
81
|
+
.join(' '));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A "tag" or "label" or "pill" element. Supports many variations including non-clickable,
|
|
85
|
+
* selectable, and cancellable variations.
|
|
86
|
+
*
|
|
87
|
+
* @category Elements
|
|
88
|
+
* @see https://electrovir.github.io/vira/book/elements/vira-tag
|
|
89
|
+
*/
|
|
90
|
+
export const ViraTag = defineViraElement()({
|
|
91
|
+
tagName: 'vira-tag',
|
|
92
|
+
cssVars: {
|
|
93
|
+
'vira-tag-text-color': 'white',
|
|
94
|
+
'vira-tag-background-color': 'black',
|
|
95
|
+
'vira-tag-border-radius': '1000px',
|
|
96
|
+
'vira-tag-gap': '6px',
|
|
97
|
+
'vira-tag-horizontal-padding': '12px',
|
|
98
|
+
'vira-tag-border-width': '2px',
|
|
99
|
+
},
|
|
100
|
+
events: {
|
|
101
|
+
toggle: defineElementEvent(),
|
|
102
|
+
cancel: defineElementEvent(),
|
|
103
|
+
},
|
|
104
|
+
hostClasses: {
|
|
105
|
+
'vira-tag-selectable': ({ inputs }) => check.isBoolean(inputs.isClickable?.selected),
|
|
106
|
+
'vira-tag-checked': ({ inputs }) => !!inputs.isClickable?.selected,
|
|
107
|
+
'vira-tag-not-checked': ({ inputs }) => inputs.isClickable?.selected === false,
|
|
108
|
+
'vira-tag-cancellable': ({ inputs }) => !!inputs.isClickable?.cancellable,
|
|
109
|
+
'vira-tag-not-clickable': ({ inputs }) => !inputs.isClickable,
|
|
110
|
+
'vira-tag-disabled': ({ inputs }) => !!inputs.disabled,
|
|
111
|
+
'vira-tag-size-large': ({ inputs }) => inputs.size === ViraSize.Large,
|
|
112
|
+
'vira-tag-size-medium': ({ inputs }) => !inputs.size || inputs.size === ViraSize.Medium,
|
|
113
|
+
'vira-tag-size-small': ({ inputs }) => inputs.size === ViraSize.Small,
|
|
114
|
+
'vira-tag-emphasis-standard': ({ inputs }) => !inputs.emphasis || inputs.emphasis === ViraEmphasis.Standard,
|
|
115
|
+
'vira-tag-emphasis-subtle': ({ inputs }) => inputs.emphasis === ViraEmphasis.Subtle,
|
|
116
|
+
'vira-tag-color-accent': ({ inputs }) => !inputs.color || inputs.color === ViraColorVariant.Accent,
|
|
117
|
+
'vira-tag-color-plain': ({ inputs }) => inputs.color === ViraColorVariant.Plain,
|
|
118
|
+
'vira-tag-color-neutral': ({ inputs }) => inputs.color === ViraColorVariant.Neutral,
|
|
119
|
+
'vira-tag-color-danger': ({ inputs }) => inputs.color === ViraColorVariant.Danger,
|
|
120
|
+
'vira-tag-color-warning': ({ inputs }) => inputs.color === ViraColorVariant.Warning,
|
|
121
|
+
'vira-tag-color-positive': ({ inputs }) => inputs.color === ViraColorVariant.Positive,
|
|
122
|
+
},
|
|
123
|
+
styles: ({ cssVars, hostClasses }) => css `
|
|
124
|
+
:host {
|
|
125
|
+
display: flex;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
button {
|
|
129
|
+
${noNativeFormStyles}
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: ${cssVars['vira-tag-gap'].value};
|
|
134
|
+
border-radius: ${cssVars['vira-tag-border-radius'].value};
|
|
135
|
+
border-width: ${cssVars['vira-tag-border-width'].value};
|
|
136
|
+
border-style: solid;
|
|
137
|
+
border-color: transparent;
|
|
138
|
+
color: ${cssVars['vira-tag-text-color'].value};
|
|
139
|
+
background-color: ${cssVars['vira-tag-background-color'].value};
|
|
140
|
+
box-sizing: border-box;
|
|
141
|
+
padding: 0 ${cssVars['vira-tag-horizontal-padding'].value};
|
|
142
|
+
|
|
143
|
+
&[disabled] {
|
|
144
|
+
cursor: default;
|
|
145
|
+
pointer-events: none;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.cancel-x,
|
|
150
|
+
.selected-check,
|
|
151
|
+
.text {
|
|
152
|
+
height: 0;
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.cancel-x {
|
|
158
|
+
display: none;
|
|
159
|
+
margin-right: -2px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.selected-check {
|
|
163
|
+
margin-left: -2px;
|
|
164
|
+
display: none;
|
|
165
|
+
visibility: hidden;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
${hostClasses['vira-tag-selectable'].selector} .selected-check {
|
|
169
|
+
display: flex;
|
|
170
|
+
}
|
|
171
|
+
${hostClasses['vira-tag-checked'].selector} .selected-check {
|
|
172
|
+
visibility: visible;
|
|
173
|
+
}
|
|
174
|
+
${hostClasses['vira-tag-cancellable'].selector} .cancel-x {
|
|
175
|
+
display: flex;
|
|
176
|
+
}
|
|
177
|
+
${hostClasses['vira-tag-size-large'].selector} button {
|
|
178
|
+
height: ${viraSizeHeights[ViraSize.Large]}px;
|
|
179
|
+
font-size: ${viraFormCssVars['vira-form-large-text-size'].value};
|
|
180
|
+
padding: 0 var(${cssVars['vira-tag-horizontal-padding'].name}, 16px);
|
|
181
|
+
}
|
|
182
|
+
${hostClasses['vira-tag-size-medium'].selector} button {
|
|
183
|
+
height: ${viraSizeHeights[ViraSize.Medium]}px;
|
|
184
|
+
font-size: ${viraFormCssVars['vira-form-medium-text-size'].value};
|
|
185
|
+
}
|
|
186
|
+
${hostClasses['vira-tag-size-small'].selector} button {
|
|
187
|
+
height: ${viraSizeHeights[ViraSize.Small]}px;
|
|
188
|
+
font-size: ${viraFormCssVars['vira-form-small-text-size'].value};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
${generateAutomaticViraTagThemeVariants()}
|
|
192
|
+
|
|
193
|
+
:host(.${hostClasses['vira-tag-disabled'].name}.${hostClasses['vira-tag-disabled']
|
|
194
|
+
.name}.${hostClasses['vira-tag-disabled'].name}.${hostClasses['vira-tag-disabled']
|
|
195
|
+
.name}) {
|
|
196
|
+
cursor: not-allowed;
|
|
197
|
+
${noUserSelect}
|
|
198
|
+
|
|
199
|
+
& button {
|
|
200
|
+
${colorCss(viraTheme.colors['vira-grey-behind-bg-decoration'])}
|
|
201
|
+
border-color: ${viraTheme.colors['vira-grey-behind-bg-decoration'].background.value}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&.${hostClasses['vira-tag-emphasis-subtle'].name} button {
|
|
205
|
+
${colorCss(viraTheme.colors['vira-grey-behind-bg-decoration'])}
|
|
206
|
+
border-color: ${viraTheme.colors['vira-grey-behind-bg-decoration'].background.value}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
:host(
|
|
211
|
+
.${hostClasses['vira-tag-color-plain'].name}.vira-tag-emphasis-${unsafeCSS(ViraEmphasis.Standard)}
|
|
212
|
+
)
|
|
213
|
+
button {
|
|
214
|
+
${colorCss(viraTheme.inverse[themeDefaultKey])};
|
|
215
|
+
border-color: ${viraTheme.inverse[themeDefaultKey].background.value};
|
|
216
|
+
|
|
217
|
+
&:hover {
|
|
218
|
+
${colorCss(viraTheme.colors['vira-grey-behind-bg-non-body'])};
|
|
219
|
+
border-color: ${viraTheme.colors['vira-grey-behind-bg-non-body'].background.value};
|
|
220
|
+
}
|
|
221
|
+
&:active {
|
|
222
|
+
${colorCss(viraTheme.inverse[themeDefaultKey])};
|
|
223
|
+
border-color: ${viraTheme.inverse[themeDefaultKey].background.value};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
:host(
|
|
227
|
+
.${hostClasses['vira-tag-color-plain'].name}.vira-tag-emphasis-${unsafeCSS(ViraEmphasis.Subtle)}
|
|
228
|
+
)
|
|
229
|
+
button {
|
|
230
|
+
background-color: transparent;
|
|
231
|
+
color: ${viraTheme.colors[themeDefaultKey].foreground.value};
|
|
232
|
+
border-color: transparent;
|
|
233
|
+
}
|
|
234
|
+
:host(
|
|
235
|
+
.${hostClasses['vira-tag-color-plain'].name}.${hostClasses['vira-tag-not-checked']
|
|
236
|
+
.name}.${hostClasses['vira-tag-not-checked'].name}.${hostClasses['vira-tag-not-checked'].name}
|
|
237
|
+
)
|
|
238
|
+
button {
|
|
239
|
+
color: ${viraTheme.colors[themeDefaultKey].foreground.value};
|
|
240
|
+
background-color: transparent;
|
|
241
|
+
border-color: transparent;
|
|
242
|
+
}
|
|
243
|
+
:host(
|
|
244
|
+
.${hostClasses['vira-tag-color-plain'].name}.vira-tag-emphasis-${unsafeCSS(ViraEmphasis.Subtle)}
|
|
245
|
+
)
|
|
246
|
+
button,
|
|
247
|
+
:host(
|
|
248
|
+
.${hostClasses['vira-tag-color-plain'].name}.${hostClasses['vira-tag-not-checked']
|
|
249
|
+
.name}.${hostClasses['vira-tag-not-checked'].name}.${hostClasses['vira-tag-not-checked'].name}
|
|
250
|
+
)
|
|
251
|
+
button {
|
|
252
|
+
&:hover {
|
|
253
|
+
${colorCss(viraTheme.colors['vira-grey-behind-fg-small-body'])}
|
|
254
|
+
border-color: ${viraTheme.colors['vira-grey-behind-fg-small-body'].background
|
|
255
|
+
.value};
|
|
256
|
+
}
|
|
257
|
+
&:active {
|
|
258
|
+
${colorCss(viraTheme.colors['vira-grey-behind-fg-body'])}
|
|
259
|
+
border-color: ${viraTheme.colors['vira-grey-behind-fg-body'].background.value};
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
`,
|
|
263
|
+
render({ inputs, dispatch, events }) {
|
|
264
|
+
const disabled = !inputs.isClickable || !!inputs.disabled;
|
|
265
|
+
return html `
|
|
266
|
+
<button
|
|
267
|
+
?disabled=${disabled}
|
|
268
|
+
${listen('click', () => {
|
|
269
|
+
if (disabled) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
else if (inputs.isClickable?.selected != undefined) {
|
|
273
|
+
dispatch(new events.toggle(!inputs.isClickable.selected));
|
|
274
|
+
}
|
|
275
|
+
else if (inputs.isClickable?.cancellable) {
|
|
276
|
+
dispatch(new events.cancel());
|
|
277
|
+
}
|
|
278
|
+
})}
|
|
279
|
+
>
|
|
280
|
+
<${ViraIcon.assign({
|
|
281
|
+
icon: Check16Icon,
|
|
282
|
+
})}
|
|
283
|
+
class="selected-check"
|
|
284
|
+
></${ViraIcon}>
|
|
285
|
+
<span class="text">${String(inputs.text)}</span>
|
|
286
|
+
<${ViraIcon.assign({
|
|
287
|
+
icon: CloseX16Icon,
|
|
288
|
+
})}
|
|
289
|
+
class="cancel-x"
|
|
290
|
+
></${ViraIcon}>
|
|
291
|
+
</button>
|
|
292
|
+
`;
|
|
293
|
+
},
|
|
294
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { html } from 'element-vir';
|
|
2
|
+
import { viraIconCssVars } from '../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../icon-svg.js';
|
|
4
|
+
/**
|
|
5
|
+
* A checkmark (16px).
|
|
6
|
+
*
|
|
7
|
+
* @category Icon
|
|
8
|
+
* @category SVG
|
|
9
|
+
* @see https://electrovir.github.io/vira/book/icons/check16icon
|
|
10
|
+
*/
|
|
11
|
+
export const Check16Icon = defineIcon({
|
|
12
|
+
name: 'Check16Icon',
|
|
13
|
+
svgTemplate: html `
|
|
14
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
15
|
+
<path
|
|
16
|
+
d="m12 5-6 6-3-3"
|
|
17
|
+
fill="none"
|
|
18
|
+
stroke=${viraIconCssVars['vira-icon-stroke-color'].value}
|
|
19
|
+
stroke-width=${viraIconCssVars['vira-icon-stroke-width'].value}
|
|
20
|
+
/>
|
|
21
|
+
</svg>
|
|
22
|
+
`,
|
|
23
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { html } from 'element-vir';
|
|
2
|
+
import { viraIconCssVars } from '../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../icon-svg.js';
|
|
4
|
+
/**
|
|
5
|
+
* An x icon meant to be used as a "close" button (16px).
|
|
6
|
+
*
|
|
7
|
+
* @category Icon
|
|
8
|
+
* @category SVG
|
|
9
|
+
* @see https://electrovir.github.io/vira/book/icons/closex16icon
|
|
10
|
+
*/
|
|
11
|
+
export const CloseX16Icon = defineIcon({
|
|
12
|
+
name: 'CloseX16Icon',
|
|
13
|
+
svgTemplate: html `
|
|
14
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
15
|
+
<path
|
|
16
|
+
d="M4 4l8 8M12 4l-8 8"
|
|
17
|
+
fill="none"
|
|
18
|
+
stroke=${viraIconCssVars['vira-icon-stroke-color'].value}
|
|
19
|
+
stroke-width=${viraIconCssVars['vira-icon-stroke-width'].value}
|
|
20
|
+
/>
|
|
21
|
+
</svg>
|
|
22
|
+
`,
|
|
23
|
+
});
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ export * from './icon-svgs/arrow-up-24.icon.js';
|
|
|
6
6
|
export * from './icon-svgs/auto-theme-24.icon.js';
|
|
7
7
|
export * from './icon-svgs/bell-24.icon.js';
|
|
8
8
|
export * from './icon-svgs/chat-24.icon.js';
|
|
9
|
+
export * from './icon-svgs/check-16.icon.js';
|
|
9
10
|
export * from './icon-svgs/check-24.icon.js';
|
|
10
11
|
export * from './icon-svgs/chevron-down-24.icon.js';
|
|
11
12
|
export * from './icon-svgs/chevron-up-24.icon.js';
|
|
13
|
+
export * from './icon-svgs/close-x-16.icon.js';
|
|
12
14
|
export * from './icon-svgs/close-x-24.icon.js';
|
|
13
15
|
export * from './icon-svgs/commit-24.icon.js';
|
|
14
16
|
export * from './icon-svgs/copy-24.icon.js';
|
|
@@ -58,9 +60,11 @@ export declare const allIconsByName: {
|
|
|
58
60
|
readonly AutoTheme24Icon: import("./icon-svg.js").ViraIconSvg;
|
|
59
61
|
readonly Bell24Icon: import("./icon-svg.js").ViraIconSvg;
|
|
60
62
|
readonly Chat24Icon: import("./icon-svg.js").ViraIconSvg;
|
|
63
|
+
readonly Check16Icon: import("./icon-svg.js").ViraIconSvg;
|
|
61
64
|
readonly Check24Icon: import("./icon-svg.js").ViraIconSvg;
|
|
62
65
|
readonly ChevronDown24Icon: import("./icon-svg.js").ViraIconSvg;
|
|
63
66
|
readonly ChevronUp24Icon: import("./icon-svg.js").ViraIconSvg;
|
|
67
|
+
readonly CloseX16Icon: import("./icon-svg.js").ViraIconSvg;
|
|
64
68
|
readonly CloseX24Icon: import("./icon-svg.js").ViraIconSvg;
|
|
65
69
|
readonly Commit24Icon: import("./icon-svg.js").ViraIconSvg;
|
|
66
70
|
readonly Copy24Icon: import("./icon-svg.js").ViraIconSvg;
|
package/dist/icons/index.js
CHANGED
|
@@ -3,9 +3,11 @@ import { ArrowUp24Icon } from './icon-svgs/arrow-up-24.icon.js';
|
|
|
3
3
|
import { AutoTheme24Icon } from './icon-svgs/auto-theme-24.icon.js';
|
|
4
4
|
import { Bell24Icon } from './icon-svgs/bell-24.icon.js';
|
|
5
5
|
import { Chat24Icon } from './icon-svgs/chat-24.icon.js';
|
|
6
|
+
import { Check16Icon } from './icon-svgs/check-16.icon.js';
|
|
6
7
|
import { Check24Icon } from './icon-svgs/check-24.icon.js';
|
|
7
8
|
import { ChevronDown24Icon } from './icon-svgs/chevron-down-24.icon.js';
|
|
8
9
|
import { ChevronUp24Icon } from './icon-svgs/chevron-up-24.icon.js';
|
|
10
|
+
import { CloseX16Icon } from './icon-svgs/close-x-16.icon.js';
|
|
9
11
|
import { CloseX24Icon } from './icon-svgs/close-x-24.icon.js';
|
|
10
12
|
import { Commit24Icon } from './icon-svgs/commit-24.icon.js';
|
|
11
13
|
import { Copy24Icon } from './icon-svgs/copy-24.icon.js';
|
|
@@ -52,9 +54,11 @@ export * from './icon-svgs/arrow-up-24.icon.js';
|
|
|
52
54
|
export * from './icon-svgs/auto-theme-24.icon.js';
|
|
53
55
|
export * from './icon-svgs/bell-24.icon.js';
|
|
54
56
|
export * from './icon-svgs/chat-24.icon.js';
|
|
57
|
+
export * from './icon-svgs/check-16.icon.js';
|
|
55
58
|
export * from './icon-svgs/check-24.icon.js';
|
|
56
59
|
export * from './icon-svgs/chevron-down-24.icon.js';
|
|
57
60
|
export * from './icon-svgs/chevron-up-24.icon.js';
|
|
61
|
+
export * from './icon-svgs/close-x-16.icon.js';
|
|
58
62
|
export * from './icon-svgs/close-x-24.icon.js';
|
|
59
63
|
export * from './icon-svgs/commit-24.icon.js';
|
|
60
64
|
export * from './icon-svgs/copy-24.icon.js';
|
|
@@ -104,9 +108,11 @@ export const allIconsByName = {
|
|
|
104
108
|
AutoTheme24Icon,
|
|
105
109
|
Bell24Icon,
|
|
106
110
|
Chat24Icon,
|
|
111
|
+
Check16Icon,
|
|
107
112
|
Check24Icon,
|
|
108
113
|
ChevronDown24Icon,
|
|
109
114
|
ChevronUp24Icon,
|
|
115
|
+
CloseX16Icon,
|
|
110
116
|
CloseX24Icon,
|
|
111
117
|
Commit24Icon,
|
|
112
118
|
Copy24Icon,
|
|
@@ -19,6 +19,9 @@ export declare const viraFormCssVars: import("lit-css-vars").CssVarDefinitions<{
|
|
|
19
19
|
readonly 'vira-form-error-active-color': import("element-vir").CSSResult;
|
|
20
20
|
readonly 'vira-form-success-color': import("element-vir").CSSResult;
|
|
21
21
|
readonly 'vira-form-label-font-weight': "bold";
|
|
22
|
+
readonly 'vira-form-small-text-size': "12px";
|
|
23
|
+
readonly 'vira-form-medium-text-size': "16px";
|
|
24
|
+
readonly 'vira-form-large-text-size': "16px";
|
|
22
25
|
readonly 'vira-form-radius': "8px";
|
|
23
26
|
readonly 'vira-form-wrapper-radius': "16px";
|
|
24
27
|
readonly 'vira-form-focus-outline-color': import("element-vir").CSSResult;
|
|
@@ -25,6 +25,9 @@ export const viraFormCssVars = defineCssVars({
|
|
|
25
25
|
'vira-form-error-active-color': viraTheme.colors['vira-red-behind-bg-body'].background.value,
|
|
26
26
|
'vira-form-success-color': viraTheme.colors['vira-green-behind-bg-non-body'].background.value,
|
|
27
27
|
'vira-form-label-font-weight': 'bold',
|
|
28
|
+
'vira-form-small-text-size': '12px',
|
|
29
|
+
'vira-form-medium-text-size': '16px',
|
|
30
|
+
'vira-form-large-text-size': '16px',
|
|
28
31
|
'vira-form-radius': defaultViraFormRadius,
|
|
29
32
|
'vira-form-wrapper-radius': '16px',
|
|
30
33
|
'vira-form-focus-outline-color': viraTheme.colors['vira-blue-foreground-header'].foreground.value,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ViraThemeColorName } from './vira-color-theme-object.js';
|
|
2
|
+
/** All available variants for controlling vira form colors. */
|
|
3
|
+
export declare enum ViraColorVariant {
|
|
4
|
+
/**
|
|
5
|
+
* This is the default.
|
|
6
|
+
*
|
|
7
|
+
* @default blue colored
|
|
8
|
+
*/
|
|
9
|
+
Accent = "accent",
|
|
10
|
+
/** @default black colored */
|
|
11
|
+
Plain = "plain",
|
|
12
|
+
/** @default grey colored */
|
|
13
|
+
Neutral = "neutral",
|
|
14
|
+
/** @default red colored */
|
|
15
|
+
Danger = "danger",
|
|
16
|
+
/** @default orange colored */
|
|
17
|
+
Warning = "warning",
|
|
18
|
+
/** @default green colored */
|
|
19
|
+
Positive = "positive",
|
|
20
|
+
/**
|
|
21
|
+
* No color variant styles will be applied at all. All related CSS vars are free to customize to
|
|
22
|
+
* your wishes.
|
|
23
|
+
*/
|
|
24
|
+
None = "none"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Maps {@link ViraColorVariant} values that support colors to their respective vira theme color
|
|
28
|
+
* keys.
|
|
29
|
+
*
|
|
30
|
+
* @category Internal
|
|
31
|
+
*/
|
|
32
|
+
export declare const viraColorVariantToColorName: Record<Exclude<ViraColorVariant, ViraColorVariant.None | ViraColorVariant.Plain>, ViraThemeColorName>;
|
|
33
|
+
/**
|
|
34
|
+
* All defined color variants starting with the default.
|
|
35
|
+
*
|
|
36
|
+
* @category Internal
|
|
37
|
+
*/
|
|
38
|
+
export declare const viraColorVariants: readonly [ViraColorVariant.Accent, ViraColorVariant.Plain, ViraColorVariant.Neutral, ViraColorVariant.Danger, ViraColorVariant.Warning, ViraColorVariant.Positive];
|
|
39
|
+
/**
|
|
40
|
+
* All available variants for controlling vira form sizes.
|
|
41
|
+
*
|
|
42
|
+
* @category Internal
|
|
43
|
+
*/
|
|
44
|
+
export declare enum ViraSize {
|
|
45
|
+
/** @default 40px tall */
|
|
46
|
+
Large = "large",
|
|
47
|
+
/**
|
|
48
|
+
* This is the default.
|
|
49
|
+
*
|
|
50
|
+
* @default 32px tall
|
|
51
|
+
*/
|
|
52
|
+
Medium = "medium",
|
|
53
|
+
/** @default 24px tall */
|
|
54
|
+
Small = "small",
|
|
55
|
+
/**
|
|
56
|
+
* No size styles will be applied at all. All related CSS vars are free to customize to your
|
|
57
|
+
* wishes.
|
|
58
|
+
*/
|
|
59
|
+
None = "none"
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* All defined size variants starting with the default.
|
|
63
|
+
*
|
|
64
|
+
* @category Internal
|
|
65
|
+
*/
|
|
66
|
+
export declare const viraSizeVariants: readonly [ViraSize.Medium, ViraSize.Small, ViraSize.Large];
|
|
67
|
+
/**
|
|
68
|
+
* All available variants for controlling vira form emphasis.
|
|
69
|
+
*
|
|
70
|
+
* @category Internal
|
|
71
|
+
*/
|
|
72
|
+
export declare enum ViraEmphasis {
|
|
73
|
+
/** This is the default. */
|
|
74
|
+
Standard = "standard",
|
|
75
|
+
Subtle = "subtle",
|
|
76
|
+
/**
|
|
77
|
+
* No emphasis styles will be applied at all. All related CSS vars are free to customize to your
|
|
78
|
+
* wishes.
|
|
79
|
+
*/
|
|
80
|
+
None = "none"
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* All defined emphasis variants starting with the default.
|
|
84
|
+
*
|
|
85
|
+
* @category Internal
|
|
86
|
+
*/
|
|
87
|
+
export declare const viraEmphasisVariants: readonly [ViraEmphasis.Standard, ViraEmphasis.Subtle];
|
|
88
|
+
/**
|
|
89
|
+
* Default heights for {@link ViraSize} values.
|
|
90
|
+
*
|
|
91
|
+
* @category Internal
|
|
92
|
+
*/
|
|
93
|
+
export declare const viraSizeHeights: Record<Exclude<ViraSize, ViraSize.None>, number>;
|