@firecms/ui 3.0.0-canary.15 → 3.0.0-canary.150

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 (110) 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/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/DialogTitle.d.ts +9 -0
  12. package/dist/components/ExpandablePanel.d.ts +2 -1
  13. package/dist/components/FileUpload.d.ts +1 -1
  14. package/dist/components/InputLabel.d.ts +2 -2
  15. package/dist/components/Label.d.ts +4 -1
  16. package/dist/components/Markdown.d.ts +1 -0
  17. package/dist/components/Menu.d.ts +6 -2
  18. package/dist/components/Menubar.d.ts +79 -0
  19. package/dist/components/MultiSelect.d.ts +32 -16
  20. package/dist/components/Popover.d.ts +2 -1
  21. package/dist/components/RadioGroup.d.ts +26 -3
  22. package/dist/components/Select.d.ts +6 -10
  23. package/dist/components/Separator.d.ts +2 -1
  24. package/dist/components/Sheet.d.ts +6 -0
  25. package/dist/components/Slider.d.ts +21 -0
  26. package/dist/components/Table.d.ts +10 -10
  27. package/dist/components/Tabs.d.ts +4 -2
  28. package/dist/components/TextField.d.ts +1 -1
  29. package/dist/components/TextareaAutosize.d.ts +3 -34
  30. package/dist/components/Tooltip.d.ts +6 -2
  31. package/dist/components/Typography.d.ts +5 -4
  32. package/dist/components/index.d.ts +3 -1
  33. package/dist/hooks/index.d.ts +3 -0
  34. package/dist/icons/Icon.d.ts +3 -3
  35. package/dist/index.css +73 -0
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.es.js +13410 -14466
  38. package/dist/index.es.js.map +1 -1
  39. package/dist/index.umd.js +19802 -857
  40. package/dist/index.umd.js.map +1 -1
  41. package/dist/styles.d.ts +9 -9
  42. package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
  43. package/dist/util/index.d.ts +1 -3
  44. package/package.json +112 -118
  45. package/src/components/Alert.tsx +4 -4
  46. package/src/components/Autocomplete.tsx +7 -5
  47. package/src/components/Avatar.tsx +40 -26
  48. package/src/components/Badge.tsx +2 -2
  49. package/src/components/BooleanSwitch.tsx +19 -19
  50. package/src/components/BooleanSwitchWithLabel.tsx +20 -11
  51. package/src/components/Button.tsx +30 -23
  52. package/src/components/Card.tsx +4 -3
  53. package/src/components/CenteredView.tsx +25 -15
  54. package/src/components/Checkbox.tsx +16 -14
  55. package/src/components/Chip.tsx +10 -7
  56. package/src/components/CircularProgress.tsx +3 -3
  57. package/src/components/Collapse.tsx +4 -2
  58. package/src/components/Container.tsx +2 -2
  59. package/src/components/DateTimeField.tsx +142 -921
  60. package/src/components/DebouncedTextField.tsx +1 -0
  61. package/src/components/Dialog.tsx +17 -7
  62. package/src/components/DialogActions.tsx +3 -3
  63. package/src/components/DialogContent.tsx +2 -2
  64. package/src/components/DialogTitle.tsx +35 -0
  65. package/src/components/ExpandablePanel.tsx +20 -12
  66. package/src/components/FileUpload.tsx +8 -10
  67. package/src/components/IconButton.tsx +6 -10
  68. package/src/components/InfoLabel.tsx +2 -2
  69. package/src/components/InputLabel.tsx +11 -9
  70. package/src/components/Label.tsx +17 -4
  71. package/src/components/Markdown.tsx +15 -3
  72. package/src/components/Menu.tsx +49 -31
  73. package/src/components/Menubar.tsx +322 -0
  74. package/src/components/MultiSelect.tsx +342 -168
  75. package/src/components/Paper.tsx +2 -2
  76. package/src/components/Popover.tsx +19 -15
  77. package/src/components/RadioGroup.tsx +41 -9
  78. package/src/components/SearchBar.tsx +12 -11
  79. package/src/components/Select.tsx +99 -126
  80. package/src/components/Separator.tsx +10 -4
  81. package/src/components/Sheet.tsx +53 -31
  82. package/src/components/Skeleton.tsx +9 -6
  83. package/src/components/Slider.tsx +109 -0
  84. package/src/components/Table.tsx +52 -35
  85. package/src/components/Tabs.tsx +19 -15
  86. package/src/components/TextField.tsx +16 -18
  87. package/src/components/TextareaAutosize.tsx +4 -3
  88. package/src/components/Tooltip.tsx +33 -16
  89. package/src/components/Typography.tsx +42 -26
  90. package/src/components/common/SelectInputLabel.tsx +3 -3
  91. package/src/components/index.tsx +3 -1
  92. package/src/hooks/index.ts +3 -0
  93. package/src/icons/Icon.tsx +46 -43
  94. package/src/icons/icon_keys.ts +114 -1301
  95. package/src/index.css +73 -0
  96. package/src/index.ts +1 -0
  97. package/src/scripts/generateIconKeys.ts +20 -11
  98. package/src/styles.ts +9 -9
  99. package/src/util/cls.ts +14 -0
  100. package/src/util/index.ts +1 -3
  101. package/tailwind.config.js +42 -26
  102. package/dist/components/Spinner.d.ts +0 -1
  103. package/src/components/Spinner.tsx +0 -18
  104. package/src/util/cn.ts +0 -6
  105. /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
  106. /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
  107. /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
  108. /package/src/{util → hooks}/useDebounceValue.tsx +0 -0
  109. /package/src/{util → hooks}/useInjectStyles.tsx +0 -0
  110. /package/src/{util → hooks}/useOutsideAlerter.tsx +0 -0
