@lynx-js/lynx-ui-dialog 3.133.1 → 3.135.3
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/CHANGELOG.md +24 -0
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.jsx +4 -4
- package/dist/Dialog.jsx.map +1 -1
- package/package.json +5 -5
- package/src/Dialog.tsx +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @lynx-js/lynx-ui-dialog
|
|
2
2
|
|
|
3
|
+
## 3.135.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`44c1de6`](https://github.com/lynx-family/lynx-ui/commit/44c1de68cf47e03c5136431a9efea7cbee69e752)]:
|
|
8
|
+
- @lynx-js/lynx-ui-button@3.135.3
|
|
9
|
+
- @lynx-js/lynx-ui-common@3.135.3
|
|
10
|
+
- @lynx-js/lynx-ui-overlay@3.135.3
|
|
11
|
+
- @lynx-js/lynx-ui-presence@3.135.3
|
|
12
|
+
|
|
13
|
+
## 3.134.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Fix presence edge cases for rapid visibility toggles during enter and exit transitions: ([#204](https://github.com/lynx-family/lynx-ui/pull/204))
|
|
18
|
+
|
|
19
|
+
- Recover when an enter interrupts an in-progress exit.
|
|
20
|
+
- Keep open and close callbacks balanced across interrupted transitions.
|
|
21
|
+
- Remove mounted containers when dismissal occurs before entering starts.
|
|
22
|
+
- Handle cancelled Dialog transitions during rapid visibility changes.
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`92ae41f`](https://github.com/lynx-family/lynx-ui/commit/92ae41f375edc015087c352211a82f582ac1d010)]:
|
|
25
|
+
- @lynx-js/lynx-ui-presence@3.134.0
|
|
26
|
+
|
|
3
27
|
## 3.133.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/Dialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAA;AAkBhB,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAoDhD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAYtD;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAYlD;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAA;AAkBhB,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAoDhD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAYtD;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAYlD;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,gCAiExD,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,uCAkEhD,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAwCtD"}
|
package/dist/Dialog.jsx
CHANGED
|
@@ -76,7 +76,7 @@ const DialogBackdrop = (props)=>{
|
|
|
76
76
|
className,
|
|
77
77
|
transition
|
|
78
78
|
});
|
|
79
|
-
const { handleKFStart, handleKFEnd, handleTransitionEnd, handleTransitionStart } = animationHandlers;
|
|
79
|
+
const { handleKFStart, handleKFCancel, handleKFEnd, handleTransitionCancel, handleTransitionEnd, handleTransitionStart } = animationHandlers;
|
|
80
80
|
const busy = resolveBusyState(groupState);
|
|
81
81
|
const handleClick = ()=>{
|
|
82
82
|
if (!clickToClose || busy) return;
|
|
@@ -84,7 +84,7 @@ const DialogBackdrop = (props)=>{
|
|
|
84
84
|
setUncontrolledShow(false);
|
|
85
85
|
onClick?.();
|
|
86
86
|
};
|
|
87
|
-
return <view className={presenceClassName} bindtap={handleClick} bindanimationstart={handleKFStart} bindanimationend={handleKFEnd} bindtransitionstart={handleTransitionStart} bindtransitionend={handleTransitionEnd} bindanimationcancel={
|
|
87
|
+
return <view className={presenceClassName} bindtap={handleClick} bindanimationstart={handleKFStart} bindanimationend={handleKFEnd} bindtransitionstart={handleTransitionStart} bindtransitioncancel={handleTransitionCancel} bindtransitionend={handleTransitionEnd} bindanimationcancel={handleKFCancel} event-through={false} style={{
|
|
88
88
|
width: '100%',
|
|
89
89
|
height: '100%',
|
|
90
90
|
position: 'absolute',
|
|
@@ -133,8 +133,8 @@ function DialogContent(props) {
|
|
|
133
133
|
className,
|
|
134
134
|
transition
|
|
135
135
|
});
|
|
136
|
-
const { handleKFStart, handleKFEnd, handleTransitionEnd, handleTransitionStart } = animationHandlers;
|
|
137
|
-
return <view className={presenceClassName} overlap={false} style={style} event-through={false} bindanimationstart={handleKFStart} bindanimationend={handleKFEnd} bindtransitionstart={handleTransitionStart} bindtransitionend={handleTransitionEnd} bindanimationcancel={
|
|
136
|
+
const { handleKFStart, handleKFCancel, handleKFEnd, handleTransitionCancel, handleTransitionEnd, handleTransitionStart } = animationHandlers;
|
|
137
|
+
return <view className={presenceClassName} overlap={false} style={style} event-through={false} bindanimationstart={handleKFStart} bindanimationend={handleKFEnd} bindtransitionstart={handleTransitionStart} bindtransitioncancel={handleTransitionCancel} bindtransitionend={handleTransitionEnd} bindanimationcancel={handleKFCancel} {...dialogContentProps}>
|
|
138
138
|
{children}
|
|
139
139
|
</view>;
|
|
140
140
|
}
|
package/dist/Dialog.jsx.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.jsx","sources":["webpack://@lynx-js/lynx-ui-dialog/./src/Dialog.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactNode } from '@lynx-js/react'\nimport { useContext, useMemo, useState } from '@lynx-js/react'\n\nimport { OverlayView } from '@lynx-js/lynx-ui-overlay'\nimport type { PresenceAnimationStatus } from '@lynx-js/lynx-ui-presence'\nimport {\n PresenceContext,\n PresenceState,\n presenceClassVariants,\n resolveAnimationStatus,\n usePresenceGroup,\n} from '@lynx-js/lynx-ui-presence'\n\nimport { DialogButton, resolveBusyState } from './DialogButton'\nimport { DialogContext } from './DialogContext'\nimport type {\n DialogBackdropProps,\n DialogCloseProps,\n DialogContentProps,\n DialogRootProps,\n DialogTriggerProps,\n DialogViewProps,\n} from './types'\n\ntype childType<T = PresenceState> = (groupState: T) => ReactNode\ntype renderChildrenType<T = PresenceState> = (\n children: childType<T> | ReactNode,\n status: T,\n) => ReactNode\n\nconst renderedChildren: renderChildrenType<PresenceAnimationStatus> = (\n children,\n status,\n) => {\n if (typeof children === 'function') {\n return children(status)\n }\n return children\n}\n\nexport function DialogRoot(props: DialogRootProps) {\n const {\n show,\n defaultShow = false,\n forceMount = false,\n children,\n onOpen,\n onClose,\n onShowChange,\n debugLog,\n } = props\n const isControlled = show !== undefined\n const [uncontrolledShow, setUncontrolledShow] = useState<boolean>(defaultShow)\n const actualShow = isControlled ? show : uncontrolledShow\n\n const [groupState, setGroupState] = useState<PresenceState>(\n actualShow ? PresenceState.Entering : PresenceState.Left,\n )\n\n const childrenStatus = resolveAnimationStatus({\n state: groupState,\n enableDelay: false,\n grouped: true,\n })\n\n const contextValue = useMemo(() => ({\n show: actualShow,\n forceMount,\n setUncontrolledShow,\n groupState,\n setGroupState,\n onOpen,\n onClose,\n onShowChange,\n debugLog,\n }), [\n actualShow,\n forceMount,\n setUncontrolledShow,\n groupState,\n setGroupState,\n onOpen,\n onClose,\n onShowChange,\n debugLog,\n ])\n\n return (\n <DialogContext.Provider value={contextValue}>\n {renderedChildren(children, childrenStatus)}\n </DialogContext.Provider>\n )\n}\n\nexport function DialogTrigger(props: DialogTriggerProps) {\n const { className, transition } = props\n const { groupState } = useContext(DialogContext)\n const presenceClassName = presenceClassVariants({\n state: groupState,\n enableDelay: false,\n className,\n transition,\n })\n return (\n <DialogButton {...props} className={presenceClassName} changeShow={true} />\n )\n}\nexport function DialogClose(props: DialogCloseProps) {\n const { className, transition } = props\n const { groupState } = useContext(DialogContext)\n const presenceClassName = presenceClassVariants({\n state: groupState,\n enableDelay: false,\n className,\n transition,\n })\n return (\n <DialogButton {...props} className={presenceClassName} changeShow={false} />\n )\n}\n\nexport const DialogBackdrop = (props: DialogBackdropProps) => {\n const {\n children,\n className,\n style,\n clickToClose = true,\n transition,\n dialogBackdropProps,\n onClick,\n } = props\n const {\n animationHandlers,\n controllers,\n } = useContext(PresenceContext)\n const state = controllers.state\n const { setUncontrolledShow, onShowChange, groupState } = useContext(\n DialogContext,\n )\n const presenceClassName = presenceClassVariants({\n state,\n enableDelay: false,\n className,\n transition,\n })\n\n const {\n handleKFStart,\n handleKFEnd,\n handleTransitionEnd,\n handleTransitionStart,\n } = animationHandlers\n const busy = resolveBusyState(groupState)\n const handleClick = () => {\n if (!clickToClose || busy) {\n return\n }\n onShowChange?.(false)\n setUncontrolledShow(false)\n onClick?.()\n }\n\n return (\n <view\n className={presenceClassName}\n bindtap={handleClick}\n bindanimationstart={handleKFStart}\n bindanimationend={handleKFEnd}\n bindtransitionstart={handleTransitionStart}\n bindtransitionend={handleTransitionEnd}\n bindanimationcancel={handleKFEnd}\n event-through={false}\n style={{\n width: '100%',\n height: '100%',\n position: 'absolute',\n ...style,\n }}\n {...dialogBackdropProps}\n >\n {children}\n </view>\n )\n}\n\nexport const DialogView = (props: DialogViewProps) => {\n const {\n container,\n children,\n className,\n style,\n overlayLevel,\n transition,\n dialogViewProps,\n } = props\n\n const {\n show,\n forceMount,\n onClose,\n onOpen,\n groupState,\n setGroupState,\n debugLog,\n } = useContext(\n DialogContext,\n )\n\n const { mountView, renderChildren } = usePresenceGroup({\n show,\n forceMount,\n setGroupState,\n children,\n onOpen,\n onClose,\n debugLog,\n })\n const presenceClassName = presenceClassVariants({\n state: groupState,\n enableDelay: false,\n className,\n transition,\n grouped: true,\n })\n\n return (\n (mountView || forceMount)\n ? (\n <OverlayView\n container={container}\n className={presenceClassName}\n style={{\n ...style,\n position: container ? 'relative' : 'fixed',\n }}\n overlayLevel={overlayLevel}\n // When the container is not given and the OverlayView is a normal view, attach the `native-interaction-enabled` prop to the view itself.\n // If this is not set, the default value on iOS is true while on Android it is false.\n overlayViewProps={container\n ? dialogViewProps\n : {\n 'native-interaction-enabled': true,\n 'flatten': false,\n ...dialogViewProps,\n }}\n >\n {renderChildren}\n </OverlayView>\n )\n : null\n )\n}\n\nexport function DialogContent(props: DialogContentProps) {\n const { className, style, children, transition, dialogContentProps } = props\n const {\n animationHandlers,\n controllers,\n } = useContext(PresenceContext)\n const state = controllers.state\n\n const presenceClassName = presenceClassVariants({\n state,\n enableDelay: false,\n className,\n transition,\n })\n const {\n handleKFStart,\n handleKFEnd,\n handleTransitionEnd,\n handleTransitionStart,\n } = animationHandlers\n\n return (\n <view\n className={presenceClassName}\n overlap={false}\n style={style}\n event-through={false}\n bindanimationstart={handleKFStart}\n bindanimationend={handleKFEnd}\n bindtransitionstart={handleTransitionStart}\n bindtransitionend={handleTransitionEnd}\n bindanimationcancel={handleKFEnd}\n {...dialogContentProps}\n >\n {children}\n </view>\n )\n}\n"],"names":["renderedChildren","children","status","DialogRoot","props","show","defaultShow","forceMount","onOpen","onClose","onShowChange","debugLog","isControlled","undefined","uncontrolledShow","setUncontrolledShow","useState","actualShow","groupState","setGroupState","PresenceState","childrenStatus","resolveAnimationStatus","contextValue","useMemo","DialogContext","DialogTrigger","className","transition","useContext","presenceClassName","presenceClassVariants","DialogButton","DialogClose","DialogBackdrop","style","clickToClose","dialogBackdropProps","onClick","animationHandlers","controllers","PresenceContext","state","handleKFStart","handleKFEnd","handleTransitionEnd","handleTransitionStart","busy","resolveBusyState","handleClick","view","DialogView","container","overlayLevel","dialogViewProps","mountView","renderChildren","usePresenceGroup","OverlayView","DialogContent","dialogContentProps"],"mappings":";;;;;AAkCA,MAAMA,mBAAgE,CACpEC,UACAC;IAEA,IAAI,AAAoB,cAApB,OAAOD,UACT,OAAOA,SAASC;IAElB,OAAOD;AACT;AAEO,SAASE,WAAWC,KAAsB;IAC/C,MAAM,EACJC,IAAI,EACJC,cAAc,KAAK,EACnBC,aAAa,KAAK,EAClBN,QAAQ,EACRO,MAAM,EACNC,OAAO,EACPC,YAAY,EACZC,QAAQ,EACT,GAAGP;IACJ,MAAMQ,eAAeP,AAASQ,WAATR;IACrB,MAAM,CAACS,kBAAkBC,oBAAoB,GAAGC,SAAkBV;IAClE,MAAMW,aAAaL,eAAeP,OAAOS;IAEzC,MAAM,CAACI,YAAYC,cAAc,GAAGH,SAClCC,aAAaG,cAAc,QAAQ,GAAGA,cAAc,IAAI;IAG1D,MAAMC,iBAAiBC,uBAAuB;QAC5C,OAAOJ;QACP,aAAa;QACb,SAAS;IACX;IAEA,MAAMK,eAAeC,QAAQ,IAAO;YAClC,MAAMP;YACNV;YACAQ;YACAG;YACAC;YACAX;YACAC;YACAC;YACAC;QACF,IAAI;QACFM;QACAV;QACAQ;QACAG;QACAC;QACAX;QACAC;QACAC;QACAC;KACD;IAED,QACGc,cAAc,SAAS,OAAOF,cAAc;MAC3C,CAACvB,iBAAiBC,UAAUoB,gBAAgB;IAC9C,EAAEI,cAAc;AAEpB;AAEO,SAASC,cAActB,KAAyB;IACrD,MAAM,EAAEuB,SAAS,EAAEC,UAAU,EAAE,GAAGxB;IAClC,MAAM,EAAEc,UAAU,EAAE,GAAGW,WAAWJ;IAClC,MAAMK,oBA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,qBACnB,qBAAqBD,cACpB,GAAGgB,kBAAkB,EACvB;MACC,CAAC3D,SAAS;IACZ,EAAEiD;AAEN"}
|
|
1
|
+
{"version":3,"file":"Dialog.jsx","sources":["webpack://@lynx-js/lynx-ui-dialog/./src/Dialog.tsx"],"sourcesContent":["// Copyright 2026 The Lynx Authors. All rights reserved.\n// Licensed under the Apache License Version 2.0 that can be found in the\n// LICENSE file in the root directory of this source tree.\n\nimport type { ReactNode } from '@lynx-js/react'\nimport { useContext, useMemo, useState } from '@lynx-js/react'\n\nimport { OverlayView } from '@lynx-js/lynx-ui-overlay'\nimport type { PresenceAnimationStatus } from '@lynx-js/lynx-ui-presence'\nimport {\n PresenceContext,\n PresenceState,\n presenceClassVariants,\n resolveAnimationStatus,\n usePresenceGroup,\n} from '@lynx-js/lynx-ui-presence'\n\nimport { DialogButton, resolveBusyState } from './DialogButton'\nimport { DialogContext } from './DialogContext'\nimport type {\n DialogBackdropProps,\n DialogCloseProps,\n DialogContentProps,\n DialogRootProps,\n DialogTriggerProps,\n DialogViewProps,\n} from './types'\n\ntype childType<T = PresenceState> = (groupState: T) => ReactNode\ntype renderChildrenType<T = PresenceState> = (\n children: childType<T> | ReactNode,\n status: T,\n) => ReactNode\n\nconst renderedChildren: renderChildrenType<PresenceAnimationStatus> = (\n children,\n status,\n) => {\n if (typeof children === 'function') {\n return children(status)\n }\n return children\n}\n\nexport function DialogRoot(props: DialogRootProps) {\n const {\n show,\n defaultShow = false,\n forceMount = false,\n children,\n onOpen,\n onClose,\n onShowChange,\n debugLog,\n } = props\n const isControlled = show !== undefined\n const [uncontrolledShow, setUncontrolledShow] = useState<boolean>(defaultShow)\n const actualShow = isControlled ? show : uncontrolledShow\n\n const [groupState, setGroupState] = useState<PresenceState>(\n actualShow ? PresenceState.Entering : PresenceState.Left,\n )\n\n const childrenStatus = resolveAnimationStatus({\n state: groupState,\n enableDelay: false,\n grouped: true,\n })\n\n const contextValue = useMemo(() => ({\n show: actualShow,\n forceMount,\n setUncontrolledShow,\n groupState,\n setGroupState,\n onOpen,\n onClose,\n onShowChange,\n debugLog,\n }), [\n actualShow,\n forceMount,\n setUncontrolledShow,\n groupState,\n setGroupState,\n onOpen,\n onClose,\n onShowChange,\n debugLog,\n ])\n\n return (\n <DialogContext.Provider value={contextValue}>\n {renderedChildren(children, childrenStatus)}\n </DialogContext.Provider>\n )\n}\n\nexport function DialogTrigger(props: DialogTriggerProps) {\n const { className, transition } = props\n const { groupState } = useContext(DialogContext)\n const presenceClassName = presenceClassVariants({\n state: groupState,\n enableDelay: false,\n className,\n transition,\n })\n return (\n <DialogButton {...props} className={presenceClassName} changeShow={true} />\n )\n}\nexport function DialogClose(props: DialogCloseProps) {\n const { className, transition } = props\n const { groupState } = useContext(DialogContext)\n const presenceClassName = presenceClassVariants({\n state: groupState,\n enableDelay: false,\n className,\n transition,\n })\n return (\n <DialogButton {...props} className={presenceClassName} changeShow={false} />\n )\n}\n\nexport const DialogBackdrop = (props: DialogBackdropProps) => {\n const {\n children,\n className,\n style,\n clickToClose = true,\n transition,\n dialogBackdropProps,\n onClick,\n } = props\n const {\n animationHandlers,\n controllers,\n } = useContext(PresenceContext)\n const state = controllers.state\n const { setUncontrolledShow, onShowChange, groupState } = useContext(\n DialogContext,\n )\n const presenceClassName = presenceClassVariants({\n state,\n enableDelay: false,\n className,\n transition,\n })\n\n const {\n handleKFStart,\n handleKFCancel,\n handleKFEnd,\n handleTransitionCancel,\n handleTransitionEnd,\n handleTransitionStart,\n } = animationHandlers\n const busy = resolveBusyState(groupState)\n const handleClick = () => {\n if (!clickToClose || busy) {\n return\n }\n onShowChange?.(false)\n setUncontrolledShow(false)\n onClick?.()\n }\n\n return (\n <view\n className={presenceClassName}\n bindtap={handleClick}\n bindanimationstart={handleKFStart}\n bindanimationend={handleKFEnd}\n bindtransitionstart={handleTransitionStart}\n bindtransitioncancel={handleTransitionCancel}\n bindtransitionend={handleTransitionEnd}\n bindanimationcancel={handleKFCancel}\n event-through={false}\n style={{\n width: '100%',\n height: '100%',\n position: 'absolute',\n ...style,\n }}\n {...dialogBackdropProps}\n >\n {children}\n </view>\n )\n}\n\nexport const DialogView = (props: DialogViewProps) => {\n const {\n container,\n children,\n className,\n style,\n overlayLevel,\n transition,\n dialogViewProps,\n } = props\n\n const {\n show,\n forceMount,\n onClose,\n onOpen,\n groupState,\n setGroupState,\n debugLog,\n } = useContext(\n DialogContext,\n )\n\n const { mountView, renderChildren } = usePresenceGroup({\n show,\n forceMount,\n setGroupState,\n children,\n onOpen,\n onClose,\n debugLog,\n })\n const presenceClassName = presenceClassVariants({\n state: groupState,\n enableDelay: false,\n className,\n transition,\n grouped: true,\n })\n\n return (\n (mountView || forceMount)\n ? (\n <OverlayView\n container={container}\n className={presenceClassName}\n style={{\n ...style,\n position: container ? 'relative' : 'fixed',\n }}\n overlayLevel={overlayLevel}\n // When the container is not given and the OverlayView is a normal view, attach the `native-interaction-enabled` prop to the view itself.\n // If this is not set, the default value on iOS is true while on Android it is false.\n overlayViewProps={container\n ? dialogViewProps\n : {\n 'native-interaction-enabled': true,\n 'flatten': false,\n ...dialogViewProps,\n }}\n >\n {renderChildren}\n </OverlayView>\n )\n : null\n )\n}\n\nexport function DialogContent(props: DialogContentProps) {\n const { className, style, children, transition, dialogContentProps } = props\n const {\n animationHandlers,\n controllers,\n } = useContext(PresenceContext)\n const state = controllers.state\n\n const presenceClassName = presenceClassVariants({\n state,\n enableDelay: false,\n className,\n transition,\n })\n const {\n handleKFStart,\n handleKFCancel,\n handleKFEnd,\n handleTransitionCancel,\n handleTransitionEnd,\n handleTransitionStart,\n } = animationHandlers\n\n return (\n <view\n className={presenceClassName}\n overlap={false}\n style={style}\n event-through={false}\n bindanimationstart={handleKFStart}\n bindanimationend={handleKFEnd}\n bindtransitionstart={handleTransitionStart}\n bindtransitioncancel={handleTransitionCancel}\n bindtransitionend={handleTransitionEnd}\n bindanimationcancel={handleKFCancel}\n {...dialogContentProps}\n >\n {children}\n </view>\n )\n}\n"],"names":["renderedChildren","children","status","DialogRoot","props","show","defaultShow","forceMount","onOpen","onClose","onShowChange","debugLog","isControlled","undefined","uncontrolledShow","setUncontrolledShow","useState","actualShow","groupState","setGroupState","PresenceState","childrenStatus","resolveAnimationStatus","contextValue","useMemo","DialogContext","DialogTrigger","className","transition","useContext","presenceClassName","presenceClassVariants","DialogButton","DialogClose","DialogBackdrop","style","clickToClose","dialogBackdropProps","onClick","animationHandlers","controllers","PresenceContext","state","handleKFStart","handleKFCancel","handleKFEnd","handleTransitionCancel","handleTransitionEnd","handleTransitionStart","busy","resolveBusyState","handleClick","view","DialogView","container","overlayLevel","dialogViewProps","mountView","renderChildren","usePresenceGroup","OverlayView","DialogContent","dialogContentProps"],"mappings":";;;;;AAkCA,MAAMA,mBAAgE,CACpEC,UACAC;IAEA,IAAI,AAAoB,cAApB,OAAOD,UACT,OAAOA,SAASC;IAElB,OAAOD;AACT;AAEO,SAASE,WAAWC,KAAsB;IAC/C,MAAM,EACJC,IAAI,EACJC,cAAc,KAAK,EACnBC,aAAa,KAAK,EAClBN,QAAQ,EACRO,MAAM,EACNC,OAAO,EACPC,YAAY,EACZC,QAAQ,EACT,GAAGP;IACJ,MAAMQ,eAAeP,AAASQ,WAATR;IACrB,MAAM,CAACS,kBAAkBC,oBAAoB,GAAGC,SAAkBV;IAClE,MAAMW,aAAaL,eAAeP,OAAOS;IAEzC,MAAM,CAACI,YAAYC,cAAc,GAAGH,SAClCC,aAAaG,cAAc,QAAQ,GAAGA,cAAc,IAAI;IAG1D,MAAMC,iBAAiBC,uBAAuB;QAC5C,OAAOJ;QACP,aAAa;QACb,SAAS;IACX;IAEA,MAAMK,eAAeC,QAAQ,IAAO;YAClC,MAAMP;YACNV;YACAQ;YACAG;YACAC;YACAX;YACAC;YACAC;YACAC;QACF,IAAI;QACFM;QACAV;QACAQ;QACAG;QACAC;QACAX;QACAC;QACAC;QACAC;KACD;IAED,QACGc,cAAc,SAAS,OAAOF,cAAc;MAC3C,CAACvB,iBAAiBC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W;QACA,aAAa;QACbf;QACAC;IACF;IACA,MAAM,EACJe,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,sBAAsB,EACtBC,mBAAmB,EACnBC,qBAAqB,EACtB,GAAGT;IAEJ,QACGa,KACC,WAAWtB,mBACX,SAAS,OACT,OAAOK,OACP,eAAe,OACf,oBAAoBQ,eACpB,kBAAkBE,aAClB,qBAAqBG,uBACrB,sBAAsBF,wBACtB,mBAAmBC,qBACnB,qBAAqBH,iBACpB,GAAGkB,kBAAkB,EACvB;MACC,CAAC7D,SAAS;IACZ,EAAEmD;AAEN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/lynx-ui-dialog",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.135.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/lynx-family/lynx-ui.git",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"clsx": "^2.1.1",
|
|
29
|
-
"@lynx-js/lynx-ui-
|
|
30
|
-
"@lynx-js/lynx-ui-
|
|
31
|
-
"@lynx-js/lynx-ui-
|
|
32
|
-
"@lynx-js/lynx-ui-
|
|
29
|
+
"@lynx-js/lynx-ui-common": "3.135.3",
|
|
30
|
+
"@lynx-js/lynx-ui-presence": "3.135.3",
|
|
31
|
+
"@lynx-js/lynx-ui-button": "3.135.3",
|
|
32
|
+
"@lynx-js/lynx-ui-overlay": "3.135.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@lynx-js/react": "0.114.0",
|
package/src/Dialog.tsx
CHANGED
|
@@ -150,7 +150,9 @@ export const DialogBackdrop = (props: DialogBackdropProps) => {
|
|
|
150
150
|
|
|
151
151
|
const {
|
|
152
152
|
handleKFStart,
|
|
153
|
+
handleKFCancel,
|
|
153
154
|
handleKFEnd,
|
|
155
|
+
handleTransitionCancel,
|
|
154
156
|
handleTransitionEnd,
|
|
155
157
|
handleTransitionStart,
|
|
156
158
|
} = animationHandlers
|
|
@@ -171,8 +173,9 @@ export const DialogBackdrop = (props: DialogBackdropProps) => {
|
|
|
171
173
|
bindanimationstart={handleKFStart}
|
|
172
174
|
bindanimationend={handleKFEnd}
|
|
173
175
|
bindtransitionstart={handleTransitionStart}
|
|
176
|
+
bindtransitioncancel={handleTransitionCancel}
|
|
174
177
|
bindtransitionend={handleTransitionEnd}
|
|
175
|
-
bindanimationcancel={
|
|
178
|
+
bindanimationcancel={handleKFCancel}
|
|
176
179
|
event-through={false}
|
|
177
180
|
style={{
|
|
178
181
|
width: '100%',
|
|
@@ -271,7 +274,9 @@ export function DialogContent(props: DialogContentProps) {
|
|
|
271
274
|
})
|
|
272
275
|
const {
|
|
273
276
|
handleKFStart,
|
|
277
|
+
handleKFCancel,
|
|
274
278
|
handleKFEnd,
|
|
279
|
+
handleTransitionCancel,
|
|
275
280
|
handleTransitionEnd,
|
|
276
281
|
handleTransitionStart,
|
|
277
282
|
} = animationHandlers
|
|
@@ -285,8 +290,9 @@ export function DialogContent(props: DialogContentProps) {
|
|
|
285
290
|
bindanimationstart={handleKFStart}
|
|
286
291
|
bindanimationend={handleKFEnd}
|
|
287
292
|
bindtransitionstart={handleTransitionStart}
|
|
293
|
+
bindtransitioncancel={handleTransitionCancel}
|
|
288
294
|
bindtransitionend={handleTransitionEnd}
|
|
289
|
-
bindanimationcancel={
|
|
295
|
+
bindanimationcancel={handleKFCancel}
|
|
290
296
|
{...dialogContentProps}
|
|
291
297
|
>
|
|
292
298
|
{children}
|