carbon-react 134.2.0 → 135.1.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.
Files changed (89) hide show
  1. package/esm/components/badge/badge.component.js +3 -2
  2. package/esm/components/multi-action-button/multi-action-button.component.d.ts +1 -1
  3. package/esm/components/multi-action-button/multi-action-button.component.js +2 -1
  4. package/esm/components/multi-action-button/multi-action-button.config.d.ts +1 -0
  5. package/esm/components/multi-action-button/multi-action-button.config.js +2 -1
  6. package/esm/components/portal/portal.js +1 -0
  7. package/esm/components/split-button/split-button.component.d.ts +5 -3
  8. package/esm/components/split-button/split-button.component.js +2 -1
  9. package/esm/components/split-button/split-button.config.d.ts +1 -0
  10. package/esm/components/split-button/split-button.config.js +2 -1
  11. package/esm/components/toast/toast.component.d.ts +0 -2
  12. package/esm/components/toast/toast.component.js +7 -15
  13. package/esm/components/toast/toast.style.d.ts +0 -3
  14. package/esm/components/toast/toast.style.js +4 -21
  15. package/lib/components/badge/badge.component.js +3 -2
  16. package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
  17. package/lib/components/multi-action-button/multi-action-button.component.js +2 -1
  18. package/lib/components/multi-action-button/multi-action-button.config.d.ts +1 -0
  19. package/lib/components/multi-action-button/multi-action-button.config.js +3 -2
  20. package/lib/components/portal/portal.js +1 -0
  21. package/lib/components/split-button/split-button.component.d.ts +5 -3
  22. package/lib/components/split-button/split-button.component.js +2 -1
  23. package/lib/components/split-button/split-button.config.d.ts +1 -0
  24. package/lib/components/split-button/split-button.config.js +3 -2
  25. package/lib/components/toast/toast.component.d.ts +0 -2
  26. package/lib/components/toast/toast.component.js +7 -15
  27. package/lib/components/toast/toast.style.d.ts +0 -3
  28. package/lib/components/toast/toast.style.js +4 -21
  29. package/package.json +1 -1
  30. package/esm/components/carousel/carousel.component.d.ts +0 -25
  31. package/esm/components/carousel/carousel.component.js +0 -125
  32. package/esm/components/carousel/carousel.style.d.ts +0 -20
  33. package/esm/components/carousel/carousel.style.js +0 -154
  34. package/esm/components/carousel/index.d.ts +0 -4
  35. package/esm/components/carousel/index.js +0 -2
  36. package/esm/components/carousel/slide/index.d.ts +0 -2
  37. package/esm/components/carousel/slide/index.js +0 -1
  38. package/esm/components/carousel/slide/slide.component.d.ts +0 -12
  39. package/esm/components/carousel/slide/slide.component.js +0 -9
  40. package/esm/components/carousel/slide/slide.style.d.ts +0 -2
  41. package/esm/components/carousel/slide/slide.style.js +0 -32
  42. package/esm/components/carousel/slide.config.d.ts +0 -3
  43. package/esm/components/carousel/slide.config.js +0 -80
  44. package/esm/components/step-sequence/index.d.ts +0 -4
  45. package/esm/components/step-sequence/index.js +0 -2
  46. package/esm/components/step-sequence/step-sequence-item/index.d.ts +0 -2
  47. package/esm/components/step-sequence/step-sequence-item/index.js +0 -1
  48. package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.d.ts +0 -19
  49. package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.js +0 -43
  50. package/esm/components/step-sequence/step-sequence-item/step-sequence-item.style.d.ts +0 -6
  51. package/esm/components/step-sequence/step-sequence-item/step-sequence-item.style.js +0 -96
  52. package/esm/components/step-sequence/step-sequence.component.d.ts +0 -13
  53. package/esm/components/step-sequence/step-sequence.component.js +0 -29
  54. package/esm/components/step-sequence/step-sequence.config.d.ts +0 -2
  55. package/esm/components/step-sequence/step-sequence.config.js +0 -2
  56. package/esm/components/step-sequence/step-sequence.style.d.ts +0 -4
  57. package/esm/components/step-sequence/step-sequence.style.js +0 -21
  58. package/lib/components/carousel/carousel.component.d.ts +0 -25
  59. package/lib/components/carousel/carousel.component.js +0 -135
  60. package/lib/components/carousel/carousel.style.d.ts +0 -20
  61. package/lib/components/carousel/carousel.style.js +0 -162
  62. package/lib/components/carousel/index.d.ts +0 -4
  63. package/lib/components/carousel/index.js +0 -20
  64. package/lib/components/carousel/package.json +0 -6
  65. package/lib/components/carousel/slide/index.d.ts +0 -2
  66. package/lib/components/carousel/slide/index.js +0 -13
  67. package/lib/components/carousel/slide/package.json +0 -6
  68. package/lib/components/carousel/slide/slide.component.d.ts +0 -12
  69. package/lib/components/carousel/slide/slide.component.js +0 -16
  70. package/lib/components/carousel/slide/slide.style.d.ts +0 -2
  71. package/lib/components/carousel/slide/slide.style.js +0 -39
  72. package/lib/components/carousel/slide.config.d.ts +0 -3
  73. package/lib/components/carousel/slide.config.js +0 -85
  74. package/lib/components/step-sequence/index.d.ts +0 -4
  75. package/lib/components/step-sequence/index.js +0 -20
  76. package/lib/components/step-sequence/package.json +0 -6
  77. package/lib/components/step-sequence/step-sequence-item/index.d.ts +0 -2
  78. package/lib/components/step-sequence/step-sequence-item/index.js +0 -13
  79. package/lib/components/step-sequence/step-sequence-item/package.json +0 -6
  80. package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.d.ts +0 -19
  81. package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.js +0 -53
  82. package/lib/components/step-sequence/step-sequence-item/step-sequence-item.style.d.ts +0 -6
  83. package/lib/components/step-sequence/step-sequence-item/step-sequence-item.style.js +0 -105
  84. package/lib/components/step-sequence/step-sequence.component.d.ts +0 -13
  85. package/lib/components/step-sequence/step-sequence.component.js +0 -37
  86. package/lib/components/step-sequence/step-sequence.config.d.ts +0 -2
  87. package/lib/components/step-sequence/step-sequence.config.js +0 -8
  88. package/lib/components/step-sequence/step-sequence.style.d.ts +0 -4
  89. package/lib/components/step-sequence/step-sequence.style.js +0 -29
