@dfds-ui/react-components 0.9.9-alpha.d6e8572b → 0.9.11-alpha.6c614078

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.
@@ -1,97 +1,45 @@
1
- var _excluded = ["children", "initialStep"];
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
4
 
5
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
-
9
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
-
11
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
-
13
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
-
15
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
-
17
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
-
19
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20
-
21
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
22
-
23
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
-
25
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
26
-
27
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
28
-
29
- import React, { useState, useContext, createContext, useCallback, memo } from 'react';
30
- import { Stepper } from '@material-ui/core';
7
+ import React, { createContext, memo } from 'react';
8
+ import { stepperWrapperStyles } from './Stepper.styles';
31
9
  import { jsx as ___EmotionJSX } from "@emotion/react";
32
- var StepperContext = /*#__PURE__*/createContext(undefined);
33
- export var useStepperContext = function useStepperContext() {
34
- var context = useContext(StepperContext);
35
-
36
- if (context === undefined) {
37
- throw new Error('useStepperContext must be used within a StepperProvider');
38
- }
39
-
40
- return context;
41
- };
10
+ export var StepperContext = /*#__PURE__*/createContext({
11
+ activeStep: 0,
12
+ orientation: 'horizontal',
13
+ nonSequential: false
14
+ });
42
15
 
43
16
  var StepperProvider = function StepperProvider(_ref) {
44
17
  var children = _ref.children,
45
- initialStep = _ref.initialStep,
46
- props = _objectWithoutProperties(_ref, _excluded);
47
-
48
- var _useState = useState([]),
49
- _useState2 = _slicedToArray(_useState, 2),
50
- steps = _useState2[0],
51
- setSteps = _useState2[1];
52
-
53
- var _useState3 = useState(initialStep || 0),
54
- _useState4 = _slicedToArray(_useState3, 2),
55
- activeIndex = _useState4[0],
56
- setActiveIndex = _useState4[1];
57
-
58
- var activeStep = steps[activeIndex];
59
- var setStep = useCallback(function (newStep) {
60
- return setSteps(function (prevSteps) {
61
- return [].concat(_toConsumableArray(prevSteps), [newStep]);
62
- });
63
- }, []);
64
- var setNext = useCallback(function () {
65
- return setActiveIndex(function (prevIndex) {
66
- return prevIndex + 1;
67
- });
68
- }, []);
69
- var setBack = useCallback(function () {
70
- return setActiveIndex(function (prevIndex) {
71
- return prevIndex - 1;
72
- });
73
- }, []);
74
- var setReset = useCallback(function () {
75
- return setActiveIndex(0);
76
- }, []);
77
- return ___EmotionJSX(StepperContext.Provider, {
78
- value: {
79
- setStep: setStep,
18
+ _ref$activeStep = _ref.activeStep,
19
+ activeStep = _ref$activeStep === void 0 ? 0 : _ref$activeStep,
20
+ _ref$nonSequential = _ref.nonSequential,
21
+ nonSequential = _ref$nonSequential === void 0 ? false : _ref$nonSequential,
22
+ _ref$orientation = _ref.orientation,
23
+ orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation;
24
+ var childrenArray = React.Children.toArray(children).filter(Boolean);
25
+ var stepArray = childrenArray.map(function (child, index) {
26
+ return /*#__PURE__*/React.cloneElement(child, _objectSpread({
27
+ index: index,
28
+ last: index + 1 === childrenArray.length
29
+ }, child.props));
30
+ });
31
+ var contextValue = React.useMemo(function () {
32
+ return {
80
33
  activeStep: activeStep,
81
- setNext: setNext,
82
- setBack: setBack,
83
- setReset: setReset,
84
- setActiveIndex: setActiveIndex
85
- }
86
- }, ___EmotionJSX(Stepper, _extends({
87
- style: {
88
- padding: 0
89
- }
90
- }, props, {
91
- connector: ___EmotionJSX(React.Fragment, null),
92
- orientation: "vertical",
93
- activeStep: activeIndex
94
- }), children));
34
+ nonSequential: nonSequential,
35
+ orientation: orientation
36
+ };
37
+ }, [activeStep, nonSequential, orientation]);
38
+ return ___EmotionJSX(StepperContext.Provider, {
39
+ value: contextValue
40
+ }, ___EmotionJSX("div", {
41
+ css: stepperWrapperStyles
42
+ }, stepArray));
95
43
  };
96
44
 
97
45
  export default /*#__PURE__*/memo(StepperProvider);