@@ -0,0 +1,109 @@
1
+ import * as React from "react";
2
+ import { cls } from "../util";
3
+ import * as SliderPrimitive from "@radix-ui/react-slider";
4
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
5
+
6
+ export interface SliderProps {
7
+ className?: string;
8
+ name?: string;
9
+ disabled?: boolean;
10
+ orientation?: React.AriaAttributes["aria-orientation"];
11
+ dir?: "ltr" | "rtl";
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ minStepsBetweenThumbs?: number;
16
+ value?: number[];
17
+ defaultValue?: number[];
18
+ onValueChange?: (value: number[]) => void;
19
+ onValueCommit?: (value: number[]) => void;
20
+ inverted?: boolean;
21
+ form?: string;
22
+ size?: "small" | "regular";
23
+ }
24
+
25
+ function SliderThumb(props: {
26
+ props: Omit<React.PropsWithoutRef<SliderProps>, "size" | "className">,
27
+ index: number,
28
+ hovered: boolean,
29
+ classes: string
30
+ }) {
31
+ return <TooltipPrimitive.Root open={props.hovered}>
32
+ <TooltipPrimitive.Trigger asChild>
33
+ <SliderPrimitive.Thumb
34
+ className={cls({
35
+ "border-primary bg-primary hover:bg-primary-dark outline-none": !props.props.disabled,
36
+ "border-surface-accent-300 bg-surface-accent-300 dark:border-surface-700 dark:bg-surface-700": props.props.disabled
37
+ },
38
+ props.classes,
39
+ "focus-visible:ring-4 focus-visible:ring-primary focus-visible:ring-opacity-50",
40
+ "hover:ring-4 hover:ring-primary hover:ring-opacity-25",
41
+ "block rounded-full transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50")}
42
+
43
+ />
44
+ </TooltipPrimitive.Trigger>
45
+ <TooltipPrimitive.Content side="top"
46
+ sideOffset={5}
47
+ className={cls(
48
+ "TooltipContent",
49
+ "max-w-lg leading-relaxed",
50
+ "z-50 rounded px-3 py-2 text-xs leading-none bg-surface-accent-700 dark:bg-surface-accent-800 bg-opacity-90 font-medium text-surface-accent-50 shadow-2xl select-none duration-400 ease-in transform opacity-100",
51
+ )}>
52
+ {props.props.value?.[props.index]}
53
+ </TooltipPrimitive.Content>
54
+ </TooltipPrimitive.Root>;
55
+ }
56
+
57
+ const Slider = React.forwardRef<
58
+ React.ElementRef<typeof SliderPrimitive.Root>,
59
+ SliderProps
60
+ >(({
61
+ className,
62
+ size = "regular",
63
+ ...props
64
+ }, ref) => {
65
+ const [hovered, setHovered] = React.useState(false);
66
+
67
+ const thumbSizeClasses =
68
+ size === "small"
69
+ ? "h-4 w-4" // Smaller size for the thumb
70
+ : "h-6 w-6"; // Default size
71
+
72
+ return (
73
+ <TooltipPrimitive.Provider delayDuration={200}>
74
+ <SliderPrimitive.Root
75
+ ref={ref}
76
+ onMouseEnter={() => setHovered(true)}
77
+ onMouseLeave={() => setHovered(false)}
78
+ className={cls(
79
+ "relative flex w-full touch-none select-none items-center",
80
+ className
81
+ )}
82
+ {...props}
83
+ >
84
+ <SliderPrimitive.Track
85
+ style={{ height: size === "small" ? 4 : 8 }}
86
+ className={"relative w-full grow overflow-hidden rounded-full bg-surface-accent-300 bg-opacity-40 dark:bg-surface-700 dark:bg-opacity-40"}>
87
+
88
+ <SliderPrimitive.Range
89
+ className={cls("absolute h-full", {
90
+ "bg-primary": !props.disabled,
91
+ "bg-surface-accent-300 dark:bg-surface-700": props.disabled,
92
+ })}
93
+ />
94
+ </SliderPrimitive.Track>
95
+
96
+ {(props.value ?? [0]).map((_, index) => <SliderThumb
97
+ key={index}
98
+ index={index}
99
+ props={props}
100
+ hovered={hovered}
101
+ classes={thumbSizeClasses}/>)}
102
+ </SliderPrimitive.Root>
103
+ </TooltipPrimitive.Provider>
104
+ );
105
+ });
106
+
107
+ Slider.displayName = "Slider";
108
+
109
+ export { Slider };
@@ -1,21 +1,24 @@
1
1
  import React, { useRef } from "react";
