@am92/react-design-system 2.9.7 → 2.9.8

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.
@@ -8,9 +8,14 @@ export const DsProgressStepper = inProps => {
8
8
  const props = { ...DsProgressStepperDefaultProps, ...inProps };
9
9
  const renderStepIcon = (stepProps) => {
10
10
  const { active, error, completed, icon } = stepProps;
11
- if (error) {
11
+ const isWarning = typeof icon === 'string' && icon === 'warning';
12
+ const isError = error || (typeof icon === 'string' && icon === 'error');
13
+ if (isError) {
12
14
  return (_jsx(DsRemixIcon, { className: 'ri-close-circle-fill', sx: { color: 'var(--ds-colour-iconNegative)' } }));
13
15
  }
16
+ if (isWarning) {
17
+ return (_jsx(DsRemixIcon, { className: 'ri-error-warning-fill', sx: { color: 'var(--ds-colour-supportWarning)' } }));
18
+ }
14
19
  if (completed) {
15
20
  return (_jsx(DsRemixIcon, { className: 'ri-checkbox-circle-fill', sx: { color: 'var(--ds-colour-iconPositive)' } }));
16
21
  }
@@ -5,7 +5,7 @@ import { DsRemixIcon } from '../../DsRemixIcon';
5
5
  import { DsStack } from '../../DsStack';
6
6
  import { DsTypography } from '../../DsTypography';
7
7
  export const DsProgressTrackerHeader = (props) => {
8
- const { activeStep, steps, nextStepLabelPrefix, dense, onClick, StepperProps, ...wrapperProps } = props;
8
+ const { activeStep, steps, nextStepLabelPrefix, dense, onClick, StepperProps, stepLabelVisible, lastStepLabelText, ...wrapperProps } = props;
9
9
  const currentStep = steps[activeStep] || {};
10
10
  const nextStepIndex = activeStep + 1;
11
11
  const nextStep = steps[nextStepIndex];
@@ -14,13 +14,13 @@ export const DsProgressTrackerHeader = (props) => {
14
14
  const fillPercentage = Math.round((nextStepIndex / steps.length) * 100);
15
15
  const renderStepsLabel = () => {
16
16
  return (_jsx(DsTypography, { component: 'div', textAlign: 'right', color: 'var(--ds-colour-typoTertiary)', variant: 'subheadingSemiboldDefault', children: isNextStepLastStep
17
- ? 'Yay! you are almost done'
17
+ ? lastStepLabelText
18
18
  : `${nextStepLabelPrefix} ${nextStep.stepName}` }));
19
19
  };
20
20
  return (_jsx(_Fragment, { children: dense ? (_jsxs(DsStack, { sx: {
21
21
  backgroundColor: 'var(--ds-colour-surfaceSecondary)',
22
22
  ...wrapperProps?.sx
23
- }, ...wrapperProps, children: [_jsxs(DsStack, { direction: 'row', justifyContent: 'space-between', px: 'var(--ds-spacing-bitterCold)', pt: 'var(--ds-spacing-frostbite)', pb: 'calc(var(--ds-spacing-frostbite) - var(--ds-spacing-deepFreeze))', onClick: onClick, children: [_jsx(DsTypography, { variant: 'subheadingSemiboldDefault', children: `STEP ${activeStep + 1} OF ${steps.length}` }), _jsxs(DsStack, { direction: 'row', spacing: 'var(--ds-spacing-frostbite)', children: [haveNextStep && renderStepsLabel(), props['ds-variant'] !== 'header' && (_jsx(DsRemixIcon, { fontSize: 'bitterCold', className: 'ri-arrow-right-s-line' }))] })] }), _jsx(DsLinearProgress, { color: 'secondary', value: fillPercentage, variant: 'determinate', sx: {
23
+ }, ...wrapperProps, children: [_jsxs(DsStack, { direction: 'row', justifyContent: 'space-between', px: 'var(--ds-spacing-bitterCold)', pt: 'var(--ds-spacing-frostbite)', pb: 'calc(var(--ds-spacing-frostbite) - var(--ds-spacing-deepFreeze))', onClick: onClick, children: [_jsx(DsTypography, { variant: 'subheadingSemiboldDefault', children: `STEP ${activeStep + 1} OF ${steps.length}` }), _jsxs(DsStack, { direction: 'row', spacing: 'var(--ds-spacing-frostbite)', children: [haveNextStep && stepLabelVisible && renderStepsLabel(), props['ds-variant'] !== 'header' && (_jsx(DsRemixIcon, { fontSize: 'bitterCold', className: 'ri-arrow-right-s-line' }))] })] }), _jsx(DsLinearProgress, { color: 'secondary', value: fillPercentage, variant: 'determinate', sx: {
24
24
  backgroundColor: 'transparent',
25
25
  height: '2px',
26
26
  '.MuiLinearProgress-bar1Determinate ': {
@@ -33,5 +33,5 @@ export const DsProgressTrackerHeader = (props) => {
33
33
  backgroundColor: 'var(--ds-colour-surfaceBackground)',
34
34
  cursor: props['ds-variant'] === 'default' ? 'pointer' : 'unset',
35
35
  ...wrapperProps?.sx
36
- }, spacing: 'var(--ds-spacing-bitterCold)', direction: 'row', onClick: onClick, ...wrapperProps, children: [_jsx(DsProgressIndicator, { activeStep: activeStep + 1, steps: steps.length }), _jsxs(DsStack, { flexGrow: 1, spacing: 'var(--ds-spacing-quickFreeze)', children: [_jsx(DsTypography, { component: 'div', textAlign: 'right', color: 'var(--ds-colour-actionSecondary)', variant: 'headingBoldExtraSmall', children: currentStep.stepName }), haveNextStep && renderStepsLabel()] })] })) }));
36
+ }, spacing: 'var(--ds-spacing-bitterCold)', direction: 'row', onClick: onClick, ...wrapperProps, children: [_jsx(DsProgressIndicator, { activeStep: activeStep + 1, steps: steps.length }), _jsxs(DsStack, { flexGrow: 1, spacing: 'var(--ds-spacing-quickFreeze)', children: [_jsx(DsTypography, { component: 'div', textAlign: 'right', color: 'var(--ds-colour-actionSecondary)', variant: 'headingBoldExtraSmall', children: currentStep.stepName }), haveNextStep && stepLabelVisible && renderStepsLabel()] })] })) }));
37
37
  };
@@ -4,7 +4,12 @@ import { DsStepperProps } from '../DsStepper';
4
4
  export interface DsProgressStepperStepProps {
5
5
  stepName?: string;
6
6
  error?: DsStepLabelProps['error'];
7
- icon?: DsStepLabelProps['icon'];
7
+ /**
8
+ * Icon to display for the step. Can be a standard icon or special values:
9
+ * - 'warning': Shows a warning icon with warning color
10
+ * - 'error': Shows an error icon
11
+ */
12
+ icon?: Exclude<DsStepLabelProps['icon'], string> | 'warning' | 'error';
8
13
  optional?: DsStepLabelProps['optional'];
9
14
  completed?: DsStepProps['completed'];
10
15
  disabled?: DsStepProps['disabled'];
@@ -28,6 +28,14 @@ export interface DsProgressTrackerProps extends DsStackProps {
28
28
  * This prop can be used to provide a custom prefix string to the step label.
29
29
  */
30
30
  nextStepLabelPrefix?: React.ReactNode;
31
+ /**
32
+ * This prop can be used to hide/show the label on progress tacker header.
33
+ */
34
+ stepLabelVisible?: boolean;
35
+ /**
36
+ * This prop can be used to show custom label text for last step.
37
+ */
38
+ lastStepLabelText?: string;
31
39
  }
32
40
  export declare const DsProgressTrackerDefaultProps: DsProgressTrackerProps;
33
41
  export interface DsProgressTrackerState {
@@ -4,8 +4,9 @@ export const DsProgressTrackerDefaultProps = {
4
4
  dense: false,
5
5
  steps: [],
6
6
  StepperProps: { orientation: 'vertical' },
7
- sx: {},
8
- nextStepLabelPrefix: 'Next Step : '
7
+ nextStepLabelPrefix: 'Next Step : ',
8
+ stepLabelVisible: true,
9
+ lastStepLabelText: 'Yay! you are almost done'
9
10
  };
10
11
  export const DsProgressTrackerDefaultState = {
11
12
  open: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@am92/react-design-system",
3
- "version": "2.9.7",
3
+ "version": "2.9.8",
4
4
  "description": "ReactJS Design System using Material UI",
5
5
  "sideEffects": false,
6
6
  "types": "dist/index.d.ts",