lizaui 9.0.13 → 9.0.16

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.
Files changed (70) hide show
  1. package/dist/button/index.es.js +1 -1
  2. package/dist/calendar/index.es.js +1 -1
  3. package/dist/checkbox/index.es.js +1 -1
  4. package/dist/chunks/{button-CA3Y2GZ1.js → button-B0fpJrMg.js} +2 -2
  5. package/dist/chunks/{button-CA3Y2GZ1.js.map → button-B0fpJrMg.js.map} +1 -1
  6. package/dist/chunks/{checkbox-qzZKMLRN.js → checkbox-C1Sssumg.js} +2 -2
  7. package/dist/chunks/{checkbox-qzZKMLRN.js.map → checkbox-C1Sssumg.js.map} +1 -1
  8. package/dist/chunks/{floating-ui.dom-N5ROFCJy.js → floating-ui.dom-B9hvXzxg.js} +11 -1
  9. package/dist/chunks/{floating-ui.dom-N5ROFCJy.js.map → floating-ui.dom-B9hvXzxg.js.map} +1 -1
  10. package/dist/chunks/{floating-ui.dom-NqZWWqNg.js → floating-ui.dom-DRSBqyFN.js} +14 -4
  11. package/dist/chunks/{floating-ui.dom-NqZWWqNg.js.map → floating-ui.dom-DRSBqyFN.js.map} +1 -1
  12. package/dist/chunks/floating-ui.react-dom-BUZLdP4-.js +294 -0
  13. package/dist/chunks/floating-ui.react-dom-BUZLdP4-.js.map +1 -0
  14. package/dist/chunks/floating-ui.react-dom-CI1b2uK3.js +310 -0
  15. package/dist/chunks/floating-ui.react-dom-CI1b2uK3.js.map +1 -0
  16. package/dist/chunks/{index-DiC9dI6_.js → index-B4RTH1-D.js} +4 -4
  17. package/dist/chunks/{index-DiC9dI6_.js.map → index-B4RTH1-D.js.map} +1 -1
  18. package/dist/chunks/{scroll-area-CgJodNZ_.js → scroll-area-B-5YmafW.js} +27 -27
  19. package/dist/chunks/{scroll-area-CgJodNZ_.js.map → scroll-area-B-5YmafW.js.map} +1 -1
  20. package/dist/chunks/{scroll-area-BcM0NCEM.js → scroll-area-WNAy-5-i.js} +3 -3
  21. package/dist/chunks/{scroll-area-BcM0NCEM.js.map → scroll-area-WNAy-5-i.js.map} +1 -1
  22. package/dist/chunks/{select-DyihZY-4.js → select-C9BYUpJm.js} +439 -83
  23. package/dist/chunks/select-C9BYUpJm.js.map +1 -0
  24. package/dist/chunks/{select-DaKy-WhC.js → select-CLIZOVIj.js} +366 -10
  25. package/dist/chunks/select-CLIZOVIj.js.map +1 -0
  26. package/dist/chunks/{textarea-By2Vv44z.js → textarea-D2_KC-J4.js} +587 -36
  27. package/dist/chunks/textarea-D2_KC-J4.js.map +1 -0
  28. package/dist/chunks/{textarea-ClJsk9Gp.js → textarea-_HQpXiCX.js} +586 -35
  29. package/dist/chunks/textarea-_HQpXiCX.js.map +1 -0
  30. package/dist/chunks/tooltip-DgenLCkC.js +1921 -0
  31. package/dist/chunks/tooltip-DgenLCkC.js.map +1 -0
  32. package/dist/chunks/tooltip-nCIpADfj.js +1937 -0
  33. package/dist/chunks/tooltip-nCIpADfj.js.map +1 -0
  34. package/dist/components/tooltip/tooltip.d.ts +1 -1
  35. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  36. package/dist/divider/index.es.js +1 -1
  37. package/dist/modal/index.es.js +1 -1
  38. package/dist/pagination/index.cjs.js +2 -2
  39. package/dist/pagination/index.es.js +3 -3
  40. package/dist/phone-input/index.cjs.js +2 -2
  41. package/dist/phone-input/index.es.js +3 -3
  42. package/dist/select-input/index.cjs.js +1 -1
  43. package/dist/select-input/index.es.js +2 -2
  44. package/dist/table/index.cjs.js +1 -1
  45. package/dist/table/index.es.js +2 -2
  46. package/dist/time-input/index.cjs.js +1 -1
  47. package/dist/time-input/index.es.js +2 -2
  48. package/dist/tooltip/index.cjs.js +1 -1
  49. package/dist/tooltip/index.es.js +1 -1
  50. package/dist/ui/index.cjs.js +290 -292
  51. package/dist/ui/index.cjs.js.map +1 -1
  52. package/dist/ui/index.es.js +180 -182
  53. package/dist/ui/index.es.js.map +1 -1
  54. package/package.json +2 -2
  55. package/dist/chunks/index-CuySPbdY.js +0 -559
  56. package/dist/chunks/index-CuySPbdY.js.map +0 -1
  57. package/dist/chunks/index-DBDBh58Q.js +0 -575
  58. package/dist/chunks/index-DBDBh58Q.js.map +0 -1
  59. package/dist/chunks/index-DNSql2gU.js +0 -662
  60. package/dist/chunks/index-DNSql2gU.js.map +0 -1
  61. package/dist/chunks/index-DlZi5TkN.js +0 -646
  62. package/dist/chunks/index-DlZi5TkN.js.map +0 -1
  63. package/dist/chunks/select-DaKy-WhC.js.map +0 -1
  64. package/dist/chunks/select-DyihZY-4.js.map +0 -1
  65. package/dist/chunks/textarea-By2Vv44z.js.map +0 -1
  66. package/dist/chunks/textarea-ClJsk9Gp.js.map +0 -1
  67. package/dist/chunks/tooltip-D4UvkD2G.js +0 -525
  68. package/dist/chunks/tooltip-D4UvkD2G.js.map +0 -1
  69. package/dist/chunks/tooltip-WGeoFpGx.js +0 -541
  70. package/dist/chunks/tooltip-WGeoFpGx.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import { useId as useId$1, useState, useEffect, createContext, forwardRef, createElement, useContext, useRef, useLayoutEffect, useImperativeHandle, useCallback, useMemo } from "react";
