@firecms/ui 3.0.0-canary.14 → 3.0.0-canary.141

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 (107) hide show
  1. package/README.md +3 -3
  2. package/dist/components/Avatar.d.ts +1 -0
  3. package/dist/components/BooleanSwitch.d.ts +1 -1
  4. package/dist/components/CenteredView.d.ts +4 -2
  5. package/dist/components/Checkbox.d.ts +3 -2
  6. package/dist/components/Chip.d.ts +3 -2
  7. package/dist/components/DateTimeField.d.ts +5 -7
  8. package/dist/components/Dialog.d.ts +4 -1
  9. package/dist/components/DialogTitle.d.ts +9 -0
  10. package/dist/components/ExpandablePanel.d.ts +2 -1
  11. package/dist/components/FileUpload.d.ts +1 -1
  12. package/dist/components/InputLabel.d.ts +2 -2
  13. package/dist/components/Label.d.ts +4 -1
  14. package/dist/components/Markdown.d.ts +1 -0
  15. package/dist/components/Menu.d.ts +6 -2
  16. package/dist/components/Menubar.d.ts +79 -0
  17. package/dist/components/MultiSelect.d.ts +31 -16
  18. package/dist/components/Popover.d.ts +2 -1
  19. package/dist/components/RadioGroup.d.ts +26 -3
  20. package/dist/components/Select.d.ts +6 -10
  21. package/dist/components/Separator.d.ts +2 -1
  22. package/dist/components/Sheet.d.ts +6 -0
  23. package/dist/components/Slider.d.ts +21 -0
  24. package/dist/components/Table.d.ts +10 -10
  25. package/dist/components/TextField.d.ts +1 -1
  26. package/dist/components/TextareaAutosize.d.ts +3 -34
  27. package/dist/components/Tooltip.d.ts +6 -2
  28. package/dist/components/Typography.d.ts +5 -4
  29. package/dist/components/index.d.ts +3 -1
  30. package/dist/hooks/index.d.ts +3 -0
  31. package/dist/icons/Icon.d.ts +3 -3
  32. package/dist/index.css +73 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.es.js +13371 -14447
  35. package/dist/index.es.js.map +1 -1
  36. package/dist/index.umd.js +19782 -857
  37. package/dist/index.umd.js.map +1 -1
  38. package/dist/styles.d.ts +8 -8
  39. package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
  40. package/dist/util/index.d.ts +1 -3
  41. package/package.json +111 -118
  42. package/src/components/Alert.tsx +2 -2
  43. package/src/components/Autocomplete.tsx +5 -3
  44. package/src/components/Avatar.tsx +8 -7
  45. package/src/components/Badge.tsx +1 -1
  46. package/src/components/BooleanSwitch.tsx +15 -15
  47. package/src/components/BooleanSwitchWithLabel.tsx +9 -8
  48. package/src/components/Button.tsx +18 -20
  49. package/src/components/Card.tsx +4 -3
  50. package/src/components/CenteredView.tsx +25 -15
  51. package/src/components/Checkbox.tsx +11 -9
  52. package/src/components/Chip.tsx +8 -5
  53. package/src/components/CircularProgress.tsx +2 -2
  54. package/src/components/Collapse.tsx +4 -2
  55. package/src/components/Container.tsx +2 -2
  56. package/src/components/DateTimeField.tsx +142 -921
  57. package/src/components/DebouncedTextField.tsx +1 -0
  58. package/src/components/Dialog.tsx +16 -6
  59. package/src/components/DialogActions.tsx +2 -2
  60. package/src/components/DialogContent.tsx +2 -2
  61. package/src/components/DialogTitle.tsx +35 -0
  62. package/src/components/ExpandablePanel.tsx +20 -12
  63. package/src/components/FileUpload.tsx +8 -10
  64. package/src/components/IconButton.tsx +4 -6
  65. package/src/components/InfoLabel.tsx +2 -2
  66. package/src/components/InputLabel.tsx +11 -9
  67. package/src/components/Label.tsx +17 -4
  68. package/src/components/Markdown.tsx +15 -3
  69. package/src/components/Menu.tsx +49 -31
  70. package/src/components/Menubar.tsx +322 -0
  71. package/src/components/MultiSelect.tsx +336 -165
  72. package/src/components/Paper.tsx +2 -2
  73. package/src/components/Popover.tsx +18 -14
  74. package/src/components/RadioGroup.tsx +41 -9
  75. package/src/components/SearchBar.tsx +9 -9
  76. package/src/components/Select.tsx +97 -124
  77. package/src/components/Separator.tsx +10 -4
  78. package/src/components/Sheet.tsx +52 -30
  79. package/src/components/Skeleton.tsx +9 -6
  80. package/src/components/Slider.tsx +109 -0
  81. package/src/components/Table.tsx +50 -33
  82. package/src/components/Tabs.tsx +6 -7
  83. package/src/components/TextField.tsx +14 -16
  84. package/src/components/TextareaAutosize.tsx +4 -3
  85. package/src/components/Tooltip.tsx +31 -14
  86. package/src/components/Typography.tsx +42 -26
  87. package/src/components/common/SelectInputLabel.tsx +2 -2
  88. package/src/components/index.tsx +3 -1
  89. package/src/hooks/index.ts +3 -0
  90. package/src/icons/Icon.tsx +46 -43
  91. package/src/icons/icon_keys.ts +114 -1301
  92. package/src/index.css +73 -0
  93. package/src/index.ts +1 -0
  94. package/src/scripts/generateIconKeys.ts +20 -11
  95. package/src/styles.ts +8 -8
  96. package/src/util/cls.ts +14 -0
  97. package/src/util/index.ts +1 -3
  98. package/tailwind.config.js +8 -6
  99. package/dist/components/Spinner.d.ts +0 -1
  100. package/src/components/Spinner.tsx +0 -18
  101. package/src/util/cn.ts +0 -6
  102. /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
  103. /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
  104. /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
  105. /package/src/{util → hooks}/useDebounceValue.tsx +0 -0
  106. /package/src/{util → hooks}/useInjectStyles.tsx +0 -0
  107. /package/src/{util → hooks}/useOutsideAlerter.tsx +0 -0
