vira 28.2.1 → 28.4.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/index.d.ts +2 -0
- package/dist/elements/index.js +2 -0
- package/dist/elements/vira-card.element.d.ts +18 -0
- package/dist/elements/vira-card.element.js +52 -0
- package/dist/elements/vira-error.element.d.ts +7 -0
- package/dist/elements/vira-error.element.js +26 -0
- package/package.json +1 -1
package/dist/elements/index.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ export * from './pop-up/vira-pop-up-menu.element.js';
|
|
|
8
8
|
export * from './pop-up/vira-pop-up-trigger.element.js';
|
|
9
9
|
export * from './vira-bold-text.element.js';
|
|
10
10
|
export * from './vira-button.element.js';
|
|
11
|
+
export * from './vira-card.element.js';
|
|
11
12
|
export * from './vira-checkbox.element.js';
|
|
12
13
|
export * from './vira-collapsible-wrapper.element.js';
|
|
13
14
|
export * from './vira-dropdown.element.js';
|
|
15
|
+
export * from './vira-error.element.js';
|
|
14
16
|
export * from './vira-icon.element.js';
|
|
15
17
|
export * from './vira-image.element.js';
|
|
16
18
|
export * from './vira-input.element.js';
|
package/dist/elements/index.js
CHANGED
|
@@ -8,9 +8,11 @@ export * from './pop-up/vira-pop-up-menu.element.js';
|
|
|
8
8
|
export * from './pop-up/vira-pop-up-trigger.element.js';
|
|
9
9
|
export * from './vira-bold-text.element.js';
|
|
10
10
|
export * from './vira-button.element.js';
|
|
11
|
+
export * from './vira-card.element.js';
|
|
11
12
|
export * from './vira-checkbox.element.js';
|
|
12
13
|
export * from './vira-collapsible-wrapper.element.js';
|
|
13
14
|
export * from './vira-dropdown.element.js';
|
|
15
|
+
export * from './vira-error.element.js';
|
|
14
16
|
export * from './vira-icon.element.js';
|
|
15
17
|
export * from './vira-image.element.js';
|
|
16
18
|
export * from './vira-input.element.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State options for {@link ViraCard}.
|
|
3
|
+
*
|
|
4
|
+
* @category Internal
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ViraCardState {
|
|
7
|
+
Error = "error",
|
|
8
|
+
Success = "success"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A simple wrapper "card" element that is just a `<slot>` with some styles.
|
|
12
|
+
*
|
|
13
|
+
* @category Elements
|
|
14
|
+
* @see https://electrovir.github.io/vira/book/elements/vira-card
|
|
15
|
+
*/
|
|
16
|
+
export declare const ViraCard: import("element-vir").DeclarativeElementDefinition<"vira-card", {
|
|
17
|
+
cardState?: ViraCardState | undefined;
|
|
18
|
+
}, {}, {}, "vira-card-error" | "vira-card-success", "vira-card-border" | "vira-card-border-radius" | "vira-card-error-color" | "vira-card-success-color" | "vira-card-padding", readonly [], readonly []>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { css, html } from 'element-vir';
|
|
2
|
+
import { defineViraElement } from './define-vira-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* State options for {@link ViraCard}.
|
|
5
|
+
*
|
|
6
|
+
* @category Internal
|
|
7
|
+
*/
|
|
8
|
+
export var ViraCardState;
|
|
9
|
+
(function (ViraCardState) {
|
|
10
|
+
ViraCardState["Error"] = "error";
|
|
11
|
+
ViraCardState["Success"] = "success";
|
|
12
|
+
})(ViraCardState || (ViraCardState = {}));
|
|
13
|
+
/**
|
|
14
|
+
* A simple wrapper "card" element that is just a `<slot>` with some styles.
|
|
15
|
+
*
|
|
16
|
+
* @category Elements
|
|
17
|
+
* @see https://electrovir.github.io/vira/book/elements/vira-card
|
|
18
|
+
*/
|
|
19
|
+
export const ViraCard = defineViraElement()({
|
|
20
|
+
tagName: 'vira-card',
|
|
21
|
+
hostClasses: {
|
|
22
|
+
'vira-card-error': ({ inputs }) => inputs.cardState === ViraCardState.Error,
|
|
23
|
+
'vira-card-success': ({ inputs }) => inputs.cardState === ViraCardState.Success,
|
|
24
|
+
},
|
|
25
|
+
cssVars: {
|
|
26
|
+
'vira-card-border': '1px solid #d3d3d3',
|
|
27
|
+
'vira-card-border-radius': '16px',
|
|
28
|
+
'vira-card-error-color': 'red',
|
|
29
|
+
'vira-card-success-color': 'green',
|
|
30
|
+
'vira-card-padding': '16px',
|
|
31
|
+
},
|
|
32
|
+
styles: ({ hostClasses, cssVars }) => css `
|
|
33
|
+
:host {
|
|
34
|
+
display: block;
|
|
35
|
+
border: ${cssVars['vira-card-border'].value};
|
|
36
|
+
border-radius: ${cssVars['vira-card-border-radius'].value};
|
|
37
|
+
padding: ${cssVars['vira-card-padding'].value};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
${hostClasses['vira-card-error'].selector} {
|
|
41
|
+
border-color: ${cssVars['vira-card-error-color'].value};
|
|
42
|
+
}
|
|
43
|
+
${hostClasses['vira-card-success'].selector} {
|
|
44
|
+
border-color: ${cssVars['vira-card-success-color'].value};
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
render() {
|
|
48
|
+
return html `
|
|
49
|
+
<slot></slot>
|
|
50
|
+
`;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An error wrapper that applies error coloring (red, by default).
|
|
3
|
+
*
|
|
4
|
+
* @category Elements
|
|
5
|
+
* @see https://electrovir.github.io/vira/book/elements/vira-error
|
|
6
|
+
*/
|
|
7
|
+
export declare const ViraError: import("element-vir").DeclarativeElementDefinition<"vira-error", {}, {}, {}, "vira-error-", "vira-error-color" | "vira-error-font-weight", readonly [], readonly []>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { css, html } from 'element-vir';
|
|
2
|
+
import { defineViraElement } from './define-vira-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* An error wrapper that applies error coloring (red, by default).
|
|
5
|
+
*
|
|
6
|
+
* @category Elements
|
|
7
|
+
* @see https://electrovir.github.io/vira/book/elements/vira-error
|
|
8
|
+
*/
|
|
9
|
+
export const ViraError = defineViraElement()({
|
|
10
|
+
tagName: 'vira-error',
|
|
11
|
+
cssVars: {
|
|
12
|
+
'vira-error-color': 'red',
|
|
13
|
+
'vira-error-font-weight': 'bold',
|
|
14
|
+
},
|
|
15
|
+
styles: ({ cssVars }) => css `
|
|
16
|
+
:host {
|
|
17
|
+
color: ${cssVars['vira-error-color'].value};
|
|
18
|
+
font-weight: ${cssVars['vira-error-font-weight'].value};
|
|
19
|
+
}
|
|
20
|
+
`,
|
|
21
|
+
render() {
|
|
22
|
+
return html `
|
|
23
|
+
<slot></slot>
|
|
24
|
+
`;
|
|
25
|
+
},
|
|
26
|
+
});
|