@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
35 lines (34 loc) • 1.54 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { createComponent, ErrorType } from '@workday/canvas-kit-react/common';
import { createStencil, calc, handleCsProp } from '@workday/canvas-kit-styling';
import { system } from '@workday/canvas-tokens-web';
import { textInputStencil } from '@workday/canvas-kit-react/text-input';
export const TextAreaResizeDirection = {
None: 'none',
Both: 'both',
Horizontal: 'horizontal',
Vertical: 'vertical',
};
export const textAreaStencil = createStencil({
extends: textInputStencil,
base: { name: "3gakgo", styles: "box-sizing:border-box;min-height:var(--cnvs-sys-space-x16);min-width:calc(calc(var(--cnvs-sys-space-x20) * 3) + var(--cnvs-sys-space-x10));&::webkit-resizer{display:none;}" },
modifiers: {
resize: {
both: { name: "5s7ca", styles: "resize:both;" },
horizontal: { name: "1voqos", styles: "resize:horizontal;" },
vertical: { name: "l1a65", styles: "resize:vertical;" },
none: { name: "ts1ok", styles: "resize:none;" }
}
},
defaultModifiers: {
resize: 'both',
}
}, "text-area-aff4ba");
export const TextArea = createComponent('textarea')({
displayName: 'TextArea',
Component: ({ resize = TextAreaResizeDirection.Both, grow, error, ...elemProps }, ref, Element) => _jsx(Element, { ref: ref, ...handleCsProp(elemProps, textAreaStencil({ error, grow, resize })) }),
subComponents: {
ErrorType,
ResizeDirection: TextAreaResizeDirection,
},
});