@elliemae/ds-stepper 2.2.0-next.6 → 2.2.1

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/cjs/Stepper.js CHANGED
@@ -38,12 +38,11 @@ const DSStepper = props$1 => {
38
38
  visited
39
39
  } = propsWithDefaults;
40
40
  const stepsArray = React__default["default"].useMemo(() => new Array(steps).fill(1), [steps]);
41
- const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(propsWithDefaults);
42
- return /*#__PURE__*/jsxRuntime.jsx(styled.StepperWrapper, _objectSpread(_objectSpread({
41
+ return /*#__PURE__*/jsxRuntime.jsx(styled.StepperWrapper, _objectSpread(_objectSpread(_objectSpread({
43
42
  steps: steps,
44
43
  current: current,
45
44
  visited: visited
46
- }, globalAttributes), {}, {
45
+ }, dsPropsHelpers.getAriaProps(props$1)), dsPropsHelpers.getDataProps(props$1)), {}, {
47
46
  children: stepsArray.map((item, index) => /*#__PURE__*/_jsx__default["default"](styled.Step // eslint-disable-next-line react/no-array-index-key
48
47
  , {
49
48
  active: current === index,
@@ -40,14 +40,14 @@ const DSStepperButton = props$1 => {
40
40
  onClick,
41
41
  innerRef
42
42
  } = propsWithDefaults;
43
- const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(propsWithDefaults);
44
- return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledButton, _objectSpread(_objectSpread({
43
+ return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledButton, _objectSpread(_objectSpread(_objectSpread({
45
44
  disabled: disabled,
46
45
  onClick: onClick,
47
46
  innerRef: innerRef,
48
47
  buttonType: dsButton.BUTTON_TYPES.TEXT,
49
48
  fontSize: fontSize
50
- }, globalAttributes), {}, {
49
+ }, dsPropsHelpers.getAriaProps(props$1)), dsPropsHelpers.getDataProps(props$1)), {}, {
50
+ "data-testid": "ds-stepper-btn",
51
51
  children: [chevron === 'left' ? _ChevronLeft || (_ChevronLeft = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronLeft, {})) : null, /*#__PURE__*/_jsx__default["default"](styled.Label, {
52
52
  value: label
53
53
  }), chevron === 'right' ? _ChevronRight || (_ChevronRight = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronRight, {})) : null]
package/cjs/props.js CHANGED
@@ -2,23 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('core-js/modules/esnext.async-iterator.filter.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.filter.js');
8
- require('core-js/modules/esnext.async-iterator.for-each.js');
9
- require('core-js/modules/esnext.iterator.for-each.js');
10
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
11
5
  var lodash = require('lodash');
12
6
  var reactDesc = require('react-desc');
13
- var dsPropsHelpers = require('@elliemae/ds-props-helpers');
14
7
 
15
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
-
17
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
18
-
19
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
-
21
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22
8
  const BUTTON_SIZES = {
23
9
  normal: 'normal',
24
10
  large: 'large'
@@ -28,26 +14,27 @@ const defaultProps = {
28
14
  current: undefined,
29
15
  visited: []
30
16
  };
31
- const dsStepperProps = _objectSpread({
17
+ const dsStepperProps = {
32
18
  steps: reactDesc.PropTypes.number.description('Number of steps').isRequired,
33
19
  current: reactDesc.PropTypes.number.description('Index of active step'),
34
20
  visited: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.number).description('Array of visited steps').isRequired
35
- }, dsPropsHelpers.globalAttributesPropTypes);
21
+ };
36
22
  const defaultButtonProps = {
37
23
  chevron: undefined,
38
24
  fontSize: BUTTON_SIZES.normal,
39
25
  disabled: false,
40
26
  onClick: lodash.noop
41
27
  };
42
- const dsStepperButtonProps = _objectSpread(_objectSpread({
28
+ const dsStepperButtonProps = {
43
29
  chevron: reactDesc.PropTypes.oneOf(['left', 'right', null]).description('Chevron icon position, if null/undefined no chevron will be shown').defaultValue(null),
44
30
  fontSize: reactDesc.PropTypes.oneOf(['normal', 'large']).description('Label size, used for marking last step').defaultValue('normal'),
45
- innerRef: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.object, reactDesc.PropTypes.func]).description('Inner ref to button component.')
46
- }, dsPropsHelpers.globalAttributesPropTypes), {}, {
31
+ label: reactDesc.PropTypes.string.description('Text Label, this only accepts text, no custom JSX').isRequired,
47
32
  disabled: reactDesc.PropTypes.bool.description('Adds disabled state.'),
48
33
  onClick: reactDesc.PropTypes.func.description('OnClick callback handler.').defaultValue('()=>{}'),
49
- label: reactDesc.PropTypes.string.description('Text Label, this only accepts text, no custom JSX').isRequired
50
- });
34
+ innerRef: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.object, reactDesc.PropTypes.func]).description('Inner ref to button component.'),
35
+ 'aria-': reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.bool]).description('accept all the aria-* props, MUST receive aria-label'),
36
+ 'data-': reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.bool]).description('accept all the data-* props')
37
+ };
51
38
 
52
39
  exports.defaultButtonProps = defaultButtonProps;
53
40
  exports.defaultProps = defaultProps;
package/cjs/styled.js CHANGED
@@ -12,7 +12,7 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
12
12
 
13
13
  const StepperWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
14
14
  componentId: "sc-fgtqnq-0"
15
- })(["display:grid;align-items:center;grid-template-columns repeat(", ",1fr);column-gap:", ";"], props => props.steps, props => props.steps >= 8 ? props.theme.space.xxxs : props.theme.space.xxs);
15
+ })(["display:grid;align-items:flex-end;grid-template-columns repeat(", ",1fr);column-gap:", ";"], props => props.steps, props => props.steps >= 8 ? props.theme.space.xxxs : props.theme.space.xxs);
16
16
  const Step = /*#__PURE__*/styled__default["default"].div.withConfig({
17
17
  componentId: "sc-fgtqnq-1"
18
18
  })(["display:grid;border-radius:1px;height:", ";background:", ";"], props => props.active ? '5px' : '3px', props => props.active || props.visited ? props.theme.colors.brand[700] : '#A9B1BE');
