@crystallize/design-system 1.24.35 → 1.24.37

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/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  showError,
18
18
  showInfo,
19
19
  showWarning
20
- } from "./chunk-RGQ4WALV.mjs";
20
+ } from "./chunk-7BLEJWBK.mjs";
21
21
  import "./chunk-NIH5ZMPE.mjs";
22
22
 
23
23
  // src/card/card.tsx
@@ -486,7 +486,7 @@ function Tag({
486
486
  // src/rich-text-editor/index.tsx
487
487
  import { lazy, Suspense } from "react";
488
488
  import { jsx as jsx15 } from "react/jsx-runtime";
489
- var LazyRichTextEditor = lazy(() => import("./rich-text-editor-MZTMZK5H.mjs"));
489
+ var LazyRichTextEditor = lazy(() => import("./rich-text-editor-TANRKQM7.mjs"));
490
490
  var RichTextEditor = (props) => {
491
491
  return /* @__PURE__ */ jsx15(Suspense, {
492
492
  fallback: null,
@@ -599,6 +599,254 @@ function Switch({ size, checked, ...props }) {
599
599
  });
600
600
  }
601
601
 
602
+ // src/color-picker/color-picker.tsx
603
+ import { useState, useMemo } from "react";
604
+
605
+ // src/colors/colors.json
606
+ var colors_default = {
607
+ cyan: {
608
+ "50": "#eefdfc",
609
+ "100": "#bff6f8",
610
+ "200": "#acf1f5",
611
+ "300": "#73e5ed",
612
+ "400": "#33d0dd",
613
+ "500": "#17b3c3",
614
+ "600": "#1690a4",
615
+ "700": "#197385",
616
+ "800": "#1d5e6d",
617
+ "900": "#1c4e5d"
618
+ },
619
+ pink: {
620
+ "50": "#fef1f9",
621
+ "100": "#fee5f4",
622
+ "200": "#ffccec",
623
+ "300": "#ffa1db",
624
+ "400": "#ff66c0",
625
+ "500": "#fb39a4",
626
+ "600": "#eb1782",
627
+ "700": "#cd0966",
628
+ "800": "#a90b54",
629
+ "900": "#8d0e49"
630
+ },
631
+ gray: {
632
+ "50": "#f5f5f6",
633
+ "100": "#e4e5e9",
634
+ "200": "#cccfd5",
635
+ "300": "#a9aeb7",
636
+ "400": "#7e8592",
637
+ "500": "#626778",
638
+ "600": "#545866",
639
+ "700": "#4c4f5a",
640
+ "800": "#40424a",
641
+ "900": "#393a40"
642
+ },
643
+ purple: {
644
+ "50": "#f7f6f9",
645
+ "100": "#eeecf2",
646
+ "200": "#d8d5e2",
647
+ "300": "#b6b0c9",
648
+ "400": "#8e85ab",
649
+ "500": "#706691",
650
+ "600": "#5b5178",
651
+ "700": "#4b4262",
652
+ "800": "#403953",
653
+ "900": "#393347"
654
+ },
655
+ green: {
656
+ "50": "#f3f8f8",
657
+ "100": "#dfebee",
658
+ "200": "#c3dade",
659
+ "300": "#9abfc6",
660
+ "400": "#699ca7",
661
+ "500": "#528693",
662
+ "600": "#436a77",
663
+ "700": "#3b5863",
664
+ "800": "#374b53",
665
+ "900": "#314148"
666
+ },
667
+ orange: {
668
+ "50": "#fff9eb",
669
+ "100": "#ffedc6",
670
+ "200": "#ffde99",
671
+ "300": "#ffbf4a",
672
+ "400": "#ffa520",
673
+ "500": "#f98107",
674
+ "600": "#dd5c02",
675
+ "700": "#b73d06",
676
+ "800": "#942e0c",
677
+ "900": "#7a270d"
678
+ },
679
+ "s-red": {
680
+ "50": "#fef2f2",
681
+ "100": "#ffe1e1",
682
+ "200": "#ffc8c8",
683
+ "300": "#ffadad",
684
+ "400": "#fd6c6c",
685
+ "500": "#f53e3e",
686
+ "600": "#e22020",
687
+ "700": "#be1717",
688
+ "800": "#9d1717",
689
+ "900": "#821a1a"
690
+ },
691
+ "s-orange": {
692
+ "50": "#fff7ed",
693
+ "100": "#ffedd5",
694
+ "200": "#ffd6a5",
695
+ "300": "#ffbb72",
696
+ "400": "#fd943a",
697
+ "500": "#fc7513",
698
+ "600": "#ed5909",
699
+ "700": "#c4420a",
700
+ "800": "#9c3410",
701
+ "900": "#7d2d11"
702
+ },
703
+ "s-yellow": {
704
+ "50": "#fefee8",
705
+ "100": "#fdffb6",
706
+ "200": "#fffe88",
707
+ "300": "#fff744",
708
+ "400": "#fee911",
709
+ "500": "#eecf04",
710
+ "600": "#cda201",
711
+ "700": "#a47404",
712
+ "800": "#875b0c",
713
+ "900": "#734a10"
714
+ },
715
+ "s-green": {
716
+ "50": "#f2ffee",
717
+ "100": "#deffd8",
718
+ "200": "#caffbf",
719
+ "300": "#8dfd78",
720
+ "400": "#53f236",
721
+ "500": "#2cdb0c",
722
+ "600": "#1eb603",
723
+ "700": "#1b8e07",
724
+ "800": "#1a700b",
725
+ "900": "#165b0c"
726
+ },
727
+ "s-blue": {
728
+ "50": "#eff5ff",
729
+ "100": "#dae7ff",
730
+ "200": "#bed5ff",
731
+ "300": "#a0c4ff",
732
+ "400": "#5d96fd",
733
+ "500": "#376ffa",
734
+ "600": "#214fef",
735
+ "700": "#193adc",
736
+ "800": "#1b31b2",
737
+ "900": "#1c2f8c"
738
+ },
739
+ "s-purple": {
740
+ "50": "#f4f3ff",
741
+ "100": "#ebe8ff",
742
+ "200": "#d9d5ff",
743
+ "300": "#bdb2ff",
744
+ "400": "#9d88fd",
745
+ "500": "#7e58fa",
746
+ "600": "#6f35f2",
747
+ "700": "#6023de",
748
+ "800": "#501dba",
749
+ "900": "#431a98"
750
+ },
751
+ "s-pink": {
752
+ "50": "#fff4ff",
753
+ "100": "#ffe7ff",
754
+ "200": "#ffc6ff",
755
+ "300": "#fea9fa",
756
+ "400": "#fc76f4",
757
+ "500": "#f342e7",
758
+ "600": "#d722c8",
759
+ "700": "#b219a1",
760
+ "800": "#921684",
761
+ "900": "#771869"
762
+ }
763
+ };
764
+
765
+ // src/color-picker/color-picker.tsx
766
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
767
+ var SHADES = ["200", "300", "400", "500", "600", "700", "800"];
768
+ var ORDERED_COLOR_NAMES = [
769
+ "s-green",
770
+ "s-red",
771
+ "orange",
772
+ "s-yellow",
773
+ "purple",
774
+ "gray",
775
+ "green",
776
+ "s-pink",
777
+ "pink",
778
+ "cyan",
779
+ "s-purple",
780
+ "s-blue"
781
+ ];
782
+ function ColorPicker({ value, setValue, children, isOpen, setIsOpen }) {
783
+ const [hoveredColor, setHoveredColor] = useState(null);
784
+ const colorLookupMap = useMemo(() => {
785
+ const map = /* @__PURE__ */ new Map();
786
+ ORDERED_COLOR_NAMES.forEach((colorName) => {
787
+ SHADES.forEach((shade) => {
788
+ const color = colors_default[colorName];
789
+ map.set(color[shade], `${colorName} ${shade}`);
790
+ });
791
+ });
792
+ return map;
793
+ }, []);
794
+ const getColorNameAndHue = (colorValue) => {
795
+ return colorLookupMap.get(colorValue) || "Color Name and Hue not found";
796
+ };
797
+ const displayedColorInfo = hoveredColor || value ? getColorNameAndHue(hoveredColor ?? value) : "Select a color";
798
+ const handleColorSelect = (colorValue) => {
799
+ setValue(colorValue);
800
+ setIsOpen(false);
801
+ };
802
+ const handleMouseEnter = (colorValue) => setHoveredColor(colorValue);
803
+ const handleMouseLeave = () => setHoveredColor(null);
804
+ return /* @__PURE__ */ jsx18(Popover, {
805
+ open: isOpen,
806
+ side: "bottom",
807
+ hasArrow: true,
808
+ onOpenChange: setIsOpen,
809
+ content: /* @__PURE__ */ jsxs10(Card, {
810
+ variant: "elevate",
811
+ className: " border border-solid border-border p-5",
812
+ children: [
813
+ /* @__PURE__ */ jsxs10("div", {
814
+ className: "mb-3",
815
+ children: [
816
+ /* @__PURE__ */ jsx18("span", {
817
+ className: "text-sm font-bold capitalize",
818
+ children: displayedColorInfo
819
+ }),
820
+ /* @__PURE__ */ jsx18("span", {
821
+ className: "ml-4 text-sm italic text-gray-500-400",
822
+ children: hoveredColor ?? value
823
+ })
824
+ ]
825
+ }),
826
+ /* @__PURE__ */ jsx18("div", {
827
+ className: "grid grid-cols-12",
828
+ children: ORDERED_COLOR_NAMES.map((colorName) => /* @__PURE__ */ jsx18("div", {
829
+ children: SHADES.map((shade) => {
830
+ const colorValue = colors_default[colorName][shade];
831
+ return /* @__PURE__ */ jsx18("div", {
832
+ className: "cursor-pointer rounded p-0.5",
833
+ onClick: () => handleColorSelect(colorValue),
834
+ onMouseEnter: () => handleMouseEnter(colorValue),
835
+ onMouseLeave: handleMouseLeave,
836
+ children: /* @__PURE__ */ jsx18("div", {
837
+ className: "h-5 w-5",
838
+ style: { backgroundColor: colorValue }
839
+ })
840
+ }, colorValue);
841
+ })
842
+ }, colorName))
843
+ })
844
+ ]
845
+ }),
846
+ children
847
+ });
848
+ }
849
+
602
850
  // src/index.ts
603
851
  var tokens = {
604
852
  button: buttonTokens,
@@ -612,6 +860,7 @@ export {
612
860
  Checkbox,
613
861
  Collapsible,
614
862
  CollapsibleTrigger,
863
+ ColorPicker,
615
864
  Dialog,
616
865
  DropdownMenu,
617
866
  Icon,
@@ -6,7 +6,7 @@ import {
6
6
  Icon,
7
7
  IconButton,
8
8
  InputWithLabel
9
- } from "./chunk-RGQ4WALV.mjs";
9
+ } from "./chunk-7BLEJWBK.mjs";
10
10
  import "./chunk-NIH5ZMPE.mjs";
11
11
 
12
12
  // src/rich-text-editor/rich-text-editor.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.24.35",
3
+ "version": "1.24.37",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -0,0 +1,100 @@
1
+ import React, { useState, useMemo, type SetStateAction } from 'react';
2
+
3
+ import { Card } from '../card';
4
+ import { colors } from '../colors';
5
+ import { Popover } from '../popover';
6
+
7
+ const SHADES = ['200', '300', '400', '500', '600', '700', '800'] as const;
8
+
9
+ const ORDERED_COLOR_NAMES = [
10
+ 's-green',
11
+ 's-red',
12
+ 'orange',
13
+ 's-yellow',
14
+ 'purple',
15
+ 'gray',
16
+ 'green',
17
+ 's-pink',
18
+ 'pink',
19
+ 'cyan',
20
+ 's-purple',
21
+ 's-blue',
22
+ ] as const;
23
+
24
+ type ColorPickerProps = {
25
+ value?: string;
26
+ setValue: (value: string) => void;
27
+ children: React.ReactNode;
28
+ isOpen: boolean;
29
+ setIsOpen: React.Dispatch<SetStateAction<boolean>>;
30
+ };
31
+
32
+ export function ColorPicker({ value, setValue, children, isOpen, setIsOpen }: ColorPickerProps) {
33
+ const [hoveredColor, setHoveredColor] = useState<string | null>(null);
34
+
35
+ const colorLookupMap = useMemo(() => {
36
+ const map = new Map();
37
+ ORDERED_COLOR_NAMES.forEach(colorName => {
38
+ SHADES.forEach(shade => {
39
+ const color = colors[colorName];
40
+ map.set(color[shade], `${colorName} ${shade}`);
41
+ });
42
+ });
43
+ return map;
44
+ }, []);
45
+
46
+ const getColorNameAndHue = (colorValue?: string): string => {
47
+ return colorLookupMap.get(colorValue) || 'Color Name and Hue not found';
48
+ };
49
+
50
+ const displayedColorInfo = hoveredColor || value ? getColorNameAndHue(hoveredColor ?? value) : 'Select a color';
51
+
52
+ const handleColorSelect = (colorValue: string) => {
53
+ setValue(colorValue);
54
+ setIsOpen(false);
55
+ };
56
+
57
+ const handleMouseEnter = (colorValue: string) => setHoveredColor(colorValue);
58
+ const handleMouseLeave = () => setHoveredColor(null);
59
+
60
+ return (
61
+ <Popover
62
+ open={isOpen}
63
+ side="bottom"
64
+ hasArrow
65
+ onOpenChange={setIsOpen}
66
+ content={
67
+ <Card variant="elevate" className=" border border-solid border-border p-5">
68
+ <div className="mb-3">
69
+ <span className="text-sm font-bold capitalize">{displayedColorInfo}</span>
70
+ <span className="ml-4 text-sm italic text-gray-500-400">{hoveredColor ?? value}</span>
71
+ </div>
72
+
73
+ <div className="grid grid-cols-12">
74
+ {ORDERED_COLOR_NAMES.map(colorName => (
75
+ <div key={colorName}>
76
+ {SHADES.map(shade => {
77
+ const colorValue = colors[colorName][shade];
78
+
79
+ return (
80
+ <div
81
+ key={colorValue}
82
+ className="cursor-pointer rounded p-0.5"
83
+ onClick={() => handleColorSelect(colorValue)}
84
+ onMouseEnter={() => handleMouseEnter(colorValue)}
85
+ onMouseLeave={handleMouseLeave}
86
+ >
87
+ <div className="h-5 w-5" style={{ backgroundColor: colorValue }} />
88
+ </div>
89
+ );
90
+ })}
91
+ </div>
92
+ ))}
93
+ </div>
94
+ </Card>
95
+ }
96
+ >
97
+ {children}
98
+ </Popover>
99
+ );
100
+ }
@@ -0,0 +1 @@
1
+ export { ColorPicker } from './color-picker';
@@ -1,35 +1,29 @@
1
1
  import { forwardRef, SVGProps } from 'react';
2
2
 
3
+ import { fill, stroke } from './variables';
4
+
3
5
  type CopyProps = SVGProps<SVGSVGElement>;
4
6
 
5
7
  type CopyRef = SVGSVGElement;
6
8
 
7
9
  export const Copy = forwardRef<CopyRef, CopyProps>((delegated, ref) => {
8
10
  return (
9
- <svg
10
- ref={ref}
11
- width="22"
12
- height="22"
13
- viewBox="0 0 22 22"
14
- fill="none"
15
- xmlns="http://www.w3.org/2000/svg"
16
- {...delegated}
17
- >
11
+ <svg ref={ref} width="22" height="22" viewBox="0 0 22 22" fill="none" {...delegated}>
18
12
  <path
19
13
  fillRule="evenodd"
20
14
  clipRule="evenodd"
21
15
  d="M5.60925 19.5266L5.88208 18.9923C6.25379 19.182 6.67497 19.2893 7.12296 19.2893H8.45636V19.8893H7.12296C6.57795 19.8893 6.06349 19.7586 5.60925 19.5266ZM10.2342 19.8893V19.2893H11.5676C12.0156 19.2893 12.4368 19.182 12.8085 18.9923L13.0813 19.5266C12.6271 19.7586 12.1126 19.8893 11.5676 19.8893H10.2342ZM14.9011 11.1111H14.3011V8.77766C14.3011 8.32967 14.1938 7.9085 14.0041 7.53678L14.5384 7.26395C14.7703 7.71819 14.9011 8.23265 14.9011 8.77766V11.1111ZM8.45636 5.44415H7.12296C6.57795 5.44415 6.06349 5.57495 5.60925 5.80686L5.88208 6.34124C6.25379 6.15146 6.67497 6.04415 7.12296 6.04415H8.45636V5.44415ZM3.78945 14.2224H4.38945V16.5558C4.38945 17.0038 4.49676 17.425 4.68654 17.7967L4.15215 18.0696C3.92024 17.6153 3.78945 17.1009 3.78945 16.5558V14.2224ZM3.78945 11.1111H4.38945V8.77766C4.38945 8.32968 4.49676 7.9085 4.68654 7.53678L4.15215 7.26395C3.92024 7.71819 3.78945 8.23265 3.78945 8.77766V11.1111ZM10.2342 5.44415V6.04415H11.5676C12.0156 6.04415 12.4368 6.15146 12.8085 6.34124L13.0813 5.80686C12.6271 5.57495 12.1126 5.44415 11.5676 5.44415H10.2342ZM14.9011 14.2224H14.3011V16.5558C14.3011 17.0038 14.1938 17.425 14.0041 17.7967L14.5384 18.0696C14.7703 17.6153 14.9011 17.1009 14.9011 16.5558V14.2224Z"
22
- fill="#528693"
16
+ fill={stroke}
23
17
  />
24
18
  <path
25
19
  d="M8.23413 5.44417C8.23413 3.60312 9.72659 2.11066 11.5676 2.11066H16.0123C17.8534 2.11066 19.3458 3.60312 19.3458 5.44416V13.2223C19.3458 15.0634 17.8534 16.5559 16.0123 16.5559H11.5676C9.72659 16.5559 8.23413 15.0634 8.23413 13.2223V5.44417Z"
26
- fill="#BFF6F8"
20
+ fill={fill}
27
21
  />
28
22
  <path
29
23
  fillRule="evenodd"
30
24
  clipRule="evenodd"
31
25
  d="M16.0123 2.71066H11.5676C10.058 2.71066 8.83413 3.93449 8.83413 5.44417V13.2223C8.83413 14.732 10.058 15.9559 11.5676 15.9559H16.0123C17.522 15.9559 18.7458 14.732 18.7458 13.2223V5.44416C18.7458 3.93449 17.522 2.71066 16.0123 2.71066ZM11.5676 2.11066C9.72659 2.11066 8.23413 3.60312 8.23413 5.44417V13.2223C8.23413 15.0634 9.72659 16.5559 11.5676 16.5559H16.0123C17.8534 16.5559 19.3458 15.0634 19.3458 13.2223V5.44416C19.3458 3.60312 17.8534 2.11066 16.0123 2.11066H11.5676Z"
32
- fill="#528693"
26
+ fill={stroke}
33
27
  />
34
28
  </svg>
35
29
  );
@@ -0,0 +1,17 @@
1
+ import { forwardRef, SVGProps } from 'react';
2
+
3
+ type DotsProps = SVGProps<SVGSVGElement>;
4
+
5
+ type DotsRef = SVGSVGElement;
6
+
7
+ export const Dots = forwardRef<DotsRef, DotsProps>((delegated, ref) => {
8
+ return (
9
+ <svg ref={ref} width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true" {...delegated}>
10
+ <circle cx="10" cy="5" r="1.7857" fill="#9095A8" />
11
+ <circle cx="10" cy="10" r="1.7857" fill="#9095A8" />
12
+ <circle cx="10" cy="15" r="1.7857" fill="#9095A8" />
13
+ </svg>
14
+ );
15
+ });
16
+
17
+ Dots.displayName = 'DotsIcon';
@@ -30,6 +30,7 @@ import { DateInfinity } from './date-infinity';
30
30
  import { Discovery } from './discovery';
31
31
  import { Document } from './document';
32
32
  import { DocumentShortcut } from './document-shortcut';
33
+ import { Dots } from './dots';
33
34
  import { Download } from './download';
34
35
  import { DragHandle } from './drag-handle';
35
36
  import { DynamicValue } from './dynamic-value';
@@ -146,6 +147,7 @@ export const Icon = {
146
147
  Dashboard,
147
148
  Document,
148
149
  DocumentShortcut,
150
+ Dots,
149
151
  Download,
150
152
  DragHandle,
151
153
  DynamicValue,
package/src/index.ts CHANGED
@@ -29,6 +29,7 @@ export * from './rich-text-editor';
29
29
  export * from './toast';
30
30
  export * from './tooltip';
31
31
  export * from './switch';
32
+ export * from './color-picker';
32
33
 
33
34
  // Icons ---
34
35
  export * from './iconography';
@@ -10,6 +10,10 @@
10
10
  @apply bg-gray-100-800 opacity-40;
11
11
  }
12
12
 
13
+ &:not(:disabled) {
14
+ @apply cursor-pointer;
15
+ }
16
+
13
17
  &[aria-checked='true'] {
14
18
  @apply border-cyan-700-200 bg-cyan-200-700;
15
19
  }