@@ -1,24 +1,34 @@
1
1
  import React from "react";
2
2
  import { Container } from "./Container";
3
- import { cn } from "../util";
3
+ import { cls } from "../util";
4
4
 
5
- export function CenteredView({
6
- children,
7
- maxWidth,
8
- className,
9
- fullScreen
10
- }: {
5
+ export type CenteredViewProps = {
11
6
  children: React.ReactNode;
12
7
  maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
8
+ outerClassName?: string;
13
9
  className?: string;
14
10
  fullScreen?: boolean;
15
- }) {
11
+ };
16
12
 
17
- return <div className={cn("flex flex-col flex-grow", fullScreen ? "h-screen" : "h-full")}>
18
- <Container className={cn("m-auto", className)}
19
- maxWidth={maxWidth}>
20
- {children}
21
- </Container>
22
- </div>
13
+ export const CenteredView = React.forwardRef<HTMLDivElement, CenteredViewProps>(({
14
+ children,
15
+ maxWidth,
16
+ outerClassName,
17
+ className,
18
+ fullScreen,
19
+ ...rest
20
+ }, ref) => { // Notice how the ref is now received as the second argument
23
21
 
24
- }
22
+ return (
23
+ <div ref={ref}
24
+ className={cls("flex flex-col flex-grow", fullScreen ? "h-screen" : "h-full", outerClassName)}
25
+ {...rest}>
26
+ <Container className={cls("m-auto", className)} maxWidth={maxWidth}>
27
+ {children}
28
+ </Container>
29
+ </div>
30
+ );
31
+
32
+ });
33
+
34
+ CenteredView.displayName = "CenteredView";
@@ -2,15 +2,16 @@ import React from "react";
2
2
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
3
 
4
4
  import { Icon } from "../icons";
5
- import { cn } from "../util";
5
+ import { cls } from "../util";
6
6
 
7
7
  export interface CheckboxProps {
8
8
  checked: boolean;
9
+ id?: string;
9
10
  disabled?: boolean;
10
11
  indeterminate?: boolean;
11
12
  onCheckedChange?: (checked: boolean) => void;
12
13
  padding?: boolean;
13
- size?: "tiny" | "small" | "medium" | "large";
14
+ size?: "smallest" | "small" | "medium" | "large";
14
15
  color?: "primary" | "secondary";
15
16
  }
16
17
 
@@ -18,20 +19,20 @@ const sizeClasses = {
18
19
  large: "w-6 h-6 rounded flex items-center justify-center",
19
20
  medium: "w-5 h-5 rounded flex items-center justify-center",
20
21
  small: "w-4 h-4 rounded flex items-center justify-center",
21
- tiny: "w-4 h-4 rounded flex items-center justify-center"
22
+ smallest: "w-4 h-4 rounded flex items-center justify-center"
22
23
  };
23
24
 
24
25
  const outerSizeClasses = {
25
26
  medium: "w-10 h-10",
26
27
  small: "w-8 h-8",
27
28
  large: "w-12 h-12 ",
28
- tiny: "w-6 h-6"
29
+ smallest: "w-6 h-6"
29
30
  }
30
31
  const paddingClasses = {
31
32
  medium: "p-2",
32
33
  small: "p-2",
33
34
  large: "p-2",
34
- tiny: ""
35
+ smallest: ""
35
36
  }
36
37
 
