@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
46 lines (44 loc) • 1.5 kB
JavaScript
import { cs } from "../utils/styles.js";
import { iconDictionary, spacingDictionary } from "./consts.js";
import { useStyleConfig } from "../core/theme.js";
import styled from "../core/styled.js";
import vui from "../core/vui.js";
import { Icon } from "../icon/icon.js";
import { T } from "../t/t.js";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
//#region src/message/message.tsx
const MessageBase = styled.divBox`
transition-duration: fast;
`;
/** Displays a simple message text. */
const Message = vui((props, ref) => {
const { children, className, text, size: sizeProp = "md", intent: intentProp, variant: variantProp, ...rest } = props;
const intent = intentProp ?? (variantProp === "error" ? "danger" : variantProp) ?? "info";
const size = sizeProp === "lg" ? "md" : sizeProp;
const styles = useStyleConfig("Message", {
variant: intent,
size
});
return /* @__PURE__ */ jsx(MessageBase, {
className: cs("vui-message", className),
ref,
...styles,
...rest,
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
mr: `${spacingDictionary[size]}px`,
mt: "2px",
name: iconDictionary[intent],
size: styles.iconSize
}), /* @__PURE__ */ jsx(T, {
size: styles.fontSize,
w: "100%",
variant: "caption",
children: children ?? text
})] })
});
});
Message.displayName = "Message";
//#endregion
export { Message, Message as default, MessageBase };
globalThis.__vuiVersion__ = "5.3.1"
//# sourceMappingURL=message.js.map