UNPKG

@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.

54 lines (53 loc) 2.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TextAreaField = void 0; /** @jsxRuntime classic */ /** @jsx jsx */ const react_1 = require("@emotion/react"); const tokens_1 = require("@workday/canvas-kit-react/tokens"); const common_1 = require("@workday/canvas-kit-react/common"); const form_field_1 = require("@workday/canvas-kit-react/form-field"); const text_input_1 = require("@workday/canvas-kit-preview-react/text-input"); const baseStyles = { transition: '0.2s box-shadow, 0.2s border-color', resize: 'both', '&::webkit-resizer': { display: 'none', }, '&::placeholder': { color: tokens_1.inputColors.placeholder, }, '&:hover': { borderColor: tokens_1.inputColors.hoverBorder, }, '&:focus:not([disabled])': { outline: 'none', }, '&:disabled': { backgroundColor: tokens_1.inputColors.disabled.background, borderColor: tokens_1.colors.licorice100, color: tokens_1.inputColors.disabled.text, '&::placeholder': { color: tokens_1.inputColors.disabled.text, }, }, }; /** * @deprecated ⚠️ `TextAreaField` in Preview has been deprecated and will be removed in a future major version. Please use [`FormField`](https://workday.github.io/canvas-kit/?path=/story/preview-inputs-form-field--basic) in Preview instead. */ exports.TextAreaField = (0, common_1.createSubcomponent)('textarea')({ displayName: 'TextArea.Field', modelHook: text_input_1.useTextInputModel, })(({ ...elemProps }, Element, model) => { const theme = (0, common_1.useTheme)(); const errorRing = (0, common_1.useThemedRing)('error'); const focusStyles = model.state.error === 'error' ? errorRing : { '&:focus:not([disabled])': { borderColor: theme.canvas.palette.common.focusOutline, boxShadow: `inset 0 0 0 1px ${theme.canvas.palette.common.focusOutline}`, }, }; return ((0, react_1.jsx)(form_field_1.FormField.Input, { as: Element, ...tokens_1.type.levels.subtext.large, css: [baseStyles, focusStyles], ...elemProps, border: `1px solid ${tokens_1.inputColors.border}`, display: "block", backgroundColor: tokens_1.inputColors.background, borderRadius: tokens_1.borderRadius.m, minHeight: 64, minWidth: 280, padding: tokens_1.space.xxs, margin: 0 })); });