3
+ import { useId as useId$2, useState, useEffect, createContext, forwardRef, createElement, useContext, useRef, useLayoutEffect, useImperativeHandle, useCallback, useMemo } from "react";
4
4
  import { c as colorVariants } from "./variants-CrIs_I54.js";
5
5
  import { t as tv } from "./tv-B0li4IsO.js";
6
6
  import { c as cva } from "./index-CEKmKomA.js";
@@ -11,9 +11,10 @@ import { v as validatePatternInput } from "./pattern-CWRl6jXR.js";
11
11
  import "./assertion-LpGn6Vzq.js";
12
12
  import { L as LabelError } from "./label-error-BTCuInp7.js";
13
13
  import { motion, AnimatePresence } from "framer-motion";
14
- import { f as useCallbackRef$1, P as Primitive, c as createContextScope, d as Presence, b as composeEventHandlers, e as Portal$1, D as DismissableLayer, h as createContext2, a as useControllableState, u as useId$2 } from "./index-CuySPbdY.js";
15
- import { u as useComposedRefs, a as createSlot } from "./index-DiC9dI6_.js";
16
- import { B as Button } from "./button-CA3Y2GZ1.js";
14
+ import { c as createSlot, u as useComposedRefs } from "./index-B4RTH1-D.js";
15
+ import * as ReactDOM from "react-dom";
16
+ import ReactDOM__default from "react-dom";
17
+ import { B as Button } from "./button-B0fpJrMg.js";
17
18
  const badge = tv({
18
19
  slots: {
19
20
  base: ["relative", "inline-flex", "shrink-0"],
@@ -530,6 +531,41 @@ const Input = React.forwardRef((props2, ref) => {
530
531
  ] });
531
532
  });
532
533
  Input.displayName = "Input";
