@crystallize/design-system 0.0.0 → 0.0.2

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 ADDED
@@ -0,0 +1,13 @@
1
+ # @crystallize/design-system
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 742b7b00: Add collapse all chunks button and remove unused prop from ActionMenu
8
+
9
+ ## 0.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 012f7c4: Add video on product variants and reuse images with lightbox for the app. Propagate dialog props to original component in the design system.
package/dist/index.d.ts CHANGED
@@ -12,10 +12,9 @@ declare function Item({ children, className, onSelect }: ItemProps): JSX.Element
12
12
 
13
13
  declare type ActionMenuProps = {
14
14
  children: ReactNode;
15
- className?: string;
16
15
  tabIndex?: number;
17
16
  };
18
- declare function ActionMenu({ children, className, tabIndex }: ActionMenuProps): JSX.Element;
17
+ declare function ActionMenu({ children, tabIndex }: ActionMenuProps): JSX.Element;
19
18
  declare namespace ActionMenu {
20
19
  var Item: typeof Item;
21
20
  }
@@ -55,21 +54,23 @@ declare const dialogContentStyles: (props?: ({
55
54
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
56
55
  declare type DialogContentProps = DialogContentStylesProps & {
57
56
  children: ReactNode;
58
- } & Pick<DialogFuncProps, 'onEscapeKeyDown' | 'onInteractOutside' | 'onPointerDownOutside' | 'closable' | 'type'>;
59
- declare function DialogContent({ children, closable, type, ...delegated }: DialogContentProps): JSX.Element;
57
+ } & Pick<DialogFuncProps, 'onEscapeKeyDown' | 'onInteractOutside' | 'onPointerDownOutside' | 'closable' | 'type' | 'className'> & DialogPrimitive.DialogContentProps;
58
+ declare function DialogContent({ children, closable, type, className, ...delegated }: DialogContentProps): JSX.Element;
60
59
  declare type DialogTitleProps = JSX.IntrinsicAttributes & DialogPrimitive.DialogTitleProps & RefAttributes<HTMLHeadingElement>;
61
- declare function DialogTitle(delegated: DialogTitleProps): JSX.Element;
60
+ declare function DialogTitle({ className, ...delegated }: DialogTitleProps): JSX.Element;
62
61
  declare type DialogDescriptionProps = JSX.IntrinsicAttributes & DialogPrimitive.DialogDescriptionProps & RefAttributes<HTMLParagraphElement>;
63
62
  declare function DialogDescription(delegated: DialogDescriptionProps): JSX.Element;
64
- declare type DialogBaseProps = {
63
+ declare const DialogRoot: react.FC<DialogPrimitive.DialogProps>;
64
+ declare type DialogBaseProps = React.ComponentProps<typeof DialogRoot> & {
65
65
  children: ReactNode;
66
66
  };
67
- declare function DialogBase({ children }: DialogBaseProps): JSX.Element;
67
+ declare function DialogBase({ children, ...delegated }: DialogBaseProps): JSX.Element;
68
68
  declare namespace DialogBase {
69
69
  var Title: typeof DialogTitle;
70
70
  var Trigger: react.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & RefAttributes<HTMLButtonElement>>;
71
71
  var Description: typeof DialogDescription;
72
72
  var Content: typeof DialogContent;
73
+ var Overlay: react.ForwardRefExoticComponent<DialogPrimitive.DialogOverlayProps & RefAttributes<HTMLDivElement>>;
73
74
  }
74
75
 
75
76
  declare type DialogType = typeof DialogBase & DialogFuncProps;
@@ -100,7 +101,7 @@ declare type DropdownMenuRootProps = {
100
101
  children: ReactNode;
101
102
  content: ReactNode;
102
103
  alignContent?: 'start' | 'center' | 'end';
103
- onOpenChange: (isOpen: boolean) => void;
104
+ onOpenChange?: (isOpen: boolean) => void;
104
105
  };
105
106
  declare function DropdownMenuRoot({ children, content, onOpenChange, alignContent }: DropdownMenuRootProps): JSX.Element;
106
107
 
package/dist/index.js CHANGED
@@ -650,17 +650,17 @@ function Item2({ children, className, onSelect }) {
650
650
 
651
651
  // src/action-menu/action-menu.tsx
652
652
  var import_jsx_runtime14 = require("react/jsx-runtime");
653
- function ActionMenu({ children, className, tabIndex }) {
653
+ function ActionMenu({ children, tabIndex }) {
654
654
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropdownMenu.Root, {
655
655
  content: children,
656
+ alignContent: "center",
656
657
  children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", {
657
658
  tabIndex,
658
659
  type: "button",
659
660
  className: (0, import_clsx4.default)(
660
661
  "items-center bg-transparent rounded-full border-none cursor-pointer flex justify-center p-1",
661
662
  "hover:bg-gray-6 focus:bg-gray-6 focus:outline-offset-2 focus:outline focus:outline-1 focus:outline-glacier focus-visible:outline-offset-2 focus-visible:outline focus-visible:outline-1 focus-visible:outline-glacier",
662
- "active:scale-95",
663
- className
663
+ "active:scale-95"
664
664
  ),
665
665
  "aria-label": "more options",
666
666
  children: [
@@ -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 = "cancel",
828
+ cancelText = "Cancel",
826
829
  onEscapeKeyDown,
827
830
  onInteractOutside,
828
831
  onPointerDownOutside,
package/dist/index.mjs CHANGED
@@ -609,17 +609,17 @@ function Item2({ children, className, onSelect }) {
609
609
 
610
610
  // src/action-menu/action-menu.tsx
611
611
  import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
612
- function ActionMenu({ children, className, tabIndex }) {
612
+ function ActionMenu({ children, tabIndex }) {
613
613
  return /* @__PURE__ */ jsx14(DropdownMenu.Root, {
614
614
  content: children,
615
+ alignContent: "center",
615
616
  children: /* @__PURE__ */ jsxs9("button", {
616
617
  tabIndex,
617
618
  type: "button",
618
619
  className: clsx4(
619
620
  "items-center bg-transparent rounded-full border-none cursor-pointer flex justify-center p-1",
620
621
  "hover:bg-gray-6 focus:bg-gray-6 focus:outline-offset-2 focus:outline focus:outline-1 focus:outline-glacier focus-visible:outline-offset-2 focus-visible:outline focus-visible:outline-1 focus-visible:outline-glacier",
621
- "active:scale-95",
622
- className
622
+ "active:scale-95"
623
623
  ),
624
624
  "aria-label": "more options",
625
625
  children: [
@@ -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 = "cancel",
787
+ cancelText = "Cancel",
785
788
  onEscapeKeyDown,
786
789
  onInteractOutside,
787
790
  onPointerDownOutside,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -8,14 +8,12 @@ import { Item } from './action-item';
8
8
 
9
9
  type ActionMenuProps = {
10
10
  children: ReactNode;
11
- className?: string;
12
11
  tabIndex?: number;
13
12
  };
14
13
 
15
- export function ActionMenu({ children, className, tabIndex }: ActionMenuProps) {
14
+ export function ActionMenu({ children, tabIndex }: ActionMenuProps) {
16
15
  return (
17
- // @ts-expect-error
18
- <DropdownMenu.Root content={children}>
16
+ <DropdownMenu.Root content={children} alignContent="center">
19
17
  <button
20
18
  tabIndex={tabIndex}
21
19
  type="button"
@@ -23,7 +21,6 @@ export function ActionMenu({ children, className, tabIndex }: ActionMenuProps) {
23
21
  'items-center bg-transparent rounded-full border-none cursor-pointer flex justify-center p-1',
24
22
  'hover:bg-gray-6 focus:bg-gray-6 focus:outline-offset-2 focus:outline focus:outline-1 focus:outline-glacier focus-visible:outline-offset-2 focus-visible:outline focus-visible:outline-1 focus-visible:outline-glacier',
25
23
  'active:scale-95',
26
- className,
27
24
  )}
28
25
  aria-label="more options"
29
26
  >
@@ -13,7 +13,7 @@ export function ConfirmDialog({
13
13
  okText = 'OK',
14
14
  onOk,
15
15
  onCancel,
16
- cancelText = 'cancel',
16
+ cancelText = 'Cancel',
17
17
  onEscapeKeyDown,
18
18
  onInteractOutside,
19
19
  onPointerDownOutside,
@@ -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<DialogFuncProps, 'onEscapeKeyDown' | 'onInteractOutside' | 'onPointerDownOutside' | 'closable' | 'type'>;
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 <DialogPrimitive.Title className="m-0 font-semibold text-2xl font-sans text-black-text" {...delegated} />;
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;
@@ -5,7 +5,7 @@ type DropdownMenuRootProps = {
5
5
  children: ReactNode;
6
6
  content: ReactNode;
7
7
  alignContent?: 'start' | 'center' | 'end';
8
- onOpenChange: (isOpen: boolean) => void;
8
+ onOpenChange?: (isOpen: boolean) => void;
9
9
  };
10
10
 
11
11
  export function DropdownMenuRoot({ children, content, onOpenChange, alignContent = 'start' }: DropdownMenuRootProps) {