@doist/reactist 28.1.1 → 28.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.
@@ -1479,18 +1479,26 @@ const InternalToast = /*#__PURE__*/React__default["default"].forwardRef(function
1479
1479
  */
1480
1480
 
1481
1481
  const actionWithCustomActionHandler = React__default["default"].useMemo(() => {
1482
+ var _action$closeToast;
1483
+
1482
1484
  if (!isActionObject(action)) {
1483
1485
  return action;
1484
1486
  }
1485
1487
 
1486
1488
  return _objectSpread2(_objectSpread2({}, action), {}, {
1489
+ closeToast: (_action$closeToast = action.closeToast) != null ? _action$closeToast : true,
1487
1490
  onClick: function handleActionClick() {
1491
+ var _action$closeToast2;
1492
+
1488
1493
  if (!action) {
1489
1494
  return;
1490
1495
  }
1491
1496
 
1492
1497
  action.onClick();
1493
- removeToast();
1498
+
1499
+ if ((_action$closeToast2 = action.closeToast) != null ? _action$closeToast2 : true) {
1500
+ removeToast();
1501
+ }
1494
1502
  }
1495
1503
  });
1496
1504
  }, [action, removeToast]);
@@ -2355,31 +2363,13 @@ const TextArea = /*#__PURE__*/React__namespace.forwardRef(function TextArea(_ref
2355
2363
  const containerRef = React__namespace.useRef(null);
2356
2364
  const internalRef = React__namespace.useRef(null);
2357
2365
  const combinedRef = useCallbackRef.useMergeRefs([ref, internalRef]);
2366
+ useAutoExpand({
2367
+ value,
2368
+ autoExpand,
2369
+ containerRef,
2370
+ internalRef
2371
+ });
2358
2372
  const textAreaClassName = classNames__default["default"]([autoExpand ? modules_2728c236.disableResize : null, disableResize ? modules_2728c236.disableResize : null]);
2359
- React__namespace.useEffect(function setupAutoExpand() {
2360
- const containerElement = containerRef.current;
2361
-
2362
- function handleAutoExpand(value) {
2363
- if (containerElement) {
2364
- containerElement.dataset.replicatedValue = value;
2365
- }
2366
- }
2367
-
2368
- function handleInput(event) {
2369
- handleAutoExpand(event.currentTarget.value);
2370
- }
2371
-
2372
- const textAreaElement = internalRef.current;
2373
-
2374
- if (!textAreaElement || !autoExpand) {
2375
- return undefined;
2376
- } // Apply change initially, in case the text area has a non-empty initial value
2377
-
2378
-
2379
- handleAutoExpand(textAreaElement.value);
2380
- textAreaElement.addEventListener('input', handleInput);
2381
- return () => textAreaElement.removeEventListener('input', handleInput);
2382
- }, [autoExpand]);
2383
2373
  return /*#__PURE__*/React__namespace.createElement(BaseField, {
2384
2374
  variant: variant,
2385
2375
  id: id,
@@ -2417,6 +2407,50 @@ const TextArea = /*#__PURE__*/React__namespace.forwardRef(function TextArea(_ref
2417
2407
  });
2418
2408
  });
2419
2409
 
2410
+ function useAutoExpand({
2411
+ value,
2412
+ autoExpand,
2413
+ containerRef,
2414
+ internalRef
2415
+ }) {
2416
+ const isControlled = value !== undefined;
2417
+ React__namespace.useEffect(function setupAutoExpandWhenUncontrolled() {
2418
+ const textAreaElement = internalRef.current;
2419
+
2420
+ if (!textAreaElement || !autoExpand || isControlled) {
2421
+ return undefined;
2422
+ }
2423
+
2424
+ const containerElement = containerRef.current;
2425
+
2426
+ function handleAutoExpand(value) {
2427
+ if (containerElement) {
2428
+ containerElement.dataset.replicatedValue = value;
2429
+ }
2430
+ }
2431
+
2432
+ function handleInput(event) {
2433
+ handleAutoExpand(event.currentTarget.value);
2434
+ } // Apply change initially, in case the text area has a non-empty initial value
2435
+
2436
+
2437
+ handleAutoExpand(textAreaElement.value);
2438
+ textAreaElement.addEventListener('input', handleInput);
2439
+ return () => textAreaElement.removeEventListener('input', handleInput);
2440
+ }, [autoExpand, containerRef, internalRef, isControlled]);
2441
+ React__namespace.useEffect(function setupAutoExpandWhenControlled() {
2442
+ if (!isControlled) {
2443
+ return;
2444
+ }
2445
+
2446
+ const containerElement = containerRef.current;
2447
+
2448
+ if (containerElement) {
2449
+ containerElement.dataset.replicatedValue = value;
2450
+ }
2451
+ }, [value, containerRef, isControlled]);
2452
+ }
2453
+
2420
2454
  function getInitials(name) {
2421
2455
  var _initials;
2422
2456