@antscorp/antsomi-ui 1.7.8 → 1.7.9

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.
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  import React, { useEffect, useMemo, useState, memo } from 'react';
14
14
  import { isNumber } from 'lodash';
15
15
  // Styled
16
- import { SelectedIcon, StepsWrapper } from './styled';
16
+ import { ErrorIcon, SelectedIcon, StepsWrapper } from './styled';
17
17
  export const Steps = memo(props => {
18
18
  const { items, saveHighestStep = true, className } = props, restOfProps = __rest(props, ["items", "saveHighestStep", "className"]);
19
19
  const { current, size = 'small' } = restOfProps;
@@ -33,8 +33,8 @@ export const Steps = memo(props => {
33
33
  }
34
34
  else {
35
35
  if (index === current) {
36
- status = 'process';
37
- icon = undefined;
36
+ status = props.status || 'process';
37
+ icon = status === 'error' ? React.createElement(ErrorIcon, null, index + 1) : undefined;
38
38
  }
39
39
  else {
40
40
  status = 'finish';
@@ -42,9 +42,24 @@ export const Steps = memo(props => {
42
42
  className = `antsomi-steps-item-selectable${index === highestStep ? ' highest-step' : ''}`;
43
43
  }
44
44
  }
45
+ // High Priority status from item
46
+ if (item.status) {
47
+ status = item.status;
48
+ switch (status) {
49
+ case 'error':
50
+ icon = React.createElement(ErrorIcon, null, index + 1);
51
+ break;
52
+ default:
53
+ break;
54
+ }
55
+ }
56
+ // Check next step is error then add custom class
57
+ if (items[index + 1] && items[index + 1].status === 'error') {
58
+ className += ' antsomi-steps-next-error';
59
+ }
45
60
  return Object.assign({ status, icon, className }, item);
46
61
  })
47
- : items, [current, saveHighestStep, highestStep, items]);
62
+ : items, [saveHighestStep, items, highestStep, props.status, current]);
48
63
  /** Check whether the user has reactivated the previous step or not */
49
64
  const isReactivate = saveHighestStep && isNumber(current) && current < highestStep;
50
65
  return (React.createElement(StepsWrapper, Object.assign({ items: customItems }, restOfProps, { size: size, isReactivate: isReactivate, highestStep: highestStep, className: `${className || ''}${saveHighestStep ? ' save-highest-step' : ''}` })));
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare const SelectedIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const ErrorIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").FlexProps<import("antd/es/_util/type").AnyObject> & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
3
4
  export declare const StepsWrapper: import("styled-components").StyledComponent<import("react").FC<import("antd").StepsProps> & {
4
5
  Step: typeof import("rc-steps").Step;
5
6
  }, any, {
@@ -1,8 +1,10 @@
1
1
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
2
2
  import styled from 'styled-components';
3
3
  import { Steps } from 'antd';
4
+ import { Flex } from '../Flex';
4
5
  // Constants
5
- import { THEME } from '@antscorp/antsomi-ui/es/constants';
6
+ import { globalToken, THEME } from '@antscorp/antsomi-ui/es/constants';
7
+ const { red6, bw0, colorError } = globalToken || {};
6
8
  const STEP_SIZE = {
7
9
  SMALL: 24,
8
10
  DEFAULT: 32,
@@ -20,6 +22,16 @@ export const SelectedIcon = styled.div `
20
22
  justify-content: center;
21
23
  align-items: center;
22
24
  `;
25
+ export const ErrorIcon = styled(Flex) `
26
+ align-items: center;
27
+ justify-content: center;
28
+ flex-shrink: 0;
29
+ background-color: ${colorError};
30
+ width: 100%;
31
+ height: 100%;
32
+ border-radius: 100%;
33
+ font-size: 14px;
34
+ `;
23
35
  export const StepsWrapper = styled(Steps) `
24
36
  &.save-highest-step {
25
37
  // * Steps Default
@@ -100,7 +112,7 @@ export const StepsWrapper = styled(Steps) `
100
112
  }
101
113
  }
102
114
 
103
- &.antsomi-steps-item-process.antsomi-steps-item-active {
115
+ &.antsomi-steps-item-active {
104
116
  & > .antsomi-steps-item-container {
105
117
  & > .antsomi-steps-item-content > .antsomi-steps-item-title {
106
118
  &::after {
@@ -115,6 +127,26 @@ export const StepsWrapper = styled(Steps) `
115
127
  }
116
128
  }
117
129
  }
130
+
131
+ &.antsomi-steps-next-error {
132
+ > .antsomi-steps-item-container
133
+ > .antsomi-steps-item-content
134
+ > .antsomi-steps-item-title::after {
135
+ background-color: ${red6} !important;
136
+ }
137
+ }
138
+
139
+ &.antsomi-steps-item-error {
140
+ > .antsomi-steps-item-container {
141
+ > .antsomi-steps-item-icon .antsomi-steps-icon {
142
+ color: ${bw0} !important;
143
+ }
144
+
145
+ > .antsomi-steps-item-content .antsomi-steps-item-title {
146
+ color: ${colorError} !important;
147
+ }
148
+ }
149
+ }
118
150
  }
119
151
  }
120
152
 
@@ -183,7 +215,9 @@ export const StepsWrapper = styled(Steps) `
183
215
  background-color: ${(_m = THEME.token) === null || _m === void 0 ? void 0 : _m.bw6};
184
216
  }
185
217
 
186
- & > .antsomi-steps-item-container > .antsomi-steps-item-content {
218
+ &:not(.antsomi-steps-item-error)
219
+ > .antsomi-steps-item-container
220
+ > .antsomi-steps-item-content {
187
221
  .antsomi-steps-item-title,
188
222
  .antsomi-steps-item-description {
189
223
  color: inherit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",