2
2
  import { defaultBorderMixin } from "../styles";
3
- import { cn } from "../util";
3
+ import { cls } from "../util";
4
4
 
5
5
  export type TableProps = {
6
6
  children: React.ReactNode;
7
7
  className?: string;
8
8
  style?: React.CSSProperties;
9
- };
9
+ } & React.TableHTMLAttributes<HTMLTableElement>;
10
10
 
11
11
  export const Table = ({
12
12
  children,
13
13
  className,
14
- style
14
+ style,
15
+ ...rest
15
16
  }: TableProps) => (
16
- <table className={cn("w-full text-left text-gray-800 dark:text-white rounded-md overflow-x-auto",
17
- className)}
18
- style={style}>
17
+ <table
18
+ className={cls("text-left text-surface-800 dark:text-white rounded-md overflow-x-auto", className)}
19
+ style={style}
20
+ {...rest}
21
+ >
19
22
  {children}
20
23
  </table>
21
24
  );
@@ -23,13 +26,17 @@ export const Table = ({
23
26
  export type TableBodyProps = {
24
27
  children?: React.ReactNode;
25
28
  className?: string;
26
- };
29
+ } & React.HTMLAttributes<HTMLTableSectionElement>;
30
+
27
31
  export const TableBody = ({
28
32
  children,
29
- className
33
+ className,
34
+ ...rest
30
35
  }: TableBodyProps) => (
31
36
  <tbody
32
- className={cn("bg-white text-sm dark:bg-gray-800 divide-y divide-slate-200 dark:divide-gray-700", className)}>
37
+ className={cls("bg-white dark:bg-surface-950 text-sm divide-y divide-surface-100 dark:divide-surface-700 dark:divide-opacity-70", className)}
38
+ {...rest}
39
+ >
33
40
  {children}
34
41
  </tbody>
35
42
  );
@@ -37,17 +44,22 @@ export const TableBody = ({
37
44
  export type TableHeaderProps = {
38
45
  children?: React.ReactNode;
39
46
  className?: string;
40
- };
47
+ } & React.HTMLAttributes<HTMLTableSectionElement>;
41
48
 
42
49
  export const TableHeader = ({
43
50
  children,
44
- className
51
+ className,
52
+ ...rest
45
53
  }: TableHeaderProps) => (
46
- <thead>
47
- <tr className={cn(
48
- defaultBorderMixin,
49
- "text-sm font-medium text-gray-700 dark:text-slate-300",
50
- "bg-slate-50 border-b dark:bg-gray-900", className)}>
54
+ <thead {...rest}>
55
+ <tr
56
+ className={cls(
57
+ defaultBorderMixin,
58
+ "text-sm font-medium text-surface-700 dark:text-surface-accent-300",
59
+ "bg-surface-accent-50 border-b dark:bg-surface-900",
60
+ className
61
+ )}
62
+ >
51
63
  {children}
52
64
  </tr>
53
65
  </thead>
@@ -58,22 +70,24 @@ export type TableRowProps = {
58
70
  className?: string;
59
71
  onClick?: React.MouseEventHandler<any>;
60
72
  style?: React.CSSProperties;
61
- };
73
+ } & React.HTMLAttributes<HTMLTableRowElement>;
62
74
 
63
75
  export const TableRow = ({
64
76
  children,
65
77
  className,
66
78
  onClick,
67
- style
79
+ style,
80
+ ...rest
68
81
  }: TableRowProps) => (
69
82
  <tr
70
83
  onClick={onClick}
71
84
  style={style}
72
- className={cn(
73
- "divide-slate-100 dark:divide-gray-800",
74
- "bg-white dark:bg-gray-950",
75
- onClick ? "hover:bg-slate-100 dark:hover:bg-gray-800 cursor-pointer" : "",
76
- className)}
85
+ className={cls(
86
+ "bg-white dark:bg-surface-950",
87
+ onClick ? "hover:bg-surface-accent-100 dark:hover:bg-surface-accent-800 cursor-pointer" : "",
88
+ className
89
+ )}
90
+ {...rest}
77
91
  >
78
92
  {children}
79
93
  </tr>
@@ -87,7 +101,7 @@ export type TableCellProps = {
87
101
  style?: React.CSSProperties;
88
102
  align?: "left" | "center" | "right";
89
103
  colspan?: number;
90
- };
104
+ } & React.HTMLAttributes<HTMLTableCellElement>;
91
105
 
92
106
  export const TableCell = ({
93
107
  children,
@@ -96,20 +110,24 @@ export const TableCell = ({
96
110
  align,
97
111
  className,
98
112
  style,
99
- colspan
113
+ colspan,
114
+ ...rest
100
115
  }: TableCellProps) => {
101
-
102
116
  const ref = useRef<HTMLTableCellElement>(null);
103
-
104
117
  const Tag = header || getParentName(ref.current) === "TableHeader" ? "th" : "td";
105
118
  return (
106
- <Tag scope={scope}
107
- colSpan={colspan}
108
- ref={ref}
109
- style={style}
110
- className={cn("px-4 py-3 text-clip ",
111
- align === "center" ? "text-center" : (align === "right" ? "text-right" : "text-left"),
112
- className)}>
119
+ <Tag
120
+ scope={scope}
121
+ colSpan={colspan}
122
+ ref={ref}
123
+ style={style}
124
+ className={cls(
125
+ "px-4 py-3 text-clip ",
126
+ align === "center" ? "text-center" : (align === "right" ? "text-right" : "text-left"),
127
+ className
128
+ )}
129
+ {...rest}
130
+ >
113
131
  {children}
114
132
  </Tag>
115
133
  );
@@ -124,7 +142,6 @@ function getParentName(element: HTMLElement | null): string | undefined {
124
142
  key.startsWith("__reactInternalInstance$")
125
143
  );
126
144
  });
127
-
128
145
  // @ts-ignore
129
146
  const domFiber = element[key];
130
147
  // @ts-ignore
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
  import * as TabsPrimitive from "@radix-ui/react-tabs";
3
- import { focusedMixin } from "../styles";
4
- import { cn } from "../util";
3
+ import { cls } from "../util";
5
4
 
6
5
  export type TabsProps = {
7
6
  value: string,
8
7
  children: React.ReactNode,
8
+ innerClassName?: string,
9
9
  className?: string,
10
10
  onValueChange: (value: string) => void
11
11
  };
@@ -14,13 +14,14 @@ export function Tabs({
14
14
  value,
15
15
  onValueChange,
16
16
  className,
17
+ innerClassName,
17
18
  children
18
19
  }: TabsProps) {
19
20
 
20
- return <TabsPrimitive.Root value={value} onValueChange={onValueChange}>
21
- <TabsPrimitive.List className={cn(
22
- "flex text-sm font-medium text-center text-slate-800 dark:text-white max-w-full overflow-auto no-scrollbar",
23
- className)
21
+ return <TabsPrimitive.Root value={value} onValueChange={onValueChange} className={className}>
22
+ <TabsPrimitive.List className={cls(
23
+ "flex text-sm font-medium text-center text-surface-accent-800 dark:text-white max-w-full overflow-auto no-scrollbar items-end",
24
+ innerClassName)
24
25
  }>
25
26
  {children}
26
27
  </TabsPrimitive.List>
@@ -30,6 +31,7 @@ export function Tabs({
30
31
  export type TabProps = {
31
32
  value: string,
32
33
  className?: string,
34
+ innerClassName?: string,
33
35
  children: React.ReactNode,
34
36
  disabled?: boolean
35
37
  };
@@ -37,24 +39,26 @@ export type TabProps = {
37
39
  export function Tab({
38
40
  value,
39
41
  className,
42
+ innerClassName,
40
43
  children,
41
44
  disabled
42
45
  }: TabProps) {
43
46
  return <TabsPrimitive.Trigger value={value}
44
47
  disabled={disabled}
45
- className={cn(focusedMixin,
48
+ className={cls(
46
49
  "border-b-2 border-transparent",
47
50
  "data-[state=active]:border-secondary",
48
51
  disabled
49
- ? "text-slate-400 dark:text-slate-500"
50
- : cn("text-slate-700 dark:text-slate-300",
51
- "data-[state=active]:text-slate-900 data-[state=active]:dark:text-white",
52
- "hover:text-slate-800 dark:hover:text-slate-200"),
53
- // disabled ? "text-slate-400 dark:text-slate-500" : "data-[state=active]:text-primary",
54
- // "data-[state=active]:bg-slate-50 data-[state=active]:dark:bg-slate-800",
52
+ ? "text-surface-accent-400 dark:text-surface-accent-500"
53
+ : cls("text-surface-accent-700 dark:text-surface-accent-300",
54
+ "data-[state=active]:text-surface-accent-900 data-[state=active]:dark:text-white",
55
+ "hover:text-surface-accent-800 dark:hover:text-surface-accent-200"),
56
+ // disabled ? "text-surface-accent-400 dark:text-surface-accent-500" : "data-[state=active]:text-primary",
57
+ // "data-[state=active]:bg-surface-accent-50 data-[state=active]:dark:bg-surface-accent-800",
55
58
  className)}>
56
- <div className={cn("uppercase inline-block p-2 px-4 m-2 rounded",
57
- "hover:bg-slate-100 dark:hover:bg-slate-800")}>
59
+ <div className={cls("uppercase inline-block p-2 px-4 m-2 rounded",
60
+ "hover:bg-surface-accent-200 hover:bg-opacity-75 dark:hover:bg-surface-accent-800",
61
+ innerClassName)}>
58
62
  {children}
59
63
  </div>
60
64
  </TabsPrimitive.Trigger>;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import React, { useCallback, useEffect, useRef } from "react";
2
3
 
3
4
  import { TextareaAutosize } from "./TextareaAutosize";
@@ -7,10 +8,9 @@ import {
7
8
  fieldBackgroundInvisibleMixin,
8
9
  fieldBackgroundMixin,
9
10
  focusedInvisibleMixin,
10
- focusedMixin
11
11
  } from "../styles";
12
12
  import { InputLabel } from "./InputLabel";
13
- import { cn } from "../util";
13
+ import { cls } from "../util";
14
14
 
15
15
  export type InputType =
16
16
  "text"
@@ -40,7 +40,7 @@ export type TextFieldProps<T extends string | number> = {
40
40
  endAdornment?: React.ReactNode,
41
41
  autoFocus?: boolean,
42
42
  placeholder?: string,
43
- size?: "small" | "medium",
43
+ size?: "smallest" | "small" | "medium",
44
44
  className?: string,
45
45
  style?: React.CSSProperties,
46
46
  inputClassName?: string,
@@ -70,7 +70,6 @@ export function TextField<T extends string | number>({
70
70
  ...inputProps
71
71
  }: TextFieldProps<T>) {
72
72
 
73
- // eslint-disable-next-line react-hooks/rules-of-hooks
74
73
  const inputRef = inputRefProp ?? useRef(null);
75
74
 
76
75
  // @ts-ignore
@@ -80,7 +79,7 @@ export function TextField<T extends string | number>({
80
79
  useEffect(() => {
81
80
  if (type !== "number") return;
82
81
  const handleWheel = (event: any) => {
83
- event.preventDefault(); // Prevent scrolling the number input
82
+ if (event.target instanceof HTMLElement) event.target.blur()
84
83
  };
85
84
 
86
85
  // Current input element
@@ -106,15 +105,13 @@ export function TextField<T extends string | number>({
106
105
  placeholder={focused || hasValue || !label ? placeholder : undefined}
107
106
  autoFocus={autoFocus}
108
107
  rows={rows}
109
- // onFocus={() => setFocused(true)}
110
- // onBlur={() => setFocused(false)}
111
108
  value={value ?? ""}
112
109
  onChange={onChange}
113
110
  style={inputStyle}
114
- className={cn(
115
- invisible ? focusedInvisibleMixin : focusedMixin,
116
- "rounded-md resize-none w-full outline-none p-[32px] text-base bg-transparent min-h-[64px] px-3 pt-[28px]",
117
- disabled && "border border-transparent outline-none opacity-50 text-slate-600 dark:text-slate-500"
111
+ className={cls(
112
+ invisible ? focusedInvisibleMixin : "",
113
+ "rounded-md resize-none w-full outline-none p-[32px] text-base bg-transparent min-h-[64px] px-3 pt-8",
114
+ disabled && "border border-transparent outline-none opacity-50 text-surface-accent-600 dark:text-surface-accent-500"
118
115
  )}
119
116
  />
120
117
  : <input
@@ -123,16 +120,16 @@ export function TextField<T extends string | number>({
123
120
  onWheel={type === "number" ? numberInputOnWheelPreventChange : undefined}
124
121
  disabled={disabled}
125
122
  style={inputStyle}
126
- className={cn(
123
+ className={cls(
127
124
  "w-full outline-none bg-transparent leading-normal px-3",
128
125
  "rounded-md",
129
- invisible ? focusedInvisibleMixin : focusedMixin,
126
+ invisible ? focusedInvisibleMixin : "",
130
127
  disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
131
- size === "small" ? "min-h-[48px]" : "min-h-[64px]",
132
- label ? (size === "medium" ? "pt-[28px] pb-2" : "pt-4 pb-2") : "py-2",
128
+ size === "smallest" ? "min-h-[32px]" : (size === "small" ? "min-h-[48px]" : "min-h-[64px]"),
129
+ label ? (size === "medium" ? "pt-8 pb-2" : "pt-4 pb-2") : "py-2",
133
130
  focused ? "text-text-primary dark:text-text-primary-dark" : "",
134
131
  endAdornment ? "pr-10" : "pr-3",
135
- disabled && "border border-transparent outline-none opacity-50 dark:opacity-50 text-slate-800 dark:text-white",
132
+ disabled && "border border-transparent outline-none opacity-50 dark:opacity-50 text-surface-accent-800 dark:text-white",
136
133
  inputClassName
137
134
  )}
138
135
  placeholder={focused || hasValue || !label ? placeholder : undefined}
@@ -146,12 +143,13 @@ export function TextField<T extends string | number>({
146
143
 
147
144
  return (
148
145
  <div
149
- className={cn(
146
+ className={cls(
150
147
  "rounded-md relative max-w-full",
151
148
  invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,
152
149
  disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
153
150
  error ? "border border-red-500 dark:border-red-600" : "",
154
151
  {
152
+ "min-h-[32px]": !invisible && size === "smallest",
155
153
  "min-h-[48px]": !invisible && size === "small",
156
154
  "min-h-[64px]": !invisible && size === "medium"
157
155
  },
@@ -160,7 +158,7 @@ export function TextField<T extends string | number>({
160
158
 
161
159
  {label && (
162
160
  <InputLabel
163
- className={cn(
161
+ className={cls(
164
162
  "pointer-events-none absolute",
165
163
  size === "medium" ? "top-1" : "-top-1",
166
164
  !error ? (focused ? "text-primary dark:text-primary" : "text-text-secondary dark:text-text-secondary-dark") : "text-red-500 dark:text-red-600",
@@ -1,7 +1,8 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import { useLayoutEffect } from "react";
3
4
  import * as ReactDOM from "react-dom";
4
- import { cn, debounce } from "../util";
5
+ import { cls, debounce } from "../util";
5
6
 
6
7
  type State = {
7
8
  outerHeightStyle: number;
@@ -276,7 +277,7 @@ export const TextareaAutosize = React.forwardRef(function TextareaAutosize(
276
277
  />
277
278
  <textarea
278
279
  aria-hidden
279
- className={cn(props.className, props.shadowClassName)}
280
+ className={cls(props.className, props.shadowClassName)}
280
281
  readOnly
281
282
  ref={shadowRef}
282
283
  tabIndex={-1}
@@ -288,7 +289,7 @@ export const TextareaAutosize = React.forwardRef(function TextareaAutosize(
288
289
  />
289
290
  </React.Fragment>
290
291
  );
291
- });
292
+ }) as React.FC<TextareaAutosizeProps & { ref?: React.ForwardedRef<Element> }>;
292
293
 
293
294
  export type TextareaAutosizeProps = Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, "onResize"> & {
294
295
 
@@ -1,34 +1,44 @@
1
+ "use client";
1
2
  import React from "react";
2
3
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
4
 
4
- import { cn, useInjectStyles } from "../util";
5
+ import { cls } from "../util";
6
+ import { useInjectStyles } from "../hooks";
5
7
 
6
8
  export type TooltipProps = {
7
9
  open?: boolean,
10
+ defaultOpen?: boolean,
8
11
  onOpenChange?: (open: boolean) => void,
9
12
  side?: "top" | "bottom" | "left" | "right",
10
13
  align?: "start" | "center" | "end",
11
14
  sideOffset?: number,
12
15
  title?: string | React.ReactNode,
13
16
  delayDuration?: number;
14
- className?: string,
17
+ asChild?: boolean;
15
18
  tooltipClassName?: string,
19
+ tooltipStyle?: React.CSSProperties;
16
20
  children: React.ReactNode,
21
+ className?: string,
22
+ container?: HTMLElement,
17
23
  style?: React.CSSProperties;
18
24
  };
19
25
 
20
26
  export const Tooltip = ({
21
27
  open,
28
+ defaultOpen,
22
29
  side = "bottom",
23
- delayDuration = 250,
30
+ delayDuration = 200,
24
31
  sideOffset,
25
32
  align,
26
33
  onOpenChange,
27
34
  title,
28
- className,
29
- style,
30
35
  tooltipClassName,
31
- children
36
+ tooltipStyle,
37
+ children,
38
+ asChild = false,
39
+ container,
40
+ className,
41
+ style
32
42
  }: TooltipProps) => {
33
43
 
34
44
  useInjectStyles("Tooltip", styles);
@@ -36,25 +46,32 @@ export const Tooltip = ({
36
46
  if (!title)
37
47
  return <>{children}</>;
38
48
 
49
+ const trigger = asChild
50
+ ? <TooltipPrimitive.Trigger asChild={true}>
51
+ {children}
52
+ </TooltipPrimitive.Trigger>
53
+ : <TooltipPrimitive.Trigger asChild={true}>
54
+ <div style={style} className={className}>
55
+ {children}
56
+ </div>
57
+ </TooltipPrimitive.Trigger>;
58
+
39
59
  return (
40
60
  <TooltipPrimitive.Provider delayDuration={delayDuration}>
41
- <TooltipPrimitive.Root open={open} onOpenChange={onOpenChange}>
42
- <TooltipPrimitive.Trigger asChild>
43
- <div className={className} style={style}>
44
- {children}
45
- </div>
46
- </TooltipPrimitive.Trigger>
47
- <TooltipPrimitive.Portal>
61
+ <TooltipPrimitive.Root open={open} onOpenChange={onOpenChange} defaultOpen={defaultOpen}>
62
+ {trigger}
63
+ <TooltipPrimitive.Portal container={container}>
48
64
  <TooltipPrimitive.Content
49
- className={cn("TooltipContent",
65
+ className={cls("TooltipContent",
50
66
  "max-w-lg leading-relaxed",
51
- "z-50 rounded px-3 py-2 text-xs leading-none bg-slate-700 dark:bg-slate-800 bg-opacity-90 font-medium text-slate-50 shadow-2xl select-none duration-400 ease-in transform opacity-100",
67
+ "z-50 rounded px-3 py-2 text-xs leading-none bg-surface-accent-700 dark:bg-surface-accent-800 bg-opacity-90 font-medium text-surface-accent-50 shadow-2xl select-none duration-400 ease-in transform opacity-100",
52
68
  tooltipClassName)}
69
+ style={tooltipStyle}
53
70
  sideOffset={sideOffset === undefined ? 4 : sideOffset}
54
71
  align={align}
55
72
  side={side}>
56
73
  {title}
57
- {/*<TooltipPrimitive.Arrow className="fill-slate-600"/>*/}
74
+ {/*<TooltipPrimitive.Arrow className="fill-surface-accent-600"/>*/}
58
75
  </TooltipPrimitive.Content>
59
76
  </TooltipPrimitive.Portal>
60
77
  </TooltipPrimitive.Root>