package/esm/Stepper.js CHANGED
@@ -10,7 +10,7 @@ import 'core-js/modules/esnext.iterator.for-each.js';
10
10
  import React from 'react';
11
11
  import { uid } from 'uid';
12
12
  import { describe } from 'react-desc';
13
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
13
+ import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, getAriaProps, getDataProps } from '@elliemae/ds-props-helpers';
14
14
  import { dsStepperProps, defaultProps } from './props.js';
15
15
  import { StepperWrapper, Step } from './styled.js';
16
16
  import { jsx } from 'react/jsx-runtime';
@@ -28,12 +28,11 @@ const DSStepper = props => {
28
28
  visited
29
29
  } = propsWithDefaults;
30
30
  const stepsArray = React.useMemo(() => new Array(steps).fill(1), [steps]);
31
- const globalAttributes = useGetGlobalAttributes(propsWithDefaults);
32
- return /*#__PURE__*/jsx(StepperWrapper, _objectSpread(_objectSpread({
31
+ return /*#__PURE__*/jsx(StepperWrapper, _objectSpread(_objectSpread(_objectSpread({
33
32
  steps: steps,
34
33
  current: current,
35
34
  visited: visited
36
- }, globalAttributes), {}, {
35
+ }, getAriaProps(props)), getDataProps(props)), {}, {
37
36
  children: stepsArray.map((item, index) => /*#__PURE__*/_jsx(Step // eslint-disable-next-line react/no-array-index-key
38
37
  , {
39
38
  active: current === index,
@@ -7,7 +7,7 @@ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
7
  import _jsx from '@babel/runtime/helpers/esm/jsx';
8
8
  import 'react';
9
9
  import { describe } from 'react-desc';
10
- import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
10
+ import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes, getAriaProps, getDataProps } from '@elliemae/ds-props-helpers';
11
11
  import { BUTTON_TYPES } from '@elliemae/ds-button';
12
12
  import { ChevronLeft, ChevronRight } from '@elliemae/ds-icons';
13
13
  import { dsStepperButtonProps, defaultButtonProps } from './props.js';
@@ -31,14 +31,14 @@ const DSStepperButton = props => {
31
31
  onClick,
32
32
  innerRef
33
33
  } = propsWithDefaults;
34
- const globalAttributes = useGetGlobalAttributes(propsWithDefaults);
35
- return /*#__PURE__*/jsxs(StyledButton, _objectSpread(_objectSpread({
34
+ return /*#__PURE__*/jsxs(StyledButton, _objectSpread(_objectSpread(_objectSpread({
36
35
  disabled: disabled,
37
36
  onClick: onClick,
38
37
  innerRef: innerRef,
39
38
  buttonType: BUTTON_TYPES.TEXT,
40
39
  fontSize: fontSize
41
- }, globalAttributes), {}, {
40
+ }, getAriaProps(props)), getDataProps(props)), {}, {
41
+ "data-testid": "ds-stepper-btn",
42
42
  children: [chevron === 'left' ? _ChevronLeft || (_ChevronLeft = /*#__PURE__*/_jsx(ChevronLeft, {})) : null, /*#__PURE__*/_jsx(Label, {
43
43
  value: label
44
44
  }), chevron === 'right' ? _ChevronRight || (_ChevronRight = /*#__PURE__*/_jsx(ChevronRight, {})) : null]
package/esm/props.js CHANGED
@@ -1,16 +1,6 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
1
  import { noop } from 'lodash';
8
2
  import { PropTypes } from 'react-desc';
9
- import { globalAttributesPropTypes } from '@elliemae/ds-props-helpers';
10
3
 
11
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
-
13
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
4
  const BUTTON_SIZES = {
15
5
  normal: 'normal',
16
6
  large: 'large'
@@ -20,25 +10,26 @@ const defaultProps = {
20
10
  current: undefined,
21
11
  visited: []
22
12
  };
23
- const dsStepperProps = _objectSpread({
13
+ const dsStepperProps = {
24
14
  steps: PropTypes.number.description('Number of steps').isRequired,
25
15
  current: PropTypes.number.description('Index of active step'),
26
16
  visited: PropTypes.arrayOf(PropTypes.number).description('Array of visited steps').isRequired
27
- }, globalAttributesPropTypes);
17
+ };
28
18
  const defaultButtonProps = {
29
19
  chevron: undefined,
30
20
  fontSize: BUTTON_SIZES.normal,
31
21
  disabled: false,
32
22
  onClick: noop
33
23
  };
34
- const dsStepperButtonProps = _objectSpread(_objectSpread({
24
+ const dsStepperButtonProps = {
35
25
  chevron: PropTypes.oneOf(['left', 'right', null]).description('Chevron icon position, if null/undefined no chevron will be shown').defaultValue(null),
36
26
  fontSize: PropTypes.oneOf(['normal', 'large']).description('Label size, used for marking last step').defaultValue('normal'),
37
- innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.')
38
- }, globalAttributesPropTypes), {}, {
27
+ label: PropTypes.string.description('Text Label, this only accepts text, no custom JSX').isRequired,
39
28
  disabled: PropTypes.bool.description('Adds disabled state.'),
40
29
  onClick: PropTypes.func.description('OnClick callback handler.').defaultValue('()=>{}'),
41
- label: PropTypes.string.description('Text Label, this only accepts text, no custom JSX').isRequired
42
- });
30
+ innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),
31
+ 'aria-': PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).description('accept all the aria-* props, MUST receive aria-label'),
32
+ 'data-': PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).description('accept all the data-* props')
33
+ };
43
34
 
44
35
  export { defaultButtonProps, defaultProps, dsStepperButtonProps, dsStepperProps };
package/esm/styled.js CHANGED
@@ -4,7 +4,7 @@ import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text'
4
4
 
5
5
  const StepperWrapper = /*#__PURE__*/styled.div.withConfig({
6
6
  componentId: "sc-fgtqnq-0"
7
- })(["display:grid;align-items:center;grid-template-columns repeat(", ",1fr);column-gap:", ";"], props => props.steps, props => props.steps >= 8 ? props.theme.space.xxxs : props.theme.space.xxs);
7
+ })(["display:grid;align-items:flex-end;grid-template-columns repeat(", ",1fr);column-gap:", ";"], props => props.steps, props => props.steps >= 8 ? props.theme.space.xxxs : props.theme.space.xxs);
8
8
  const Step = /*#__PURE__*/styled.div.withConfig({
9
9
  componentId: "sc-fgtqnq-1"
10
10
  })(["display:grid;border-radius:1px;height:", ";background:", ";"], props => props.active ? '5px' : '3px', props => props.active || props.visited ? props.theme.colors.brand[700] : '#A9B1BE');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-stepper",
3
- "version": "2.2.0-next.6",
3
+ "version": "2.2.1",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Stepper",
6
6
  "module": "./esm/index.js",
@@ -48,10 +48,10 @@
48
48
  "build": "node ../../scripts/build/build.js"
49
49
  },
50
50
  "dependencies": {
51
- "@elliemae/ds-button": "2.2.0-next.6",
52
- "@elliemae/ds-icons": "2.2.0-next.6",
53
- "@elliemae/ds-props-helpers": "2.2.0-next.6",
54
- "@elliemae/ds-truncated-tooltip-text": "2.2.0-next.6",
51
+ "@elliemae/ds-button": "2.2.1",
52
+ "@elliemae/ds-icons": "2.2.1",
53
+ "@elliemae/ds-props-helpers": "2.2.1",
54
+ "@elliemae/ds-truncated-tooltip-text": "2.2.1",
55
55
  "react-desc": "~4.1.3",
56
56
  "uid": "~2.0.0"
57
57
  },