@rebasepro/ui 0.2.1 → 0.2.4
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/Button.d.ts +2 -2
- package/dist/components/ErrorBoundary.d.ts +25 -3
- package/dist/components/VirtualTable/VirtualTable.d.ts +1 -1
- package/dist/components/VirtualTable/VirtualTableCell.d.ts +6 -6
- package/dist/components/VirtualTable/VirtualTableHeader.d.ts +8 -8
- package/dist/components/VirtualTable/VirtualTableHeaderRow.d.ts +1 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +11 -11
- package/dist/components/VirtualTable/VirtualTableRow.d.ts +1 -1
- package/dist/components/VirtualTable/types.d.ts +9 -9
- package/dist/hooks/useDebounceCallback.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +135 -76
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +130 -71
- package/dist/index.umd.js.map +1 -1
- package/dist/util/debounce.d.ts +1 -1
- package/package.json +3 -2
- package/src/components/BooleanSwitch.tsx +1 -1
- package/src/components/Button.tsx +11 -11
- package/src/components/ErrorBoundary.tsx +171 -18
- package/src/components/IconButton.tsx +4 -4
- package/src/components/MultiSelect.tsx +6 -6
- package/src/components/SearchBar.tsx +1 -1
- package/src/components/TextareaAutosize.tsx +2 -2
- package/src/components/VirtualTable/VirtualTable.tsx +8 -8
- package/src/components/VirtualTable/VirtualTableCell.tsx +6 -6
- package/src/components/VirtualTable/VirtualTableHeader.tsx +15 -15
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +6 -6
- package/src/components/VirtualTable/VirtualTableProps.tsx +11 -11
- package/src/components/VirtualTable/VirtualTableRow.tsx +2 -2
- package/src/components/VirtualTable/types.tsx +9 -9
- package/src/hooks/useDebounceCallback.tsx +2 -1
- package/src/index.css +1 -1
- package/src/util/debounce.ts +2 -1
- package/src/scripts/migrateIconImports.ts +0 -108
- package/src/scripts/test.ts +0 -6
package/dist/index.umd.js
CHANGED
|
@@ -989,15 +989,15 @@
|
|
|
989
989
|
"border border-transparent bg-surface-300 dark:bg-surface-500 opacity-40 bg-surface-300/40 dark:bg-surface-500/40": t25
|
|
990
990
|
});
|
|
991
991
|
const sizeClasses2 = cls({
|
|
992
|
-
"py-
|
|
993
|
-
"py-
|
|
994
|
-
"py-2
|
|
995
|
-
"py-
|
|
996
|
-
"py-
|
|
992
|
+
"py-0.5 px-1.5": size === "small",
|
|
993
|
+
"py-1.5 px-3": size === "medium",
|
|
994
|
+
"py-2 px-4": size === "large",
|
|
995
|
+
"py-2.5 px-5": size === "xl",
|
|
996
|
+
"py-3 px-6": size === "2xl"
|
|
997
997
|
});
|
|
998
998
|
const iconColorClass = (color === "neutral" || color === "text") && !disabled ? "[&>svg]:text-surface-accent-500 dark:[&>svg]:text-surface-accent-300" : "";
|
|
999
999
|
if (Component) {
|
|
1000
|
-
t30 = /* @__PURE__ */ jsxRuntime.jsxs(Component, { ref, onClick: props.onClick, className: cls(startIcon ? "pl-3" : "", "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-
|
|
1000
|
+
t30 = /* @__PURE__ */ jsxRuntime.jsxs(Component, { ref, onClick: props.onClick, className: cls(startIcon ? "pl-3" : "", "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-1.5 px-3 focus:outline-none transition-all ease-in-out duration-150 gap-1.5 active:scale-[0.98]", buttonClasses2, sizeClasses2, iconColorClass, className), ...props, children: [
|
|
1001
1001
|
startIcon,
|
|
1002
1002
|
children
|
|
1003
1003
|
] });
|
|
@@ -1006,7 +1006,7 @@
|
|
|
1006
1006
|
t26 = ref;
|
|
1007
1007
|
t27 = props.type ?? "button";
|
|
1008
1008
|
t28 = props.onClick;
|
|
1009
|
-
t29 = cls(startIcon ? "pl-3" : "", "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-
|
|
1009
|
+
t29 = cls(startIcon ? "pl-3" : "", "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-1.5 px-3 focus:outline-none transition-all ease-in-out duration-150 gap-1.5 active:scale-[0.98]", buttonClasses2, sizeClasses2, iconColorClass, className);
|
|
1010
1010
|
}
|
|
1011
1011
|
$[11] = Component;
|
|
1012
1012
|
$[12] = children;
|
|
@@ -1552,11 +1552,18 @@
|
|
|
1552
1552
|
disabled: "text-text-disabled dark:text-text-disabled-dark",
|
|
1553
1553
|
error: "text-red-500"
|
|
1554
1554
|
};
|
|
1555
|
+
function isPermissionError(error) {
|
|
1556
|
+
if (!error) return false;
|
|
1557
|
+
const msg = error.message?.toLowerCase() ?? "";
|
|
1558
|
+
const code = error.code?.toLowerCase() ?? "";
|
|
1559
|
+
return msg.includes("permission") || msg.includes("insufficient") || msg.includes("unauthorized") || msg.includes("forbidden") || msg.includes("access denied") || code === "permission_denied" || code === "insufficient_permissions" || error.status === 403;
|
|
1560
|
+
}
|
|
1555
1561
|
class ErrorBoundary extends React.Component {
|
|
1556
1562
|
constructor(props) {
|
|
1557
1563
|
super(props);
|
|
1558
1564
|
this.state = {
|
|
1559
|
-
error: null
|
|
1565
|
+
error: null,
|
|
1566
|
+
showDetails: false
|
|
1560
1567
|
};
|
|
1561
1568
|
}
|
|
1562
1569
|
static getDerivedStateFromError(error) {
|
|
@@ -1567,18 +1574,71 @@
|
|
|
1567
1574
|
componentDidCatch(error, _errorInfo) {
|
|
1568
1575
|
console.error(error);
|
|
1569
1576
|
}
|
|
1577
|
+
handleReset = () => {
|
|
1578
|
+
this.setState({
|
|
1579
|
+
error: null,
|
|
1580
|
+
showDetails: false
|
|
1581
|
+
});
|
|
1582
|
+
this.props.onReset?.();
|
|
1583
|
+
};
|
|
1584
|
+
handleReload = () => {
|
|
1585
|
+
window.location.reload();
|
|
1586
|
+
};
|
|
1587
|
+
toggleDetails = () => {
|
|
1588
|
+
this.setState((prev) => ({
|
|
1589
|
+
showDetails: !prev.showDetails
|
|
1590
|
+
}));
|
|
1591
|
+
};
|
|
1570
1592
|
render() {
|
|
1571
1593
|
if (this.state.error) {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
] }),
|
|
1577
|
-
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", children: this.state.error?.message ?? "See the error in the console" })
|
|
1578
|
-
] });
|
|
1594
|
+
if (this.props.fullPage) {
|
|
1595
|
+
return this.renderFullPage();
|
|
1596
|
+
}
|
|
1597
|
+
return this.renderInline();
|
|
1579
1598
|
}
|
|
1580
1599
|
return this.props.children;
|
|
1581
1600
|
}
|
|
1601
|
+
renderInline() {
|
|
1602
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col m-2", children: [
|
|
1603
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center m-2", children: [
|
|
1604
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, { className: "text-red-500", size: iconSize.small }),
|
|
1605
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-4", children: "Error" })
|
|
1606
|
+
] }),
|
|
1607
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", children: this.state.error?.message ?? "See the error in the console" })
|
|
1608
|
+
] });
|
|
1609
|
+
}
|
|
1610
|
+
renderFullPage() {
|
|
1611
|
+
const {
|
|
1612
|
+
error,
|
|
1613
|
+
showDetails
|
|
1614
|
+
} = this.state;
|
|
1615
|
+
const isPermission = isPermissionError(error);
|
|
1616
|
+
const Icon = isPermission ? lucideReact.ShieldAlertIcon : lucideReact.AlertCircleIcon;
|
|
1617
|
+
const title = isPermission ? "Access denied" : "Something went wrong";
|
|
1618
|
+
const description = isPermission ? "You don't have permission to access this resource. Please check your account permissions or contact your administrator." : "An unexpected error occurred. You can try reloading the page or going back.";
|
|
1619
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls("flex items-center justify-center min-h-[400px] h-full w-full", "bg-surface-50 dark:bg-surface-950"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center max-w-md px-6 py-10 text-center", children: [
|
|
1620
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cls("flex items-center justify-center w-14 h-14 rounded-2xl mb-6", isPermission ? "bg-amber-100 dark:bg-amber-900/30" : "bg-red-100 dark:bg-red-900/30"), children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 28, className: isPermission ? "text-amber-600 dark:text-amber-400" : "text-red-500 dark:text-red-400" }) }),
|
|
1621
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h6", className: "text-text-primary dark:text-text-primary-dark mb-2", children: title }),
|
|
1622
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark mb-8", children: description }),
|
|
1623
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
1624
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outlined", color: "neutral", size: "medium", onClick: this.handleReset, children: [
|
|
1625
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeftIcon, { size: 16 }),
|
|
1626
|
+
"Try again"
|
|
1627
|
+
] }),
|
|
1628
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "filled", color: "primary", size: "medium", onClick: this.handleReload, children: [
|
|
1629
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCwIcon, { size: 16 }),
|
|
1630
|
+
"Reload page"
|
|
1631
|
+
] })
|
|
1632
|
+
] }),
|
|
1633
|
+
error?.message && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 w-full", children: [
|
|
1634
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { onClick: this.toggleDetails, className: cls("flex items-center gap-1 mx-auto text-xs", "text-text-disabled dark:text-text-disabled-dark", "hover:text-text-secondary dark:hover:text-text-secondary-dark", "transition-colors cursor-pointer bg-transparent border-none p-0"), children: [
|
|
1635
|
+
"Technical details",
|
|
1636
|
+
showDetails ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { size: 14 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { size: 14 })
|
|
1637
|
+
] }),
|
|
1638
|
+
showDetails && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls("mt-3 p-3 rounded-lg text-left text-xs", "bg-surface-100 dark:bg-surface-800", "text-text-secondary dark:text-text-secondary-dark", "font-mono break-all"), children: error.message })
|
|
1639
|
+
] })
|
|
1640
|
+
] }) });
|
|
1641
|
+
}
|
|
1582
1642
|
}
|
|
1583
1643
|
const sizeClasses$2 = {
|
|
1584
1644
|
large: "w-6 h-6 rounded flex items-center justify-center",
|
|
@@ -2091,10 +2151,10 @@
|
|
|
2091
2151
|
const baseClasses = "inline-flex items-center justify-center p-2 text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150";
|
|
2092
2152
|
const colorClasses$1 = "text-surface-accent-500 visited:text-surface-accent-500 dark:text-surface-accent-300 dark:visited:text-surface-300";
|
|
2093
2153
|
const sizeClasses$1 = {
|
|
2094
|
-
medium: "w-
|
|
2095
|
-
small: "w-
|
|
2096
|
-
smallest: "w-
|
|
2097
|
-
large: "w-
|
|
2154
|
+
medium: "w-9 !h-9 min-w-9 min-h-9",
|
|
2155
|
+
small: "w-7 !h-7 min-w-7 min-h-7",
|
|
2156
|
+
smallest: "w-5 !h-5 min-w-5 min-h-5",
|
|
2157
|
+
large: "w-10 !h-10 min-w-10 min-h-10"
|
|
2098
2158
|
};
|
|
2099
2159
|
const shapeClasses = {
|
|
2100
2160
|
circular: "rounded-full",
|
|
@@ -4325,7 +4385,7 @@
|
|
|
4325
4385
|
if (selectedValues.some((v_0) => String(v_0) === String(newValue))) {
|
|
4326
4386
|
newSelectedValues = selectedValues.filter((v) => String(v) !== String(newValue));
|
|
4327
4387
|
} else {
|
|
4328
|
-
newSelectedValues = [...selectedValues, newValue];
|
|
4388
|
+
newSelectedValues = [...selectedValues, String(newValue)];
|
|
4329
4389
|
}
|
|
4330
4390
|
updateValues(newSelectedValues);
|
|
4331
4391
|
};
|
|
@@ -5247,88 +5307,87 @@
|
|
|
5247
5307
|
t10 = $[17];
|
|
5248
5308
|
}
|
|
5249
5309
|
const t11 = searchText ?? "";
|
|
5250
|
-
const t12 =
|
|
5251
|
-
|
|
5252
|
-
let t14;
|
|
5310
|
+
const t12 = !onTextSearch;
|
|
5311
|
+
let t13;
|
|
5253
5312
|
if ($[18] !== onTextSearch) {
|
|
5254
|
-
|
|
5313
|
+
t13 = onTextSearch ? (event) => {
|
|
5255
5314
|
setSearchText(event.target.value);
|
|
5256
5315
|
} : void 0;
|
|
5257
5316
|
$[18] = onTextSearch;
|
|
5258
|
-
$[19] =
|
|
5317
|
+
$[19] = t13;
|
|
5259
5318
|
} else {
|
|
5260
|
-
|
|
5319
|
+
t13 = $[19];
|
|
5261
5320
|
}
|
|
5321
|
+
let t14;
|
|
5262
5322
|
let t15;
|
|
5263
|
-
let t16;
|
|
5264
5323
|
if ($[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
$[20] =
|
|
5268
|
-
$[21] =
|
|
5324
|
+
t14 = () => setActive(true);
|
|
5325
|
+
t15 = () => setActive(false);
|
|
5326
|
+
$[20] = t14;
|
|
5327
|
+
$[21] = t15;
|
|
5269
5328
|
} else {
|
|
5270
|
-
|
|
5271
|
-
|
|
5329
|
+
t14 = $[20];
|
|
5330
|
+
t15 = $[21];
|
|
5272
5331
|
}
|
|
5273
|
-
const
|
|
5274
|
-
const
|
|
5275
|
-
const
|
|
5276
|
-
let
|
|
5277
|
-
if ($[22] !== innerClassName || $[23] !== inputPaddingClass || $[24] !==
|
|
5278
|
-
|
|
5332
|
+
const t16 = (disabled || loading) && "pointer-events-none";
|
|
5333
|
+
const t17 = size === "small" ? "text-sm" : "";
|
|
5334
|
+
const t18 = expandable ? active ? "w-[220px]" : "w-[180px]" : "";
|
|
5335
|
+
let t19;
|
|
5336
|
+
if ($[22] !== innerClassName || $[23] !== inputPaddingClass || $[24] !== t16 || $[25] !== t17 || $[26] !== t18) {
|
|
5337
|
+
t19 = cls(t16, "placeholder-text-disabled dark:placeholder-text-disabled-dark", "relative flex items-center transition-all bg-transparent outline-none focus:outline-none focus:ring-0 appearance-none border-none focus:border-transparent", inputPaddingClass, "h-full w-full text-current", t17, t18, innerClassName);
|
|
5279
5338
|
$[22] = innerClassName;
|
|
5280
5339
|
$[23] = inputPaddingClass;
|
|
5281
|
-
$[24] =
|
|
5282
|
-
$[25] =
|
|
5283
|
-
$[26] =
|
|
5284
|
-
$[27] =
|
|
5340
|
+
$[24] = t16;
|
|
5341
|
+
$[25] = t17;
|
|
5342
|
+
$[26] = t18;
|
|
5343
|
+
$[27] = t19;
|
|
5285
5344
|
} else {
|
|
5286
|
-
|
|
5345
|
+
t19 = $[27];
|
|
5287
5346
|
}
|
|
5288
|
-
let
|
|
5289
|
-
if ($[28] !== autoFocus || $[29] !==
|
|
5290
|
-
|
|
5347
|
+
let t20;
|
|
5348
|
+
if ($[28] !== autoFocus || $[29] !== inputRef || $[30] !== onClick || $[31] !== placeholder || $[32] !== t11 || $[33] !== t12 || $[34] !== t13 || $[35] !== t19) {
|
|
5349
|
+
t20 = /* @__PURE__ */ jsxRuntime.jsx("input", { value: t11, ref: inputRef, onClick, placeholder, "aria-label": placeholder, readOnly: t12, onChange: t13, autoFocus, onFocus: t14, onBlur: t15, className: t19 });
|
|
5291
5350
|
$[28] = autoFocus;
|
|
5292
|
-
$[29] =
|
|
5293
|
-
$[30] =
|
|
5294
|
-
$[31] =
|
|
5295
|
-
$[32] =
|
|
5296
|
-
$[33] =
|
|
5297
|
-
$[34] =
|
|
5298
|
-
$[35] =
|
|
5299
|
-
$[36] =
|
|
5351
|
+
$[29] = inputRef;
|
|
5352
|
+
$[30] = onClick;
|
|
5353
|
+
$[31] = placeholder;
|
|
5354
|
+
$[32] = t11;
|
|
5355
|
+
$[33] = t12;
|
|
5356
|
+
$[34] = t13;
|
|
5357
|
+
$[35] = t19;
|
|
5358
|
+
$[36] = t20;
|
|
5300
5359
|
} else {
|
|
5301
|
-
|
|
5360
|
+
t20 = $[36];
|
|
5302
5361
|
}
|
|
5303
|
-
let
|
|
5362
|
+
let t21;
|
|
5304
5363
|
if ($[37] !== clearText || $[38] !== searchText || $[39] !== size) {
|
|
5305
|
-
|
|
5364
|
+
t21 = searchText ? /* @__PURE__ */ jsxRuntime.jsx(IconButton, { className: `${size === "small" ? "mr-0 top-0" : "mr-1 top-0"} absolute right-0 z-10`, size: "small", "aria-label": "Clear search", onClick: clearText, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { size: iconSize.smallest }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
|
|
5306
5365
|
width: 26
|
|
5307
5366
|
} });
|
|
5308
5367
|
$[37] = clearText;
|
|
5309
5368
|
$[38] = searchText;
|
|
5310
5369
|
$[39] = size;
|
|
5311
|
-
$[40] =
|
|
5370
|
+
$[40] = t21;
|
|
5312
5371
|
} else {
|
|
5313
|
-
|
|
5372
|
+
t21 = $[40];
|
|
5314
5373
|
}
|
|
5315
|
-
let
|
|
5316
|
-
if ($[41] !== onClick || $[42] !== t10 || $[43] !==
|
|
5317
|
-
|
|
5374
|
+
let t22;
|
|
5375
|
+
if ($[41] !== onClick || $[42] !== t10 || $[43] !== t20 || $[44] !== t21 || $[45] !== t7) {
|
|
5376
|
+
t22 = /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "search", "aria-label": "Search", onClick, className: t7, children: [
|
|
5318
5377
|
t10,
|
|
5319
|
-
|
|
5320
|
-
|
|
5378
|
+
t20,
|
|
5379
|
+
t21
|
|
5321
5380
|
] });
|
|
5322
5381
|
$[41] = onClick;
|
|
5323
5382
|
$[42] = t10;
|
|
5324
|
-
$[43] =
|
|
5325
|
-
$[44] =
|
|
5383
|
+
$[43] = t20;
|
|
5384
|
+
$[44] = t21;
|
|
5326
5385
|
$[45] = t7;
|
|
5327
|
-
$[46] =
|
|
5386
|
+
$[46] = t22;
|
|
5328
5387
|
} else {
|
|
5329
|
-
|
|
5388
|
+
t22 = $[46];
|
|
5330
5389
|
}
|
|
5331
|
-
return
|
|
5390
|
+
return t22;
|
|
5332
5391
|
}
|
|
5333
5392
|
const Select = React.forwardRef((t0, ref) => {
|
|
5334
5393
|
const $ = reactCompilerRuntime.c(123);
|
|
@@ -8764,7 +8823,7 @@
|
|
|
8764
8823
|
zIndex: 1
|
|
8765
8824
|
}, children: endAdornment });
|
|
8766
8825
|
}
|
|
8767
|
-
const rowData = data
|
|
8826
|
+
const rowData = data ? data[index] : void 0;
|
|
8768
8827
|
return /* @__PURE__ */ jsxRuntime.jsxs(VirtualTableRow, { rowData, rowIndex: index, onRowClick, columns, hoverRow, rowClassName, style: {
|
|
8769
8828
|
...style,
|
|
8770
8829
|
top: `calc(${style.top}px + ${headerHeight ?? 48}px)`
|