UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

34 lines (33 loc) 2.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CheckboxCheck = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); 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 icon_1 = require("@workday/canvas-kit-react/icon"); const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web"); const CheckBackground_1 = require("./CheckBackground"); const checkboxCheckStencil = (0, canvas_kit_styling_1.createStencil)({ base: { name: "1z4rq4", styles: "box-sizing:border-box;display:flex;flex-direction:column;max-width:100%;pointer-events:none;transition:transform 200ms ease, opacity 200ms ease;span{margin-inline-start:calc(0.375rem * -1);transition:margin 200ms ease;}opacity:var(--cnvs-sys-opacity-zero);transform:scale(0.5);" }, modifiers: { checked: { true: { name: "4750n", styles: "--color-system-icon-3a4847:var(--cnvs-brand-primary-accent);opacity:var(--cnvs-sys-opacity-full);transform:scale(1);" } }, indeterminate: { true: { name: "1cmxjd", styles: "opacity:var(--cnvs-sys-opacity-full);transform:scale(1);" } }, variant: { inverse: { name: "3ksttd", styles: "--color-system-icon-3a4847:var(--cnvs-brand-primary-base);& > div{background-color:var(--cnvs-brand-primary-base);}" } } } }, "checkbox-check-3954b5"); const indeterminateBoxStencil = (0, canvas_kit_styling_1.createStencil)({ base: { name: "7kkj", styles: "box-sizing:border-box;width:0.625rem;height:calc(var(--cnvs-sys-space-x1) / 2);background-color:var(--cnvs-brand-primary-accent);" } }, "indeterminate-box-105dc4"); exports.CheckboxCheck = (0, common_1.createComponent)('div')({ displayName: 'CheckboxCheck', Component: ({ checked, error, indeterminate, variant }) => { return ((0, jsx_runtime_1.jsx)(CheckBackground_1.CheckBackground, { error: error, children: (0, jsx_runtime_1.jsx)("div", { ...checkboxCheckStencil({ checked, indeterminate, variant }), children: indeterminate ? ((0, jsx_runtime_1.jsx)("div", { ...indeterminateBoxStencil() })) : (checked && (0, jsx_runtime_1.jsx)(icon_1.SystemIcon, { icon: canvas_system_icons_web_1.checkSmallIcon })) }) })); }, });