@@ -0,0 +1,3 @@
1
+ export declare const stepperWrapperStyles: import("@emotion/react").SerializedStyles;
2
+ export declare const stepWrapperStyles: import("@emotion/react").SerializedStyles;
3
+ export declare const stepButtonStyles: ({ active, completed }: any) => import("@emotion/react").SerializedStyles;
@@ -0,0 +1,27 @@
1
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2
+
3
+ import { theme } from '@dfds-ui/theme';
4
+ import { css } from '@emotion/react';
5
+ export var stepperWrapperStyles = process.env.NODE_ENV === "production" ? {
6
+ name: "zjik7",
7
+ styles: "display:flex"
8
+ } : {
9
+ name: "1efy7gc-stepperWrapperStyles",
10
+ styles: "display:flex;label:stepperWrapperStyles;",
11
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdGVwcGVyL1N0ZXBwZXIuc3R5bGVzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHdUMiLCJmaWxlIjoiLi4vLi4vc3JjL3N0ZXBwZXIvU3RlcHBlci5zdHlsZXMudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdGhlbWUgfSBmcm9tICdAZGZkcy11aS90aGVtZSdcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuXG5leHBvcnQgY29uc3Qgc3RlcHBlcldyYXBwZXJTdHlsZXMgPSBjc3NgXG4gIGRpc3BsYXk6IGZsZXg7XG5gXG5cbmV4cG9ydCBjb25zdCBzdGVwV3JhcHBlclN0eWxlcyA9IGNzc2BcbiAgZGlzcGxheTogZmxleDtcbiAgZ2FwOiAwLjVyZW07XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XG4gICY6bm90KDpsYXN0LWNoaWxkKSB7XG4gICAgZmxleDogMTtcbiAgICAmOmFmdGVyIHtcbiAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XG4gICAgICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7XG4gICAgICBjb250ZW50OiAnJztcbiAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICAgIHotaW5kZXg6IC0xO1xuICAgICAgaGVpZ2h0OiAycHg7XG4gICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjYTZiNWJkO1xuICAgICAgZmxleDogMTtcbiAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgbWFyZ2luLXJpZ2h0OiAwLjVyZW07XG4gICAgfVxuICB9XG5gXG5cbmV4cG9ydCBjb25zdCBzdGVwQnV0dG9uU3R5bGVzID0gKHsgYWN0aXZlLCBjb21wbGV0ZWQgfTogYW55KSA9PiBjc3NgXG4gIGJvcmRlcjogbm9uZTtcbiAgbWFyZ2luOiAwO1xuICBwYWRkaW5nOiAwO1xuICBjdXJzb3I6IHBvaW50ZXI7XG4gIGJvcmRlci1yYWRpdXM6IDUwJTtcbiAgYmFja2dyb3VuZC1jb2xvcjogJHthY3RpdmUgfHwgY29tcGxldGVkID8gdGhlbWUuY29sb3JzLnNlY29uZGFyeS5tYWluIDogJyNhNmI1YmQnfTtcbiAgZm9udC13ZWlnaHQ6ICR7YWN0aXZlIHx8IGNvbXBsZXRlZCA/ICdib2xkJyA6ICcnfTtcbiAgbWluLXdpZHRoOiAxLjVlbTtcbiAgbWluLWhlaWdodDogMS41ZW07XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICBhbGlnbi1pdGVtczogY2VudGVyO1xuICBjb2xvcjogI2ZmZjtcbiAgOmhvdmVyIHtcbiAgICBjb2xvcjogI2ZmZjtcbiAgfVxuYFxuIl19 */",
12
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
13
+ };
14
+ export var stepWrapperStyles = process.env.NODE_ENV === "production" ? {
15
+ name: "qws31f",
16
+ styles: "display:flex;gap:0.5rem;align-items:center;box-sizing:border-box;&:not(:last-child){flex:1;&:after{box-sizing:border-box;display:inline-block;content:'';position:relative;z-index:-1;height:2px;background-color:#a6b5bd;flex:1;width:100%;margin-right:0.5rem;}}"
17
+ } : {
18
+ name: "8b6k6d-stepWrapperStyles",
19
+ styles: "display:flex;gap:0.5rem;align-items:center;box-sizing:border-box;&:not(:last-child){flex:1;&:after{box-sizing:border-box;display:inline-block;content:'';position:relative;z-index:-1;height:2px;background-color:#a6b5bd;flex:1;width:100%;margin-right:0.5rem;}};label:stepWrapperStyles;",
20
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdGVwcGVyL1N0ZXBwZXIuc3R5bGVzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPb0MiLCJmaWxlIjoiLi4vLi4vc3JjL3N0ZXBwZXIvU3RlcHBlci5zdHlsZXMudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgdGhlbWUgfSBmcm9tICdAZGZkcy11aS90aGVtZSdcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuXG5leHBvcnQgY29uc3Qgc3RlcHBlcldyYXBwZXJTdHlsZXMgPSBjc3NgXG4gIGRpc3BsYXk6IGZsZXg7XG5gXG5cbmV4cG9ydCBjb25zdCBzdGVwV3JhcHBlclN0eWxlcyA9IGNzc2BcbiAgZGlzcGxheTogZmxleDtcbiAgZ2FwOiAwLjVyZW07XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XG4gICY6bm90KDpsYXN0LWNoaWxkKSB7XG4gICAgZmxleDogMTtcbiAgICAmOmFmdGVyIHtcbiAgICAgIGJveC1zaXppbmc6IGJvcmRlci1ib3g7XG4gICAgICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7XG4gICAgICBjb250ZW50OiAnJztcbiAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICAgIHotaW5kZXg6IC0xO1xuICAgICAgaGVpZ2h0OiAycHg7XG4gICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjYTZiNWJkO1xuICAgICAgZmxleDogMTtcbiAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgbWFyZ2luLXJpZ2h0OiAwLjVyZW07XG4gICAgfVxuICB9XG5gXG5cbmV4cG9ydCBjb25zdCBzdGVwQnV0dG9uU3R5bGVzID0gKHsgYWN0aXZlLCBjb21wbGV0ZWQgfTogYW55KSA9PiBjc3NgXG4gIGJvcmRlcjogbm9uZTtcbiAgbWFyZ2luOiAwO1xuICBwYWRkaW5nOiAwO1xuICBjdXJzb3I6IHBvaW50ZXI7XG4gIGJvcmRlci1yYWRpdXM6IDUwJTtcbiAgYmFja2dyb3VuZC1jb2xvcjogJHthY3RpdmUgfHwgY29tcGxldGVkID8gdGhlbWUuY29sb3JzLnNlY29uZGFyeS5tYWluIDogJyNhNmI1YmQnfTtcbiAgZm9udC13ZWlnaHQ6ICR7YWN0aXZlIHx8IGNvbXBsZXRlZCA/ICdib2xkJyA6ICcnfTtcbiAgbWluLXdpZHRoOiAxLjVlbTtcbiAgbWluLWhlaWdodDogMS41ZW07XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICBhbGlnbi1pdGVtczogY2VudGVyO1xuICBjb2xvcjogI2ZmZjtcbiAgOmhvdmVyIHtcbiAgICBjb2xvcjogI2ZmZjtcbiAgfVxuYFxuIl19 */",
21
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
+ };
23
+ export var stepButtonStyles = function stepButtonStyles(_ref) {
24
+ var active = _ref.active,
25
+ completed = _ref.completed;
26
+ return /*#__PURE__*/css("border:none;margin:0;padding:0;cursor:pointer;border-radius:50%;background-color:", active || completed ? theme.colors.secondary.main : '#a6b5bd', ";font-weight:", active || completed ? 'bold' : '', ";min-width:1.5em;min-height:1.5em;display:flex;justify-content:center;align-items:center;color:#fff;:hover{color:#fff;}" + (process.env.NODE_ENV === "production" ? "" : ";label:stepButtonStyles;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdGVwcGVyL1N0ZXBwZXIu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2ludGVyO1xuICBib3JkZXItcmFkaXVzOiA1MCU7XG4gIGJhY2tncm91bmQtY29sb3I6ICR7YWN0aXZlIHx8IGNvbXBsZXRlZCA/IHRoZW1lLmNvbG9ycy5zZWNvbmRhcnkubWFpbiA6ICcjYTZiNWJkJ307XG4gIGZvbnQtd2VpZ2h0OiAke2FjdGl2ZSB8fCBjb21wbGV0ZWQgPyAnYm9sZCcgOiAnJ307XG4gIG1pbi13aWR0aDogMS41ZW07XG4gIG1pbi1oZWlnaHQ6IDEuNWVtO1xuICBkaXNwbGF5OiBmbGV4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgY29sb3I6ICNmZmY7XG4gIDpob3ZlciB7XG4gICAgY29sb3I6ICNmZmY7XG4gIH1cbmBcbiJdfQ== */");
27
+ };
@@ -1,2 +1,2 @@
1
1
  export { default as Step } from './Step';
2
- export { default as Stepper, useStepperContext } from './Stepper';
2
+ export { default as Stepper } from './Stepper';
package/stepper/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export { default as Step } from './Step';
2
- export { default as Stepper, useStepperContext } from './Stepper';
2
+ export { default as Stepper } from './Stepper';