@firecms/ui 3.0.0-canary.16 → 3.0.0-canary.160

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.
Files changed (111) hide show
  1. package/README.md +60 -150
  2. package/dist/components/Avatar.d.ts +1 -0
  3. package/dist/components/BooleanSwitch.d.ts +1 -1
  4. package/dist/components/BooleanSwitchWithLabel.d.ts +4 -1
  5. package/dist/components/Button.d.ts +1 -1
  6. package/dist/components/CenteredView.d.ts +4 -2
  7. package/dist/components/Checkbox.d.ts +3 -2
  8. package/dist/components/Chip.d.ts +3 -2
  9. package/dist/components/DateTimeField.d.ts +5 -7
  10. package/dist/components/Dialog.d.ts +4 -1
  11. package/dist/components/DialogContent.d.ts +2 -1
  12. package/dist/components/DialogTitle.d.ts +10 -0
  13. package/dist/components/ExpandablePanel.d.ts +2 -1
  14. package/dist/components/FileUpload.d.ts +2 -2
  15. package/dist/components/InputLabel.d.ts +2 -2
  16. package/dist/components/Label.d.ts +4 -1
  17. package/dist/components/Markdown.d.ts +1 -0
  18. package/dist/components/Menu.d.ts +6 -2
  19. package/dist/components/Menubar.d.ts +79 -0
  20. package/dist/components/MultiSelect.d.ts +32 -16
  21. package/dist/components/Popover.d.ts +2 -1
  22. package/dist/components/RadioGroup.d.ts +26 -3
  23. package/dist/components/Select.d.ts +8 -11
  24. package/dist/components/Separator.d.ts +2 -1
  25. package/dist/components/Sheet.d.ts +6 -0
  26. package/dist/components/Slider.d.ts +21 -0
  27. package/dist/components/Table.d.ts +10 -10
  28. package/dist/components/Tabs.d.ts +4 -2
  29. package/dist/components/TextField.d.ts +1 -1
  30. package/dist/components/TextareaAutosize.d.ts +3 -34
  31. package/dist/components/Tooltip.d.ts +6 -2
  32. package/dist/components/Typography.d.ts +5 -4
  33. package/dist/components/index.d.ts +3 -1
  34. package/dist/hooks/index.d.ts +3 -0
  35. package/dist/icons/Icon.d.ts +3 -3
  36. package/dist/index.css +73 -0
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.es.js +50174 -20590
  39. package/dist/index.es.js.map +1 -1
  40. package/dist/index.umd.js +50441 -857
  41. package/dist/index.umd.js.map +1 -1
  42. package/dist/styles.d.ts +9 -9
  43. package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
  44. package/dist/util/index.d.ts +1 -3
  45. package/package.json +119 -118
  46. package/src/components/Alert.tsx +4 -4
  47. package/src/components/Autocomplete.tsx +7 -5
  48. package/src/components/Avatar.tsx +41 -26
  49. package/src/components/Badge.tsx +2 -2
  50. package/src/components/BooleanSwitch.tsx +14 -13
  51. package/src/components/BooleanSwitchWithLabel.tsx +17 -8
  52. package/src/components/Button.tsx +31 -23
  53. package/src/components/Card.tsx +4 -3
  54. package/src/components/CenteredView.tsx +26 -15
  55. package/src/components/Checkbox.tsx +16 -14
  56. package/src/components/Chip.tsx +13 -10
  57. package/src/components/CircularProgress.tsx +3 -3
  58. package/src/components/Collapse.tsx +4 -2
  59. package/src/components/Container.tsx +3 -2
  60. package/src/components/DateTimeField.tsx +144 -921
  61. package/src/components/DebouncedTextField.tsx +1 -0
  62. package/src/components/Dialog.tsx +17 -7
  63. package/src/components/DialogActions.tsx +3 -3
  64. package/src/components/DialogContent.tsx +7 -3
  65. package/src/components/DialogTitle.tsx +41 -0
  66. package/src/components/ExpandablePanel.tsx +20 -12
  67. package/src/components/FileUpload.tsx +11 -13
  68. package/src/components/IconButton.tsx +7 -11
  69. package/src/components/InfoLabel.tsx +2 -2
  70. package/src/components/InputLabel.tsx +12 -9
  71. package/src/components/Label.tsx +18 -4
  72. package/src/components/Markdown.tsx +15 -3
  73. package/src/components/Menu.tsx +50 -31
  74. package/src/components/Menubar.tsx +322 -0
  75. package/src/components/MultiSelect.tsx +341 -167
  76. package/src/components/Paper.tsx +2 -2
  77. package/src/components/Popover.tsx +19 -15
  78. package/src/components/RadioGroup.tsx +42 -9
  79. package/src/components/SearchBar.tsx +12 -11
  80. package/src/components/Select.tsx +142 -130
  81. package/src/components/Separator.tsx +10 -4
  82. package/src/components/Sheet.tsx +53 -31
  83. package/src/components/Skeleton.tsx +9 -6
  84. package/src/components/Slider.tsx +110 -0
  85. package/src/components/Table.tsx +54 -35
  86. package/src/components/Tabs.tsx +17 -15
  87. package/src/components/TextField.tsx +25 -23
  88. package/src/components/TextareaAutosize.tsx +4 -3
  89. package/src/components/Tooltip.tsx +33 -16
  90. package/src/components/Typography.tsx +42 -26
  91. package/src/components/common/SelectInputLabel.tsx +3 -3
  92. package/src/components/index.tsx +3 -1
  93. package/src/hooks/index.ts +3 -0
  94. package/src/{util → hooks}/useDebounceValue.tsx +2 -0
  95. package/src/{util → hooks}/useInjectStyles.tsx +1 -0
  96. package/src/{util → hooks}/useOutsideAlerter.tsx +2 -0
  97. package/src/icons/Icon.tsx +48 -43
  98. package/src/icons/icon_keys.ts +114 -1301
  99. package/src/index.css +73 -0
  100. package/src/index.ts +1 -0
  101. package/src/scripts/generateIconKeys.ts +20 -11
  102. package/src/styles.ts +9 -9
  103. package/src/util/cls.ts +14 -0
  104. package/src/util/index.ts +1 -3
  105. package/tailwind.config.js +42 -26
  106. package/dist/components/Spinner.d.ts +0 -1
  107. package/src/components/Spinner.tsx +0 -18
  108. package/src/util/cn.ts +0 -6
  109. /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
  110. /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
  111. /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
