bianic-ui 2.14.0-beta.2 → 2.14.0-beta.3
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/cjs/index.js +149 -1
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Stepper/Horizontal/Navbar.d.ts +4 -0
- package/dist/cjs/types/components/Stepper/Horizontal/Standard.d.ts +4 -0
- package/dist/cjs/types/components/Stepper/Horizontal/configs.d.ts +9 -0
- package/dist/cjs/types/components/Stepper/Horizontal/index.d.ts +3 -20
- package/dist/cjs/types/components/Stepper/Horizontal/types.d.ts +32 -0
- package/dist/cjs/types/components/Stepper/index.d.ts +1 -0
- package/dist/cjs/types/components/index.d.ts +1 -0
- package/dist/cjs/types/stories/Button/Button.test.stories.d.ts +24 -0
- package/dist/cjs/types/stories/HorizontalStepper/HorizontalStepper.stories.d.ts +123 -4
- package/dist/cjs/types/stories/HorizontalStepper/HorizontalStepper.test.stories.d.ts +49 -0
- package/dist/esm/index.js +149 -1
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Stepper/Horizontal/Navbar.d.ts +4 -0
- package/dist/esm/types/components/Stepper/Horizontal/Standard.d.ts +4 -0
- package/dist/esm/types/components/Stepper/Horizontal/configs.d.ts +9 -0
- package/dist/esm/types/components/Stepper/Horizontal/index.d.ts +3 -20
- package/dist/esm/types/components/Stepper/Horizontal/types.d.ts +32 -0
- package/dist/esm/types/components/Stepper/index.d.ts +1 -0
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/esm/types/stories/Button/Button.test.stories.d.ts +24 -0
- package/dist/esm/types/stories/HorizontalStepper/HorizontalStepper.stories.d.ts +123 -4
- package/dist/esm/types/stories/HorizontalStepper/HorizontalStepper.test.stories.d.ts +49 -0
- package/dist/index.d.ts +17 -5
- package/package.json +13 -3
package/dist/cjs/index.js
CHANGED
|
@@ -9237,7 +9237,7 @@ function cn() {
|
|
|
9237
9237
|
}
|
|
9238
9238
|
return twMerge(clsx(inputs));
|
|
9239
9239
|
}
|
|
9240
|
-
function
|
|
9240
|
+
function StandardHorizontalStepper(_a) {
|
|
9241
9241
|
var steps = _a.steps, activeStep = _a.activeStep, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.onStepClick, onStepClick = _d === void 0 ? undefined : _d, _e = _a.processedIcon, processedIcon = _e === void 0 ? undefined : _e, _f = _a.currentIcon, currentIcon = _f === void 0 ? undefined : _f, _g = _a.color, color = _g === void 0 ? 'blue' : _g, _h = _a.showLabels, showLabels = _h === void 0 ? true : _h;
|
|
9242
9242
|
var isSmall = size === 'sm';
|
|
9243
9243
|
var connectorColor = "bg-bia-".concat(color);
|
|
@@ -9287,6 +9287,154 @@ function HorizontalStepper(_a) {
|
|
|
9287
9287
|
})));
|
|
9288
9288
|
}
|
|
9289
9289
|
|
|
9290
|
+
var navbarItemConfig = {
|
|
9291
|
+
current: 'cursor-default',
|
|
9292
|
+
clickable: 'cursor-pointer hover:bg-bia-white/15 active:bg-bia-white-transparent-80 focus-visible:outline focus-visible:outline-[3px] focus-visible:outline-offset-0 focus-visible:outline-bia-blue-light-50',
|
|
9293
|
+
static: 'cursor-default',
|
|
9294
|
+
disabled: 'cursor-default',
|
|
9295
|
+
};
|
|
9296
|
+
var navbarCircleConfig = {
|
|
9297
|
+
currentDefault: 'bg-bia-white border-bia-white text-bia-black',
|
|
9298
|
+
other: 'border-bia-white text-bia-white',
|
|
9299
|
+
disabled: 'border-bia-white-transparent-40 text-bia-white-transparent-40',
|
|
9300
|
+
};
|
|
9301
|
+
var navbarCurrentColorConfig = {
|
|
9302
|
+
blue: 'bg-bia-blue border-bia-blue text-bia-white',
|
|
9303
|
+
green: 'bg-bia-green border-bia-green text-bia-white',
|
|
9304
|
+
teal: 'bg-bia-teal border-bia-teal text-bia-white',
|
|
9305
|
+
crayola: 'bg-bia-crayola border-bia-crayola text-bia-white',
|
|
9306
|
+
orange: 'bg-bia-orange border-bia-orange text-bia-white',
|
|
9307
|
+
red: 'bg-bia-red border-bia-red text-bia-white',
|
|
9308
|
+
};
|
|
9309
|
+
var navbarProcessedColorConfig = {
|
|
9310
|
+
blue: 'border-bia-blue text-bia-white',
|
|
9311
|
+
green: 'border-bia-green text-bia-white',
|
|
9312
|
+
teal: 'border-bia-teal text-bia-white',
|
|
9313
|
+
crayola: 'border-bia-crayola text-bia-white',
|
|
9314
|
+
orange: 'border-bia-orange text-bia-white',
|
|
9315
|
+
red: 'border-bia-red text-bia-white',
|
|
9316
|
+
};
|
|
9317
|
+
var navbarProcessedFilledColorConfig = {
|
|
9318
|
+
blue: 'bg-bia-blue border-bia-blue text-bia-white',
|
|
9319
|
+
green: 'bg-bia-green border-bia-green text-bia-white',
|
|
9320
|
+
teal: 'bg-bia-teal border-bia-teal text-bia-white',
|
|
9321
|
+
crayola: 'bg-bia-crayola border-bia-crayola text-bia-white',
|
|
9322
|
+
orange: 'bg-bia-orange border-bia-orange text-bia-white',
|
|
9323
|
+
red: 'bg-bia-red border-bia-red text-bia-white',
|
|
9324
|
+
};
|
|
9325
|
+
var navbarLabelConfig = {
|
|
9326
|
+
enabled: 'whitespace-nowrap leading-4 text-bia-white',
|
|
9327
|
+
disabled: 'whitespace-nowrap leading-4 text-bia-white-transparent-40',
|
|
9328
|
+
};
|
|
9329
|
+
var navbarChevronConfig = {
|
|
9330
|
+
enabled: 'shrink-0 text-bia-white',
|
|
9331
|
+
disabled: 'shrink-0 text-bia-white-transparent-40',
|
|
9332
|
+
};
|
|
9333
|
+
|
|
9334
|
+
var NAVBAR_COLORS = [
|
|
9335
|
+
'blue',
|
|
9336
|
+
'green',
|
|
9337
|
+
'teal',
|
|
9338
|
+
'crayola',
|
|
9339
|
+
'orange',
|
|
9340
|
+
'red',
|
|
9341
|
+
];
|
|
9342
|
+
var circleTextColor = function (circleClass) { var _a, _b; return (_b = (_a = circleClass.match(/text-bia-\S+/)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : ''; };
|
|
9343
|
+
function resolveItemState(isCurrent, isDisabled, isClickable) {
|
|
9344
|
+
if (isCurrent)
|
|
9345
|
+
return 'current';
|
|
9346
|
+
if (isDisabled)
|
|
9347
|
+
return 'disabled';
|
|
9348
|
+
if (isClickable)
|
|
9349
|
+
return 'clickable';
|
|
9350
|
+
return 'static';
|
|
9351
|
+
}
|
|
9352
|
+
function resolveCircleClass(isCurrent, isDisabled, isProcessed, navColor, processedIcon) {
|
|
9353
|
+
if (isCurrent) {
|
|
9354
|
+
if (navColor)
|
|
9355
|
+
return navbarCurrentColorConfig[navColor];
|
|
9356
|
+
return navbarCircleConfig.currentDefault;
|
|
9357
|
+
}
|
|
9358
|
+
if (isDisabled)
|
|
9359
|
+
return navbarCircleConfig.disabled;
|
|
9360
|
+
if (isProcessed && navColor) {
|
|
9361
|
+
if (processedIcon)
|
|
9362
|
+
return navbarProcessedFilledColorConfig[navColor];
|
|
9363
|
+
return navbarProcessedColorConfig[navColor];
|
|
9364
|
+
}
|
|
9365
|
+
return navbarCircleConfig.other;
|
|
9366
|
+
}
|
|
9367
|
+
function resolveCircleContent(step, index, isProcessed, isCurrent, processedIcon, currentIcon, circleClass) {
|
|
9368
|
+
if (step.icon)
|
|
9369
|
+
return step.icon;
|
|
9370
|
+
if (isProcessed && processedIcon)
|
|
9371
|
+
return processedIcon;
|
|
9372
|
+
if (isCurrent && currentIcon)
|
|
9373
|
+
return currentIcon;
|
|
9374
|
+
return (React.createElement(Text, { variant: "tiny-text", className: "leading-none ".concat(circleTextColor(circleClass)) }, index + 1));
|
|
9375
|
+
}
|
|
9376
|
+
function NavbarHorizontalStepper(_a) {
|
|
9377
|
+
var steps = _a.steps, activeStep = _a.activeStep, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.onStepClick, onStepClick = _c === void 0 ? undefined : _c, _d = _a.color, color = _d === void 0 ? undefined : _d, _e = _a.processedIcon, processedIcon = _e === void 0 ? undefined : _e, _f = _a.currentIcon, currentIcon = _f === void 0 ? undefined : _f;
|
|
9378
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9379
|
+
_a.size;
|
|
9380
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9381
|
+
_a.showLabels;
|
|
9382
|
+
// size and showLabels are accepted for API parity, ignored on navbar
|
|
9383
|
+
var navColor = color === undefined
|
|
9384
|
+
? undefined
|
|
9385
|
+
: validUnion(color, NAVBAR_COLORS);
|
|
9386
|
+
return (React.createElement("nav", { "aria-label": "Progress", className: cn$1('flex', className) },
|
|
9387
|
+
React.createElement("ol", { className: "flex items-center" }, steps.map(function (step, index) {
|
|
9388
|
+
var _a;
|
|
9389
|
+
var isCurrent = index === activeStep;
|
|
9390
|
+
var isProcessed = index < activeStep;
|
|
9391
|
+
var isDisabled = !isCurrent && Boolean(step.disabled);
|
|
9392
|
+
var isClickable = !isCurrent && !isDisabled && Boolean(onStepClick);
|
|
9393
|
+
var itemState = resolveItemState(isCurrent, isDisabled, isClickable);
|
|
9394
|
+
var itemClass = cn$1('flex h-6 items-center gap-[5px] px-[5px] py-[3px]', !isCurrent && 'rounded-radius-sm', navbarItemConfig[itemState]);
|
|
9395
|
+
var circleClass = resolveCircleClass(isCurrent, isDisabled, isProcessed, navColor, processedIcon);
|
|
9396
|
+
var labelClass = isDisabled
|
|
9397
|
+
? navbarLabelConfig.disabled
|
|
9398
|
+
: navbarLabelConfig.enabled;
|
|
9399
|
+
var isChevronDisabled = !isCurrent && Boolean(step.disabled);
|
|
9400
|
+
var circleContent = resolveCircleContent(step, index, isProcessed, isCurrent, processedIcon, currentIcon, circleClass);
|
|
9401
|
+
var circle = (React.createElement("span", { className: cn$1('flex size-5 min-w-5 shrink-0 items-center justify-center rounded-full border px-[5px] py-px text-size-tiny', circleClass) }, circleContent));
|
|
9402
|
+
var label = step.label ? (React.createElement(Text, { variant: "tiny-text", className: labelClass }, step.label)) : null;
|
|
9403
|
+
var content = (React.createElement(React.Fragment, null,
|
|
9404
|
+
circle,
|
|
9405
|
+
label));
|
|
9406
|
+
var stepElement;
|
|
9407
|
+
if (isCurrent) {
|
|
9408
|
+
stepElement = (React.createElement("span", { "aria-current": "step", className: itemClass }, content));
|
|
9409
|
+
}
|
|
9410
|
+
else if (isClickable) {
|
|
9411
|
+
stepElement = (React.createElement("button", { type: "button", onClick: function () { return onStepClick === null || onStepClick === void 0 ? void 0 : onStepClick(index); }, className: itemClass }, content));
|
|
9412
|
+
}
|
|
9413
|
+
else if (isDisabled && onStepClick) {
|
|
9414
|
+
stepElement = (React.createElement("button", { type: "button", disabled: true, className: itemClass }, content));
|
|
9415
|
+
}
|
|
9416
|
+
else {
|
|
9417
|
+
stepElement = React.createElement("span", { className: itemClass }, content);
|
|
9418
|
+
}
|
|
9419
|
+
return (React.createElement("li", { key: (_a = step.id) !== null && _a !== void 0 ? _a : index, className: "flex items-center" },
|
|
9420
|
+
index > 0 && (React.createElement(TbChevronRight, { size: 14, "aria-hidden": "true", className: isChevronDisabled
|
|
9421
|
+
? navbarChevronConfig.disabled
|
|
9422
|
+
: navbarChevronConfig.enabled })),
|
|
9423
|
+
stepElement));
|
|
9424
|
+
}))));
|
|
9425
|
+
}
|
|
9426
|
+
|
|
9427
|
+
var VARIANT_UNION = ['default', 'navbar'];
|
|
9428
|
+
function HorizontalStepper(props) {
|
|
9429
|
+
var variant = props.variant, rest = __rest(props, ["variant"]);
|
|
9430
|
+
switch (validUnion(variant, VARIANT_UNION)) {
|
|
9431
|
+
case 'navbar':
|
|
9432
|
+
return (React.createElement(NavbarHorizontalStepper, __assign({}, rest)));
|
|
9433
|
+
default:
|
|
9434
|
+
return (React.createElement(StandardHorizontalStepper, __assign({}, rest)));
|
|
9435
|
+
}
|
|
9436
|
+
}
|
|
9437
|
+
|
|
9290
9438
|
var variantConfig = {
|
|
9291
9439
|
upcoming: 'bg-white border-2 border-coolgrey-light-50',
|
|
9292
9440
|
processed: 'bg-white border-2 border-bia-blue',
|