@openzeppelin/ui-components 1.2.0 → 1.3.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/index.cjs +134 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +56 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +133 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -606,6 +606,134 @@ const DropdownMenuShortcut = ({ className, ...props }) => {
|
|
|
606
606
|
};
|
|
607
607
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
608
608
|
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/components/ui/ecosystem-dropdown.tsx
|
|
611
|
+
/** Simple dropdown selector for choosing a blockchain ecosystem. */
|
|
612
|
+
function EcosystemDropdown({ options, value, onValueChange, getEcosystemIcon, disabled = false, className, placeholder = "Select blockchain...", "aria-labelledby": ariaLabelledby }) {
|
|
613
|
+
const [open, setOpen] = React$1.useState(false);
|
|
614
|
+
const selectedOption = options.find((o) => o.value === value);
|
|
615
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
616
|
+
open,
|
|
617
|
+
onOpenChange: setOpen,
|
|
618
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
619
|
+
asChild: true,
|
|
620
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
621
|
+
variant: "outline",
|
|
622
|
+
role: "combobox",
|
|
623
|
+
"aria-expanded": open,
|
|
624
|
+
"aria-labelledby": ariaLabelledby,
|
|
625
|
+
disabled,
|
|
626
|
+
className: cn("w-full justify-between", className),
|
|
627
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
628
|
+
className: "flex items-center gap-2 truncate",
|
|
629
|
+
children: selectedOption ? /* @__PURE__ */ jsxs(Fragment, { children: [getEcosystemIcon?.(selectedOption.value), /* @__PURE__ */ jsx("span", {
|
|
630
|
+
className: "truncate",
|
|
631
|
+
children: selectedOption.label
|
|
632
|
+
})] }) : /* @__PURE__ */ jsx("span", {
|
|
633
|
+
className: "text-muted-foreground",
|
|
634
|
+
children: placeholder
|
|
635
|
+
})
|
|
636
|
+
}), /* @__PURE__ */ jsx(ChevronDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
637
|
+
})
|
|
638
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
639
|
+
className: "w-[--radix-dropdown-menu-trigger-width] min-w-[200px]",
|
|
640
|
+
align: "start",
|
|
641
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
642
|
+
disabled: !option.enabled,
|
|
643
|
+
onSelect: () => {
|
|
644
|
+
onValueChange(option.value);
|
|
645
|
+
setOpen(false);
|
|
646
|
+
},
|
|
647
|
+
className: "gap-2",
|
|
648
|
+
children: [
|
|
649
|
+
getEcosystemIcon?.(option.value),
|
|
650
|
+
/* @__PURE__ */ jsx("span", {
|
|
651
|
+
className: "flex-1 truncate",
|
|
652
|
+
children: option.label
|
|
653
|
+
}),
|
|
654
|
+
!option.enabled && option.disabledLabel && /* @__PURE__ */ jsx("span", {
|
|
655
|
+
className: "shrink-0 text-xs text-muted-foreground",
|
|
656
|
+
children: option.disabledLabel
|
|
657
|
+
}),
|
|
658
|
+
value === option.value && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 shrink-0 opacity-100" })
|
|
659
|
+
]
|
|
660
|
+
}, option.value))
|
|
661
|
+
})]
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/components/icons/MidnightIcon.tsx
|
|
667
|
+
/**
|
|
668
|
+
* MidnightIcon - SVG icon for the Midnight blockchain
|
|
669
|
+
* Inline SVG to ensure it renders correctly when this package is consumed as a library
|
|
670
|
+
*/
|
|
671
|
+
function MidnightIcon({ size = 16, className = "", variant: _variant }) {
|
|
672
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
673
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
674
|
+
viewBox: "0 0 789.37 789.37",
|
|
675
|
+
width: size,
|
|
676
|
+
height: size,
|
|
677
|
+
className,
|
|
678
|
+
"aria-hidden": "true",
|
|
679
|
+
children: [
|
|
680
|
+
/* @__PURE__ */ jsx("path", {
|
|
681
|
+
d: "m394.69,0C176.71,0,0,176.71,0,394.69s176.71,394.69,394.69,394.69,394.69-176.71,394.69-394.69S612.67,0,394.69,0Zm0,716.6c-177.5,0-321.91-144.41-321.91-321.91S217.18,72.78,394.69,72.78s321.91,144.41,321.91,321.91-144.41,321.91-321.91,321.91Z",
|
|
682
|
+
fill: "currentColor"
|
|
683
|
+
}),
|
|
684
|
+
/* @__PURE__ */ jsx("rect", {
|
|
685
|
+
x: "357.64",
|
|
686
|
+
y: "357.64",
|
|
687
|
+
width: "74.09",
|
|
688
|
+
height: "74.09",
|
|
689
|
+
fill: "currentColor"
|
|
690
|
+
}),
|
|
691
|
+
/* @__PURE__ */ jsx("rect", {
|
|
692
|
+
x: "357.64",
|
|
693
|
+
y: "240.66",
|
|
694
|
+
width: "74.09",
|
|
695
|
+
height: "74.09",
|
|
696
|
+
fill: "currentColor"
|
|
697
|
+
}),
|
|
698
|
+
/* @__PURE__ */ jsx("rect", {
|
|
699
|
+
x: "357.64",
|
|
700
|
+
y: "123.69",
|
|
701
|
+
width: "74.09",
|
|
702
|
+
height: "74.09",
|
|
703
|
+
fill: "currentColor"
|
|
704
|
+
})
|
|
705
|
+
]
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
//#endregion
|
|
710
|
+
//#region src/components/ui/ecosystem-icon.tsx
|
|
711
|
+
/** Displays the appropriate icon for a blockchain ecosystem. */
|
|
712
|
+
function EcosystemIcon({ ecosystem, fallbackLabel, className, size = 16, variant = "branded" }) {
|
|
713
|
+
if (ecosystem.id === "midnight") return /* @__PURE__ */ jsx(MidnightIcon, {
|
|
714
|
+
size,
|
|
715
|
+
variant,
|
|
716
|
+
className: cn("shrink-0", className)
|
|
717
|
+
});
|
|
718
|
+
if (ecosystem.iconComponent) return /* @__PURE__ */ jsx(ecosystem.iconComponent, {
|
|
719
|
+
size,
|
|
720
|
+
variant,
|
|
721
|
+
className: cn("shrink-0", className)
|
|
722
|
+
});
|
|
723
|
+
const initial = (fallbackLabel ?? ecosystem.id).charAt(0).toUpperCase();
|
|
724
|
+
return /* @__PURE__ */ jsx("div", {
|
|
725
|
+
className: cn("bg-muted text-muted-foreground shrink-0 rounded-full flex items-center justify-center font-medium", className),
|
|
726
|
+
style: {
|
|
727
|
+
width: size,
|
|
728
|
+
height: size,
|
|
729
|
+
fontSize: size * .5
|
|
730
|
+
},
|
|
731
|
+
role: "img",
|
|
732
|
+
"aria-label": fallbackLabel ?? ecosystem.id,
|
|
733
|
+
children: initial
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
|
|
609
737
|
//#endregion
|
|
610
738
|
//#region src/components/ui/empty-state.tsx
|
|
611
739
|
/**
|
|
@@ -931,50 +1059,6 @@ const LoadingButton = React$1.forwardRef(({ className, loading = false, children
|
|
|
931
1059
|
});
|
|
932
1060
|
LoadingButton.displayName = "LoadingButton";
|
|
933
1061
|
|
|
934
|
-
//#endregion
|
|
935
|
-
//#region src/components/icons/MidnightIcon.tsx
|
|
936
|
-
/**
|
|
937
|
-
* MidnightIcon - SVG icon for the Midnight blockchain
|
|
938
|
-
* Inline SVG to ensure it renders correctly when this package is consumed as a library
|
|
939
|
-
*/
|
|
940
|
-
function MidnightIcon({ size = 16, className = "", variant: _variant }) {
|
|
941
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
942
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
943
|
-
viewBox: "0 0 789.37 789.37",
|
|
944
|
-
width: size,
|
|
945
|
-
height: size,
|
|
946
|
-
className,
|
|
947
|
-
"aria-hidden": "true",
|
|
948
|
-
children: [
|
|
949
|
-
/* @__PURE__ */ jsx("path", {
|
|
950
|
-
d: "m394.69,0C176.71,0,0,176.71,0,394.69s176.71,394.69,394.69,394.69,394.69-176.71,394.69-394.69S612.67,0,394.69,0Zm0,716.6c-177.5,0-321.91-144.41-321.91-321.91S217.18,72.78,394.69,72.78s321.91,144.41,321.91,321.91-144.41,321.91-321.91,321.91Z",
|
|
951
|
-
fill: "currentColor"
|
|
952
|
-
}),
|
|
953
|
-
/* @__PURE__ */ jsx("rect", {
|
|
954
|
-
x: "357.64",
|
|
955
|
-
y: "357.64",
|
|
956
|
-
width: "74.09",
|
|
957
|
-
height: "74.09",
|
|
958
|
-
fill: "currentColor"
|
|
959
|
-
}),
|
|
960
|
-
/* @__PURE__ */ jsx("rect", {
|
|
961
|
-
x: "357.64",
|
|
962
|
-
y: "240.66",
|
|
963
|
-
width: "74.09",
|
|
964
|
-
height: "74.09",
|
|
965
|
-
fill: "currentColor"
|
|
966
|
-
}),
|
|
967
|
-
/* @__PURE__ */ jsx("rect", {
|
|
968
|
-
x: "357.64",
|
|
969
|
-
y: "123.69",
|
|
970
|
-
width: "74.09",
|
|
971
|
-
height: "74.09",
|
|
972
|
-
fill: "currentColor"
|
|
973
|
-
})
|
|
974
|
-
]
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
|
|
978
1062
|
//#endregion
|
|
979
1063
|
//#region src/components/ui/network-icon.tsx
|
|
980
1064
|
/** Displays the appropriate icon for a blockchain network. */
|
|
@@ -2701,7 +2785,7 @@ BooleanField.displayName = "BooleanField";
|
|
|
2701
2785
|
* 4. BaseField provides consistent layout and hook form integration
|
|
2702
2786
|
* 5. This component handles bytes-specific validation and formatting
|
|
2703
2787
|
*/
|
|
2704
|
-
function BytesField({ id, label, helperText, control, name, width = "full", validation, placeholder = "Enter hex or base64 encoded bytes", rows = 3, maxBytes, acceptedFormats = "both", autoPrefix = false, allowHexPrefix = true, readOnly }) {
|
|
2788
|
+
function BytesField({ id, label, helperText, control, name, width = "full", validation, placeholder = "Enter hex or base64 encoded bytes", rows = 3, maxBytes, exactBytes, acceptedFormats = "both", autoPrefix = false, allowHexPrefix = true, readOnly }) {
|
|
2705
2789
|
const isRequired = !!validation?.required;
|
|
2706
2790
|
const errorId = `${id}-error`;
|
|
2707
2791
|
const descriptionId = `${id}-description`;
|
|
@@ -2712,6 +2796,7 @@ function BytesField({ id, label, helperText, control, name, width = "full", vali
|
|
|
2712
2796
|
return validateBytesSimple(value, {
|
|
2713
2797
|
acceptedFormats,
|
|
2714
2798
|
maxBytes,
|
|
2799
|
+
exactBytes,
|
|
2715
2800
|
allowHexPrefix
|
|
2716
2801
|
});
|
|
2717
2802
|
};
|
|
@@ -2787,7 +2872,8 @@ function BytesField({ id, label, helperText, control, name, width = "full", vali
|
|
|
2787
2872
|
acceptedFormats === "hex" && "Hex format (e.g., 48656c6c6f or 0x48656c6c6f)",
|
|
2788
2873
|
acceptedFormats === "base64" && "Base64 format (e.g., SGVsbG8=)",
|
|
2789
2874
|
acceptedFormats === "both" && "Hex (e.g., 48656c6c6f) or Base64 (e.g., SGVsbG8=) format",
|
|
2790
|
-
|
|
2875
|
+
exactBytes && ` • Exactly ${exactBytes} bytes (${exactBytes * 2} hex chars)`,
|
|
2876
|
+
!exactBytes && maxBytes && ` • Max ${maxBytes} bytes`
|
|
2791
2877
|
]
|
|
2792
2878
|
})]
|
|
2793
2879
|
}),
|
|
@@ -5159,5 +5245,5 @@ const Toaster = ({ ...props }) => {
|
|
|
5159
5245
|
};
|
|
5160
5246
|
|
|
5161
5247
|
//#endregion
|
|
5162
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AddressDisplay, AddressField, Alert, AlertDescription, AlertTitle, AmountField, ArrayField, ArrayObjectField, Banner, BaseField, BigIntField, BooleanField, Button, BytesField, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DateRangePicker, DateTimeField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, EnumField, ErrorMessage, ExternalLink, FileUploadField, Footer, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Header, INTEGER_HTML_PATTERN, INTEGER_INPUT_PATTERN, INTEGER_PATTERN, Input, Label, LoadingButton, MapEntryRow, MapField, MidnightIcon, NetworkErrorNotificationProvider, NetworkIcon, NetworkSelector, NetworkServiceErrorBanner, NetworkStatusBadge, NumberField, ObjectField, PasswordField, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioField, RadioGroup, RadioGroupItem, RelayerDetailsCard, Select, SelectContent, SelectField, SelectGroup, SelectGroupedField, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarButton, SidebarGroup, SidebarLayout, SidebarSection, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaField, TextField, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UrlField, ViewContractStateButton, buttonVariants, computeChildTouched, createFocusManager, createValidationResult, formatValidationError, getAccessibilityProps, getDescribedById, getErrorMessage, getValidationStateClasses, getWidthClasses, handleEscapeKey, handleKeyboardEvent, handleNumericKeys, handleToggleKeys, handleValidationError, hasFieldError, isDuplicateMapKey, useDuplicateKeyIndexes, useMapFieldSync, useNetworkErrorAwareAdapter, useNetworkErrorReporter, useNetworkErrors, validateField, validateMapEntries, validateMapStructure };
|
|
5248
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AddressDisplay, AddressField, Alert, AlertDescription, AlertTitle, AmountField, ArrayField, ArrayObjectField, Banner, BaseField, BigIntField, BooleanField, Button, BytesField, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DateRangePicker, DateTimeField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EcosystemDropdown, EcosystemIcon, EmptyState, EnumField, ErrorMessage, ExternalLink, FileUploadField, Footer, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Header, INTEGER_HTML_PATTERN, INTEGER_INPUT_PATTERN, INTEGER_PATTERN, Input, Label, LoadingButton, MapEntryRow, MapField, MidnightIcon, NetworkErrorNotificationProvider, NetworkIcon, NetworkSelector, NetworkServiceErrorBanner, NetworkStatusBadge, NumberField, ObjectField, PasswordField, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioField, RadioGroup, RadioGroupItem, RelayerDetailsCard, Select, SelectContent, SelectField, SelectGroup, SelectGroupedField, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SidebarButton, SidebarGroup, SidebarLayout, SidebarSection, Tabs, TabsContent, TabsList, TabsTrigger, TextAreaField, TextField, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UrlField, ViewContractStateButton, buttonVariants, computeChildTouched, createFocusManager, createValidationResult, formatValidationError, getAccessibilityProps, getDescribedById, getErrorMessage, getValidationStateClasses, getWidthClasses, handleEscapeKey, handleKeyboardEvent, handleNumericKeys, handleToggleKeys, handleValidationError, hasFieldError, isDuplicateMapKey, useDuplicateKeyIndexes, useMapFieldSync, useNetworkErrorAwareAdapter, useNetworkErrorReporter, useNetworkErrors, validateField, validateMapEntries, validateMapStructure };
|
|
5163
5249
|
//# sourceMappingURL=index.mjs.map
|