package/src/index.css ADDED
@@ -0,0 +1,73 @@
1
+ /* Chrome, Safari and Opera */
2
+ .no-scrollbar::-webkit-scrollbar {
3
+ display: none;
4
+ }
5
+
6
+ .no-scrollbar {
7
+ -ms-overflow-style: none; /* IE and Edge */
8
+ scrollbar-width: none; /* Firefox */
9
+ }
10
+
11
+ .typography-h1 {
12
+ @apply text-6xl font-headers font-light;
13
+ }
14
+
15
+ .typography-h2 {
16
+ @apply text-5xl font-headers font-light;
17
+ }
18
+
19
+ .typography-h3 {
20
+ @apply text-4xl font-headers font-normal;
21
+ }
22
+
23
+ .typography-h4 {
24
+ @apply text-3xl font-headers font-normal;
25
+ }
26
+
27
+ .typography-h5 {
28
+ @apply text-2xl font-headers font-normal;
29
+ }
30
+
31
+ .typography-h6 {
32
+ @apply text-xl font-headers font-medium;
33
+ }
34
+
35
+ .typography-subtitle1 {
36
+ @apply text-lg font-headers font-medium;
37
+ }
38
+
39
+ .typography-subtitle2 {
40
+ @apply text-base font-headers font-medium;
41
+ }
42
+
43
+ .typography-body1 {
44
+ }
45
+
46
+ .typography-body2 {
47
+ @apply text-sm;
48
+ }
49
+
50
+ .typography-caption {
51
+ @apply text-xs;
52
+ }
53
+
54
+ .typography-label {
55
+ @apply text-sm font-medium;
56
+ }
57
+
58
+ .typography-inherit {
59
+ @apply text-inherit;
60
+ }
61
+
62
+ .typography-button {
63
+ @apply text-sm font-semibold uppercase;
64
+ }
65
+
66
+
67
+ :focus-visible {
68
+ @apply outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent
69
+ }
70
+
71
+ a {
72
+ @apply text-blue-600 dark:text-blue-400 dark:hover:text-blue-600 hover:text-blue-800
73
+ }
package/src/index.ts CHANGED
@@ -2,3 +2,4 @@ export * from "./components";
2
2
  export * from "./styles";
