rw-elements-tools 1.3.6 → 1.3.7
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.
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const BordersTable = [
|
|
2
|
+
{
|
|
3
|
+
globalControl: "ControlType",
|
|
4
|
+
id: "{{value}}Borders",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
visible: "globalControlTypeBorders == 'hover'",
|
|
8
|
+
title: "State",
|
|
9
|
+
id: "globalBordersState",
|
|
10
|
+
responsive: false,
|
|
11
|
+
segmented: {
|
|
12
|
+
default: "start",
|
|
13
|
+
items: [
|
|
14
|
+
{
|
|
15
|
+
title: "Start",
|
|
16
|
+
value: "start",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: "End",
|
|
20
|
+
value: "end",
|
|
21
|
+
},
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
divider: {},
|
|
27
|
+
visible: "globalControlTypeBorders != 'none'",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
visible: "globalControlTypeBorders == 'static' || (globalControlTypeBorders == 'hover' && globalBordersState == 'start')",
|
|
31
|
+
globalControl: "BorderStyle",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
visible: "globalControlTypeBorders == 'static' || (globalControlTypeBorders == 'hover' && globalBordersState == 'start')",
|
|
35
|
+
globalControl: "BorderColor",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
visible: "globalControlTypeBorders == 'static' || (globalControlTypeBorders == 'hover' && globalBordersState == 'start')",
|
|
39
|
+
globalControl: "BorderWidth",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
visible: "(globalControlTypeBorders == 'hover' && globalBordersState == 'end')",
|
|
43
|
+
globalControl: "BorderStyle",
|
|
44
|
+
id: "{{value}}End",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
visible: "(globalControlTypeBorders == 'hover' && globalBordersState == 'end')",
|
|
48
|
+
globalControl: "BorderColor",
|
|
49
|
+
id: "{{value}}End",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
visible: "(globalControlTypeBorders == 'hover' && globalBordersState == 'end')",
|
|
53
|
+
globalControl: "BorderWidth",
|
|
54
|
+
id: "{{value}}End",
|
|
55
|
+
format: "hover:{{value}}",
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
export default BordersTable;
|
package/controls/index.js
CHANGED
|
@@ -48,6 +48,7 @@ export { BorderHover } from "./Borders/Border.js";
|
|
|
48
48
|
export { default as Borders } from "./Borders/Borders.js";
|
|
49
49
|
export { default as BordersContainer } from "./Borders/BordersContainer.js";
|
|
50
50
|
export { default as BordersInput } from "./Borders/BordersInput.js";
|
|
51
|
+
export { default as BordersTable } from "./Borders/BordersTable.js";
|
|
51
52
|
export { default as BorderColor } from "./Borders/BorderColor.js";
|
|
52
53
|
export { default as BorderRadius } from "./Borders/BorderRadius.js";
|
|
53
54
|
export { default as BorderStyle } from "./Borders/BorderStyle.js";
|
package/package.json
CHANGED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const globalBordersTable = (app, args = {}) => {
|
|
2
|
+
const {
|
|
3
|
+
globalControlTypeBorders: type,
|
|
4
|
+
globalBordersColor: color,
|
|
5
|
+
globalBordersColorOpacity: colorOpacity,
|
|
6
|
+
globalBordersWidth: width,
|
|
7
|
+
globalBordersStyle: style,
|
|
8
|
+
globalBordersColorEnd: colorEnd,
|
|
9
|
+
globalBordersColorOpacityEnd: colorOpacityEnd,
|
|
10
|
+
globalBordersWidthEnd: widthEnd,
|
|
11
|
+
globalBordersStyleEnd: styleEnd,
|
|
12
|
+
} = app.props;
|
|
13
|
+
|
|
14
|
+
const classes = [];
|
|
15
|
+
|
|
16
|
+
const { node } = app;
|
|
17
|
+
node.isContainer = args.isContainer || false;
|
|
18
|
+
const wantsActive = args.active || false;
|
|
19
|
+
const wantsFocus = args.focus || false;
|
|
20
|
+
|
|
21
|
+
if (type == 'none') {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
classes.push(
|
|
26
|
+
width,
|
|
27
|
+
style,
|
|
28
|
+
color.split(' ')
|
|
29
|
+
.filter(Boolean) // Remove empty strings
|
|
30
|
+
.map(c => `${c.trim()}/${colorOpacity}`)
|
|
31
|
+
.join(' '),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const prefix = getHoverPrefix(node, 'background', 'self');
|
|
35
|
+
if (type == 'hover') {
|
|
36
|
+
classes.push(
|
|
37
|
+
widthEnd,
|
|
38
|
+
`${prefix}:${styleEnd}`,
|
|
39
|
+
colorEnd.split(' ')
|
|
40
|
+
.filter(Boolean)
|
|
41
|
+
.map(c => `${prefix}:${c.trim()}/${colorOpacityEnd}`)
|
|
42
|
+
.join(' '),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (wantsActive) {
|
|
47
|
+
const endColor = type == 'hover' ? colorEnd : color;
|
|
48
|
+
const endWidth = type == 'hover' ? widthEnd : width;
|
|
49
|
+
const endStyle = type == 'hover' ? styleEnd : style;
|
|
50
|
+
|
|
51
|
+
classes.push(
|
|
52
|
+
endWidth.replace(/hover/g, 'data-[active=true]'),
|
|
53
|
+
`data-[active=true]:${endStyle}`,
|
|
54
|
+
endColor.split(' ')
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
.map(c => `data-[active=true]:${c.trim()}/${colorOpacityEnd}`)
|
|
57
|
+
.join(' '),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (wantsFocus) {
|
|
62
|
+
const endColor = type == 'hover' ? colorEnd : color;
|
|
63
|
+
const endWidth = type == 'hover' ? widthEnd : width;
|
|
64
|
+
const endStyle = type == 'hover' ? styleEnd : style;
|
|
65
|
+
|
|
66
|
+
classes.push(
|
|
67
|
+
endWidth.replace(/hover/g, 'focus'),
|
|
68
|
+
`${prefix.replace(/hover/g, "focus")}:${endStyle}`,
|
|
69
|
+
endColor.split(' ')
|
|
70
|
+
.filter(Boolean)
|
|
71
|
+
.map(c => `${prefix.replace(/hover/g, "focus")}:${c.trim()}/${colorOpacityEnd}`)
|
|
72
|
+
.join(' '),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return classnames(classes).toString();
|
|
77
|
+
}
|