@pixpilot/shadcn-ui 1.32.1 → 1.33.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.d.cts +2 -2
- package/dist/Card.d.cts +3 -3
- package/dist/ColorSelect.d.cts +2 -2
- package/dist/ContentCard.d.cts +2 -2
- package/dist/DatePicker.d.cts +2 -2
- package/dist/Rating.d.cts +3 -3
- package/dist/Select.d.cts +2 -2
- package/dist/confirmation-dialog/confirmation-dialogs.cjs +3 -5
- package/dist/confirmation-dialog/confirmation-dialogs.js +3 -3
- package/dist/confirmation-dialog/index.cjs +0 -1
- package/dist/confirmation-dialog/index.d.cts +1 -2
- package/dist/confirmation-dialog/index.d.ts +1 -2
- package/dist/confirmation-dialog/index.js +0 -1
- package/dist/dialog/Dialog.d.cts +5 -5
- package/dist/dialog/Dialog.d.ts +5 -5
- package/dist/{confirmation-dialog → dialog-provider}/DialogProvider.cjs +1 -1
- package/dist/{confirmation-dialog → dialog-provider}/DialogProvider.d.cts +1 -1
- package/dist/{confirmation-dialog → dialog-provider}/DialogProvider.d.ts +1 -1
- package/dist/{confirmation-dialog → dialog-provider}/DialogProvider.js +1 -1
- package/dist/dialog-provider/dialog-registry.cjs +85 -0
- package/dist/dialog-provider/dialog-registry.d.cts +124 -0
- package/dist/dialog-provider/dialog-registry.d.ts +124 -0
- package/dist/dialog-provider/dialog-registry.js +80 -0
- package/dist/dialog-provider/index.cjs +4 -0
- package/dist/dialog-provider/index.d.cts +4 -0
- package/dist/dialog-provider/index.d.ts +4 -0
- package/dist/dialog-provider/index.js +4 -0
- package/dist/dialog-provider/register-dialog.cjs +41 -0
- package/dist/dialog-provider/register-dialog.d.cts +89 -0
- package/dist/dialog-provider/register-dialog.d.ts +89 -0
- package/dist/dialog-provider/register-dialog.js +39 -0
- package/dist/dialog-provider/show-dialog.cjs +30 -0
- package/dist/dialog-provider/show-dialog.d.cts +24 -0
- package/dist/dialog-provider/show-dialog.d.ts +24 -0
- package/dist/dialog-provider/show-dialog.js +28 -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/index.cjs +11 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -2
- package/dist/input/Input.d.cts +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/theme-toggle/ThemeModeDropdown.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchInside.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeSwitchOutside.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeToggleButton.d.cts +2 -2
- package/dist/theme-toggle/ThemeModeToggleButton.d.ts +2 -2
- package/package.json +1 -1
package/dist/Button.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
import { Button, Tooltip, TooltipContent, TooltipTrigger, buttonVariants } from "@pixpilot/shadcn";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { VariantProps } from "class-variance-authority";
|
|
@@ -27,7 +27,7 @@ interface ButtonProps extends React.ComponentProps<typeof Button>, VariantProps<
|
|
|
27
27
|
}
|
|
28
28
|
declare function Button$1(props: ButtonProps & {
|
|
29
29
|
ref?: React.Ref<HTMLButtonElement>;
|
|
30
|
-
}):
|
|
30
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
31
31
|
declare namespace Button$1 {
|
|
32
32
|
var displayName: string;
|
|
33
33
|
}
|
package/dist/Card.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
2
2
|
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@pixpilot/shadcn";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
@@ -6,10 +6,10 @@ import React from "react";
|
|
|
6
6
|
declare function CardTitle$1({
|
|
7
7
|
className,
|
|
8
8
|
...props
|
|
9
|
-
}: React.ComponentProps<typeof CardTitle>):
|
|
9
|
+
}: React.ComponentProps<typeof CardTitle>): react_jsx_runtime1.JSX.Element;
|
|
10
10
|
declare function CardHeader$1({
|
|
11
11
|
className,
|
|
12
12
|
...props
|
|
13
|
-
}: React.ComponentProps<typeof CardHeader>):
|
|
13
|
+
}: React.ComponentProps<typeof CardHeader>): react_jsx_runtime1.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader$1 as CardHeader, CardTitle$1 as CardTitle };
|
package/dist/ColorSelect.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
2
2
|
import { Select, SelectContent } from "@pixpilot/shadcn";
|
|
3
3
|
import React, { ComponentProps } from "react";
|
|
4
4
|
|
|
@@ -16,6 +16,6 @@ type BaseColorSelectProps = {
|
|
|
16
16
|
placeholder?: string;
|
|
17
17
|
keyboardMode?: 'cycle' | 'dropdown';
|
|
18
18
|
} & Omit<ComponentProps<typeof Select>, 'value' | 'onValueChange' | 'children'>;
|
|
19
|
-
declare function ColorSelect(props: BaseColorSelectProps):
|
|
19
|
+
declare function ColorSelect(props: BaseColorSelectProps): react_jsx_runtime4.JSX.Element;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { BaseColorSelectProps, ColorSelect, ColorSelectOption };
|
package/dist/ContentCard.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Card } from "./Card.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
3
|
import React, { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/ContentCard.d.ts
|
|
@@ -8,7 +8,7 @@ interface SectionCardProps extends React.ComponentProps<typeof Card> {
|
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
marginBottom?: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function ContentCard(props: SectionCardProps):
|
|
11
|
+
declare function ContentCard(props: SectionCardProps): react_jsx_runtime5.JSX.Element;
|
|
12
12
|
declare namespace ContentCard {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
package/dist/DatePicker.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
2
2
|
import { Calendar } from "@pixpilot/shadcn";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ type DatePickerProps = {
|
|
|
9
9
|
onChange?: (date: Date | undefined) => void;
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
} & Omit<ComponentProps<typeof Calendar>, 'selected' | 'onSelect' | 'mode'>;
|
|
12
|
-
declare function DatePicker(props: DatePickerProps):
|
|
12
|
+
declare function DatePicker(props: DatePickerProps): react_jsx_runtime6.JSX.Element;
|
|
13
13
|
declare namespace DatePicker {
|
|
14
14
|
var displayName: string;
|
|
15
15
|
}
|
package/dist/Rating.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
import { VariantProps } from "class-variance-authority";
|
|
4
4
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
@@ -35,7 +35,7 @@ declare function RatingButton({
|
|
|
35
35
|
index,
|
|
36
36
|
className,
|
|
37
37
|
...props
|
|
38
|
-
}: RatingButtonProps):
|
|
38
|
+
}: RatingButtonProps): react_jsx_runtime7.JSX.Element;
|
|
39
39
|
declare function Rating({
|
|
40
40
|
value: valueProp,
|
|
41
41
|
defaultValue,
|
|
@@ -53,6 +53,6 @@ declare function Rating({
|
|
|
53
53
|
children,
|
|
54
54
|
id,
|
|
55
55
|
...props
|
|
56
|
-
}: React$1.PropsWithChildren<RatingProps>):
|
|
56
|
+
}: React$1.PropsWithChildren<RatingProps>): react_jsx_runtime7.JSX.Element;
|
|
57
57
|
//#endregion
|
|
58
58
|
export { Rating, RatingButton, RatingButtonProps, RatingColor, RatingOption, RatingProps };
|
package/dist/Select.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
2
|
import { Select, SelectContent } from "@pixpilot/shadcn";
|
|
3
3
|
import React, { ComponentProps } from "react";
|
|
4
4
|
|
|
@@ -51,6 +51,6 @@ type BaseSelectProps = {
|
|
|
51
51
|
required?: boolean;
|
|
52
52
|
className?: string;
|
|
53
53
|
} & Omit<ComponentProps<typeof Select>, 'value' | 'onValueChange' | 'children' | 'disabled' | 'name' | 'required'>;
|
|
54
|
-
declare function Select$1(props: BaseSelectProps):
|
|
54
|
+
declare function Select$1(props: BaseSelectProps): react_jsx_runtime9.JSX.Element;
|
|
55
55
|
//#endregion
|
|
56
56
|
export { Select$1 as Select, SelectContentProps, SelectOption };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_dialog_registry = require('../dialog-provider/dialog-registry.cjs');
|
|
2
|
+
require('../dialog-provider/index.cjs');
|
|
2
3
|
const require_ConfirmationDialog = require('./ConfirmationDialog.cjs');
|
|
3
|
-
let __ebay_nice_modal_react = require("@ebay/nice-modal-react");
|
|
4
|
-
__ebay_nice_modal_react = require_rolldown_runtime.__toESM(__ebay_nice_modal_react);
|
|
5
4
|
|
|
6
5
|
//#region src/confirmation-dialog/confirmation-dialogs.tsx
|
|
7
6
|
async function showConfirmDialog(props) {
|
|
8
7
|
const id = crypto.randomUUID();
|
|
9
|
-
|
|
10
|
-
return __ebay_nice_modal_react.default.show(id, props);
|
|
8
|
+
return require_dialog_registry.dialog.register(id, require_ConfirmationDialog.default).show(props);
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { dialog } from "../dialog-provider/dialog-registry.js";
|
|
2
|
+
import "../dialog-provider/index.js";
|
|
1
3
|
import ConfirmationDialog_default from "./ConfirmationDialog.js";
|
|
2
|
-
import NiceModal from "@ebay/nice-modal-react";
|
|
3
4
|
|
|
4
5
|
//#region src/confirmation-dialog/confirmation-dialogs.tsx
|
|
5
6
|
async function showConfirmDialog(props) {
|
|
6
7
|
const id = crypto.randomUUID();
|
|
7
|
-
|
|
8
|
-
return NiceModal.show(id, props);
|
|
8
|
+
return dialog.register(id, ConfirmationDialog_default).show(props);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { ConfirmationDialogProps, ConfirmationDialogVariant } from "./ConfirmationDialog.cjs";
|
|
2
|
-
import { showConfirmDialog } from "./confirmation-dialogs.cjs";
|
|
3
|
-
import { DialogProvider, DialogProviderProps } from "./DialogProvider.cjs";
|
|
2
|
+
import { showConfirmDialog } from "./confirmation-dialogs.cjs";
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { ConfirmationDialogProps, ConfirmationDialogVariant } from "./ConfirmationDialog.js";
|
|
2
|
-
import { showConfirmDialog } from "./confirmation-dialogs.js";
|
|
3
|
-
import { DialogProvider, DialogProviderProps } from "./DialogProvider.js";
|
|
2
|
+
import { showConfirmDialog } from "./confirmation-dialogs.js";
|
package/dist/dialog/Dialog.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
2
|
import { DialogClose, DialogContent } from "@pixpilot/shadcn";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
|
|
@@ -10,18 +10,18 @@ declare const DialogContent$1: React$1.ForwardRefExoticComponent<DialogContentPr
|
|
|
10
10
|
declare function DialogHeader({
|
|
11
11
|
className,
|
|
12
12
|
...props
|
|
13
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
13
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime11.JSX.Element;
|
|
14
14
|
declare function DialogBody({
|
|
15
15
|
className,
|
|
16
16
|
...props
|
|
17
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
17
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime11.JSX.Element;
|
|
18
18
|
declare function DialogFooter({
|
|
19
19
|
className,
|
|
20
20
|
...props
|
|
21
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
21
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime11.JSX.Element;
|
|
22
22
|
declare function DialogClose$1({
|
|
23
23
|
className,
|
|
24
24
|
...props
|
|
25
|
-
}: React$1.ComponentPropsWithoutRef<typeof DialogClose>):
|
|
25
|
+
}: React$1.ComponentPropsWithoutRef<typeof DialogClose>): react_jsx_runtime11.JSX.Element;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { DialogBody, DialogClose$1 as DialogClose, DialogContent$1 as DialogContent, DialogContentProps, DialogFooter, DialogHeader };
|
package/dist/dialog/Dialog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DialogClose, DialogContent } from "@pixpilot/shadcn";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/dialog/Dialog.d.ts
|
|
6
6
|
interface DialogContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogContent> {
|
|
@@ -10,18 +10,18 @@ declare const DialogContent$1: React$1.ForwardRefExoticComponent<DialogContentPr
|
|
|
10
10
|
declare function DialogHeader$1({
|
|
11
11
|
className,
|
|
12
12
|
...props
|
|
13
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
13
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime11.JSX.Element;
|
|
14
14
|
declare function DialogBody({
|
|
15
15
|
className,
|
|
16
16
|
...props
|
|
17
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
17
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime11.JSX.Element;
|
|
18
18
|
declare function DialogFooter$1({
|
|
19
19
|
className,
|
|
20
20
|
...props
|
|
21
|
-
}: React$1.HTMLAttributes<HTMLDivElement>):
|
|
21
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime11.JSX.Element;
|
|
22
22
|
declare function DialogClose$1({
|
|
23
23
|
className,
|
|
24
24
|
...props
|
|
25
|
-
}: React$1.ComponentPropsWithoutRef<typeof DialogClose>):
|
|
25
|
+
}: React$1.ComponentPropsWithoutRef<typeof DialogClose>): react_jsx_runtime11.JSX.Element;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { DialogBody, DialogClose$1 as DialogClose, DialogContent$1 as DialogContent, DialogContentProps, DialogFooter$1 as DialogFooter, DialogHeader$1 as DialogHeader };
|
|
@@ -6,7 +6,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
6
6
|
let __ebay_nice_modal_react = require("@ebay/nice-modal-react");
|
|
7
7
|
__ebay_nice_modal_react = require_rolldown_runtime.__toESM(__ebay_nice_modal_react);
|
|
8
8
|
|
|
9
|
-
//#region src/
|
|
9
|
+
//#region src/dialog-provider/DialogProvider.tsx
|
|
10
10
|
const DialogProviderMountedContext = (0, react.createContext)(false);
|
|
11
11
|
/**
|
|
12
12
|
* Guards against nested DialogProviders, which would break NiceModal.
|
|
@@ -2,7 +2,7 @@ import React, { createContext, use } from "react";
|
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import NiceModal from "@ebay/nice-modal-react";
|
|
4
4
|
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/dialog-provider/DialogProvider.tsx
|
|
6
6
|
const DialogProviderMountedContext = createContext(false);
|
|
7
7
|
/**
|
|
8
8
|
* Guards against nested DialogProviders, which would break NiceModal.
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Hides a registered dialog by id.
|
|
10
|
+
*
|
|
11
|
+
* Use this when the caller only knows the dialog id. If you already have the
|
|
12
|
+
* controller returned by `dialog.register(...)`, prefer `controller.hide()`.
|
|
13
|
+
*
|
|
14
|
+
* @param id - Dialog id that was previously registered.
|
|
15
|
+
* @returns A promise from NiceModal that resolves after the hide action is
|
|
16
|
+
* dispatched.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* ```ts
|
|
20
|
+
* await hideDialog('project-dialog');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
async function hideDialog(id) {
|
|
24
|
+
return __ebay_nice_modal_react.default.hide(id);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Removes a registered dialog instance from the NiceModal render tree by id.
|
|
28
|
+
*
|
|
29
|
+
* This does not unregister the dialog component; it only removes the mounted
|
|
30
|
+
* instance from the modal tree.
|
|
31
|
+
*
|
|
32
|
+
* @param id - Dialog id that was previously registered.
|
|
33
|
+
* Usage:
|
|
34
|
+
* ```ts
|
|
35
|
+
* removeDialog('project-dialog');
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function removeDialog(id) {
|
|
39
|
+
__ebay_nice_modal_react.default.remove(id);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Unregisters a dialog component by id.
|
|
43
|
+
*
|
|
44
|
+
* Use this when a registered dialog should no longer be available through
|
|
45
|
+
* `showDialog(...)` or `dialog.show(...)`.
|
|
46
|
+
*
|
|
47
|
+
* @param id - Dialog id that was previously registered.
|
|
48
|
+
* Usage:
|
|
49
|
+
* ```ts
|
|
50
|
+
* unregisterDialog('project-dialog');
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
function unregisterDialog(id) {
|
|
54
|
+
(0, __ebay_nice_modal_react.unregister)(id);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Convenience registry facade for dialog operations.
|
|
58
|
+
*
|
|
59
|
+
* Use this when you prefer a single import with discoverable methods instead of
|
|
60
|
+
* importing `registerDialog`, `showDialog`, `hideDialog`, `removeDialog`, and
|
|
61
|
+
* `unregisterDialog` separately.
|
|
62
|
+
*
|
|
63
|
+
* @returns An object of dialog helper functions.
|
|
64
|
+
*
|
|
65
|
+
* Usage:
|
|
66
|
+
* ```ts
|
|
67
|
+
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
68
|
+
* await projectDialog.show({ projectId: 'project-1' });
|
|
69
|
+
* await dialog.show('project-dialog', { projectId: 'project-2' });
|
|
70
|
+
* dialog.unregister('project-dialog');
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
const dialog = {
|
|
74
|
+
hide: hideDialog,
|
|
75
|
+
register: require_register_dialog.registerDialog,
|
|
76
|
+
remove: removeDialog,
|
|
77
|
+
show: require_show_dialog.showDialog,
|
|
78
|
+
unregister: unregisterDialog
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.dialog = dialog;
|
|
83
|
+
exports.hideDialog = hideDialog;
|
|
84
|
+
exports.removeDialog = removeDialog;
|
|
85
|
+
exports.unregisterDialog = unregisterDialog;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { registerDialog } from "./register-dialog.cjs";
|
|
2
|
+
import { showDialog } from "./show-dialog.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/dialog-provider/dialog-registry.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hides a registered dialog by id.
|
|
8
|
+
*
|
|
9
|
+
* Use this when the caller only knows the dialog id. If you already have the
|
|
10
|
+
* controller returned by `dialog.register(...)`, prefer `controller.hide()`.
|
|
11
|
+
*
|
|
12
|
+
* @param id - Dialog id that was previously registered.
|
|
13
|
+
* @returns A promise from NiceModal that resolves after the hide action is
|
|
14
|
+
* dispatched.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* ```ts
|
|
18
|
+
* await hideDialog('project-dialog');
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function hideDialog<TResult = unknown>(id: string): Promise<TResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Removes a registered dialog instance from the NiceModal render tree by id.
|
|
24
|
+
*
|
|
25
|
+
* This does not unregister the dialog component; it only removes the mounted
|
|
26
|
+
* instance from the modal tree.
|
|
27
|
+
*
|
|
28
|
+
* @param id - Dialog id that was previously registered.
|
|
29
|
+
* Usage:
|
|
30
|
+
* ```ts
|
|
31
|
+
* removeDialog('project-dialog');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare function removeDialog(id: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Unregisters a dialog component by id.
|
|
37
|
+
*
|
|
38
|
+
* Use this when a registered dialog should no longer be available through
|
|
39
|
+
* `showDialog(...)` or `dialog.show(...)`.
|
|
40
|
+
*
|
|
41
|
+
* @param id - Dialog id that was previously registered.
|
|
42
|
+
* Usage:
|
|
43
|
+
* ```ts
|
|
44
|
+
* unregisterDialog('project-dialog');
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function unregisterDialog(id: string): void;
|
|
48
|
+
interface DialogRegistry {
|
|
49
|
+
/**
|
|
50
|
+
* Registers a dialog component and returns a typed controller.
|
|
51
|
+
*
|
|
52
|
+
* @returns A controller with `id`, `show`, `hide`, and `remove`.
|
|
53
|
+
*
|
|
54
|
+
* Usage:
|
|
55
|
+
* ```ts
|
|
56
|
+
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
register: typeof registerDialog;
|
|
60
|
+
/**
|
|
61
|
+
* Shows a registered dialog by id with generic props.
|
|
62
|
+
*
|
|
63
|
+
* @returns A promise resolved by the dialog component.
|
|
64
|
+
*
|
|
65
|
+
* Usage:
|
|
66
|
+
* ```ts
|
|
67
|
+
* await dialog.show('project-dialog', { projectId: 'project-1' });
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
show: typeof showDialog;
|
|
71
|
+
/**
|
|
72
|
+
* Hides a registered dialog by id.
|
|
73
|
+
*
|
|
74
|
+
* @returns A promise from NiceModal after the hide action is dispatched.
|
|
75
|
+
*
|
|
76
|
+
* Usage:
|
|
77
|
+
* ```ts
|
|
78
|
+
* await dialog.hide('project-dialog');
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
hide: typeof hideDialog;
|
|
82
|
+
/**
|
|
83
|
+
* Removes a registered dialog instance from the render tree by id.
|
|
84
|
+
*
|
|
85
|
+
* @returns Nothing.
|
|
86
|
+
*
|
|
87
|
+
* Usage:
|
|
88
|
+
* ```ts
|
|
89
|
+
* dialog.remove('project-dialog');
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
remove: typeof removeDialog;
|
|
93
|
+
/**
|
|
94
|
+
* Unregisters a dialog component by id.
|
|
95
|
+
*
|
|
96
|
+
* @returns Nothing.
|
|
97
|
+
*
|
|
98
|
+
* Usage:
|
|
99
|
+
* ```ts
|
|
100
|
+
* dialog.unregister('project-dialog');
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
unregister: typeof unregisterDialog;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Convenience registry facade for dialog operations.
|
|
107
|
+
*
|
|
108
|
+
* Use this when you prefer a single import with discoverable methods instead of
|
|
109
|
+
* importing `registerDialog`, `showDialog`, `hideDialog`, `removeDialog`, and
|
|
110
|
+
* `unregisterDialog` separately.
|
|
111
|
+
*
|
|
112
|
+
* @returns An object of dialog helper functions.
|
|
113
|
+
*
|
|
114
|
+
* Usage:
|
|
115
|
+
* ```ts
|
|
116
|
+
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
117
|
+
* await projectDialog.show({ projectId: 'project-1' });
|
|
118
|
+
* await dialog.show('project-dialog', { projectId: 'project-2' });
|
|
119
|
+
* dialog.unregister('project-dialog');
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare const dialog: DialogRegistry;
|
|
123
|
+
//#endregion
|
|
124
|
+
export { DialogRegistry, dialog, hideDialog, removeDialog, unregisterDialog };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { registerDialog } from "./register-dialog.js";
|
|
2
|
+
import { showDialog } from "./show-dialog.js";
|
|
3
|
+
|
|
4
|
+
//#region src/dialog-provider/dialog-registry.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hides a registered dialog by id.
|
|
8
|
+
*
|
|
9
|
+
* Use this when the caller only knows the dialog id. If you already have the
|
|
10
|
+
* controller returned by `dialog.register(...)`, prefer `controller.hide()`.
|
|
11
|
+
*
|
|
12
|
+
* @param id - Dialog id that was previously registered.
|
|
13
|
+
* @returns A promise from NiceModal that resolves after the hide action is
|
|
14
|
+
* dispatched.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* ```ts
|
|
18
|
+
* await hideDialog('project-dialog');
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function hideDialog<TResult = unknown>(id: string): Promise<TResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Removes a registered dialog instance from the NiceModal render tree by id.
|
|
24
|
+
*
|
|
25
|
+
* This does not unregister the dialog component; it only removes the mounted
|
|
26
|
+
* instance from the modal tree.
|
|
27
|
+
*
|
|
28
|
+
* @param id - Dialog id that was previously registered.
|
|
29
|
+
* Usage:
|
|
30
|
+
* ```ts
|
|
31
|
+
* removeDialog('project-dialog');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare function removeDialog(id: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Unregisters a dialog component by id.
|
|
37
|
+
*
|
|
38
|
+
* Use this when a registered dialog should no longer be available through
|
|
39
|
+
* `showDialog(...)` or `dialog.show(...)`.
|
|
40
|
+
*
|
|
41
|
+
* @param id - Dialog id that was previously registered.
|
|
42
|
+
* Usage:
|
|
43
|
+
* ```ts
|
|
44
|
+
* unregisterDialog('project-dialog');
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function unregisterDialog(id: string): void;
|
|
48
|
+
interface DialogRegistry {
|
|
49
|
+
/**
|
|
50
|
+
* Registers a dialog component and returns a typed controller.
|
|
51
|
+
*
|
|
52
|
+
* @returns A controller with `id`, `show`, `hide`, and `remove`.
|
|
53
|
+
*
|
|
54
|
+
* Usage:
|
|
55
|
+
* ```ts
|
|
56
|
+
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
register: typeof registerDialog;
|
|
60
|
+
/**
|
|
61
|
+
* Shows a registered dialog by id with generic props.
|
|
62
|
+
*
|
|
63
|
+
* @returns A promise resolved by the dialog component.
|
|
64
|
+
*
|
|
65
|
+
* Usage:
|
|
66
|
+
* ```ts
|
|
67
|
+
* await dialog.show('project-dialog', { projectId: 'project-1' });
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
show: typeof showDialog;
|
|
71
|
+
/**
|
|
72
|
+
* Hides a registered dialog by id.
|
|
73
|
+
*
|
|
74
|
+
* @returns A promise from NiceModal after the hide action is dispatched.
|
|
75
|
+
*
|
|
76
|
+
* Usage:
|
|
77
|
+
* ```ts
|
|
78
|
+
* await dialog.hide('project-dialog');
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
hide: typeof hideDialog;
|
|
82
|
+
/**
|
|
83
|
+
* Removes a registered dialog instance from the render tree by id.
|
|
84
|
+
*
|
|
85
|
+
* @returns Nothing.
|
|
86
|
+
*
|
|
87
|
+
* Usage:
|
|
88
|
+
* ```ts
|
|
89
|
+
* dialog.remove('project-dialog');
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
remove: typeof removeDialog;
|
|
93
|
+
/**
|
|
94
|
+
* Unregisters a dialog component by id.
|
|
95
|
+
*
|
|
96
|
+
* @returns Nothing.
|
|
97
|
+
*
|
|
98
|
+
* Usage:
|
|
99
|
+
* ```ts
|
|
100
|
+
* dialog.unregister('project-dialog');
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
unregister: typeof unregisterDialog;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Convenience registry facade for dialog operations.
|
|
107
|
+
*
|
|
108
|
+
* Use this when you prefer a single import with discoverable methods instead of
|
|
109
|
+
* importing `registerDialog`, `showDialog`, `hideDialog`, `removeDialog`, and
|
|
110
|
+
* `unregisterDialog` separately.
|
|
111
|
+
*
|
|
112
|
+
* @returns An object of dialog helper functions.
|
|
113
|
+
*
|
|
114
|
+
* Usage:
|
|
115
|
+
* ```ts
|
|
116
|
+
* const projectDialog = dialog.register('project-dialog', ProjectDialog);
|
|
117
|
+
* await projectDialog.show({ projectId: 'project-1' });
|
|
118
|
+
* await dialog.show('project-dialog', { projectId: 'project-2' });
|
|
119
|
+
* dialog.unregister('project-dialog');
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare const dialog: DialogRegistry;
|
|
123
|
+
//#endregion
|
|
124
|
+
export { DialogRegistry, dialog, hideDialog, removeDialog, unregisterDialog };
|