@workday/canvas-kit-preview-react
Version:
Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.
80 lines (79 loc) • 5.35 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatusIndicator = void 0;
const react_1 = __importDefault(require("react"));
const common_1 = require("@workday/canvas-kit-react/common");
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
const layout_1 = require("@workday/canvas-kit-react/layout");
const icon_1 = require("@workday/canvas-kit-react/icon");
const StatusIndicatorIcon_1 = require("./StatusIndicatorIcon");
const StatusIndicatorLabel_1 = require("./StatusIndicatorLabel");
const statusIndicatorStencil = (0, canvas_kit_styling_1.createStencil)({
base: { name: "nzjw1g", styles: "box-sizing:border-box;display:inline-flex;gap:var(--cnvs-sys-space-x1);max-width:12.5rem;align-items:center;border-radius:var(--cnvs-sys-shape-half);height:1.25rem;padding:var(--cnvs-sys-space-zero) var(--cnvs-sys-space-x1);outline:0.0625rem solid transparent;" },
modifiers: {
gray: {
high: { name: "nzjw1k", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-212f69:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-gray-default);" },
low: { name: "nzjw1l", styles: "color:var(--cnvs-sys-color-static-gray-strong);--color-system-icon-212f69:var(--cnvs-sys-color-static-gray-strong);background:var(--cnvs-sys-color-static-gray-soft);" }
},
orange: {
high: { name: "nzjw1m", styles: "color:var(--cnvs-sys-color-static-gray-stronger);--color-system-icon-212f69:var(--cnvs-sys-color-static-gray-stronger);background:var(--cnvs-sys-color-static-orange-default);" },
low: { name: "nzjw1n", styles: "color:var(--cnvs-sys-color-static-gold-stronger);--color-system-icon-212f69:var(--cnvs-sys-color-static-gold-stronger);background:var(--cnvs-sys-color-static-orange-soft);" }
},
blue: {
high: { name: "nzjw1o", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-212f69:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-blue-default);" },
low: { name: "nzjw1p", styles: "color:var(--cnvs-sys-color-static-blue-strong);--color-system-icon-212f69:var(--cnvs-sys-color-static-blue-strong);background:var(--cnvs-sys-color-static-blue-soft);" }
},
green: {
high: { name: "nzjw1q", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-212f69:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-green-strong);" },
low: { name: "nzjw1r", styles: "color:var(--cnvs-sys-color-static-green-strong);--color-system-icon-212f69:var(--cnvs-sys-color-static-green-strong);background:var(--cnvs-sys-color-static-green-soft);" }
},
red: {
high: { name: "nzjw1s", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-212f69:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-red-default);" },
low: { name: "nzjw1t", styles: "color:var(--cnvs-sys-color-static-red-strong);--color-system-icon-212f69:var(--cnvs-sys-color-static-red-strong);background:var(--cnvs-sys-color-static-red-soft);" }
},
transparent: {
high: { name: "nzjw1u", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-212f69:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-bg-translucent);" },
low: { name: "nzjw1v", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-212f69:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-bg-translucent);" }
}
}
}, "status-indicator-1a565e");
/**
* `StatusIndicator` is a container component which renders an {@link Flex} under the hood to
* apply spacing evenly between its children. It has a default maximum width of `200px`.
*
* ```tsx
* <StatusIndicator emphasis="low" variant="blue">
* {Child components}
* </StatusIndicator>
* ```
*/
exports.StatusIndicator = (0, common_1.createComponent)('div')({
displayName: 'StatusIndicator',
subComponents: {
/**
* `StatusIndicator.Label` renders {@link Text} under the hood. It will apply an ellipsis if its
* contents exceed the component's maximum width.
*
* ```tsx
* <StatusIndicator.Label>{The text to be rendered}</StatusIndicator.Label>
* ```
*/
Label: StatusIndicatorLabel_1.StatusIndicatorLabel,
/**
* `StatusIndicator.Icon` renders {@link SystemIcon} under the hood. It's used as a decorative
* element to visually support the {@link StatusIndicatorLabel StatusIndicator.Label} text.
*
* ```tsx
* <StatusIndicator.Icon icon={uploadCloudIcon} />
* ```
*/
Icon: StatusIndicatorIcon_1.StatusIndicatorIcon,
},
Component: ({ emphasis = 'low', variant = 'gray', children, ...elemProps }, ref, Element) => {
return (react_1.default.createElement(Element, { ref: ref, ...(0, layout_1.mergeStyles)(elemProps, statusIndicatorStencil({ [variant]: emphasis })) }, children));
},
});
;