37
38
  const colorClasses = {
@@ -40,6 +41,7 @@ const colorClasses = {
40
41
  }
41
42
 
42
43
  export const Checkbox = ({
44
+ id,
43
45
  checked,
44
46
  indeterminate = false,
45
47
  padding = true,
@@ -55,17 +57,17 @@ export const Checkbox = ({
55
57
  ? 20
56
58
  : size === "small"
57
59
  ? 16
58
- : size === "tiny"
60
+ : size === "smallest"
59
61
  ? 14
60
62
  : 24;
61
63
  return (
62
64
  <CheckboxPrimitive.Root
63
- asChild
65
+ id={id}
64
66
  checked={indeterminate || isChecked}
65
67
  disabled={disabled}
66
68
  onCheckedChange={disabled ? undefined : onCheckedChange}>
67
69
 
68
- <div className={cn(
70
+ <div className={cls(
69
71
  padding ? paddingClasses[size] : "",
70
72
  outerSizeClasses[size],
71
73
  "inline-flex items-center justify-center text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150",
@@ -73,7 +75,7 @@ export const Checkbox = ({
73
75
  onCheckedChange ? "cursor-pointer" : "cursor-default"
74
76
  )}>
75
77
  <div
76
- className={cn(
78
+ className={cls(
77
79
  "border-2 relative transition-colors ease-in-out duration-150",
78
80
  sizeClasses[size],
79
81
  disabled
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { CHIP_COLORS, cn, getColorSchemeForKey } from "../util";
2
+ import { CHIP_COLORS, cls, getColorSchemeForKey } from "../util";
3
3
 
4
4
  export type ChipColorScheme = {
5
5
  color: string;
@@ -11,16 +11,17 @@ export type ChipColorKey = keyof typeof CHIP_COLORS;
11
11
  export interface ChipProps {
12
12
  className?: string;
13
13
  children: React.ReactNode;
14
- size?: "tiny" | "small" | "medium";
14
+ size?: "smallest" | "small" | "medium";
15
15
  colorScheme?: ChipColorScheme | ChipColorKey;
16
16
  error?: boolean;
17
17
  outlined?: boolean;
18
18
  onClick?: () => void;
19
19
  icon?: React.ReactNode;
20
+ style?: React.CSSProperties;
20
21
  }
21
22
 
22
23
  const sizeClassNames = {
23
- tiny: "px-2 py-0.5 text-sm",
24
+ smallest: "px-2 py-0.5 text-sm",
24
25
  small: "px-3 py-1 text-sm",
25
26
  medium: "px-4 py-1.5 text-sm"
26
27
  }
@@ -36,13 +37,14 @@ export function Chip({
36
37
  onClick,
37
38
  icon,
38
39
  size = "medium",
39
- className
40
+ className,
41
+ style
40
42
  }: ChipProps) {
41
43
 
42
44
  const usedColorScheme = typeof colorScheme === "string" ? getColorSchemeForKey(colorScheme) : colorScheme;
43
45
  return (
44
46
  <div
45
- className={cn("rounded-lg w-fit h-fit font-regular inline-flex gap-1",
47
+ className={cls("rounded-lg max-w-full w-max h-fit font-regular inline-flex gap-1",
46
48
  "text-ellipsis",
47
49
  onClick ? "cursor-pointer hover:bg-slate-300 hover:dark:bg-slate-700" : "",
48
50
  sizeClassNames[size],
@@ -54,6 +56,7 @@ export function Chip({
54
56
  backgroundColor: error || !usedColorScheme ? undefined : usedColorScheme.color,
55
57
  color: error || !usedColorScheme ? undefined : usedColorScheme.text,
56
58
  overflow: "hidden",
59
+ ...style
57
60
  // display: "-webkit-box",
58
61
  // WebkitLineClamp: 1,
59
62
  // WebkitBoxOrient: "vertical",
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { cn } from "../util";
2
+ import { cls } from "../util";
3
3
 
4
4
  export type CircularProgressProps = {
5
5
  size?: "small" | "medium" | "large",
@@ -31,7 +31,7 @@ export function CircularProgress({
31
31
 
32
32
  return (
33
33
  <div
34
- className={cn(
34
+ className={cls(
35
35
  sizeClasses,
36
36
  borderClasses,
37
37
  "inline-block animate-spin rounded-full border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
@@ -1,7 +1,9 @@
1
+ "use client";
1
2
  import React from "react";
2
3
  import * as Collapsible from "@radix-ui/react-collapsible";
3
4
 
4
- import { cn, useInjectStyles } from "../util";
5
+ import { cls } from "../util";
6
+ import { useInjectStyles } from "../hooks";
5
7
 
6
8
  interface CollapseProps {
7
9
  children?: React.ReactNode;
@@ -53,7 +55,7 @@ export function Collapse({
53
55
  className={className}>
54
56
 
55
57
  <Collapsible.Content
56
- className={cn(`CollapseContent-${duration}`)}
58
+ className={cls(`CollapseContent-${duration}`)}
57
59
  >
58
60
  {children}
59
61
  </Collapsible.Content>
@@ -1,5 +1,5 @@
1
1
  import React, { ForwardRefRenderFunction } from "react";
2
- import { cn } from "../util";
2
+ import { cls } from "../util";
3
3
 
4
4
  export type ContainerProps = {
5
5
  children: React.ReactNode;
@@ -37,7 +37,7 @@ const ContainerInner: ForwardRefRenderFunction<HTMLDivElement, ContainerProps> =
37
37
  return (
38
38
  <div
39
39
  ref={ref}
40
- className={cn("mx-auto px-3 md:px-4 lg-px-6",
40
+ className={cls("mx-auto px-3 md:px-4 lg-px-6",
41
41
  classForMaxWidth,
42
42
  className)}
43
43
  style={style}>