UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

44 lines (43 loc) 2.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FormFieldLabel = exports.formFieldLabelStencil = 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 text_1 = require("@workday/canvas-kit-react/text"); const layout_1 = require("@workday/canvas-kit-react/layout"); const canvas_tokens_web_1 = require("@workday/canvas-tokens-web"); const hooks_1 = require("./hooks"); exports.formFieldLabelStencil = (0, canvas_kit_styling_1.createStencil)({ extends: text_1.textStencil, base: { name: "1xvhvx", styles: "box-sizing:border-box;font-weight:var(--cnvs-sys-font-weight-medium);color:var(--cnvs-sys-color-text-default);padding-inline-start:var(--cnvs-sys-space-zero);display:flex;align-items:center;min-width:11.25rem;" }, modifiers: { isRequired: { true: { name: "26eee8", styles: "&::after{content:\"*\";font-size:var(--cnvs-sys-font-size-body-large);font-weight:var(--cnvs-sys-font-weight-normal);color:var(--cnvs-brand-error-base);text-decoration:unset;margin-inline-start:var(--cnvs-sys-space-x1);}" } }, orientation: { horizontalStart: { name: "12z151", styles: "justify-content:flex-start;float:left;max-height:var(--cnvs-sys-space-x10);" }, horizontalEnd: { name: "2nb1bn", styles: "max-height:var(--cnvs-sys-space-x10);float:left;justify-content:flex-end;" }, vertical: { name: "3g6wij", styles: "width:100%;" } }, isHidden: { true: { name: "hyqw0", styles: "clip:rect(1px, 1px, 1px, 1px);clip-path:polygon(0px 0px, 0px 0px, 0px 0px, 0px 0px);position:absolute;overflow:hidden;white-space:nowrap;height:1px;min-height:1px;width:1px;min-width:1px;margin:-1px;padding:0;border:0;" } } }, defaultModifiers: { typeLevel: 'subtext.large', } }, "form-field-label-7bb465"); exports.FormFieldLabel = (0, common_1.createSubcomponent)('label')({ displayName: 'FormField.Label', modelHook: hooks_1.useFormFieldModel, elemPropsHook: hooks_1.useFormFieldLabel, })(({ children, typeLevel, variant, isHidden, ...elemProps }, Element, model) => { return ((0, jsx_runtime_1.jsx)(Element, { ...(0, layout_1.mergeStyles)(elemProps, (0, exports.formFieldLabelStencil)({ typeLevel, variant, isHidden: isHidden ? 'true' : undefined, isRequired: model.state.isRequired, orientation: model.state.orientation, })), children: children })); });