@openzeppelin/ui-components 3.0.0 → 3.0.1
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/index.cjs +76 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +25 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +77 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -10
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ let sonner = require("sonner");
|
|
|
38
38
|
let next_themes = require("next-themes");
|
|
39
39
|
|
|
40
40
|
//#region src/version.ts
|
|
41
|
-
const VERSION = "3.0.
|
|
41
|
+
const VERSION = "3.0.1";
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/components/ui/accordion.tsx
|
|
@@ -1348,7 +1348,7 @@ function NetworkIcon({ network, className, size = 16, variant = "branded" }) {
|
|
|
1348
1348
|
//#endregion
|
|
1349
1349
|
//#region src/components/ui/network-selector.tsx
|
|
1350
1350
|
/** Searchable dropdown selector for blockchain networks with optional grouping and multi-select. */
|
|
1351
|
-
function NetworkSelector({ networks, getNetworkLabel, getNetworkIcon, getNetworkType, getNetworkId, groupByEcosystem = false, getEcosystem, filterNetwork, className, placeholder = "Select Network", ...modeProps }) {
|
|
1351
|
+
function NetworkSelector({ networks, getNetworkLabel, getNetworkIcon, getNetworkType, getNetworkId, groupByEcosystem = false, getEcosystem, filterNetwork, isNetworkDisabled, getNetworkDisabledLabel, className, placeholder = "Select Network", ...modeProps }) {
|
|
1352
1352
|
const [open, setOpen] = react.useState(false);
|
|
1353
1353
|
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1354
1354
|
const isMultiple = modeProps.multiple === true;
|
|
@@ -1389,6 +1389,7 @@ function NetworkSelector({ networks, getNetworkLabel, getNetworkIcon, getNetwork
|
|
|
1389
1389
|
getNetworkId
|
|
1390
1390
|
]);
|
|
1391
1391
|
const handleSelect = react.useCallback((network) => {
|
|
1392
|
+
if (isNetworkDisabled?.(network)) return;
|
|
1392
1393
|
if (isMultiple && selectedNetworkIds && onSelectionChange) {
|
|
1393
1394
|
const id = getNetworkId(network);
|
|
1394
1395
|
onSelectionChange(selectedNetworkIds.includes(id) ? selectedNetworkIds.filter((x) => x !== id) : [...selectedNetworkIds, id]);
|
|
@@ -1401,7 +1402,8 @@ function NetworkSelector({ networks, getNetworkLabel, getNetworkIcon, getNetwork
|
|
|
1401
1402
|
selectedNetworkIds,
|
|
1402
1403
|
onSelectionChange,
|
|
1403
1404
|
onSelectNetwork,
|
|
1404
|
-
getNetworkId
|
|
1405
|
+
getNetworkId,
|
|
1406
|
+
isNetworkDisabled
|
|
1405
1407
|
]);
|
|
1406
1408
|
const handleClearAll = react.useCallback(() => {
|
|
1407
1409
|
if (isMultiple && onSelectionChange) onSelectionChange([]);
|
|
@@ -1487,31 +1489,47 @@ function NetworkSelector({ networks, getNetworkLabel, getNetworkIcon, getNetwork
|
|
|
1487
1489
|
className: "text-xs font-medium text-muted-foreground",
|
|
1488
1490
|
children: group
|
|
1489
1491
|
}),
|
|
1490
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuGroup, { children: groupNetworks.map((network) =>
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1492
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuGroup, { children: groupNetworks.map((network) => {
|
|
1493
|
+
const disabled = isNetworkDisabled?.(network) ?? false;
|
|
1494
|
+
const disabledLabel = disabled ? getNetworkDisabledLabel?.(network) : void 0;
|
|
1495
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenuItem, {
|
|
1496
|
+
disabled,
|
|
1497
|
+
onSelect: (e) => {
|
|
1498
|
+
if (disabled) {
|
|
1499
|
+
e.preventDefault();
|
|
1500
|
+
return;
|
|
1501
|
+
}
|
|
1502
|
+
if (isMultiple) e.preventDefault();
|
|
1503
|
+
handleSelect(network);
|
|
1504
|
+
},
|
|
1505
|
+
className: (0, _openzeppelin_ui_utils.cn)("gap-2", disabled && "cursor-not-allowed opacity-60"),
|
|
1506
|
+
children: [
|
|
1507
|
+
isMultiple ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1508
|
+
className: (0, _openzeppelin_ui_utils.cn)("flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border transition-colors", isSelected(network) ? "border-selected bg-selected text-selected-foreground" : "border-input bg-background", disabled && "opacity-50"),
|
|
1509
|
+
children: isSelected(network) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-3 w-3" })
|
|
1510
|
+
}) : null,
|
|
1511
|
+
getNetworkIcon?.(network),
|
|
1512
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1513
|
+
className: "flex flex-1 items-center gap-2 min-w-0",
|
|
1514
|
+
children: [
|
|
1515
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1516
|
+
className: "truncate",
|
|
1517
|
+
children: getNetworkLabel(network)
|
|
1518
|
+
}),
|
|
1519
|
+
getNetworkType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1520
|
+
className: "shrink-0 rounded-sm bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",
|
|
1521
|
+
children: getNetworkType(network)
|
|
1522
|
+
}),
|
|
1523
|
+
disabledLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1524
|
+
className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
|
|
1525
|
+
children: disabledLabel
|
|
1526
|
+
}) : null
|
|
1527
|
+
]
|
|
1528
|
+
}),
|
|
1529
|
+
!isMultiple && isSelected(network) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-4 w-4 text-selected opacity-100" })
|
|
1530
|
+
]
|
|
1531
|
+
}, getNetworkId(network));
|
|
1532
|
+
}) }),
|
|
1515
1533
|
index < Object.keys(groupedNetworks).length - 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuSeparator, {})
|
|
1516
1534
|
] }, group))]
|
|
1517
1535
|
})]
|
|
@@ -6368,6 +6386,35 @@ function NetworkServiceErrorBanner({ networkConfig, serviceType, errorMessage, t
|
|
|
6368
6386
|
});
|
|
6369
6387
|
}
|
|
6370
6388
|
|
|
6389
|
+
//#endregion
|
|
6390
|
+
//#region src/components/network-availability/NetworkAvailabilityNotice.tsx
|
|
6391
|
+
/**
|
|
6392
|
+
* Banner shown when the deployment disables mainnet or specific network IDs.
|
|
6393
|
+
* Hidden when no network availability policy is active.
|
|
6394
|
+
*/
|
|
6395
|
+
function NetworkAvailabilityNotice({ appName, selfHostRepoUrl, className }) {
|
|
6396
|
+
if (!(0, _openzeppelin_ui_utils.isNetworkAvailabilityPolicyActive)()) return null;
|
|
6397
|
+
const { title, descriptionBeforeLink, descriptionLinkLabel } = (0, _openzeppelin_ui_utils.getHostedNetworkAvailabilityNoticeCopy)(appName);
|
|
6398
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Alert, {
|
|
6399
|
+
className,
|
|
6400
|
+
children: [
|
|
6401
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Info, { className: "h-4 w-4" }),
|
|
6402
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertTitle, { children: title }),
|
|
6403
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(AlertDescription, { children: [
|
|
6404
|
+
descriptionBeforeLink,
|
|
6405
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
6406
|
+
href: selfHostRepoUrl,
|
|
6407
|
+
target: "_blank",
|
|
6408
|
+
rel: "noopener noreferrer",
|
|
6409
|
+
className: "font-medium underline underline-offset-4 hover:text-foreground",
|
|
6410
|
+
children: descriptionLinkLabel
|
|
6411
|
+
}),
|
|
6412
|
+
"."
|
|
6413
|
+
] })
|
|
6414
|
+
]
|
|
6415
|
+
});
|
|
6416
|
+
}
|
|
6417
|
+
|
|
6371
6418
|
//#endregion
|
|
6372
6419
|
//#region src/components/ui/sonner.tsx
|
|
6373
6420
|
const Toaster = ({ ...props }) => {
|
|
@@ -6467,6 +6514,7 @@ exports.LoadingButton = LoadingButton;
|
|
|
6467
6514
|
exports.MapEntryRow = MapEntryRow;
|
|
6468
6515
|
exports.MapField = MapField;
|
|
6469
6516
|
exports.MidnightIcon = MidnightIcon;
|
|
6517
|
+
exports.NetworkAvailabilityNotice = NetworkAvailabilityNotice;
|
|
6470
6518
|
exports.NetworkErrorNotificationProvider = NetworkErrorNotificationProvider;
|
|
6471
6519
|
exports.NetworkIcon = NetworkIcon;
|
|
6472
6520
|
exports.NetworkSelector = NetworkSelector;
|