@hipay/hipay-material-ui 3.7.10 → 3.7.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -67,6 +67,8 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
67
67
  var steps = _ref.steps,
68
68
  _ref$stepLabelVisibil = _ref.stepLabelVisibilityToggle,
69
69
  stepLabelVisibilityToggle = _ref$stepLabelVisibil === void 0 ? true : _ref$stepLabelVisibil,
70
+ _ref$stepLabelDefault = _ref.stepLabelDefaultVisible,
71
+ stepLabelDefaultVisible = _ref$stepLabelDefault === void 0 ? true : _ref$stepLabelDefault,
70
72
  onShowStepLabel = _ref.onShowStepLabel,
71
73
  onHideStepLabel = _ref.onHideStepLabel,
72
74
  _ref$customClasses = _ref.customClasses,
@@ -87,12 +89,17 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
87
89
  activeStep = _useCounter2[0],
88
90
  setActiveStep = _useCounter2[1].set;
89
91
 
90
- var _useState = (0, _react.useState)(true),
92
+ var _useState = (0, _react.useState)(stepLabelDefaultVisible),
91
93
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
92
94
  stepLabelVisible = _useState2[0],
93
95
  setStepLabelVisible = _useState2[1];
94
96
 
95
97
  var instantActiveStep = 0;
98
+ var stepsRef = (0, _react.useMemo)(function () {
99
+ return Array(steps.length).fill(0).map(function () {
100
+ return _react.default.createRef();
101
+ });
102
+ }, []);
96
103
 
97
104
  var getOffsetTop = function getOffsetTop(element) {
98
105
  var offsetTop = 0;
@@ -107,7 +114,7 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
107
114
 
108
115
  var scrollToStep = function scrollToStep(index) {
109
116
  window.scrollTo({
110
- top: getOffsetTop(steps[index].ref.current) - stepMargin,
117
+ top: getOffsetTop(stepsRef[index].current) - stepMargin,
111
118
  behavior: 'smooth'
112
119
  });
113
120
  };
@@ -124,8 +131,8 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
124
131
  var stepIndex = 0;
125
132
 
126
133
  while (stepIndex < steps.length) {
127
- var stepHeight = steps[stepIndex].ref.current.offsetHeight;
128
- var stepBottomOffset = getOffsetTop(steps[stepIndex].ref.current) + (stepHeight - stepMargin);
134
+ var stepHeight = stepsRef[stepIndex].current.offsetHeight;
135
+ var stepBottomOffset = getOffsetTop(stepsRef[stepIndex].current) + (stepHeight - stepMargin);
129
136
 
130
137
  if (stepBottomOffset > scrollOffset) {
131
138
  newActiveStep = stepIndex;
@@ -182,7 +189,7 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
182
189
  onClick: function onClick() {
183
190
  return scrollToStep(index);
184
191
  },
185
- indicator: index + 1,
192
+ indicator: step.indicator,
186
193
  label: stepLabelVisible ? step.label : null,
187
194
  status: status[index]
188
195
  });
@@ -196,7 +203,7 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
196
203
  }, steps.map(function (step, index) {
197
204
  return /*#__PURE__*/_react.default.createElement("div", {
198
205
  key: index,
199
- ref: step.ref
206
+ ref: stepsRef[index]
200
207
  }, step.content);
201
208
  })));
202
209
  };
@@ -124,7 +124,9 @@ var useStepLabelStyle = (0, _styles.makeStyles)(function (theme) {
124
124
  fontWeight: '600 !important',
125
125
  color: "inherit !important",
126
126
  fontSize: '13px',
127
- whiteSpace: 'nowrap'
127
+ whiteSpace: 'nowrap',
128
+ height: 16,
129
+ transform: 'translateY(-2px)'
128
130
  }),
129
131
  active: {},
130
132
  completed: {}
@@ -67,6 +67,8 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
67
67
  var steps = _ref.steps,
68
68
  _ref$stepLabelVisibil = _ref.stepLabelVisibilityToggle,