534
+ var NODES = [
535
+ "a",
536
+ "button",
537
+ "div",
538
+ "form",
539
+ "h2",
540
+ "h3",
541
+ "img",
542
+ "input",
543
+ "label",
544
+ "li",
545
+ "nav",
546
+ "ol",
547
+ "p",
548
+ "select",
549
+ "span",
550
+ "svg",
551
+ "ul"
552
+ ];
553
+ var Primitive = NODES.reduce((primitive, node) => {
554
+ const Slot2 = createSlot(`Primitive.${node}`);
555
+ const Node2 = React.forwardRef((props2, forwardedRef) => {
556
+ const { asChild, ...primitiveProps } = props2;
557
+ const Comp = asChild ? Slot2 : node;
558
+ if (typeof window !== "undefined") {
559
+ window[Symbol.for("radix-ui")] = true;
560
+ }
561
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
562
+ });
563
+ Node2.displayName = `Primitive.${node}`;
564
+ return { ...primitive, [node]: Node2 };
565
+ }, {});
566
+ function dispatchDiscreteCustomEvent(target, event) {
567
+ if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
568
+ }
533
569
  const SwitchClassProps = cva(["flex items-center cursor-pointer relative rounded-full p-0.5 px-1 relative overflow-hidden"], {
534
570
  variants: {
535
571
  color: {
@@ -570,7 +606,7 @@ const Switch = ({
570
606
  onChange,
571
607
  ...props2
572
608
  }) => {
573
- const switchId = useId$1();
609
+ const switchId = useId$2();
574
610
  const resolvedId = id || switchId;
575
611
  const [valueCheck, setValueCheck] = useState(false);
576
612
  useEffect(() => {
@@ -669,18 +705,382 @@ const Switch = ({
669
705
  ] });
670
706
  };
671
707
  Switch.displayName = "Switch";
672
- var count = 0;
708
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
709
+ return function handleEvent(event) {
710
+ originalEventHandler?.(event);
711
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
712
+ return ourEventHandler?.(event);
713
+ }
714
+ };
715
+ }
716
+ function createContext2(rootComponentName, defaultContext) {
717
+ const Context = React.createContext(defaultContext);
718
+ const Provider = (props2) => {
719
+ const { children, ...context } = props2;
720
+ const value = React.useMemo(() => context, Object.values(context));
721
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
722
+ };
723
+ Provider.displayName = rootComponentName + "Provider";
724
+ function useContext2(consumerName) {
725
+ const context = React.useContext(Context);
726
+ if (context) return context;
727
+ if (defaultContext !== void 0) return defaultContext;
728
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
729
+ }
730
+ return [Provider, useContext2];
731
+ }
732
+ function createContextScope(scopeName, createContextScopeDeps = []) {
733
+ let defaultContexts = [];
734
+ function createContext3(rootComponentName, defaultContext) {
735
+ const BaseContext = React.createContext(defaultContext);
736
+ const index = defaultContexts.length;
737
+ defaultContexts = [...defaultContexts, defaultContext];
738
+ const Provider = (props2) => {
739
+ const { scope, children, ...context } = props2;
740
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
741
+ const value = React.useMemo(() => context, Object.values(context));
742
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
743
+ };
744
+ Provider.displayName = rootComponentName + "Provider";
745
+ function useContext2(consumerName, scope) {
746
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
747
+ const context = React.useContext(Context);
748
+ if (context) return context;
749
+ if (defaultContext !== void 0) return defaultContext;
750
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
751
+ }
752
+ return [Provider, useContext2];
753
+ }
754
+ const createScope = () => {
755
+ const scopeContexts = defaultContexts.map((defaultContext) => {
756
+ return React.createContext(defaultContext);
757
+ });
758
+ return function useScope(scope) {
759
+ const contexts = scope?.[scopeName] || scopeContexts;
760
+ return React.useMemo(
761
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
762
+ [scope, contexts]
763
+ );
764
+ };
765
+ };
766
+ createScope.scopeName = scopeName;
767
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
768
+ }
769
+ function composeContextScopes(...scopes) {
770
+ const baseScope = scopes[0];
771
+ if (scopes.length === 1) return baseScope;
772
+ const createScope = () => {
773
+ const scopeHooks = scopes.map((createScope2) => ({
774
+ useScope: createScope2(),
775
+ scopeName: createScope2.scopeName
776
+ }));
777
+ return function useComposedScopes(overrideScopes) {
778
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
779
+ const scopeProps = useScope(overrideScopes);
780
+ const currentScope = scopeProps[`__scope${scopeName}`];
781
+ return { ...nextScopes2, ...currentScope };
782
+ }, {});
783
+ return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
784
+ };
785
+ };
786
+ createScope.scopeName = baseScope.scopeName;
787
+ return createScope;
788
+ }
789
+ var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
790
+ };
791
+ var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
792
+ function useControllableState({
793
+ prop,
794
+ defaultProp,
795
+ onChange = () => {
796
+ },
797
+ caller
798
+ }) {
799
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
800
+ defaultProp,
801
+ onChange
802
+ });
803
+ const isControlled = prop !== void 0;
804
+ const value = isControlled ? prop : uncontrolledProp;
805
+ {
806
+ const isControlledRef = React.useRef(prop !== void 0);
807
+ React.useEffect(() => {
808
+ const wasControlled = isControlledRef.current;
809
+ if (wasControlled !== isControlled) {
810
+ const from = wasControlled ? "controlled" : "uncontrolled";
811
+ const to = isControlled ? "controlled" : "uncontrolled";
812
+ }
813
+ isControlledRef.current = isControlled;
814
+ }, [isControlled, caller]);
815
+ }
816
+ const setValue = React.useCallback(
817
+ (nextValue) => {
818
+ if (isControlled) {
819
+ const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
820
+ if (value2 !== prop) {
821
+ onChangeRef.current?.(value2);
822
+ }
823
+ } else {
824
+ setUncontrolledProp(nextValue);
825
+ }
826
+ },
827
+ [isControlled, prop, setUncontrolledProp, onChangeRef]
828
+ );
829
+ return [value, setValue];
830
+ }
831
+ function useUncontrolledState({
832
+ defaultProp,
833
+ onChange
834
+ }) {
835
+ const [value, setValue] = React.useState(defaultProp);
836
+ const prevValueRef = React.useRef(value);
837
+ const onChangeRef = React.useRef(onChange);
838
+ useInsertionEffect(() => {
839
+ onChangeRef.current = onChange;
840
+ }, [onChange]);
841
+ React.useEffect(() => {
842
+ if (prevValueRef.current !== value) {
843
+ onChangeRef.current?.(value);
844
+ prevValueRef.current = value;
845
+ }
846
+ }, [value, prevValueRef]);
847
+ return [value, setValue, onChangeRef];
848
+ }
849
+ function isFunction(value) {
850
+ return typeof value === "function";
851
+ }
852
+ function useCallbackRef$1(callback) {
853
+ const callbackRef = React.useRef(callback);
854
+ React.useEffect(() => {
855
+ callbackRef.current = callback;
856
+ });
857
+ return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
858
+ }
859
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
860
+ const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
861
+ React.useEffect(() => {
862
+ const handleKeyDown = (event) => {
863
+ if (event.key === "Escape") {
864
+ onEscapeKeyDown(event);
865
+ }
866
+ };
867
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
868
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
869
+ }, [onEscapeKeyDown, ownerDocument]);
870
+ }
871
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
872
+ var CONTEXT_UPDATE = "dismissableLayer.update";
873
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
874
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
875
+ var originalBodyPointerEvents;
876
+ var DismissableLayerContext = React.createContext({
877
+ layers: /* @__PURE__ */ new Set(),
878
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
879
+ branches: /* @__PURE__ */ new Set()
880
+ });
881
+ var DismissableLayer = React.forwardRef(
882
+ (props2, forwardedRef) => {
883
+ const {
884
+ disableOutsidePointerEvents = false,
885
+ onEscapeKeyDown,
886
+ onPointerDownOutside,
887
+ onFocusOutside,
888
+ onInteractOutside,
889
+ onDismiss,
890
+ ...layerProps
891
+ } = props2;
892
+ const context = React.useContext(DismissableLayerContext);
893
+ const [node, setNode] = React.useState(null);
894
+ const ownerDocument = node?.ownerDocument ?? globalThis?.document;
895
+ const [, force] = React.useState({});
896
+ const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
897
+ const layers = Array.from(context.layers);
898
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
899
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
900
+ const index = node ? layers.indexOf(node) : -1;
901
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
902
+ const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
903
+ const pointerDownOutside = usePointerDownOutside((event) => {
904
+ const target = event.target;
905
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
906
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
907
+ onPointerDownOutside?.(event);
908
+ onInteractOutside?.(event);
909
+ if (!event.defaultPrevented) onDismiss?.();
910
+ }, ownerDocument);
911
+ const focusOutside = useFocusOutside((event) => {
912
+ const target = event.target;
913
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
914
+ if (isFocusInBranch) return;
915
+ onFocusOutside?.(event);
916
+ onInteractOutside?.(event);
917
+ if (!event.defaultPrevented) onDismiss?.();
918
+ }, ownerDocument);
919
+ useEscapeKeydown((event) => {
920
+ const isHighestLayer = index === context.layers.size - 1;
921
+ if (!isHighestLayer) return;
922
+ onEscapeKeyDown?.(event);
923
+ if (!event.defaultPrevented && onDismiss) {
924
+ event.preventDefault();
925
+ onDismiss();
926
+ }
927
+ }, ownerDocument);
928
+ React.useEffect(() => {
929
+ if (!node) return;
930
+ if (disableOutsidePointerEvents) {
931
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
932
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
933
+ ownerDocument.body.style.pointerEvents = "none";
934
+ }
935
+ context.layersWithOutsidePointerEventsDisabled.add(node);
936
+ }
937
+ context.layers.add(node);
938
+ dispatchUpdate();
939
+ return () => {
940
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
941
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
942
+ }
943
+ };
944
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
945
+ React.useEffect(() => {
946
+ return () => {
947
+ if (!node) return;
948
+ context.layers.delete(node);
949
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
950
+ dispatchUpdate();
951
+ };
952
+ }, [node, context]);
953
+ React.useEffect(() => {
954
+ const handleUpdate = () => force({});
955
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
956
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
957
+ }, []);
958
+ return /* @__PURE__ */ jsx(
959
+ Primitive.div,
960
+ {
961
+ ...layerProps,
962
+ ref: composedRefs,
963
+ style: {
964
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
965
+ ...props2.style
966
+ },
967
+ onFocusCapture: composeEventHandlers(props2.onFocusCapture, focusOutside.onFocusCapture),
968
+ onBlurCapture: composeEventHandlers(props2.onBlurCapture, focusOutside.onBlurCapture),
969
+ onPointerDownCapture: composeEventHandlers(
970
+ props2.onPointerDownCapture,
971
+ pointerDownOutside.onPointerDownCapture
972
+ )
973
+ }
974
+ );
975
+ }
976
+ );
977
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
978
+ var BRANCH_NAME = "DismissableLayerBranch";
979
+ var DismissableLayerBranch = React.forwardRef((props2, forwardedRef) => {
980
+ const context = React.useContext(DismissableLayerContext);
981
+ const ref = React.useRef(null);
982
+ const composedRefs = useComposedRefs(forwardedRef, ref);
983
+ React.useEffect(() => {
984
+ const node = ref.current;
985
+ if (node) {
986
+ context.branches.add(node);
987
+ return () => {
988
+ context.branches.delete(node);
989
+ };
990
+ }
991
+ }, [context.branches]);
992
+ return /* @__PURE__ */ jsx(Primitive.div, { ...props2, ref: composedRefs });
993
+ });
994
+ DismissableLayerBranch.displayName = BRANCH_NAME;
995
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
996
+ const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
997
+ const isPointerInsideReactTreeRef = React.useRef(false);
998
+ const handleClickRef = React.useRef(() => {
999
+ });
1000
+ React.useEffect(() => {
1001
+ const handlePointerDown2 = (event) => {
1002
+ if (event.target && !isPointerInsideReactTreeRef.current) {
1003
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
1004
+ handleAndDispatchCustomEvent(
1005
+ POINTER_DOWN_OUTSIDE,
1006
+ handlePointerDownOutside,
1007
+ eventDetail,
1008
+ { discrete: true }
1009
+ );
1010
+ };
1011
+ const eventDetail = { originalEvent: event };
1012
+ if (event.pointerType === "touch") {
1013
+ ownerDocument.removeEventListener("click", handleClickRef.current);
1014
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
1015
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
1016
+ } else {
1017
+ handleAndDispatchPointerDownOutsideEvent2();
1018
+ }
1019
+ } else {
1020
+ ownerDocument.removeEventListener("click", handleClickRef.current);
1021
+ }
1022
+ isPointerInsideReactTreeRef.current = false;
1023
+ };
1024
+ const timerId = window.setTimeout(() => {
1025
+ ownerDocument.addEventListener("pointerdown", handlePointerDown2);
1026
+ }, 0);
1027
+ return () => {
1028
+ window.clearTimeout(timerId);
1029
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown2);
1030
+ ownerDocument.removeEventListener("click", handleClickRef.current);
1031
+ };
1032
+ }, [ownerDocument, handlePointerDownOutside]);
1033
+ return {
1034
+ // ensures we check React component tree (not just DOM tree)
1035
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
1036
+ };
1037
+ }
1038
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
1039
+ const handleFocusOutside = useCallbackRef$1(onFocusOutside);
1040
+ const isFocusInsideReactTreeRef = React.useRef(false);
1041
+ React.useEffect(() => {
1042
+ const handleFocus = (event) => {
1043
+ if (event.target && !isFocusInsideReactTreeRef.current) {
1044
+ const eventDetail = { originalEvent: event };
1045
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
1046
+ discrete: false
1047
+ });
1048
+ }
1049
+ };
1050
+ ownerDocument.addEventListener("focusin", handleFocus);
1051
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
1052
+ }, [ownerDocument, handleFocusOutside]);
1053
+ return {
1054
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
1055
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
1056
+ };
1057
+ }
1058
+ function dispatchUpdate() {
1059
+ const event = new CustomEvent(CONTEXT_UPDATE);
1060
+ document.dispatchEvent(event);
1061
+ }
1062
+ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
1063
+ const target = detail.originalEvent.target;
1064
+ const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
1065
+ if (handler) target.addEventListener(name, handler, { once: true });
1066
+ if (discrete) {
1067
+ dispatchDiscreteCustomEvent(target, event);
1068
+ } else {
1069
+ target.dispatchEvent(event);
1070
+ }
1071
+ }
1072
+ var count$1 = 0;
673
1073
  function useFocusGuards() {
674
1074
  React.useEffect(() => {
675
1075
  const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
676
1076
  document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
677
1077
  document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
678
- count++;
1078
+ count$1++;
679
1079
  return () => {
680
- if (count === 1) {
1080
+ if (count$1 === 1) {
681
1081
  document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
682
1082
  }
683
- count--;
1083
+ count$1--;
684
1084
  };
685
1085
  }, []);
686
1086
  }
@@ -893,6 +1293,146 @@ function arrayRemove(array, item) {
893
1293
  function removeLinks(items) {
894
1294
  return items.filter((item) => item.tagName !== "A");
895
1295
  }
1296
+ var useReactId = React[" useId ".trim().toString()] || (() => void 0);
1297
+ var count = 0;
1298
+ function useId$1(deterministicId) {
1299
+ const [id, setId] = React.useState(useReactId());
1300
+ useLayoutEffect2(() => {
1301
+ setId((reactId) => reactId ?? String(count++));
1302
+ }, [deterministicId]);
1303
+ return deterministicId || (id ? `radix-${id}` : "");
1304
+ }
1305
+ var PORTAL_NAME$1 = "Portal";
1306
+ var Portal$1 = React.forwardRef((props2, forwardedRef) => {
1307
+ const { container: containerProp, ...portalProps } = props2;
1308
+ const [mounted, setMounted] = React.useState(false);
1309
+ useLayoutEffect2(() => setMounted(true), []);
1310
+ const container = containerProp || mounted && globalThis?.document?.body;
1311
+ return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
1312
+ });
1313
+ Portal$1.displayName = PORTAL_NAME$1;
1314
+ function useStateMachine(initialState, machine) {
1315
+ return React.useReducer((state, event) => {
1316
+ const nextState = machine[state][event];
1317
+ return nextState ?? state;
1318
+ }, initialState);
1319
+ }
1320
+ var Presence = (props2) => {
1321
+ const { present, children } = props2;
1322
+ const presence = usePresence(present);
1323
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
1324
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
1325
+ const forceMount = typeof children === "function";
1326
+ return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
1327
+ };
1328
+ Presence.displayName = "Presence";
1329
+ function usePresence(present) {
1330
+ const [node, setNode] = React.useState();
1331
+ const stylesRef = React.useRef(null);
1332
+ const prevPresentRef = React.useRef(present);
1333
+ const prevAnimationNameRef = React.useRef("none");
1334
+ const initialState = present ? "mounted" : "unmounted";
1335
+ const [state, send] = useStateMachine(initialState, {
1336
+ mounted: {
1337
+ UNMOUNT: "unmounted",
1338
+ ANIMATION_OUT: "unmountSuspended"
1339
+ },
1340
+ unmountSuspended: {
1341
+ MOUNT: "mounted",
1342
+ ANIMATION_END: "unmounted"
1343
+ },
1344
+ unmounted: {
1345
+ MOUNT: "mounted"
1346
+ }
1347
+ });
1348
+ React.useEffect(() => {
1349
+ const currentAnimationName = getAnimationName(stylesRef.current);
1350
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
1351
+ }, [state]);
1352
+ useLayoutEffect2(() => {
1353
+ const styles = stylesRef.current;
1354
+ const wasPresent = prevPresentRef.current;
1355
+ const hasPresentChanged = wasPresent !== present;
1356
+ if (hasPresentChanged) {
1357
+ const prevAnimationName = prevAnimationNameRef.current;
1358
+ const currentAnimationName = getAnimationName(styles);
1359
+ if (present) {
1360
+ send("MOUNT");
1361
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
1362
+ send("UNMOUNT");
1363
+ } else {
1364
+ const isAnimating = prevAnimationName !== currentAnimationName;
1365
+ if (wasPresent && isAnimating) {
1366
+ send("ANIMATION_OUT");
1367
+ } else {
1368
+ send("UNMOUNT");
1369
+ }
1370
+ }
1371
+ prevPresentRef.current = present;
1372
+ }
1373
+ }, [present, send]);
1374
+ useLayoutEffect2(() => {
1375
+ if (node) {
1376
+ let timeoutId;
1377
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
1378
+ const handleAnimationEnd = (event) => {
1379
+ const currentAnimationName = getAnimationName(stylesRef.current);
1380
+ const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
1381
+ if (event.target === node && isCurrentAnimation) {
1382
+ send("ANIMATION_END");
1383
+ if (!prevPresentRef.current) {
1384
+ const currentFillMode = node.style.animationFillMode;
1385
+ node.style.animationFillMode = "forwards";
1386
+ timeoutId = ownerWindow.setTimeout(() => {
1387
+ if (node.style.animationFillMode === "forwards") {
1388
+ node.style.animationFillMode = currentFillMode;
1389
+ }
1390
+ });
1391
+ }
1392
+ }
1393
+ };
1394
+ const handleAnimationStart = (event) => {
1395
+ if (event.target === node) {
1396
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
1397
+ }
1398
+ };
1399
+ node.addEventListener("animationstart", handleAnimationStart);
1400
+ node.addEventListener("animationcancel", handleAnimationEnd);
1401
+ node.addEventListener("animationend", handleAnimationEnd);
1402
+ return () => {
1403
+ ownerWindow.clearTimeout(timeoutId);
1404
+ node.removeEventListener("animationstart", handleAnimationStart);
1405
+ node.removeEventListener("animationcancel", handleAnimationEnd);
1406
+ node.removeEventListener("animationend", handleAnimationEnd);
1407
+ };
1408
+ } else {
1409
+ send("ANIMATION_END");
1410
+ }
1411
+ }, [node, send]);
1412
+ return {
1413
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
1414
+ ref: React.useCallback((node2) => {
1415
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
1416
+ setNode(node2);
1417
+ }, [])
1418
+ };
1419
+ }
1420
+ function getAnimationName(styles) {
1421
+ return styles?.animationName || "none";
1422
+ }
1423
+ function getElementRef(element) {
1424
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
1425
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1426
+ if (mayWarn) {
1427
+ return element.ref;
1428
+ }
1429
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
1430
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
1431
+ if (mayWarn) {
1432
+ return element.props.ref;
1433
+ }
1434
+ return element.props.ref || element.ref;
1435
+ }
896
1436
  var getDefaultParent = function(originalTarget) {
897
1437
  if (typeof document === "undefined") {
898
1438
  return null;
@@ -3795,9 +4335,9 @@ var Dialog$1 = (props2) => {
3795
4335
  scope: __scopeDialog,
3796
4336
  triggerRef,
3797
4337
  contentRef,
3798
- contentId: useId$2(),
3799
- titleId: useId$2(),
3800
- descriptionId: useId$2(),
4338
+ contentId: useId$1(),
4339
+ titleId: useId$1(),
4340
+ descriptionId: useId$1(),
3801
4341
  open,
3802
4342
  onOpenChange: setOpen,
3803
4343
  onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
@@ -4443,38 +4983,49 @@ const Textarea = React.forwardRef(
4443
4983
  );
4444
4984
  Textarea.displayName = "Textarea";
4445
4985
  export {
4986
+ DialogClose as A,
4446
4987
  Badge as B,
4447
4988
  Content as C,
4448
- Dialog as D,
4989
+ DismissableLayer as D,
4990
+ DialogFooter as E,
4449
4991
  FocusScope as F,
4992
+ DialogOverlay as G,
4993
+ DialogPortal as H,
4450
4994
  Input as I,
4995
+ DialogTrigger as J,
4996
+ Textarea as K,
4451
4997
  Lt as L,
4452
4998
  Overlay as O,
4453
- PanelGroup as P,
4999
+ Primitive as P,
4454
5000
  ReactRemoveScroll as R,
4455
5001
  Switch as S,
4456
5002
  Trigger as T,
4457
5003
  WarningProvider as W,
4458
- Panel as a,
4459
- PanelResizeHandle as b,
4460
- Root as c,
4461
- Portal as d,
4462
- DialogHeader as e,
4463
- DialogTitle as f,
4464
- DialogDescription as g,
5004
+ Presence as a,
5005
+ composeEventHandlers as b,
5006
+ createContextScope as c,
5007
+ useLayoutEffect2 as d,
5008
+ useControllableState as e,
5009
+ useId$1 as f,
5010
+ Portal$1 as g,
4465
5011
  hideOthers as h,
4466
- DialogContent as i,
4467
- jt as j,
4468
- Close as k,
4469
- Title as l,
4470
- Description as m,
4471
- createDialogScope as n,
4472
- DialogClose as o,
4473
- DialogFooter as p,
4474
- DialogOverlay as q,
4475
- DialogPortal as r,
4476
- DialogTrigger as s,
4477
- Textarea as t,
4478
- useFocusGuards as u
5012
+ useFocusGuards as i,
5013
+ dispatchDiscreteCustomEvent as j,
5014
+ PanelGroup as k,
5015
+ Panel as l,
5016
+ PanelResizeHandle as m,
5017
+ Root as n,
5018
+ Portal as o,
5019
+ Dialog as p,
5020
+ DialogHeader as q,
5021
+ DialogTitle as r,
5022
+ DialogDescription as s,
5023
+ DialogContent as t,
5024
+ useCallbackRef$1 as u,
5025
+ jt as v,
5026
+ Close as w,
5027
+ Title as x,
5028
+ Description as y,
5029
+ createDialogScope as z
4479
5030
  };
4480
- //# sourceMappingURL=textarea-ClJsk9Gp.js.map
5031
+ //# sourceMappingURL=textarea-_HQpXiCX.js.map