@crystallize/design-system 0.0.0 → 0.0.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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.js +9 -6
- package/dist/index.mjs +9 -6
- package/package.json +1 -1
- package/src/dialog/confirm-dialog.tsx +1 -1
- package/src/dialog/dialog.tsx +20 -9
package/CHANGELOG.md
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -55,21 +55,23 @@ declare const dialogContentStyles: (props?: ({
|
|
|
55
55
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
56
56
|
declare type DialogContentProps = DialogContentStylesProps & {
|
|
57
57
|
children: ReactNode;
|
|
58
|
-
} & Pick<DialogFuncProps, 'onEscapeKeyDown' | 'onInteractOutside' | 'onPointerDownOutside' | 'closable' | 'type'
|
|
59
|
-
declare function DialogContent({ children, closable, type, ...delegated }: DialogContentProps): JSX.Element;
|
|
58
|
+
} & Pick<DialogFuncProps, 'onEscapeKeyDown' | 'onInteractOutside' | 'onPointerDownOutside' | 'closable' | 'type' | 'className'> & DialogPrimitive.DialogContentProps;
|
|
59
|
+
declare function DialogContent({ children, closable, type, className, ...delegated }: DialogContentProps): JSX.Element;
|
|
60
60
|
declare type DialogTitleProps = JSX.IntrinsicAttributes & DialogPrimitive.DialogTitleProps & RefAttributes<HTMLHeadingElement>;
|
|
61
|
-
declare function DialogTitle(delegated: DialogTitleProps): JSX.Element;
|
|
61
|
+
declare function DialogTitle({ className, ...delegated }: DialogTitleProps): JSX.Element;
|
|
62
62
|
declare type DialogDescriptionProps = JSX.IntrinsicAttributes & DialogPrimitive.DialogDescriptionProps & RefAttributes<HTMLParagraphElement>;
|
|
63
63
|
declare function DialogDescription(delegated: DialogDescriptionProps): JSX.Element;
|
|
64
|
-
declare
|
|
64
|
+
declare const DialogRoot: react.FC<DialogPrimitive.DialogProps>;
|
|
65
|
+
declare type DialogBaseProps = React.ComponentProps<typeof DialogRoot> & {
|
|
65
66
|
children: ReactNode;
|
|
66
67
|
};
|
|
67
|
-
declare function DialogBase({ children }: DialogBaseProps): JSX.Element;
|
|
68
|
+
declare function DialogBase({ children, ...delegated }: DialogBaseProps): JSX.Element;
|
|
68
69
|
declare namespace DialogBase {
|
|
69
70
|
var Title: typeof DialogTitle;
|
|
70
71
|
var Trigger: react.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
71
72
|
var Description: typeof DialogDescription;
|
|
72
73
|
var Content: typeof DialogContent;
|
|
74
|
+
var Overlay: react.ForwardRefExoticComponent<DialogPrimitive.DialogOverlayProps & RefAttributes<HTMLDivElement>>;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
declare type DialogType = typeof DialogBase & DialogFuncProps;
|
package/dist/index.js
CHANGED
|
@@ -727,6 +727,7 @@ Button.displayName = "Button";
|
|
|
727
727
|
var destroyFns = [];
|
|
728
728
|
|
|
729
729
|
// src/dialog/dialog.tsx
|
|
730
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
730
731
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
731
732
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
732
733
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
@@ -745,7 +746,7 @@ var dialogContentStyles = (0, import_class_variance_authority2.cva)(
|
|
|
745
746
|
}
|
|
746
747
|
}
|
|
747
748
|
);
|
|
748
|
-
function DialogContent({ children, closable = true, type, ...delegated }) {
|
|
749
|
+
function DialogContent({ children, closable = true, type, className, ...delegated }) {
|
|
749
750
|
const withIcon = typeof type !== "undefined";
|
|
750
751
|
const IconComponent = type && IconMap[type];
|
|
751
752
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DialogPrimitive.Portal, {
|
|
@@ -754,7 +755,7 @@ function DialogContent({ children, closable = true, type, ...delegated }) {
|
|
|
754
755
|
className: "bg-black/30 fixed inset-0"
|
|
755
756
|
}),
|
|
756
757
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DialogPrimitive.Content, {
|
|
757
|
-
className: dialogContentStyles({ withIcon }),
|
|
758
|
+
className: dialogContentStyles({ withIcon, class: className }),
|
|
758
759
|
...delegated,
|
|
759
760
|
children: [
|
|
760
761
|
IconComponent && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconComponent, {
|
|
@@ -782,9 +783,9 @@ function DialogContent({ children, closable = true, type, ...delegated }) {
|
|
|
782
783
|
]
|
|
783
784
|
});
|
|
784
785
|
}
|
|
785
|
-
function DialogTitle(delegated) {
|
|
786
|
+
function DialogTitle({ className, ...delegated }) {
|
|
786
787
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DialogPrimitive.Title, {
|
|
787
|
-
className: "m-0 font-semibold text-2xl font-sans text-black-text",
|
|
788
|
+
className: (0, import_clsx5.default)("m-0 font-semibold text-2xl font-sans text-black-text", className),
|
|
788
789
|
...delegated
|
|
789
790
|
});
|
|
790
791
|
}
|
|
@@ -797,8 +798,9 @@ function DialogDescription(delegated) {
|
|
|
797
798
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
798
799
|
var DialogClose = DialogPrimitive.Close;
|
|
799
800
|
var DialogRoot = DialogPrimitive.Root;
|
|
800
|
-
function DialogBase({ children }) {
|
|
801
|
+
function DialogBase({ children, ...delegated }) {
|
|
801
802
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DialogRoot, {
|
|
803
|
+
...delegated,
|
|
802
804
|
children
|
|
803
805
|
});
|
|
804
806
|
}
|
|
@@ -806,6 +808,7 @@ DialogBase.Title = DialogTitle;
|
|
|
806
808
|
DialogBase.Trigger = DialogTrigger;
|
|
807
809
|
DialogBase.Description = DialogDescription;
|
|
808
810
|
DialogBase.Content = DialogContent;
|
|
811
|
+
DialogBase.Overlay = DialogPrimitive.Overlay;
|
|
809
812
|
|
|
810
813
|
// src/dialog/config.tsx
|
|
811
814
|
var import_react_dom = require("react-dom");
|
|
@@ -822,7 +825,7 @@ function ConfirmDialog({
|
|
|
822
825
|
okText = "OK",
|
|
823
826
|
onOk,
|
|
824
827
|
onCancel,
|
|
825
|
-
cancelText = "
|
|
828
|
+
cancelText = "Cancel",
|
|
826
829
|
onEscapeKeyDown,
|
|
827
830
|
onInteractOutside,
|
|
828
831
|
onPointerDownOutside,
|
package/dist/index.mjs
CHANGED
|
@@ -686,6 +686,7 @@ Button.displayName = "Button";
|
|
|
686
686
|
var destroyFns = [];
|
|
687
687
|
|
|
688
688
|
// src/dialog/dialog.tsx
|
|
689
|
+
import clsx5 from "clsx";
|
|
689
690
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
690
691
|
import { cva as cva2 } from "class-variance-authority";
|
|
691
692
|
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
@@ -704,7 +705,7 @@ var dialogContentStyles = cva2(
|
|
|
704
705
|
}
|
|
705
706
|
}
|
|
706
707
|
);
|
|
707
|
-
function DialogContent({ children, closable = true, type, ...delegated }) {
|
|
708
|
+
function DialogContent({ children, closable = true, type, className, ...delegated }) {
|
|
708
709
|
const withIcon = typeof type !== "undefined";
|
|
709
710
|
const IconComponent = type && IconMap[type];
|
|
710
711
|
return /* @__PURE__ */ jsxs10(DialogPrimitive.Portal, {
|
|
@@ -713,7 +714,7 @@ function DialogContent({ children, closable = true, type, ...delegated }) {
|
|
|
713
714
|
className: "bg-black/30 fixed inset-0"
|
|
714
715
|
}),
|
|
715
716
|
/* @__PURE__ */ jsxs10(DialogPrimitive.Content, {
|
|
716
|
-
className: dialogContentStyles({ withIcon }),
|
|
717
|
+
className: dialogContentStyles({ withIcon, class: className }),
|
|
717
718
|
...delegated,
|
|
718
719
|
children: [
|
|
719
720
|
IconComponent && /* @__PURE__ */ jsx16(IconComponent, {
|
|
@@ -741,9 +742,9 @@ function DialogContent({ children, closable = true, type, ...delegated }) {
|
|
|
741
742
|
]
|
|
742
743
|
});
|
|
743
744
|
}
|
|
744
|
-
function DialogTitle(delegated) {
|
|
745
|
+
function DialogTitle({ className, ...delegated }) {
|
|
745
746
|
return /* @__PURE__ */ jsx16(DialogPrimitive.Title, {
|
|
746
|
-
className: "m-0 font-semibold text-2xl font-sans text-black-text",
|
|
747
|
+
className: clsx5("m-0 font-semibold text-2xl font-sans text-black-text", className),
|
|
747
748
|
...delegated
|
|
748
749
|
});
|
|
749
750
|
}
|
|
@@ -756,8 +757,9 @@ function DialogDescription(delegated) {
|
|
|
756
757
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
757
758
|
var DialogClose = DialogPrimitive.Close;
|
|
758
759
|
var DialogRoot = DialogPrimitive.Root;
|
|
759
|
-
function DialogBase({ children }) {
|
|
760
|
+
function DialogBase({ children, ...delegated }) {
|
|
760
761
|
return /* @__PURE__ */ jsx16(DialogRoot, {
|
|
762
|
+
...delegated,
|
|
761
763
|
children
|
|
762
764
|
});
|
|
763
765
|
}
|
|
@@ -765,6 +767,7 @@ DialogBase.Title = DialogTitle;
|
|
|
765
767
|
DialogBase.Trigger = DialogTrigger;
|
|
766
768
|
DialogBase.Description = DialogDescription;
|
|
767
769
|
DialogBase.Content = DialogContent;
|
|
770
|
+
DialogBase.Overlay = DialogPrimitive.Overlay;
|
|
768
771
|
|
|
769
772
|
// src/dialog/config.tsx
|
|
770
773
|
import { unmountComponentAtNode, render as DOMRender } from "react-dom";
|
|
@@ -781,7 +784,7 @@ function ConfirmDialog({
|
|
|
781
784
|
okText = "OK",
|
|
782
785
|
onOk,
|
|
783
786
|
onCancel,
|
|
784
|
-
cancelText = "
|
|
787
|
+
cancelText = "Cancel",
|
|
785
788
|
onEscapeKeyDown,
|
|
786
789
|
onInteractOutside,
|
|
787
790
|
onPointerDownOutside,
|
package/package.json
CHANGED
package/src/dialog/dialog.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
2
1
|
import type { ReactNode, RefAttributes } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
4
|
import { cva, VariantProps } from 'class-variance-authority';
|
|
4
5
|
|
|
5
6
|
import { Button } from '../button';
|
|
@@ -26,9 +27,13 @@ const dialogContentStyles = cva(
|
|
|
26
27
|
|
|
27
28
|
type DialogContentProps = DialogContentStylesProps & {
|
|
28
29
|
children: ReactNode;
|
|
29
|
-
} & Pick<
|
|
30
|
+
} & Pick<
|
|
31
|
+
DialogFuncProps,
|
|
32
|
+
'onEscapeKeyDown' | 'onInteractOutside' | 'onPointerDownOutside' | 'closable' | 'type' | 'className'
|
|
33
|
+
> &
|
|
34
|
+
DialogPrimitive.DialogContentProps;
|
|
30
35
|
|
|
31
|
-
function DialogContent({ children, closable = true, type, ...delegated }: DialogContentProps) {
|
|
36
|
+
function DialogContent({ children, closable = true, type, className, ...delegated }: DialogContentProps) {
|
|
32
37
|
const withIcon = typeof type !== 'undefined';
|
|
33
38
|
|
|
34
39
|
const IconComponent = type && IconMap[type];
|
|
@@ -36,7 +41,7 @@ function DialogContent({ children, closable = true, type, ...delegated }: Dialog
|
|
|
36
41
|
return (
|
|
37
42
|
<DialogPrimitive.Portal>
|
|
38
43
|
<DialogPrimitive.Overlay className="bg-black/30 fixed inset-0" />
|
|
39
|
-
<DialogPrimitive.Content className={dialogContentStyles({ withIcon })} {...delegated}>
|
|
44
|
+
<DialogPrimitive.Content className={dialogContentStyles({ withIcon, class: className })} {...delegated}>
|
|
40
45
|
{IconComponent && <IconComponent className="my-1 shrink-0" width={32} height={32} />}
|
|
41
46
|
{closable && (
|
|
42
47
|
<DialogClose asChild>
|
|
@@ -53,8 +58,13 @@ function DialogContent({ children, closable = true, type, ...delegated }: Dialog
|
|
|
53
58
|
|
|
54
59
|
type DialogTitleProps = JSX.IntrinsicAttributes & DialogPrimitive.DialogTitleProps & RefAttributes<HTMLHeadingElement>;
|
|
55
60
|
|
|
56
|
-
function DialogTitle(delegated: DialogTitleProps) {
|
|
57
|
-
return
|
|
61
|
+
function DialogTitle({ className, ...delegated }: DialogTitleProps) {
|
|
62
|
+
return (
|
|
63
|
+
<DialogPrimitive.Title
|
|
64
|
+
className={clsx('m-0 font-semibold text-2xl font-sans text-black-text', className)}
|
|
65
|
+
{...delegated}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
type DialogDescriptionProps = JSX.IntrinsicAttributes &
|
|
@@ -71,15 +81,16 @@ const DialogClose = DialogPrimitive.Close;
|
|
|
71
81
|
|
|
72
82
|
export const DialogRoot = DialogPrimitive.Root;
|
|
73
83
|
|
|
74
|
-
type DialogBaseProps = {
|
|
84
|
+
type DialogBaseProps = React.ComponentProps<typeof DialogRoot> & {
|
|
75
85
|
children: ReactNode;
|
|
76
86
|
};
|
|
77
87
|
|
|
78
|
-
export function DialogBase({ children }: DialogBaseProps) {
|
|
79
|
-
return <DialogRoot>{children}</DialogRoot>;
|
|
88
|
+
export function DialogBase({ children, ...delegated }: DialogBaseProps) {
|
|
89
|
+
return <DialogRoot {...delegated}>{children}</DialogRoot>;
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
DialogBase.Title = DialogTitle;
|
|
83
93
|
DialogBase.Trigger = DialogTrigger;
|
|
84
94
|
DialogBase.Description = DialogDescription;
|
|
85
95
|
DialogBase.Content = DialogContent;
|
|
96
|
+
DialogBase.Overlay = DialogPrimitive.Overlay;
|