vira 25.12.1 → 25.12.3
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 +1 -1
- package/dist/elements/pop-up/vira-menu-trigger.element.js +2 -3
- package/dist/elements/table/define-table.d.ts +12 -2
- package/dist/elements/table/vira-table.element.d.ts +13 -2
- package/dist/elements/table/vira-table.element.js +39 -6
- package/dist/elements/vira-dropdown.element.js +0 -1
- package/dist/styles/form-themes.d.ts +2 -0
- package/dist/styles/form-themes.js +2 -0
- package/package.json +2 -2
|
@@ -38,4 +38,4 @@ export declare const ViraMenuTrigger: import("element-vir").DeclarativeElementDe
|
|
|
38
38
|
}, {
|
|
39
39
|
itemActivate: import("element-vir").DefineEvent<PropertyKey[]>;
|
|
40
40
|
openChange: import("element-vir").DefineEvent<ShowPopUpResult | undefined>;
|
|
41
|
-
}, "vira-menu-trigger-", "vira-menu-trigger-", readonly [
|
|
41
|
+
}, "vira-menu-trigger-", "vira-menu-trigger-", readonly []>;
|
|
@@ -36,7 +36,6 @@ export const ViraMenuTrigger = defineViraElement()({
|
|
|
36
36
|
itemActivate: defineElementEvent(),
|
|
37
37
|
openChange: defineElementEvent(),
|
|
38
38
|
},
|
|
39
|
-
slotNames: ['trigger'],
|
|
40
39
|
state() {
|
|
41
40
|
return {
|
|
42
41
|
navController: undefined,
|
|
@@ -45,7 +44,7 @@ export const ViraMenuTrigger = defineViraElement()({
|
|
|
45
44
|
showPopUpResult: undefined,
|
|
46
45
|
};
|
|
47
46
|
},
|
|
48
|
-
render({ inputs, state, updateState, dispatch, events
|
|
47
|
+
render({ inputs, state, updateState, dispatch, events }) {
|
|
49
48
|
return html `
|
|
50
49
|
<${ViraPopUpTrigger.assign({
|
|
51
50
|
isDisabled: inputs.isDisabled,
|
|
@@ -82,7 +81,7 @@ export const ViraMenuTrigger = defineViraElement()({
|
|
|
82
81
|
}
|
|
83
82
|
})}
|
|
84
83
|
>
|
|
85
|
-
<slot slot=${
|
|
84
|
+
<slot slot=${ViraPopUpTrigger.slotNames.trigger}></slot>
|
|
86
85
|
${state.navController && state.showPopUpResult
|
|
87
86
|
? html `
|
|
88
87
|
<${ViraPopUpMenu.assign({
|
|
@@ -26,8 +26,18 @@ export type ViraTableColumns = ReadonlyArray<Readonly<{
|
|
|
26
26
|
* @category Internal
|
|
27
27
|
*/
|
|
28
28
|
export type ViraTableRow<Columns extends ViraTableColumns | undefined = undefined> = {
|
|
29
|
-
|
|
30
|
-
}
|
|
29
|
+
cells: ViraTableCell<Columns>;
|
|
30
|
+
} & PartialWithUndefined<{
|
|
31
|
+
/**
|
|
32
|
+
* If `true`, no actions will be fired from this row (like row clicks). No disable styles are
|
|
33
|
+
* applied.
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
/** Optional: keep track of which row is which by attaching an id to it. */
|
|
39
|
+
id: PropertyKey;
|
|
40
|
+
}>;
|
|
31
41
|
/**
|
|
32
42
|
* Table information input for `ViraTable`.
|
|
33
43
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
2
|
import { type AttributeValues, type CSSResult } from 'element-vir';
|
|
3
|
-
import { type ViraTableSetup } from './define-table.js';
|
|
3
|
+
import { type ViraTableRow, type ViraTableSetup } from './define-table.js';
|
|
4
4
|
/**
|
|
5
5
|
* Element tagnames that have passthroughs setup for them in {@link ViraTable}.
|
|
6
6
|
*
|
|
@@ -21,6 +21,12 @@ export declare const ViraTable: import("element-vir").DeclarativeElementDefiniti
|
|
|
21
21
|
*/
|
|
22
22
|
table: ViraTableSetup;
|
|
23
23
|
} & PartialWithUndefined<{
|
|
24
|
+
/**
|
|
25
|
+
* Block all rows from being clickable.
|
|
26
|
+
*
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
preventRowClicks: boolean;
|
|
24
30
|
/**
|
|
25
31
|
* Block the sticky table header.
|
|
26
32
|
*
|
|
@@ -43,4 +49,9 @@ export declare const ViraTable: import("element-vir").DeclarativeElementDefiniti
|
|
|
43
49
|
attributePassthrough: Readonly<PartialWithUndefined<Record<ViraTableElementsForPassthrough, AttributeValues>>>;
|
|
44
50
|
/** Styles that will be applied directly to the inner elements. */
|
|
45
51
|
stylePassthrough: Readonly<PartialWithUndefined<Record<ViraTableElementsForPassthrough, CSSResult>>>;
|
|
46
|
-
}>>, {}, {
|
|
52
|
+
}>>, {}, {
|
|
53
|
+
rowClick: import("element-vir").DefineEvent<{
|
|
54
|
+
row: ViraTableRow;
|
|
55
|
+
originalEvent: MouseEvent;
|
|
56
|
+
}>;
|
|
57
|
+
}, "vira-table-", "vira-table-", readonly []>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { attributes, css, html, ifDefined, nothing, } from 'element-vir';
|
|
1
|
+
import { attributes, classMap, css, defineElementEvent, html, ifDefined, listen, nothing, } from 'element-vir';
|
|
2
|
+
import { viraFormCssVars } from '../../styles/form-themes.js';
|
|
2
3
|
import { defineViraElement } from '../define-vira-element.js';
|
|
3
4
|
/**
|
|
4
5
|
* A flexible table element with automatic header pinning. Use {@link createTable} to create a
|
|
@@ -10,14 +11,19 @@ export const ViraTable = defineViraElement()({
|
|
|
10
11
|
tagName: 'vira-table',
|
|
11
12
|
styles: css `
|
|
12
13
|
:host {
|
|
13
|
-
background-color
|
|
14
|
+
background: ${viraFormCssVars['vira-form-background-color'].value};
|
|
14
15
|
display: block;
|
|
15
16
|
position: relative;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
table,
|
|
19
20
|
thead {
|
|
20
|
-
background
|
|
21
|
+
background: inherit;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
th,
|
|
25
|
+
td {
|
|
26
|
+
padding: 0;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
table {
|
|
@@ -26,10 +32,28 @@ export const ViraTable = defineViraElement()({
|
|
|
26
32
|
|
|
27
33
|
thead {
|
|
28
34
|
z-index: 10;
|
|
29
|
-
/*
|
|
35
|
+
/* Other important thead styles are directly attached to the HTML element. */
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.clickable {
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
color: ${viraFormCssVars['vira-form-selection-hover-foreground-color'].value};
|
|
43
|
+
background-color: ${viraFormCssVars['vira-form-selection-hover-background-color']
|
|
44
|
+
.value};
|
|
45
|
+
}
|
|
46
|
+
&:active {
|
|
47
|
+
color: ${viraFormCssVars['vira-form-selection-active-foreground-color'].value};
|
|
48
|
+
background-color: ${viraFormCssVars['vira-form-selection-active-background-color']
|
|
49
|
+
.value};
|
|
50
|
+
}
|
|
30
51
|
}
|
|
31
52
|
`,
|
|
32
|
-
|
|
53
|
+
events: {
|
|
54
|
+
rowClick: defineElementEvent(),
|
|
55
|
+
},
|
|
56
|
+
render({ inputs, events, dispatch }) {
|
|
33
57
|
const rows = inputs.table.rows.map((row) => {
|
|
34
58
|
const cells = inputs.table.columns.map((column) => {
|
|
35
59
|
if (column.hide) {
|
|
@@ -42,16 +66,25 @@ export const ViraTable = defineViraElement()({
|
|
|
42
66
|
: nothing}
|
|
43
67
|
style=${ifDefined(inputs.stylePassthrough?.td)}
|
|
44
68
|
>
|
|
45
|
-
${row.
|
|
69
|
+
${row.cells[column.key]}
|
|
46
70
|
</td>
|
|
47
71
|
`;
|
|
48
72
|
});
|
|
73
|
+
const isClickable = !inputs.preventRowClicks && !row.disabled;
|
|
49
74
|
return html `
|
|
50
75
|
<tr
|
|
76
|
+
class=${classMap({
|
|
77
|
+
clickable: isClickable,
|
|
78
|
+
})}
|
|
51
79
|
${inputs.attributePassthrough?.tr
|
|
52
80
|
? attributes(inputs.attributePassthrough.tr)
|
|
53
81
|
: nothing}
|
|
54
82
|
style=${ifDefined(inputs.stylePassthrough?.tr)}
|
|
83
|
+
${listen('click', (event) => {
|
|
84
|
+
if (isClickable) {
|
|
85
|
+
dispatch(new events.rowClick({ originalEvent: event, row }));
|
|
86
|
+
}
|
|
87
|
+
})}
|
|
55
88
|
>
|
|
56
89
|
${cells}
|
|
57
90
|
</tr>
|
|
@@ -11,4 +11,6 @@ export declare const viraFormCssVars: import("lit-css-vars").CssVarDefinitions<{
|
|
|
11
11
|
readonly 'vira-form-focus-color': import("lit").CSSResult;
|
|
12
12
|
readonly 'vira-form-selection-hover-background-color': "#d2eaff";
|
|
13
13
|
readonly 'vira-form-selection-hover-foreground-color': "black";
|
|
14
|
+
readonly 'vira-form-selection-active-background-color': "#d2eaff";
|
|
15
|
+
readonly 'vira-form-selection-active-foreground-color': "black";
|
|
14
16
|
}>;
|
|
@@ -13,4 +13,6 @@ export const viraFormCssVars = defineCssVars({
|
|
|
13
13
|
'vira-form-focus-color': viraFocusCssVars['vira-focus-outline-color'].value,
|
|
14
14
|
'vira-form-selection-hover-background-color': '#d2eaff',
|
|
15
15
|
'vira-form-selection-hover-foreground-color': 'black',
|
|
16
|
+
'vira-form-selection-active-background-color': '#d2eaff',
|
|
17
|
+
'vira-form-selection-active-foreground-color': 'black',
|
|
16
18
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "25.12.
|
|
3
|
+
"version": "25.12.3",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vite-tsconfig-paths": "^5.1.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"element-vir": "^25.12.
|
|
70
|
+
"element-vir": "^25.12.3"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=22"
|