69
69
  stepLabelVisibilityToggle = _ref$stepLabelVisibil === void 0 ? true : _ref$stepLabelVisibil,
70
+ _ref$stepLabelDefault = _ref.stepLabelDefaultVisible,
71
+ stepLabelDefaultVisible = _ref$stepLabelDefault === void 0 ? true : _ref$stepLabelDefault,
70
72
  onShowStepLabel = _ref.onShowStepLabel,
71
73
  onHideStepLabel = _ref.onHideStepLabel,
72
74
  _ref$customClasses = _ref.customClasses,
@@ -87,12 +89,17 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
87
89
  activeStep = _useCounter2[0],
88
90
  setActiveStep = _useCounter2[1].set;
89
91
 
90
- var _useState = (0, _react.useState)(true),
92
+ var _useState = (0, _react.useState)(stepLabelDefaultVisible),
91
93
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
92
94
  stepLabelVisible = _useState2[0],
93
95
  setStepLabelVisible = _useState2[1];
94
96
 
95
97
  var instantActiveStep = 0;
98
+ var stepsRef = (0, _react.useMemo)(function () {
99
+ return Array(steps.length).fill(0).map(function () {
100
+ return _react.default.createRef();
101
+ });
102
+ }, []);
96
103
 
97
104
  var getOffsetTop = function getOffsetTop(element) {
98
105
  var offsetTop = 0;
@@ -107,7 +114,7 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
107
114
 
108
115
  var scrollToStep = function scrollToStep(index) {
109
116
  window.scrollTo({
110
- top: getOffsetTop(steps[index].ref.current) - stepMargin,
117
+ top: getOffsetTop(stepsRef[index].current) - stepMargin,
111
118
  behavior: 'smooth'
112
119
  });
113
120
  };
@@ -124,8 +131,8 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
124
131
  var stepIndex = 0;
125
132
 
126
133
  while (stepIndex < steps.length) {
127
- var stepHeight = steps[stepIndex].ref.current.offsetHeight;
128
- var stepBottomOffset = getOffsetTop(steps[stepIndex].ref.current) + (stepHeight - stepMargin);
134
+ var stepHeight = stepsRef[stepIndex].current.offsetHeight;
135
+ var stepBottomOffset = getOffsetTop(stepsRef[stepIndex].current) + (stepHeight - stepMargin);
129
136
 
130
137
  if (stepBottomOffset > scrollOffset) {
131
138
  newActiveStep = stepIndex;
@@ -182,7 +189,7 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
182
189
  onClick: function onClick() {
183
190
  return scrollToStep(index);
184
191
  },
185
- indicator: index + 1,
192
+ indicator: step.indicator,
186
193
  label: stepLabelVisible ? step.label : null,
187
194
  status: status[index]
188
195
  });
@@ -196,7 +203,7 @@ var HiScrollStepper = function HiScrollStepper(_ref) {
196
203
  }, steps.map(function (step, index) {
197
204
  return /*#__PURE__*/_react.default.createElement("div", {
198
205
  key: index,
199
- ref: step.ref
206
+ ref: stepsRef[index]
200
207
  }, step.content);
201
208
  })));
202
209
  };
@@ -124,7 +124,9 @@ var useStepLabelStyle = (0, _styles.makeStyles)(function (theme) {
124
124
  fontWeight: '600 !important',
125
125
  color: "inherit !important",
126
126
  fontSize: '13px',
127
- whiteSpace: 'nowrap'
127
+ whiteSpace: 'nowrap',
128
+ height: 16,
129
+ transform: 'translateY(-2px)'
128
130
  }),
129
131
  active: {},
130
132
  completed: {}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@hipay/hipay-material-ui",
3
- "version": "3.7.10",
3
+ "private": false,
4
+ "version": "3.7.11",
4
5
  "description": "React components that implement Google's Material Design.",
5
6
  "repository": {
6
7
  "type": "git",
@@ -66,4 +67,4 @@
66
67
  },
67
68
  "main": "./index.js",
68
69
  "module": "./esm/index.js"
69
- }
70
+ }