@plasmicpkgs/react-aria 0.0.146 → 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.
@@ -4645,13 +4645,15 @@ function BaseTextArea_(props, ref) {
4645
4645
  plasmicUpdateVariant,
4646
4646
  setControlContextData,
4647
4647
  value,
4648
- resize
4648
+ resize,
4649
+ autoResize
4649
4650
  } = _a, restProps = __objRest$2(_a, [
4650
4651
  "className",
4651
4652
  "plasmicUpdateVariant",
4652
4653
  "setControlContextData",
4653
4654
  "value",
4654
- "resize"
4655
+ "resize",
4656
+ "autoResize"
4655
4657
  ]);
4656
4658
  const textFieldContext = React.useContext(PlasmicTextFieldContext);
4657
4659
  const [textAreaContextProps, textAreaRef] = useContextProps(
@@ -4670,7 +4672,7 @@ function BaseTextArea_(props, ref) {
4670
4672
  hoverProps,
4671
4673
  {
4672
4674
  value: isDefined(textFieldContext) ? void 0 : value,
4673
- style: __spreadValues$2(__spreadValues$2({}, COMMON_STYLES), resize ? { resize } : {}),
4675
+ style: __spreadValues$2(__spreadValues$2({}, COMMON_STYLES), autoResize ? { resize: "none" } : resize ? { resize } : {}),
4674
4676
  className
4675
4677
  }
4676
4678
  );
@@ -4679,6 +4681,13 @@ function BaseTextArea_(props, ref) {
4679
4681
  setControlContextData == null ? void 0 : setControlContextData({
4680
4682
  parent: textFieldContext
4681
4683
  });
4684
+ React.useEffect(() => {
4685
+ const el = textAreaRef.current;
4686
+ if (autoResize && el) {
4687
+ el.style.height = "auto";
4688
+ el.style.height = `${el.scrollHeight}px`;
4689
+ }
4690
+ }, [mergedProps.value]);
4682
4691
  useEffect(() => {
4683
4692
  if (plasmicUpdateVariant) {
4684
4693
  plasmicUpdateVariant({
@@ -4739,6 +4748,12 @@ function registerTextArea(loader, overrides) {
4739
4748
  "onBeforeInput",
4740
4749
  "onInput"
4741
4750
  ])), {
4751
+ autoResize: {
4752
+ type: "boolean",
4753
+ displayName: "Auto resize",
4754
+ defaultValueHint: false,
4755
+ description: "Grows or shrinks the element automatically based on text content. Disables manual resizing."
4756
+ },
4742
4757
  resize: {
4743
4758
  type: "choice",
4744
4759
  description: "Controls if and how the element can be resized.",
@@ -4750,7 +4765,9 @@ function registerTextArea(loader, overrides) {
4750
4765
  "inline",
4751
4766
  "none"
4752
4767
  ],
4753
- defaultValueHint: "both"
4768
+ defaultValueHint: "both",
4769
+ hidden: (props) => Boolean(props.autoResize),
4770
+ advanced: true
4754
4771
  }
4755
4772
  }),
4756
4773
  states: {