@openzeppelin/ui-components 2.0.0 → 2.1.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 +43 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +42 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +43 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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 = "2.
|
|
41
|
+
const VERSION = "2.1.0";
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/components/ui/accordion.tsx
|
|
@@ -126,7 +126,7 @@ const TooltipTrigger = _radix_ui_react_tooltip.Trigger;
|
|
|
126
126
|
const TooltipContent = react.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Content, {
|
|
127
127
|
ref,
|
|
128
128
|
sideOffset,
|
|
129
|
-
className: (0, _openzeppelin_ui_utils.cn)("bg-
|
|
129
|
+
className: (0, _openzeppelin_ui_utils.cn)("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md px-3 py-1.5 text-xs", className),
|
|
130
130
|
...props
|
|
131
131
|
}) }));
|
|
132
132
|
TooltipContent.displayName = _radix_ui_react_tooltip.Content.displayName;
|
|
@@ -573,15 +573,15 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
|
|
573
573
|
weekdays: "flex",
|
|
574
574
|
weekday: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
|
575
575
|
week: "flex w-full mt-2",
|
|
576
|
-
day: (0, _openzeppelin_ui_utils.cn)("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-
|
|
576
|
+
day: (0, _openzeppelin_ui_utils.cn)("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-selected/15 [&:has([aria-selected].day-outside)]:bg-selected/10 [&:has([aria-selected].day-range-end)]:rounded-r-md", props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md"),
|
|
577
577
|
day_button: (0, _openzeppelin_ui_utils.cn)(buttonVariants({ variant: "ghost" }), "h-9 w-9 p-0 font-normal aria-selected:opacity-100 rounded-none hover:rounded-none"),
|
|
578
578
|
range_start: "day-range-start rounded-l-md",
|
|
579
579
|
range_end: "day-range-end rounded-r-md",
|
|
580
|
-
selected: "bg-
|
|
580
|
+
selected: "bg-selected text-selected-foreground hover:bg-selected hover:text-selected-foreground focus:bg-selected focus:text-selected-foreground",
|
|
581
581
|
today: "bg-accent text-accent-foreground",
|
|
582
|
-
outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-
|
|
582
|
+
outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-selected/10 aria-selected:text-muted-foreground aria-selected:opacity-30",
|
|
583
583
|
disabled: "text-muted-foreground opacity-50",
|
|
584
|
-
range_middle: "aria-selected:bg-
|
|
584
|
+
range_middle: "aria-selected:bg-selected/15 aria-selected:text-foreground",
|
|
585
585
|
hidden: "invisible",
|
|
586
586
|
...classNames
|
|
587
587
|
},
|
|
@@ -650,7 +650,7 @@ function CardFooter({ className, ...props }) {
|
|
|
650
650
|
function Checkbox({ className, ...props }) {
|
|
651
651
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_checkbox.Root, {
|
|
652
652
|
"data-slot": "checkbox",
|
|
653
|
-
className: (0, _openzeppelin_ui_utils.cn)("border-input data-[state=checked]:bg-
|
|
653
|
+
className: (0, _openzeppelin_ui_utils.cn)("border-input data-[state=checked]:bg-selected data-[state=checked]:text-selected-foreground data-[state=checked]:border-selected focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
654
654
|
...props,
|
|
655
655
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_checkbox.Indicator, {
|
|
656
656
|
"data-slot": "checkbox-indicator",
|
|
@@ -1244,7 +1244,7 @@ const Header = ({ title, onOpenSidebar, rightContent }) => {
|
|
|
1244
1244
|
type: "button",
|
|
1245
1245
|
"aria-label": "Open menu",
|
|
1246
1246
|
onClick: onOpenSidebar,
|
|
1247
|
-
className: "mr-2 sm:mr-3 inline-flex items-center justify-center rounded-md p-2 text-
|
|
1247
|
+
className: "mr-2 sm:mr-3 inline-flex items-center justify-center rounded-md p-2 text-foreground hover:bg-muted focus:outline-none focus:ring-2 focus:ring-primary xl:hidden",
|
|
1248
1248
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Menu, { className: "size-5" })
|
|
1249
1249
|
}),
|
|
1250
1250
|
title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -1491,7 +1491,7 @@ function NetworkSelector({ networks, getNetworkLabel, getNetworkIcon, getNetwork
|
|
|
1491
1491
|
className: "gap-2",
|
|
1492
1492
|
children: [
|
|
1493
1493
|
isMultiple ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1494
|
-
className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-
|
|
1494
|
+
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"),
|
|
1495
1495
|
children: isSelected(network) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-3 w-3" })
|
|
1496
1496
|
}) : null,
|
|
1497
1497
|
getNetworkIcon?.(network),
|
|
@@ -1505,7 +1505,7 @@ function NetworkSelector({ networks, getNetworkLabel, getNetworkIcon, getNetwork
|
|
|
1505
1505
|
children: getNetworkType(network)
|
|
1506
1506
|
})]
|
|
1507
1507
|
}),
|
|
1508
|
-
!isMultiple && isSelected(network) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-4 w-4 opacity-100" })
|
|
1508
|
+
!isMultiple && isSelected(network) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-4 w-4 text-selected opacity-100" })
|
|
1509
1509
|
]
|
|
1510
1510
|
}, getNetworkId(network))) }),
|
|
1511
1511
|
index < Object.keys(groupedNetworks).length - 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuSeparator, {})
|
|
@@ -1595,7 +1595,7 @@ RadioGroup.displayName = _radix_ui_react_radio_group.Root.displayName;
|
|
|
1595
1595
|
const RadioGroupItem = react.forwardRef(({ className, ...props }, ref) => {
|
|
1596
1596
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_radio_group.Item, {
|
|
1597
1597
|
ref,
|
|
1598
|
-
className: (0, _openzeppelin_ui_utils.cn)("border-input bg-background text-
|
|
1598
|
+
className: (0, _openzeppelin_ui_utils.cn)("border-input bg-background text-selected h-4 w-4 rounded-full border shadow-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
1599
1599
|
...props,
|
|
1600
1600
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_radio_group.Indicator, {
|
|
1601
1601
|
className: "flex items-center justify-center",
|
|
@@ -1687,7 +1687,7 @@ SelectSeparator.displayName = _radix_ui_react_select.Separator.displayName;
|
|
|
1687
1687
|
* Can render as a button or anchor element depending on whether href is provided.
|
|
1688
1688
|
*/
|
|
1689
1689
|
function SidebarButton({ icon, children, onClick, size = "default", badge, disabled = false, isSelected = false, href, target, rel, className }) {
|
|
1690
|
-
const commonClass = (0, _openzeppelin_ui_utils.cn)("group relative flex flex-wrap items-center gap-x-2 gap-y-0.5 px-3 py-2 rounded-lg font-semibold text-sm transition-colors", badge ? "justify-between" : "justify-start", disabled ? "text-
|
|
1690
|
+
const commonClass = (0, _openzeppelin_ui_utils.cn)("group relative flex flex-wrap items-center gap-x-2 gap-y-0.5 px-3 py-2 rounded-lg font-semibold text-sm transition-colors", badge ? "justify-between" : "justify-start", disabled ? "text-muted-foreground/60 cursor-not-allowed" : isSelected ? "text-selected bg-selected/10" : "text-muted-foreground hover:text-foreground cursor-pointer hover:before:content-[\"\"] hover:before:absolute hover:before:inset-x-0 hover:before:top-1 hover:before:bottom-1 hover:before:bg-muted/80 hover:before:rounded-lg hover:before:-z-10", size === "small" ? "min-h-10" : "min-h-11", className);
|
|
1691
1691
|
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1692
1692
|
className: "flex items-center gap-2",
|
|
1693
1693
|
children: [icon, children]
|
|
@@ -1865,7 +1865,7 @@ function TabsList({ className, ...props }) {
|
|
|
1865
1865
|
function TabsTrigger({ className, ...props }) {
|
|
1866
1866
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tabs.Trigger, {
|
|
1867
1867
|
"data-slot": "tabs-trigger",
|
|
1868
|
-
className: (0, _openzeppelin_ui_utils.cn)("data-[state=active]:bg-background data-[state=active]:text-
|
|
1868
|
+
className: (0, _openzeppelin_ui_utils.cn)("data-[state=active]:bg-background data-[state=active]:text-selected focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
1869
1869
|
...props
|
|
1870
1870
|
});
|
|
1871
1871
|
}
|
|
@@ -1940,7 +1940,7 @@ function canClick(state, freeNavigation = false) {
|
|
|
1940
1940
|
}
|
|
1941
1941
|
function StepCircle({ state, index }) {
|
|
1942
1942
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1943
|
-
className: (0, _openzeppelin_ui_utils.cn)("flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold transition-all", state === "completed" && "bg-
|
|
1943
|
+
className: (0, _openzeppelin_ui_utils.cn)("flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold transition-all", state === "completed" && "bg-selected text-selected-foreground", state === "current" && "bg-selected text-selected-foreground ring-2 ring-selected/30", state === "visited" && "bg-selected/10 text-selected ring-1 ring-selected/40", state === "invalid" && "bg-destructive/10 text-destructive ring-1 ring-destructive/40", state === "upcoming" && "bg-muted text-muted-foreground"),
|
|
1944
1944
|
children: state === "completed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "size-3.5" }) : state === "visited" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Pencil, { className: "size-3" }) : state === "invalid" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.AlertCircle, { className: "size-3.5" }) : index + 1
|
|
1945
1945
|
});
|
|
1946
1946
|
}
|
|
@@ -1948,10 +1948,10 @@ function StepLabel({ title, state, isSkipped }) {
|
|
|
1948
1948
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1949
1949
|
className: "min-w-0 flex-1",
|
|
1950
1950
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1951
|
-
className: (0, _openzeppelin_ui_utils.cn)("text-sm font-medium transition-colors", state === "current" && "text-
|
|
1951
|
+
className: (0, _openzeppelin_ui_utils.cn)("text-sm font-medium transition-colors", state === "current" && "text-selected", state === "completed" && "text-foreground", state === "visited" && "text-selected", state === "invalid" && "text-destructive", state === "upcoming" && "text-muted-foreground"),
|
|
1952
1952
|
children: title
|
|
1953
1953
|
}), isSkipped && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1954
|
-
className: "mt-0.5 block text-[11px] text-
|
|
1954
|
+
className: "mt-0.5 block text-[11px] text-muted-foreground",
|
|
1955
1955
|
children: "Skipped"
|
|
1956
1956
|
})]
|
|
1957
1957
|
});
|
|
@@ -1959,7 +1959,7 @@ function StepLabel({ title, state, isSkipped }) {
|
|
|
1959
1959
|
function VerticalStepper({ steps, currentStepIndex, furthestStepIndex = currentStepIndex, onStepClick, freeNavigation, className }) {
|
|
1960
1960
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1961
1961
|
"aria-label": "Wizard steps",
|
|
1962
|
-
className: (0, _openzeppelin_ui_utils.cn)("rounded-2xl border border-
|
|
1962
|
+
className: (0, _openzeppelin_ui_utils.cn)("rounded-2xl border border-border bg-card p-6", className),
|
|
1963
1963
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1964
1964
|
className: "flex flex-col gap-1",
|
|
1965
1965
|
children: steps.map((step, index) => {
|
|
@@ -1969,7 +1969,7 @@ function VerticalStepper({ steps, currentStepIndex, furthestStepIndex = currentS
|
|
|
1969
1969
|
type: "button",
|
|
1970
1970
|
onClick: () => clickable && onStepClick?.(index),
|
|
1971
1971
|
disabled: !clickable,
|
|
1972
|
-
className: (0, _openzeppelin_ui_utils.cn)("flex items-center gap-3 rounded-xl border border-transparent px-3 py-3 text-left transition-all duration-150", clickable ? "cursor-pointer" : "cursor-not-allowed opacity-50", state === "current" && "border-
|
|
1972
|
+
className: (0, _openzeppelin_ui_utils.cn)("flex items-center gap-3 rounded-xl border border-transparent px-3 py-3 text-left transition-all duration-150", clickable ? "cursor-pointer" : "cursor-not-allowed opacity-50", state === "current" && "border-selected/40 bg-selected/5", state === "completed" && "bg-card hover:bg-muted/40", state === "visited" && "bg-card hover:bg-selected/5", state === "invalid" && "border-destructive/40 bg-destructive/5 hover:bg-destructive/10", state === "upcoming" && "bg-card"),
|
|
1973
1973
|
"aria-current": state === "current" ? "step" : void 0,
|
|
1974
1974
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StepCircle, {
|
|
1975
1975
|
state,
|
|
@@ -1987,7 +1987,7 @@ function VerticalStepper({ steps, currentStepIndex, furthestStepIndex = currentS
|
|
|
1987
1987
|
function HorizontalStepper({ steps, currentStepIndex, furthestStepIndex = currentStepIndex, onStepClick, freeNavigation, className }) {
|
|
1988
1988
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1989
1989
|
"aria-label": "Wizard steps",
|
|
1990
|
-
className: (0, _openzeppelin_ui_utils.cn)("rounded-2xl border border-
|
|
1990
|
+
className: (0, _openzeppelin_ui_utils.cn)("rounded-2xl border border-border bg-card p-6", className),
|
|
1991
1991
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1992
1992
|
className: "flex w-full items-center",
|
|
1993
1993
|
children: steps.map((step, index) => {
|
|
@@ -1998,7 +1998,7 @@ function HorizontalStepper({ steps, currentStepIndex, furthestStepIndex = curren
|
|
|
1998
1998
|
type: "button",
|
|
1999
1999
|
onClick: () => clickable && onStepClick?.(index),
|
|
2000
2000
|
disabled: !clickable,
|
|
2001
|
-
className: (0, _openzeppelin_ui_utils.cn)("flex items-center gap-2 rounded-xl border border-transparent px-3 py-2 text-left transition-all duration-150", clickable ? "cursor-pointer" : "cursor-not-allowed opacity-50", state === "current" && "border-
|
|
2001
|
+
className: (0, _openzeppelin_ui_utils.cn)("flex items-center gap-2 rounded-xl border border-transparent px-3 py-2 text-left transition-all duration-150", clickable ? "cursor-pointer" : "cursor-not-allowed opacity-50", state === "current" && "border-selected/40 bg-selected/5", state === "completed" && "bg-card hover:bg-muted/40", state === "visited" && "bg-card hover:bg-selected/5", state === "invalid" && "border-destructive/40 bg-destructive/5 hover:bg-destructive/10", state === "upcoming" && "bg-card"),
|
|
2002
2002
|
"aria-current": state === "current" ? "step" : void 0,
|
|
2003
2003
|
"aria-label": `Step ${index + 1}: ${step.title}`,
|
|
2004
2004
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StepCircle, {
|
|
@@ -2012,7 +2012,7 @@ function HorizontalStepper({ steps, currentStepIndex, furthestStepIndex = curren
|
|
|
2012
2012
|
isSkipped: step.status === "skipped"
|
|
2013
2013
|
})
|
|
2014
2014
|
})]
|
|
2015
|
-
}), !isLast && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, _openzeppelin_ui_utils.cn)("mx-1 h-px flex-1 transition-colors sm:mx-2", index < currentStepIndex ? "bg-
|
|
2015
|
+
}), !isLast && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, _openzeppelin_ui_utils.cn)("mx-1 h-px flex-1 transition-colors sm:mx-2", index < currentStepIndex ? "bg-selected" : "bg-border") })] }, step.id);
|
|
2016
2016
|
})
|
|
2017
2017
|
})
|
|
2018
2018
|
});
|
|
@@ -2042,7 +2042,8 @@ function WizardStepper(props) {
|
|
|
2042
2042
|
* @param props - The props for the WizardNavigation component.
|
|
2043
2043
|
* @returns A React node representing the navigation component.
|
|
2044
2044
|
*/
|
|
2045
|
-
function WizardNavigation({ isFirstStep, isLastStep, canProceed = true, onPrevious, onNext, onCancel, extraActions, nextLabel = "Next", lastStepLabel = "Finish", className }) {
|
|
2045
|
+
function WizardNavigation({ isFirstStep, isLastStep, canProceed = true, onPrevious, onNext, onCancel, extraActions, nextLabel = "Next", lastStepLabel = "Finish", showLastStepPrimary = true, className }) {
|
|
2046
|
+
const showPrimary = !isLastStep || showLastStepPrimary;
|
|
2046
2047
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2047
2048
|
className: (0, _openzeppelin_ui_utils.cn)("flex items-center justify-between", className),
|
|
2048
2049
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -2062,7 +2063,7 @@ function WizardNavigation({ isFirstStep, isLastStep, canProceed = true, onPrevio
|
|
|
2062
2063
|
})]
|
|
2063
2064
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2064
2065
|
className: "flex gap-2",
|
|
2065
|
-
children: [extraActions, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Button, {
|
|
2066
|
+
children: [extraActions, showPrimary && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Button, {
|
|
2066
2067
|
type: "button",
|
|
2067
2068
|
onClick: onNext,
|
|
2068
2069
|
disabled: !canProceed,
|
|
@@ -2298,7 +2299,7 @@ function isScrollableNavigationKey(event) {
|
|
|
2298
2299
|
|
|
2299
2300
|
//#endregion
|
|
2300
2301
|
//#region src/components/ui/wizard/WizardLayout.tsx
|
|
2301
|
-
function PagedLayout({ steps, currentStepIndex, furthestStepIndex: furthestStepIndexProp, onStepChange, onComplete, onCancel, navActions, header, variant, className }) {
|
|
2302
|
+
function PagedLayout({ steps, currentStepIndex, furthestStepIndex: furthestStepIndexProp, onStepChange, onComplete, onLastStepPrimary, onCancel, nextLabel, lastStepLabel, hideLastStepPrimary, navActions, header, variant, className }) {
|
|
2302
2303
|
const safeIndex = getSafeStepIndex(steps.length, currentStepIndex);
|
|
2303
2304
|
const resolvedFurthestStepIndex = useFurthestStepIndex(safeIndex, furthestStepIndexProp);
|
|
2304
2305
|
if (steps.length === 0) return null;
|
|
@@ -2308,7 +2309,8 @@ function PagedLayout({ steps, currentStepIndex, furthestStepIndex: furthestStepI
|
|
|
2308
2309
|
const canProceed = currentStep?.isValid !== false;
|
|
2309
2310
|
const handleNext = () => {
|
|
2310
2311
|
if (isLastStep) {
|
|
2311
|
-
|
|
2312
|
+
if (onLastStepPrimary) onLastStepPrimary();
|
|
2313
|
+
else onComplete?.();
|
|
2312
2314
|
return;
|
|
2313
2315
|
}
|
|
2314
2316
|
onStepChange(safeIndex + 1);
|
|
@@ -2328,7 +2330,10 @@ function PagedLayout({ steps, currentStepIndex, furthestStepIndex: furthestStepI
|
|
|
2328
2330
|
onPrevious: handlePrevious,
|
|
2329
2331
|
onNext: handleNext,
|
|
2330
2332
|
onCancel,
|
|
2331
|
-
extraActions: navActions
|
|
2333
|
+
extraActions: navActions,
|
|
2334
|
+
nextLabel,
|
|
2335
|
+
lastStepLabel,
|
|
2336
|
+
showLastStepPrimary: !hideLastStepPrimary
|
|
2332
2337
|
})
|
|
2333
2338
|
})
|
|
2334
2339
|
});
|
|
@@ -2378,7 +2383,7 @@ function PagedLayout({ steps, currentStepIndex, furthestStepIndex: furthestStepI
|
|
|
2378
2383
|
})]
|
|
2379
2384
|
});
|
|
2380
2385
|
}
|
|
2381
|
-
function ScrollableLayout({ steps, currentStepIndex, onStepChange, header, onComplete, scrollPadding, className }) {
|
|
2386
|
+
function ScrollableLayout({ steps, currentStepIndex, onStepChange, header, onComplete, hideScrollableCompleteButton, scrollableCompleteLabel, scrollPadding, className }) {
|
|
2382
2387
|
const instanceId = (0, react.useId)();
|
|
2383
2388
|
const scrollRef = (0, react.useRef)(null);
|
|
2384
2389
|
const sectionId = (0, react.useCallback)((stepId) => `wizard-section-${instanceId}-${stepId}`, [instanceId]);
|
|
@@ -2417,12 +2422,12 @@ function ScrollableLayout({ steps, currentStepIndex, onStepChange, header, onCom
|
|
|
2417
2422
|
children: step.component
|
|
2418
2423
|
}, step.id))
|
|
2419
2424
|
}),
|
|
2420
|
-
onComplete && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2425
|
+
onComplete && !hideScrollableCompleteButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2421
2426
|
className: "flex justify-end pt-8",
|
|
2422
2427
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
2423
2428
|
type: "button",
|
|
2424
2429
|
onClick: onComplete,
|
|
2425
|
-
children: "Finish"
|
|
2430
|
+
children: scrollableCompleteLabel ?? "Finish"
|
|
2426
2431
|
})
|
|
2427
2432
|
})
|
|
2428
2433
|
]
|
|
@@ -2455,6 +2460,8 @@ function WizardLayout(props) {
|
|
|
2455
2460
|
onStepChange: rest.onStepChange,
|
|
2456
2461
|
header: rest.header,
|
|
2457
2462
|
onComplete: rest.onComplete,
|
|
2463
|
+
hideScrollableCompleteButton: rest.hideScrollableCompleteButton,
|
|
2464
|
+
scrollableCompleteLabel: rest.scrollableCompleteLabel,
|
|
2458
2465
|
scrollPadding: rest.scrollPadding,
|
|
2459
2466
|
className: rest.className
|
|
2460
2467
|
});
|
|
@@ -2855,7 +2862,7 @@ function AddressField({ id, label, placeholder, helperText, control, name, width
|
|
|
2855
2862
|
type: "button",
|
|
2856
2863
|
role: "option",
|
|
2857
2864
|
"aria-selected": i === highlightedIndex,
|
|
2858
|
-
className: (0, _openzeppelin_ui_utils.cn)("flex w-full flex-col px-3 py-2 text-left text-sm", "hover:bg-
|
|
2865
|
+
className: (0, _openzeppelin_ui_utils.cn)("flex w-full flex-col px-3 py-2 text-left text-sm", "hover:bg-selected/10", i === highlightedIndex && "bg-selected/10"),
|
|
2859
2866
|
onMouseDown: (e) => {
|
|
2860
2867
|
e.preventDefault();
|
|
2861
2868
|
applySuggestion(s);
|
|
@@ -4549,15 +4556,15 @@ function FileUploadField({ id, label, placeholder = "Drop your file here or clic
|
|
|
4549
4556
|
},
|
|
4550
4557
|
className: `
|
|
4551
4558
|
relative rounded-lg border-2 border-dashed transition-all duration-200
|
|
4552
|
-
${isDragOver ? "border-
|
|
4559
|
+
${isDragOver ? "border-selected bg-selected/5" : hasError ? "border-destructive bg-destructive/5" : fileName ? "border-border bg-muted/30" : "border-border bg-background hover:border-selected/50 hover:bg-muted/50"}
|
|
4553
4560
|
${readOnly || isProcessing ? "cursor-not-allowed opacity-60" : fileName ? "cursor-default" : "cursor-pointer"}
|
|
4554
4561
|
p-6
|
|
4555
4562
|
`,
|
|
4556
4563
|
children: !fileName ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4557
4564
|
className: "flex flex-col items-center justify-center gap-3 text-center",
|
|
4558
4565
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4559
|
-
className: `rounded-full p-3 transition-colors ${isDragOver ? "bg-
|
|
4560
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Upload, { className: `h-8 w-8 transition-colors ${isDragOver ? "text-
|
|
4566
|
+
className: `rounded-full p-3 transition-colors ${isDragOver ? "bg-selected/10" : "bg-muted"}`,
|
|
4567
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Upload, { className: `h-8 w-8 transition-colors ${isDragOver ? "text-selected" : "text-muted-foreground"}` })
|
|
4561
4568
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4562
4569
|
className: "space-y-1",
|
|
4563
4570
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -5442,7 +5449,7 @@ function RadioField({ id, label, helperText, control, name, width = "full", vali
|
|
|
5442
5449
|
const isDisabled = option.disabled;
|
|
5443
5450
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
5444
5451
|
htmlFor: optionId,
|
|
5445
|
-
className: `group relative flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 transition-all duration-150 ${isDisabled ? "cursor-not-allowed opacity-50" : "hover:bg-muted/50"} ${isSelected && !hasError ? "bg-
|
|
5452
|
+
className: `group relative flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 transition-all duration-150 ${isDisabled ? "cursor-not-allowed opacity-50" : "hover:bg-muted/50"} ${isSelected && !hasError ? "bg-selected/5" : ""}`,
|
|
5446
5453
|
children: [
|
|
5447
5454
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
5448
5455
|
type: "radio",
|
|
@@ -5456,13 +5463,13 @@ function RadioField({ id, label, helperText, control, name, width = "full", vali
|
|
|
5456
5463
|
}),
|
|
5457
5464
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5458
5465
|
className: "relative flex size-4 items-center justify-center",
|
|
5459
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `absolute size-4 rounded-full border-2 transition-all duration-150 ${isSelected ? hasError ? "border-destructive bg-destructive/10" : "border-
|
|
5466
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `absolute size-4 rounded-full border-2 transition-all duration-150 ${isSelected ? hasError ? "border-destructive bg-destructive/10" : "border-selected bg-selected/10" : hasError ? "border-destructive/50" : "border-muted-foreground/40 group-hover:border-muted-foreground/60"} ${!isDisabled && "group-hover:scale-105"}` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `absolute size-1.5 rounded-full transition-all duration-150 ${isSelected ? hasError ? "bg-destructive scale-100 opacity-100" : "bg-selected scale-100 opacity-100" : "scale-0 opacity-0"}` })]
|
|
5460
5467
|
}),
|
|
5461
5468
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5462
5469
|
className: `text-sm transition-colors duration-150 ${isDisabled ? "text-muted-foreground" : isSelected ? hasError ? "text-destructive font-medium" : "text-foreground font-medium" : "text-foreground"}`,
|
|
5463
5470
|
children: option.label
|
|
5464
5471
|
}),
|
|
5465
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `absolute -inset-1 rounded-lg ring-2 ring-
|
|
5472
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: `absolute -inset-1 rounded-lg ring-2 ring-selected ring-offset-2 ring-offset-background transition-opacity duration-150 ${isSelected && !isDisabled ? "opacity-0 focus-within:opacity-100" : "opacity-0"}` })
|
|
5466
5473
|
]
|
|
5467
5474
|
}, option.value);
|
|
5468
5475
|
})
|