@snack-uikit/stepper 0.5.3 → 0.5.5-preview-993a9cfb.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 0.5.4 (2024-02-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-0000:** optional props ([efa7f9c](https://github.com/cloud-ru-tech/snack-uikit/commit/efa7f9cb22ffc26a27ee1eb8ccbdf4b0facea628))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.5.3 (2024-02-05)
7
18
 
8
19
  ### Only dependencies have been changed
package/README.md CHANGED
@@ -48,12 +48,12 @@ return (
48
48
  ### Props
49
49
  | name | type | default value | description |
50
50
  |------|------|---------------|-------------|
51
- | onCompleteChange* | `(isCompleted: boolean) => void` | - | Колбек изменения завершенности |
52
- | onChangeCurrentStep* | `(newValue: number, prevValue: number) => void` | - | Колбек смены текущего степа |
53
51
  | children* | `({stepper, ...api}) => ReactElement` | - | Render function. Принимает аргументы: `stepper` - JSX-элемент степпера, `goNext` - перейти на след. шаг, `goPrev` - перейти на пред. шаг, `resetValidation` - сбросить состояние валидации для текущего шага, `isCompleted` - окончен ли процесс, `currentStepIndex` - индекс текущего шага, `stepCount` - кол-во шагов. |
54
52
  | steps* | `StepData[]` | - | Массив шагов |
55
53
  | defaultCurrentStepIndex | `number` | - | Индекс текущего шага по-дефолту |
56
54
  | className | `string` | - | CSS-класс |
55
+ | onChangeCurrentStep | `(newValue: number, prevValue: number) => void` | - | Колбек смены текущего степа |
56
+ | onCompleteChange | `(isCompleted: boolean) => void` | - | Колбек изменения завершенности |
57
57
 
58
58
 
59
59
  [//]: DOCUMENTATION_SECTION_END
@@ -18,8 +18,8 @@ export type StepperProps = WithSupportProps<{
18
18
  */
19
19
  children: (params: StepperState) => ReactElement;
20
20
  /** Колбек смены текущего степа */
21
- onChangeCurrentStep: (newValue: number, prevValue: number) => void;
21
+ onChangeCurrentStep?: (newValue: number, prevValue: number) => void;
22
22
  /** Колбек изменения завершенности */
23
- onCompleteChange: (isCompleted: boolean) => void;
23
+ onCompleteChange?: (isCompleted: boolean) => void;
24
24
  }>;
25
25
  export declare function Stepper({ children, steps, className, onChangeCurrentStep, onCompleteChange, defaultCurrentStepIndex, ...props }: StepperProps): import("react/jsx-runtime").JSX.Element;
@@ -96,7 +96,7 @@ export function Stepper(_a) {
96
96
  setCurrentStepState(STEP_STATE.Current);
97
97
  }
98
98
  }, [currentStepState]);
99
- const stepper = (_jsx("div", Object.assign({ className: cn(styles.stepper, className) }, extractSupportProps(props), { children: stepsView.map((step, index) => (_jsx(Step, { step: step, "data-test-id": props['data-test-id'] }, step.title + index))) })));
99
+ const stepper = (_jsx("div", Object.assign({ className: cn(styles.stepper, className) }, extractSupportProps(props), { children: stepsView.map((step, index) => (_jsx(Step, { step: step, "data-test-id": props['data-test-id'], hideTailLine: index === steps.length - 1 }, step.title + index))) })));
100
100
  const stepperApi = { goNext, goPrev, currentStepIndex, isCompleted, resetValidation, stepCount: steps.length };
101
101
  return _jsx(StepperContext.Provider, { value: stepperApi, children: children(Object.assign({ stepper }, stepperApi)) });
102
102
  }
@@ -1,4 +1,5 @@
1
1
  .stepper{
2
2
  display:flex;
3
3
  flex-direction:row;
4
+ align-items:start;
4
5
  }
@@ -9,8 +9,8 @@
9
9
  justify-content:center;
10
10
  }
11
11
  .icon svg{
12
- width:var(--dimension-3m, 24px) !important;
13
- height:var(--dimension-3m, 24px) !important;
12
+ width:var(--size-icon-container-s, 24px) !important;
13
+ height:var(--size-icon-container-s, 24px) !important;
14
14
  }
15
15
  .icon[data-state=completed]{
16
16
  color:var(--sys-primary-accent-default, #794ed3);
@@ -22,17 +22,17 @@
22
22
  }
23
23
  .icon[data-state=waiting]{
24
24
  box-sizing:border-box;
25
- color:var(--sys-neutral-text-support, #565656);
26
- border-color:var(--sys-neutral-decor-default, #dedede);
25
+ color:var(--sys-neutral-text-support, #656771);
26
+ border-color:var(--sys-neutral-decor-default, #dfe2ec);
27
27
  border-style:solid;
28
28
  }
29
29
  .icon[data-state=loading]{
30
30
  box-sizing:border-box;
31
- color:var(--sys-neutral-accent-default, #757575);
32
- border-color:var(--sys-neutral-decor-default, #dedede);
31
+ color:var(--sys-neutral-accent-default, #6f717c);
32
+ border-color:var(--sys-neutral-decor-default, #dfe2ec);
33
33
  border-style:solid;
34
34
  }
35
35
  .icon[data-state=rejected]{
36
- color:var(--sys-red-on-accent, #fffbfa);
37
- background-color:var(--sys-red-accent-default, #d93f2f);
36
+ color:var(--sys-red-on-accent, #fffbf9);
37
+ background-color:var(--sys-red-accent-default, #cd3c3c);
38
38
  }
@@ -1,7 +1,8 @@
1
1
  import { WithSupportProps } from '@snack-uikit/utils';
2
2
  import { StepViewData } from '../../types';
3
3
  export type StepProps = WithSupportProps<{
4
+ hideTailLine?: boolean;
4
5
  step: StepViewData;
5
6
  className?: string;
6
7
  }>;
7
- export declare function Step({ step, className, 'data-test-id': testId, ...props }: StepProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function Step({ step, className, 'data-test-id': testId, hideTailLine, ...props }: StepProps): import("react/jsx-runtime").JSX.Element;
@@ -21,6 +21,6 @@ import styles from './styles.module.css';
21
21
  const getTailTestId = getTestIdBuilder('_element-tail');
22
22
  const getStepTestId = getTestIdBuilder('_element-step');
23
23
  export function Step(_a) {
24
- var { step, className, 'data-test-id': testId } = _a, props = __rest(_a, ["step", "className", 'data-test-id']);
25
- return (_jsxs("div", Object.assign({ className: cn(styles.step, className), "data-state": step.state }, extractSupportProps(props), { children: [_jsxs("div", { className: styles.track, children: [_jsx("button", { className: styles.statusContainer, onClick: step.onClick, disabled: !step.onClick, "data-test-id": getStepTestId(testId), "data-state": step.state, children: _jsx(Icon, Object.assign({}, step, { className: styles.icon })) }), _jsx("div", { className: styles.tail, "data-completed": step.state === STEP_STATE.Completed || undefined, "data-test-id": getTailTestId(testId), children: _jsx("div", { className: styles.tailLine }) })] }), _jsxs("div", { className: styles.content, children: [_jsx(Typography.SansBodyM, { className: styles.title, tag: 'div', children: _jsx(TruncateString, { text: step.title }) }), step.description && (_jsx(Typography.SansBodyS, { className: styles.description, tag: 'div', children: _jsx(TruncateString, { text: step.description, maxLines: 2 }) }))] })] })));
24
+ var { step, className, 'data-test-id': testId, hideTailLine } = _a, props = __rest(_a, ["step", "className", 'data-test-id', "hideTailLine"]);
25
+ return (_jsxs("div", Object.assign({ className: cn(styles.step, className), "data-state": step.state }, extractSupportProps(props), { children: [_jsxs("div", { className: styles.track, children: [_jsx("button", { className: styles.statusContainer, onClick: step.onClick, disabled: !step.onClick, "data-test-id": getStepTestId(testId), "data-state": step.state, children: _jsx(Icon, Object.assign({}, step, { className: styles.icon })) }), !hideTailLine && (_jsx("div", { className: styles.tail, "data-completed": step.state === STEP_STATE.Completed || undefined, "data-test-id": getTailTestId(testId), children: _jsx("div", { className: styles.tailLine }) }))] }), _jsxs("div", { className: styles.content, children: [_jsx(Typography.SansBodyM, { className: styles.title, tag: 'div', children: _jsx(TruncateString, { text: step.title }) }), step.description && (_jsx(Typography.SansBodyS, { className: styles.description, tag: 'div', children: _jsx(TruncateString, { text: step.description, maxLines: 2 }) }))] })] })));
26
26
  }
@@ -2,7 +2,7 @@
2
2
  height:var(--size-stepper-step-track-line, 2px);
3
3
  border-radius:var(--radius-stepper-step-track-line, 2px);
4
4
  flex-grow:1;
5
- background-color:var(--sys-neutral-decor-default, #dedede);
5
+ background-color:var(--sys-neutral-decor-default, #dfe2ec);
6
6
  }
7
7
 
8
8
  .tail{
@@ -18,12 +18,12 @@
18
18
 
19
19
  .title{
20
20
  overflow:hidden;
21
- color:var(--sys-neutral-text-main, #333333);
21
+ color:var(--sys-neutral-text-main, #33333b);
22
22
  }
23
23
 
24
24
  .description{
25
25
  overflow:hidden;
26
- color:var(--sys-neutral-text-light, #898989);
26
+ color:var(--sys-neutral-text-light, #868892);
27
27
  }
28
28
 
29
29
  .step{
@@ -54,7 +54,7 @@
54
54
  align-items:center;
55
55
  margin:0;
56
56
  padding:0;
57
- color:var(--sys-neutral-text-main, #333333);
57
+ color:var(--sys-neutral-text-main, #33333b);
58
58
  background-color:transparent;
59
59
  border:none;
60
60
  }
@@ -62,22 +62,22 @@
62
62
  outline-width:var(--border-state-focus-s-border-width, 2px);
63
63
  outline-style:var(--border-state-focus-s-border-style, solid);
64
64
  outline-color:var(--border-state-focus-s-border-color, );
65
- outline-color:var(--sys-available-complementary, #131313);
65
+ outline-color:var(--sys-available-complementary, #141415);
66
66
  outline-offset:var(--spacing-state-focus-offset, 2px);
67
67
  }
68
68
  .statusContainer:not([disabled]){
69
69
  cursor:pointer;
70
70
  }
71
71
  .statusContainer:not([disabled]):focus-visible, .statusContainer:not([disabled]):hover{
72
- color:var(--sys-neutral-text-light, #898989);
73
- }
74
-
75
- .icon{
76
- flex-shrink:0;
72
+ color:var(--sys-neutral-text-light, #868892);
77
73
  }
78
74
 
79
75
  .content{
80
76
  display:flex;
81
77
  flex-direction:column;
82
78
  width:100%;
79
+ }
80
+
81
+ .icon{
82
+ flex-shrink:0;
83
83
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Stepper",
7
- "version": "0.5.3",
7
+ "version": "0.5.5-preview-993a9cfb.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -33,11 +33,11 @@
33
33
  "scripts": {},
34
34
  "dependencies": {
35
35
  "@snack-uikit/icons": "0.20.1",
36
- "@snack-uikit/loaders": "0.5.0",
37
- "@snack-uikit/truncate-string": "0.4.7",
36
+ "@snack-uikit/loaders": "0.5.1-preview-993a9cfb.0",
37
+ "@snack-uikit/truncate-string": "0.4.8-preview-993a9cfb.0",
38
38
  "@snack-uikit/typography": "0.6.1",
39
39
  "@snack-uikit/utils": "3.2.0",
40
40
  "classnames": "2.3.2"
41
41
  },
42
- "gitHead": "b1acc8128bdab6f23b534d7c464208069e59ed8c"
42
+ "gitHead": "a421965dc78af63a8c292e595b3f0a8ff1be86f9"
43
43
  }
@@ -27,9 +27,9 @@ export type StepperProps = WithSupportProps<{
27
27
  */
28
28
  children: (params: StepperState) => ReactElement;
29
29
  /** Колбек смены текущего степа */
30
- onChangeCurrentStep: (newValue: number, prevValue: number) => void;
30
+ onChangeCurrentStep?: (newValue: number, prevValue: number) => void;
31
31
  /** Колбек изменения завершенности */
32
- onCompleteChange: (isCompleted: boolean) => void;
32
+ onCompleteChange?: (isCompleted: boolean) => void;
33
33
  }>;
34
34
 
35
35
  export function Stepper({
@@ -149,7 +149,12 @@ export function Stepper({
149
149
  const stepper = (
150
150
  <div className={cn(styles.stepper, className)} {...extractSupportProps(props)}>
151
151
  {stepsView.map((step, index) => (
152
- <Step key={step.title + index} step={step} data-test-id={props['data-test-id']} />
152
+ <Step
153
+ key={step.title + index}
154
+ step={step}
155
+ data-test-id={props['data-test-id']}
156
+ hideTailLine={index === steps.length - 1}
157
+ />
153
158
  ))}
154
159
  </div>
155
160
  );
@@ -1,4 +1,5 @@
1
1
  .stepper {
2
2
  display: flex;
3
3
  flex-direction: row;
4
+ align-items: start;
4
5
  }
@@ -11,6 +11,7 @@ import { Icon } from '../Icon';
11
11
  import styles from './styles.module.scss';
12
12
 
13
13
  export type StepProps = WithSupportProps<{
14
+ hideTailLine?: boolean;
14
15
  step: StepViewData;
15
16
  className?: string;
16
17
  }>;
@@ -18,7 +19,7 @@ export type StepProps = WithSupportProps<{
18
19
  const getTailTestId = getTestIdBuilder('_element-tail');
19
20
  const getStepTestId = getTestIdBuilder('_element-step');
20
21
 
21
- export function Step({ step, className, 'data-test-id': testId, ...props }: StepProps) {
22
+ export function Step({ step, className, 'data-test-id': testId, hideTailLine, ...props }: StepProps) {
22
23
  return (
23
24
  <div className={cn(styles.step, className)} data-state={step.state} {...extractSupportProps(props)}>
24
25
  <div className={styles.track}>
@@ -32,13 +33,15 @@ export function Step({ step, className, 'data-test-id': testId, ...props }: Step
32
33
  <Icon {...step} className={styles.icon} />
33
34
  </button>
34
35
 
35
- <div
36
- className={styles.tail}
37
- data-completed={step.state === STEP_STATE.Completed || undefined}
38
- data-test-id={getTailTestId(testId)}
39
- >
40
- <div className={styles.tailLine} />
41
- </div>
36
+ {!hideTailLine && (
37
+ <div
38
+ className={styles.tail}
39
+ data-completed={step.state === STEP_STATE.Completed || undefined}
40
+ data-test-id={getTailTestId(testId)}
41
+ >
42
+ <div className={styles.tailLine} />
43
+ </div>
44
+ )}
42
45
  </div>
43
46
 
44
47
  <div className={styles.content}>
@@ -81,12 +81,13 @@
81
81
  }
82
82
  }
83
83
 
84
- .icon {
85
- flex-shrink: 0;
86
- }
87
-
88
84
  .content {
89
85
  display: flex;
90
86
  flex-direction: column;
91
87
  width: 100%;
92
88
  }
89
+
90
+ .icon {
91
+ flex-shrink: 0;
92
+ }
93
+