@plasmicpkgs/react-aria 0.0.145 → 0.0.147

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.
@@ -4652,12 +4652,16 @@ function BaseTextArea_(props, ref) {
4652
4652
  className,
4653
4653
  plasmicUpdateVariant,
4654
4654
  setControlContextData,
4655
- value
4655
+ value,
4656
+ resize,
4657
+ autoResize
4656
4658
  } = _a, restProps = __objRest$2(_a, [
4657
4659
  "className",
4658
4660
  "plasmicUpdateVariant",
4659
4661
  "setControlContextData",
4660
- "value"
4662
+ "value",
4663
+ "resize",
4664
+ "autoResize"
4661
4665
  ]);
4662
4666
  const textFieldContext = React__default.default.useContext(PlasmicTextFieldContext);
4663
4667
  const [textAreaContextProps, textAreaRef] = reactAriaComponents.useContextProps(
@@ -4676,7 +4680,7 @@ function BaseTextArea_(props, ref) {
4676
4680
  hoverProps,
4677
4681
  {
4678
4682
  value: isDefined(textFieldContext) ? void 0 : value,
4679
- style: COMMON_STYLES,
4683
+ style: __spreadValues$2(__spreadValues$2({}, COMMON_STYLES), autoResize ? { resize: "none" } : resize ? { resize } : {}),
4680
4684
  className
4681
4685
  }
4682
4686
  );
@@ -4685,6 +4689,13 @@ function BaseTextArea_(props, ref) {
4685
4689
  setControlContextData == null ? void 0 : setControlContextData({
4686
4690
  parent: textFieldContext
4687
4691
  });
4692
+ React__default.default.useEffect(() => {
4693
+ const el = textAreaRef.current;
4694
+ if (autoResize && el) {
4695
+ el.style.height = "auto";
4696
+ el.style.height = `${el.scrollHeight}px`;
4697
+ }
4698
+ }, [mergedProps.value]);
4688
4699
  React.useEffect(() => {
4689
4700
  if (plasmicUpdateVariant) {
4690
4701
  plasmicUpdateVariant({
@@ -4718,7 +4729,7 @@ function registerTextArea(loader, overrides) {
4718
4729
  importPath: "@plasmicpkgs/react-aria/skinny/registerTextArea",
4719
4730
  importName: "BaseTextArea",
4720
4731
  variants: variants$1,
4721
- props: __spreadValues$2({}, getCommonProps("Text Area", [
4732
+ props: __spreadProps$2(__spreadValues$2({}, getCommonProps("Text Area", [
4722
4733
  "name",
4723
4734
  "disabled",
4724
4735
  "readOnly",
@@ -4744,7 +4755,29 @@ function registerTextArea(loader, overrides) {
4744
4755
  "onSelect",
4745
4756
  "onBeforeInput",
4746
4757
  "onInput"
4747
- ])),
4758
+ ])), {
4759
+ autoResize: {
4760
+ type: "boolean",
4761
+ displayName: "Auto resize",
4762
+ defaultValueHint: false,
4763
+ description: "Grows or shrinks the element automatically based on text content. Disables manual resizing."
4764
+ },
4765
+ resize: {
4766
+ type: "choice",
4767
+ description: "Controls if and how the element can be resized.",
4768
+ options: [
4769
+ "both",
4770
+ "horizontal",
4771
+ "vertical",
4772
+ "block",
4773
+ "inline",
4774
+ "none"
4775
+ ],
4776
+ defaultValueHint: "both",
4777
+ hidden: (props) => Boolean(props.autoResize),
4778
+ advanced: true
4779
+ }
4780
+ }),
4748
4781
  states: {
4749
4782
  value: __spreadValues$2({
4750
4783
  type: "writable",