@pixpilot/shadcn-ui 2.1.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button-extended/ButtonExtended.d.cts +2 -2
- package/dist/button-extended/ButtonExtended.d.ts +2 -2
- package/dist/card/Card.d.ts +3 -3
- package/dist/color-select/ColorSelect.d.cts +2 -2
- package/dist/color-select/ColorSelect.d.ts +2 -2
- package/dist/confirmation-dialog/ConfirmationDialog.cjs +2 -2
- package/dist/confirmation-dialog/ConfirmationDialog.js +2 -2
- package/dist/confirmation-dialog/mcp.js +3 -3
- package/dist/content-card/ContentCard.d.cts +2 -2
- package/dist/content-card/ContentCard.d.ts +2 -2
- package/dist/date-picker/DatePicker.d.cts +2 -2
- package/dist/date-picker/DatePicker.d.ts +2 -2
- package/dist/dialog/Dialog.d.cts +5 -5
- package/dist/dialog/Dialog.d.ts +5 -5
- package/dist/dialog/mcp.js +1 -1
- package/dist/dialog-registry/dialog-registry.cjs +24 -0
- package/dist/dialog-registry/dialog-registry.d.cts +23 -0
- package/dist/dialog-registry/dialog-registry.d.ts +23 -0
- package/dist/dialog-registry/dialog-registry.js +23 -0
- package/dist/dialog-registry/index.d.cts +3 -0
- package/dist/dialog-registry/index.d.ts +3 -0
- package/dist/dialog-registry/mcp.js +51 -0
- package/dist/dialog-registry/register-dialog.cjs +20 -0
- package/dist/dialog-registry/register-dialog.d.cts +21 -0
- package/dist/dialog-registry/register-dialog.d.ts +21 -0
- package/dist/dialog-registry/register-dialog.js +20 -0
- package/dist/dialog-registry/show-dialog.cjs +17 -0
- package/dist/dialog-registry/show-dialog.d.cts +18 -0
- package/dist/dialog-registry/show-dialog.d.ts +18 -0
- package/dist/dialog-registry/show-dialog.js +17 -0
- package/dist/drawer/Drawer.cjs +57 -0
- package/dist/drawer/Drawer.d.cts +40 -0
- package/dist/drawer/Drawer.d.ts +40 -0
- package/dist/drawer/Drawer.js +49 -0
- package/dist/drawer/index.d.cts +3 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/drawer/index.js +4 -0
- package/dist/drawer/mcp.js +55 -0
- package/dist/drawer-registry/drawer-registry.cjs +28 -0
- package/dist/drawer-registry/drawer-registry.d.cts +27 -0
- package/dist/drawer-registry/drawer-registry.d.ts +27 -0
- package/dist/drawer-registry/drawer-registry.js +27 -0
- package/dist/drawer-registry/index.d.cts +3 -0
- package/dist/drawer-registry/index.d.ts +3 -0
- package/dist/drawer-registry/mcp.js +51 -0
- package/dist/drawer-registry/register-drawer.cjs +20 -0
- package/dist/drawer-registry/register-drawer.d.cts +21 -0
- package/dist/drawer-registry/register-drawer.d.ts +21 -0
- package/dist/drawer-registry/register-drawer.js +20 -0
- package/dist/drawer-registry/show-drawer.cjs +17 -0
- package/dist/drawer-registry/show-drawer.d.cts +18 -0
- package/dist/drawer-registry/show-drawer.d.ts +18 -0
- package/dist/drawer-registry/show-drawer.js +17 -0
- package/dist/file-upload/FileUpload.d.cts +2 -2
- package/dist/file-upload/FileUpload.d.ts +2 -2
- package/dist/file-upload-inline/FileUploadInline.d.cts +2 -2
- package/dist/file-upload-inline/FileUploadInline.d.ts +2 -2
- package/dist/file-upload-root/FileUploadRoot.d.cts +2 -2
- package/dist/file-upload-root/FileUploadRoot.d.ts +2 -2
- package/dist/generated/mcp-registry.js +38 -32
- package/dist/index.cjs +32 -9
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +11 -5
- package/dist/input/Input.d.cts +2 -2
- package/dist/overlay-provider/OverlayProvider.cjs +47 -0
- package/dist/overlay-provider/OverlayProvider.d.cts +18 -0
- package/dist/overlay-provider/OverlayProvider.d.ts +18 -0
- package/dist/overlay-provider/OverlayProvider.js +42 -0
- package/dist/overlay-provider/index.d.cts +2 -0
- package/dist/overlay-provider/index.d.ts +2 -0
- package/dist/overlay-provider/mcp.js +35 -0
- package/dist/overlay-provider/overlay-registry.cjs +104 -0
- package/dist/overlay-provider/overlay-registry.d.cts +91 -0
- package/dist/overlay-provider/overlay-registry.d.ts +91 -0
- package/dist/overlay-provider/overlay-registry.js +94 -0
- package/dist/overlay-provider/types.d.cts +20 -0
- package/dist/overlay-provider/types.d.ts +20 -0
- package/dist/rating/Rating.d.cts +3 -3
- package/dist/rating/Rating.d.ts +3 -3
- package/dist/select/Select.d.cts +2 -2
- package/dist/select/Select.d.ts +2 -2
- package/dist/tags-input/TagsInput.d.cts +2 -2
- package/dist/tags-input/TagsInput.d.ts +2 -2
- package/dist/tags-input/TagsInputInline.d.cts +2 -2
- package/dist/tags-input/TagsInputInline.d.ts +2 -2
- package/dist/theme-toggle/ThemeModeDropdown.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeDropdown.d.ts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchInside.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchInside.d.ts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.ts +2 -2
- package/dist/theme-toggle/ThemeModeToggleButton.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeToggleButton.d.ts +2 -2
- package/package.json +3 -3
- package/dist/dialog-provider/DialogProvider.cjs +0 -40
- package/dist/dialog-provider/DialogProvider.d.cts +0 -28
- package/dist/dialog-provider/DialogProvider.d.ts +0 -28
- package/dist/dialog-provider/DialogProvider.js +0 -36
- package/dist/dialog-provider/dialog-registry.cjs +0 -100
- package/dist/dialog-provider/dialog-registry.d.cts +0 -150
- package/dist/dialog-provider/dialog-registry.d.ts +0 -150
- package/dist/dialog-provider/dialog-registry.js +0 -93
- package/dist/dialog-provider/index.d.cts +0 -4
- package/dist/dialog-provider/index.d.ts +0 -4
- package/dist/dialog-provider/mcp.js +0 -24
- package/dist/dialog-provider/register-dialog.cjs +0 -64
- package/dist/dialog-provider/register-dialog.d.cts +0 -98
- package/dist/dialog-provider/register-dialog.d.ts +0 -98
- package/dist/dialog-provider/register-dialog.js +0 -61
- package/dist/dialog-provider/show-dialog.cjs +0 -30
- package/dist/dialog-provider/show-dialog.d.cts +0 -24
- package/dist/dialog-provider/show-dialog.d.ts +0 -24
- package/dist/dialog-provider/show-dialog.js +0 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime24 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/theme-toggle/ThemeModeSwitchOutside.d.ts
|
|
4
4
|
interface ThemeModeSwitchOutsideProps {
|
|
@@ -23,7 +23,7 @@ interface ThemeModeSwitchOutsideProps {
|
|
|
23
23
|
* Icons flank the switch control on either side.
|
|
24
24
|
* Pure component - requires value and onChange props.
|
|
25
25
|
*/
|
|
26
|
-
declare function ThemeModeSwitchOutside(props: ThemeModeSwitchOutsideProps):
|
|
26
|
+
declare function ThemeModeSwitchOutside(props: ThemeModeSwitchOutsideProps): react_jsx_runtime24.JSX.Element;
|
|
27
27
|
declare namespace ThemeModeSwitchOutside {
|
|
28
28
|
var displayName: string;
|
|
29
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/theme-toggle/ThemeModeToggleButton.d.ts
|
|
4
4
|
interface ThemeModeToggleButtonProps {
|
|
@@ -14,7 +14,7 @@ interface ThemeModeToggleButtonProps {
|
|
|
14
14
|
* Light/Dark toggle button.
|
|
15
15
|
* Pure component - toggles between light and dark.
|
|
16
16
|
*/
|
|
17
|
-
declare function ThemeModeToggleButton(props: ThemeModeToggleButtonProps):
|
|
17
|
+
declare function ThemeModeToggleButton(props: ThemeModeToggleButtonProps): react_jsx_runtime14.JSX.Element;
|
|
18
18
|
declare namespace ThemeModeToggleButton {
|
|
19
19
|
var displayName: string;
|
|
20
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime25 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/theme-toggle/ThemeModeToggleButton.d.ts
|
|
4
4
|
interface ThemeModeToggleButtonProps {
|
|
@@ -14,7 +14,7 @@ interface ThemeModeToggleButtonProps {
|
|
|
14
14
|
* Light/Dark toggle button.
|
|
15
15
|
* Pure component - toggles between light and dark.
|
|
16
16
|
*/
|
|
17
|
-
declare function ThemeModeToggleButton(props: ThemeModeToggleButtonProps):
|
|
17
|
+
declare function ThemeModeToggleButton(props: ThemeModeToggleButtonProps): react_jsx_runtime25.JSX.Element;
|
|
18
18
|
declare namespace ThemeModeToggleButton {
|
|
19
19
|
var displayName: string;
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/shadcn-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"description": "Custom UI components and utilities built with shadcn/ui.",
|
|
6
6
|
"author": "m.doaie <m.doaie@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react-responsive": "^10.0.1",
|
|
56
56
|
"sonner": "2.0.7",
|
|
57
57
|
"zod": "^4.3.6",
|
|
58
|
-
"@pixpilot/shadcn": "
|
|
58
|
+
"@pixpilot/shadcn": "2.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@storybook/react": "^8.6.18",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"tsx": "^4.21.0",
|
|
73
73
|
"typescript": "^5.9.3",
|
|
74
74
|
"@internal/eslint-config": "0.3.0",
|
|
75
|
+
"@internal/hooks": "0.0.0",
|
|
75
76
|
"@internal/prettier-config": "0.0.1",
|
|
76
77
|
"@internal/mcp": "0.0.0",
|
|
77
|
-
"@internal/hooks": "0.0.0",
|
|
78
78
|
"@internal/tsconfig": "0.1.0",
|
|
79
79
|
"@internal/tsdown-config": "0.1.0",
|
|
80
80
|
"@internal/vitest-config": "0.1.0"
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let react = require("react");
|
|
3
|
-
react = require_rolldown_runtime.__toESM(react);
|
|
4
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
-
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
6
|
-
let __ebay_nice_modal_react = require("@ebay/nice-modal-react");
|
|
7
|
-
__ebay_nice_modal_react = require_rolldown_runtime.__toESM(__ebay_nice_modal_react);
|
|
8
|
-
|
|
9
|
-
//#region src/dialog-provider/DialogProvider.tsx
|
|
10
|
-
const DialogProviderMountedContext = (0, react.createContext)(false);
|
|
11
|
-
/**
|
|
12
|
-
* Guards against nested DialogProviders, which would break NiceModal.
|
|
13
|
-
*
|
|
14
|
-
* NiceModal.Provider creates its own isolated modal state store via React context.
|
|
15
|
-
* If a second NiceModal.Provider mounts anywhere below the first, it shadows the
|
|
16
|
-
* outer one — meaning modals registered/shown inside the inner provider are
|
|
17
|
-
* invisible to the outer one, and vice versa.
|
|
18
|
-
*
|
|
19
|
-
* This becomes especially bad with navigation: when you navigate away and back,
|
|
20
|
-
* the inner provider unmounts and remounts, creating a brand-new store. Any
|
|
21
|
-
* in-flight `showConfirmDialog` calls still hold a reference to the old store's
|
|
22
|
-
* dispatch, so their promises never resolve and the modal tree is left in a
|
|
23
|
-
* broken state. This has been detected when navigating in a Next.js app,
|
|
24
|
-
* but it could happen in any React app that conditionally mounts/unmounts providers.
|
|
25
|
-
*
|
|
26
|
-
* The fix: track whether a DialogProvider is already mounted above us in the tree.
|
|
27
|
-
* If one is, skip rendering NiceModal.Provider entirely and just pass children
|
|
28
|
-
* through — making the inner DialogProvider a safe no-op.
|
|
29
|
-
*/
|
|
30
|
-
const DialogProvider = (props) => {
|
|
31
|
-
if ((0, react.use)(DialogProviderMountedContext)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: props.children });
|
|
32
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogProviderMountedContext.Provider, {
|
|
33
|
-
value: true,
|
|
34
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ebay_nice_modal_react.default.Provider, { children: props.children })
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
DialogProvider.displayName = "DialogProvider";
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
exports.DialogProvider = DialogProvider;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
//#region src/dialog-provider/DialogProvider.d.ts
|
|
4
|
-
interface DialogProviderProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Guards against nested DialogProviders, which would break NiceModal.
|
|
9
|
-
*
|
|
10
|
-
* NiceModal.Provider creates its own isolated modal state store via React context.
|
|
11
|
-
* If a second NiceModal.Provider mounts anywhere below the first, it shadows the
|
|
12
|
-
* outer one — meaning modals registered/shown inside the inner provider are
|
|
13
|
-
* invisible to the outer one, and vice versa.
|
|
14
|
-
*
|
|
15
|
-
* This becomes especially bad with navigation: when you navigate away and back,
|
|
16
|
-
* the inner provider unmounts and remounts, creating a brand-new store. Any
|
|
17
|
-
* in-flight `showConfirmDialog` calls still hold a reference to the old store's
|
|
18
|
-
* dispatch, so their promises never resolve and the modal tree is left in a
|
|
19
|
-
* broken state. This has been detected when navigating in a Next.js app,
|
|
20
|
-
* but it could happen in any React app that conditionally mounts/unmounts providers.
|
|
21
|
-
*
|
|
22
|
-
* The fix: track whether a DialogProvider is already mounted above us in the tree.
|
|
23
|
-
* If one is, skip rendering NiceModal.Provider entirely and just pass children
|
|
24
|
-
* through — making the inner DialogProvider a safe no-op.
|
|
25
|
-
*/
|
|
26
|
-
declare const DialogProvider: React.FC<DialogProviderProps>;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { DialogProvider, DialogProviderProps };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
//#region src/dialog-provider/DialogProvider.d.ts
|
|
4
|
-
interface DialogProviderProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Guards against nested DialogProviders, which would break NiceModal.
|
|
9
|
-
*
|
|
10
|
-
* NiceModal.Provider creates its own isolated modal state store via React context.
|
|
11
|
-
* If a second NiceModal.Provider mounts anywhere below the first, it shadows the
|
|
12
|
-
* outer one — meaning modals registered/shown inside the inner provider are
|
|
13
|
-
* invisible to the outer one, and vice versa.
|
|
14
|
-
*
|
|
15
|
-
* This becomes especially bad with navigation: when you navigate away and back,
|
|
16
|
-
* the inner provider unmounts and remounts, creating a brand-new store. Any
|
|
17
|
-
* in-flight `showConfirmDialog` calls still hold a reference to the old store's
|
|
18
|
-
* dispatch, so their promises never resolve and the modal tree is left in a
|
|
19
|
-
* broken state. This has been detected when navigating in a Next.js app,
|
|
20
|
-
* but it could happen in any React app that conditionally mounts/unmounts providers.
|
|
21
|
-
*
|
|
22
|
-
* The fix: track whether a DialogProvider is already mounted above us in the tree.
|
|
23
|
-
* If one is, skip rendering NiceModal.Provider entirely and just pass children
|
|
24
|
-
* through — making the inner DialogProvider a safe no-op.
|
|
25
|
-
*/
|
|
26
|
-
declare const DialogProvider: React.FC<DialogProviderProps>;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { DialogProvider, DialogProviderProps };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React, { createContext, use } from "react";
|
|
2
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
-
import NiceModal from "@ebay/nice-modal-react";
|
|
4
|
-
|
|
5
|
-
//#region src/dialog-provider/DialogProvider.tsx
|
|
6
|
-
const DialogProviderMountedContext = createContext(false);
|
|
7
|
-
/**
|
|
8
|
-
* Guards against nested DialogProviders, which would break NiceModal.
|
|
9
|
-
*
|
|
10
|
-
* NiceModal.Provider creates its own isolated modal state store via React context.
|
|
11
|
-
* If a second NiceModal.Provider mounts anywhere below the first, it shadows the
|
|
12
|
-
* outer one — meaning modals registered/shown inside the inner provider are
|
|
13
|
-
* invisible to the outer one, and vice versa.
|
|
14
|
-
*
|
|
15
|
-
* This becomes especially bad with navigation: when you navigate away and back,
|
|
16
|
-
* the inner provider unmounts and remounts, creating a brand-new store. Any
|
|
17
|
-
* in-flight `showConfirmDialog` calls still hold a reference to the old store's
|
|
18
|
-
* dispatch, so their promises never resolve and the modal tree is left in a
|
|
19
|
-
* broken state. This has been detected when navigating in a Next.js app,
|
|
20
|
-
* but it could happen in any React app that conditionally mounts/unmounts providers.
|
|
21
|
-
*
|
|
22
|
-
* The fix: track whether a DialogProvider is already mounted above us in the tree.
|
|
23
|
-
* If one is, skip rendering NiceModal.Provider entirely and just pass children
|
|
24
|
-
* through — making the inner DialogProvider a safe no-op.
|
|
25
|
-
*/
|
|
26
|
-
const DialogProvider = (props) => {
|
|
27
|
-
if (use(DialogProviderMountedContext)) return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
28
|
-
return /* @__PURE__ */ jsx(DialogProviderMountedContext.Provider, {
|
|
29
|
-
value: true,
|
|
30
|
-
children: /* @__PURE__ */ jsx(NiceModal.Provider, { children: props.children })
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
DialogProvider.displayName = "DialogProvider";
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
export { DialogProvider };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_register_dialog = require('./register-dialog.cjs');
|
|
3
|
-
const require_show_dialog = require('./show-dialog.cjs');
|
|
4
|
-
let __ebay_nice_modal_react = require("@ebay/nice-modal-react");
|
|
5
|
-
__ebay_nice_modal_react = require_rolldown_runtime.__toESM(__ebay_nice_modal_react);
|
|
6
|
-
|
|
7
|
-
//#region src/dialog-provider/dialog-registry.ts
|
|
8
|
-
const useDialog = __ebay_nice_modal_react.useModal;
|
|
9
|
-
function createDialog(component) {
|
|
10
|
-
const CreatedDialog = __ebay_nice_modal_react.default.create(component);
|
|
11
|
-
return Object.assign(CreatedDialog, {
|
|
12
|
-
show: async (props) => __ebay_nice_modal_react.default.show(CreatedDialog, props),
|
|
13
|
-
hide: async () => __ebay_nice_modal_react.default.hide(CreatedDialog),
|
|
14
|
-
remove: () => {
|
|
15
|
-
__ebay_nice_modal_react.default.remove(CreatedDialog);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Hides a registered dialog by id.
|
|
21
|
-
*
|
|
22
|
-
* Use this when the caller only knows the dialog id. If you already have the
|
|
23
|
-
* controller returned by `dialog.register(...)`, prefer `controller.hide()`.
|
|
24
|
-
*
|
|
25
|
-
* @param id - Dialog id that was previously registered.
|
|
26
|
-
* @returns A promise from NiceModal that resolves after the hide action is
|
|
27
|
-
* dispatched.
|
|
28
|
-
*
|
|
29
|
-
* Usage:
|
|
30
|
-
* ```ts
|
|
31
|
-
* await hideDialog('project-dialog');
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
async function hideDialog(id) {
|
|
35
|
-
return __ebay_nice_modal_react.default.hide(id);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Removes a registered dialog instance from the NiceModal render tree by id.
|
|
39
|
-
*
|
|
40
|
-
* This does not unregister the dialog component; it only removes the mounted
|
|
41
|
-
* instance from the modal tree.
|
|
42
|
-
*
|
|
43
|
-
* @param id - Dialog id that was previously registered.
|
|
44
|
-
* Usage:
|
|
45
|
-
* ```ts
|
|
46
|
-
* removeDialog('project-dialog');
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
function removeDialog(id) {
|
|
50
|
-
__ebay_nice_modal_react.default.remove(id);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Unregisters a dialog component by id.
|
|
54
|
-
*
|
|
55
|
-
* Use this when a registered dialog should no longer be available through
|
|
56
|
-
* `showDialog(...)` or `dialog.show(...)`.
|
|
57
|
-
*
|
|
58
|
-
* @param id - Dialog id that was previously registered.
|
|
59
|
-
* Usage:
|
|
60
|
-
* ```ts
|
|
61
|
-
* unregisterDialog('project-dialog');
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
function unregisterDialog(id) {
|
|
65
|
-
(0, __ebay_nice_modal_react.unregister)(id);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Convenience registry facade for dialog operations.
|
|
69
|
-
*
|
|
70
|
-
* Use this when you prefer a single import with discoverable methods instead of
|
|
71
|
-
* importing `registerDialog`, `showDialog`, `hideDialog`, `removeDialog`, and
|
|
72
|
-
* `unregisterDialog` separately.
|
|
73
|
-
*
|
|
74
|
-
* @returns An object of dialog helper functions.
|
|
75
|
-
*
|
|
76
|
-
* Usage:
|
|
77
|
-
* ```ts
|
|
78
|
-
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
79
|
-
* await projectDialog.show({ projectId: 'project-1' });
|
|
80
|
-
* await dialog.show('project-dialog', { projectId: 'project-2' });
|
|
81
|
-
* dialog.unregister('project-dialog');
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
const dialog = {
|
|
85
|
-
create: createDialog,
|
|
86
|
-
hide: hideDialog,
|
|
87
|
-
register: require_register_dialog.registerDialog,
|
|
88
|
-
remove: removeDialog,
|
|
89
|
-
show: require_show_dialog.showDialog,
|
|
90
|
-
unregister: unregisterDialog,
|
|
91
|
-
useDialog
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
//#endregion
|
|
95
|
-
exports.createDialog = createDialog;
|
|
96
|
-
exports.dialog = dialog;
|
|
97
|
-
exports.hideDialog = hideDialog;
|
|
98
|
-
exports.removeDialog = removeDialog;
|
|
99
|
-
exports.unregisterDialog = unregisterDialog;
|
|
100
|
-
exports.useDialog = useDialog;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { registerDialog } from "./register-dialog.cjs";
|
|
2
|
-
import { showDialog } from "./show-dialog.cjs";
|
|
3
|
-
import { ComponentType, FC } from "react";
|
|
4
|
-
import { NiceModalHocProps, useModal } from "@ebay/nice-modal-react";
|
|
5
|
-
|
|
6
|
-
//#region src/dialog-provider/dialog-registry.d.ts
|
|
7
|
-
declare const useDialog: typeof useModal;
|
|
8
|
-
interface CreatedDialog<TProps extends object> extends FC<TProps & NiceModalHocProps> {
|
|
9
|
-
show: <TResult = unknown>(props?: TProps) => Promise<TResult>;
|
|
10
|
-
hide: <TResult = unknown>() => Promise<TResult>;
|
|
11
|
-
remove: () => void;
|
|
12
|
-
}
|
|
13
|
-
declare function createDialog<TProps extends object>(component: ComponentType<TProps>): CreatedDialog<TProps>;
|
|
14
|
-
/**
|
|
15
|
-
* Hides a registered dialog by id.
|
|
16
|
-
*
|
|
17
|
-
* Use this when the caller only knows the dialog id. If you already have the
|
|
18
|
-
* controller returned by `dialog.register(...)`, prefer `controller.hide()`.
|
|
19
|
-
*
|
|
20
|
-
* @param id - Dialog id that was previously registered.
|
|
21
|
-
* @returns A promise from NiceModal that resolves after the hide action is
|
|
22
|
-
* dispatched.
|
|
23
|
-
*
|
|
24
|
-
* Usage:
|
|
25
|
-
* ```ts
|
|
26
|
-
* await hideDialog('project-dialog');
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
declare function hideDialog<TResult = unknown>(id: string): Promise<TResult>;
|
|
30
|
-
/**
|
|
31
|
-
* Removes a registered dialog instance from the NiceModal render tree by id.
|
|
32
|
-
*
|
|
33
|
-
* This does not unregister the dialog component; it only removes the mounted
|
|
34
|
-
* instance from the modal tree.
|
|
35
|
-
*
|
|
36
|
-
* @param id - Dialog id that was previously registered.
|
|
37
|
-
* Usage:
|
|
38
|
-
* ```ts
|
|
39
|
-
* removeDialog('project-dialog');
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
declare function removeDialog(id: string): void;
|
|
43
|
-
/**
|
|
44
|
-
* Unregisters a dialog component by id.
|
|
45
|
-
*
|
|
46
|
-
* Use this when a registered dialog should no longer be available through
|
|
47
|
-
* `showDialog(...)` or `dialog.show(...)`.
|
|
48
|
-
*
|
|
49
|
-
* @param id - Dialog id that was previously registered.
|
|
50
|
-
* Usage:
|
|
51
|
-
* ```ts
|
|
52
|
-
* unregisterDialog('project-dialog');
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
declare function unregisterDialog(id: string): void;
|
|
56
|
-
interface DialogRegistry {
|
|
57
|
-
/**
|
|
58
|
-
* Registers a dialog component and returns a typed controller.
|
|
59
|
-
*
|
|
60
|
-
* @returns A controller with `id`, `show`, `hide`, and `remove`.
|
|
61
|
-
*
|
|
62
|
-
* Usage:
|
|
63
|
-
* ```ts
|
|
64
|
-
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
register: typeof registerDialog;
|
|
68
|
-
/**
|
|
69
|
-
* Creates a custom NiceModal dialog component with controller helpers.
|
|
70
|
-
*
|
|
71
|
-
* Use this for dialogs that need to control `useDialog()` directly. For simple
|
|
72
|
-
* shadcn dialogs, prefer `dialog.register(...)`.
|
|
73
|
-
*
|
|
74
|
-
* Usage:
|
|
75
|
-
* ```ts
|
|
76
|
-
* const CustomDialog = dialog.create((props) => {
|
|
77
|
-
* const modal = dialog.useDialog();
|
|
78
|
-
* return <Dialog open={modal.visible} onOpenChange={(open) => !open && modal.hide()} />;
|
|
79
|
-
* });
|
|
80
|
-
*
|
|
81
|
-
* await CustomDialog.show({ projectId: 'project-1' });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
create: typeof createDialog;
|
|
85
|
-
/**
|
|
86
|
-
* Shows a registered dialog by id with generic props.
|
|
87
|
-
*
|
|
88
|
-
* @returns A promise resolved by the dialog component.
|
|
89
|
-
*
|
|
90
|
-
* Usage:
|
|
91
|
-
* ```ts
|
|
92
|
-
* await dialog.show('project-dialog', { projectId: 'project-1' });
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
show: typeof showDialog;
|
|
96
|
-
/**
|
|
97
|
-
* Hides a registered dialog by id.
|
|
98
|
-
*
|
|
99
|
-
* @returns A promise from NiceModal after the hide action is dispatched.
|
|
100
|
-
*
|
|
101
|
-
* Usage:
|
|
102
|
-
* ```ts
|
|
103
|
-
* await dialog.hide('project-dialog');
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
hide: typeof hideDialog;
|
|
107
|
-
/**
|
|
108
|
-
* Removes a registered dialog instance from the render tree by id.
|
|
109
|
-
*
|
|
110
|
-
* @returns Nothing.
|
|
111
|
-
*
|
|
112
|
-
* Usage:
|
|
113
|
-
* ```ts
|
|
114
|
-
* dialog.remove('project-dialog');
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
remove: typeof removeDialog;
|
|
118
|
-
/**
|
|
119
|
-
* Unregisters a dialog component by id.
|
|
120
|
-
*
|
|
121
|
-
* @returns Nothing.
|
|
122
|
-
*
|
|
123
|
-
* Usage:
|
|
124
|
-
* ```ts
|
|
125
|
-
* dialog.unregister('project-dialog');
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
unregister: typeof unregisterDialog;
|
|
129
|
-
useDialog: typeof useDialog;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Convenience registry facade for dialog operations.
|
|
133
|
-
*
|
|
134
|
-
* Use this when you prefer a single import with discoverable methods instead of
|
|
135
|
-
* importing `registerDialog`, `showDialog`, `hideDialog`, `removeDialog`, and
|
|
136
|
-
* `unregisterDialog` separately.
|
|
137
|
-
*
|
|
138
|
-
* @returns An object of dialog helper functions.
|
|
139
|
-
*
|
|
140
|
-
* Usage:
|
|
141
|
-
* ```ts
|
|
142
|
-
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
143
|
-
* await projectDialog.show({ projectId: 'project-1' });
|
|
144
|
-
* await dialog.show('project-dialog', { projectId: 'project-2' });
|
|
145
|
-
* dialog.unregister('project-dialog');
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
declare const dialog: DialogRegistry;
|
|
149
|
-
//#endregion
|
|
150
|
-
export { CreatedDialog, DialogRegistry, createDialog, dialog, hideDialog, removeDialog, unregisterDialog, useDialog };
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { registerDialog } from "./register-dialog.js";
|
|
2
|
-
import { showDialog } from "./show-dialog.js";
|
|
3
|
-
import { ComponentType, FC } from "react";
|
|
4
|
-
import { NiceModalHocProps, useModal } from "@ebay/nice-modal-react";
|
|
5
|
-
|
|
6
|
-
//#region src/dialog-provider/dialog-registry.d.ts
|
|
7
|
-
declare const useDialog: typeof useModal;
|
|
8
|
-
interface CreatedDialog<TProps extends object> extends FC<TProps & NiceModalHocProps> {
|
|
9
|
-
show: <TResult = unknown>(props?: TProps) => Promise<TResult>;
|
|
10
|
-
hide: <TResult = unknown>() => Promise<TResult>;
|
|
11
|
-
remove: () => void;
|
|
12
|
-
}
|
|
13
|
-
declare function createDialog<TProps extends object>(component: ComponentType<TProps>): CreatedDialog<TProps>;
|
|
14
|
-
/**
|
|
15
|
-
* Hides a registered dialog by id.
|
|
16
|
-
*
|
|
17
|
-
* Use this when the caller only knows the dialog id. If you already have the
|
|
18
|
-
* controller returned by `dialog.register(...)`, prefer `controller.hide()`.
|
|
19
|
-
*
|
|
20
|
-
* @param id - Dialog id that was previously registered.
|
|
21
|
-
* @returns A promise from NiceModal that resolves after the hide action is
|
|
22
|
-
* dispatched.
|
|
23
|
-
*
|
|
24
|
-
* Usage:
|
|
25
|
-
* ```ts
|
|
26
|
-
* await hideDialog('project-dialog');
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
declare function hideDialog<TResult = unknown>(id: string): Promise<TResult>;
|
|
30
|
-
/**
|
|
31
|
-
* Removes a registered dialog instance from the NiceModal render tree by id.
|
|
32
|
-
*
|
|
33
|
-
* This does not unregister the dialog component; it only removes the mounted
|
|
34
|
-
* instance from the modal tree.
|
|
35
|
-
*
|
|
36
|
-
* @param id - Dialog id that was previously registered.
|
|
37
|
-
* Usage:
|
|
38
|
-
* ```ts
|
|
39
|
-
* removeDialog('project-dialog');
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
declare function removeDialog(id: string): void;
|
|
43
|
-
/**
|
|
44
|
-
* Unregisters a dialog component by id.
|
|
45
|
-
*
|
|
46
|
-
* Use this when a registered dialog should no longer be available through
|
|
47
|
-
* `showDialog(...)` or `dialog.show(...)`.
|
|
48
|
-
*
|
|
49
|
-
* @param id - Dialog id that was previously registered.
|
|
50
|
-
* Usage:
|
|
51
|
-
* ```ts
|
|
52
|
-
* unregisterDialog('project-dialog');
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
declare function unregisterDialog(id: string): void;
|
|
56
|
-
interface DialogRegistry {
|
|
57
|
-
/**
|
|
58
|
-
* Registers a dialog component and returns a typed controller.
|
|
59
|
-
*
|
|
60
|
-
* @returns A controller with `id`, `show`, `hide`, and `remove`.
|
|
61
|
-
*
|
|
62
|
-
* Usage:
|
|
63
|
-
* ```ts
|
|
64
|
-
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
register: typeof registerDialog;
|
|
68
|
-
/**
|
|
69
|
-
* Creates a custom NiceModal dialog component with controller helpers.
|
|
70
|
-
*
|
|
71
|
-
* Use this for dialogs that need to control `useDialog()` directly. For simple
|
|
72
|
-
* shadcn dialogs, prefer `dialog.register(...)`.
|
|
73
|
-
*
|
|
74
|
-
* Usage:
|
|
75
|
-
* ```ts
|
|
76
|
-
* const CustomDialog = dialog.create((props) => {
|
|
77
|
-
* const modal = dialog.useDialog();
|
|
78
|
-
* return <Dialog open={modal.visible} onOpenChange={(open) => !open && modal.hide()} />;
|
|
79
|
-
* });
|
|
80
|
-
*
|
|
81
|
-
* await CustomDialog.show({ projectId: 'project-1' });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
create: typeof createDialog;
|
|
85
|
-
/**
|
|
86
|
-
* Shows a registered dialog by id with generic props.
|
|
87
|
-
*
|
|
88
|
-
* @returns A promise resolved by the dialog component.
|
|
89
|
-
*
|
|
90
|
-
* Usage:
|
|
91
|
-
* ```ts
|
|
92
|
-
* await dialog.show('project-dialog', { projectId: 'project-1' });
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
show: typeof showDialog;
|
|
96
|
-
/**
|
|
97
|
-
* Hides a registered dialog by id.
|
|
98
|
-
*
|
|
99
|
-
* @returns A promise from NiceModal after the hide action is dispatched.
|
|
100
|
-
*
|
|
101
|
-
* Usage:
|
|
102
|
-
* ```ts
|
|
103
|
-
* await dialog.hide('project-dialog');
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
hide: typeof hideDialog;
|
|
107
|
-
/**
|
|
108
|
-
* Removes a registered dialog instance from the render tree by id.
|
|
109
|
-
*
|
|
110
|
-
* @returns Nothing.
|
|
111
|
-
*
|
|
112
|
-
* Usage:
|
|
113
|
-
* ```ts
|
|
114
|
-
* dialog.remove('project-dialog');
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
remove: typeof removeDialog;
|
|
118
|
-
/**
|
|
119
|
-
* Unregisters a dialog component by id.
|
|
120
|
-
*
|
|
121
|
-
* @returns Nothing.
|
|
122
|
-
*
|
|
123
|
-
* Usage:
|
|
124
|
-
* ```ts
|
|
125
|
-
* dialog.unregister('project-dialog');
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
unregister: typeof unregisterDialog;
|
|
129
|
-
useDialog: typeof useDialog;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Convenience registry facade for dialog operations.
|
|
133
|
-
*
|
|
134
|
-
* Use this when you prefer a single import with discoverable methods instead of
|
|
135
|
-
* importing `registerDialog`, `showDialog`, `hideDialog`, `removeDialog`, and
|
|
136
|
-
* `unregisterDialog` separately.
|
|
137
|
-
*
|
|
138
|
-
* @returns An object of dialog helper functions.
|
|
139
|
-
*
|
|
140
|
-
* Usage:
|
|
141
|
-
* ```ts
|
|
142
|
-
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
143
|
-
* await projectDialog.show({ projectId: 'project-1' });
|
|
144
|
-
* await dialog.show('project-dialog', { projectId: 'project-2' });
|
|
145
|
-
* dialog.unregister('project-dialog');
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
declare const dialog: DialogRegistry;
|
|
149
|
-
//#endregion
|
|
150
|
-
export { CreatedDialog, DialogRegistry, createDialog, dialog, hideDialog, removeDialog, unregisterDialog, useDialog };
|