@traefik-labs/faency 13.1.1 → 13.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox/Checkbox.cjs +15 -2
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +15 -2
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.themes.cjs +4 -2
- package/dist/components/Checkbox/Checkbox.themes.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.themes.js +4 -2
- package/dist/components/Checkbox/Checkbox.themes.js.map +1 -1
- package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs +1 -1
- package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs.map +1 -1
- package/dist/components/DateTimePickerInput/DateTimePickerInput.js +1 -1
- package/dist/components/DateTimePickerInput/DateTimePickerInput.js.map +1 -1
- package/dist/components/Field/Field.cjs +91 -0
- package/dist/components/Field/Field.cjs.map +1 -0
- package/dist/components/Field/Field.js +89 -0
- package/dist/components/Field/Field.js.map +1 -0
- package/dist/components/Field/Field.vanilla.cjs +95 -0
- package/dist/components/Field/Field.vanilla.cjs.map +1 -0
- package/dist/components/Field/Field.vanilla.css.cjs +6 -0
- package/dist/components/Field/Field.vanilla.css.cjs.map +1 -0
- package/dist/components/Field/Field.vanilla.css.js +6 -0
- package/dist/components/Field/Field.vanilla.css.js.map +1 -0
- package/dist/components/Field/Field.vanilla.js +93 -0
- package/dist/components/Field/Field.vanilla.js.map +1 -0
- package/dist/components/Field/FieldContext.cjs +136 -0
- package/dist/components/Field/FieldContext.cjs.map +1 -0
- package/dist/components/Field/FieldContext.js +130 -0
- package/dist/components/Field/FieldContext.js.map +1 -0
- package/dist/components/Input/Input.cjs +31 -6
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.js +31 -6
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.vanilla.cjs +17 -4
- package/dist/components/Input/Input.vanilla.cjs.map +1 -1
- package/dist/components/Input/Input.vanilla.css.cjs.map +1 -1
- package/dist/components/Input/Input.vanilla.css.js.map +1 -1
- package/dist/components/Input/Input.vanilla.js +17 -4
- package/dist/components/Input/Input.vanilla.js.map +1 -1
- package/dist/components/Radio/Radio.cjs +21 -1
- package/dist/components/Radio/Radio.cjs.map +1 -1
- package/dist/components/Radio/Radio.js +21 -1
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Radio/Radio.themes.cjs +4 -2
- package/dist/components/Radio/Radio.themes.cjs.map +1 -1
- package/dist/components/Radio/Radio.themes.js +4 -2
- package/dist/components/Radio/Radio.themes.js.map +1 -1
- package/dist/components/Select/Select.cjs +33 -4
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.js +33 -4
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Switch/Switch.cjs +19 -5
- package/dist/components/Switch/Switch.cjs.map +1 -1
- package/dist/components/Switch/Switch.js +19 -5
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Switch/Switch.themes.cjs +4 -2
- package/dist/components/Switch/Switch.themes.cjs.map +1 -1
- package/dist/components/Switch/Switch.themes.js +4 -2
- package/dist/components/Switch/Switch.themes.js.map +1 -1
- package/dist/components/Text/Text.themes.cjs +2 -2
- package/dist/components/Text/Text.themes.cjs.map +1 -1
- package/dist/components/Text/Text.themes.js +2 -2
- package/dist/components/Text/Text.themes.js.map +1 -1
- package/dist/components/Text/Text.vanilla.cjs +36 -0
- package/dist/components/Text/Text.vanilla.cjs.map +1 -0
- package/dist/components/Text/Text.vanilla.css.cjs +55 -0
- package/dist/components/Text/Text.vanilla.css.cjs.map +1 -0
- package/dist/components/Text/Text.vanilla.css.js +56 -0
- package/dist/components/Text/Text.vanilla.css.js.map +1 -0
- package/dist/components/Text/Text.vanilla.js +36 -0
- package/dist/components/Text/Text.vanilla.js.map +1 -0
- package/dist/components/TextField/TextField.cjs +73 -77
- package/dist/components/TextField/TextField.cjs.map +1 -1
- package/dist/components/TextField/TextField.js +73 -77
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.vanilla.cjs +70 -86
- package/dist/components/TextField/TextField.vanilla.cjs.map +1 -1
- package/dist/components/TextField/TextField.vanilla.css.cjs +10 -0
- package/dist/components/TextField/TextField.vanilla.css.cjs.map +1 -0
- package/dist/components/TextField/TextField.vanilla.css.js +8 -0
- package/dist/components/TextField/TextField.vanilla.css.js.map +1 -0
- package/dist/components/TextField/TextField.vanilla.js +71 -87
- package/dist/components/TextField/TextField.vanilla.js.map +1 -1
- package/dist/components/Textarea/Textarea.cjs +51 -41
- package/dist/components/Textarea/Textarea.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.js +51 -41
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.cjs +49 -49
- package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.css.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.css.js.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.js +49 -49
- package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
- package/dist/faency.css +170 -14
- package/dist/index.cjs +7 -1
- package/dist/index.d.ts +375 -0
- package/dist/index.js +5 -2
- package/dist/styles/themes.css.cjs.map +1 -1
- package/dist/styles/themes.css.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_stitches_config = require("../../stitches.config.cjs");
|
|
3
|
-
const require_Box = require("../Box/Box.cjs");
|
|
4
3
|
const require_Elevation = require("../Elevation/Elevation.cjs");
|
|
5
4
|
const require_Label = require("../Label/Label.cjs");
|
|
5
|
+
const require_FieldContext = require("../Field/FieldContext.cjs");
|
|
6
|
+
const require_Field = require("../Field/Field.cjs");
|
|
6
7
|
let react = require("react");
|
|
7
8
|
react = require_runtime.__toESM(react, 1);
|
|
8
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -26,12 +27,16 @@ var StyledTextarea = require_stitches_config.styled("textarea", {
|
|
|
26
27
|
color: "$textareaText",
|
|
27
28
|
fontVariantNumeric: "tabular-nums",
|
|
28
29
|
transition: "box-shadow .1s ease-in-out",
|
|
29
|
-
"&:-webkit-autofill,&:autofill": {
|
|
30
|
+
"&:-webkit-autofill,&:autofill": {
|
|
31
|
+
boxShadow: "inset 0 0 0 1px $colors$textareaBorder, inset 0 0 0 100px $colors$textareaBg",
|
|
32
|
+
WebkitTextFillColor: "$colors$hiContrast"
|
|
33
|
+
},
|
|
30
34
|
"&:-webkit-autofill::first-line,&:autofill::first-line": {
|
|
31
35
|
fontFamily: "$rubik",
|
|
32
36
|
color: "$hiContrast"
|
|
33
37
|
},
|
|
34
38
|
"&:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, ${FOCUS_SHADOW}` },
|
|
39
|
+
"&:-webkit-autofill:focus-visible,&:autofill:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, inset 0 0 0 100px $colors$textareaBg, ${FOCUS_SHADOW}` },
|
|
35
40
|
"&::placeholder": { color: "$textareaPlaceholder" },
|
|
36
41
|
"&:read-only:not(:disabled)": { boxShadow: "none" },
|
|
37
42
|
"&:disabled": {
|
|
@@ -48,7 +53,9 @@ var StyledTextarea = require_stitches_config.styled("textarea", {
|
|
|
48
53
|
} },
|
|
49
54
|
state: { invalid: {
|
|
50
55
|
boxShadow: "inset 0 0 0 1px $colors$textareaInvalidBorder",
|
|
56
|
+
"&:-webkit-autofill,&:autofill": { boxShadow: "inset 0 0 0 1px $colors$textareaInvalidBorder, inset 0 0 0 100px $colors$textareaBg" },
|
|
51
57
|
"&:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, ${FOCUS_SHADOW}` },
|
|
58
|
+
"&:-webkit-autofill:focus-visible,&:autofill:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, inset 0 0 0 100px $colors$textareaBg, ${FOCUS_SHADOW}` },
|
|
52
59
|
"@hover": { "&:hover": { "&::after": { backgroundColor: "$textareaInvalidBorder" } } }
|
|
53
60
|
} },
|
|
54
61
|
cursor: {
|
|
@@ -141,50 +148,53 @@ var AdornmentWrapperEnd = require_stitches_config.styled("div", {
|
|
|
141
148
|
alignItems: "center",
|
|
142
149
|
justifyContent: "center"
|
|
143
150
|
});
|
|
144
|
-
var
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
const hasEndAdornment = react.default.useMemo(() => Boolean(endAdornment), [endAdornment]);
|
|
148
|
-
const labelVariant = react.default.useMemo(() => {
|
|
149
|
-
if (disabled) return "subtle";
|
|
150
|
-
if (invalid) return "invalid";
|
|
151
|
-
if (hasFocus) return "contrast";
|
|
152
|
-
return "default";
|
|
153
|
-
}, [
|
|
154
|
-
invalid,
|
|
151
|
+
var TextareaControl = react.default.forwardRef(({ state, disabled, id, css, endAdornment, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
|
|
152
|
+
const control = require_FieldContext.useFieldControl({
|
|
153
|
+
id,
|
|
155
154
|
disabled,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
155
|
+
invalid: state === "invalid",
|
|
156
|
+
"aria-describedby": ariaDescribedBy,
|
|
157
|
+
"aria-invalid": ariaInvalid
|
|
158
|
+
});
|
|
159
|
+
const resolvedState = control.invalid ? "invalid" : state;
|
|
160
|
+
const hasEndAdornment = Boolean(endAdornment);
|
|
161
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TextareaWrapper, {
|
|
162
|
+
state: resolvedState,
|
|
163
|
+
disabled: control.disabled,
|
|
164
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledTextarea, {
|
|
165
|
+
id: control.id,
|
|
166
|
+
ref: forwardedRef,
|
|
167
|
+
css,
|
|
168
|
+
disabled: control.disabled,
|
|
169
|
+
state: resolvedState,
|
|
170
|
+
endAdornment: hasEndAdornment,
|
|
171
|
+
"aria-describedby": control["aria-describedby"],
|
|
172
|
+
"aria-invalid": control["aria-invalid"],
|
|
173
|
+
...props
|
|
174
|
+
}), hasEndAdornment && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AdornmentWrapperEnd, { children: endAdornment })]
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
var Textarea = react.default.forwardRef(({ label, description, error, announceError, id, rootCss, state, disabled, ...props }, forwardedRef) => {
|
|
178
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Field.Field, {
|
|
179
|
+
id,
|
|
180
|
+
label: label && ((labelProps) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Label.Label, {
|
|
181
|
+
...labelProps,
|
|
171
182
|
css: { display: "block" },
|
|
172
183
|
children: label
|
|
173
|
-
})
|
|
184
|
+
})),
|
|
185
|
+
description,
|
|
186
|
+
error,
|
|
187
|
+
announceError,
|
|
188
|
+
invalid: state === "invalid",
|
|
189
|
+
disabled,
|
|
190
|
+
css: rootCss,
|
|
191
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextareaControl, {
|
|
192
|
+
ref: forwardedRef,
|
|
193
|
+
id,
|
|
174
194
|
state,
|
|
175
195
|
disabled,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
ref: forwardedRef,
|
|
179
|
-
css,
|
|
180
|
-
disabled,
|
|
181
|
-
state,
|
|
182
|
-
onFocus: handleFocus,
|
|
183
|
-
onBlur: handleBlur,
|
|
184
|
-
endAdornment: hasEndAdornment,
|
|
185
|
-
...props
|
|
186
|
-
}), hasEndAdornment && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AdornmentWrapperEnd, { children: endAdornment })]
|
|
187
|
-
})]
|
|
196
|
+
...props
|
|
197
|
+
})
|
|
188
198
|
});
|
|
189
199
|
});
|
|
190
200
|
exports.Textarea = Textarea;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.cjs","names":["elevationVariants","styled","React","Box","Label"],"sources":["../../../components/Textarea/Textarea.tsx"],"sourcesContent":["import React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Label } from '../Label';\n\n// CONSTANTS\nconst FOCUS_SHADOW = elevationVariants[1].boxShadow; // apply elevation $1 when focus\n\n// COMPONENTS\nconst StyledTextarea = styled('textarea', {\n // Reset\n appearance: 'none',\n overflow: 'auto', // force overflow auto behaviour cross-browser\n borderWidth: '0',\n boxSizing: 'border-box',\n fontFamily: '$rubik',\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n // Custom\n p: '$3',\n position: 'relative',\n flexGrow: 1, // make sure to grow fully inside TextareaWrapper\n backgroundColor: 'transparent',\n borderRadius: 'inherit', // inherit border radius from TextareaWrapper\n boxShadow: 'inset 0 0 0 1px $colors$textareaBorder',\n color: '$textareaText',\n fontVariantNumeric: 'tabular-nums',\n transition: 'box-shadow .1s ease-in-out',\n\n '&:-webkit-autofill,&:autofill': {\n boxShadow: 'inset 0 0 0 1px $colors$textareaBorder, inset 0 0 0 100px $colors$textareaBg',\n },\n\n '&:-webkit-autofill::first-line,&:autofill::first-line': {\n fontFamily: '$rubik',\n color: '$hiContrast',\n },\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, ${FOCUS_SHADOW}`,\n },\n\n '&::placeholder': {\n color: '$textareaPlaceholder',\n },\n\n '&:read-only:not(:disabled)': {\n boxShadow: 'none',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.7,\n color: '$textareaDisabledText',\n },\n variants: {\n variant: {\n ghost: {\n boxShadow: 'none',\n '&:disabled': {\n boxShadow: 'none',\n },\n backgroundColor: 'transparent',\n '&:focus-visible': {\n backgroundColor: '$loContrast',\n },\n },\n },\n state: {\n invalid: {\n boxShadow: 'inset 0 0 0 1px $colors$textareaInvalidBorder',\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, ${FOCUS_SHADOW}`,\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$textareaInvalidBorder',\n },\n },\n },\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '@hover': {\n '&:hover:not(:read-only)': {\n cursor: 'text',\n },\n },\n '&:focus-visible:not(:read-only)': {\n cursor: 'text',\n },\n },\n text: {\n cursor: 'text',\n },\n },\n resize: {\n none: {\n resize: 'none',\n },\n both: {\n resize: 'both',\n },\n vertical: {\n resize: 'vertical',\n },\n horizontal: {\n resize: 'horizontal',\n },\n },\n endAdornment: {\n true: {\n paddingBottom: '$5',\n paddingRight: '$5',\n },\n },\n },\n defaultVariants: {\n cursor: 'default',\n resize: 'both',\n },\n compoundVariants: [\n {\n variant: 'ghost',\n state: 'invalid',\n css: {\n boxShadow: 'inset 0 0 0 1px $colors$textareaInvalidBorder',\n },\n },\n ],\n});\n\nconst TextareaWrapper = styled('div', {\n // Reset\n outline: 'none',\n lineHeight: 0,\n\n position: 'relative',\n display: 'inline-flex', // helps matching resizable content size\n backgroundColor: '$textareaBg',\n color: '$textareaPlaceholder',\n borderRadius: '$3',\n\n '&::before': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$textareaFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: '$textareaHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n\n variants: {\n disabled: {\n true: {\n opacity: 0.7,\n color: '$textareaDisabledText',\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: 'inherit',\n },\n '&::after': {\n backgroundColor: 'inherit',\n },\n },\n },\n },\n },\n state: {\n invalid: {\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$textareaInvalidBorder',\n },\n },\n },\n },\n },\n },\n defaultVariants: {\n disabled: false,\n },\n});\n\nconst AdornmentWrapperEnd = styled('div', {\n position: 'absolute',\n bottom: '$2',\n right: '$3',\n minWidth: '$5',\n minHeight: '$5',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n});\n\nexport interface TextareaVariants\n extends Omit<VariantProps<typeof StyledTextarea>, 'endAdornment'> {}\n\nexport interface TextareaProps\n extends TextareaVariants,\n Omit<React.ComponentProps<typeof StyledTextarea>, 'endAdornment'> {\n label?: string;\n endAdornment?: React.ReactNode;\n rootCss?: CSS;\n}\n\nexport const Textarea = React.forwardRef<React.ElementRef<typeof StyledTextarea>, TextareaProps>(\n (\n { state, disabled, onFocus, onBlur, label, id, rootCss, css, endAdornment, ...props },\n forwardedRef\n ) => {\n const [hasFocus, setHasFocus] = React.useState(false);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const hasEndAdornment = React.useMemo(() => Boolean(endAdornment), [endAdornment]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (hasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, hasFocus]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setHasFocus(true);\n },\n [onFocus, setHasFocus]\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setHasFocus(false);\n },\n [onBlur, setHasFocus]\n );\n\n return (\n <Box css={rootCss}>\n {label && (\n <Label variant={labelVariant} htmlFor={id} css={{ display: 'block' }}>\n {label}\n </Label>\n )}\n <TextareaWrapper state={state} disabled={disabled}>\n <StyledTextarea\n id={id}\n ref={forwardedRef}\n css={css}\n disabled={disabled}\n state={state}\n onFocus={handleFocus}\n onBlur={handleBlur}\n endAdornment={hasEndAdornment}\n {...props}\n />\n {hasEndAdornment && <AdornmentWrapperEnd>{endAdornment}</AdornmentWrapperEnd>}\n </TextareaWrapper>\n </Box>\n );\n }\n);\n"],"mappings":";;;;;;;;;AAQA,IAAM,eAAeA,kBAAAA,kBAAkB,EAAE,CAAC;AAG1C,IAAM,iBAAiBC,wBAAAA,OAAO,YAAY;CAExC,YAAY;CACZ,UAAU;CACV,aAAa;CACb,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,yBAAyB;CAGzB,GAAG;CACH,UAAU;CACV,UAAU;CACV,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,OAAO;CACP,oBAAoB;CACpB,YAAY;CAEZ,iCAAiC,EAC/B,WAAW,+EACb;CAEA,yDAAyD;EACvD,YAAY;EACZ,OAAO;CACT;CAEA,mBAAmB,EACjB,WAAW,gDAAgD,eAC7D;CAEA,kBAAkB,EAChB,OAAO,uBACT;CAEA,8BAA8B,EAC5B,WAAW,OACb;CAEA,cAAc;EACZ,eAAe;EACf,SAAS;EACT,OAAO;CACT;CACA,UAAU;EACR,SAAS,EACP,OAAO;GACL,WAAW;GACX,cAAc,EACZ,WAAW,OACb;GACA,iBAAiB;GACjB,mBAAmB,EACjB,iBAAiB,cACnB;EACF,EACF;EACA,OAAO,EACL,SAAS;GACP,WAAW;GACX,mBAAmB,EACjB,WAAW,kDAAkD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AAA,KAAA,CAAC,iBAAD;GAAwB;GAAiB;GAAzC,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD;IACM;IACJ,KAAK;IACA;IACK;IACH;IACP,SAAS;IACT,QAAQ;IACR,cAAc;IACd,GAAI;GACL,CAAA,GACA,mBAAmB,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAD,EAAA,UAAsB,aAAkC,CAAA,CAC7D;EACd,CAAA,CAAA;;AAET,CACF"}
|
|
1
|
+
{"version":3,"file":"Textarea.cjs","names":["elevationVariants","styled","React","useFieldControl","Field","Label"],"sources":["../../../components/Textarea/Textarea.tsx"],"sourcesContent":["import React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\nimport { Field } from '../Field/Field';\nimport { FieldLabelProps, useFieldControl } from '../Field/FieldContext';\nimport { Label } from '../Label';\n\n// CONSTANTS\nconst FOCUS_SHADOW = elevationVariants[1].boxShadow; // apply elevation $1 when focus\n\n// COMPONENTS\nconst StyledTextarea = styled('textarea', {\n // Reset\n appearance: 'none',\n overflow: 'auto', // force overflow auto behaviour cross-browser\n borderWidth: '0',\n boxSizing: 'border-box',\n fontFamily: '$rubik',\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n // Custom\n p: '$3',\n position: 'relative',\n flexGrow: 1, // make sure to grow fully inside TextareaWrapper\n backgroundColor: 'transparent',\n borderRadius: 'inherit', // inherit border radius from TextareaWrapper\n boxShadow: 'inset 0 0 0 1px $colors$textareaBorder',\n color: '$textareaText',\n fontVariantNumeric: 'tabular-nums',\n transition: 'box-shadow .1s ease-in-out',\n\n '&:-webkit-autofill,&:autofill': {\n boxShadow: 'inset 0 0 0 1px $colors$textareaBorder, inset 0 0 0 100px $colors$textareaBg',\n WebkitTextFillColor: '$colors$hiContrast',\n },\n\n '&:-webkit-autofill::first-line,&:autofill::first-line': {\n fontFamily: '$rubik',\n color: '$hiContrast',\n },\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, ${FOCUS_SHADOW}`,\n },\n\n '&:-webkit-autofill:focus-visible,&:autofill:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, inset 0 0 0 100px $colors$textareaBg, ${FOCUS_SHADOW}`,\n },\n\n '&::placeholder': {\n color: '$textareaPlaceholder',\n },\n\n '&:read-only:not(:disabled)': {\n boxShadow: 'none',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.7,\n color: '$textareaDisabledText',\n },\n variants: {\n variant: {\n ghost: {\n boxShadow: 'none',\n '&:disabled': {\n boxShadow: 'none',\n },\n backgroundColor: 'transparent',\n '&:focus-visible': {\n backgroundColor: '$loContrast',\n },\n },\n },\n state: {\n invalid: {\n boxShadow: 'inset 0 0 0 1px $colors$textareaInvalidBorder',\n '&:-webkit-autofill,&:autofill': {\n boxShadow:\n 'inset 0 0 0 1px $colors$textareaInvalidBorder, inset 0 0 0 100px $colors$textareaBg',\n },\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, ${FOCUS_SHADOW}`,\n },\n '&:-webkit-autofill:focus-visible,&:autofill:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, inset 0 0 0 100px $colors$textareaBg, ${FOCUS_SHADOW}`,\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$textareaInvalidBorder',\n },\n },\n },\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '@hover': {\n '&:hover:not(:read-only)': {\n cursor: 'text',\n },\n },\n '&:focus-visible:not(:read-only)': {\n cursor: 'text',\n },\n },\n text: {\n cursor: 'text',\n },\n },\n resize: {\n none: {\n resize: 'none',\n },\n both: {\n resize: 'both',\n },\n vertical: {\n resize: 'vertical',\n },\n horizontal: {\n resize: 'horizontal',\n },\n },\n endAdornment: {\n true: {\n paddingBottom: '$5',\n paddingRight: '$5',\n },\n },\n },\n defaultVariants: {\n cursor: 'default',\n resize: 'both',\n },\n compoundVariants: [\n {\n variant: 'ghost',\n state: 'invalid',\n css: {\n boxShadow: 'inset 0 0 0 1px $colors$textareaInvalidBorder',\n },\n },\n ],\n});\n\nconst TextareaWrapper = styled('div', {\n // Reset\n outline: 'none',\n lineHeight: 0,\n\n position: 'relative',\n display: 'inline-flex', // helps matching resizable content size\n backgroundColor: '$textareaBg',\n color: '$textareaPlaceholder',\n borderRadius: '$3',\n\n '&::before': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$textareaFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: '$textareaHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n\n variants: {\n disabled: {\n true: {\n opacity: 0.7,\n color: '$textareaDisabledText',\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: 'inherit',\n },\n '&::after': {\n backgroundColor: 'inherit',\n },\n },\n },\n },\n },\n state: {\n invalid: {\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$textareaInvalidBorder',\n },\n },\n },\n },\n },\n },\n defaultVariants: {\n disabled: false,\n },\n});\n\nconst AdornmentWrapperEnd = styled('div', {\n position: 'absolute',\n bottom: '$2',\n right: '$3',\n minWidth: '$5',\n minHeight: '$5',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n});\n\nexport interface TextareaVariants extends Omit<\n VariantProps<typeof StyledTextarea>,\n 'endAdornment'\n> {}\n\nexport interface TextareaProps\n extends TextareaVariants, Omit<React.ComponentProps<typeof StyledTextarea>, 'endAdornment'> {\n label?: string;\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n endAdornment?: React.ReactNode;\n rootCss?: CSS;\n}\n\ntype TextareaControlProps = Omit<\n TextareaProps,\n 'label' | 'description' | 'error' | 'announceError' | 'rootCss'\n>;\n\nconst TextareaControl = React.forwardRef<\n React.ElementRef<typeof StyledTextarea>,\n TextareaControlProps\n>(\n (\n {\n state,\n disabled,\n id,\n css,\n endAdornment,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n forwardedRef,\n ) => {\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n const resolvedState = control.invalid ? 'invalid' : state;\n const hasEndAdornment = Boolean(endAdornment);\n\n return (\n <TextareaWrapper state={resolvedState} disabled={control.disabled}>\n <StyledTextarea\n id={control.id}\n ref={forwardedRef}\n css={css}\n disabled={control.disabled}\n state={resolvedState}\n endAdornment={hasEndAdornment}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n {...props}\n />\n {hasEndAdornment && <AdornmentWrapperEnd>{endAdornment}</AdornmentWrapperEnd>}\n </TextareaWrapper>\n );\n },\n);\n\nexport const Textarea = React.forwardRef<React.ElementRef<typeof StyledTextarea>, TextareaProps>(\n (\n { label, description, error, announceError, id, rootCss, state, disabled, ...props },\n forwardedRef,\n ) => {\n return (\n <Field\n id={id}\n label={\n label &&\n ((labelProps: FieldLabelProps) => (\n <Label {...labelProps} css={{ display: 'block' }}>\n {label}\n </Label>\n ))\n }\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={disabled}\n css={rootCss}\n >\n <TextareaControl ref={forwardedRef} id={id} state={state} disabled={disabled} {...props} />\n </Field>\n );\n },\n);\n"],"mappings":";;;;;;;;;;AASA,IAAM,eAAeA,kBAAAA,kBAAkB,EAAE,CAAC;AAG1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U;EACnB,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CACD,MAAM,gBAAgB,QAAQ,UAAU,YAAY;CACpD,MAAM,kBAAkB,QAAQ,YAAY;CAE5C,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,iBAAD;EAAiB,OAAO;EAAe,UAAU,QAAQ;EAAzD,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD;GACE,IAAI,QAAQ;GACZ,KAAK;GACA;GACL,UAAU,QAAQ;GAClB,OAAO;GACP,cAAc;GACd,oBAAkB,QAAQ;GAC1B,gBAAc,QAAQ;GACtB,GAAI;EACL,CAAA,GACA,mBAAmB,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAD,EAAA,UAAsB,aAAkC,CAAA,CAC7D;;AAErB,CACF;AAEA,IAAa,WAAWD,MAAAA,QAAM,YAE1B,EAAE,OAAO,aAAa,OAAO,eAAe,IAAI,SAAS,OAAO,UAAU,GAAG,SAC7E,iBACG;CACH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,cAAAA,OAAD;EACM;EACJ,OACE,WACE,eACA,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,OAAD;GAAO,GAAI;GAAY,KAAK,EAAE,SAAS,QAAQ;GAC5C,UAAA;EACI,CAAA;EAGE;EACN;EACQ;EACf,SAAS,UAAU;EACT;EACV,KAAK;EAEL,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD;GAAiB,KAAK;GAAkB;GAAW;GAAiB;GAAU,GAAI;EAAQ,CAAA;CACrF,CAAA;AAEX,CACF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { styled } from "../../stitches.config.js";
|
|
2
|
-
import { Box } from "../Box/Box.js";
|
|
3
2
|
import { elevationVariants } from "../Elevation/Elevation.js";
|
|
4
3
|
import { Label } from "../Label/Label.js";
|
|
4
|
+
import { useFieldControl } from "../Field/FieldContext.js";
|
|
5
|
+
import { Field } from "../Field/Field.js";
|
|
5
6
|
import React from "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
// components/Textarea/Textarea.tsx
|
|
@@ -24,12 +25,16 @@ var StyledTextarea = styled("textarea", {
|
|
|
24
25
|
color: "$textareaText",
|
|
25
26
|
fontVariantNumeric: "tabular-nums",
|
|
26
27
|
transition: "box-shadow .1s ease-in-out",
|
|
27
|
-
"&:-webkit-autofill,&:autofill": {
|
|
28
|
+
"&:-webkit-autofill,&:autofill": {
|
|
29
|
+
boxShadow: "inset 0 0 0 1px $colors$textareaBorder, inset 0 0 0 100px $colors$textareaBg",
|
|
30
|
+
WebkitTextFillColor: "$colors$hiContrast"
|
|
31
|
+
},
|
|
28
32
|
"&:-webkit-autofill::first-line,&:autofill::first-line": {
|
|
29
33
|
fontFamily: "$rubik",
|
|
30
34
|
color: "$hiContrast"
|
|
31
35
|
},
|
|
32
36
|
"&:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, ${FOCUS_SHADOW}` },
|
|
37
|
+
"&:-webkit-autofill:focus-visible,&:autofill:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, inset 0 0 0 100px $colors$textareaBg, ${FOCUS_SHADOW}` },
|
|
33
38
|
"&::placeholder": { color: "$textareaPlaceholder" },
|
|
34
39
|
"&:read-only:not(:disabled)": { boxShadow: "none" },
|
|
35
40
|
"&:disabled": {
|
|
@@ -46,7 +51,9 @@ var StyledTextarea = styled("textarea", {
|
|
|
46
51
|
} },
|
|
47
52
|
state: { invalid: {
|
|
48
53
|
boxShadow: "inset 0 0 0 1px $colors$textareaInvalidBorder",
|
|
54
|
+
"&:-webkit-autofill,&:autofill": { boxShadow: "inset 0 0 0 1px $colors$textareaInvalidBorder, inset 0 0 0 100px $colors$textareaBg" },
|
|
49
55
|
"&:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, ${FOCUS_SHADOW}` },
|
|
56
|
+
"&:-webkit-autofill:focus-visible,&:autofill:focus-visible": { boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, inset 0 0 0 100px $colors$textareaBg, ${FOCUS_SHADOW}` },
|
|
50
57
|
"@hover": { "&:hover": { "&::after": { backgroundColor: "$textareaInvalidBorder" } } }
|
|
51
58
|
} },
|
|
52
59
|
cursor: {
|
|
@@ -139,50 +146,53 @@ var AdornmentWrapperEnd = styled("div", {
|
|
|
139
146
|
alignItems: "center",
|
|
140
147
|
justifyContent: "center"
|
|
141
148
|
});
|
|
142
|
-
var
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
const hasEndAdornment = React.useMemo(() => Boolean(endAdornment), [endAdornment]);
|
|
146
|
-
const labelVariant = React.useMemo(() => {
|
|
147
|
-
if (disabled) return "subtle";
|
|
148
|
-
if (invalid) return "invalid";
|
|
149
|
-
if (hasFocus) return "contrast";
|
|
150
|
-
return "default";
|
|
151
|
-
}, [
|
|
152
|
-
invalid,
|
|
149
|
+
var TextareaControl = React.forwardRef(({ state, disabled, id, css, endAdornment, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
|
|
150
|
+
const control = useFieldControl({
|
|
151
|
+
id,
|
|
153
152
|
disabled,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
153
|
+
invalid: state === "invalid",
|
|
154
|
+
"aria-describedby": ariaDescribedBy,
|
|
155
|
+
"aria-invalid": ariaInvalid
|
|
156
|
+
});
|
|
157
|
+
const resolvedState = control.invalid ? "invalid" : state;
|
|
158
|
+
const hasEndAdornment = Boolean(endAdornment);
|
|
159
|
+
return /* @__PURE__ */ jsxs(TextareaWrapper, {
|
|
160
|
+
state: resolvedState,
|
|
161
|
+
disabled: control.disabled,
|
|
162
|
+
children: [/* @__PURE__ */ jsx(StyledTextarea, {
|
|
163
|
+
id: control.id,
|
|
164
|
+
ref: forwardedRef,
|
|
165
|
+
css,
|
|
166
|
+
disabled: control.disabled,
|
|
167
|
+
state: resolvedState,
|
|
168
|
+
endAdornment: hasEndAdornment,
|
|
169
|
+
"aria-describedby": control["aria-describedby"],
|
|
170
|
+
"aria-invalid": control["aria-invalid"],
|
|
171
|
+
...props
|
|
172
|
+
}), hasEndAdornment && /* @__PURE__ */ jsx(AdornmentWrapperEnd, { children: endAdornment })]
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
var Textarea = React.forwardRef(({ label, description, error, announceError, id, rootCss, state, disabled, ...props }, forwardedRef) => {
|
|
176
|
+
return /* @__PURE__ */ jsx(Field, {
|
|
177
|
+
id,
|
|
178
|
+
label: label && ((labelProps) => /* @__PURE__ */ jsx(Label, {
|
|
179
|
+
...labelProps,
|
|
169
180
|
css: { display: "block" },
|
|
170
181
|
children: label
|
|
171
|
-
}),
|
|
182
|
+
})),
|
|
183
|
+
description,
|
|
184
|
+
error,
|
|
185
|
+
announceError,
|
|
186
|
+
invalid: state === "invalid",
|
|
187
|
+
disabled,
|
|
188
|
+
css: rootCss,
|
|
189
|
+
children: /* @__PURE__ */ jsx(TextareaControl, {
|
|
190
|
+
ref: forwardedRef,
|
|
191
|
+
id,
|
|
172
192
|
state,
|
|
173
193
|
disabled,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
ref: forwardedRef,
|
|
177
|
-
css,
|
|
178
|
-
disabled,
|
|
179
|
-
state,
|
|
180
|
-
onFocus: handleFocus,
|
|
181
|
-
onBlur: handleBlur,
|
|
182
|
-
endAdornment: hasEndAdornment,
|
|
183
|
-
...props
|
|
184
|
-
}), hasEndAdornment && /* @__PURE__ */ jsx(AdornmentWrapperEnd, { children: endAdornment })]
|
|
185
|
-
})]
|
|
194
|
+
...props
|
|
195
|
+
})
|
|
186
196
|
});
|
|
187
197
|
});
|
|
188
198
|
export { Textarea };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","names":[],"sources":["../../../components/Textarea/Textarea.tsx"],"sourcesContent":["import React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Label } from '../Label';\n\n// CONSTANTS\nconst FOCUS_SHADOW = elevationVariants[1].boxShadow; // apply elevation $1 when focus\n\n// COMPONENTS\nconst StyledTextarea = styled('textarea', {\n // Reset\n appearance: 'none',\n overflow: 'auto', // force overflow auto behaviour cross-browser\n borderWidth: '0',\n boxSizing: 'border-box',\n fontFamily: '$rubik',\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n // Custom\n p: '$3',\n position: 'relative',\n flexGrow: 1, // make sure to grow fully inside TextareaWrapper\n backgroundColor: 'transparent',\n borderRadius: 'inherit', // inherit border radius from TextareaWrapper\n boxShadow: 'inset 0 0 0 1px $colors$textareaBorder',\n color: '$textareaText',\n fontVariantNumeric: 'tabular-nums',\n transition: 'box-shadow .1s ease-in-out',\n\n '&:-webkit-autofill,&:autofill': {\n boxShadow: 'inset 0 0 0 1px $colors$textareaBorder, inset 0 0 0 100px $colors$textareaBg',\n },\n\n '&:-webkit-autofill::first-line,&:autofill::first-line': {\n fontFamily: '$rubik',\n color: '$hiContrast',\n },\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, ${FOCUS_SHADOW}`,\n },\n\n '&::placeholder': {\n color: '$textareaPlaceholder',\n },\n\n '&:read-only:not(:disabled)': {\n boxShadow: 'none',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.7,\n color: '$textareaDisabledText',\n },\n variants: {\n variant: {\n ghost: {\n boxShadow: 'none',\n '&:disabled': {\n boxShadow: 'none',\n },\n backgroundColor: 'transparent',\n '&:focus-visible': {\n backgroundColor: '$loContrast',\n },\n },\n },\n state: {\n invalid: {\n boxShadow: 'inset 0 0 0 1px $colors$textareaInvalidBorder',\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, ${FOCUS_SHADOW}`,\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$textareaInvalidBorder',\n },\n },\n },\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '@hover': {\n '&:hover:not(:read-only)': {\n cursor: 'text',\n },\n },\n '&:focus-visible:not(:read-only)': {\n cursor: 'text',\n },\n },\n text: {\n cursor: 'text',\n },\n },\n resize: {\n none: {\n resize: 'none',\n },\n both: {\n resize: 'both',\n },\n vertical: {\n resize: 'vertical',\n },\n horizontal: {\n resize: 'horizontal',\n },\n },\n endAdornment: {\n true: {\n paddingBottom: '$5',\n paddingRight: '$5',\n },\n },\n },\n defaultVariants: {\n cursor: 'default',\n resize: 'both',\n },\n compoundVariants: [\n {\n variant: 'ghost',\n state: 'invalid',\n css: {\n boxShadow: 'inset 0 0 0 1px $colors$textareaInvalidBorder',\n },\n },\n ],\n});\n\nconst TextareaWrapper = styled('div', {\n // Reset\n outline: 'none',\n lineHeight: 0,\n\n position: 'relative',\n display: 'inline-flex', // helps matching resizable content size\n backgroundColor: '$textareaBg',\n color: '$textareaPlaceholder',\n borderRadius: '$3',\n\n '&::before': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$textareaFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: '$textareaHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n\n variants: {\n disabled: {\n true: {\n opacity: 0.7,\n color: '$textareaDisabledText',\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: 'inherit',\n },\n '&::after': {\n backgroundColor: 'inherit',\n },\n },\n },\n },\n },\n state: {\n invalid: {\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$textareaInvalidBorder',\n },\n },\n },\n },\n },\n },\n defaultVariants: {\n disabled: false,\n },\n});\n\nconst AdornmentWrapperEnd = styled('div', {\n position: 'absolute',\n bottom: '$2',\n right: '$3',\n minWidth: '$5',\n minHeight: '$5',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n});\n\nexport interface TextareaVariants\n extends Omit<VariantProps<typeof StyledTextarea>, 'endAdornment'> {}\n\nexport interface TextareaProps\n extends TextareaVariants,\n Omit<React.ComponentProps<typeof StyledTextarea>, 'endAdornment'> {\n label?: string;\n endAdornment?: React.ReactNode;\n rootCss?: CSS;\n}\n\nexport const Textarea = React.forwardRef<React.ElementRef<typeof StyledTextarea>, TextareaProps>(\n (\n { state, disabled, onFocus, onBlur, label, id, rootCss, css, endAdornment, ...props },\n forwardedRef\n ) => {\n const [hasFocus, setHasFocus] = React.useState(false);\n\n const invalid = React.useMemo(() => state === 'invalid', [state]);\n\n const hasEndAdornment = React.useMemo(() => Boolean(endAdornment), [endAdornment]);\n\n const labelVariant = React.useMemo(() => {\n if (disabled) {\n return 'subtle';\n }\n if (invalid) {\n return 'invalid';\n }\n if (hasFocus) {\n return 'contrast';\n }\n return 'default';\n }, [invalid, disabled, hasFocus]);\n\n const handleFocus = React.useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n if (onFocus) {\n onFocus(e);\n }\n setHasFocus(true);\n },\n [onFocus, setHasFocus]\n );\n\n const handleBlur = React.useCallback(\n (e: React.FocusEvent<HTMLTextAreaElement>) => {\n if (onBlur) {\n onBlur(e);\n }\n setHasFocus(false);\n },\n [onBlur, setHasFocus]\n );\n\n return (\n <Box css={rootCss}>\n {label && (\n <Label variant={labelVariant} htmlFor={id} css={{ display: 'block' }}>\n {label}\n </Label>\n )}\n <TextareaWrapper state={state} disabled={disabled}>\n <StyledTextarea\n id={id}\n ref={forwardedRef}\n css={css}\n disabled={disabled}\n state={state}\n onFocus={handleFocus}\n onBlur={handleBlur}\n endAdornment={hasEndAdornment}\n {...props}\n />\n {hasEndAdornment && <AdornmentWrapperEnd>{endAdornment}</AdornmentWrapperEnd>}\n </TextareaWrapper>\n </Box>\n );\n }\n);\n"],"mappings":";;;;;;;AAQA,IAAM,eAAe,kBAAkB,EAAE,CAAC;AAG1C,IAAM,iBAAiB,OAAO,YAAY;CAExC,YAAY;CACZ,UAAU;CACV,aAAa;CACb,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,yBAAyB;CAGzB,GAAG;CACH,UAAU;CACV,UAAU;CACV,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,OAAO;CACP,oBAAoB;CACpB,YAAY;CAEZ,iCAAiC,EAC/B,WAAW,+EACb;CAEA,yDAAyD;EACvD,YAAY;EACZ,OAAO;CACT;CAEA,mBAAmB,EACjB,WAAW,gDAAgD,eAC7D;CAEA,kBAAkB,EAChB,OAAO,uBACT;CAEA,8BAA8B,EAC5B,WAAW,OACb;CAEA,cAAc;EACZ,eAAe;EACf,SAAS;EACT,OAAO;CACT;CACA,UAAU;EACR,SAAS,EACP,OAAO;GACL,WAAW;GACX,cAAc,EACZ,WAAW,OACb;GACA,iBAAiB;GACjB,mBAAmB,EACjB,iBAAiB,cACnB;EACF,EACF;EACA,OAAO,EACL,SAAS;GACP,WAAW;GACX,mBAAmB,EACjB,WAAW,kDAAkD,eAC/D;GACA,UAAU,EACR,WAAW,EACT,YAAY,EACV,iBAAiB,yBACnB,EACF,EACF;EACF,EACF;EACA,QAAQ;GACN,SAAS;IACP,QAAQ;IACR,UAAU,EACR,2BAA2B,EACzB,QAAQ,OACV,EACF;IACA,mCAAmC,EACjC,QAAQ,OACV;GACF;GACA,MAAM,EACJ,QAAQ,OACV;EACF;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;AAaD,IAAa,WAAW,MAAM,YAE1B,EAAE,OAAO,UAAU,SAAS,QAAQ,OAAO,IAAI,SAAS,KAAK,cAAc,GAAG,SAC9E,iBACG;CACH,MAAM,CAAC,UAAU,eAAe,MAAM,SAAS,KAAK;CAEpD,MAAM,UAAU,MAAM,cAAc,UAAU,WAAW,CAAC,KAAK,CAAC;CAEhE,MAAM,kBAAkB,MAAM,cAAc,QAAQ,YAAY,GAAG,CAAC,YAAY,CAAC;CAEjF,MAAM,eAAe,MAAM,cAAc;EACvC,IAAI,UACF,OAAO;EAET,IAAI,SACF,OAAO;EAET,IAAI,UACF,OAAO;EAET,OAAO;CACT,GAAG;EAAC;EAAS;EAAU;CAAQ,CAAC;CAEhC,MAAM,cAAc,MAAM,aACvB,MAA6C;EAC5C,IAAI,SACF,QAAQ,CAAC;EAEX,YAAY,IAAI;CAClB,GACA,CAAC,SAAS,WAAW,CACvB;CAEA,MAAM,aAAa,MAAM,aACtB,MAA6C;EAC5C,IAAI,QACF,OAAO,CAAC;EAEV,YAAY,KAAK;CACnB,GACA,CAAC,QAAQ,WAAW,CACtB;CAEA,OACE,qBAAC,KAAD;EAAK,KAAK;EAAV,UAAA,CACG,SACC,oBAAC,OAAD;GAAO,SAAS;GAAc,SAAS;GAAI,KAAK,EAAE,SAAS,QAAQ;GAChE,UAAA;EACI,CAAA,GAET,qBAAC,iBAAD;GAAwB;GAAiB;GAAzC,UAAA,CACE,oBAAC,gBAAD;IACM;IACJ,KAAK;IACA;IACK;IACH;IACP,SAAS;IACT,QAAQ;IACR,cAAc;IACd,GAAI;GACL,CAAA,GACA,mBAAmB,oBAAC,qBAAD,EAAA,UAAsB,aAAkC,CAAA,CAC7D;EACd,CAAA,CAAA;;AAET,CACF"}
|
|
1
|
+
{"version":3,"file":"Textarea.js","names":[],"sources":["../../../components/Textarea/Textarea.tsx"],"sourcesContent":["import React from 'react';\n\nimport { CSS, styled, VariantProps } from '../../stitches.config';\nimport { elevationVariants } from '../Elevation';\nimport { Field } from '../Field/Field';\nimport { FieldLabelProps, useFieldControl } from '../Field/FieldContext';\nimport { Label } from '../Label';\n\n// CONSTANTS\nconst FOCUS_SHADOW = elevationVariants[1].boxShadow; // apply elevation $1 when focus\n\n// COMPONENTS\nconst StyledTextarea = styled('textarea', {\n // Reset\n appearance: 'none',\n overflow: 'auto', // force overflow auto behaviour cross-browser\n borderWidth: '0',\n boxSizing: 'border-box',\n fontFamily: '$rubik',\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n // Custom\n p: '$3',\n position: 'relative',\n flexGrow: 1, // make sure to grow fully inside TextareaWrapper\n backgroundColor: 'transparent',\n borderRadius: 'inherit', // inherit border radius from TextareaWrapper\n boxShadow: 'inset 0 0 0 1px $colors$textareaBorder',\n color: '$textareaText',\n fontVariantNumeric: 'tabular-nums',\n transition: 'box-shadow .1s ease-in-out',\n\n '&:-webkit-autofill,&:autofill': {\n boxShadow: 'inset 0 0 0 1px $colors$textareaBorder, inset 0 0 0 100px $colors$textareaBg',\n WebkitTextFillColor: '$colors$hiContrast',\n },\n\n '&:-webkit-autofill::first-line,&:autofill::first-line': {\n fontFamily: '$rubik',\n color: '$hiContrast',\n },\n\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, ${FOCUS_SHADOW}`,\n },\n\n '&:-webkit-autofill:focus-visible,&:autofill:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaFocusBorder, inset 0 0 0 100px $colors$textareaBg, ${FOCUS_SHADOW}`,\n },\n\n '&::placeholder': {\n color: '$textareaPlaceholder',\n },\n\n '&:read-only:not(:disabled)': {\n boxShadow: 'none',\n },\n\n '&:disabled': {\n pointerEvents: 'none',\n opacity: 0.7,\n color: '$textareaDisabledText',\n },\n variants: {\n variant: {\n ghost: {\n boxShadow: 'none',\n '&:disabled': {\n boxShadow: 'none',\n },\n backgroundColor: 'transparent',\n '&:focus-visible': {\n backgroundColor: '$loContrast',\n },\n },\n },\n state: {\n invalid: {\n boxShadow: 'inset 0 0 0 1px $colors$textareaInvalidBorder',\n '&:-webkit-autofill,&:autofill': {\n boxShadow:\n 'inset 0 0 0 1px $colors$textareaInvalidBorder, inset 0 0 0 100px $colors$textareaBg',\n },\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, ${FOCUS_SHADOW}`,\n },\n '&:-webkit-autofill:focus-visible,&:autofill:focus-visible': {\n boxShadow: `inset 0 0 0 2px $colors$textareaInvalidBorder, inset 0 0 0 100px $colors$textareaBg, ${FOCUS_SHADOW}`,\n },\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$textareaInvalidBorder',\n },\n },\n },\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '@hover': {\n '&:hover:not(:read-only)': {\n cursor: 'text',\n },\n },\n '&:focus-visible:not(:read-only)': {\n cursor: 'text',\n },\n },\n text: {\n cursor: 'text',\n },\n },\n resize: {\n none: {\n resize: 'none',\n },\n both: {\n resize: 'both',\n },\n vertical: {\n resize: 'vertical',\n },\n horizontal: {\n resize: 'horizontal',\n },\n },\n endAdornment: {\n true: {\n paddingBottom: '$5',\n paddingRight: '$5',\n },\n },\n },\n defaultVariants: {\n cursor: 'default',\n resize: 'both',\n },\n compoundVariants: [\n {\n variant: 'ghost',\n state: 'invalid',\n css: {\n boxShadow: 'inset 0 0 0 1px $colors$textareaInvalidBorder',\n },\n },\n ],\n});\n\nconst TextareaWrapper = styled('div', {\n // Reset\n outline: 'none',\n lineHeight: 0,\n\n position: 'relative',\n display: 'inline-flex', // helps matching resizable content size\n backgroundColor: '$textareaBg',\n color: '$textareaPlaceholder',\n borderRadius: '$3',\n\n '&::before': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n },\n\n '&:focus-visible': {\n '&::before': {\n backgroundColor: '$textareaFocusBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.15,\n },\n },\n\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: '$textareaHoverBg',\n },\n '&::after': {\n backgroundColor: '$primary',\n opacity: 0.05,\n },\n },\n },\n\n variants: {\n disabled: {\n true: {\n opacity: 0.7,\n color: '$textareaDisabledText',\n '@hover': {\n '&:hover': {\n '&::before': {\n backgroundColor: 'inherit',\n },\n '&::after': {\n backgroundColor: 'inherit',\n },\n },\n },\n },\n },\n state: {\n invalid: {\n '@hover': {\n '&:hover': {\n '&::after': {\n backgroundColor: '$textareaInvalidBorder',\n },\n },\n },\n },\n },\n },\n defaultVariants: {\n disabled: false,\n },\n});\n\nconst AdornmentWrapperEnd = styled('div', {\n position: 'absolute',\n bottom: '$2',\n right: '$3',\n minWidth: '$5',\n minHeight: '$5',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n});\n\nexport interface TextareaVariants extends Omit<\n VariantProps<typeof StyledTextarea>,\n 'endAdornment'\n> {}\n\nexport interface TextareaProps\n extends TextareaVariants, Omit<React.ComponentProps<typeof StyledTextarea>, 'endAdornment'> {\n label?: string;\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n endAdornment?: React.ReactNode;\n rootCss?: CSS;\n}\n\ntype TextareaControlProps = Omit<\n TextareaProps,\n 'label' | 'description' | 'error' | 'announceError' | 'rootCss'\n>;\n\nconst TextareaControl = React.forwardRef<\n React.ElementRef<typeof StyledTextarea>,\n TextareaControlProps\n>(\n (\n {\n state,\n disabled,\n id,\n css,\n endAdornment,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n forwardedRef,\n ) => {\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n const resolvedState = control.invalid ? 'invalid' : state;\n const hasEndAdornment = Boolean(endAdornment);\n\n return (\n <TextareaWrapper state={resolvedState} disabled={control.disabled}>\n <StyledTextarea\n id={control.id}\n ref={forwardedRef}\n css={css}\n disabled={control.disabled}\n state={resolvedState}\n endAdornment={hasEndAdornment}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n {...props}\n />\n {hasEndAdornment && <AdornmentWrapperEnd>{endAdornment}</AdornmentWrapperEnd>}\n </TextareaWrapper>\n );\n },\n);\n\nexport const Textarea = React.forwardRef<React.ElementRef<typeof StyledTextarea>, TextareaProps>(\n (\n { label, description, error, announceError, id, rootCss, state, disabled, ...props },\n forwardedRef,\n ) => {\n return (\n <Field\n id={id}\n label={\n label &&\n ((labelProps: FieldLabelProps) => (\n <Label {...labelProps} css={{ display: 'block' }}>\n {label}\n </Label>\n ))\n }\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={disabled}\n css={rootCss}\n >\n <TextareaControl ref={forwardedRef} id={id} state={state} disabled={disabled} {...props} />\n </Field>\n );\n },\n);\n"],"mappings":";;;;;;;;AASA,IAAM,eAAe,kBAAkB,EAAE,CAAC;AAG1C,IAAM,iBAAiB,OAAO,YAAY;CAExC,YAAY;CACZ,UAAU;CACV,aAAa;CACb,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,yBAAyB;CAGzB,GAAG;CACH,UAAU;CACV,UAAU;CACV,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,OAAO;CACP,oBAAoB;CACpB,YAAY;CAEZ,iCAAiC;EAC/B,WAAW;EACX,qBAAqB;CACvB;CAEA,yDAAyD;EACvD,YAAY;EACZ,OAAO;CACT;CAEA,mBAAmB,EACjB,WAAW,gDAAgD,eAC7D;CAEA,6DAA6D,EAC3D,WAAW,sFAAsF,eACnG;CAEA,kBAAkB,EAChB,OAAO,uBACT;CAEA,8BAA8B,EAC5B,WAAW,OACb;CAEA,cAAc;EACZ,eAAe;E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OAAD;EACM;EACJ,OACE,WACE,eACA,oBAAC,OAAD;GAAO,GAAI;GAAY,KAAK,EAAE,SAAS,QAAQ;GAC5C,UAAA;EACI,CAAA;EAGE;EACN;EACQ;EACf,SAAS,UAAU;EACT;EACV,KAAK;EAEL,UAAA,oBAAC,iBAAD;GAAiB,KAAK;GAAkB;GAAW;GAAiB;GAAU,GAAI;EAAQ,CAAA;CACrF,CAAA;AAEX,CACF"}
|
|
@@ -2,40 +2,25 @@ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
const require_cssProps = require("../../styles/cssProps.cjs");
|
|
3
3
|
const require_themeContext = require("../../styles/themeContext.cjs");
|
|
4
4
|
const require_Label_vanilla = require("../Label/Label.vanilla.cjs");
|
|
5
|
+
const require_FieldContext = require("../Field/FieldContext.cjs");
|
|
6
|
+
const require_Field_vanilla = require("../Field/Field.vanilla.cjs");
|
|
5
7
|
const require_Textarea_vanilla_css = require("./Textarea.vanilla.css.cjs");
|
|
6
8
|
let react = require("react");
|
|
7
9
|
react = require_runtime.__toESM(react, 1);
|
|
8
10
|
let _vanilla_extract_dynamic = require("@vanilla-extract/dynamic");
|
|
9
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
12
|
// components/Textarea/Textarea.vanilla.tsx
|
|
11
|
-
var
|
|
12
|
-
const [hasFocus, setHasFocus] = react.default.useState(false);
|
|
13
|
+
var TextareaVanillaControl = react.default.forwardRef(({ state, disabled, id, css, endAdornment, variant, cursor, resize, className, style, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
|
|
13
14
|
const { colors } = require_themeContext.useVanillaExtractTheme();
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const labelVariant = react.default.useMemo(() => {
|
|
17
|
-
if (disabled) return "subtle";
|
|
18
|
-
if (invalid) return "invalid";
|
|
19
|
-
if (hasFocus) return "contrast";
|
|
20
|
-
return "default";
|
|
21
|
-
}, [
|
|
22
|
-
invalid,
|
|
15
|
+
const control = require_FieldContext.useFieldControl({
|
|
16
|
+
id,
|
|
23
17
|
disabled,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const handleBlur = react.default.useCallback((e) => {
|
|
31
|
-
if (onBlur) onBlur(e);
|
|
32
|
-
setHasFocus(false);
|
|
33
|
-
}, [onBlur, setHasFocus]);
|
|
34
|
-
const { style: rootCssStyles, vars: rootVars } = require_cssProps.processCSSProp(rootCss, colors);
|
|
35
|
-
const rootMergedStyles = {
|
|
36
|
-
...rootCssStyles,
|
|
37
|
-
...(0, _vanilla_extract_dynamic.assignInlineVars)(rootVars)
|
|
38
|
-
};
|
|
18
|
+
invalid: state === "invalid",
|
|
19
|
+
"aria-describedby": ariaDescribedBy,
|
|
20
|
+
"aria-invalid": ariaInvalid
|
|
21
|
+
});
|
|
22
|
+
const resolvedState = control.invalid ? "invalid" : state;
|
|
23
|
+
const hasEndAdornment = Boolean(endAdornment);
|
|
39
24
|
const { style: cssStyles, vars } = require_cssProps.processCSSProp(css, colors);
|
|
40
25
|
const mergedStyles = {
|
|
41
26
|
...cssStyles,
|
|
@@ -43,39 +28,54 @@ var TextareaVanilla = react.default.forwardRef(({ state, disabled, onFocus, onBl
|
|
|
43
28
|
...(0, _vanilla_extract_dynamic.assignInlineVars)(vars)
|
|
44
29
|
};
|
|
45
30
|
const textareaWrapperClass = require_Textarea_vanilla_css.textareaWrapperRecipe({
|
|
46
|
-
state,
|
|
47
|
-
disabled
|
|
31
|
+
state: resolvedState,
|
|
32
|
+
disabled: control.disabled
|
|
48
33
|
});
|
|
49
34
|
const styledTextareaClass = require_Textarea_vanilla_css.styledTextareaRecipe({
|
|
50
35
|
variant,
|
|
51
|
-
state,
|
|
36
|
+
state: resolvedState,
|
|
52
37
|
cursor,
|
|
53
38
|
resize,
|
|
54
39
|
endAdornment: hasEndAdornment
|
|
55
40
|
});
|
|
56
41
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
57
|
-
|
|
58
|
-
children: [
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
className: textareaWrapperClass,
|
|
43
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
44
|
+
id: control.id,
|
|
45
|
+
disabled: control.disabled,
|
|
46
|
+
ref: forwardedRef,
|
|
47
|
+
className: `${styledTextareaClass} ${className || ""}`.trim(),
|
|
48
|
+
style: mergedStyles,
|
|
49
|
+
"aria-describedby": control["aria-describedby"],
|
|
50
|
+
"aria-invalid": control["aria-invalid"],
|
|
51
|
+
...props
|
|
52
|
+
}), hasEndAdornment && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
53
|
+
className: "q2igawg",
|
|
54
|
+
children: endAdornment
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
TextareaVanillaControl.displayName = "TextareaVanillaControl";
|
|
59
|
+
var TextareaVanilla = react.default.forwardRef(({ label, description, error, announceError, id, rootCss, state, ...props }, forwardedRef) => {
|
|
60
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Field_vanilla.FieldVanilla, {
|
|
61
|
+
id,
|
|
62
|
+
label: label && ((labelProps) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Label_vanilla.LabelVanilla, {
|
|
63
|
+
...labelProps,
|
|
61
64
|
css: { display: "block" },
|
|
62
65
|
children: label
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
children: endAdornment
|
|
77
|
-
})]
|
|
78
|
-
})]
|
|
66
|
+
})),
|
|
67
|
+
description,
|
|
68
|
+
error,
|
|
69
|
+
announceError,
|
|
70
|
+
invalid: state === "invalid",
|
|
71
|
+
disabled: props.disabled,
|
|
72
|
+
css: rootCss,
|
|
73
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextareaVanillaControl, {
|
|
74
|
+
ref: forwardedRef,
|
|
75
|
+
id,
|
|
76
|
+
state,
|
|
77
|
+
...props
|
|
78
|
+
})
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
TextareaVanilla.displayName = "TextareaVanilla";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.vanilla.cjs","names":["React","useVanillaExtractTheme","processCSSProp","assignInlineVars","textareaWrapperRecipe","styledTextareaRecipe","LabelVanilla"],"sources":["../../../components/Textarea/Textarea.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport React from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { LabelVanilla } from '../Label';\nimport {\n adornmentWrapperEnd,\n styledTextareaRecipe,\n textareaWrapperRecipe,\n} from './Textarea.vanilla.css';\n\ntype StyledTextareaRecipeVariants = NonNullable<RecipeVariants<typeof styledTextareaRecipe>>;\n\nexport interface TextareaVanillaOwnProps extends CSSProps {\n variant?: StyledTextareaRecipeVariants['variant'];\n state?: StyledTextareaRecipeVariants['state'];\n cursor?: StyledTextareaRecipeVariants['cursor'];\n resize?: StyledTextareaRecipeVariants['resize'];\n label?: string;\n endAdornment?: React.ReactNode;\n rootCss?: CSSProps['css'];\n}\n\nexport type TextareaVanillaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> &\n TextareaVanillaOwnProps;\n\
|
|
1
|
+
{"version":3,"file":"Textarea.vanilla.cjs","names":["React","useVanillaExtractTheme","useFieldControl","processCSSProp","assignInlineVars","textareaWrapperRecipe","styledTextareaRecipe","FieldVanilla","LabelVanilla"],"sources":["../../../components/Textarea/Textarea.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport React from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { FieldVanilla } from '../Field/Field.vanilla';\nimport { FieldLabelProps, useFieldControl } from '../Field/FieldContext';\nimport { LabelVanilla } from '../Label';\nimport {\n adornmentWrapperEnd,\n styledTextareaRecipe,\n textareaWrapperRecipe,\n} from './Textarea.vanilla.css';\n\ntype StyledTextareaRecipeVariants = NonNullable<RecipeVariants<typeof styledTextareaRecipe>>;\n\nexport interface TextareaVanillaOwnProps extends CSSProps {\n variant?: StyledTextareaRecipeVariants['variant'];\n state?: StyledTextareaRecipeVariants['state'];\n cursor?: StyledTextareaRecipeVariants['cursor'];\n resize?: StyledTextareaRecipeVariants['resize'];\n label?: string;\n description?: React.ReactNode;\n error?: React.ReactNode;\n announceError?: boolean;\n endAdornment?: React.ReactNode;\n rootCss?: CSSProps['css'];\n}\n\nexport type TextareaVanillaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> &\n TextareaVanillaOwnProps;\n\ntype TextareaVanillaControlProps = Omit<\n TextareaVanillaProps,\n 'label' | 'description' | 'error' | 'announceError' | 'rootCss'\n>;\n\nconst TextareaVanillaControl = React.forwardRef<HTMLTextAreaElement, TextareaVanillaControlProps>(\n (\n {\n state,\n disabled,\n id,\n css,\n endAdornment,\n variant,\n cursor,\n resize,\n className,\n style,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n ...props\n },\n forwardedRef,\n ) => {\n const { colors } = useVanillaExtractTheme();\n const control = useFieldControl({\n id,\n disabled,\n invalid: state === 'invalid',\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n });\n const resolvedState = control.invalid ? 'invalid' : state;\n const hasEndAdornment = Boolean(endAdornment);\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const mergedStyles = { ...cssStyles, ...style, ...assignInlineVars(vars) };\n\n const textareaWrapperClass = textareaWrapperRecipe({\n state: resolvedState,\n disabled: control.disabled,\n });\n const styledTextareaClass = styledTextareaRecipe({\n variant,\n state: resolvedState,\n cursor,\n resize,\n endAdornment: hasEndAdornment,\n });\n\n return (\n <div className={textareaWrapperClass}>\n <textarea\n id={control.id}\n disabled={control.disabled}\n ref={forwardedRef}\n className={`${styledTextareaClass} ${className || ''}`.trim()}\n style={mergedStyles}\n aria-describedby={control['aria-describedby']}\n aria-invalid={control['aria-invalid']}\n {...props}\n />\n {hasEndAdornment && <div className={adornmentWrapperEnd}>{endAdornment}</div>}\n </div>\n );\n },\n);\n\nTextareaVanillaControl.displayName = 'TextareaVanillaControl';\n\nexport const TextareaVanilla = React.forwardRef<HTMLTextAreaElement, TextareaVanillaProps>(\n ({ label, description, error, announceError, id, rootCss, state, ...props }, forwardedRef) => {\n return (\n <FieldVanilla\n id={id}\n label={\n label &&\n ((labelProps: FieldLabelProps) => (\n <LabelVanilla {...labelProps} css={{ display: 'block' }}>\n {label}\n </LabelVanilla>\n ))\n }\n description={description}\n error={error}\n announceError={announceError}\n invalid={state === 'invalid'}\n disabled={props.disabled}\n css={rootCss}\n >\n <TextareaVanillaControl ref={forwardedRef} id={id} state={state} {...props} />\n </FieldVanilla>\n );\n },\n);\n\nTextareaVanilla.displayName = 'TextareaVanilla';\n"],"mappings":";;;;;;;;;;;;AAsCA,IAAM,yBAAyBA,MAAAA,QAAM,YAEjC,EACE,OACA,UACA,IACA,KACA,cACA,SACA,QACA,QACA,WACA,OACA,oBAAoB,iBACpB,gBAAgB,aAChB,GAAG,SAEL,iBACG;CACH,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAC1C,MAAM,UAAUC,qBAAAA,gBAAgB;EAC9B;EACA;EACA,SAAS,UAAU;EACnB,oBAAoB;EACpB,gBAAgB;CAClB,CAAC;CACD,MAAM,gBAAgB,QAAQ,UAAU,YAAY;CACpD,MAAM,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AI;EAAQ,CAAA;CACjE,CAAA;AAElB,CACF;AAEA,gBAAgB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/Textarea/Textarea.vanilla.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { breakpoints } from '../../styles/breakpoints.css';\nimport { tokens } from '../../styles/tokens.css';\n\n// CONSTANTS\nconst FOCUS_SHADOW =\n '0 1px 5px 0 hsla(0, 0%, 0%, 0.2), 0 3px 1px -2px hsla(0, 0%, 0%, 0.12), 0 2px 2px 0 hsla(0, 0%, 0%, 0.14)';\n\nconst styledTextareaBase = style({\n // Reset\n appearance: 'none',\n overflow: 'auto',\n borderWidth: '0',\n boxSizing: 'border-box',\n fontFamily: tokens.fonts.rubik,\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n // Custom\n padding: tokens.space['3'],\n position: 'relative',\n flexGrow: 1,\n backgroundColor: 'transparent',\n borderRadius: 'inherit',\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaBorder}`,\n color: tokens.colors.textareaText,\n fontVariantNumeric: 'tabular-nums',\n transition: 'box-shadow .1s ease-in-out',\n\n selectors: {\n '&:-webkit-autofill, &:autofill': {\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaBorder}, inset 0 0 0 100px ${tokens.colors.textareaBg}`,\n },\n '&:-webkit-autofill::first-line, &:autofill::first-line': {\n fontFamily: tokens.fonts.rubik,\n color: tokens.colors.hiContrast,\n },\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${tokens.colors.textareaFocusBorder}, ${FOCUS_SHADOW}`,\n },\n '&::placeholder': {\n color: tokens.colors.textareaPlaceholder,\n },\n '&:read-only:not(:disabled)': {\n boxShadow: 'none',\n },\n '&:disabled': {\n pointerEvents: 'none',\n opacity: '0.7',\n color: tokens.colors.textareaDisabledText,\n },\n },\n});\n\nexport const styledTextareaRecipe = recipe({\n base: styledTextareaBase,\n variants: {\n variant: {\n ghost: {\n boxShadow: 'none',\n backgroundColor: 'transparent',\n selectors: {\n '&:disabled': {\n boxShadow: 'none',\n },\n '&:focus-visible': {\n backgroundColor: tokens.colors.loContrast,\n },\n },\n },\n },\n state: {\n invalid: {\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaInvalidBorder}`,\n selectors: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${tokens.colors.textareaInvalidBorder}, ${FOCUS_SHADOW}`,\n },\n },\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover::after': {\n backgroundColor: tokens.colors.textareaInvalidBorder,\n },\n },\n },\n },\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover:not(:read-only)': {\n cursor: 'text',\n },\n },\n },\n },\n selectors: {\n '&:focus-visible:not(:read-only)': {\n cursor: 'text',\n },\n },\n },\n text: {\n cursor: 'text',\n },\n },\n resize: {\n none: {\n resize: 'none',\n },\n both: {\n resize: 'both',\n },\n vertical: {\n resize: 'vertical',\n },\n horizontal: {\n resize: 'horizontal',\n },\n },\n endAdornment: {\n true: {\n paddingBottom: tokens.space['5'],\n paddingRight: tokens.space['5'],\n },\n },\n },\n compoundVariants: [\n {\n variants: {\n variant: 'ghost',\n state: 'invalid',\n },\n style: {\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaInvalidBorder}`,\n },\n },\n ],\n defaultVariants: {\n cursor: 'default',\n resize: 'both',\n },\n});\n\nconst textareaWrapperBase = style({\n // Reset\n outline: 'none',\n lineHeight: 0,\n\n position: 'relative',\n display: 'inline-flex',\n backgroundColor: tokens.colors.textareaBg,\n color: tokens.colors.textareaPlaceholder,\n borderRadius: tokens.radii['3'],\n\n selectors: {\n '&::before': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: '0',\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: '0',\n pointerEvents: 'none',\n },\n '&:focus-visible::before': {\n backgroundColor: tokens.colors.textareaFocusBg,\n },\n '&:focus-visible::after': {\n backgroundColor: tokens.colors.primary,\n opacity: '0.15',\n },\n },\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover::before': {\n backgroundColor: tokens.colors.textareaHoverBg,\n },\n '&:hover::after': {\n backgroundColor: tokens.colors.primary,\n opacity: '0.05',\n },\n },\n },\n },\n});\n\nexport const textareaWrapperRecipe = recipe({\n base: textareaWrapperBase,\n variants: {\n disabled: {\n true: {\n opacity: '0.7',\n color: tokens.colors.textareaDisabledText,\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover::before': {\n backgroundColor: 'inherit',\n },\n '&:hover::after': {\n backgroundColor: 'inherit',\n },\n },\n },\n },\n },\n },\n state: {\n invalid: {\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover::after': {\n backgroundColor: tokens.colors.textareaInvalidBorder,\n },\n },\n },\n },\n },\n },\n },\n defaultVariants: {\n disabled: false,\n },\n});\n\nexport const adornmentWrapperEnd = style({\n position: 'absolute',\n bottom: tokens.space['2'],\n right: tokens.space['3'],\n minWidth: tokens.sizes['5'],\n minHeight: tokens.sizes['5'],\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n});\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Textarea.vanilla.css.cjs","names":["_7a468"],"sources":["../../../components/Textarea/Textarea.vanilla.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css';\nimport { recipe } from '@vanilla-extract/recipes';\n\nimport { breakpoints } from '../../styles/breakpoints.css';\nimport { tokens } from '../../styles/tokens.css';\n\n// CONSTANTS\nconst FOCUS_SHADOW =\n '0 1px 5px 0 hsla(0, 0%, 0%, 0.2), 0 3px 1px -2px hsla(0, 0%, 0%, 0.12), 0 2px 2px 0 hsla(0, 0%, 0%, 0.14)';\n\nconst styledTextareaBase = style({\n // Reset\n appearance: 'none',\n overflow: 'auto',\n borderWidth: '0',\n boxSizing: 'border-box',\n fontFamily: tokens.fonts.rubik,\n margin: '0',\n outline: 'none',\n WebkitTapHighlightColor: 'rgba(0,0,0,0)',\n\n // Custom\n padding: tokens.space['3'],\n position: 'relative',\n flexGrow: 1,\n backgroundColor: 'transparent',\n borderRadius: 'inherit',\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaBorder}`,\n color: tokens.colors.textareaText,\n fontVariantNumeric: 'tabular-nums',\n transition: 'box-shadow .1s ease-in-out',\n\n selectors: {\n '&:-webkit-autofill, &:autofill': {\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaBorder}, inset 0 0 0 100px ${tokens.colors.textareaBg}`,\n WebkitTextFillColor: tokens.colors.hiContrast,\n },\n '&:-webkit-autofill::first-line, &:autofill::first-line': {\n fontFamily: tokens.fonts.rubik,\n color: tokens.colors.hiContrast,\n },\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${tokens.colors.textareaFocusBorder}, ${FOCUS_SHADOW}`,\n },\n '&:-webkit-autofill:focus-visible, &:autofill:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${tokens.colors.textareaFocusBorder}, inset 0 0 0 100px ${tokens.colors.textareaBg}, ${FOCUS_SHADOW}`,\n },\n '&::placeholder': {\n color: tokens.colors.textareaPlaceholder,\n },\n '&:read-only:not(:disabled)': {\n boxShadow: 'none',\n },\n '&:disabled': {\n pointerEvents: 'none',\n opacity: '0.7',\n color: tokens.colors.textareaDisabledText,\n },\n },\n});\n\nexport const styledTextareaRecipe = recipe({\n base: styledTextareaBase,\n variants: {\n variant: {\n ghost: {\n boxShadow: 'none',\n backgroundColor: 'transparent',\n selectors: {\n '&:disabled': {\n boxShadow: 'none',\n },\n '&:focus-visible': {\n backgroundColor: tokens.colors.loContrast,\n },\n },\n },\n },\n state: {\n invalid: {\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaInvalidBorder}`,\n selectors: {\n '&:-webkit-autofill, &:autofill': {\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaInvalidBorder}, inset 0 0 0 100px ${tokens.colors.textareaBg}`,\n },\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${tokens.colors.textareaInvalidBorder}, ${FOCUS_SHADOW}`,\n },\n '&:-webkit-autofill:focus-visible, &:autofill:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${tokens.colors.textareaInvalidBorder}, inset 0 0 0 100px ${tokens.colors.textareaBg}, ${FOCUS_SHADOW}`,\n },\n },\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover::after': {\n backgroundColor: tokens.colors.textareaInvalidBorder,\n },\n },\n },\n },\n },\n },\n cursor: {\n default: {\n cursor: 'default',\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover:not(:read-only)': {\n cursor: 'text',\n },\n },\n },\n },\n selectors: {\n '&:focus-visible:not(:read-only)': {\n cursor: 'text',\n },\n },\n },\n text: {\n cursor: 'text',\n },\n },\n resize: {\n none: {\n resize: 'none',\n },\n both: {\n resize: 'both',\n },\n vertical: {\n resize: 'vertical',\n },\n horizontal: {\n resize: 'horizontal',\n },\n },\n endAdornment: {\n true: {\n paddingBottom: tokens.space['5'],\n paddingRight: tokens.space['5'],\n },\n },\n },\n compoundVariants: [\n {\n variants: {\n variant: 'ghost',\n state: 'invalid',\n },\n style: {\n boxShadow: `inset 0 0 0 1px ${tokens.colors.textareaInvalidBorder}`,\n },\n },\n ],\n defaultVariants: {\n cursor: 'default',\n resize: 'both',\n },\n});\n\nconst textareaWrapperBase = style({\n // Reset\n outline: 'none',\n lineHeight: 0,\n\n position: 'relative',\n display: 'inline-flex',\n backgroundColor: tokens.colors.textareaBg,\n color: tokens.colors.textareaPlaceholder,\n borderRadius: tokens.radii['3'],\n\n selectors: {\n '&::before': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: '0',\n pointerEvents: 'none',\n },\n '&::after': {\n boxSizing: 'border-box',\n borderRadius: 'inherit',\n content: '\"\"',\n position: 'absolute',\n inset: '0',\n pointerEvents: 'none',\n },\n '&:focus-visible::before': {\n backgroundColor: tokens.colors.textareaFocusBg,\n },\n '&:focus-visible::after': {\n backgroundColor: tokens.colors.primary,\n opacity: '0.15',\n },\n },\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover::before': {\n backgroundColor: tokens.colors.textareaHoverBg,\n },\n '&:hover::after': {\n backgroundColor: tokens.colors.primary,\n opacity: '0.05',\n },\n },\n },\n },\n});\n\nexport const textareaWrapperRecipe = recipe({\n base: textareaWrapperBase,\n variants: {\n disabled: {\n true: {\n opacity: '0.7',\n color: tokens.colors.textareaDisabledText,\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover::before': {\n backgroundColor: 'inherit',\n },\n '&:hover::after': {\n backgroundColor: 'inherit',\n },\n },\n },\n },\n },\n },\n state: {\n invalid: {\n '@media': {\n [breakpoints.hover]: {\n selectors: {\n '&:hover::after': {\n backgroundColor: tokens.colors.textareaInvalidBorder,\n },\n },\n },\n },\n },\n },\n },\n defaultVariants: {\n disabled: false,\n },\n});\n\nexport const adornmentWrapperEnd = style({\n position: 'absolute',\n bottom: tokens.space['2'],\n right: tokens.space['3'],\n minWidth: tokens.sizes['5'],\n minHeight: tokens.sizes['5'],\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n});\n"],"mappings":""}
|