@@ -1,125 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
- import React, { useCallback, useEffect, useRef, useState, useMemo } from "react";
3
- import PropTypes from "prop-types";
4
- import Logger from "../../__internal__/utils/logger";
5
- import tagComponent from "../../__internal__/utils/helpers/tags/tags";
6
- import { CarouselPreviousButtonWrapperStyle, CarouselNextButtonWrapperStyle, CarouselButtonStyle, CarouselStyledIconRight, CarouselStyledIconLeft, CarouselSelectorWrapperStyle, CarouselSelectorInputWrapperStyle, CarouselSelectorInputStyle, CarouselSelectorLabelStyle, CarouselWrapperStyle, CarouselSliderWrapper } from "./carousel.style";
7
- import guid from "../../__internal__/utils/helpers/guid";
8
- let deprecateWarnTriggered = false;
9
- const NEXT = "next";
10
- const PREVIOUS = "previous";
11
- export const Carousel = ({
12
- children,
13
- className,
14
- enableSlideSelector = true,
15
- enablePreviousButton = true,
16
- enableNextButton = true,
17
- initialSlideIndex = 0,
18
- onSlideChange,
19
- slideIndex,
20
- ...props
21
- }) => {
22
- if (!deprecateWarnTriggered) {
23
- deprecateWarnTriggered = true;
24
- Logger.deprecate("The Carousel component is deprecated and will soon be removed.");
25
- }
26
- const [selectedSlideIndex, setSelectedSlideIndex] = useState(Number(slideIndex) || Number(initialSlideIndex));
27
- const transitionDirection = useRef(NEXT);
28
- const lastSlideIndexProp = useRef(slideIndex);
29
- const id = useMemo(() => guid(), []);
30
- const numOfSlides = useMemo(() => {
31
- return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child)).length;
32
- }, [children]);
33
- const handleSlideChange = useCallback(newIndex => {
34
- setSelectedSlideIndex(newIndex);
35
- if (onSlideChange) {
36
- onSlideChange(newIndex, transitionDirection.current);
37
- }
38
- }, [onSlideChange]);
39
- useEffect(() => {
40
- const newIndex = slideIndex;
41
- const isNewIndexUndefined = typeof newIndex === "undefined";
42
- const isTheSameIndex = newIndex === lastSlideIndexProp.current || newIndex === selectedSlideIndex;
43
- if (isNewIndexUndefined || isTheSameIndex) return;
44
- if (Number(newIndex) > Number(selectedSlideIndex)) {
45
- transitionDirection.current = NEXT;
46
- } else {
47
- transitionDirection.current = PREVIOUS;
48
- }
49
- lastSlideIndexProp.current = newIndex;
50
- handleSlideChange(newIndex);
51
- }, [handleSlideChange, slideIndex, selectedSlideIndex]);
52
- function onPreviousClick() {
53
- const newIndex = selectedSlideIndex - 1;
54
- transitionDirection.current = PREVIOUS;
55
- handleSlideChange(newIndex);
56
- }
57
- function onNextClick() {
58
- const newIndex = selectedSlideIndex + 1;
59
- transitionDirection.current = NEXT;
60
- handleSlideChange(newIndex);
61
- }
62
- function onSlideSelection(ev) {
63
- const newSlideSelection = Number(ev.target.value);
64
- transitionDirection.current = newSlideSelection > selectedSlideIndex ? NEXT : PREVIOUS;
65
- handleSlideChange(newSlideSelection);
66
- }
67
- function slideSelector() {
68
- if (!enableSlideSelector) return null;
69
- const buttons = [];
70
- for (let i = 0; i < numOfSlides; i++) {
71
- buttons.push( /*#__PURE__*/React.createElement(CarouselSelectorInputWrapperStyle, {
72
- key: i,
73
- "data-element": "selector-inputs"
74
- }, /*#__PURE__*/React.createElement(CarouselSelectorInputStyle, {
75
- "data-element": "selector-input",
76
- name: `carousel-slide-${id}`,
77
- id: `carousel-slide-${i}-${id}`,
78
- type: "radio",
79
- value: i,
80
- onChange: onSlideSelection,
81
- checked: selectedSlideIndex === i
82
- }), /*#__PURE__*/React.createElement(CarouselSelectorLabelStyle, {
83
- "data-element": "selector-label",
84
- htmlFor: `carousel-slide-${i}-${id}`
85
- })));
86
- }
87
- return /*#__PURE__*/React.createElement(CarouselSelectorWrapperStyle, {
88
- "data-element": "slide-selector"
89
- }, buttons);
90
- }
91
- function previousButton() {
92
- if (!enablePreviousButton) return null;
93
- const isDisabled = selectedSlideIndex === 0;
94
- return /*#__PURE__*/React.createElement(CarouselPreviousButtonWrapperStyle, null, /*#__PURE__*/React.createElement(CarouselButtonStyle, {
95
- onClick: onPreviousClick,
96
- "data-element": "previous",
97
- "aria-label": "previous",
98
- disabled: isDisabled
99
- }, /*#__PURE__*/React.createElement(CarouselStyledIconLeft, {
100
- type: "chevron_down"
101
- })));
102
- }
103
- function nextButton() {
104
- if (!enableNextButton) return null;
105
- const isDisabled = numOfSlides === selectedSlideIndex + 1;
106
- return /*#__PURE__*/React.createElement(CarouselNextButtonWrapperStyle, null, /*#__PURE__*/React.createElement(CarouselButtonStyle, {
107
- onClick: onNextClick,
108
- "data-element": "next",
109
- "aria-label": "next",
110
- type: "button",
111
- disabled: isDisabled
112
- }, /*#__PURE__*/React.createElement(CarouselStyledIconRight, {
113
- type: "chevron_down"
114
- })));
115
- }
116
- return /*#__PURE__*/React.createElement(CarouselWrapperStyle, _extends({
117
- className: className
118
- }, tagComponent("carousel", props)), /*#__PURE__*/React.createElement("div", {
119
- className: "carbon-carousel__content"
120
- }, previousButton(), /*#__PURE__*/React.createElement(CarouselSliderWrapper, {
121
- elementIndex: selectedSlideIndex
122
- }, children), nextButton()), slideSelector());
123
- };
124
- Carousel.displayName = "Carousel";
125
- export default Carousel;
@@ -1,20 +0,0 @@
1
- /// <reference types="react" />
2
- declare const CarouselNavigationStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- declare const CarouselPreviousButtonWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- declare const CarouselNextButtonWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- declare const CarouselStyledIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
6
- declare const CarouselStyledIconLeft: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
7
- declare const CarouselStyledIconRight: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
8
- declare const CarouselButtonStyle: import("styled-components").StyledComponent<"button", any, {
9
- type: "button";
10
- }, "type">;
11
- declare const CarouselSelectorInputStyle: import("styled-components").StyledComponent<"input", any, {}, never>;
12
- declare const CarouselSelectorLabelStyle: import("styled-components").StyledComponent<"label", any, {}, never>;
13
- declare const CarouselSelectorWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
14
- declare const CarouselSelectorInputWrapperStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
15
- interface CarouselSliderWrapperProps {
16
- elementIndex: number;
17
- }
18
- declare const CarouselSliderWrapper: import("styled-components").StyledComponent<"div", any, CarouselSliderWrapperProps, never>;
19
- declare const CarouselWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
20
- export { CarouselNavigationStyle, CarouselNextButtonWrapperStyle, CarouselPreviousButtonWrapperStyle, CarouselButtonStyle, CarouselStyledIcon, CarouselStyledIconLeft, CarouselStyledIconRight, CarouselSelectorWrapperStyle, CarouselSelectorInputWrapperStyle, CarouselSelectorInputStyle, CarouselSelectorLabelStyle, CarouselWrapperStyle, CarouselSliderWrapper, };
@@ -1,154 +0,0 @@
1
- import styled, { css } from "styled-components";
2
- import Icon from "../icon";
3
- import { slideAnimation, fadeAnimation } from "./slide.config";
4
- import { SlideStyle } from "./slide/slide.style";
5
- import addFocusStyling from "../../style/utils/add-focus-styling";
6
- import baseTheme from "../../style/themes/base";
7
- const CarouselNavigationStyle = styled.div`
8
- margin-top: -32.5px;
9
- position: absolute;
10
- top: 52%;
11
- z-index: 20;
12
- `;
13
- const CarouselPreviousButtonWrapperStyle = styled(CarouselNavigationStyle)`
14
- margin-left: 8px;
15
- `;
16
- const CarouselNextButtonWrapperStyle = styled(CarouselNavigationStyle)`
17
- right: 0;
18
- margin-right: 8px;
19
- `;
20
- const CarouselStyledIcon = styled(Icon)`
21
- cursor: pointer;
22
- color: var(--colorsActionMajorYang100);
23
- &::before {
24
- font-size: 16px;
25
- }
26
- `;
27
- const CarouselStyledIconLeft = styled(CarouselStyledIcon)`
28
- transform: rotate(90deg);
29
- `;
30
- const CarouselStyledIconRight = styled(CarouselStyledIcon)`
31
- transform: rotate(-90deg);
32
- `;
33
- const oldFocusStyling = `
34
- outline: solid 2px var(--colorsSemanticFocus500);
35
- `;
36
- const CarouselButtonStyle = styled.button.attrs({
37
- type: "button"
38
- })`
39
- ${({
40
- disabled
41
- }) => css`
42
- border: none;
43
- border-radius: var(--borderRadius400);
44
- width: 40px;
45
- height: 40px;
46
- border-width: var(--borderWidth200);
47
- border-color: var(--colorsActionMajorTransparent);
48
- background-color: ${disabled ? "var(--colorsActionDisabled500)" : "var(--colorsActionMajor500)"};
49
-
50
- ${disabled && css`
51
- ${CarouselStyledIcon} {
52
- color: var(--colorsActionMajorYin030);
53
- }
54
- `}
55
-
56
- &:hover {
57
- background-color: var(--colorsActionMajor600);
58
- cursor: ${disabled ? "default" : "pointer"};
59
-
60
- ${disabled && css`
61
- background-color: var(--colorsActionDisabled500);
62
- cursor: default;
63
-
64
- ${CarouselStyledIcon} {
65
- cursor: default;
66
- }
67
- `}
68
- }
69
-
70
- &:active {
71
- border: none;
72
- }
73
-
74
- &:focus {
75
- ${({
76
- theme
77
- }) => `${!theme.focusRedesignOptOut ? addFocusStyling() : /* istanbul ignore next */oldFocusStyling}`}
78
-
79
- ::-moz-focus-inner {
80
- border: 0;
81
- }
82
-
83
- ${disabled && css`
84
- outline: none;
85
- `}
86
- }
87
- `}
88
- `;
89
- CarouselButtonStyle.defaultProps = {
90
- theme: baseTheme
91
- };
92
- const CarouselSelectorInputStyle = styled.input`
93
- display: none;
94
- `;
95
- const CarouselSelectorLabelStyle = styled.label`
96
- display: inline-block;
97
- border-radius: var(--borderRadius100);
98
- width: 10px;
99
- height: 10px;
100
- background: var(--colorsActionMinor200);
101
- margin: 0px 4px;
102
-
103
- &:hover {
104
- cursor: pointer;
105
- }
106
- `;
107
- const CarouselSelectorWrapperStyle = styled.div`
108
- ${css`
109
- height: 20px;
110
- margin-top: 25px;
111
- text-align: center;
112
-
113
- ${CarouselSelectorInputStyle}:checked {
114
- + ${CarouselSelectorLabelStyle} {
115
- width: 10px;
116
- height: 10px;
117
- background: var(--colorsActionMinor400);
118
- border-color: transparent;
119
- position: relative;
120
- }
121
- }
122
- `}
123
- `;
124
- const CarouselSelectorInputWrapperStyle = styled.span`
125
- display: inline-block;
126
- line-height: 20px;
127
- vertical-align: middle;
128
- `;
129
- const CarouselSliderWrapper = styled.div`
130
- transition: 0.4s;
131
- display: flex;
132
- position: relative;
133
-
134
- ${({
135
- elementIndex
136
- }) => css`
137
- left: ${10 - 80 * elementIndex}%;
138
-
139
- ${SlideStyle}:nth-of-type(${elementIndex + 1}) {
140
- transform: scale(1);
141
- opacity: 1;
142
- }
143
- `}
144
- `;
145
- const CarouselWrapperStyle = styled.div`
146
- .carbon-carousel__content {
147
- overflow: hidden;
148
- position: relative;
149
- }
150
-
151
- ${slideAnimation};
152
- ${fadeAnimation};
153
- `;
154
- export { CarouselNavigationStyle, CarouselNextButtonWrapperStyle, CarouselPreviousButtonWrapperStyle, CarouselButtonStyle, CarouselStyledIcon, CarouselStyledIconLeft, CarouselStyledIconRight, CarouselSelectorWrapperStyle, CarouselSelectorInputWrapperStyle, CarouselSelectorInputStyle, CarouselSelectorLabelStyle, CarouselWrapperStyle, CarouselSliderWrapper };
@@ -1,4 +0,0 @@
1
- export { Carousel } from "./carousel.component";
2
- export { default as Slide } from "./slide";
3
- export type { CarouselProps } from "./carousel.component";
4
- export type { SlideProps } from "./slide";
@@ -1,2 +0,0 @@
1
- export { Carousel } from "./carousel.component";
2
- export { default as Slide } from "./slide";
@@ -1,2 +0,0 @@
1
- export { default } from "./slide.component";
2
- export type { SlideProps } from "./slide.component";
@@ -1 +0,0 @@
1
- export { default } from "./slide.component";
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- export interface SlideProps {
3
- /** Content of the Slide */
4
- children?: React.ReactNode;
5
- /** Accepts a callback function which is triggered on Slide click */
6
- onClick?: (ev: React.MouseEvent<HTMLDivElement>) => void;
7
- }
8
- export declare const Slide: {
9
- (props: SlideProps): React.JSX.Element;
10
- displayName: string;
11
- };
12
- export default Slide;
@@ -1,9 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
- /* eslint-disable react/prop-types */
3
- import React from "react";
4
- import PropTypes from "prop-types";
5
- import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
6
- import { SlideStyle } from "./slide.style";
7
- export const Slide = props => /*#__PURE__*/React.createElement(SlideStyle, _extends({}, props, tagComponent("slide", props)));
8
- Slide.displayName = "Slide";
9
- export default Slide;
@@ -1,2 +0,0 @@
1
- declare const SlideStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export { SlideStyle };
@@ -1,32 +0,0 @@
1
- import styled, { css } from "styled-components";
2
- const SlideStyle = styled.div`
3
- ${({
4
- onClick
5
- }) => css`
6
- box-sizing: border-box;
7
- display: inline-block;
8
- width: 100%;
9
- z-index: 10;
10
- border-radius: var(--borderRadius200);
11
- overflow: hidden;
12
-
13
- transition: 0.5s;
14
- min-width: 80%;
15
- transform: scale(0.9);
16
- opacity: 0.3;
17
- margin: 30px 0;
18
- box-shadow: var(--boxShadow200);
19
- background-color: var(--colorsUtilityYang100);
20
-
21
- ${onClick && css`
22
- :hover {
23
- transition: all 0.2s ease-in;
24
- transform: scale(1.02);
25
- cursor: pointer;
26
- }
27
- `}
28
- `}
29
- `;
30
-
31
- // eslint-disable-next-line import/prefer-default-export
32
- export { SlideStyle };
@@ -1,3 +0,0 @@
1
- declare const slideAnimation: import("styled-components").FlattenSimpleInterpolation;
2
- declare const fadeAnimation: import("styled-components").FlattenSimpleInterpolation;
3
- export { slideAnimation, fadeAnimation };
@@ -1,80 +0,0 @@
1
- import { css } from "styled-components";
2
- const animationStyle = "all 500ms cubic-bezier(.23,1.10,.69,1.01)";
3
- const slideAnimation = css`
4
- // NEXT
5
- .slide-next-enter {
6
- opacity: 0;
7
- left: 100%;
8
- position: absolute;
9
- }
10
-
11
- .slide-next-enter.slide-next-enter-active {
12
- opacity: 1;
13
- left: 0;
14
- transition: ${animationStyle};
15
- }
16
-
17
- .slide-next-exit {
18
- opacity: 1;
19
- left: 0;
20
- position: relative;
21
- }
22
-
23
- .slide-next-exit.slide-next-exit-active {
24
- opacity: 0;
25
- left: -100%;
26
- transition: ${animationStyle};
27
- }
28
-
29
- // PREVIOUS
30
- .slide-previous-enter {
31
- opacity: 0;
32
- left: -100%;
33
- position: absolute;
34
- }
35
-
36
- .slide-previous-enter.slide-previous-enter-active {
37
- opacity: 1;
38
- left: 0;
39
- transition: ${animationStyle};
40
- }
41
-
42
- .slide-previous-exit {
43
- opacity: 1;
44
- left: 0;
45
- position: relative;
46
- }
47
-
48
- .slide-previous-exit.slide-previous-exit-active {
49
- opacity: 0;
50
- left: 100%;
51
- transition: ${animationStyle};
52
- }
53
- `;
54
- const fadeAnimation = css`
55
- // FADE
56
- .carousel-transition-fade-enter {
57
- opacity: 0;
58
- position: absolute;
59
- }
60
-
61
- .carousel-transition-fade-enter.carousel-transition-fade-enter-active {
62
- opacity: 1;
63
- transition: ${animationStyle};
64
- }
65
-
66
- .carousel-transition-fade-exit {
67
- opacity: 1;
68
- position: relative;
69
- }
70
-
71
- .carousel-transition-fade-exit.carousel-transition-fade-exit-active {
72
- opacity: 0;
73
- transition: ${animationStyle};
74
- }
75
-
76
- .carbon-carousel__transition {
77
- height: 100%;
78
- }
79
- `;
80
- export { slideAnimation, fadeAnimation };
@@ -1,4 +0,0 @@
1
- export { default as StepSequence } from "./step-sequence.component";
2
- export type { StepSequenceProps } from "./step-sequence.component";
3
- export { default as StepSequenceItem } from "./step-sequence-item";
4
- export type { StepSequenceItemProps } from "./step-sequence-item";
@@ -1,2 +0,0 @@
1
- export { default as StepSequence } from "./step-sequence.component";
2
- export { default as StepSequenceItem } from "./step-sequence-item";
@@ -1,2 +0,0 @@
1
- export { default } from "./step-sequence-item.component";
2
- export type { StepSequenceItemProps } from "./step-sequence-item.component";
@@ -1 +0,0 @@
1
- export { default } from "./step-sequence-item.component";
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- export interface StepSequenceItemProps {
3
- /** Aria label */
4
- ariaLabel?: string;
5
- /** Hidden label to be displayed if item is complete */
6
- hiddenCompleteLabel?: string;
7
- /** Hidden label to be displayed if item is current */
8
- hiddenCurrentLabel?: string;
9
- /** Value to be displayed before text for uncomplete steps */
10
- indicator: string;
11
- /** Flag to hide the indicator for uncomplete steps */
12
- hideIndicator?: boolean;
13
- /** Status for the step */
14
- status?: "complete" | "current" | "incomplete";
15
- /** Content to be displayed */
16
- children: React.ReactNode;
17
- }
18
- export declare const StepSequenceItem: ({ hideIndicator, indicator, status, hiddenCompleteLabel, hiddenCurrentLabel, children, ariaLabel, ...rest }: StepSequenceItemProps) => React.JSX.Element;
19
- export default StepSequenceItem;
@@ -1,43 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
- import React, { useContext } from "react";
3
- import PropTypes from "prop-types";
4
- import { StyledStepSequenceItem, StyledStepSequenceItemContent, StyledStepSequenceItemIndicator, StyledStepSequenceItemHiddenLabel } from "./step-sequence-item.style";
5
- import Icon from "../../icon";
6
- import { StepSequenceContext } from "../step-sequence.component";
7
- export const StepSequenceItem = ({
8
- hideIndicator = false,
9
- indicator,
10
- status = "incomplete",
11
- hiddenCompleteLabel,
12
- hiddenCurrentLabel,
13
- children,
14
- ariaLabel,
15
- ...rest
16
- }) => {
17
- const {
18
- orientation
19
- } = useContext(StepSequenceContext);
20
- const indicatorText = () => {
21
- return !hideIndicator ? /*#__PURE__*/React.createElement(StyledStepSequenceItemIndicator, null, indicator) : null;
22
- };
23
- const icon = () => status === "complete" ? /*#__PURE__*/React.createElement(Icon, {
24
- type: "tick"
25
- }) : indicatorText();
26
- const hiddenLabel = () => {
27
- if (hiddenCompleteLabel && status === "complete") {
28
- return /*#__PURE__*/React.createElement(StyledStepSequenceItemHiddenLabel, null, hiddenCompleteLabel);
29
- }
30
- if (hiddenCurrentLabel && status === "current") {
31
- return /*#__PURE__*/React.createElement(StyledStepSequenceItemHiddenLabel, null, hiddenCurrentLabel);
32
- }
33
- return null;
34
- };
35
- return /*#__PURE__*/React.createElement(StyledStepSequenceItem, _extends({
36
- "data-component": "step-sequence-item",
37
- orientation: orientation,
38
- status: status,
39
- key: `step-seq-item-${indicator}`,
40
- "aria-label": ariaLabel
41
- }, rest), hiddenLabel(), /*#__PURE__*/React.createElement(StyledStepSequenceItemContent, null, icon(), /*#__PURE__*/React.createElement("span", null, children)));
42
- };
43
- export default StepSequenceItem;
@@ -1,6 +0,0 @@
1
- import { StepSequenceProps } from "../step-sequence.component";
2
- import { StepSequenceItemProps } from "./step-sequence-item.component";
3
- export declare const StyledStepSequenceItem: import("styled-components").StyledComponent<"li", any, Pick<StepSequenceItemProps, "status"> & Pick<StepSequenceProps, "orientation">, never>;
4
- export declare const StyledStepSequenceItemContent: import("styled-components").StyledComponent<"span", any, {}, never>;
5
- export declare const StyledStepSequenceItemHiddenLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
6
- export declare const StyledStepSequenceItemIndicator: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -1,96 +0,0 @@
1
- import styled, { css } from "styled-components";
2
- import StyledIcon from "../../icon/icon.style";
3
- export const StyledStepSequenceItem = styled.li`
4
- display: flex;
5
- align-items: center;
6
- flex-grow: 1;
7
- text-align: right;
8
- list-style-type: none;
9
- color: var(--colorsUtilityYin055);
10
-
11
- ${({
12
- orientation,
13
- status
14
- }) => {
15
- const side = orientation === "vertical" ? "left" : "top";
16
- return css`
17
- &::before {
18
- content: "";
19
- flex-grow: 1;
20
- display: block;
21
- margin: 0 16px;
22
- border-${side}: var(--sizing025) dashed var(--colorsUtilityYin055);
23
- }
24
-
25
- & span {
26
- display: flex;
27
- align-items: center;
28
- justify-content: center;
29
- }
30
-
31
- ${StyledIcon} {
32
- margin-right: 8px;
33
- color: var(--colorsBaseTheme, var(--colorsSemanticPositive500));
34
- }
35
-
36
- &:first-child {
37
- flex-grow: 0;
38
-
39
- &::before {
40
- display: none;
41
- }
42
- }
43
-
44
- ${status === "current" && css`
45
- color: var(--colorsUtilityYin090);
46
-
47
- &::before {
48
- border-${side}-color: var(--colorsUtilityYin090);
49
- border-${side}-style: solid;
50
- }
51
- `}
52
-
53
- ${status === "complete" && css`
54
- color: var(--colorsBaseTheme, var(--colorsSemanticPositive500));
55
-
56
- &::before {
57
- border-${side}-color: var(
58
- --colorsBaseTheme,
59
- var(--colorsSemanticPositive500)
60
- );
61
- border-${side}-style: solid;
62
- }
63
- `}
64
-
65
- ${orientation === "vertical" && css`
66
- flex-direction: column;
67
- align-items: flex-start;
68
-
69
- &::before {
70
- flex-grow: 0;
71
- border-left-width: var(--sizing025);
72
- height: 100%;
73
- min-height: var(--sizing300);
74
- margin: 12px 8px;
75
- }
76
- `}
77
- `;
78
- }}
79
- `;
80
- export const StyledStepSequenceItemContent = styled.span`
81
- display: flex;
82
- `;
83
- export const StyledStepSequenceItemHiddenLabel = styled.span`
84
- position: absolute !important;
85
- height: 1px;
86
- width: 1px;
87
- overflow: hidden;
88
- clip: rect(1px, 1px, 1px, 1px);
89
- `;
90
- export const StyledStepSequenceItemIndicator = styled.span`
91
- display: block;
92
- min-width: 16px;
93
- height: 16px;
94
- margin-right: 8px;
95
- text-align: center;
96
- `;
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import { SpaceProps } from "styled-system";
3
- export declare const StepSequenceContext: React.Context<{
4
- orientation: "horizontal" | "vertical";
5
- }>;
6
- export interface StepSequenceProps extends SpaceProps {
7
- /** Step sequence items to be rendered */
8
- children: React.ReactNode;
9
- /** The direction that step sequence items should be rendered */
10
- orientation?: "horizontal" | "vertical";
11
- }
12
- export declare const StepSequence: ({ children, orientation, ...props }: StepSequenceProps) => React.JSX.Element;
13
- export default StepSequence;