rw-elements-tools 1.3.5 → 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
|
+
}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
const getOrderClasses = (orderByBreakpoint = {}, orderCustomByBreakpoint = {}) => {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const getOrderClasses = (orderByBreakpoint = {}, orderCustomByBreakpoint = {}, breakpointNames = []) => {
|
|
2
|
+
const allBreakpoints = ["base", ...breakpointNames];
|
|
3
|
+
|
|
4
|
+
// Find custom value by cascading back through previous breakpoints
|
|
5
|
+
const getCustomValue = (currentBreakpoint) => {
|
|
6
|
+
const currentIndex = allBreakpoints.indexOf(currentBreakpoint);
|
|
7
|
+
for (let i = currentIndex; i >= 0; i--) {
|
|
8
|
+
const bp = allBreakpoints[i];
|
|
9
|
+
if (orderCustomByBreakpoint[bp] !== undefined) {
|
|
10
|
+
return orderCustomByBreakpoint[bp];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return allBreakpoints
|
|
17
|
+
.filter(bp => orderByBreakpoint[bp] !== undefined)
|
|
18
|
+
.map((breakpoint) => {
|
|
19
|
+
const value = orderByBreakpoint[breakpoint];
|
|
4
20
|
const prefix = breakpoint === "base" ? "" : `${breakpoint}:`;
|
|
5
|
-
const orderValue = value === "custom"
|
|
6
|
-
? `order-[${
|
|
21
|
+
const orderValue = value === "custom"
|
|
22
|
+
? `order-[${getCustomValue(breakpoint)}]`
|
|
7
23
|
: `order-${value}`;
|
|
8
24
|
return `${prefix}${orderValue}`;
|
|
9
25
|
})
|
|
@@ -40,6 +56,8 @@ const globalActAsGridOrFlexItem = (app) => {
|
|
|
40
56
|
globalGridOrFlexItemOrderCustom: orderCustomByBreakpoint,
|
|
41
57
|
} = app.responsiveProps;
|
|
42
58
|
|
|
59
|
+
const { names: breakpointNames } = app.theme.breakpoints;
|
|
60
|
+
|
|
43
61
|
if (displayAs == "default") {
|
|
44
62
|
return false;
|
|
45
63
|
}
|
|
@@ -55,7 +73,7 @@ const globalActAsGridOrFlexItem = (app) => {
|
|
|
55
73
|
shrink,
|
|
56
74
|
grow,
|
|
57
75
|
basis == "custom" ? basisCustom : basis,
|
|
58
|
-
getOrderClasses(orderByBreakpoint, orderCustomByBreakpoint)
|
|
76
|
+
getOrderClasses(orderByBreakpoint, orderCustomByBreakpoint, breakpointNames)
|
|
59
77
|
] : [])
|
|
60
78
|
);
|
|
61
79
|
}
|
|
@@ -71,7 +89,7 @@ const globalActAsGridOrFlexItem = (app) => {
|
|
|
71
89
|
rowEnd !== "row-end-auto" ? rowEnd : undefined,
|
|
72
90
|
alignSelf,
|
|
73
91
|
justifySelf,
|
|
74
|
-
getOrderClasses(orderByBreakpoint, orderCustomByBreakpoint)
|
|
92
|
+
getOrderClasses(orderByBreakpoint, orderCustomByBreakpoint, breakpointNames)
|
|
75
93
|
] : [])
|
|
76
94
|
);
|
|
77
95
|
}
|