@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 * as React from 'react';
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: "d5h461", 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: "d5h462", styles: "resize:both;" },
horizontal: { name: "d5h463", styles: "resize:horizontal;" },
vertical: { name: "d5h464", styles: "resize:vertical;" },
none: { name: "d5h465", styles: "resize:none;" }
}
},
defaultModifiers: {
resize: 'both',
}
}, "text-area-3e725a");
export const TextArea = createComponent('textarea')({
displayName: 'TextArea',
Component: ({ resize = TextAreaResizeDirection.Both, grow, error, ...elemProps }, ref, Element) => React.createElement(Element, { ref: ref, ...handleCsProp(elemProps, textAreaStencil({ error, grow, resize })) }),
subComponents: {
ErrorType,
ResizeDirection: TextAreaResizeDirection,
},
});