@chakra-v2/styled-system
Version:
Style function for css-in-js building component libraries
138 lines (135 loc) • 5.28 kB
JavaScript
import { t } from '../utils/index.mjs';
const border = {
border: t.borders("border"),
borderWidth: t.borderWidths("borderWidth"),
borderStyle: t.borderStyles("borderStyle"),
borderColor: t.colors("borderColor"),
borderRadius: t.radii("borderRadius"),
borderTop: t.borders("borderTop"),
borderBlockStart: t.borders("borderBlockStart"),
borderTopLeftRadius: t.radii("borderTopLeftRadius"),
borderStartStartRadius: t.logical({
scale: "radii",
property: {
ltr: "borderTopLeftRadius",
rtl: "borderTopRightRadius"
}
}),
borderEndStartRadius: t.logical({
scale: "radii",
property: {
ltr: "borderBottomLeftRadius",
rtl: "borderBottomRightRadius"
}
}),
borderTopRightRadius: t.radii("borderTopRightRadius"),
borderStartEndRadius: t.logical({
scale: "radii",
property: {
ltr: "borderTopRightRadius",
rtl: "borderTopLeftRadius"
}
}),
borderEndEndRadius: t.logical({
scale: "radii",
property: {
ltr: "borderBottomRightRadius",
rtl: "borderBottomLeftRadius"
}
}),
borderRight: t.borders("borderRight"),
borderInlineEnd: t.borders("borderInlineEnd"),
borderBottom: t.borders("borderBottom"),
borderBlockEnd: t.borders("borderBlockEnd"),
borderBottomLeftRadius: t.radii("borderBottomLeftRadius"),
borderBottomRightRadius: t.radii("borderBottomRightRadius"),
borderLeft: t.borders("borderLeft"),
borderInlineStart: {
property: "borderInlineStart",
scale: "borders"
},
borderInlineStartRadius: t.logical({
scale: "radii",
property: {
ltr: ["borderTopLeftRadius", "borderBottomLeftRadius"],
rtl: ["borderTopRightRadius", "borderBottomRightRadius"]
}
}),
borderInlineEndRadius: t.logical({
scale: "radii",
property: {
ltr: ["borderTopRightRadius", "borderBottomRightRadius"],
rtl: ["borderTopLeftRadius", "borderBottomLeftRadius"]
}
}),
borderX: t.borders(["borderLeft", "borderRight"]),
borderInline: t.borders("borderInline"),
borderY: t.borders(["borderTop", "borderBottom"]),
borderBlock: t.borders("borderBlock"),
borderTopWidth: t.borderWidths("borderTopWidth"),
borderBlockStartWidth: t.borderWidths("borderBlockStartWidth"),
borderTopColor: t.colors("borderTopColor"),
borderBlockStartColor: t.colors("borderBlockStartColor"),
borderTopStyle: t.borderStyles("borderTopStyle"),
borderBlockStartStyle: t.borderStyles("borderBlockStartStyle"),
borderBottomWidth: t.borderWidths("borderBottomWidth"),
borderBlockEndWidth: t.borderWidths("borderBlockEndWidth"),
borderBottomColor: t.colors("borderBottomColor"),
borderBlockEndColor: t.colors("borderBlockEndColor"),
borderBottomStyle: t.borderStyles("borderBottomStyle"),
borderBlockEndStyle: t.borderStyles("borderBlockEndStyle"),
borderLeftWidth: t.borderWidths("borderLeftWidth"),
borderInlineStartWidth: t.borderWidths("borderInlineStartWidth"),
borderLeftColor: t.colors("borderLeftColor"),
borderInlineStartColor: t.colors("borderInlineStartColor"),
borderLeftStyle: t.borderStyles("borderLeftStyle"),
borderInlineStartStyle: t.borderStyles("borderInlineStartStyle"),
borderRightWidth: t.borderWidths("borderRightWidth"),
borderInlineEndWidth: t.borderWidths("borderInlineEndWidth"),
borderRightColor: t.colors("borderRightColor"),
borderInlineEndColor: t.colors("borderInlineEndColor"),
borderRightStyle: t.borderStyles("borderRightStyle"),
borderInlineEndStyle: t.borderStyles("borderInlineEndStyle"),
borderTopRadius: t.radii(["borderTopLeftRadius", "borderTopRightRadius"]),
borderBottomRadius: t.radii([
"borderBottomLeftRadius",
"borderBottomRightRadius"
]),
borderLeftRadius: t.radii(["borderTopLeftRadius", "borderBottomLeftRadius"]),
borderRightRadius: t.radii([
"borderTopRightRadius",
"borderBottomRightRadius"
])
};
Object.assign(border, {
rounded: border.borderRadius,
roundedTop: border.borderTopRadius,
roundedTopLeft: border.borderTopLeftRadius,
roundedTopRight: border.borderTopRightRadius,
roundedTopStart: border.borderStartStartRadius,
roundedTopEnd: border.borderStartEndRadius,
roundedBottom: border.borderBottomRadius,
roundedBottomLeft: border.borderBottomLeftRadius,
roundedBottomRight: border.borderBottomRightRadius,
roundedBottomStart: border.borderEndStartRadius,
roundedBottomEnd: border.borderEndEndRadius,
roundedLeft: border.borderLeftRadius,
roundedRight: border.borderRightRadius,
roundedStart: border.borderInlineStartRadius,
roundedEnd: border.borderInlineEndRadius,
borderStart: border.borderInlineStart,
borderEnd: border.borderInlineEnd,
borderTopStartRadius: border.borderStartStartRadius,
borderTopEndRadius: border.borderStartEndRadius,
borderBottomStartRadius: border.borderEndStartRadius,
borderBottomEndRadius: border.borderEndEndRadius,
borderStartRadius: border.borderInlineStartRadius,
borderEndRadius: border.borderInlineEndRadius,
borderStartWidth: border.borderInlineStartWidth,
borderEndWidth: border.borderInlineEndWidth,
borderStartColor: border.borderInlineStartColor,
borderEndColor: border.borderInlineEndColor,
borderStartStyle: border.borderInlineStartStyle,
borderEndStyle: border.borderInlineEndStyle
});
export { border };