@crossed/ui
Version:
A universal & performant styling library for React Native, Next.js & React
207 lines (206 loc) • 6.58 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var styles_exports = {};
__export(styles_exports, {
buttonErrorStyles: () => buttonErrorStyles,
buttonPrimaryStyles: () => buttonPrimaryStyles,
buttonSecondaryStyles: () => buttonSecondaryStyles,
buttonSizeStyles: () => buttonSizeStyles,
buttonSuccessStyles: () => buttonSuccessStyles,
buttonTertiaryStyles: () => buttonTertiaryStyles,
textStyles: () => textStyles
});
module.exports = __toCommonJS(styles_exports);
var import_styled = require("@crossed/styled");
const buttonSizeStyles = (0, import_styled.createStyles)(({ space }) => ({
default: {
":disabled": { opacity: 0.5 },
web: {
"base": { boxSizing: "border-box" },
":focus-visible": {
outlineWidth: "2px",
outlineOffset: "2px",
outlineStyle: "solid"
}
},
base: {
display: "flex",
borderRadius: 7,
borderWidth: 2,
borderStyle: "solid",
borderColor: "transparent",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
backgroundColor: "transparent",
gap: 8
}
},
sm: { base: { height: 32, paddingHorizontal: space.xs } },
md: { base: { height: 44, paddingHorizontal: space.md } },
lg: { base: { height: 52, paddingHorizontal: space.lg } }
}));
const buttonPrimaryStyles = (0, import_styled.createStyles)(
({ components: { Action } }) => ({
root: {
"base": {
backgroundColor: Action.primary.default.background,
borderColor: Action.primary.default.background
},
":hover": {
backgroundColor: Action.primary.hover.background,
borderColor: Action.primary.hover.background
},
":active": {
backgroundColor: Action.primary.active.background,
borderColor: Action.primary.active.background
},
"web": {
":focus-visible": {
outlineColor: Action.primary.focus.border
}
}
},
text: { "base": { color: Action.primary.default.text } },
textHover: { "base": { color: Action.primary.hover.text } },
textActive: { "base": { color: Action.primary.active.text } }
})
);
const buttonSecondaryStyles = (0, import_styled.createStyles)(
({ components: { Action } }) => ({
root: {
"base": {
borderColor: Action.secondary.default.border,
backgroundColor: Action.secondary.default.background
},
":hover": {
borderColor: Action.secondary.hover.border,
backgroundColor: Action.secondary.hover.background
},
":active": {
borderColor: Action.secondary.active.border,
backgroundColor: Action.secondary.active.background
},
"web": {
":focus-visible": {
outlineColor: Action.secondary.focus.border
}
}
},
text: { "base": { color: Action.secondary.default.text } },
textHover: { "base": { color: Action.secondary.hover.text } },
textActive: { "base": { color: Action.secondary.active.text } }
})
);
const buttonTertiaryStyles = (0, import_styled.createStyles)(
({ components: { Action } }) => ({
root: {
"base": {
borderColor: Action.tertiary.default.border,
backgroundColor: Action.tertiary.default.background
},
":hover": {
borderColor: Action.tertiary.hover.border,
backgroundColor: Action.tertiary.hover.background
},
":active": {
borderColor: Action.tertiary.active.border,
backgroundColor: Action.tertiary.active.background
},
"web": {
":focus-visible": {
outlineColor: Action.tertiary.focus.border,
backgroundColor: Action.tertiary.focus.background
}
}
},
text: { "base": { color: Action.tertiary.default.text } },
textHover: { "base": { color: Action.tertiary.hover.text } },
textActive: { "base": { color: Action.tertiary.active.text } }
})
);
const buttonSuccessStyles = (0, import_styled.createStyles)(
({ colors }) => ({
root: {
"base": {
borderColor: colors.success.primary,
backgroundColor: colors.success.primary
},
":hover": {
borderColor: colors.success.dark,
backgroundColor: colors.success.dark
},
":active": {
borderColor: colors.success.dark,
backgroundColor: colors.success.dark
},
"web": {
":focus-visible": {
outlineColor: colors.success.primary
}
}
},
text: { "base": { color: colors.white } },
textHover: {},
textActive: {}
})
);
const buttonErrorStyles = (0, import_styled.createStyles)(
({ colors }) => ({
root: {
"base": {
backgroundColor: colors.error.primary,
borderColor: colors.error.primary
},
":hover": {
backgroundColor: colors.error.muted,
borderColor: colors.error.muted
},
":active": {
backgroundColor: colors.error.satured,
borderColor: colors.error.satured
},
"web": {
":focus-visible": {
outlineColor: colors.error.primary
}
}
},
text: { "base": { color: colors.white } },
textHover: {},
textActive: {}
})
);
const textStyles = (0, import_styled.createStyles)(() => ({
default: { base: { fontWeight: "bold" } },
disabled: { base: { pointerEvents: "none" } }
// sm: { base: { height: 32, paddingHorizontal: space.xs } },
// md: { base: { height: 44, paddingHorizontal: space.md } },
// lg: { base: { height: 52, paddingHorizontal: space.lg } },
}));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
buttonErrorStyles,
buttonPrimaryStyles,
buttonSecondaryStyles,
buttonSizeStyles,
buttonSuccessStyles,
buttonTertiaryStyles,
textStyles
});
//# sourceMappingURL=styles.js.map