@rebasepro/ui 0.0.1-canary.f81da60 → 0.1.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/dist/components/SearchBar.d.ts +5 -1
- package/dist/index.css +2 -2
- package/dist/index.es.js +69 -57
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +69 -57
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Button.tsx +6 -6
- package/src/components/DateTimeField.tsx +1 -1
- package/src/components/SearchBar.tsx +7 -2
- package/src/components/Tooltip.tsx +1 -1
- package/src/components/VirtualTable/VirtualTable.tsx +8 -6
- package/src/components/VirtualTable/VirtualTableHeader.tsx +3 -3
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/index.css +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/rebaseco"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"react-use-measure": "^2.1.7",
|
|
70
70
|
"react-window": "^1.8.11",
|
|
71
71
|
"tailwind-merge": "^2.6.0",
|
|
72
|
-
"@rebasepro/types": "0.
|
|
72
|
+
"@rebasepro/types": "0.1.2"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"react": ">=19.0.0",
|
|
@@ -42,22 +42,22 @@ const ButtonInner = React.memo(React.forwardRef<
|
|
|
42
42
|
"border border-primary bg-primary focus:ring-primary shadow-sm hover:shadow-md hover:brightness-110 text-white hover:text-white": variant === "filled" && color === "primary" && !disabled,
|
|
43
43
|
"border border-secondary bg-secondary focus:ring-secondary shadow-sm hover:shadow-md hover:brightness-110 text-white hover:text-white": variant === "filled" && color === "secondary" && !disabled,
|
|
44
44
|
"border border-red-500 bg-red-500 hover:bg-red-600 focus:ring-red-500 shadow-sm hover:shadow-md text-white hover:text-white": variant === "filled" && color === "error" && !disabled,
|
|
45
|
-
"border border-surface-accent-200 bg-surface-accent-200 hover:bg-surface-accent-300 focus:ring-surface-accent-400 shadow-sm hover:shadow-md text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark": variant === "filled" && color === "text" && !disabled,
|
|
46
|
-
"border border-transparent bg-surface-100 hover:bg-surface-accent-200 text-text-primary dark:bg-surface-700 dark:hover:bg-surface-accent-
|
|
45
|
+
"border border-surface-accent-200 bg-surface-accent-200 hover:bg-surface-accent-300 focus:ring-surface-accent-400 shadow-sm hover:shadow-md text-text-primary hover:text-text-primary dark:border-surface-accent-700 dark:bg-surface-accent-700 dark:hover:bg-surface-accent-600 dark:text-text-primary-dark hover:dark:text-text-primary-dark": variant === "filled" && color === "text" && !disabled,
|
|
46
|
+
"border border-transparent bg-surface-100 hover:bg-surface-accent-200 text-text-primary dark:bg-surface-700 dark:hover:bg-surface-accent-700 dark:text-text-primary-dark hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark": variant === "filled" && color === "neutral" && !disabled,
|
|
47
47
|
|
|
48
48
|
// Text Variants
|
|
49
49
|
"border border-transparent text-primary hover:text-primary hover:bg-surface-accent-200 hover:bg-opacity-75 hover:bg-surface-accent-200/75 dark:hover:bg-surface-accent-800": variant === "text" && color === "primary" && !disabled,
|
|
50
50
|
"border border-transparent text-secondary hover:text-secondary hover:bg-surface-accent-200 hover:bg-opacity-75 hover:bg-surface-accent-200/75 dark:hover:bg-surface-accent-800": variant === "text" && color === "secondary" && !disabled,
|
|
51
51
|
"border border-transparent text-red-500 hover:text-red-500 hover:bg-red-500 hover:bg-opacity-10 hover:bg-red-500/10": variant === "text" && color === "error" && !disabled,
|
|
52
|
-
"border border-transparent text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark hover:bg-surface-accent-200 hover:dark:bg-surface-
|
|
53
|
-
"border border-transparent text-text-primary hover:text-text-primary hover:bg-surface-accent-200 dark:text-text-primary-dark dark:hover:text-text-primary-dark dark:hover:bg-surface-accent-
|
|
52
|
+
"border border-transparent text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:dark:text-text-primary-dark hover:bg-surface-accent-200 hover:bg-opacity-75 hover:bg-surface-accent-200/75 dark:hover:bg-surface-accent-800": variant === "text" && color === "text" && !disabled,
|
|
53
|
+
"border border-transparent text-text-primary hover:text-text-primary hover:bg-surface-accent-200 hover:bg-opacity-75 hover:bg-surface-accent-200/75 dark:text-text-primary-dark dark:hover:text-text-primary-dark dark:hover:bg-surface-accent-800": variant === "text" && color === "neutral" && !disabled,
|
|
54
54
|
|
|
55
55
|
// Outlined Variants
|
|
56
56
|
"border border-primary text-primary hover:text-primary hover:bg-primary-bg hover:bg-primary/10": variant === "outlined" && color === "primary" && !disabled,
|
|
57
57
|
"border border-secondary text-secondary hover:text-secondary hover:bg-secondary-bg": variant === "outlined" && color === "secondary" && !disabled,
|
|
58
58
|
"border border-red-500 text-red-500 hover:text-red-500 hover:bg-red-500 hover:text-white": variant === "outlined" && color === "error" && !disabled,
|
|
59
|
-
"border border-surface-accent-400 text-text-primary hover:text-text-primary dark:text-text-primary-dark hover:bg-surface-accent-200": variant === "outlined" && color === "text" && !disabled,
|
|
60
|
-
"border border-surface-300 text-text-primary hover:bg-surface-accent-200 dark:border-surface-600 dark:text-text-primary-dark dark:hover:bg-surface-accent-
|
|
59
|
+
"border border-surface-accent-400 text-text-primary hover:text-text-primary dark:text-text-primary-dark dark:border-surface-accent-600 hover:bg-surface-accent-200 hover:bg-opacity-75 hover:bg-surface-accent-200/75 dark:hover:bg-surface-accent-800": variant === "outlined" && color === "text" && !disabled,
|
|
60
|
+
"border border-surface-300 text-text-primary hover:bg-surface-accent-200 hover:bg-opacity-75 hover:bg-surface-accent-200/75 dark:border-surface-600 dark:text-text-primary-dark dark:hover:bg-surface-accent-800": variant === "outlined" && color === "neutral" && !disabled,
|
|
61
61
|
|
|
62
62
|
// Disabled states for all variants
|
|
63
63
|
"text-text-disabled dark:text-text-disabled-dark": disabled,
|
|
@@ -28,6 +28,10 @@ interface SearchBarProps {
|
|
|
28
28
|
disabled?: boolean;
|
|
29
29
|
loading?: boolean;
|
|
30
30
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
31
|
+
/**
|
|
32
|
+
* Optional initial value for the search input, e.g. from URL params.
|
|
33
|
+
*/
|
|
34
|
+
initialValue?: string;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export function SearchBar({
|
|
@@ -41,10 +45,11 @@ export function SearchBar({
|
|
|
41
45
|
autoFocus,
|
|
42
46
|
disabled,
|
|
43
47
|
loading,
|
|
44
|
-
inputRef
|
|
48
|
+
inputRef,
|
|
49
|
+
initialValue
|
|
45
50
|
}: SearchBarProps) {
|
|
46
51
|
|
|
47
|
-
const [searchText, setSearchText] = useState<string>("");
|
|
52
|
+
const [searchText, setSearchText] = useState<string>(initialValue ?? "");
|
|
48
53
|
const [active, setActive] = useState<boolean>(false);
|
|
49
54
|
|
|
50
55
|
const deferredValues = useDebounceValue(searchText, 200);
|
|
@@ -65,7 +65,7 @@ export const Tooltip = ({
|
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
67
|
<TooltipPrimitive.Provider delayDuration={delayDuration}>
|
|
68
|
-
<TooltipPrimitive.Root open
|
|
68
|
+
<TooltipPrimitive.Root {...(open !== undefined ? { open, onOpenChange } : {})} defaultOpen={defaultOpen}>
|
|
69
69
|
{trigger}
|
|
70
70
|
<TooltipPrimitive.Portal container={finalContainer}>
|
|
71
71
|
<TooltipPrimitive.Content
|
|
@@ -8,7 +8,7 @@ import { deepEqual as equal } from "fast-equals"
|
|
|
8
8
|
import { FixedSizeList as List } from "react-window";
|
|
9
9
|
import useMeasure from "react-use-measure";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { CircularProgress } from "../CircularProgress";
|
|
12
12
|
import {
|
|
13
13
|
OnVirtualTableColumnResizeParams,
|
|
14
14
|
VirtualTableColumn,
|
|
@@ -74,7 +74,7 @@ const innerElementType = forwardRef<HTMLDivElement, InnerElementProps>(({
|
|
|
74
74
|
}}>
|
|
75
75
|
<div style={{ position: "sticky",
|
|
76
76
|
top: 0,
|
|
77
|
-
zIndex:
|
|
77
|
+
zIndex: 20 }}>
|
|
78
78
|
<VirtualTableHeaderRow {...virtualTableProps}/>
|
|
79
79
|
</div>
|
|
80
80
|
{!customView && children}
|
|
@@ -333,9 +333,11 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
333
333
|
</CenteredView>
|
|
334
334
|
: (empty
|
|
335
335
|
? (loading
|
|
336
|
-
? <
|
|
336
|
+
? <div className="flex items-center justify-center py-12 px-8">
|
|
337
|
+
<CircularProgress size="small"/>
|
|
338
|
+
</div>
|
|
337
339
|
: <div
|
|
338
|
-
className="flex flex-col overflow-auto items-center justify-center
|
|
340
|
+
className="flex flex-col overflow-auto items-center justify-center py-12 px-8">
|
|
339
341
|
{emptyComponent}
|
|
340
342
|
</div>)
|
|
341
343
|
: undefined);
|
|
@@ -469,7 +471,7 @@ const SortableCellWrapper = ({
|
|
|
469
471
|
style={style}
|
|
470
472
|
className={cls(
|
|
471
473
|
"flex-shrink-0",
|
|
472
|
-
frozen && "sticky left-0 z-10 bg-white dark:bg-surface-
|
|
474
|
+
frozen && "sticky left-0 z-10 bg-white dark:bg-surface-900"
|
|
473
475
|
)}
|
|
474
476
|
{...attrsWithoutTabIndex}
|
|
475
477
|
>
|
|
@@ -579,7 +581,7 @@ function MemoizedList({
|
|
|
579
581
|
key={`cell_wrapper_${column.key}`}
|
|
580
582
|
className={cls(
|
|
581
583
|
"flex-shrink-0 relative",
|
|
582
|
-
column.frozen && "sticky left-0 z-10 bg-white dark:bg-surface-
|
|
584
|
+
column.frozen && "sticky left-0 z-10 bg-white dark:bg-surface-900"
|
|
583
585
|
)}
|
|
584
586
|
style={{
|
|
585
587
|
minWidth: column.width,
|
|
@@ -90,7 +90,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
90
90
|
className={cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center",
|
|
91
91
|
isDragging
|
|
92
92
|
? "bg-primary-bg dark:bg-primary-bg-dark"
|
|
93
|
-
: "bg-surface-50 dark:bg-surface-
|
|
93
|
+
: "bg-surface-50 dark:bg-surface-900",
|
|
94
94
|
"text-text-secondary hover:text-text-primary dark:text-text-secondary-dark dark:hover:text-text-primary-dark",
|
|
95
95
|
!isDragging && "hover:bg-surface-100 dark:hover:bg-surface-900 hover:bg-opacity-50 hover:bg-surface-100/50 dark:hover:bg-opacity-50 dark:hover:bg-surface-900/50",
|
|
96
96
|
column.frozen ? "sticky left-0 z-10" : "relative z-0",
|
|
@@ -134,7 +134,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
134
134
|
invisible={!sort}>
|
|
135
135
|
<IconButton
|
|
136
136
|
size={"small"}
|
|
137
|
-
className={onHover || openFilter ? "bg-white dark:bg-surface-
|
|
137
|
+
className={onHover || openFilter ? "bg-white dark:bg-surface-900" : undefined}
|
|
138
138
|
onClick={() => {
|
|
139
139
|
onColumnSort(column.key as Extract<keyof M, string>);
|
|
140
140
|
}}
|
|
@@ -161,7 +161,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
161
161
|
modal={true}
|
|
162
162
|
trigger={
|
|
163
163
|
<IconButton
|
|
164
|
-
className={onHover || openFilter ? "bg-white dark:bg-surface-
|
|
164
|
+
className={onHover || openFilter ? "bg-white dark:bg-surface-900" : undefined}
|
|
165
165
|
size={"small"}
|
|
166
166
|
onClick={handleSettingsClick}>
|
|
167
167
|
<FilterIcon size={iconSize.small}/>
|
|
@@ -209,7 +209,7 @@ export const VirtualTableHeaderRow = ({
|
|
|
209
209
|
return (
|
|
210
210
|
<>
|
|
211
211
|
<div
|
|
212
|
-
className={cls(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 border-b bg-surface-50 dark:bg-surface-
|
|
212
|
+
className={cls(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 border-b bg-surface-50 dark:bg-surface-900")}
|
|
213
213
|
style={{ height: headerHeight }}>
|
|
214
214
|
{columns.map((column, columnIndex) => {
|
|
215
215
|
const filterForThisProperty: [VirtualTableWhereFilterOp, any] | undefined =
|
|
@@ -28,7 +28,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
|
|
|
28
28
|
return (
|
|
29
29
|
<div
|
|
30
30
|
className={cls(
|
|
31
|
-
"flex min-w-full text-sm border-b border-surface-200/60 dark:border-surface-700/60 dark:bg-surface-
|
|
31
|
+
"flex min-w-full text-sm border-b border-surface-200/60 dark:border-surface-700/60 dark:bg-surface-800",
|
|
32
32
|
rowClassName ? rowClassName(rowData) : "",
|
|
33
33
|
{
|
|
34
34
|
"hover:!bg-surface-50/75 dark:hover:!bg-surface-800/75": hoverRow,
|
package/src/index.css
CHANGED
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
--color-surface-accent-600: #475569;
|
|
51
51
|
--color-surface-accent-700: #334155;
|
|
52
52
|
--color-surface-accent-800: #1e293b;
|
|
53
|
-
--color-surface-accent-900: #
|
|
54
|
-
--color-surface-accent-950: #
|
|
53
|
+
--color-surface-accent-900: #172033;
|
|
54
|
+
--color-surface-accent-950: #0f172a;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/* Chrome, Safari and Opera */
|