@rebasepro/ui 0.2.5 → 0.4.0
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/Card.d.ts +2 -3
- package/dist/components/FilterChip.d.ts +2 -10
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +8 -2
- package/dist/index.es.js +112 -94
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +111 -93
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -3
- package/src/components/Card.tsx +1 -1
- package/src/components/DebouncedTextField.tsx +57 -16
- package/src/components/FilterChip.tsx +8 -13
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +3 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +21 -12
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<{
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
style?: React.CSSProperties;
|
|
5
5
|
onClick?: (e?: React.MouseEvent) => void;
|
|
6
6
|
className?: string;
|
|
7
|
-
}
|
|
8
|
-
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
9
8
|
export { Card };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export interface FilterChipProps {
|
|
2
|
+
export interface FilterChipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
3
3
|
/**
|
|
4
4
|
* The text label displayed on the chip.
|
|
5
5
|
*/
|
|
@@ -8,10 +8,6 @@ export interface FilterChipProps {
|
|
|
8
8
|
* Whether the chip is currently in an active/selected state.
|
|
9
9
|
*/
|
|
10
10
|
active?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Callback when the chip is clicked.
|
|
13
|
-
*/
|
|
14
|
-
onClick?: () => void;
|
|
15
11
|
/**
|
|
16
12
|
* Optional icon rendered before the label.
|
|
17
13
|
*/
|
|
@@ -21,10 +17,6 @@ export interface FilterChipProps {
|
|
|
21
17
|
* @default "medium"
|
|
22
18
|
*/
|
|
23
19
|
size?: "small" | "medium";
|
|
24
|
-
/**
|
|
25
|
-
* Additional class names.
|
|
26
|
-
*/
|
|
27
|
-
className?: string;
|
|
28
20
|
/**
|
|
29
21
|
* Whether the chip is disabled.
|
|
30
22
|
*/
|
|
@@ -39,4 +31,4 @@ export interface FilterChipProps {
|
|
|
39
31
|
*
|
|
40
32
|
* @group Interactive components
|
|
41
33
|
*/
|
|
42
|
-
export declare
|
|
34
|
+
export declare const FilterChip: React.ForwardRefExoticComponent<FilterChipProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -224,6 +224,12 @@ export type OnVirtualTableColumnResizeParams = {
|
|
|
224
224
|
key: string;
|
|
225
225
|
column: VirtualTableColumn;
|
|
226
226
|
};
|
|
227
|
+
/**
|
|
228
|
+
* @see Table
|
|
229
|
+
* @group Components
|
|
230
|
+
*/
|
|
231
|
+
export type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "array-contains" | "in" | "not-in" | "array-contains-any";
|
|
232
|
+
export type FilterValues<Key extends string> = Partial<Record<Key, [WhereFilterOp, unknown] | [WhereFilterOp, unknown][]>>;
|
|
227
233
|
/**
|
|
228
234
|
* @see Table
|
|
229
235
|
* @group Components
|
|
@@ -233,11 +239,11 @@ export type VirtualTableSort = "asc" | "desc" | undefined;
|
|
|
233
239
|
* @see Table
|
|
234
240
|
* @group Components
|
|
235
241
|
*/
|
|
236
|
-
export type VirtualTableFilterValues<Key extends string> =
|
|
242
|
+
export type VirtualTableFilterValues<Key extends string> = FilterValues<Key>;
|
|
237
243
|
/**
|
|
238
244
|
* Filter conditions in a `Query.where()` clause are specified using the
|
|
239
245
|
* strings `<`, `<=`, `==`, `>=`, `>`, `array-contains`, `in`, and `array-contains-any`.
|
|
240
246
|
* @see Table
|
|
241
247
|
* @group Models
|
|
242
248
|
*/
|
|
243
|
-
export type VirtualTableWhereFilterOp =
|
|
249
|
+
export type VirtualTableWhereFilterOp = WhereFilterOp;
|
package/dist/index.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import { c } from "react-compiler-runtime";
|
|
|
4
4
|
import { clsx } from "clsx";
|
|
5
5
|
import { twMerge } from "tailwind-merge";
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import React__default, { createContext, useContext, useEffect, useRef, useState, Children, forwardRef, useLayoutEffect, useId,
|
|
7
|
+
import React__default, { createContext, useContext, useEffect, useRef, useState, Children, forwardRef, useLayoutEffect, useId, useCallback, useMemo, createRef } from "react";
|
|
8
8
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
9
9
|
import { AlertCircleIcon, ShieldAlertIcon, ArrowLeftIcon, RefreshCwIcon, ChevronUpIcon, ChevronDownIcon, MinusIcon, CheckIcon, CalendarIcon, XIcon, ChevronRightIcon, SearchIcon, ChevronLeftIcon, ArrowUpIcon, FilterIcon } from "lucide-react";
|
|
10
10
|
import { AlertCircleIcon as AlertCircleIcon2, AlertTriangleIcon, AlignLeftIcon, AppWindow, ArrowDownToLineIcon, ArrowLeftIcon as ArrowLeftIcon2, ArrowRightFromLineIcon, ArrowRightIcon, ArrowRightToLineIcon, ArrowUpToLineIcon, BoldIcon, BookOpenIcon, CalendarIcon as CalendarIcon2, CheckCircleIcon, CheckIcon as CheckIcon2, CheckSquareIcon, ChevronDownIcon as ChevronDownIcon2, ChevronLeftIcon as ChevronLeftIcon2, ChevronRightIcon as ChevronRightIcon2, ChevronUpIcon as ChevronUpIcon2, ChevronsLeftIcon, ChevronsRightIcon, ChevronsUpDownIcon, CircleIcon, CircleUserIcon, CodeIcon, ColumnsIcon, CopyIcon, DatabaseIcon, DownloadIcon, ExternalLinkIcon, EyeIcon, EyeOffIcon, FileIcon, FileSearchIcon, FileTextIcon, FilterIcon as FilterIcon2, FilterXIcon, FlagIcon, FolderIcon, FolderPlusIcon, FolderUpIcon, FunctionSquareIcon, GitBranchIcon, GlobeIcon, HashIcon, Heading1Icon, Heading2Icon, Heading3Icon, HelpCircleIcon, HistoryIcon, HomeIcon, ImageIcon, ImageOffIcon, InfoIcon, ItalicIcon, KanbanIcon, KeyIcon, KeyRoundIcon, LanguagesIcon, LayoutGridIcon, LinkIcon, ListIcon, ListOrderedIcon, LoaderIcon, LogOutIcon, MailIcon, Maximize2Icon, MenuIcon, MinusCircleIcon, MinusIcon as MinusIcon2, MoonIcon, MoreVerticalIcon, Music2Icon, PanelLeftIcon, PauseIcon, PencilIcon, PhoneIcon, PlayIcon, PlusIcon, QuoteIcon, RefreshCcwIcon, RefreshCwIcon as RefreshCwIcon2, RepeatIcon, Rows3Icon, SaveIcon, SearchIcon as SearchIcon2, SendIcon, SettingsIcon, ShieldIcon, ShoppingCartIcon, SlidersHorizontalIcon, SquareIcon, StarIcon, StrikethroughIcon, SunIcon, SunMoonIcon, TableIcon, TagIcon, TerminalIcon, TextIcon, Trash2Icon, TypeIcon, UnderlineIcon, UndoIcon, UploadCloudIcon, UploadIcon, UserCheckIcon, UserIcon, VideoIcon, VoteIcon, Wand2Icon, XCircleIcon, XIcon as XIcon2, icons } from "lucide-react";
|
|
@@ -3178,49 +3178,80 @@ const sizeClasses = {
|
|
|
3178
3178
|
small: "px-2 py-0.5 text-xs",
|
|
3179
3179
|
medium: "px-2.5 py-1 text-xs"
|
|
3180
3180
|
};
|
|
3181
|
-
|
|
3182
|
-
const $ = c(
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3181
|
+
const FilterChip = React__default.forwardRef(function FilterChip2(t0, ref) {
|
|
3182
|
+
const $ = c(22);
|
|
3183
|
+
let children;
|
|
3184
|
+
let className;
|
|
3185
|
+
let icon;
|
|
3186
|
+
let onClick;
|
|
3187
|
+
let rest;
|
|
3188
|
+
let t1;
|
|
3189
|
+
let t2;
|
|
3190
|
+
let t3;
|
|
3191
|
+
if ($[0] !== t0) {
|
|
3192
|
+
({
|
|
3193
|
+
children,
|
|
3194
|
+
active: t1,
|
|
3195
|
+
onClick,
|
|
3196
|
+
icon,
|
|
3197
|
+
size: t2,
|
|
3198
|
+
className,
|
|
3199
|
+
disabled: t3,
|
|
3200
|
+
...rest
|
|
3201
|
+
} = t0);
|
|
3202
|
+
$[0] = t0;
|
|
3203
|
+
$[1] = children;
|
|
3204
|
+
$[2] = className;
|
|
3205
|
+
$[3] = icon;
|
|
3206
|
+
$[4] = onClick;
|
|
3207
|
+
$[5] = rest;
|
|
3208
|
+
$[6] = t1;
|
|
3209
|
+
$[7] = t2;
|
|
3210
|
+
$[8] = t3;
|
|
3211
|
+
} else {
|
|
3212
|
+
children = $[1];
|
|
3213
|
+
className = $[2];
|
|
3214
|
+
icon = $[3];
|
|
3215
|
+
onClick = $[4];
|
|
3216
|
+
rest = $[5];
|
|
3217
|
+
t1 = $[6];
|
|
3218
|
+
t2 = $[7];
|
|
3219
|
+
t3 = $[8];
|
|
3220
|
+
}
|
|
3192
3221
|
const active = t1 === void 0 ? false : t1;
|
|
3193
3222
|
const size = t2 === void 0 ? "medium" : t2;
|
|
3194
3223
|
const disabled = t3 === void 0 ? false : t3;
|
|
3195
3224
|
const t4 = sizeClasses[size];
|
|
3196
3225
|
let t5;
|
|
3197
|
-
if ($[
|
|
3226
|
+
if ($[9] !== active || $[10] !== className || $[11] !== disabled || $[12] !== t4) {
|
|
3198
3227
|
t5 = cls("inline-flex items-center gap-1 rounded-full", "font-medium whitespace-nowrap select-none shrink-0", "transition-all duration-150", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50", t4, active ? "bg-primary/12 text-primary dark:bg-primary/20 dark:text-primary shadow-[inset_0_0_0_1.5px_var(--color-primary)]" : cls("bg-surface-accent-100 text-text-secondary dark:bg-surface-accent-800 dark:text-text-secondary-dark", !disabled && "cursor-pointer hover:bg-surface-accent-200 dark:hover:bg-surface-accent-700"), disabled && "opacity-50 cursor-not-allowed", className);
|
|
3199
|
-
$[
|
|
3200
|
-
$[
|
|
3201
|
-
$[
|
|
3202
|
-
$[
|
|
3203
|
-
$[
|
|
3228
|
+
$[9] = active;
|
|
3229
|
+
$[10] = className;
|
|
3230
|
+
$[11] = disabled;
|
|
3231
|
+
$[12] = t4;
|
|
3232
|
+
$[13] = t5;
|
|
3204
3233
|
} else {
|
|
3205
|
-
t5 = $[
|
|
3234
|
+
t5 = $[13];
|
|
3206
3235
|
}
|
|
3207
3236
|
let t6;
|
|
3208
|
-
if ($[
|
|
3209
|
-
t6 = /* @__PURE__ */ jsxs("button", { type: "button", onClick, disabled, className: t5, children: [
|
|
3237
|
+
if ($[14] !== children || $[15] !== disabled || $[16] !== icon || $[17] !== onClick || $[18] !== ref || $[19] !== rest || $[20] !== t5) {
|
|
3238
|
+
t6 = /* @__PURE__ */ jsxs("button", { ref, type: "button", onClick, disabled, className: t5, ...rest, children: [
|
|
3210
3239
|
icon,
|
|
3211
3240
|
children
|
|
3212
3241
|
] });
|
|
3213
|
-
$[
|
|
3214
|
-
$[
|
|
3215
|
-
$[
|
|
3216
|
-
$[
|
|
3217
|
-
$[
|
|
3218
|
-
$[
|
|
3242
|
+
$[14] = children;
|
|
3243
|
+
$[15] = disabled;
|
|
3244
|
+
$[16] = icon;
|
|
3245
|
+
$[17] = onClick;
|
|
3246
|
+
$[18] = ref;
|
|
3247
|
+
$[19] = rest;
|
|
3248
|
+
$[20] = t5;
|
|
3249
|
+
$[21] = t6;
|
|
3219
3250
|
} else {
|
|
3220
|
-
t6 = $[
|
|
3251
|
+
t6 = $[21];
|
|
3221
3252
|
}
|
|
3222
3253
|
return t6;
|
|
3223
|
-
}
|
|
3254
|
+
});
|
|
3224
3255
|
const colorClasses = {
|
|
3225
3256
|
info: "bg-sky-200 dark:bg-teal-900",
|
|
3226
3257
|
warn: "bg-orange-200 dark:bg-yellow-950"
|
|
@@ -7549,73 +7580,59 @@ const Badge = React__default.forwardRef((t0, ref) => {
|
|
|
7549
7580
|
});
|
|
7550
7581
|
Badge.displayName = "Badge";
|
|
7551
7582
|
function DebouncedTextField(props) {
|
|
7552
|
-
const
|
|
7553
|
-
const
|
|
7554
|
-
const
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7583
|
+
const [internalValue, setInternalValue] = useState(props.value ?? "");
|
|
7584
|
+
const lastSentValueRef = useRef(props.value ?? "");
|
|
7585
|
+
const timerRef = useRef(void 0);
|
|
7586
|
+
useEffect(() => {
|
|
7587
|
+
const externalValue = props.value ?? "";
|
|
7588
|
+
if (externalValue !== lastSentValueRef.current) {
|
|
7589
|
+
setInternalValue(externalValue);
|
|
7590
|
+
lastSentValueRef.current = externalValue;
|
|
7591
|
+
}
|
|
7592
|
+
}, [props.value]);
|
|
7593
|
+
useEffect(() => {
|
|
7594
|
+
return () => {
|
|
7595
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
7561
7596
|
};
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
}
|
|
7578
|
-
|
|
7579
|
-
|
|
7597
|
+
}, []);
|
|
7598
|
+
const flushChange = useCallback((value, event) => {
|
|
7599
|
+
if (timerRef.current) {
|
|
7600
|
+
clearTimeout(timerRef.current);
|
|
7601
|
+
timerRef.current = void 0;
|
|
7602
|
+
}
|
|
7603
|
+
if (value !== props.value && props.onChange) {
|
|
7604
|
+
lastSentValueRef.current = value;
|
|
7605
|
+
const e = {
|
|
7606
|
+
...event,
|
|
7607
|
+
target: {
|
|
7608
|
+
...event?.target,
|
|
7609
|
+
value,
|
|
7610
|
+
name: props.name
|
|
7611
|
+
}
|
|
7612
|
+
};
|
|
7613
|
+
props.onChange(e);
|
|
7614
|
+
}
|
|
7615
|
+
}, [props.value, props.onChange, props.name]);
|
|
7616
|
+
const internalOnChange = useCallback((event_0) => {
|
|
7617
|
+
const newValue = event_0.target.value;
|
|
7618
|
+
setInternalValue(newValue);
|
|
7619
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
7620
|
+
const eventCopy = {
|
|
7621
|
+
...event_0,
|
|
7622
|
+
target: {
|
|
7623
|
+
...event_0?.target,
|
|
7624
|
+
name: event_0?.target?.name
|
|
7580
7625
|
}
|
|
7581
7626
|
};
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
}
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
$[6] = deferredValue;
|
|
7592
|
-
$[7] = props.value;
|
|
7593
|
-
$[8] = t3;
|
|
7594
|
-
} else {
|
|
7595
|
-
t3 = $[8];
|
|
7596
|
-
}
|
|
7597
|
-
useEffect(t2, t3);
|
|
7598
|
-
let t4;
|
|
7599
|
-
if ($[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
7600
|
-
t4 = (event) => {
|
|
7601
|
-
previousEventRef.current = event;
|
|
7602
|
-
setInternalValue(event.target.value);
|
|
7603
|
-
};
|
|
7604
|
-
$[9] = t4;
|
|
7605
|
-
} else {
|
|
7606
|
-
t4 = $[9];
|
|
7607
|
-
}
|
|
7608
|
-
const internalOnChange = t4;
|
|
7609
|
-
let t5;
|
|
7610
|
-
if ($[10] !== internalValue || $[11] !== props) {
|
|
7611
|
-
t5 = /* @__PURE__ */ jsx(TextField, { ...props, onChange: internalOnChange, value: internalValue });
|
|
7612
|
-
$[10] = internalValue;
|
|
7613
|
-
$[11] = props;
|
|
7614
|
-
$[12] = t5;
|
|
7615
|
-
} else {
|
|
7616
|
-
t5 = $[12];
|
|
7617
|
-
}
|
|
7618
|
-
return t5;
|
|
7627
|
+
timerRef.current = setTimeout(() => {
|
|
7628
|
+
flushChange(newValue, eventCopy);
|
|
7629
|
+
}, 150);
|
|
7630
|
+
}, [flushChange]);
|
|
7631
|
+
const internalOnBlur = useCallback((event_1) => {
|
|
7632
|
+
flushChange(internalValue, event_1);
|
|
7633
|
+
props.onBlur?.(event_1);
|
|
7634
|
+
}, [internalValue, flushChange, props.onBlur]);
|
|
7635
|
+
return /* @__PURE__ */ jsx(TextField, { ...props, onChange: internalOnChange, onBlur: internalOnBlur, value: internalValue });
|
|
7619
7636
|
}
|
|
7620
7637
|
const styles = `
|
|
7621
7638
|
@keyframes shimmer {
|
|
@@ -8335,7 +8352,8 @@ const VirtualTableHeaderRow = ({
|
|
|
8335
8352
|
height: headerHeight
|
|
8336
8353
|
}, children: [
|
|
8337
8354
|
columns.map((column_0, columnIndex) => {
|
|
8338
|
-
const
|
|
8355
|
+
const columnFilter = column_0 && filter && filter[column_0.key] ? filter[column_0.key] : void 0;
|
|
8356
|
+
const filterForThisProperty = columnFilter ? Array.isArray(columnFilter[0]) ? columnFilter[0] : columnFilter : void 0;
|
|
8339
8357
|
const isDraggable = !column_0.frozen && !!onColumnsOrderChange;
|
|
8340
8358
|
const isDragging = draggingColumnId === column_0.key;
|
|
8341
8359
|
return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(SortableColumnHeader, { column: column_0, columnIndex, columnRefs, isResizing, onFilterUpdate, filter: filterForThisProperty, sortByProperty, currentSort, onColumnSort, onClickResizeColumn, createFilterField, isDragging, isDraggable }) }, "header_" + column_0.key);
|