@nexus-cross/design-system 1.0.3-beta.1
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/cursor-rules/nexus-project-setup.mdc +188 -0
- package/cursor-rules/nexus-ui-api.mdc +698 -0
- package/cursor-rules/nexus-ui-components.mdc +104 -0
- package/dist/accordion.d.mts +28 -0
- package/dist/accordion.d.ts +28 -0
- package/dist/accordion.js +28 -0
- package/dist/accordion.mjs +3 -0
- package/dist/avatar.d.mts +17 -0
- package/dist/avatar.d.ts +17 -0
- package/dist/avatar.js +16 -0
- package/dist/avatar.mjs +3 -0
- package/dist/button.d.mts +15 -0
- package/dist/button.d.ts +15 -0
- package/dist/button.js +16 -0
- package/dist/button.mjs +3 -0
- package/dist/carousel.d.mts +36 -0
- package/dist/carousel.d.ts +36 -0
- package/dist/carousel.js +32 -0
- package/dist/carousel.mjs +3 -0
- package/dist/checkbox.d.mts +21 -0
- package/dist/checkbox.d.ts +21 -0
- package/dist/checkbox.js +20 -0
- package/dist/checkbox.mjs +3 -0
- package/dist/chip.d.mts +16 -0
- package/dist/chip.d.ts +16 -0
- package/dist/chip.js +16 -0
- package/dist/chip.mjs +3 -0
- package/dist/chunks/chunk-22ULI3BF.js +21 -0
- package/dist/chunks/chunk-2JTPRBHZ.mjs +36 -0
- package/dist/chunks/chunk-377KBJQG.js +74 -0
- package/dist/chunks/chunk-3CHRUKSJ.mjs +120 -0
- package/dist/chunks/chunk-4ITJA3IS.mjs +83 -0
- package/dist/chunks/chunk-4J3GCZ7W.mjs +102 -0
- package/dist/chunks/chunk-53A2SL62.js +218 -0
- package/dist/chunks/chunk-54IA2P2Z.mjs +40 -0
- package/dist/chunks/chunk-5I2VRWWU.js +172 -0
- package/dist/chunks/chunk-5TBXVD56.js +88 -0
- package/dist/chunks/chunk-6DZVNFVY.js +82 -0
- package/dist/chunks/chunk-6FHK6CBR.js +117 -0
- package/dist/chunks/chunk-6H7V2I3X.mjs +270 -0
- package/dist/chunks/chunk-6MRM5K2N.js +106 -0
- package/dist/chunks/chunk-6NTASYZO.js +132 -0
- package/dist/chunks/chunk-76CY4STF.js +165 -0
- package/dist/chunks/chunk-76K6KXCT.js +100 -0
- package/dist/chunks/chunk-7MT3QYE6.js +92 -0
- package/dist/chunks/chunk-7OEK2KX3.mjs +81 -0
- package/dist/chunks/chunk-AKIBUO5A.mjs +83 -0
- package/dist/chunks/chunk-AOVU67NI.mjs +139 -0
- package/dist/chunks/chunk-AOXXE5UQ.mjs +14 -0
- package/dist/chunks/chunk-AWBGWBFS.js +135 -0
- package/dist/chunks/chunk-AZ2URLDD.js +39 -0
- package/dist/chunks/chunk-BEA727LO.mjs +108 -0
- package/dist/chunks/chunk-C3E7CSKG.mjs +115 -0
- package/dist/chunks/chunk-C6H2UNOX.js +83 -0
- package/dist/chunks/chunk-CVYXRSXT.mjs +8 -0
- package/dist/chunks/chunk-EIOP4DOE.mjs +292 -0
- package/dist/chunks/chunk-FA2OPP3U.mjs +140 -0
- package/dist/chunks/chunk-FHPHDK3O.mjs +89 -0
- package/dist/chunks/chunk-FKHW7QYG.js +725 -0
- package/dist/chunks/chunk-FKZI2HTI.js +104 -0
- package/dist/chunks/chunk-G4XJG7XI.js +66 -0
- package/dist/chunks/chunk-GMIGQ5VP.mjs +86 -0
- package/dist/chunks/chunk-GSLIY6WW.js +109 -0
- package/dist/chunks/chunk-HHXDOKXY.js +108 -0
- package/dist/chunks/chunk-HUPAHDJ7.js +273 -0
- package/dist/chunks/chunk-I252NERB.mjs +21 -0
- package/dist/chunks/chunk-I7YJB2F5.js +143 -0
- package/dist/chunks/chunk-IB5UCYQY.mjs +66 -0
- package/dist/chunks/chunk-IJG7J2VU.mjs +148 -0
- package/dist/chunks/chunk-INP2AH3B.js +27 -0
- package/dist/chunks/chunk-IUNNTSD2.mjs +195 -0
- package/dist/chunks/chunk-JNMCYWGY.js +10 -0
- package/dist/chunks/chunk-JZ3PWHKS.mjs +51 -0
- package/dist/chunks/chunk-KWPIEHD2.mjs +78 -0
- package/dist/chunks/chunk-LBKBCI2K.mjs +44 -0
- package/dist/chunks/chunk-LVTD2UQN.mjs +48 -0
- package/dist/chunks/chunk-MPKRXMCJ.js +93 -0
- package/dist/chunks/chunk-NCQDOPBR.mjs +86 -0
- package/dist/chunks/chunk-NHDGKOAM.js +104 -0
- package/dist/chunks/chunk-OTGS6BDQ.mjs +25 -0
- package/dist/chunks/chunk-Q2TMXHPK.js +178 -0
- package/dist/chunks/chunk-Q7GQVAYY.js +88 -0
- package/dist/chunks/chunk-Q7H6LCNN.js +169 -0
- package/dist/chunks/chunk-QJNQCLMV.js +25 -0
- package/dist/chunks/chunk-QK6NCII4.js +36 -0
- package/dist/chunks/chunk-RLP3U52D.mjs +153 -0
- package/dist/chunks/chunk-T2IY2TSR.js +43 -0
- package/dist/chunks/chunk-TLTEUIBY.js +112 -0
- package/dist/chunks/chunk-TPBKQ3WC.js +303 -0
- package/dist/chunks/chunk-TR5JBBEA.mjs +116 -0
- package/dist/chunks/chunk-TWHDXCKR.js +61 -0
- package/dist/chunks/chunk-U56AGSLE.mjs +106 -0
- package/dist/chunks/chunk-U6KOUYWX.mjs +66 -0
- package/dist/chunks/chunk-U76LT5GE.js +70 -0
- package/dist/chunks/chunk-UDQXLI5Y.mjs +81 -0
- package/dist/chunks/chunk-UH667FUK.mjs +712 -0
- package/dist/chunks/chunk-UR6JOKVB.mjs +65 -0
- package/dist/chunks/chunk-VH5FF6DZ.mjs +38 -0
- package/dist/chunks/chunk-WJ2OVQD3.mjs +105 -0
- package/dist/chunks/chunk-WNFJ4NJN.mjs +55 -0
- package/dist/chunks/chunk-WSWD5ZUJ.js +106 -0
- package/dist/chunks/chunk-XALPBGSC.mjs +23 -0
- package/dist/chunks/chunk-XEHFB62A.js +82 -0
- package/dist/chunks/chunk-YEGPB7A7.js +83 -0
- package/dist/chunks/chunk-YEWKPWK3.mjs +80 -0
- package/dist/chunks/chunk-Z7OKV6NW.mjs +59 -0
- package/dist/chunks/chunk-ZCMKIB5U.js +140 -0
- package/dist/client-only.d.mts +13 -0
- package/dist/client-only.d.ts +13 -0
- package/dist/client-only.js +11 -0
- package/dist/client-only.mjs +2 -0
- package/dist/countdown.d.mts +27 -0
- package/dist/countdown.d.ts +27 -0
- package/dist/countdown.js +16 -0
- package/dist/countdown.mjs +3 -0
- package/dist/counter.d.mts +15 -0
- package/dist/counter.d.ts +15 -0
- package/dist/counter.js +11 -0
- package/dist/counter.mjs +2 -0
- package/dist/divider.d.mts +14 -0
- package/dist/divider.d.ts +14 -0
- package/dist/divider.js +16 -0
- package/dist/divider.mjs +3 -0
- package/dist/drawer.d.mts +42 -0
- package/dist/drawer.d.ts +42 -0
- package/dist/drawer.js +44 -0
- package/dist/drawer.mjs +3 -0
- package/dist/ellipsis.d.mts +16 -0
- package/dist/ellipsis.d.ts +16 -0
- package/dist/ellipsis.js +12 -0
- package/dist/ellipsis.mjs +3 -0
- package/dist/error-boundary.d.mts +20 -0
- package/dist/error-boundary.d.ts +20 -0
- package/dist/error-boundary.js +11 -0
- package/dist/error-boundary.mjs +2 -0
- package/dist/hooks/useCheckDevice.d.mts +47 -0
- package/dist/hooks/useCheckDevice.d.ts +47 -0
- package/dist/hooks/useCheckDevice.js +8 -0
- package/dist/hooks/useCheckDevice.mjs +2 -0
- package/dist/hooks/useClickOutside.d.mts +12 -0
- package/dist/hooks/useClickOutside.d.ts +12 -0
- package/dist/hooks/useClickOutside.js +8 -0
- package/dist/hooks/useClickOutside.mjs +2 -0
- package/dist/hooks/useDraggableBottomSheet.d.mts +24 -0
- package/dist/hooks/useDraggableBottomSheet.d.ts +24 -0
- package/dist/hooks/useDraggableBottomSheet.js +11 -0
- package/dist/hooks/useDraggableBottomSheet.mjs +2 -0
- package/dist/hooks/useDraggableWindow.d.mts +21 -0
- package/dist/hooks/useDraggableWindow.d.ts +21 -0
- package/dist/hooks/useDraggableWindow.js +11 -0
- package/dist/hooks/useDraggableWindow.mjs +2 -0
- package/dist/hooks/useInView.d.mts +14 -0
- package/dist/hooks/useInView.d.ts +14 -0
- package/dist/hooks/useInView.js +17 -0
- package/dist/hooks/useInView.mjs +2 -0
- package/dist/hooks/useModal.d.mts +2 -0
- package/dist/hooks/useModal.d.ts +2 -0
- package/dist/hooks/useModal.js +11 -0
- package/dist/hooks/useModal.mjs +2 -0
- package/dist/index.d.mts +74 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +633 -0
- package/dist/index.mjs +227 -0
- package/dist/infinite-scroll.d.mts +26 -0
- package/dist/infinite-scroll.d.ts +26 -0
- package/dist/infinite-scroll.js +12 -0
- package/dist/infinite-scroll.mjs +3 -0
- package/dist/marquee.d.mts +12 -0
- package/dist/marquee.d.ts +12 -0
- package/dist/marquee.js +12 -0
- package/dist/marquee.mjs +3 -0
- package/dist/modal/index.d.mts +87 -0
- package/dist/modal/index.d.ts +87 -0
- package/dist/modal/index.js +54 -0
- package/dist/modal/index.mjs +9 -0
- package/dist/number-input.d.mts +21 -0
- package/dist/number-input.d.ts +21 -0
- package/dist/number-input.js +16 -0
- package/dist/number-input.mjs +3 -0
- package/dist/pagination.d.mts +21 -0
- package/dist/pagination.d.ts +21 -0
- package/dist/pagination.js +20 -0
- package/dist/pagination.mjs +3 -0
- package/dist/popover.d.mts +25 -0
- package/dist/popover.d.ts +25 -0
- package/dist/popover.js +32 -0
- package/dist/popover.mjs +3 -0
- package/dist/radio-group.d.mts +29 -0
- package/dist/radio-group.d.ts +29 -0
- package/dist/radio-group.js +24 -0
- package/dist/radio-group.mjs +3 -0
- package/dist/select.d.mts +31 -0
- package/dist/select.d.ts +31 -0
- package/dist/select.js +24 -0
- package/dist/select.mjs +3 -0
- package/dist/spinner.d.mts +9 -0
- package/dist/spinner.d.ts +9 -0
- package/dist/spinner.js +12 -0
- package/dist/spinner.mjs +3 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.mts +3 -0
- package/dist/styles.d.ts +3 -0
- package/dist/styles.js +19 -0
- package/dist/styles.mjs +17 -0
- package/dist/switch.d.mts +15 -0
- package/dist/switch.d.ts +15 -0
- package/dist/switch.js +16 -0
- package/dist/switch.mjs +3 -0
- package/dist/tab.d.mts +36 -0
- package/dist/tab.d.ts +36 -0
- package/dist/tab.js +20 -0
- package/dist/tab.mjs +3 -0
- package/dist/table.d.mts +80 -0
- package/dist/table.d.ts +80 -0
- package/dist/table.js +32 -0
- package/dist/table.mjs +3 -0
- package/dist/text-area.d.mts +15 -0
- package/dist/text-area.d.ts +15 -0
- package/dist/text-area.js +16 -0
- package/dist/text-area.mjs +3 -0
- package/dist/text-input.d.mts +17 -0
- package/dist/text-input.d.ts +17 -0
- package/dist/text-input.js +16 -0
- package/dist/text-input.mjs +3 -0
- package/dist/theme-provider.d.mts +25 -0
- package/dist/theme-provider.d.ts +25 -0
- package/dist/theme-provider.js +15 -0
- package/dist/theme-provider.mjs +2 -0
- package/dist/toast.d.mts +42 -0
- package/dist/toast.d.ts +42 -0
- package/dist/toast.js +20 -0
- package/dist/toast.mjs +3 -0
- package/dist/tooltip.d.mts +24 -0
- package/dist/tooltip.d.ts +24 -0
- package/dist/tooltip.js +20 -0
- package/dist/tooltip.mjs +3 -0
- package/dist/typography.d.mts +19 -0
- package/dist/typography.d.ts +19 -0
- package/dist/typography.js +102 -0
- package/dist/typography.mjs +79 -0
- package/dist/useModal-BsGIcP8t.d.mts +128 -0
- package/dist/useModal-BsGIcP8t.d.ts +128 -0
- package/dist/utils/cn.d.mts +15 -0
- package/dist/utils/cn.d.ts +15 -0
- package/dist/utils/cn.js +11 -0
- package/dist/utils/cn.mjs +2 -0
- package/dist/utils/scroll.d.mts +4 -0
- package/dist/utils/scroll.d.ts +4 -0
- package/dist/utils/scroll.js +15 -0
- package/dist/utils/scroll.mjs +2 -0
- package/dist/virtual-scroll.d.mts +34 -0
- package/dist/virtual-scroll.d.ts +34 -0
- package/dist/virtual-scroll.js +16 -0
- package/dist/virtual-scroll.mjs +3 -0
- package/package.json +271 -0
- package/scripts/setup-cursor-rules.cjs +92 -0
package/dist/toast.d.mts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ToasterProps as ToasterProps$1, ExternalToast } from 'sonner';
|
|
2
|
+
export { ExternalToast as ToastOptions, toast } from 'sonner';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
6
|
+
interface ToasterProps extends Partial<ToasterProps$1> {
|
|
7
|
+
position?: ToastPosition;
|
|
8
|
+
unstyled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function Toaster({ position, unstyled, toastOptions, ...props }: ToasterProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
type ToastOptions = ExternalToast;
|
|
13
|
+
/**
|
|
14
|
+
* Sonner toast 래퍼 훅.
|
|
15
|
+
*
|
|
16
|
+
* `toast()` 함수를 직접 사용해도 되지만,
|
|
17
|
+
* 편의 메서드(successToast, errorToast 등)를 제공합니다.
|
|
18
|
+
*
|
|
19
|
+
* headless 모드: `toast.custom(<MyComponent />)` 사용
|
|
20
|
+
*/
|
|
21
|
+
declare function useToast(): {
|
|
22
|
+
toast: (message: string, options?: ToastOptions) => string | number;
|
|
23
|
+
successToast: (message: string, options?: ToastOptions) => string | number;
|
|
24
|
+
errorToast: (message: string, options?: ToastOptions) => string | number;
|
|
25
|
+
warningToast: (message: string, options?: ToastOptions) => string | number;
|
|
26
|
+
infoToast: (message: string, options?: ToastOptions) => string | number;
|
|
27
|
+
promiseToast: <T>(promise: Promise<T> | (() => Promise<T>), msgs: {
|
|
28
|
+
loading: string;
|
|
29
|
+
success: string | ((data: T) => string);
|
|
30
|
+
error: string | ((error: unknown) => string);
|
|
31
|
+
}, options?: ToastOptions) => (string & {
|
|
32
|
+
unwrap: () => Promise<T>;
|
|
33
|
+
}) | (number & {
|
|
34
|
+
unwrap: () => Promise<T>;
|
|
35
|
+
}) | {
|
|
36
|
+
unwrap: () => Promise<T>;
|
|
37
|
+
};
|
|
38
|
+
customToast: (jsx: (id: string | number) => React.ReactElement, options?: ToastOptions) => string | number;
|
|
39
|
+
dismissToast: (id?: string | number) => string | number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { type ToastPosition, Toaster, type ToasterProps, useToast };
|
package/dist/toast.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ToasterProps as ToasterProps$1, ExternalToast } from 'sonner';
|
|
2
|
+
export { ExternalToast as ToastOptions, toast } from 'sonner';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
6
|
+
interface ToasterProps extends Partial<ToasterProps$1> {
|
|
7
|
+
position?: ToastPosition;
|
|
8
|
+
unstyled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function Toaster({ position, unstyled, toastOptions, ...props }: ToasterProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
type ToastOptions = ExternalToast;
|
|
13
|
+
/**
|
|
14
|
+
* Sonner toast 래퍼 훅.
|
|
15
|
+
*
|
|
16
|
+
* `toast()` 함수를 직접 사용해도 되지만,
|
|
17
|
+
* 편의 메서드(successToast, errorToast 등)를 제공합니다.
|
|
18
|
+
*
|
|
19
|
+
* headless 모드: `toast.custom(<MyComponent />)` 사용
|
|
20
|
+
*/
|
|
21
|
+
declare function useToast(): {
|
|
22
|
+
toast: (message: string, options?: ToastOptions) => string | number;
|
|
23
|
+
successToast: (message: string, options?: ToastOptions) => string | number;
|
|
24
|
+
errorToast: (message: string, options?: ToastOptions) => string | number;
|
|
25
|
+
warningToast: (message: string, options?: ToastOptions) => string | number;
|
|
26
|
+
infoToast: (message: string, options?: ToastOptions) => string | number;
|
|
27
|
+
promiseToast: <T>(promise: Promise<T> | (() => Promise<T>), msgs: {
|
|
28
|
+
loading: string;
|
|
29
|
+
success: string | ((data: T) => string);
|
|
30
|
+
error: string | ((error: unknown) => string);
|
|
31
|
+
}, options?: ToastOptions) => (string & {
|
|
32
|
+
unwrap: () => Promise<T>;
|
|
33
|
+
}) | (number & {
|
|
34
|
+
unwrap: () => Promise<T>;
|
|
35
|
+
}) | {
|
|
36
|
+
unwrap: () => Promise<T>;
|
|
37
|
+
};
|
|
38
|
+
customToast: (jsx: (id: string | number) => React.ReactElement, options?: ToastOptions) => string | number;
|
|
39
|
+
dismissToast: (id?: string | number) => string | number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { type ToastPosition, Toaster, type ToasterProps, useToast };
|
package/dist/toast.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk7MT3QYE6_js = require('./chunks/chunk-7MT3QYE6.js');
|
|
4
|
+
require('./chunks/chunk-QJNQCLMV.js');
|
|
5
|
+
require('./chunks/chunk-JNMCYWGY.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "Toaster", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunk7MT3QYE6_js.Toaster; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "toast", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunk7MT3QYE6_js.toast; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "useToast", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunk7MT3QYE6_js.useToast; }
|
|
20
|
+
});
|
package/dist/toast.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
5
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
6
|
+
import { VariantProps } from 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
declare const tooltipContentVariants: (props?: ({
|
|
9
|
+
variant?: "light" | "dark" | null | undefined;
|
|
10
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
+
interface TooltipProps extends VariantProps<typeof tooltipContentVariants> {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
content: ReactNode;
|
|
14
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
15
|
+
align?: 'start' | 'center' | 'end';
|
|
16
|
+
delayDuration?: number;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
triggerClassName?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
22
|
+
declare const Tooltip: ({ children, content, side, align, delayDuration, disabled, variant, triggerClassName, className, }: TooltipProps) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { Tooltip, TooltipProvider, tooltipContentVariants };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
5
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
6
|
+
import { VariantProps } from 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
declare const tooltipContentVariants: (props?: ({
|
|
9
|
+
variant?: "light" | "dark" | null | undefined;
|
|
10
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
+
interface TooltipProps extends VariantProps<typeof tooltipContentVariants> {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
content: ReactNode;
|
|
14
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
15
|
+
align?: 'start' | 'center' | 'end';
|
|
16
|
+
delayDuration?: number;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
triggerClassName?: string;
|
|
20
|
+
}
|
|
21
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
22
|
+
declare const Tooltip: ({ children, content, side, align, delayDuration, disabled, variant, triggerClassName, className, }: TooltipProps) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { Tooltip, TooltipProvider, tooltipContentVariants };
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkC6H2UNOX_js = require('./chunks/chunk-C6H2UNOX.js');
|
|
4
|
+
require('./chunks/chunk-QJNQCLMV.js');
|
|
5
|
+
require('./chunks/chunk-JNMCYWGY.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "Tooltip", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkC6H2UNOX_js.Tooltip; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "TooltipProvider", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkC6H2UNOX_js.TooltipProvider; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "tooltipContentVariants", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkC6H2UNOX_js.tooltipContentVariants; }
|
|
20
|
+
});
|
package/dist/tooltip.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const typographyVariants: (props?: ({
|
|
6
|
+
variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "caption" | "overline" | "label" | null | undefined;
|
|
7
|
+
color?: "primary" | "secondary" | "tertiary" | "muted" | "accent" | "danger" | "success" | "inherit" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
type TypographyElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'label' | 'div';
|
|
10
|
+
type TypographyColor = NonNullable<VariantProps<typeof typographyVariants>['color']>;
|
|
11
|
+
interface TypographyProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'> {
|
|
12
|
+
as?: TypographyElement;
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
variant?: VariantProps<typeof typographyVariants>['variant'];
|
|
15
|
+
color?: TypographyColor;
|
|
16
|
+
}
|
|
17
|
+
declare const Typography: React.ForwardRefExoticComponent<TypographyProps & React.RefAttributes<HTMLElement>>;
|
|
18
|
+
|
|
19
|
+
export { Typography, type TypographyProps, typographyVariants };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const typographyVariants: (props?: ({
|
|
6
|
+
variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "caption" | "overline" | "label" | null | undefined;
|
|
7
|
+
color?: "primary" | "secondary" | "tertiary" | "muted" | "accent" | "danger" | "success" | "inherit" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
type TypographyElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'label' | 'div';
|
|
10
|
+
type TypographyColor = NonNullable<VariantProps<typeof typographyVariants>['color']>;
|
|
11
|
+
interface TypographyProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'> {
|
|
12
|
+
as?: TypographyElement;
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
variant?: VariantProps<typeof typographyVariants>['variant'];
|
|
15
|
+
color?: TypographyColor;
|
|
16
|
+
}
|
|
17
|
+
declare const Typography: React.ForwardRefExoticComponent<TypographyProps & React.RefAttributes<HTMLElement>>;
|
|
18
|
+
|
|
19
|
+
export { Typography, type TypographyProps, typographyVariants };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkQJNQCLMV_js = require('./chunks/chunk-QJNQCLMV.js');
|
|
4
|
+
require('./chunks/chunk-JNMCYWGY.js');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
7
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
|
+
|
|
30
|
+
var typographyVariants = classVarianceAuthority.cva("nx:text-text-primary", {
|
|
31
|
+
variants: {
|
|
32
|
+
variant: {
|
|
33
|
+
h1: "nx:text-4xl nx:font-bold nx:tracking-tight",
|
|
34
|
+
h2: "nx:text-3xl nx:font-bold nx:tracking-tight",
|
|
35
|
+
h3: "nx:text-2xl nx:font-semibold",
|
|
36
|
+
h4: "nx:text-xl nx:font-semibold",
|
|
37
|
+
h5: "nx:text-lg nx:font-semibold",
|
|
38
|
+
h6: "nx:text-base nx:font-semibold",
|
|
39
|
+
body1: "nx:text-base nx:font-normal nx:leading-relaxed",
|
|
40
|
+
body2: "nx:text-sm nx:font-normal nx:leading-relaxed",
|
|
41
|
+
caption: "nx:text-xs nx:font-normal nx:text-text-secondary",
|
|
42
|
+
overline: "nx:text-xs nx:font-medium nx:uppercase nx:tracking-widest nx:text-text-tertiary",
|
|
43
|
+
label: "nx:text-sm nx:font-medium"
|
|
44
|
+
},
|
|
45
|
+
color: {
|
|
46
|
+
primary: "nx:text-text-primary",
|
|
47
|
+
secondary: "nx:text-text-secondary",
|
|
48
|
+
tertiary: "nx:text-text-tertiary",
|
|
49
|
+
muted: "nx:text-text-muted",
|
|
50
|
+
accent: "nx:text-accent-primary",
|
|
51
|
+
danger: "nx:text-status-negative",
|
|
52
|
+
success: "nx:text-status-positive",
|
|
53
|
+
inherit: "nx:text-inherit"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
variant: "body1",
|
|
58
|
+
color: "primary"
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
var variantTagMap = {
|
|
62
|
+
h1: "h1",
|
|
63
|
+
h2: "h2",
|
|
64
|
+
h3: "h3",
|
|
65
|
+
h4: "h4",
|
|
66
|
+
h5: "h5",
|
|
67
|
+
h6: "h6",
|
|
68
|
+
body1: "p",
|
|
69
|
+
body2: "p",
|
|
70
|
+
caption: "span",
|
|
71
|
+
overline: "span",
|
|
72
|
+
label: "label"
|
|
73
|
+
};
|
|
74
|
+
var Typography = React__namespace.forwardRef(
|
|
75
|
+
({ className, variant, color, as, asChild = false, children, ...props }, ref) => {
|
|
76
|
+
if (asChild) {
|
|
77
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
reactSlot.Slot,
|
|
79
|
+
{
|
|
80
|
+
ref,
|
|
81
|
+
className: chunkQJNQCLMV_js.cn(typographyVariants({ variant, color }), className),
|
|
82
|
+
...props,
|
|
83
|
+
children
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
const Tag = as ?? variantTagMap[variant ?? "body1"] ?? "span";
|
|
88
|
+
return React__namespace.createElement(
|
|
89
|
+
Tag,
|
|
90
|
+
{
|
|
91
|
+
ref,
|
|
92
|
+
className: chunkQJNQCLMV_js.cn(typographyVariants({ variant, color }), className),
|
|
93
|
+
...props
|
|
94
|
+
},
|
|
95
|
+
children
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
Typography.displayName = "Typography";
|
|
100
|
+
|
|
101
|
+
exports.Typography = Typography;
|
|
102
|
+
exports.typographyVariants = typographyVariants;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { cn } from './chunks/chunk-XALPBGSC.mjs';
|
|
2
|
+
import './chunks/chunk-CVYXRSXT.mjs';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var typographyVariants = cva("nx:text-text-primary", {
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
h1: "nx:text-4xl nx:font-bold nx:tracking-tight",
|
|
12
|
+
h2: "nx:text-3xl nx:font-bold nx:tracking-tight",
|
|
13
|
+
h3: "nx:text-2xl nx:font-semibold",
|
|
14
|
+
h4: "nx:text-xl nx:font-semibold",
|
|
15
|
+
h5: "nx:text-lg nx:font-semibold",
|
|
16
|
+
h6: "nx:text-base nx:font-semibold",
|
|
17
|
+
body1: "nx:text-base nx:font-normal nx:leading-relaxed",
|
|
18
|
+
body2: "nx:text-sm nx:font-normal nx:leading-relaxed",
|
|
19
|
+
caption: "nx:text-xs nx:font-normal nx:text-text-secondary",
|
|
20
|
+
overline: "nx:text-xs nx:font-medium nx:uppercase nx:tracking-widest nx:text-text-tertiary",
|
|
21
|
+
label: "nx:text-sm nx:font-medium"
|
|
22
|
+
},
|
|
23
|
+
color: {
|
|
24
|
+
primary: "nx:text-text-primary",
|
|
25
|
+
secondary: "nx:text-text-secondary",
|
|
26
|
+
tertiary: "nx:text-text-tertiary",
|
|
27
|
+
muted: "nx:text-text-muted",
|
|
28
|
+
accent: "nx:text-accent-primary",
|
|
29
|
+
danger: "nx:text-status-negative",
|
|
30
|
+
success: "nx:text-status-positive",
|
|
31
|
+
inherit: "nx:text-inherit"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
variant: "body1",
|
|
36
|
+
color: "primary"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
var variantTagMap = {
|
|
40
|
+
h1: "h1",
|
|
41
|
+
h2: "h2",
|
|
42
|
+
h3: "h3",
|
|
43
|
+
h4: "h4",
|
|
44
|
+
h5: "h5",
|
|
45
|
+
h6: "h6",
|
|
46
|
+
body1: "p",
|
|
47
|
+
body2: "p",
|
|
48
|
+
caption: "span",
|
|
49
|
+
overline: "span",
|
|
50
|
+
label: "label"
|
|
51
|
+
};
|
|
52
|
+
var Typography = React.forwardRef(
|
|
53
|
+
({ className, variant, color, as, asChild = false, children, ...props }, ref) => {
|
|
54
|
+
if (asChild) {
|
|
55
|
+
return /* @__PURE__ */ jsx(
|
|
56
|
+
Slot,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
className: cn(typographyVariants({ variant, color }), className),
|
|
60
|
+
...props,
|
|
61
|
+
children
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
const Tag = as ?? variantTagMap[variant ?? "body1"] ?? "span";
|
|
66
|
+
return React.createElement(
|
|
67
|
+
Tag,
|
|
68
|
+
{
|
|
69
|
+
ref,
|
|
70
|
+
className: cn(typographyVariants({ variant, color }), className),
|
|
71
|
+
...props
|
|
72
|
+
},
|
|
73
|
+
children
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
Typography.displayName = "Typography";
|
|
78
|
+
|
|
79
|
+
export { Typography, typographyVariants };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { MutableRefObject, ComponentType, ReactNode, FunctionComponent } from 'react';
|
|
2
|
+
|
|
3
|
+
type ModalLayout = 'default' | 'bottom-sheet' | 'slide-left' | 'slide-right' | 'full-page' | 'full-page-reverse' | 'draggable';
|
|
4
|
+
interface AnimationOptions {
|
|
5
|
+
name?: string;
|
|
6
|
+
mobile?: string;
|
|
7
|
+
delay?: number;
|
|
8
|
+
duration?: number;
|
|
9
|
+
timingFunc?: string;
|
|
10
|
+
leaveTimingFunc?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DefaultModalOption {
|
|
13
|
+
animation?: AnimationOptions;
|
|
14
|
+
dimCloseEnable?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface ModalType {
|
|
17
|
+
id: string;
|
|
18
|
+
props: Record<string, unknown>;
|
|
19
|
+
component: ComponentType<Record<string, unknown>>;
|
|
20
|
+
isUpdate?: boolean;
|
|
21
|
+
close?: (modalId: string, isAnimation?: boolean) => void;
|
|
22
|
+
onOpen?: (value: ModalType) => void;
|
|
23
|
+
onClose?: () => void;
|
|
24
|
+
resolve: <T>(value: T) => void;
|
|
25
|
+
reject: (reason?: unknown) => void;
|
|
26
|
+
}
|
|
27
|
+
interface ModalTemplatePropsType {
|
|
28
|
+
className?: string;
|
|
29
|
+
layout?: ModalLayout;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
showDim?: boolean;
|
|
32
|
+
title?: ReactNode | string;
|
|
33
|
+
desc?: ReactNode | string;
|
|
34
|
+
dimClose?: boolean;
|
|
35
|
+
animation?: AnimationOptions;
|
|
36
|
+
close: (isAnimation?: boolean) => void | Promise<unknown>;
|
|
37
|
+
}
|
|
38
|
+
interface ModalPropsType<T = unknown> {
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
className?: string;
|
|
41
|
+
layout?: ModalLayout;
|
|
42
|
+
componentName?: string;
|
|
43
|
+
animation?: AnimationOptions;
|
|
44
|
+
close: (isAnimation?: boolean) => void | Promise<unknown>;
|
|
45
|
+
resolve: (value: T, useClose?: boolean) => void;
|
|
46
|
+
}
|
|
47
|
+
interface DefaultModalPropsType {
|
|
48
|
+
id?: string;
|
|
49
|
+
duplicateCheck?: boolean;
|
|
50
|
+
portalId?: string;
|
|
51
|
+
scrollEnable?: boolean;
|
|
52
|
+
isToggle?: boolean;
|
|
53
|
+
isAlone?: boolean;
|
|
54
|
+
clickOutSideRef?: MutableRefObject<HTMLElement>;
|
|
55
|
+
componentName?: string;
|
|
56
|
+
animation?: AnimationOptions;
|
|
57
|
+
layout?: ModalLayout;
|
|
58
|
+
disableEscapeKeyPress?: boolean;
|
|
59
|
+
onOpen?: (value: ModalType) => void;
|
|
60
|
+
onClose?: () => void;
|
|
61
|
+
}
|
|
62
|
+
type PropsOf<T> = T extends FunctionComponent<infer P> ? P : undefined;
|
|
63
|
+
type ModalPropsOf<T> = Omit<PropsOf<T>, 'close' | 'resolve'>;
|
|
64
|
+
type RequiredKeys<T> = {
|
|
65
|
+
[K in keyof T]: T extends Record<K, T[K]> ? K : never;
|
|
66
|
+
}[keyof T];
|
|
67
|
+
type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
68
|
+
type OpenModalPropsAndOptions<T> = HasRequiredKeys<ModalPropsOf<T>> extends true ? ModalPropsOf<T> & DefaultModalPropsType : (ModalPropsOf<T> & DefaultModalPropsType) | undefined;
|
|
69
|
+
type OpenModalProps<T> = HasRequiredKeys<ModalPropsOf<T>> extends true ? {
|
|
70
|
+
component: T;
|
|
71
|
+
props: ModalPropsOf<T>;
|
|
72
|
+
options?: DefaultModalPropsType;
|
|
73
|
+
} : {
|
|
74
|
+
component: T;
|
|
75
|
+
props?: ModalPropsOf<T>;
|
|
76
|
+
options?: DefaultModalPropsType;
|
|
77
|
+
};
|
|
78
|
+
interface OpenModal {
|
|
79
|
+
<T extends ComponentType<any>>(params: OpenModalProps<T>): Promise<unknown>;
|
|
80
|
+
<T extends ComponentType<any>>(component: T, props?: OpenModalPropsAndOptions<T>): Promise<unknown>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type OpenModalParams<T extends ComponentType<any> = ComponentType<any>> = {
|
|
84
|
+
component: T;
|
|
85
|
+
props?: ModalPropsOf<T>;
|
|
86
|
+
options?: DefaultModalPropsType;
|
|
87
|
+
};
|
|
88
|
+
interface ModalFn {
|
|
89
|
+
<T extends ComponentType<any>>(params: OpenModalParams<T>): Promise<unknown>;
|
|
90
|
+
close: (id: string, isAnimation?: boolean) => void;
|
|
91
|
+
check: (params: {
|
|
92
|
+
componentName: string;
|
|
93
|
+
onlyLastCheck?: boolean;
|
|
94
|
+
} | {
|
|
95
|
+
modalId: string;
|
|
96
|
+
onlyLastCheck?: boolean;
|
|
97
|
+
}) => boolean;
|
|
98
|
+
reset: () => void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* const { modal, toggleModal, scrollModal, closeModal } = useModal();
|
|
104
|
+
*
|
|
105
|
+
* const result = await modal({
|
|
106
|
+
* component: MyModal,
|
|
107
|
+
* props: { title: 'Hello' },
|
|
108
|
+
* options: { animation: { name: 'pop-fade', duration: 300 } },
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare function useModal(): {
|
|
113
|
+
modal: ModalFn;
|
|
114
|
+
toggleModal: <T extends ComponentType<any>>(params: OpenModalParams<T>) => Promise<unknown>;
|
|
115
|
+
toggleOneModal: <T extends ComponentType<any>>(params: OpenModalParams<T>) => Promise<unknown>;
|
|
116
|
+
scrollModal: <T extends ComponentType<any>>(params: OpenModalParams<T>) => Promise<unknown>;
|
|
117
|
+
closeModal: (id: string, isAnimation?: boolean) => void;
|
|
118
|
+
checkModal: (params: {
|
|
119
|
+
componentName: string;
|
|
120
|
+
onlyLastCheck?: boolean;
|
|
121
|
+
} | {
|
|
122
|
+
modalId: string;
|
|
123
|
+
onlyLastCheck?: boolean;
|
|
124
|
+
}) => boolean;
|
|
125
|
+
resetModal: () => void;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export { type AnimationOptions as A, type DefaultModalPropsType as D, type ModalLayout as M, type OpenModal as O, type ModalPropsType as a, type ModalTemplatePropsType as b, type ModalType as c, type DefaultModalOption as d, type ModalPropsOf as e, useModal as u };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { MutableRefObject, ComponentType, ReactNode, FunctionComponent } from 'react';
|
|
2
|
+
|
|
3
|
+
type ModalLayout = 'default' | 'bottom-sheet' | 'slide-left' | 'slide-right' | 'full-page' | 'full-page-reverse' | 'draggable';
|
|
4
|
+
interface AnimationOptions {
|
|
5
|
+
name?: string;
|
|
6
|
+
mobile?: string;
|
|
7
|
+
delay?: number;
|
|
8
|
+
duration?: number;
|
|
9
|
+
timingFunc?: string;
|
|
10
|
+
leaveTimingFunc?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DefaultModalOption {
|
|
13
|
+
animation?: AnimationOptions;
|
|
14
|
+
dimCloseEnable?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface ModalType {
|
|
17
|
+
id: string;
|
|
18
|
+
props: Record<string, unknown>;
|
|
19
|
+
component: ComponentType<Record<string, unknown>>;
|
|
20
|
+
isUpdate?: boolean;
|
|
21
|
+
close?: (modalId: string, isAnimation?: boolean) => void;
|
|
22
|
+
onOpen?: (value: ModalType) => void;
|
|
23
|
+
onClose?: () => void;
|
|
24
|
+
resolve: <T>(value: T) => void;
|
|
25
|
+
reject: (reason?: unknown) => void;
|
|
26
|
+
}
|
|
27
|
+
interface ModalTemplatePropsType {
|
|
28
|
+
className?: string;
|
|
29
|
+
layout?: ModalLayout;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
showDim?: boolean;
|
|
32
|
+
title?: ReactNode | string;
|
|
33
|
+
desc?: ReactNode | string;
|
|
34
|
+
dimClose?: boolean;
|
|
35
|
+
animation?: AnimationOptions;
|
|
36
|
+
close: (isAnimation?: boolean) => void | Promise<unknown>;
|
|
37
|
+
}
|
|
38
|
+
interface ModalPropsType<T = unknown> {
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
className?: string;
|
|
41
|
+
layout?: ModalLayout;
|
|
42
|
+
componentName?: string;
|
|
43
|
+
animation?: AnimationOptions;
|
|
44
|
+
close: (isAnimation?: boolean) => void | Promise<unknown>;
|
|
45
|
+
resolve: (value: T, useClose?: boolean) => void;
|
|
46
|
+
}
|
|
47
|
+
interface DefaultModalPropsType {
|
|
48
|
+
id?: string;
|
|
49
|
+
duplicateCheck?: boolean;
|
|
50
|
+
portalId?: string;
|
|
51
|
+
scrollEnable?: boolean;
|
|
52
|
+
isToggle?: boolean;
|
|
53
|
+
isAlone?: boolean;
|
|
54
|
+
clickOutSideRef?: MutableRefObject<HTMLElement>;
|
|
55
|
+
componentName?: string;
|
|
56
|
+
animation?: AnimationOptions;
|
|
57
|
+
layout?: ModalLayout;
|
|
58
|
+
disableEscapeKeyPress?: boolean;
|
|
59
|
+
onOpen?: (value: ModalType) => void;
|
|
60
|
+
onClose?: () => void;
|
|
61
|
+
}
|
|
62
|
+
type PropsOf<T> = T extends FunctionComponent<infer P> ? P : undefined;
|
|
63
|
+
type ModalPropsOf<T> = Omit<PropsOf<T>, 'close' | 'resolve'>;
|
|
64
|
+
type RequiredKeys<T> = {
|
|
65
|
+
[K in keyof T]: T extends Record<K, T[K]> ? K : never;
|
|
66
|
+
}[keyof T];
|
|
67
|
+
type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
68
|
+
type OpenModalPropsAndOptions<T> = HasRequiredKeys<ModalPropsOf<T>> extends true ? ModalPropsOf<T> & DefaultModalPropsType : (ModalPropsOf<T> & DefaultModalPropsType) | undefined;
|
|
69
|
+
type OpenModalProps<T> = HasRequiredKeys<ModalPropsOf<T>> extends true ? {
|
|
70
|
+
component: T;
|
|
71
|
+
props: ModalPropsOf<T>;
|
|
72
|
+
options?: DefaultModalPropsType;
|
|
73
|
+
} : {
|
|
74
|
+
component: T;
|
|
75
|
+
props?: ModalPropsOf<T>;
|
|
76
|
+
options?: DefaultModalPropsType;
|
|
77
|
+
};
|
|
78
|
+
interface OpenModal {
|
|
79
|
+
<T extends ComponentType<any>>(params: OpenModalProps<T>): Promise<unknown>;
|
|
80
|
+
<T extends ComponentType<any>>(component: T, props?: OpenModalPropsAndOptions<T>): Promise<unknown>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type OpenModalParams<T extends ComponentType<any> = ComponentType<any>> = {
|
|
84
|
+
component: T;
|
|
85
|
+
props?: ModalPropsOf<T>;
|
|
86
|
+
options?: DefaultModalPropsType;
|
|
87
|
+
};
|
|
88
|
+
interface ModalFn {
|
|
89
|
+
<T extends ComponentType<any>>(params: OpenModalParams<T>): Promise<unknown>;
|
|
90
|
+
close: (id: string, isAnimation?: boolean) => void;
|
|
91
|
+
check: (params: {
|
|
92
|
+
componentName: string;
|
|
93
|
+
onlyLastCheck?: boolean;
|
|
94
|
+
} | {
|
|
95
|
+
modalId: string;
|
|
96
|
+
onlyLastCheck?: boolean;
|
|
97
|
+
}) => boolean;
|
|
98
|
+
reset: () => void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* const { modal, toggleModal, scrollModal, closeModal } = useModal();
|
|
104
|
+
*
|
|
105
|
+
* const result = await modal({
|
|
106
|
+
* component: MyModal,
|
|
107
|
+
* props: { title: 'Hello' },
|
|
108
|
+
* options: { animation: { name: 'pop-fade', duration: 300 } },
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare function useModal(): {
|
|
113
|
+
modal: ModalFn;
|
|
114
|
+
toggleModal: <T extends ComponentType<any>>(params: OpenModalParams<T>) => Promise<unknown>;
|
|
115
|
+
toggleOneModal: <T extends ComponentType<any>>(params: OpenModalParams<T>) => Promise<unknown>;
|
|
116
|
+
scrollModal: <T extends ComponentType<any>>(params: OpenModalParams<T>) => Promise<unknown>;
|
|
117
|
+
closeModal: (id: string, isAnimation?: boolean) => void;
|
|
118
|
+
checkModal: (params: {
|
|
119
|
+
componentName: string;
|
|
120
|
+
onlyLastCheck?: boolean;
|
|
121
|
+
} | {
|
|
122
|
+
modalId: string;
|
|
123
|
+
onlyLastCheck?: boolean;
|
|
124
|
+
}) => boolean;
|
|
125
|
+
resetModal: () => void;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export { type AnimationOptions as A, type DefaultModalPropsType as D, type ModalLayout as M, type OpenModal as O, type ModalPropsType as a, type ModalTemplatePropsType as b, type ModalType as c, type DefaultModalOption as d, type ModalPropsOf as e, useModal as u };
|