@rubenpazch/stepper 2.0.0 → 4.0.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/Stepper.d.ts.map +1 -1
- package/dist/index.cjs.js +49 -23
- package/dist/index.esm.js +49 -23
- package/package.json +6 -3
package/dist/Stepper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../src/Stepper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../src/Stepper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,KAAK,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAChD,UAAU,OAAO;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAuBD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,OAAO,CAiGpC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -424,21 +424,53 @@ function requireJsxRuntime () {
|
|
|
424
424
|
|
|
425
425
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
426
426
|
|
|
427
|
+
function styleInject(css, ref) {
|
|
428
|
+
if ( ref === void 0 ) ref = {};
|
|
429
|
+
var insertAt = ref.insertAt;
|
|
430
|
+
|
|
431
|
+
if (typeof document === 'undefined') { return; }
|
|
432
|
+
|
|
433
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
434
|
+
var style = document.createElement('style');
|
|
435
|
+
style.type = 'text/css';
|
|
436
|
+
|
|
437
|
+
if (insertAt === 'top') {
|
|
438
|
+
if (head.firstChild) {
|
|
439
|
+
head.insertBefore(style, head.firstChild);
|
|
440
|
+
} else {
|
|
441
|
+
head.appendChild(style);
|
|
442
|
+
}
|
|
443
|
+
} else {
|
|
444
|
+
head.appendChild(style);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
if (style.styleSheet) {
|
|
448
|
+
style.styleSheet.cssText = css;
|
|
449
|
+
} else {
|
|
450
|
+
style.appendChild(document.createTextNode(css));
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
var css_248z = "/* Container */\n.Stepper-module_container__DJqqd {\n margin-bottom: 2rem;\n}\n\n/* Step container */\n.Stepper-module_stepsContainer__BSRre {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.Stepper-module_stepWrapper__tLZrN {\n display: flex;\n align-items: center;\n flex: 1;\n}\n\n.Stepper-module_stepContent__U41GC {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n/* Circle */\n.Stepper-module_circle__NG20I {\n border-radius: 9999px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: 600;\n transition: all 150ms ease;\n}\n\n/* Circle sizes */\n.Stepper-module_circleSmall__OvjYU {\n width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n line-height: 1rem;\n}\n\n.Stepper-module_circleMedium__4USpR {\n width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n line-height: 1.5rem;\n}\n\n.Stepper-module_circleLarge__YJTfR {\n width: 4rem;\n height: 4rem;\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n\n/* Circle states */\n.Stepper-module_circleActive__b9Mg5 {\n background: var(--lb-color-primary);\n color: var(--lb-color-primary-foreground);\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);\n transform: scale(1.1);\n}\n\n.Stepper-module_circleActiveSmall__y038c {\n box-shadow: 0 0 0 2px var(--lb-color-blue-border);\n}\n\n.Stepper-module_circleActiveMedium__f5x7y {\n box-shadow: 0 0 0 4px var(--lb-color-blue-border);\n}\n\n.Stepper-module_circleActiveLarge__k5w2P {\n box-shadow: 0 0 0 8px var(--lb-color-blue-border);\n}\n\n.Stepper-module_circleCompleted__3PZzz {\n background: var(--lb-color-blue-subtle);\n color: var(--lb-color-primary);\n}\n\n.Stepper-module_circleFuture__5QSu9 {\n background: var(--lb-color-neutral-300);\n color: var(--lb-color-neutral-600);\n}\n\n/* Title */\n.Stepper-module_title__-ugD2 {\n margin-top: 0.5rem;\n font-weight: 500;\n transition: all 150ms ease;\n}\n\n/* Title sizes */\n.Stepper-module_titleSmall__UaJEH {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n\n.Stepper-module_titleMedium__9l6Ig {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n\n.Stepper-module_titleLarge__CK7gk {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n\n/* Title states */\n.Stepper-module_titleActive__DUnmr {\n color: var(--lb-color-primary-hover);\n font-weight: 700;\n}\n\n.Stepper-module_titleClickable__b3i-v {\n color: var(--lb-color-primary);\n text-decoration: underline;\n cursor: pointer;\n}\n\n.Stepper-module_titleClickable__b3i-v:hover {\n color: var(--lb-color-blue-strong);\n}\n\n.Stepper-module_titleCompleted__VdB7c {\n color: var(--lb-color-primary);\n}\n\n.Stepper-module_titleFuture__cSPZD {\n color: var(--lb-color-neutral-500);\n}\n\n/* Link and button styles */\n.Stepper-module_link__3WBTp {\n text-decoration: none;\n}\n\n.Stepper-module_link__3WBTp:hover {\n text-decoration: underline;\n}\n\n.Stepper-module_link__3WBTp:focus {\n outline: none;\n}\n\n.Stepper-module_button__2p5jI {\n background: transparent;\n border: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n}\n\n.Stepper-module_button__2p5jI:focus {\n outline: none;\n}\n\n/* Connector line */\n.Stepper-module_connector__7JYHQ {\n height: 0.25rem;\n flex: 1;\n margin-left: 1rem;\n margin-right: 1rem;\n margin-top: -1.25rem;\n}\n\n.Stepper-module_connectorCompleted__ZrGL7 {\n background: var(--lb-color-primary);\n}\n\n.Stepper-module_connectorIncomplete__6Gg1g {\n background: var(--lb-color-neutral-300);\n}\n";
|
|
455
|
+
var styles = {"container":"Stepper-module_container__DJqqd","stepsContainer":"Stepper-module_stepsContainer__BSRre","stepWrapper":"Stepper-module_stepWrapper__tLZrN","stepContent":"Stepper-module_stepContent__U41GC","circle":"Stepper-module_circle__NG20I","circleSmall":"Stepper-module_circleSmall__OvjYU","circleMedium":"Stepper-module_circleMedium__4USpR","circleLarge":"Stepper-module_circleLarge__YJTfR","circleActive":"Stepper-module_circleActive__b9Mg5","circleActiveSmall":"Stepper-module_circleActiveSmall__y038c","circleActiveMedium":"Stepper-module_circleActiveMedium__f5x7y","circleActiveLarge":"Stepper-module_circleActiveLarge__k5w2P","circleCompleted":"Stepper-module_circleCompleted__3PZzz","circleFuture":"Stepper-module_circleFuture__5QSu9","title":"Stepper-module_title__-ugD2","titleSmall":"Stepper-module_titleSmall__UaJEH","titleMedium":"Stepper-module_titleMedium__9l6Ig","titleLarge":"Stepper-module_titleLarge__CK7gk","titleActive":"Stepper-module_titleActive__DUnmr","titleClickable":"Stepper-module_titleClickable__b3i-v","titleCompleted":"Stepper-module_titleCompleted__VdB7c","titleFuture":"Stepper-module_titleFuture__cSPZD","link":"Stepper-module_link__3WBTp","button":"Stepper-module_button__2p5jI","connector":"Stepper-module_connector__7JYHQ","connectorCompleted":"Stepper-module_connectorCompleted__ZrGL7","connectorIncomplete":"Stepper-module_connectorIncomplete__6Gg1g"};
|
|
456
|
+
styleInject(css_248z);
|
|
457
|
+
|
|
458
|
+
const classNames = (...classes) => classes.filter(Boolean).join(" ");
|
|
427
459
|
const sizeMap = {
|
|
428
460
|
small: {
|
|
429
|
-
circle:
|
|
430
|
-
title:
|
|
431
|
-
ring:
|
|
461
|
+
circle: styles.circleSmall,
|
|
462
|
+
title: styles.titleSmall,
|
|
463
|
+
ring: styles.circleActiveSmall,
|
|
432
464
|
},
|
|
433
465
|
medium: {
|
|
434
|
-
circle:
|
|
435
|
-
title:
|
|
436
|
-
ring:
|
|
466
|
+
circle: styles.circleMedium,
|
|
467
|
+
title: styles.titleMedium,
|
|
468
|
+
ring: styles.circleActiveMedium,
|
|
437
469
|
},
|
|
438
470
|
large: {
|
|
439
|
-
circle:
|
|
440
|
-
title:
|
|
441
|
-
ring:
|
|
471
|
+
circle: styles.circleLarge,
|
|
472
|
+
title: styles.titleLarge,
|
|
473
|
+
ring: styles.circleActiveLarge,
|
|
442
474
|
},
|
|
443
475
|
};
|
|
444
476
|
const ProgressSteps = ({ steps, currentStep, className = "", stepClickable = false, onStepChange, size = "medium", }) => {
|
|
@@ -449,24 +481,18 @@ const ProgressSteps = ({ steps, currentStep, className = "", stepClickable = fal
|
|
|
449
481
|
if (onStepChange)
|
|
450
482
|
onStepChange(step.number);
|
|
451
483
|
};
|
|
452
|
-
return (jsxRuntimeExports.jsx("div", { className:
|
|
484
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames(styles.container, className), "data-testid": "progress-steps", children: jsxRuntimeExports.jsx("div", { className: styles.stepsContainer, children: steps.map((step, index) => {
|
|
453
485
|
const isClickable = stepClickable && (step.link || step.onClick || onStepChange);
|
|
454
486
|
const isActive = step.number === currentStep;
|
|
455
487
|
const isFuture = step.number > currentStep;
|
|
456
488
|
const isClickableStep = isClickable && !isActive;
|
|
457
|
-
const stepContent = (jsxRuntimeExports.jsxs("div", { className:
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
${isActive ? "text-blue-700 font-bold" : ""}
|
|
465
|
-
${isClickableStep ? "text-blue-600 underline cursor-pointer hover:text-blue-800" : ""}
|
|
466
|
-
${!isActive && !isClickableStep && !isFuture ? "text-blue-600" : ""}
|
|
467
|
-
${isFuture ? "text-gray-500" : ""}
|
|
468
|
-
`, children: step.title })] }));
|
|
469
|
-
return (jsxRuntimeExports.jsxs("div", { className: "flex items-center flex-1", children: [isClickable ? (step.link ? (jsxRuntimeExports.jsx("a", { href: step.link, className: "hover:underline focus:outline-none", tabIndex: 0, children: stepContent })) : (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => handleStepClick(step), className: "bg-transparent border-none p-0 m-0 focus:outline-none", children: stepContent }))) : (stepContent), index < steps.length - 1 && (jsxRuntimeExports.jsx("div", { className: `h-1 flex-1 mx-4 mt-[-20px] ${step.number < currentStep ? "bg-blue-600" : "bg-gray-300"}` }))] }, step.number));
|
|
489
|
+
const stepContent = (jsxRuntimeExports.jsxs("div", { className: styles.stepContent, children: [jsxRuntimeExports.jsx("div", { className: classNames(styles.circle, sizeStyles.circle, isActive && styles.circleActive, isActive && sizeStyles.ring, !isActive && !isFuture && styles.circleCompleted, isFuture && styles.circleFuture), "data-testid": `step-circle-${step.number}`, "data-active": isActive, "data-completed": !isActive && !isFuture, "data-future": isFuture, children: step.number }), jsxRuntimeExports.jsx("span", { className: classNames(styles.title, sizeStyles.title, isActive && styles.titleActive, isClickableStep && styles.titleClickable, !isActive &&
|
|
490
|
+
!isClickableStep &&
|
|
491
|
+
!isFuture &&
|
|
492
|
+
styles.titleCompleted, isFuture && styles.titleFuture), "data-testid": `step-title-${step.number}`, children: step.title })] }));
|
|
493
|
+
return (jsxRuntimeExports.jsxs("div", { className: styles.stepWrapper, children: [isClickable ? (step.link ? (jsxRuntimeExports.jsx("a", { href: step.link, className: styles.link, tabIndex: 0, children: stepContent })) : (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => handleStepClick(step), className: styles.button, children: stepContent }))) : (stepContent), index < steps.length - 1 && (jsxRuntimeExports.jsx("div", { className: classNames(styles.connector, step.number < currentStep
|
|
494
|
+
? styles.connectorCompleted
|
|
495
|
+
: styles.connectorIncomplete), "data-testid": `connector-${step.number}` }))] }, step.number));
|
|
470
496
|
}) }) }));
|
|
471
497
|
};
|
|
472
498
|
|
package/dist/index.esm.js
CHANGED
|
@@ -422,21 +422,53 @@ function requireJsxRuntime () {
|
|
|
422
422
|
|
|
423
423
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
424
424
|
|
|
425
|
+
function styleInject(css, ref) {
|
|
426
|
+
if ( ref === void 0 ) ref = {};
|
|
427
|
+
var insertAt = ref.insertAt;
|
|
428
|
+
|
|
429
|
+
if (typeof document === 'undefined') { return; }
|
|
430
|
+
|
|
431
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
432
|
+
var style = document.createElement('style');
|
|
433
|
+
style.type = 'text/css';
|
|
434
|
+
|
|
435
|
+
if (insertAt === 'top') {
|
|
436
|
+
if (head.firstChild) {
|
|
437
|
+
head.insertBefore(style, head.firstChild);
|
|
438
|
+
} else {
|
|
439
|
+
head.appendChild(style);
|
|
440
|
+
}
|
|
441
|
+
} else {
|
|
442
|
+
head.appendChild(style);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (style.styleSheet) {
|
|
446
|
+
style.styleSheet.cssText = css;
|
|
447
|
+
} else {
|
|
448
|
+
style.appendChild(document.createTextNode(css));
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
var css_248z = "/* Container */\n.Stepper-module_container__DJqqd {\n margin-bottom: 2rem;\n}\n\n/* Step container */\n.Stepper-module_stepsContainer__BSRre {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.Stepper-module_stepWrapper__tLZrN {\n display: flex;\n align-items: center;\n flex: 1;\n}\n\n.Stepper-module_stepContent__U41GC {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n/* Circle */\n.Stepper-module_circle__NG20I {\n border-radius: 9999px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: 600;\n transition: all 150ms ease;\n}\n\n/* Circle sizes */\n.Stepper-module_circleSmall__OvjYU {\n width: 1.5rem;\n height: 1.5rem;\n font-size: 0.75rem;\n line-height: 1rem;\n}\n\n.Stepper-module_circleMedium__4USpR {\n width: 2.5rem;\n height: 2.5rem;\n font-size: 1rem;\n line-height: 1.5rem;\n}\n\n.Stepper-module_circleLarge__YJTfR {\n width: 4rem;\n height: 4rem;\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n\n/* Circle states */\n.Stepper-module_circleActive__b9Mg5 {\n background: var(--lb-color-primary);\n color: var(--lb-color-primary-foreground);\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);\n transform: scale(1.1);\n}\n\n.Stepper-module_circleActiveSmall__y038c {\n box-shadow: 0 0 0 2px var(--lb-color-blue-border);\n}\n\n.Stepper-module_circleActiveMedium__f5x7y {\n box-shadow: 0 0 0 4px var(--lb-color-blue-border);\n}\n\n.Stepper-module_circleActiveLarge__k5w2P {\n box-shadow: 0 0 0 8px var(--lb-color-blue-border);\n}\n\n.Stepper-module_circleCompleted__3PZzz {\n background: var(--lb-color-blue-subtle);\n color: var(--lb-color-primary);\n}\n\n.Stepper-module_circleFuture__5QSu9 {\n background: var(--lb-color-neutral-300);\n color: var(--lb-color-neutral-600);\n}\n\n/* Title */\n.Stepper-module_title__-ugD2 {\n margin-top: 0.5rem;\n font-weight: 500;\n transition: all 150ms ease;\n}\n\n/* Title sizes */\n.Stepper-module_titleSmall__UaJEH {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n\n.Stepper-module_titleMedium__9l6Ig {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n\n.Stepper-module_titleLarge__CK7gk {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n\n/* Title states */\n.Stepper-module_titleActive__DUnmr {\n color: var(--lb-color-primary-hover);\n font-weight: 700;\n}\n\n.Stepper-module_titleClickable__b3i-v {\n color: var(--lb-color-primary);\n text-decoration: underline;\n cursor: pointer;\n}\n\n.Stepper-module_titleClickable__b3i-v:hover {\n color: var(--lb-color-blue-strong);\n}\n\n.Stepper-module_titleCompleted__VdB7c {\n color: var(--lb-color-primary);\n}\n\n.Stepper-module_titleFuture__cSPZD {\n color: var(--lb-color-neutral-500);\n}\n\n/* Link and button styles */\n.Stepper-module_link__3WBTp {\n text-decoration: none;\n}\n\n.Stepper-module_link__3WBTp:hover {\n text-decoration: underline;\n}\n\n.Stepper-module_link__3WBTp:focus {\n outline: none;\n}\n\n.Stepper-module_button__2p5jI {\n background: transparent;\n border: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n}\n\n.Stepper-module_button__2p5jI:focus {\n outline: none;\n}\n\n/* Connector line */\n.Stepper-module_connector__7JYHQ {\n height: 0.25rem;\n flex: 1;\n margin-left: 1rem;\n margin-right: 1rem;\n margin-top: -1.25rem;\n}\n\n.Stepper-module_connectorCompleted__ZrGL7 {\n background: var(--lb-color-primary);\n}\n\n.Stepper-module_connectorIncomplete__6Gg1g {\n background: var(--lb-color-neutral-300);\n}\n";
|
|
453
|
+
var styles = {"container":"Stepper-module_container__DJqqd","stepsContainer":"Stepper-module_stepsContainer__BSRre","stepWrapper":"Stepper-module_stepWrapper__tLZrN","stepContent":"Stepper-module_stepContent__U41GC","circle":"Stepper-module_circle__NG20I","circleSmall":"Stepper-module_circleSmall__OvjYU","circleMedium":"Stepper-module_circleMedium__4USpR","circleLarge":"Stepper-module_circleLarge__YJTfR","circleActive":"Stepper-module_circleActive__b9Mg5","circleActiveSmall":"Stepper-module_circleActiveSmall__y038c","circleActiveMedium":"Stepper-module_circleActiveMedium__f5x7y","circleActiveLarge":"Stepper-module_circleActiveLarge__k5w2P","circleCompleted":"Stepper-module_circleCompleted__3PZzz","circleFuture":"Stepper-module_circleFuture__5QSu9","title":"Stepper-module_title__-ugD2","titleSmall":"Stepper-module_titleSmall__UaJEH","titleMedium":"Stepper-module_titleMedium__9l6Ig","titleLarge":"Stepper-module_titleLarge__CK7gk","titleActive":"Stepper-module_titleActive__DUnmr","titleClickable":"Stepper-module_titleClickable__b3i-v","titleCompleted":"Stepper-module_titleCompleted__VdB7c","titleFuture":"Stepper-module_titleFuture__cSPZD","link":"Stepper-module_link__3WBTp","button":"Stepper-module_button__2p5jI","connector":"Stepper-module_connector__7JYHQ","connectorCompleted":"Stepper-module_connectorCompleted__ZrGL7","connectorIncomplete":"Stepper-module_connectorIncomplete__6Gg1g"};
|
|
454
|
+
styleInject(css_248z);
|
|
455
|
+
|
|
456
|
+
const classNames = (...classes) => classes.filter(Boolean).join(" ");
|
|
425
457
|
const sizeMap = {
|
|
426
458
|
small: {
|
|
427
|
-
circle:
|
|
428
|
-
title:
|
|
429
|
-
ring:
|
|
459
|
+
circle: styles.circleSmall,
|
|
460
|
+
title: styles.titleSmall,
|
|
461
|
+
ring: styles.circleActiveSmall,
|
|
430
462
|
},
|
|
431
463
|
medium: {
|
|
432
|
-
circle:
|
|
433
|
-
title:
|
|
434
|
-
ring:
|
|
464
|
+
circle: styles.circleMedium,
|
|
465
|
+
title: styles.titleMedium,
|
|
466
|
+
ring: styles.circleActiveMedium,
|
|
435
467
|
},
|
|
436
468
|
large: {
|
|
437
|
-
circle:
|
|
438
|
-
title:
|
|
439
|
-
ring:
|
|
469
|
+
circle: styles.circleLarge,
|
|
470
|
+
title: styles.titleLarge,
|
|
471
|
+
ring: styles.circleActiveLarge,
|
|
440
472
|
},
|
|
441
473
|
};
|
|
442
474
|
const ProgressSteps = ({ steps, currentStep, className = "", stepClickable = false, onStepChange, size = "medium", }) => {
|
|
@@ -447,24 +479,18 @@ const ProgressSteps = ({ steps, currentStep, className = "", stepClickable = fal
|
|
|
447
479
|
if (onStepChange)
|
|
448
480
|
onStepChange(step.number);
|
|
449
481
|
};
|
|
450
|
-
return (jsxRuntimeExports.jsx("div", { className:
|
|
482
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames(styles.container, className), "data-testid": "progress-steps", children: jsxRuntimeExports.jsx("div", { className: styles.stepsContainer, children: steps.map((step, index) => {
|
|
451
483
|
const isClickable = stepClickable && (step.link || step.onClick || onStepChange);
|
|
452
484
|
const isActive = step.number === currentStep;
|
|
453
485
|
const isFuture = step.number > currentStep;
|
|
454
486
|
const isClickableStep = isClickable && !isActive;
|
|
455
|
-
const stepContent = (jsxRuntimeExports.jsxs("div", { className:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
${isActive ? "text-blue-700 font-bold" : ""}
|
|
463
|
-
${isClickableStep ? "text-blue-600 underline cursor-pointer hover:text-blue-800" : ""}
|
|
464
|
-
${!isActive && !isClickableStep && !isFuture ? "text-blue-600" : ""}
|
|
465
|
-
${isFuture ? "text-gray-500" : ""}
|
|
466
|
-
`, children: step.title })] }));
|
|
467
|
-
return (jsxRuntimeExports.jsxs("div", { className: "flex items-center flex-1", children: [isClickable ? (step.link ? (jsxRuntimeExports.jsx("a", { href: step.link, className: "hover:underline focus:outline-none", tabIndex: 0, children: stepContent })) : (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => handleStepClick(step), className: "bg-transparent border-none p-0 m-0 focus:outline-none", children: stepContent }))) : (stepContent), index < steps.length - 1 && (jsxRuntimeExports.jsx("div", { className: `h-1 flex-1 mx-4 mt-[-20px] ${step.number < currentStep ? "bg-blue-600" : "bg-gray-300"}` }))] }, step.number));
|
|
487
|
+
const stepContent = (jsxRuntimeExports.jsxs("div", { className: styles.stepContent, children: [jsxRuntimeExports.jsx("div", { className: classNames(styles.circle, sizeStyles.circle, isActive && styles.circleActive, isActive && sizeStyles.ring, !isActive && !isFuture && styles.circleCompleted, isFuture && styles.circleFuture), "data-testid": `step-circle-${step.number}`, "data-active": isActive, "data-completed": !isActive && !isFuture, "data-future": isFuture, children: step.number }), jsxRuntimeExports.jsx("span", { className: classNames(styles.title, sizeStyles.title, isActive && styles.titleActive, isClickableStep && styles.titleClickable, !isActive &&
|
|
488
|
+
!isClickableStep &&
|
|
489
|
+
!isFuture &&
|
|
490
|
+
styles.titleCompleted, isFuture && styles.titleFuture), "data-testid": `step-title-${step.number}`, children: step.title })] }));
|
|
491
|
+
return (jsxRuntimeExports.jsxs("div", { className: styles.stepWrapper, children: [isClickable ? (step.link ? (jsxRuntimeExports.jsx("a", { href: step.link, className: styles.link, tabIndex: 0, children: stepContent })) : (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => handleStepClick(step), className: styles.button, children: stepContent }))) : (stepContent), index < steps.length - 1 && (jsxRuntimeExports.jsx("div", { className: classNames(styles.connector, step.number < currentStep
|
|
492
|
+
? styles.connectorCompleted
|
|
493
|
+
: styles.connectorIncomplete), "data-testid": `connector-${step.number}` }))] }, step.number));
|
|
468
494
|
}) }) }));
|
|
469
495
|
};
|
|
470
496
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubenpazch/stepper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Stepper component",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
|
-
"sideEffects":
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"**/*.css"
|
|
21
|
+
],
|
|
20
22
|
"exports": {
|
|
21
23
|
".": {
|
|
22
24
|
"import": "./dist/index.esm.js",
|
|
@@ -26,7 +28,8 @@
|
|
|
26
28
|
},
|
|
27
29
|
"peerDependencies": {
|
|
28
30
|
"react": "^19.0.0",
|
|
29
|
-
"react-dom": "^19.0.0"
|
|
31
|
+
"react-dom": "^19.0.0",
|
|
32
|
+
"@rubenpazch/tokens": "0.2.0"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
35
|
"@rubenpazch/typescript-config": "3.0.0"
|