3
3
  export * from "./util";
4
4
  export * from "./icons";
5
+ export * from "./hooks";
@@ -2,18 +2,27 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import { fileURLToPath } from "url";
4
4
 
5
+ const extractIconKeys = (cssData: string): string[] => {
6
+ const iconKeys: string[] = [];
7
+ console.log("cssData", cssData);
8
+ const regex = /\.mi-(.*?)::before/g;
9
+ let match;
10
+
11
+ while ((match = regex.exec(cssData)) !== null) {
12
+ if (match[1]) {
13
+ iconKeys.push(match[1].replaceAll("-", "_"));
14
+ }
15
+ }
16
+
17
+ return iconKeys;
18
+ };
19
+
5
20
  //https://github.com/google/material-design-icons/blob/master/variablefont/MaterialSymbolsRounded%5BFILL%2CGRAD%2Copsz%2Cwght%5D.codepoints
6
- export function generateIconKeys() {
7
- return fetch("https://raw.githubusercontent.com/google/material-design-icons/master/variablefont/MaterialSymbolsRounded%5BFILL%2CGRAD%2Copsz%2Cwght%5D.codepoints")
8
- .then((response) => response.text())
9
- .then((text) => {
10
- const lines = text.split("\n");
11
- const words = lines.map((line) => line.split(" ")[0]);
12
- const keys = words.filter(Boolean).filter((word) => word !== "addchart");
13
- console.log(keys);
14
- saveIconKeys(keys);
15
- return keys;
16
- });
21
+ export async function generateIconKeys() {
22
+ const cssData = await fs.promises.readFile("../../node_modules/material-icons/css/material-icons.css", 'utf-8');
23
+ const keys = extractIconKeys(cssData);
24
+ saveIconKeys(keys);
25
+ return keys;
17
26
  }
18
27
 
19
28
  function saveIconKeys(keys: string[]) {
package/src/styles.ts CHANGED
@@ -1,12 +1,12 @@
1
- export const focusedMixin = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent";
2
- export const focusedInvisibleMixin = "focus:bg-opacity-70 focus:bg-slate-100 focus:dark:bg-gray-800 focus:dark:bg-opacity-60";
1
+ export const focusedDisabled = "focus-visible:ring-0 focus-visible:ring-offset-0";
2
+ export const focusedInvisibleMixin = "focus:bg-opacity-70 focus:bg-surface-accent-100 focus:dark:bg-surface-800 focus:dark:bg-opacity-60";
3
3
  export const focusedClasses = "z-30 outline-none ring-2 ring-primary ring-opacity-75 ring-offset-2 ring-offset-transparent ";
4
- export const fieldBackgroundMixin = "bg-opacity-50 bg-slate-200 dark:bg-gray-800 dark:bg-opacity-60 transition duration-150 ease-in-out";
5
- export const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-slate-100 dark:bg-gray-800 dark:bg-opacity-0 transition duration-150 ease-in-out";
6
- export const fieldBackgroundDisabledMixin = "bg-opacity-80 dark:bg-opacity-90";
7
- export const fieldBackgroundHoverMixin = "hover:bg-opacity-70 dark:hover:bg-opacity-90";
8
- export const defaultBorderMixin = "border-gray-100 dark:border-gray-800 dark:border-opacity-80";
9
- export const paperMixin = "bg-white rounded-md dark:bg-gray-950 border dark:border-gray-800 dark:border-opacity-90 border-gray-100";
10
- export const cardMixin = "bg-white rounded-md dark:bg-gray-950 dark:border-gray-800 dark:border-opacity-50 transition duration-200 ease-in-out m-1 -p-1 border border-transparent";
4
+ export const fieldBackgroundMixin = "bg-opacity-50 bg-surface-accent-200 dark:bg-surface-800 dark:bg-opacity-60";
5
+ export const fieldBackgroundInvisibleMixin = "bg-opacity-0 bg-surface-accent-100 dark:bg-surface-800 dark:bg-opacity-0";
6
+ export const fieldBackgroundDisabledMixin = "dark:bg-surface-800 bg-opacity-50 dark:bg-opacity-90";
7
+ export const fieldBackgroundHoverMixin = "hover:bg-opacity-70 dark:hover:bg-surface-700 dark:hover:bg-opacity-40";
8
+ export const defaultBorderMixin = "border-surface-200 border-opacity-40 dark:border-surface-700 dark:border-opacity-40";
9
+ export const paperMixin = "bg-white rounded-md dark:bg-surface-950 border border-surface-200 border-opacity-40 dark:border-surface-700 dark:border-opacity-40";
10
+ export const cardMixin = "bg-white border border-surface-200 border-opacity-40 dark:border-transparent rounded-md dark:bg-surface-950 dark:border-surface-700 dark:border-opacity-40 m-1 -p-1";
11
11
  export const cardClickableMixin = "hover:bg-primary-bg dark:hover:bg-primary-bg hover:bg-opacity-20 dark:hover:bg-opacity-20 hover:ring-2 hover:ring-primary cursor-pointer";
12
12
  export const cardSelectedMixin = "bg-primary-bg dark:bg-primary-bg bg-opacity-30 dark:bg-opacity-10 ring-1 ring-primary ring-opacity-75";
@@ -0,0 +1,14 @@
1
+ import { type ClassValue, clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cls(...classes: ClassValue[]) {
5
+ return twMerge(clsx(classes))
6
+ }
7
+
8
+ /**
9
+ * @deprecated
10
+ */
11
+ export function cn(...classes: ClassValue[]) {
12
+ console.warn("cn() is deprecated, use cls() instead. cn will be removed in the final 3.0.0 version");
13
+ return cls(...classes)
14
+ }
package/src/util/index.ts CHANGED
@@ -1,6 +1,4 @@
1
- export * from "./cn";
1
+ export * from "./cls";
2
2
  export * from "./debounce";
3
3
  export * from "./chip_colors";
4
4
  export * from "./key_to_icon_component";
5
- export * from "./useInjectStyles";
6
- export * from "./useOutsideAlerter";
@@ -1,11 +1,15 @@
1
+ import typography from "@tailwindcss/typography";
2
+
1
3
  export default {
2
4
  darkMode: ["selector", "[data-theme=\"dark\"]"],
3
5
  mode: "jit",
4
6
  content: [
5
7
  "./index.html",
6
8
  "./src/**/*.{js,ts,jsx,tsx}",
7
- "./node_modules/firecms/src/**/*.{js,ts,jsx,tsx}",
8
- "./node_modules/@firecms/**/src/**/*.{js,ts,jsx,tsx}"
9
+ "./node_modules/@firecms/**/*.{js,ts,jsx,tsx}"
10
+ ],
11
+ plugins: [
12
+ typography
9
13
  ],
10
14
  theme: {
11
15
  extend: {
@@ -25,42 +29,54 @@ export default {
25
29
  "sans-serif"
26
30
  ],
27
31
  mono: [
28
- "IBM Plex Mono",
32
+ "JetBrains Mono",
29
33
  "Space Mono",
30
34
  "Lucida Console",
31
35
  "monospace"
32
36
  ]
33
37
  },
34
38
  colors: {
35
- primary: "var(--fcms-primary)",
39
+ "primary": "var(--fcms-primary)",
36
40
  "primary-dark": "var(--fcms-primary-dark)",
37
41
  "primary-bg": "var(--fcms-primary-bg)",
38
- secondary: "var(--fcms-secondary)",
39
- field: {
40
- disabled: "rgb(224 224 226)",
42
+ "secondary": "var(--fcms-secondary)",
43
+ "field": {
44
+ "disabled": "rgb(224 224 226)",
41
45
  "disabled-dark": "rgb(35 35 37)"
42
46
  },
43
- text: {
44
- primary: "rgba(0, 0, 0, 0.87)",
47
+ "text": {
48
+ "primary": "rgba(0, 0, 0, 0.87)",
49
+ "secondary": "rgba(0, 0, 0, 0.52)",
50
+ "disabled": "rgba(0, 0, 0, 0.38)",
45
51
  "primary-dark": "#ffffff",
46
- secondary: "rgba(0, 0, 0, 0.6)",
47
- "secondary-dark": "rgba(255, 255, 255, 0.7)",
48
- disabled: "rgba(0, 0, 0, 0.38)",
49
- "disabled-dark": "rgba(255, 255, 255, 0.5)",
50
- label: "rgb(131, 131, 131)"
52
+ "secondary-dark": "rgba(255, 255, 255, 0.60)",
53
+ "disabled-dark": "rgba(255, 255, 255, 0.48)"
54
+ },
55
+ "surface": {
56
+ "50": "#f8f8fc",
57
+ "100": "#E7E7EB",
58
+ "200": "#CFCFD6",
59
+ "300": "#B7B7BF",
60
+ "400": "#A0A0A9",
61
+ "500": "#87878F",
62
+ "600": "#6B6B74",
63
+ "700": "#454552",
64
+ "800": "#292934",
65
+ "900": "#18181C",
66
+ "950": "#101013"
51
67
  },
52
- gray: {
53
- 50: "#f8f8fc",
54
- 100: "#E7E7EB",
55
- 200: "#CFCFD6",
56
- 300: "#B7B7BF",
57
- 400: "#A0A0A9",
58
- 500: "#87878F",
59
- 600: "#6C6C75",
60
- 700: "#505058",
61
- 800: "#35353A",
62
- 900: "#18181C",
63
- 950: "#101013"
68
+ "surface-accent": {
69
+ "50": "#f8fafc",
70
+ "100": "#f1f5f9",
71
+ "200": "#e2e8f0",
72
+ "300": "#cbd5e1",
73
+ "400": "#94a3b8",
74
+ "500": "#64748b",
75
+ "600": "#475569",
76
+ "700": "#334155",
77
+ "800": "#1e293b",
78
+ "900": "#0f172a",
79
+ "950": "#020617"
64
80
  }
65
81
  }
66
82
  }
@@ -1 +0,0 @@
1
- export declare function Spinner(): import("react/jsx-runtime").JSX.Element;
@@ -1,18 +0,0 @@
1
- import React from "react";
2
-
3
- export function Spinner() {
4
- return (
5
- <div role="status">
6
- <svg aria-hidden="true" className="w-8 h-8 mr-2 text-slate-200 animate-spin dark:text-slate-600 fill-primary"
7
- viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
8
- <path
9
- d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
10
- fill="currentColor"/>
11
- <path
12
- d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
13
- fill="currentFill"/>
14
- </svg>
15
- <span className="sr-only">Loading...</span>
16
- </div>
17
- );
18
- }
package/src/util/cn.ts DELETED
@@ -1,6 +0,0 @@
1
- import { type ClassValue, clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
3
-
4
- export function cn(...classes: ClassValue[]) {
5
- return twMerge(clsx(classes))
6
- }
File without changes
File without changes
File without changes