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
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavbarHorizontalStepperProps } from './types';
|
|
3
|
+
export declare function NavbarHorizontalStepper({ steps, activeStep, className, onStepClick, color, processedIcon, currentIcon, size, showLabels, }: Omit<NavbarHorizontalStepperProps, 'variant'>): React.JSX.Element;
|
|
4
|
+
export default NavbarHorizontalStepper;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StandardHorizontalStepperProps } from './types';
|
|
3
|
+
export declare function StandardHorizontalStepper({ steps, activeStep, size, className, onStepClick, processedIcon, currentIcon, color, showLabels, }: Omit<StandardHorizontalStepperProps, 'variant'>): React.JSX.Element;
|
|
4
|
+
export default StandardHorizontalStepper;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HorizontalStepperColor } from './types';
|
|
2
|
+
export type NavbarStepState = 'current' | 'clickable' | 'static' | 'disabled';
|
|
3
|
+
export declare const navbarItemConfig: Record<NavbarStepState, string>;
|
|
4
|
+
export declare const navbarCircleConfig: Record<'currentDefault' | 'other' | 'disabled', string>;
|
|
5
|
+
export declare const navbarCurrentColorConfig: Record<HorizontalStepperColor, string>;
|
|
6
|
+
export declare const navbarProcessedColorConfig: Record<HorizontalStepperColor, string>;
|
|
7
|
+
export declare const navbarProcessedFilledColorConfig: Record<HorizontalStepperColor, string>;
|
|
8
|
+
export declare const navbarLabelConfig: Record<'enabled' | 'disabled', string>;
|
|
9
|
+
export declare const navbarChevronConfig: Record<'enabled' | 'disabled', string>;
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export interface Step {
|
|
5
|
-
id: string | number;
|
|
6
|
-
label?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
icon?: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
export interface HorizontalStepperProps {
|
|
11
|
-
steps: Step[];
|
|
12
|
-
activeStep: number;
|
|
13
|
-
size?: StepperSize;
|
|
14
|
-
className?: string;
|
|
15
|
-
onStepClick?: (index: number) => void;
|
|
16
|
-
processedIcon?: React.ReactNode;
|
|
17
|
-
currentIcon?: React.ReactNode;
|
|
18
|
-
color?: string;
|
|
19
|
-
showLabels?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare function HorizontalStepper({ steps, activeStep, size, className, onStepClick, processedIcon, currentIcon, color, showLabels, }: HorizontalStepperProps): React.JSX.Element;
|
|
2
|
+
import { HorizontalStepperProps } from './types';
|
|
3
|
+
export declare function HorizontalStepper(props: HorizontalStepperProps): React.JSX.Element;
|
|
22
4
|
export default HorizontalStepper;
|
|
5
|
+
export type { Step, StepStatus, StepperSize, HorizontalStepperProps, HorizontalStepperVariant, HorizontalStepperColor, StandardHorizontalStepperProps, NavbarHorizontalStepperProps, } from './types';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type StepStatus = 'upcoming' | 'current' | 'processed';
|
|
3
|
+
export type StepperSize = 'sm' | 'md';
|
|
4
|
+
export interface Step {
|
|
5
|
+
id: string | number;
|
|
6
|
+
label?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type HorizontalStepperVariant = 'default' | 'navbar';
|
|
12
|
+
export type HorizontalStepperColor = 'blue' | 'green' | 'teal' | 'crayola' | 'orange' | 'red';
|
|
13
|
+
interface BaseHorizontalStepperProps {
|
|
14
|
+
steps: Step[];
|
|
15
|
+
activeStep: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
onStepClick?: (index: number) => void;
|
|
18
|
+
processedIcon?: React.ReactNode;
|
|
19
|
+
currentIcon?: React.ReactNode;
|
|
20
|
+
size?: StepperSize;
|
|
21
|
+
showLabels?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface StandardHorizontalStepperProps extends BaseHorizontalStepperProps {
|
|
24
|
+
variant?: 'default';
|
|
25
|
+
color?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface NavbarHorizontalStepperProps extends BaseHorizontalStepperProps {
|
|
28
|
+
variant: 'navbar';
|
|
29
|
+
color?: HorizontalStepperColor;
|
|
30
|
+
}
|
|
31
|
+
export type HorizontalStepperProps = StandardHorizontalStepperProps | NavbarHorizontalStepperProps;
|
|
32
|
+
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { default as HorizontalStepper } from './Horizontal';
|
|
2
2
|
export { default as VerticalStepper } from './Vertical';
|
|
3
|
+
export type { HorizontalStepperProps, HorizontalStepperVariant, HorizontalStepperColor, StandardHorizontalStepperProps, NavbarHorizontalStepperProps, } from './Horizontal';
|
|
@@ -35,6 +35,7 @@ export { default as Tooltip } from './Tooltip';
|
|
|
35
35
|
export { Display, P, Heading, Text, Link } from './Typography';
|
|
36
36
|
export { Toaster } from './Toaster';
|
|
37
37
|
export { HorizontalStepper, VerticalStepper } from './Stepper';
|
|
38
|
+
export type { HorizontalStepperProps, HorizontalStepperVariant, HorizontalStepperColor, StandardHorizontalStepperProps, NavbarHorizontalStepperProps, } from './Stepper';
|
|
38
39
|
export { default as Window } from './Window';
|
|
39
40
|
export { getRelativeTime, formatDateTime } from '../utility';
|
|
40
41
|
export type { DateTimeFormatType } from '../utility';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<Omit<import("../../components/Button/PropInterfaceButton").ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
a11y: {
|
|
9
|
+
test: string;
|
|
10
|
+
};
|
|
11
|
+
chromatic: {
|
|
12
|
+
disableSnapshot: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
args: {
|
|
16
|
+
label: string;
|
|
17
|
+
onClick: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
export declare const ClickCallsOnClick: Story;
|
|
23
|
+
export declare const DisabledDoesNotFire: Story;
|
|
24
|
+
export declare const KeyboardActivates: Story;
|
|
@@ -1,9 +1,128 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { HorizontalStepper } from '../../components
|
|
3
|
-
declare const meta:
|
|
1
|
+
import type { StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { HorizontalStepper } from '../../components';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof HorizontalStepper;
|
|
6
|
+
argTypes: {
|
|
7
|
+
variant: {
|
|
8
|
+
control: "inline-radio";
|
|
9
|
+
options: string[];
|
|
10
|
+
description: string;
|
|
11
|
+
table: {
|
|
12
|
+
defaultValue: {
|
|
13
|
+
summary: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
steps: {
|
|
18
|
+
control: false;
|
|
19
|
+
description: string;
|
|
20
|
+
table: {
|
|
21
|
+
defaultValue: {
|
|
22
|
+
summary: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
activeStep: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "number";
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
};
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
className: {
|
|
35
|
+
control: "text";
|
|
36
|
+
description: string;
|
|
37
|
+
table: {
|
|
38
|
+
defaultValue: {
|
|
39
|
+
summary: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
size: {
|
|
44
|
+
control: "radio";
|
|
45
|
+
options: string[];
|
|
46
|
+
description: string;
|
|
47
|
+
table: {
|
|
48
|
+
defaultValue: {
|
|
49
|
+
summary: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
color: {
|
|
54
|
+
control: "select";
|
|
55
|
+
options: string[];
|
|
56
|
+
description: string;
|
|
57
|
+
table: {
|
|
58
|
+
defaultValue: {
|
|
59
|
+
summary: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
showLabels: {
|
|
64
|
+
control: "boolean";
|
|
65
|
+
description: string;
|
|
66
|
+
table: {
|
|
67
|
+
defaultValue: {
|
|
68
|
+
summary: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
processedIcon: {
|
|
73
|
+
control: false;
|
|
74
|
+
description: string;
|
|
75
|
+
table: {
|
|
76
|
+
defaultValue: {
|
|
77
|
+
summary: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
currentIcon: {
|
|
82
|
+
control: false;
|
|
83
|
+
description: string;
|
|
84
|
+
table: {
|
|
85
|
+
defaultValue: {
|
|
86
|
+
summary: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
onStepClick: {
|
|
91
|
+
control: false;
|
|
92
|
+
action: string;
|
|
93
|
+
description: string;
|
|
94
|
+
table: {
|
|
95
|
+
type: {
|
|
96
|
+
summary: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
args: {
|
|
102
|
+
variant: "default";
|
|
103
|
+
steps: {
|
|
104
|
+
id: string;
|
|
105
|
+
label: string;
|
|
106
|
+
}[];
|
|
107
|
+
activeStep: number;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
4
110
|
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof
|
|
111
|
+
type Story = StoryObj<typeof meta>;
|
|
6
112
|
export declare const Medium: Story;
|
|
7
113
|
export declare const Small: Story;
|
|
8
114
|
export declare const Interactive: Story;
|
|
9
115
|
export declare const InteractiveCustomIcon: Story;
|
|
116
|
+
export declare const Default: Story;
|
|
117
|
+
export declare const Basic: Story;
|
|
118
|
+
export declare const DefaultVariant: Story;
|
|
119
|
+
export declare const WithColor: Story;
|
|
120
|
+
export declare const WithoutLabels: Story;
|
|
121
|
+
export declare const Navbar: Story;
|
|
122
|
+
export declare const NavbarWithColor: Story;
|
|
123
|
+
export declare const NavbarWithIcons: Story;
|
|
124
|
+
export declare const NavbarWithDisabledSteps: Story;
|
|
125
|
+
export declare const NavbarStatic: Story;
|
|
126
|
+
export declare const NavbarLongLabels: Story;
|
|
127
|
+
export declare const NavbarSimulation: Story;
|
|
128
|
+
export declare const NavbarLockedStepsSimulation: Story;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { HorizontalStepper } from '../../components';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof HorizontalStepper;
|
|
6
|
+
tags: string[];
|
|
7
|
+
parameters: {
|
|
8
|
+
a11y: {
|
|
9
|
+
test: string;
|
|
10
|
+
};
|
|
11
|
+
chromatic: {
|
|
12
|
+
disableSnapshot: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
args: {
|
|
16
|
+
variant: "default";
|
|
17
|
+
steps: {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}[];
|
|
21
|
+
activeStep: number;
|
|
22
|
+
onStepClick: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
export declare const DefaultVariantMatchesOmittedVariant: Story;
|
|
28
|
+
export declare const InvalidVariantFallsBackToDefault: Story;
|
|
29
|
+
export declare const NavbarStructure: Story;
|
|
30
|
+
export declare const NavbarClickCallsOnStepClick: Story;
|
|
31
|
+
export declare const NavbarKeyboardActivates: Story;
|
|
32
|
+
export declare const NavbarCurrentStepNotClickable: Story;
|
|
33
|
+
export declare const NavbarDisabledStepsBlockClicks: Story;
|
|
34
|
+
export declare const NavbarCurrentStepIgnoresDisabled: Story;
|
|
35
|
+
export declare const NavbarStaticNoButtons: Story;
|
|
36
|
+
export declare const NavbarIgnoresSizeAndShowLabels: Story;
|
|
37
|
+
export declare const NavbarSimulationClickMovesActiveStep: Story;
|
|
38
|
+
export declare const NavbarLockedStepsSimulationFlow: Story;
|
|
39
|
+
export declare const NavbarEmpty: Story;
|
|
40
|
+
export declare const NavbarOutOfRange: Story;
|
|
41
|
+
export declare const NavbarManySteps: Story;
|
|
42
|
+
export declare const NavbarClassName: Story;
|
|
43
|
+
export declare const StandardIgnoresDisabled: Story;
|
|
44
|
+
export declare const NavbarColorAppliesToCircles: Story;
|
|
45
|
+
export declare const NavbarDefaultColorIsWhite: Story;
|
|
46
|
+
export declare const NavbarColorDisabledIgnoresColor: Story;
|
|
47
|
+
export declare const NavbarInvalidColor: Story;
|
|
48
|
+
export declare const NavbarIcons: Story;
|
|
49
|
+
export declare const NavbarCurrentShowsNumberWithoutIcon: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -9235,7 +9235,7 @@ function cn() {
|
|
|
9235
9235
|
}
|
|
9236
9236
|
return twMerge(clsx(inputs));
|
|
9237
9237
|
}
|
|
9238
|
-
function
|
|
9238
|
+
function StandardHorizontalStepper(_a) {
|
|
9239
9239
|
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;
|
|
9240
9240
|
var isSmall = size === 'sm';
|
|
9241
9241
|
var connectorColor = "bg-bia-".concat(color);
|
|
@@ -9285,6 +9285,154 @@ function HorizontalStepper(_a) {
|
|
|
9285
9285
|
})));
|
|
9286
9286
|
}
|
|
9287
9287
|
|
|
9288
|
+
var navbarItemConfig = {
|
|
9289
|
+
current: 'cursor-default',
|
|
9290
|
+
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',
|
|
9291
|
+
static: 'cursor-default',
|
|
9292
|
+
disabled: 'cursor-default',
|
|
9293
|
+
};
|
|
9294
|
+
var navbarCircleConfig = {
|
|
9295
|
+
currentDefault: 'bg-bia-white border-bia-white text-bia-black',
|
|
9296
|
+
other: 'border-bia-white text-bia-white',
|
|
9297
|
+
disabled: 'border-bia-white-transparent-40 text-bia-white-transparent-40',
|
|
9298
|
+
};
|
|
9299
|
+
var navbarCurrentColorConfig = {
|
|
9300
|
+
blue: 'bg-bia-blue border-bia-blue text-bia-white',
|
|
9301
|
+
green: 'bg-bia-green border-bia-green text-bia-white',
|
|
9302
|
+
teal: 'bg-bia-teal border-bia-teal text-bia-white',
|
|
9303
|
+
crayola: 'bg-bia-crayola border-bia-crayola text-bia-white',
|
|
9304
|
+
orange: 'bg-bia-orange border-bia-orange text-bia-white',
|
|
9305
|
+
red: 'bg-bia-red border-bia-red text-bia-white',
|
|
9306
|
+
};
|
|
9307
|
+
var navbarProcessedColorConfig = {
|
|
9308
|
+
blue: 'border-bia-blue text-bia-white',
|
|
9309
|
+
green: 'border-bia-green text-bia-white',
|
|
9310
|
+
teal: 'border-bia-teal text-bia-white',
|
|
9311
|
+
crayola: 'border-bia-crayola text-bia-white',
|
|
9312
|
+
orange: 'border-bia-orange text-bia-white',
|
|
9313
|
+
red: 'border-bia-red text-bia-white',
|
|
9314
|
+
};
|
|
9315
|
+
var navbarProcessedFilledColorConfig = {
|
|
9316
|
+
blue: 'bg-bia-blue border-bia-blue text-bia-white',
|
|
9317
|
+
green: 'bg-bia-green border-bia-green text-bia-white',
|
|
9318
|
+
teal: 'bg-bia-teal border-bia-teal text-bia-white',
|
|
9319
|
+
crayola: 'bg-bia-crayola border-bia-crayola text-bia-white',
|
|
9320
|
+
orange: 'bg-bia-orange border-bia-orange text-bia-white',
|
|
9321
|
+
red: 'bg-bia-red border-bia-red text-bia-white',
|
|
9322
|
+
};
|
|
9323
|
+
var navbarLabelConfig = {
|
|
9324
|
+
enabled: 'whitespace-nowrap leading-4 text-bia-white',
|
|
9325
|
+
disabled: 'whitespace-nowrap leading-4 text-bia-white-transparent-40',
|
|
9326
|
+
};
|
|
9327
|
+
var navbarChevronConfig = {
|
|
9328
|
+
enabled: 'shrink-0 text-bia-white',
|
|
9329
|
+
disabled: 'shrink-0 text-bia-white-transparent-40',
|
|
9330
|
+
};
|
|
9331
|
+
|
|
9332
|
+
var NAVBAR_COLORS = [
|
|
9333
|
+
'blue',
|
|
9334
|
+
'green',
|
|
9335
|
+
'teal',
|
|
9336
|
+
'crayola',
|
|
9337
|
+
'orange',
|
|
9338
|
+
'red',
|
|
9339
|
+
];
|
|
9340
|
+
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 : ''; };
|
|
9341
|
+
function resolveItemState(isCurrent, isDisabled, isClickable) {
|
|
9342
|
+
if (isCurrent)
|
|
9343
|
+
return 'current';
|
|
9344
|
+
if (isDisabled)
|
|
9345
|
+
return 'disabled';
|
|
9346
|
+
if (isClickable)
|
|
9347
|
+
return 'clickable';
|
|
9348
|
+
return 'static';
|
|
9349
|
+
}
|
|
9350
|
+
function resolveCircleClass(isCurrent, isDisabled, isProcessed, navColor, processedIcon) {
|
|
9351
|
+
if (isCurrent) {
|
|
9352
|
+
if (navColor)
|
|
9353
|
+
return navbarCurrentColorConfig[navColor];
|
|
9354
|
+
return navbarCircleConfig.currentDefault;
|
|
9355
|
+
}
|
|
9356
|
+
if (isDisabled)
|
|
9357
|
+
return navbarCircleConfig.disabled;
|
|
9358
|
+
if (isProcessed && navColor) {
|
|
9359
|
+
if (processedIcon)
|
|
9360
|
+
return navbarProcessedFilledColorConfig[navColor];
|
|
9361
|
+
return navbarProcessedColorConfig[navColor];
|
|
9362
|
+
}
|
|
9363
|
+
return navbarCircleConfig.other;
|
|
9364
|
+
}
|
|
9365
|
+
function resolveCircleContent(step, index, isProcessed, isCurrent, processedIcon, currentIcon, circleClass) {
|
|
9366
|
+
if (step.icon)
|
|
9367
|
+
return step.icon;
|
|
9368
|
+
if (isProcessed && processedIcon)
|
|
9369
|
+
return processedIcon;
|
|
9370
|
+
if (isCurrent && currentIcon)
|
|
9371
|
+
return currentIcon;
|
|
9372
|
+
return (React.createElement(Text, { variant: "tiny-text", className: "leading-none ".concat(circleTextColor(circleClass)) }, index + 1));
|
|
9373
|
+
}
|
|
9374
|
+
function NavbarHorizontalStepper(_a) {
|
|
9375
|
+
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;
|
|
9376
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9377
|
+
_a.size;
|
|
9378
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9379
|
+
_a.showLabels;
|
|
9380
|
+
// size and showLabels are accepted for API parity, ignored on navbar
|
|
9381
|
+
var navColor = color === undefined
|
|
9382
|
+
? undefined
|
|
9383
|
+
: validUnion(color, NAVBAR_COLORS);
|
|
9384
|
+
return (React.createElement("nav", { "aria-label": "Progress", className: cn$1('flex', className) },
|
|
9385
|
+
React.createElement("ol", { className: "flex items-center" }, steps.map(function (step, index) {
|
|
9386
|
+
var _a;
|
|
9387
|
+
var isCurrent = index === activeStep;
|
|
9388
|
+
var isProcessed = index < activeStep;
|
|
9389
|
+
var isDisabled = !isCurrent && Boolean(step.disabled);
|
|
9390
|
+
var isClickable = !isCurrent && !isDisabled && Boolean(onStepClick);
|
|
9391
|
+
var itemState = resolveItemState(isCurrent, isDisabled, isClickable);
|
|
9392
|
+
var itemClass = cn$1('flex h-6 items-center gap-[5px] px-[5px] py-[3px]', !isCurrent && 'rounded-radius-sm', navbarItemConfig[itemState]);
|
|
9393
|
+
var circleClass = resolveCircleClass(isCurrent, isDisabled, isProcessed, navColor, processedIcon);
|
|
9394
|
+
var labelClass = isDisabled
|
|
9395
|
+
? navbarLabelConfig.disabled
|
|
9396
|
+
: navbarLabelConfig.enabled;
|
|
9397
|
+
var isChevronDisabled = !isCurrent && Boolean(step.disabled);
|
|
9398
|
+
var circleContent = resolveCircleContent(step, index, isProcessed, isCurrent, processedIcon, currentIcon, circleClass);
|
|
9399
|
+
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));
|
|
9400
|
+
var label = step.label ? (React.createElement(Text, { variant: "tiny-text", className: labelClass }, step.label)) : null;
|
|
9401
|
+
var content = (React.createElement(React.Fragment, null,
|
|
9402
|
+
circle,
|
|
9403
|
+
label));
|
|
9404
|
+
var stepElement;
|
|
9405
|
+
if (isCurrent) {
|
|
9406
|
+
stepElement = (React.createElement("span", { "aria-current": "step", className: itemClass }, content));
|
|
9407
|
+
}
|
|
9408
|
+
else if (isClickable) {
|
|
9409
|
+
stepElement = (React.createElement("button", { type: "button", onClick: function () { return onStepClick === null || onStepClick === void 0 ? void 0 : onStepClick(index); }, className: itemClass }, content));
|
|
9410
|
+
}
|
|
9411
|
+
else if (isDisabled && onStepClick) {
|
|
9412
|
+
stepElement = (React.createElement("button", { type: "button", disabled: true, className: itemClass }, content));
|
|
9413
|
+
}
|
|
9414
|
+
else {
|
|
9415
|
+
stepElement = React.createElement("span", { className: itemClass }, content);
|
|
9416
|
+
}
|
|
9417
|
+
return (React.createElement("li", { key: (_a = step.id) !== null && _a !== void 0 ? _a : index, className: "flex items-center" },
|
|
9418
|
+
index > 0 && (React.createElement(TbChevronRight, { size: 14, "aria-hidden": "true", className: isChevronDisabled
|
|
9419
|
+
? navbarChevronConfig.disabled
|
|
9420
|
+
: navbarChevronConfig.enabled })),
|
|
9421
|
+
stepElement));
|
|
9422
|
+
}))));
|
|
9423
|
+
}
|
|
9424
|
+
|
|
9425
|
+
var VARIANT_UNION = ['default', 'navbar'];
|
|
9426
|
+
function HorizontalStepper(props) {
|
|
9427
|
+
var variant = props.variant, rest = __rest(props, ["variant"]);
|
|
9428
|
+
switch (validUnion(variant, VARIANT_UNION)) {
|
|
9429
|
+
case 'navbar':
|
|
9430
|
+
return (React.createElement(NavbarHorizontalStepper, __assign({}, rest)));
|
|
9431
|
+
default:
|
|
9432
|
+
return (React.createElement(StandardHorizontalStepper, __assign({}, rest)));
|
|
9433
|
+
}
|
|
9434
|
+
}
|
|
9435
|
+
|
|
9288
9436
|
var variantConfig = {
|
|
9289
9437
|
upcoming: 'bg-white border-2 border-coolgrey-light-50',
|
|
9290
9438
|
processed: 'bg-white border-2 border-bia-blue',
|