@plasmicpkgs/react-aria 0.0.145 → 0.0.146
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/.tsbuildinfo +1 -1
- package/dist/react-aria.esm.js +21 -5
- package/dist/react-aria.esm.js.map +1 -1
- package/dist/react-aria.js +21 -5
- package/dist/react-aria.js.map +1 -1
- package/dist/registerTextArea.d.ts +1 -0
- package/package.json +2 -2
- package/skinny/registerTextArea.cjs.js +21 -5
- package/skinny/registerTextArea.cjs.js.map +1 -1
- package/skinny/registerTextArea.d.ts +1 -0
- package/skinny/registerTextArea.esm.js +21 -5
- package/skinny/registerTextArea.esm.js.map +1 -1
|
@@ -5,6 +5,7 @@ import { WithVariants } from "./variant-utils";
|
|
|
5
5
|
declare const TEXTAREA_VARIANTS: ("disabled" | "hovered" | "focused" | "focusVisible")[];
|
|
6
6
|
export interface BaseTextAreaProps extends Omit<TextAreaProps, "className">, HasControlContextData, WithVariants<typeof TEXTAREA_VARIANTS> {
|
|
7
7
|
className?: string;
|
|
8
|
+
resize?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare const inputHelpers: {
|
|
10
11
|
states: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/react-aria",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.146",
|
|
4
4
|
"description": "Plasmic registration calls for react-aria based components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "f7751c75698357a2c49f2e28818a6c2437e8341f"
|
|
78
78
|
}
|
|
@@ -66,12 +66,14 @@ function BaseTextArea_(props, ref) {
|
|
|
66
66
|
className,
|
|
67
67
|
plasmicUpdateVariant,
|
|
68
68
|
setControlContextData,
|
|
69
|
-
value
|
|
69
|
+
value,
|
|
70
|
+
resize
|
|
70
71
|
} = _a, restProps = __objRest(_a, [
|
|
71
72
|
"className",
|
|
72
73
|
"plasmicUpdateVariant",
|
|
73
74
|
"setControlContextData",
|
|
74
|
-
"value"
|
|
75
|
+
"value",
|
|
76
|
+
"resize"
|
|
75
77
|
]);
|
|
76
78
|
const textFieldContext = React__default.default.useContext(contexts.PlasmicTextFieldContext);
|
|
77
79
|
const [textAreaContextProps, textAreaRef] = reactAriaComponents.useContextProps(
|
|
@@ -90,7 +92,7 @@ function BaseTextArea_(props, ref) {
|
|
|
90
92
|
hoverProps,
|
|
91
93
|
{
|
|
92
94
|
value: utils.isDefined(textFieldContext) ? void 0 : value,
|
|
93
|
-
style: common.COMMON_STYLES,
|
|
95
|
+
style: __spreadValues(__spreadValues({}, common.COMMON_STYLES), resize ? { resize } : {}),
|
|
94
96
|
className
|
|
95
97
|
}
|
|
96
98
|
);
|
|
@@ -132,7 +134,7 @@ function registerTextArea(loader, overrides) {
|
|
|
132
134
|
importPath: "@plasmicpkgs/react-aria/skinny/registerTextArea",
|
|
133
135
|
importName: "BaseTextArea",
|
|
134
136
|
variants,
|
|
135
|
-
props: __spreadValues({}, common.getCommonProps("Text Area", [
|
|
137
|
+
props: __spreadProps(__spreadValues({}, common.getCommonProps("Text Area", [
|
|
136
138
|
"name",
|
|
137
139
|
"disabled",
|
|
138
140
|
"readOnly",
|
|
@@ -158,7 +160,21 @@ function registerTextArea(loader, overrides) {
|
|
|
158
160
|
"onSelect",
|
|
159
161
|
"onBeforeInput",
|
|
160
162
|
"onInput"
|
|
161
|
-
])),
|
|
163
|
+
])), {
|
|
164
|
+
resize: {
|
|
165
|
+
type: "choice",
|
|
166
|
+
description: "Controls if and how the element can be resized.",
|
|
167
|
+
options: [
|
|
168
|
+
"both",
|
|
169
|
+
"horizontal",
|
|
170
|
+
"vertical",
|
|
171
|
+
"block",
|
|
172
|
+
"inline",
|
|
173
|
+
"none"
|
|
174
|
+
],
|
|
175
|
+
defaultValueHint: "both"
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
162
178
|
states: {
|
|
163
179
|
value: __spreadValues({
|
|
164
180
|
type: "writable",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerTextArea.cjs.js","sources":["../src/registerTextArea.tsx"],"sourcesContent":["import React, { ChangeEvent, ForwardedRef, useEffect } from \"react\";\nimport { mergeProps, useFocusRing, useHover } from \"react-aria\";\nimport {\n TextAreaContext,\n TextAreaProps,\n useContextProps,\n} from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonProps } from \"./common\";\nimport { PlasmicTextFieldContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n filterHoverProps,\n HasControlContextData,\n isDefined,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst TEXTAREA_VARIANTS = [\n \"focused\" as const,\n \"focusVisible\" as const,\n \"hovered\" as const,\n \"disabled\" as const,\n];\n\nconst { variants } = pickAriaComponentVariants(TEXTAREA_VARIANTS);\n\nexport interface BaseTextAreaProps\n extends Omit<TextAreaProps, \"className\">,\n HasControlContextData,\n WithVariants<typeof TEXTAREA_VARIANTS> {\n className?: string;\n}\n\nexport const inputHelpers = {\n states: {\n value: {\n onChangeArgsToValue: (e: ChangeEvent<HTMLInputElement>) => {\n return e.target.value;\n },\n },\n },\n};\n\nfunction BaseTextArea_(\n props: BaseTextAreaProps,\n ref: ForwardedRef<HTMLTextAreaElement>\n) {\n const {\n className,\n plasmicUpdateVariant,\n setControlContextData,\n value,\n ...restProps\n } = props;\n\n const textFieldContext = React.useContext(PlasmicTextFieldContext);\n const [textAreaContextProps, textAreaRef] = useContextProps(\n restProps,\n ref,\n TextAreaContext\n );\n\n const { hoverProps, isHovered } = useHover(textAreaContextProps);\n const { isFocused, isFocusVisible, focusProps } = useFocusRing({\n isTextInput: true,\n autoFocus: textAreaContextProps.autoFocus,\n });\n\n const mergedProps = mergeProps(\n filterHoverProps(textAreaContextProps),\n focusProps,\n hoverProps,\n {\n value: isDefined(textFieldContext) ? undefined : value,\n style: COMMON_STYLES,\n className,\n }\n );\n\n const isDisabled = mergedProps.disabled || false;\n const isInvalid =\n !!mergedProps[\"aria-invalid\"] && mergedProps[\"aria-invalid\"] !== \"false\";\n\n setControlContextData?.({\n parent: textFieldContext,\n });\n\n useEffect(() => {\n if (plasmicUpdateVariant) {\n plasmicUpdateVariant({\n disabled: isDisabled,\n focused: isFocused,\n focusVisible: isFocusVisible,\n hovered: isHovered,\n });\n }\n }, [isFocused, isFocusVisible, isHovered, isDisabled, plasmicUpdateVariant]);\n\n return (\n <textarea\n {...mergedProps}\n ref={textAreaRef}\n data-focused={isFocused || undefined}\n data-disabled={isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-invalid={isInvalid || undefined}\n />\n );\n}\n\nexport const BaseTextArea = React.forwardRef(BaseTextArea_);\n\nexport function registerTextArea(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTextArea>\n) {\n registerComponentHelper(\n loader,\n BaseTextArea,\n {\n name: makeComponentName(\"textarea\"),\n displayName: \"Aria TextArea\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextArea\",\n importName: \"BaseTextArea\",\n variants,\n props: {\n ...getCommonProps<BaseTextAreaProps>(\"Text Area\", [\n \"name\",\n \"disabled\",\n \"readOnly\",\n \"autoFocus\",\n \"aria-label\",\n \"required\",\n \"placeholder\",\n \"value\",\n \"maxLength\",\n \"minLength\",\n \"inputMode\",\n \"onChange\",\n \"onFocus\",\n \"onBlur\",\n \"onKeyDown\",\n \"onKeyUp\",\n \"onCopy\",\n \"onCut\",\n \"onPaste\",\n \"onCompositionStart\",\n \"onCompositionEnd\",\n \"onCompositionUpdate\",\n \"onSelect\",\n \"onBeforeInput\",\n \"onInput\",\n ]),\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n ...inputHelpers.states.value,\n },\n },\n componentHelpers: {\n helpers: inputHelpers,\n importName: \"inputHelpers\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextArea\",\n },\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PlasmicTextFieldContext","useContextProps","TextAreaContext","useHover","useFocusRing","mergeProps","filterHoverProps","isDefined","COMMON_STYLES","useEffect","registerComponentHelper","makeComponentName","getCommonProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,iBAAoB,GAAA;AAAA,EACxB,SAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAa,GAAAA,sCAAA,CAA0B,iBAAiB,CAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"registerTextArea.cjs.js","sources":["../src/registerTextArea.tsx"],"sourcesContent":["import React, { ChangeEvent, ForwardedRef, useEffect } from \"react\";\nimport { mergeProps, useFocusRing, useHover } from \"react-aria\";\nimport {\n TextAreaContext,\n TextAreaProps,\n useContextProps,\n} from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonProps } from \"./common\";\nimport { PlasmicTextFieldContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n filterHoverProps,\n HasControlContextData,\n isDefined,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst TEXTAREA_VARIANTS = [\n \"focused\" as const,\n \"focusVisible\" as const,\n \"hovered\" as const,\n \"disabled\" as const,\n];\n\nconst { variants } = pickAriaComponentVariants(TEXTAREA_VARIANTS);\n\nexport interface BaseTextAreaProps\n extends Omit<TextAreaProps, \"className\">,\n HasControlContextData,\n WithVariants<typeof TEXTAREA_VARIANTS> {\n className?: string;\n resize?: string;\n}\n\nexport const inputHelpers = {\n states: {\n value: {\n onChangeArgsToValue: (e: ChangeEvent<HTMLInputElement>) => {\n return e.target.value;\n },\n },\n },\n};\n\nfunction BaseTextArea_(\n props: BaseTextAreaProps,\n ref: ForwardedRef<HTMLTextAreaElement>\n) {\n const {\n className,\n plasmicUpdateVariant,\n setControlContextData,\n value,\n resize,\n ...restProps\n } = props;\n\n const textFieldContext = React.useContext(PlasmicTextFieldContext);\n const [textAreaContextProps, textAreaRef] = useContextProps(\n restProps,\n ref,\n TextAreaContext\n );\n\n const { hoverProps, isHovered } = useHover(textAreaContextProps);\n const { isFocused, isFocusVisible, focusProps } = useFocusRing({\n isTextInput: true,\n autoFocus: textAreaContextProps.autoFocus,\n });\n\n const mergedProps = mergeProps(\n filterHoverProps(textAreaContextProps),\n focusProps,\n hoverProps,\n {\n value: isDefined(textFieldContext) ? undefined : value,\n style: {\n ...COMMON_STYLES,\n ...(resize ? { resize } : {}),\n },\n className,\n }\n );\n\n const isDisabled = mergedProps.disabled || false;\n const isInvalid =\n !!mergedProps[\"aria-invalid\"] && mergedProps[\"aria-invalid\"] !== \"false\";\n\n setControlContextData?.({\n parent: textFieldContext,\n });\n\n useEffect(() => {\n if (plasmicUpdateVariant) {\n plasmicUpdateVariant({\n disabled: isDisabled,\n focused: isFocused,\n focusVisible: isFocusVisible,\n hovered: isHovered,\n });\n }\n }, [isFocused, isFocusVisible, isHovered, isDisabled, plasmicUpdateVariant]);\n\n return (\n <textarea\n {...mergedProps}\n ref={textAreaRef}\n data-focused={isFocused || undefined}\n data-disabled={isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-invalid={isInvalid || undefined}\n />\n );\n}\n\nexport const BaseTextArea = React.forwardRef(BaseTextArea_);\n\nexport function registerTextArea(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTextArea>\n) {\n registerComponentHelper(\n loader,\n BaseTextArea,\n {\n name: makeComponentName(\"textarea\"),\n displayName: \"Aria TextArea\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextArea\",\n importName: \"BaseTextArea\",\n variants,\n props: {\n ...getCommonProps<BaseTextAreaProps>(\"Text Area\", [\n \"name\",\n \"disabled\",\n \"readOnly\",\n \"autoFocus\",\n \"aria-label\",\n \"required\",\n \"placeholder\",\n \"value\",\n \"maxLength\",\n \"minLength\",\n \"inputMode\",\n \"onChange\",\n \"onFocus\",\n \"onBlur\",\n \"onKeyDown\",\n \"onKeyUp\",\n \"onCopy\",\n \"onCut\",\n \"onPaste\",\n \"onCompositionStart\",\n \"onCompositionEnd\",\n \"onCompositionUpdate\",\n \"onSelect\",\n \"onBeforeInput\",\n \"onInput\",\n ]),\n resize: {\n type: \"choice\",\n description: \"Controls if and how the element can be resized.\",\n options: [\n \"both\",\n \"horizontal\",\n \"vertical\",\n \"block\",\n \"inline\",\n \"none\",\n ],\n defaultValueHint: \"both\",\n },\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n ...inputHelpers.states.value,\n },\n },\n componentHelpers: {\n helpers: inputHelpers,\n importName: \"inputHelpers\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextArea\",\n },\n },\n overrides\n );\n}\n"],"names":["pickAriaComponentVariants","React","PlasmicTextFieldContext","useContextProps","TextAreaContext","useHover","useFocusRing","mergeProps","filterHoverProps","isDefined","COMMON_STYLES","useEffect","registerComponentHelper","makeComponentName","getCommonProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,iBAAoB,GAAA;AAAA,EACxB,SAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAa,GAAAA,sCAAA,CAA0B,iBAAiB,CAAA,CAAA;AAUzD,MAAM,YAAe,G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AA;AAAA,UACd,YAAc,EAAA,MAAA;AAAA,SAAA,EACX,aAAa,MAAO,CAAA,KAAA,CAAA;AAAA,OAE3B;AAAA,MACA,gBAAkB,EAAA;AAAA,QAChB,OAAS,EAAA,YAAA;AAAA,QACT,UAAY,EAAA,cAAA;AAAA,QACZ,UAAY,EAAA,iDAAA;AAAA,OACd;AAAA,KACF;AAAA,IACA,SAAA;AAAA,GACF,CAAA;AACF;;;;;;"}
|
|
@@ -5,6 +5,7 @@ import { WithVariants } from "./variant-utils";
|
|
|
5
5
|
declare const TEXTAREA_VARIANTS: ("disabled" | "hovered" | "focused" | "focusVisible")[];
|
|
6
6
|
export interface BaseTextAreaProps extends Omit<TextAreaProps, "className">, HasControlContextData, WithVariants<typeof TEXTAREA_VARIANTS> {
|
|
7
7
|
className?: string;
|
|
8
|
+
resize?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare const inputHelpers: {
|
|
10
11
|
states: {
|
|
@@ -60,12 +60,14 @@ function BaseTextArea_(props, ref) {
|
|
|
60
60
|
className,
|
|
61
61
|
plasmicUpdateVariant,
|
|
62
62
|
setControlContextData,
|
|
63
|
-
value
|
|
63
|
+
value,
|
|
64
|
+
resize
|
|
64
65
|
} = _a, restProps = __objRest(_a, [
|
|
65
66
|
"className",
|
|
66
67
|
"plasmicUpdateVariant",
|
|
67
68
|
"setControlContextData",
|
|
68
|
-
"value"
|
|
69
|
+
"value",
|
|
70
|
+
"resize"
|
|
69
71
|
]);
|
|
70
72
|
const textFieldContext = React.useContext(PlasmicTextFieldContext);
|
|
71
73
|
const [textAreaContextProps, textAreaRef] = useContextProps(
|
|
@@ -84,7 +86,7 @@ function BaseTextArea_(props, ref) {
|
|
|
84
86
|
hoverProps,
|
|
85
87
|
{
|
|
86
88
|
value: isDefined(textFieldContext) ? void 0 : value,
|
|
87
|
-
style: COMMON_STYLES,
|
|
89
|
+
style: __spreadValues(__spreadValues({}, COMMON_STYLES), resize ? { resize } : {}),
|
|
88
90
|
className
|
|
89
91
|
}
|
|
90
92
|
);
|
|
@@ -126,7 +128,7 @@ function registerTextArea(loader, overrides) {
|
|
|
126
128
|
importPath: "@plasmicpkgs/react-aria/skinny/registerTextArea",
|
|
127
129
|
importName: "BaseTextArea",
|
|
128
130
|
variants,
|
|
129
|
-
props: __spreadValues({}, getCommonProps("Text Area", [
|
|
131
|
+
props: __spreadProps(__spreadValues({}, getCommonProps("Text Area", [
|
|
130
132
|
"name",
|
|
131
133
|
"disabled",
|
|
132
134
|
"readOnly",
|
|
@@ -152,7 +154,21 @@ function registerTextArea(loader, overrides) {
|
|
|
152
154
|
"onSelect",
|
|
153
155
|
"onBeforeInput",
|
|
154
156
|
"onInput"
|
|
155
|
-
])),
|
|
157
|
+
])), {
|
|
158
|
+
resize: {
|
|
159
|
+
type: "choice",
|
|
160
|
+
description: "Controls if and how the element can be resized.",
|
|
161
|
+
options: [
|
|
162
|
+
"both",
|
|
163
|
+
"horizontal",
|
|
164
|
+
"vertical",
|
|
165
|
+
"block",
|
|
166
|
+
"inline",
|
|
167
|
+
"none"
|
|
168
|
+
],
|
|
169
|
+
defaultValueHint: "both"
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
156
172
|
states: {
|
|
157
173
|
value: __spreadValues({
|
|
158
174
|
type: "writable",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerTextArea.esm.js","sources":["../src/registerTextArea.tsx"],"sourcesContent":["import React, { ChangeEvent, ForwardedRef, useEffect } from \"react\";\nimport { mergeProps, useFocusRing, useHover } from \"react-aria\";\nimport {\n TextAreaContext,\n TextAreaProps,\n useContextProps,\n} from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonProps } from \"./common\";\nimport { PlasmicTextFieldContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n filterHoverProps,\n HasControlContextData,\n isDefined,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst TEXTAREA_VARIANTS = [\n \"focused\" as const,\n \"focusVisible\" as const,\n \"hovered\" as const,\n \"disabled\" as const,\n];\n\nconst { variants } = pickAriaComponentVariants(TEXTAREA_VARIANTS);\n\nexport interface BaseTextAreaProps\n extends Omit<TextAreaProps, \"className\">,\n HasControlContextData,\n WithVariants<typeof TEXTAREA_VARIANTS> {\n className?: string;\n}\n\nexport const inputHelpers = {\n states: {\n value: {\n onChangeArgsToValue: (e: ChangeEvent<HTMLInputElement>) => {\n return e.target.value;\n },\n },\n },\n};\n\nfunction BaseTextArea_(\n props: BaseTextAreaProps,\n ref: ForwardedRef<HTMLTextAreaElement>\n) {\n const {\n className,\n plasmicUpdateVariant,\n setControlContextData,\n value,\n ...restProps\n } = props;\n\n const textFieldContext = React.useContext(PlasmicTextFieldContext);\n const [textAreaContextProps, textAreaRef] = useContextProps(\n restProps,\n ref,\n TextAreaContext\n );\n\n const { hoverProps, isHovered } = useHover(textAreaContextProps);\n const { isFocused, isFocusVisible, focusProps } = useFocusRing({\n isTextInput: true,\n autoFocus: textAreaContextProps.autoFocus,\n });\n\n const mergedProps = mergeProps(\n filterHoverProps(textAreaContextProps),\n focusProps,\n hoverProps,\n {\n value: isDefined(textFieldContext) ? undefined : value,\n style: COMMON_STYLES,\n className,\n }\n );\n\n const isDisabled = mergedProps.disabled || false;\n const isInvalid =\n !!mergedProps[\"aria-invalid\"] && mergedProps[\"aria-invalid\"] !== \"false\";\n\n setControlContextData?.({\n parent: textFieldContext,\n });\n\n useEffect(() => {\n if (plasmicUpdateVariant) {\n plasmicUpdateVariant({\n disabled: isDisabled,\n focused: isFocused,\n focusVisible: isFocusVisible,\n hovered: isHovered,\n });\n }\n }, [isFocused, isFocusVisible, isHovered, isDisabled, plasmicUpdateVariant]);\n\n return (\n <textarea\n {...mergedProps}\n ref={textAreaRef}\n data-focused={isFocused || undefined}\n data-disabled={isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-invalid={isInvalid || undefined}\n />\n );\n}\n\nexport const BaseTextArea = React.forwardRef(BaseTextArea_);\n\nexport function registerTextArea(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTextArea>\n) {\n registerComponentHelper(\n loader,\n BaseTextArea,\n {\n name: makeComponentName(\"textarea\"),\n displayName: \"Aria TextArea\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextArea\",\n importName: \"BaseTextArea\",\n variants,\n props: {\n ...getCommonProps<BaseTextAreaProps>(\"Text Area\", [\n \"name\",\n \"disabled\",\n \"readOnly\",\n \"autoFocus\",\n \"aria-label\",\n \"required\",\n \"placeholder\",\n \"value\",\n \"maxLength\",\n \"minLength\",\n \"inputMode\",\n \"onChange\",\n \"onFocus\",\n \"onBlur\",\n \"onKeyDown\",\n \"onKeyUp\",\n \"onCopy\",\n \"onCut\",\n \"onPaste\",\n \"onCompositionStart\",\n \"onCompositionEnd\",\n \"onCompositionUpdate\",\n \"onSelect\",\n \"onBeforeInput\",\n \"onInput\",\n ]),\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n ...inputHelpers.states.value,\n },\n },\n componentHelpers: {\n helpers: inputHelpers,\n importName: \"inputHelpers\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextArea\",\n },\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,iBAAoB,GAAA;AAAA,EACxB,SAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAa,GAAA,yBAAA,CAA0B,iBAAiB,CAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"registerTextArea.esm.js","sources":["../src/registerTextArea.tsx"],"sourcesContent":["import React, { ChangeEvent, ForwardedRef, useEffect } from \"react\";\nimport { mergeProps, useFocusRing, useHover } from \"react-aria\";\nimport {\n TextAreaContext,\n TextAreaProps,\n useContextProps,\n} from \"react-aria-components\";\nimport { COMMON_STYLES, getCommonProps } from \"./common\";\nimport { PlasmicTextFieldContext } from \"./contexts\";\nimport {\n CodeComponentMetaOverrides,\n filterHoverProps,\n HasControlContextData,\n isDefined,\n makeComponentName,\n Registerable,\n registerComponentHelper,\n} from \"./utils\";\nimport { pickAriaComponentVariants, WithVariants } from \"./variant-utils\";\n\nconst TEXTAREA_VARIANTS = [\n \"focused\" as const,\n \"focusVisible\" as const,\n \"hovered\" as const,\n \"disabled\" as const,\n];\n\nconst { variants } = pickAriaComponentVariants(TEXTAREA_VARIANTS);\n\nexport interface BaseTextAreaProps\n extends Omit<TextAreaProps, \"className\">,\n HasControlContextData,\n WithVariants<typeof TEXTAREA_VARIANTS> {\n className?: string;\n resize?: string;\n}\n\nexport const inputHelpers = {\n states: {\n value: {\n onChangeArgsToValue: (e: ChangeEvent<HTMLInputElement>) => {\n return e.target.value;\n },\n },\n },\n};\n\nfunction BaseTextArea_(\n props: BaseTextAreaProps,\n ref: ForwardedRef<HTMLTextAreaElement>\n) {\n const {\n className,\n plasmicUpdateVariant,\n setControlContextData,\n value,\n resize,\n ...restProps\n } = props;\n\n const textFieldContext = React.useContext(PlasmicTextFieldContext);\n const [textAreaContextProps, textAreaRef] = useContextProps(\n restProps,\n ref,\n TextAreaContext\n );\n\n const { hoverProps, isHovered } = useHover(textAreaContextProps);\n const { isFocused, isFocusVisible, focusProps } = useFocusRing({\n isTextInput: true,\n autoFocus: textAreaContextProps.autoFocus,\n });\n\n const mergedProps = mergeProps(\n filterHoverProps(textAreaContextProps),\n focusProps,\n hoverProps,\n {\n value: isDefined(textFieldContext) ? undefined : value,\n style: {\n ...COMMON_STYLES,\n ...(resize ? { resize } : {}),\n },\n className,\n }\n );\n\n const isDisabled = mergedProps.disabled || false;\n const isInvalid =\n !!mergedProps[\"aria-invalid\"] && mergedProps[\"aria-invalid\"] !== \"false\";\n\n setControlContextData?.({\n parent: textFieldContext,\n });\n\n useEffect(() => {\n if (plasmicUpdateVariant) {\n plasmicUpdateVariant({\n disabled: isDisabled,\n focused: isFocused,\n focusVisible: isFocusVisible,\n hovered: isHovered,\n });\n }\n }, [isFocused, isFocusVisible, isHovered, isDisabled, plasmicUpdateVariant]);\n\n return (\n <textarea\n {...mergedProps}\n ref={textAreaRef}\n data-focused={isFocused || undefined}\n data-disabled={isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-invalid={isInvalid || undefined}\n />\n );\n}\n\nexport const BaseTextArea = React.forwardRef(BaseTextArea_);\n\nexport function registerTextArea(\n loader?: Registerable,\n overrides?: CodeComponentMetaOverrides<typeof BaseTextArea>\n) {\n registerComponentHelper(\n loader,\n BaseTextArea,\n {\n name: makeComponentName(\"textarea\"),\n displayName: \"Aria TextArea\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextArea\",\n importName: \"BaseTextArea\",\n variants,\n props: {\n ...getCommonProps<BaseTextAreaProps>(\"Text Area\", [\n \"name\",\n \"disabled\",\n \"readOnly\",\n \"autoFocus\",\n \"aria-label\",\n \"required\",\n \"placeholder\",\n \"value\",\n \"maxLength\",\n \"minLength\",\n \"inputMode\",\n \"onChange\",\n \"onFocus\",\n \"onBlur\",\n \"onKeyDown\",\n \"onKeyUp\",\n \"onCopy\",\n \"onCut\",\n \"onPaste\",\n \"onCompositionStart\",\n \"onCompositionEnd\",\n \"onCompositionUpdate\",\n \"onSelect\",\n \"onBeforeInput\",\n \"onInput\",\n ]),\n resize: {\n type: \"choice\",\n description: \"Controls if and how the element can be resized.\",\n options: [\n \"both\",\n \"horizontal\",\n \"vertical\",\n \"block\",\n \"inline\",\n \"none\",\n ],\n defaultValueHint: \"both\",\n },\n },\n states: {\n value: {\n type: \"writable\",\n valueProp: \"value\",\n onChangeProp: \"onChange\",\n variableType: \"text\",\n ...inputHelpers.states.value,\n },\n },\n componentHelpers: {\n helpers: inputHelpers,\n importName: \"inputHelpers\",\n importPath: \"@plasmicpkgs/react-aria/skinny/registerTextArea\",\n },\n },\n overrides\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,iBAAoB,GAAA;AAAA,EACxB,SAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AACF,CAAA,CAAA;AAEA,MAAM,EAAE,QAAA,EAAa,GAAA,yBAAA,CAA0B,iBAAiB,CAAA,CAAA;AAUzD,MAAM,YAAe,GAAA;AAAA,EAC1B,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA;AAAA,MACL,mBAAA,EAAqB,CAAC,CAAqC,KAAA;AACzD,QAAA,OAAO,EAAE,MAAO,CAAA,KAAA,CAAA;AAAA,OAClB;AAAA,KACF;AAAA,GACF;AACF,EAAA;AAEA,SAAS,aAAA,CACP,OACA,GACA,EAAA;AACA,EAAA,MAOI,EANF,GAAA,KAAA,EAAA;AAAA,IAAA,SAAA;AAAA,IACA,oBAAA;AAAA,IACA,qBAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,GAxDJ,GA0DM,EADC,EAAA,SAAA,GAAA,SAAA,CACD,EADC,EAAA;AAAA,IALH,WAAA;AAAA,IACA,sBAAA;AAAA,IACA,uBAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,GAAA,CAAA,CAAA;AAIF,EAAM,MAAA,gBAAA,GAAmB,KAAM,CAAA,UAAA,CAAW,uBAAuB,CAAA,CAAA;AACjE,EAAM,MAAA,CAAC,oBAAsB,EAAA,WAAW,CAAI,GAAA,eAAA;AAAA,IAC1C,SAAA;AAAA,IACA,GAAA;AAAA,IACA,eAAA;AAAA,GACF,CAAA;AAEA,EAAA,MAAM,EAAE,UAAA,EAAY,SAAU,EAAA,GAAI,SAAS,oBAAoB,CAAA,CAAA;AAC/D,EAAA,MAAM,EAAE,SAAA,EAAW,cAAgB,EAAA,UAA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