@openzeppelin/ui-components 2.0.1 → 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 +16 -9
- 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 +36 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +16 -9
- 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.0
|
|
41
|
+
const VERSION = "2.1.0";
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/components/ui/accordion.tsx
|
|
@@ -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
|
});
|