vira 28.19.7 → 29.1.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/form/vira-form-fields.d.ts +11 -1
- package/dist/elements/form/vira-form-fields.js +1 -0
- package/dist/elements/form/vira-form.element.js +42 -0
- package/dist/elements/pop-up/vira-menu.element.js +2 -4
- package/dist/elements/pop-up/vira-pop-up-menu.element.js +3 -4
- package/dist/elements/vira-button.element.d.ts +5 -2
- package/dist/elements/vira-button.element.js +54 -18
- package/dist/elements/vira-card.element.d.ts +1 -1
- package/dist/elements/vira-card.element.js +15 -6
- package/dist/elements/vira-checkbox.element.d.ts +9 -5
- package/dist/elements/vira-checkbox.element.js +45 -15
- package/dist/elements/vira-dropdown.element.js +1 -2
- package/dist/elements/vira-error.element.js +1 -1
- package/dist/elements/vira-input.element.d.ts +3 -2
- package/dist/elements/vira-input.element.js +10 -16
- package/dist/elements/vira-link.element.d.ts +1 -1
- package/dist/elements/vira-link.element.js +7 -6
- package/dist/elements/vira-modal.element.d.ts +1 -1
- package/dist/elements/vira-modal.element.js +7 -9
- package/dist/elements/vira-progress.element.d.ts +1 -1
- package/dist/elements/vira-progress.element.js +3 -4
- package/dist/elements/vira-select.element.js +5 -4
- package/dist/styles/focus.d.ts +0 -13
- package/dist/styles/focus.js +3 -17
- package/dist/styles/form-styles.d.ts +114 -11
- package/dist/styles/form-styles.js +117 -12
- package/dist/styles/index.d.ts +0 -1
- package/dist/styles/index.js +0 -1
- package/dist/styles/native-styles.js +0 -1
- package/dist/styles/vira-color-palette.d.ts +86 -84
- package/dist/styles/vira-color-palette.js +86 -84
- package/dist/styles/vira-color-theme.d.ts +456 -60
- package/dist/styles/vira-color-theme.js +471 -93
- package/package.json +3 -3
- package/dist/styles/border.d.ts +0 -9
- package/dist/styles/border.js +0 -10
|
@@ -15,6 +15,7 @@ export declare enum ViraFormFieldType {
|
|
|
15
15
|
/** Uses a password input without any attributes applied for auto complete hints. */
|
|
16
16
|
PlainPassword = "plain-password",
|
|
17
17
|
Email = "email",
|
|
18
|
+
Number = "number",
|
|
18
19
|
Select = "select",
|
|
19
20
|
Checkbox = "checkbox"
|
|
20
21
|
}
|
|
@@ -75,7 +76,16 @@ export type ViraFormField = ({
|
|
|
75
76
|
}> & CommonViraFormFields) | ({
|
|
76
77
|
type: ViraFormFieldType.Checkbox;
|
|
77
78
|
value: boolean | undefined;
|
|
78
|
-
} & CommonViraFormFields)
|
|
79
|
+
} & CommonViraFormFields) | ({
|
|
80
|
+
type: ViraFormFieldType.Number;
|
|
81
|
+
value: number | undefined;
|
|
82
|
+
} & PartialWithUndefined<{
|
|
83
|
+
placeholder: string;
|
|
84
|
+
icon: ViraIconSvg;
|
|
85
|
+
min: number;
|
|
86
|
+
max: number;
|
|
87
|
+
step: number;
|
|
88
|
+
}> & CommonViraFormFields);
|
|
79
89
|
/**
|
|
80
90
|
* A collection of form fields for `ViraForm`.
|
|
81
91
|
*
|
|
@@ -15,6 +15,7 @@ export var ViraFormFieldType;
|
|
|
15
15
|
/** Uses a password input without any attributes applied for auto complete hints. */
|
|
16
16
|
ViraFormFieldType["PlainPassword"] = "plain-password";
|
|
17
17
|
ViraFormFieldType["Email"] = "email";
|
|
18
|
+
ViraFormFieldType["Number"] = "number";
|
|
18
19
|
ViraFormFieldType["Select"] = "select";
|
|
19
20
|
ViraFormFieldType["Checkbox"] = "checkbox";
|
|
20
21
|
})(ViraFormFieldType || (ViraFormFieldType = {}));
|
|
@@ -92,6 +92,48 @@ export const ViraForm = defineViraElement()({
|
|
|
92
92
|
></${ViraSelect}>
|
|
93
93
|
`;
|
|
94
94
|
}
|
|
95
|
+
else if (field.type === ViraFormFieldType.Number) {
|
|
96
|
+
return html `
|
|
97
|
+
<${ViraInput.assign({
|
|
98
|
+
value: field.value?.toString() || '',
|
|
99
|
+
disabled: inputs.isDisabled || field.isDisabled,
|
|
100
|
+
allowedInputs: /\d/,
|
|
101
|
+
hasError: field.hasError,
|
|
102
|
+
icon: field.icon,
|
|
103
|
+
label: applyRequiredLabel(field.label, !!field.isRequired && !inputs.hideRequiredMarkers),
|
|
104
|
+
placeholder: field.placeholder,
|
|
105
|
+
showClearButton: inputs.showClearButtons,
|
|
106
|
+
type: ViraInputType.Number,
|
|
107
|
+
attributePassthrough: {
|
|
108
|
+
...(field.min === undefined
|
|
109
|
+
? {}
|
|
110
|
+
: {
|
|
111
|
+
min: String(field.min),
|
|
112
|
+
}),
|
|
113
|
+
...(field.max === undefined
|
|
114
|
+
? {}
|
|
115
|
+
: {
|
|
116
|
+
max: String(field.max),
|
|
117
|
+
}),
|
|
118
|
+
...(field.step === undefined
|
|
119
|
+
? {}
|
|
120
|
+
: {
|
|
121
|
+
step: String(field.step),
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
})}
|
|
125
|
+
${field.testId ? testId(field.testId) : nothing}
|
|
126
|
+
${listen(ViraInput.events.valueChange, (event) => {
|
|
127
|
+
const numericValue = event.detail === '' ? undefined : Number(event.detail);
|
|
128
|
+
dispatch(new events.valueChange({
|
|
129
|
+
key,
|
|
130
|
+
...field,
|
|
131
|
+
value: numericValue,
|
|
132
|
+
}));
|
|
133
|
+
})}
|
|
134
|
+
></${ViraInput}>
|
|
135
|
+
`;
|
|
136
|
+
}
|
|
95
137
|
else {
|
|
96
138
|
return html `
|
|
97
139
|
<${ViraInput.assign({
|
|
@@ -64,8 +64,7 @@ export const ViraMenu = defineViraElement()({
|
|
|
64
64
|
baseSelector: '.menu-item:not(.disabled):not(.selected)',
|
|
65
65
|
navValue: NavValue.Active,
|
|
66
66
|
})}, .menu-item:not(.disabled):not(.selected):hover {
|
|
67
|
-
background-color: ${viraFormCssVars['vira-form-selection-hover-
|
|
68
|
-
.value};
|
|
67
|
+
background-color: ${viraFormCssVars['vira-form-selection-hover-color'].value};
|
|
69
68
|
outline: none;
|
|
70
69
|
}
|
|
71
70
|
|
|
@@ -80,8 +79,7 @@ export const ViraMenu = defineViraElement()({
|
|
|
80
79
|
navValue: NavValue.Active,
|
|
81
80
|
})},
|
|
82
81
|
.menu-item:not(.disabled):hover {
|
|
83
|
-
background-color: ${viraFormCssVars['vira-form-selection-hover-
|
|
84
|
-
.value};
|
|
82
|
+
background-color: ${viraFormCssVars['vira-form-selection-hover-color'].value};
|
|
85
83
|
outline: none;
|
|
86
84
|
}
|
|
87
85
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { css, html } from 'element-vir';
|
|
2
|
-
import { viraBorders } from '../../styles/border.js';
|
|
3
2
|
import { viraFormCssVars } from '../../styles/form-styles.js';
|
|
4
3
|
import { viraShadows } from '../../styles/shadows.js';
|
|
5
4
|
import { defineViraElement } from '../define-vira-element.js';
|
|
@@ -48,7 +47,7 @@ export const ViraPopUpMenu = defineViraElement()({
|
|
|
48
47
|
overflow-y: auto;
|
|
49
48
|
z-index: 99;
|
|
50
49
|
box-sizing: border-box;
|
|
51
|
-
border-radius: ${
|
|
50
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
52
51
|
border-top-left-radius: 0;
|
|
53
52
|
border-top-right-radius: 0;
|
|
54
53
|
background-color: ${viraFormCssVars['vira-form-background-color'].value};
|
|
@@ -59,7 +58,7 @@ export const ViraPopUpMenu = defineViraElement()({
|
|
|
59
58
|
|
|
60
59
|
${hostClasses['vira-pop-up-menu-open-upwards'].selector} {
|
|
61
60
|
${viraShadows.menuShadowReversed}
|
|
62
|
-
border-radius: ${
|
|
61
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
63
62
|
border-bottom-left-radius: 0;
|
|
64
63
|
border-bottom-right-radius: 0;
|
|
65
64
|
}
|
|
@@ -69,7 +68,7 @@ export const ViraPopUpMenu = defineViraElement()({
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
${hostClasses['vira-pop-up-menu-rounded'].selector} {
|
|
72
|
-
border-radius: ${
|
|
71
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
73
72
|
}
|
|
74
73
|
`,
|
|
75
74
|
render() {
|
|
@@ -7,7 +7,10 @@ import { type ViraIconSvg } from '../icons/index.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare enum ViraButtonStyle {
|
|
9
9
|
Default = "vira-button-default",
|
|
10
|
-
Outline = "vira-button-outline"
|
|
10
|
+
Outline = "vira-button-outline",
|
|
11
|
+
Danger = "vira-button-danger",
|
|
12
|
+
DangerOutline = "vira-button-danger-outline",
|
|
13
|
+
Ghost = "vira-button-ghost"
|
|
11
14
|
}
|
|
12
15
|
/**
|
|
13
16
|
* A custom button with default styling.
|
|
@@ -28,4 +31,4 @@ export declare const ViraButton: import("element-vir").DeclarativeElementDefinit
|
|
|
28
31
|
* @default false
|
|
29
32
|
*/
|
|
30
33
|
expandToFitIcon: boolean;
|
|
31
|
-
}>, {}, {}, "vira-button-outline-style" | "vira-button-
|
|
34
|
+
}>, {}, {}, "vira-button-outline-style" | "vira-button-danger-style" | "vira-button-ghost-style" | "vira-button-disabled" | "vira-button-expand-to-fit-icon" | "vira-button-icon-only" | "vira-button-default-style", "vira-button-padding" | "vira-button-internal-foreground-color" | "vira-button-internal-background-color", readonly [], readonly []>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css, html, nothing } from 'element-vir';
|
|
2
|
-
import { viraBorders } from '../styles/border.js';
|
|
3
2
|
import { viraDisabledStyles } from '../styles/disabled.js';
|
|
4
3
|
import { viraAnimationDurations } from '../styles/durations.js';
|
|
5
|
-
import { createFocusStyles
|
|
4
|
+
import { createFocusStyles } from '../styles/focus.js';
|
|
5
|
+
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
6
6
|
import { noUserSelect } from '../styles/index.js';
|
|
7
7
|
import { noNativeFormStyles } from '../styles/native-styles.js';
|
|
8
8
|
import { defineViraElement } from './define-vira-element.js';
|
|
@@ -16,6 +16,9 @@ export var ViraButtonStyle;
|
|
|
16
16
|
(function (ViraButtonStyle) {
|
|
17
17
|
ViraButtonStyle["Default"] = "vira-button-default";
|
|
18
18
|
ViraButtonStyle["Outline"] = "vira-button-outline";
|
|
19
|
+
ViraButtonStyle["Danger"] = "vira-button-danger";
|
|
20
|
+
ViraButtonStyle["DangerOutline"] = "vira-button-danger-outline";
|
|
21
|
+
ViraButtonStyle["Ghost"] = "vira-button-ghost";
|
|
19
22
|
})(ViraButtonStyle || (ViraButtonStyle = {}));
|
|
20
23
|
/**
|
|
21
24
|
* A custom button with default styling.
|
|
@@ -27,17 +30,17 @@ export var ViraButtonStyle;
|
|
|
27
30
|
export const ViraButton = defineViraElement()({
|
|
28
31
|
tagName: 'vira-button',
|
|
29
32
|
hostClasses: {
|
|
30
|
-
'vira-button-outline-style': ({ inputs }) => inputs.buttonStyle === ViraButtonStyle.Outline
|
|
33
|
+
'vira-button-outline-style': ({ inputs }) => inputs.buttonStyle === ViraButtonStyle.Outline ||
|
|
34
|
+
inputs.buttonStyle === ViraButtonStyle.DangerOutline,
|
|
35
|
+
'vira-button-danger-style': ({ inputs }) => inputs.buttonStyle === ViraButtonStyle.Danger ||
|
|
36
|
+
inputs.buttonStyle === ViraButtonStyle.DangerOutline,
|
|
37
|
+
'vira-button-ghost-style': ({ inputs }) => inputs.buttonStyle === ViraButtonStyle.Ghost,
|
|
31
38
|
'vira-button-disabled': ({ inputs }) => !!inputs.disabled,
|
|
32
39
|
'vira-button-expand-to-fit-icon': ({ inputs }) => !!inputs.expandToFitIcon,
|
|
40
|
+
'vira-button-icon-only': ({ inputs }) => !!inputs.icon && !inputs.text,
|
|
41
|
+
'vira-button-default-style': ({ inputs }) => !inputs.buttonStyle || inputs.buttonStyle === ViraButtonStyle.Default,
|
|
33
42
|
},
|
|
34
43
|
cssVars: {
|
|
35
|
-
/** On the default button style this is the background color. */
|
|
36
|
-
'vira-button-primary-color': '#0a89ff',
|
|
37
|
-
'vira-button-primary-hover-color': '#59b1ff',
|
|
38
|
-
'vira-button-primary-active-color': '#007ff6',
|
|
39
|
-
/** On the default button style this is the text color. */
|
|
40
|
-
'vira-button-secondary-color': '#ffffff',
|
|
41
44
|
'vira-button-padding': '5px 10px',
|
|
42
45
|
'vira-button-internal-foreground-color': 'transparent',
|
|
43
46
|
'vira-button-internal-background-color': 'transparent',
|
|
@@ -51,28 +54,61 @@ export const ViraButton = defineViraElement()({
|
|
|
51
54
|
align-items: center;
|
|
52
55
|
box-sizing: border-box;
|
|
53
56
|
${noUserSelect};
|
|
54
|
-
${cssVars['vira-button-internal-background-color'].name}: ${
|
|
55
|
-
${cssVars['vira-button-internal-foreground-color'].name}: ${
|
|
56
|
-
${
|
|
57
|
+
${cssVars['vira-button-internal-background-color'].name}: ${viraFormCssVars['vira-form-accent-primary-color'].value};
|
|
58
|
+
${cssVars['vira-button-internal-foreground-color'].name}: ${viraFormCssVars['vira-form-background-color'].value};
|
|
59
|
+
${viraFormCssVars['vira-form-focus-outline-color'].name}: ${viraFormCssVars['vira-form-accent-primary-hover-color'].value}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
${hostClasses['vira-button-disabled'].selector} {
|
|
63
|
+
${viraDisabledStyles};
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
:host(:hover) button,
|
|
60
67
|
button:hover {
|
|
61
|
-
${cssVars['vira-button-internal-background-color'].name}: ${
|
|
68
|
+
${cssVars['vira-button-internal-background-color'].name}: ${viraFormCssVars['vira-form-accent-primary-hover-color'].value};
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
:host(:active) button,
|
|
65
72
|
button:active {
|
|
66
|
-
${cssVars['vira-button-internal-background-color'].name}: ${
|
|
73
|
+
${cssVars['vira-button-internal-background-color'].name}: ${viraFormCssVars['vira-form-accent-primary-active-color'].value};
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
${hostClasses['vira-button-
|
|
70
|
-
|
|
76
|
+
${hostClasses['vira-button-danger-style'].selector} {
|
|
77
|
+
& button {
|
|
78
|
+
${cssVars['vira-button-internal-background-color'].name}: ${viraFormCssVars['vira-form-error-color'].value};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&:hover button,
|
|
82
|
+
& button:hover {
|
|
83
|
+
${cssVars['vira-button-internal-background-color'].name}: ${viraFormCssVars['vira-form-error-hover-color'].value};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:active button,
|
|
87
|
+
& button:active {
|
|
88
|
+
${cssVars['vira-button-internal-background-color'].name}: ${viraFormCssVars['vira-form-error-active-color'].value};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
${hostClasses['vira-button-ghost-style'].selector} {
|
|
93
|
+
& button {
|
|
94
|
+
${cssVars['vira-button-internal-background-color'].name}: transparent;
|
|
95
|
+
${cssVars['vira-button-internal-foreground-color'].name}: currentColor;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:hover button,
|
|
99
|
+
& button:hover {
|
|
100
|
+
${cssVars['vira-button-internal-background-color'].name}: ${viraFormCssVars['vira-form-filled-background-color'].value};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:active button,
|
|
104
|
+
& button:active {
|
|
105
|
+
${cssVars['vira-button-internal-background-color'].name}: ${viraFormCssVars['vira-form-filled-active-background-color'].value};
|
|
106
|
+
}
|
|
71
107
|
}
|
|
72
108
|
|
|
73
109
|
${hostClasses['vira-button-outline-style'].selector} button {
|
|
74
110
|
color: ${cssVars['vira-button-internal-background-color'].value};
|
|
75
|
-
background-color:
|
|
111
|
+
background-color: ${cssVars['vira-button-internal-foreground-color'].value};
|
|
76
112
|
border-color: currentColor;
|
|
77
113
|
}
|
|
78
114
|
|
|
@@ -87,7 +123,7 @@ export const ViraButton = defineViraElement()({
|
|
|
87
123
|
display: inline-flex;
|
|
88
124
|
justify-content: center;
|
|
89
125
|
align-items: center;
|
|
90
|
-
border-radius: ${
|
|
126
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
91
127
|
background-color: ${cssVars['vira-button-internal-background-color'].value};
|
|
92
128
|
color: ${cssVars['vira-button-internal-foreground-color'].value};
|
|
93
129
|
padding: ${cssVars['vira-button-padding'].value};
|
|
@@ -15,4 +15,4 @@ export declare enum ViraCardState {
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const ViraCard: import("element-vir").DeclarativeElementDefinition<"vira-card", {
|
|
17
17
|
cardState?: ViraCardState | undefined;
|
|
18
|
-
}, {}, {}, "vira-card-error" | "vira-card-success", "vira-card-border" | "vira-card-
|
|
18
|
+
}, {}, {}, "vira-card-error" | "vira-card-success", "vira-card-border" | "vira-card-padding", readonly [], readonly []>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { css, html } from 'element-vir';
|
|
2
|
+
import { CssVarSyntaxName } from 'lit-css-vars';
|
|
2
3
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
3
4
|
import { defineViraElement } from './define-vira-element.js';
|
|
4
5
|
/**
|
|
@@ -24,23 +25,31 @@ export const ViraCard = defineViraElement()({
|
|
|
24
25
|
'vira-card-success': ({ inputs }) => inputs.cardState === ViraCardState.Success,
|
|
25
26
|
},
|
|
26
27
|
cssVars: {
|
|
27
|
-
'vira-card-border':
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
'vira-card-border': {
|
|
29
|
+
default: css `1px solid ${viraFormCssVars['vira-form-border-color'].value}`,
|
|
30
|
+
initialValue: 'none',
|
|
31
|
+
},
|
|
32
|
+
'vira-card-padding': {
|
|
33
|
+
default: css `
|
|
34
|
+
${viraFormCssVars['vira-form-wrapper-radius'].value}
|
|
35
|
+
`,
|
|
36
|
+
initialValue: '16px',
|
|
37
|
+
syntax: CssVarSyntaxName.Length,
|
|
38
|
+
},
|
|
30
39
|
},
|
|
31
40
|
styles: ({ hostClasses, cssVars }) => css `
|
|
32
41
|
:host {
|
|
33
42
|
display: block;
|
|
34
43
|
border: ${cssVars['vira-card-border'].value};
|
|
35
|
-
border-radius: ${
|
|
44
|
+
border-radius: ${viraFormCssVars['vira-form-wrapper-radius'].value};
|
|
36
45
|
padding: ${cssVars['vira-card-padding'].value};
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
${hostClasses['vira-card-error'].selector} {
|
|
40
|
-
border-color: ${viraFormCssVars['vira-form-error-
|
|
49
|
+
border-color: ${viraFormCssVars['vira-form-error-color'].value};
|
|
41
50
|
}
|
|
42
51
|
${hostClasses['vira-card-success'].selector} {
|
|
43
|
-
border-color: ${viraFormCssVars['vira-form-success-
|
|
52
|
+
border-color: ${viraFormCssVars['vira-form-success-color'].value};
|
|
44
53
|
}
|
|
45
54
|
`,
|
|
46
55
|
render() {
|
|
@@ -12,16 +12,20 @@ export type ViraCheckboxInnerElements = 'label' | 'custom-checkbox' | 'text' | t
|
|
|
12
12
|
*
|
|
13
13
|
* @category Internal
|
|
14
14
|
*/
|
|
15
|
-
export type ViraCheckboxInputs =
|
|
15
|
+
export type ViraCheckboxInputs = {
|
|
16
|
+
value: boolean;
|
|
17
|
+
} & PartialWithUndefined<{
|
|
16
18
|
stylePassthrough: Partial<Record<ViraCheckboxInnerElements, CSSResult>>;
|
|
17
19
|
attributePassthrough: Partial<Record<ViraCheckboxInnerElements, AttributeValues>>;
|
|
18
20
|
disabled: boolean;
|
|
19
21
|
label: string;
|
|
20
22
|
hasError: boolean;
|
|
21
23
|
horizontal: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
/** The checkbox will be filled with a form selection color when it is checked. */
|
|
25
|
+
fillWhenChecked: boolean;
|
|
26
|
+
/** The checkbox will be filled with a form error color when it is unchecked. */
|
|
27
|
+
fillWhenUnchecked: boolean;
|
|
28
|
+
}>;
|
|
25
29
|
/**
|
|
26
30
|
* A custom checkbox.
|
|
27
31
|
*
|
|
@@ -31,4 +35,4 @@ export type ViraCheckboxInputs = PartialWithUndefined<{
|
|
|
31
35
|
*/
|
|
32
36
|
export declare const ViraCheckbox: import("element-vir").DeclarativeElementDefinition<"vira-checkbox", Readonly<ViraCheckboxInputs>, {}, {
|
|
33
37
|
valueChange: import("element-vir").DefineEvent<boolean>;
|
|
34
|
-
}, "vira-checkbox-horizontal", "vira-checkbox-", readonly [], readonly []>;
|
|
38
|
+
}, "vira-checkbox-horizontal" | "vira-checkbox-filled-checked" | "vira-checkbox-filled-unchecked", "vira-checkbox-", readonly [], readonly []>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { attributes, classMap, css, defineElementEvent, html, ifDefined, listen, listenToActivate, nothing, } from 'element-vir';
|
|
2
2
|
import { Check24Icon, viraIconCssVars } from '../icons/index.js';
|
|
3
|
-
import { viraBorders } from '../styles/border.js';
|
|
4
3
|
import { viraDisabledStyles } from '../styles/disabled.js';
|
|
5
4
|
import { createFocusStyles } from '../styles/focus.js';
|
|
6
5
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
@@ -17,6 +16,8 @@ export const ViraCheckbox = defineViraElement()({
|
|
|
17
16
|
tagName: 'vira-checkbox',
|
|
18
17
|
hostClasses: {
|
|
19
18
|
'vira-checkbox-horizontal': ({ inputs }) => !!inputs.horizontal,
|
|
19
|
+
'vira-checkbox-filled-checked': ({ inputs }) => !!inputs.fillWhenChecked,
|
|
20
|
+
'vira-checkbox-filled-unchecked': ({ inputs }) => !!inputs.fillWhenUnchecked,
|
|
20
21
|
},
|
|
21
22
|
styles: ({ hostClasses }) => css `
|
|
22
23
|
:host {
|
|
@@ -33,6 +34,43 @@ export const ViraCheckbox = defineViraElement()({
|
|
|
33
34
|
width: 100%;
|
|
34
35
|
height: 100%;
|
|
35
36
|
box-sizing: border-box;
|
|
37
|
+
${viraIconCssVars['vira-icon-stroke-width'].name}: 3px;
|
|
38
|
+
opacity: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${hostClasses['vira-checkbox-filled-checked'].selector} {
|
|
42
|
+
& .custom-checkbox.checked {
|
|
43
|
+
color: ${viraFormCssVars['vira-form-background-color'].value};
|
|
44
|
+
background-color: ${viraFormCssVars['vira-form-accent-primary-color'].value};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
label {
|
|
48
|
+
&:hover .custom-checkbox.checked {
|
|
49
|
+
background-color: ${viraFormCssVars['vira-form-accent-primary-hover-color']
|
|
50
|
+
.value};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:active .custom-checkbox.checked {
|
|
54
|
+
background-color: ${viraFormCssVars['vira-form-accent-primary-active-color']
|
|
55
|
+
.value};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
${hostClasses['vira-checkbox-filled-unchecked'].selector} {
|
|
60
|
+
& .custom-checkbox:not(.checked) {
|
|
61
|
+
color: ${viraFormCssVars['vira-form-background-color'].value};
|
|
62
|
+
background-color: ${viraFormCssVars['vira-form-error-color'].value};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
label {
|
|
66
|
+
&:hover .custom-checkbox:not(.checked) {
|
|
67
|
+
background-color: ${viraFormCssVars['vira-form-error-hover-color'].value};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:active .custom-checkbox:not(.checked) {
|
|
71
|
+
background-color: ${viraFormCssVars['vira-form-error-active-color'].value};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
36
74
|
}
|
|
37
75
|
|
|
38
76
|
label {
|
|
@@ -51,14 +89,11 @@ export const ViraCheckbox = defineViraElement()({
|
|
|
51
89
|
}
|
|
52
90
|
|
|
53
91
|
&:hover .custom-checkbox {
|
|
54
|
-
background-color: ${viraFormCssVars['vira-form-selection-hover-
|
|
55
|
-
|
|
92
|
+
background-color: ${viraFormCssVars['vira-form-selection-hover-color'].value};
|
|
93
|
+
}
|
|
94
|
+
&:active .custom-checkbox {
|
|
95
|
+
background-color: ${viraFormCssVars['vira-form-selection-active-color'].value};
|
|
56
96
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
${ViraIcon} {
|
|
60
|
-
${viraIconCssVars['vira-icon-stroke-width'].name}: 2px;
|
|
61
|
-
opacity: 0;
|
|
62
97
|
}
|
|
63
98
|
|
|
64
99
|
/* The visible custom box */
|
|
@@ -66,7 +101,7 @@ export const ViraCheckbox = defineViraElement()({
|
|
|
66
101
|
flex-shrink: 0;
|
|
67
102
|
border: 1px solid ${viraFormCssVars['vira-form-border-color'].value};
|
|
68
103
|
color: ${viraFormCssVars['vira-form-foreground-color'].value};
|
|
69
|
-
border-radius: ${
|
|
104
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
70
105
|
display: inline-block;
|
|
71
106
|
position: relative;
|
|
72
107
|
cursor: pointer;
|
|
@@ -80,12 +115,7 @@ export const ViraCheckbox = defineViraElement()({
|
|
|
80
115
|
}
|
|
81
116
|
|
|
82
117
|
&.error {
|
|
83
|
-
border-color: ${viraFormCssVars['vira-form-error-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&:active {
|
|
87
|
-
background-color: ${viraFormCssVars['vira-form-selection-active-background-color']
|
|
88
|
-
.value};
|
|
118
|
+
border-color: ${viraFormCssVars['vira-form-error-color'].value};
|
|
89
119
|
}
|
|
90
120
|
|
|
91
121
|
&.disabled {
|
|
@@ -2,7 +2,6 @@ import { check } from '@augment-vir/assert';
|
|
|
2
2
|
import { filterMap } from '@augment-vir/common';
|
|
3
3
|
import { classMap, css, defineElementEvent, html, ifDefined, listen, nothing, testId, } from 'element-vir';
|
|
4
4
|
import { ChevronUp24Icon } from '../icons/index.js';
|
|
5
|
-
import { viraBorders } from '../styles/border.js';
|
|
6
5
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
7
6
|
import { noUserSelect, viraAnimationDurations } from '../styles/index.js';
|
|
8
7
|
import { defineViraElement } from './define-vira-element.js';
|
|
@@ -87,7 +86,7 @@ export const ViraDropdown = defineViraElement()({
|
|
|
87
86
|
align-items: center;
|
|
88
87
|
padding: 3px;
|
|
89
88
|
padding-left: 10px;
|
|
90
|
-
border-radius: ${
|
|
89
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
91
90
|
background-color: ${viraFormCssVars['vira-form-background-color'].value};
|
|
92
91
|
color: ${viraFormCssVars['vira-form-foreground-color'].value};
|
|
93
92
|
}
|
|
@@ -14,7 +14,7 @@ export const ViraError = defineViraElement()({
|
|
|
14
14
|
},
|
|
15
15
|
styles: ({ cssVars }) => css `
|
|
16
16
|
:host {
|
|
17
|
-
color: ${viraFormCssVars['vira-form-error-
|
|
17
|
+
color: ${viraFormCssVars['vira-form-error-color'].value};
|
|
18
18
|
font-weight: ${cssVars['vira-error-font-weight'].value};
|
|
19
19
|
}
|
|
20
20
|
`,
|
|
@@ -9,7 +9,8 @@ export * from './shared-text-input-logic.js';
|
|
|
9
9
|
export declare enum ViraInputType {
|
|
10
10
|
Default = "text",
|
|
11
11
|
Password = "password",
|
|
12
|
-
Email = "email"
|
|
12
|
+
Email = "email",
|
|
13
|
+
Number = "number"
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* A single line input element with all listeners properly attached. Multiple types are allowed with
|
|
@@ -59,4 +60,4 @@ export declare const ViraInput: import("element-vir").DeclarativeElementDefiniti
|
|
|
59
60
|
* that was blocked out of programmatic "value" property assignments.
|
|
60
61
|
*/
|
|
61
62
|
inputBlocked: import("element-vir").DefineEvent<string>;
|
|
62
|
-
}, "vira-input-disabled" | "vira-input-fit-text" | "vira-input-clear-button-shown" | "vira-input-error", "vira-input-
|
|
63
|
+
}, "vira-input-disabled" | "vira-input-fit-text" | "vira-input-clear-button-shown" | "vira-input-error", "vira-input-padding-horizontal" | "vira-input-padding-vertical", readonly [], readonly []>;
|
|
@@ -6,7 +6,7 @@ import { CloseX24Icon } from '../icons/icon-svgs/close-x-24.icon.js';
|
|
|
6
6
|
import { EyeClosed24Icon, EyeOpen24Icon } from '../icons/index.js';
|
|
7
7
|
import { createFocusStyles } from '../styles/focus.js';
|
|
8
8
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
9
|
-
import { noUserSelect, viraAnimationDurations,
|
|
9
|
+
import { noUserSelect, viraAnimationDurations, viraDisabledStyles } from '../styles/index.js';
|
|
10
10
|
import { noNativeFormStyles } from '../styles/native-styles.js';
|
|
11
11
|
import { defineViraElement } from './define-vira-element.js';
|
|
12
12
|
import { filterTextInputValue, textInputListener, } from './shared-text-input-logic.js';
|
|
@@ -22,6 +22,7 @@ export var ViraInputType;
|
|
|
22
22
|
ViraInputType["Default"] = "text";
|
|
23
23
|
ViraInputType["Password"] = "password";
|
|
24
24
|
ViraInputType["Email"] = "email";
|
|
25
|
+
ViraInputType["Number"] = "number";
|
|
25
26
|
})(ViraInputType || (ViraInputType = {}));
|
|
26
27
|
/**
|
|
27
28
|
* A single line input element with all listeners properly attached. Multiple types are allowed with
|
|
@@ -34,13 +35,6 @@ export var ViraInputType;
|
|
|
34
35
|
export const ViraInput = defineViraElement()({
|
|
35
36
|
tagName: 'vira-input',
|
|
36
37
|
cssVars: {
|
|
37
|
-
'vira-input-action-button-color': '#aaaaaa',
|
|
38
|
-
'vira-input-clear-button-hover-color': '#ff0000',
|
|
39
|
-
'vira-input-clear-button-active-color': '#b30000',
|
|
40
|
-
// eslint-disable-next-line sonarjs/no-hardcoded-passwords
|
|
41
|
-
'vira-input-show-password-button-hover-color': '#0a89ff',
|
|
42
|
-
// eslint-disable-next-line sonarjs/no-hardcoded-passwords
|
|
43
|
-
'vira-input-show-password-button-active-color': '#0261ba',
|
|
44
38
|
'vira-input-padding-horizontal': '10px',
|
|
45
39
|
'vira-input-padding-vertical': '6px',
|
|
46
40
|
},
|
|
@@ -127,7 +121,7 @@ export const ViraInput = defineViraElement()({
|
|
|
127
121
|
left: 0;
|
|
128
122
|
width: 100%;
|
|
129
123
|
height: 100%;
|
|
130
|
-
border-radius: ${
|
|
124
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
131
125
|
z-index: 0;
|
|
132
126
|
pointer-events: none;
|
|
133
127
|
}
|
|
@@ -147,7 +141,7 @@ export const ViraInput = defineViraElement()({
|
|
|
147
141
|
align-items: center;
|
|
148
142
|
position: relative;
|
|
149
143
|
padding: 0 ${cssVars['vira-input-padding-horizontal'].value};
|
|
150
|
-
border-radius: ${
|
|
144
|
+
border-radius: ${viraFormCssVars['vira-form-radius'].value};
|
|
151
145
|
background-color: ${viraFormCssVars['vira-form-background-color'].value};
|
|
152
146
|
/*
|
|
153
147
|
Border colors are actually applied via the .wrapper-border class. However, we must
|
|
@@ -217,28 +211,28 @@ export const ViraInput = defineViraElement()({
|
|
|
217
211
|
|
|
218
212
|
.clear-x-button,
|
|
219
213
|
.show-password-button {
|
|
220
|
-
color: ${
|
|
214
|
+
color: ${viraFormCssVars['vira-form-placeholder-color'].value};
|
|
221
215
|
}
|
|
222
216
|
|
|
223
217
|
.clear-x-button:hover {
|
|
224
|
-
color: ${
|
|
218
|
+
color: ${viraFormCssVars['vira-form-error-color'].value};
|
|
225
219
|
}
|
|
226
220
|
|
|
227
221
|
.clear-x-button:active {
|
|
228
|
-
color: ${
|
|
222
|
+
color: ${viraFormCssVars['vira-form-error-active-color'].value};
|
|
229
223
|
}
|
|
230
224
|
|
|
231
225
|
.show-password-button:hover {
|
|
232
|
-
color: ${
|
|
226
|
+
color: ${viraFormCssVars['vira-form-accent-primary-color'].value};
|
|
233
227
|
}
|
|
234
228
|
|
|
235
229
|
.show-password-button:active {
|
|
236
|
-
color: ${
|
|
230
|
+
color: ${viraFormCssVars['vira-form-accent-primary-active-color'].value};
|
|
237
231
|
}
|
|
238
232
|
|
|
239
233
|
${hostClasses['vira-input-error'].selector} {
|
|
240
234
|
& .wrapper-border {
|
|
241
|
-
border-color: ${viraFormCssVars['vira-form-error-
|
|
235
|
+
border-color: ${viraFormCssVars['vira-form-error-color'].value};
|
|
242
236
|
}
|
|
243
237
|
}
|
|
244
238
|
|
|
@@ -70,4 +70,4 @@ export declare const ViraLink: import("element-vir").DeclarativeElementDefinitio
|
|
|
70
70
|
attributePassthrough: Readonly<PartialWithUndefined<{
|
|
71
71
|
a: AttributeValues;
|
|
72
72
|
}>>;
|
|
73
|
-
}>, {}, {}, "vira-link-", "vira-link-
|
|
73
|
+
}>, {}, {}, "vira-link-", "vira-link-", readonly [], readonly []>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { attributes, css, html, ifDefined, listen, } from 'element-vir';
|
|
2
|
+
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
2
3
|
import { defineViraElement } from './define-vira-element.js';
|
|
3
4
|
/**
|
|
4
5
|
* A hyperlink wrapper element that can be configured to emit route change events rather than just
|
|
@@ -10,10 +11,7 @@ import { defineViraElement } from './define-vira-element.js';
|
|
|
10
11
|
*/
|
|
11
12
|
export const ViraLink = defineViraElement()({
|
|
12
13
|
tagName: 'vira-link',
|
|
13
|
-
|
|
14
|
-
'vira-link-hover-color': 'currentColor',
|
|
15
|
-
},
|
|
16
|
-
styles: ({ cssVars }) => css `
|
|
14
|
+
styles: css `
|
|
17
15
|
:host {
|
|
18
16
|
display: inline;
|
|
19
17
|
text-decoration: underline;
|
|
@@ -30,10 +28,13 @@ export const ViraLink = defineViraElement()({
|
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
:host(:hover) a,
|
|
33
|
-
a:hover
|
|
31
|
+
a:hover {
|
|
32
|
+
color: ${viraFormCssVars['vira-form-accent-primary-color'].value};
|
|
33
|
+
}
|
|
34
|
+
|
|
34
35
|
:host(:active) a,
|
|
35
36
|
a:active {
|
|
36
|
-
color: ${
|
|
37
|
+
color: ${viraFormCssVars['vira-form-accent-primary-active-color'].value};
|
|
37
38
|
}
|
|
38
39
|
`,
|
|
39
40
|
render({ inputs }) {
|
|
@@ -36,4 +36,4 @@ export declare const ViraModal: import("element-vir").DeclarativeElementDefiniti
|
|
|
36
36
|
cleanup: undefined | (() => void);
|
|
37
37
|
}, {
|
|
38
38
|
modalClose: import("element-vir").DefineEvent<void>;
|
|
39
|
-
}, "vira-modal-phone-size", "vira-modal-backdrop-
|
|
39
|
+
}, "vira-modal-phone-size", "vira-modal-backdrop-filter", readonly ["modalTitle"], readonly []>;
|