@openedx/paragon 23.23.1 → 23.23.3

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 (126) hide show
  1. package/dist/Card/CardFooter.d.ts +19 -0
  2. package/dist/Card/CardFooter.js +5 -31
  3. package/dist/Card/CardFooter.js.map +1 -1
  4. package/dist/Card/CardSection.d.ts +19 -0
  5. package/dist/Card/CardSection.js +5 -31
  6. package/dist/Card/CardSection.js.map +1 -1
  7. package/dist/Card/CardStatus.d.ts +17 -0
  8. package/dist/Card/CardStatus.js +3 -25
  9. package/dist/Card/CardStatus.js.map +1 -1
  10. package/dist/Collapsible/CollapsibleAdvanced.d.ts +41 -0
  11. package/dist/Collapsible/CollapsibleAdvanced.js +8 -38
  12. package/dist/Collapsible/CollapsibleAdvanced.js.map +1 -1
  13. package/dist/Collapsible/CollapsibleBody.d.ts +11 -0
  14. package/dist/Collapsible/CollapsibleBody.js +6 -20
  15. package/dist/Collapsible/CollapsibleBody.js.map +1 -1
  16. package/dist/Collapsible/CollapsibleTrigger.d.ts +17 -0
  17. package/dist/Collapsible/CollapsibleTrigger.js +16 -33
  18. package/dist/Collapsible/CollapsibleTrigger.js.map +1 -1
  19. package/dist/Collapsible/CollapsibleVisible.d.ts +11 -0
  20. package/dist/Collapsible/CollapsibleVisible.js +6 -17
  21. package/dist/Collapsible/CollapsibleVisible.js.map +1 -1
  22. package/dist/Collapsible/index.d.ts +40 -0
  23. package/dist/Collapsible/index.js +23 -73
  24. package/dist/Collapsible/index.js.map +1 -1
  25. package/dist/DataTable/filters/DropdownFilter.d.ts +28 -0
  26. package/dist/DataTable/filters/DropdownFilter.js +0 -24
  27. package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
  28. package/dist/Form/FormAutosuggestOption.d.ts +11 -0
  29. package/dist/Form/FormAutosuggestOption.js +1 -15
  30. package/dist/Form/FormAutosuggestOption.js.map +1 -1
  31. package/dist/Form/FormControlDecorator.d.ts +7 -0
  32. package/dist/Form/FormControlDecorator.js +1 -9
  33. package/dist/Form/FormControlDecorator.js.map +1 -1
  34. package/dist/Form/FormControlFloatingLabel.d.ts +6 -0
  35. package/dist/Form/FormControlFloatingLabel.js +0 -4
  36. package/dist/Form/FormControlFloatingLabel.js.map +1 -1
  37. package/dist/Form/index.d.ts +1 -1
  38. package/dist/Form/index.js +0 -1
  39. package/dist/Form/index.js.map +1 -1
  40. package/dist/Modal/ModalCloseButton.d.ts +15 -0
  41. package/dist/Modal/ModalCloseButton.js +11 -25
  42. package/dist/Modal/ModalCloseButton.js.map +1 -1
  43. package/dist/Modal/ModalDialog.d.ts +1 -1
  44. package/dist/Modal/ModalDialog.js +0 -1
  45. package/dist/Modal/ModalDialog.js.map +1 -1
  46. package/dist/ProductTour/CheckpointBody.d.ts +6 -0
  47. package/dist/ProductTour/CheckpointBody.js +3 -10
  48. package/dist/ProductTour/CheckpointBody.js.map +1 -1
  49. package/dist/ProductTour/CheckpointTitle.d.ts +6 -0
  50. package/dist/ProductTour/CheckpointTitle.js +3 -10
  51. package/dist/ProductTour/CheckpointTitle.js.map +1 -1
  52. package/dist/StatefulButton/index.d.ts +45 -0
  53. package/dist/StatefulButton/index.js +15 -61
  54. package/dist/StatefulButton/index.js.map +1 -1
  55. package/dist/Stepper/Stepper.d.ts +22 -0
  56. package/dist/Stepper/Stepper.js +1 -12
  57. package/dist/Stepper/Stepper.js.map +1 -1
  58. package/dist/Stepper/StepperActionRow.d.ts +19 -0
  59. package/dist/Stepper/StepperActionRow.js +10 -21
  60. package/dist/Stepper/StepperActionRow.js.map +1 -1
  61. package/dist/Stepper/StepperContext.d.ts +33 -0
  62. package/dist/Stepper/StepperContext.js +7 -10
  63. package/dist/Stepper/StepperContext.js.map +1 -1
  64. package/dist/Stepper/StepperHeader.d.ts +27 -0
  65. package/dist/Stepper/StepperHeader.js +17 -43
  66. package/dist/Stepper/StepperHeader.js.map +1 -1
  67. package/dist/Stepper/StepperHeaderStep.d.ts +16 -0
  68. package/dist/Stepper/StepperHeaderStep.js +2 -23
  69. package/dist/Stepper/StepperHeaderStep.js.map +1 -1
  70. package/dist/Stepper/StepperStep.d.ts +29 -0
  71. package/dist/Stepper/StepperStep.js +1 -36
  72. package/dist/Stepper/StepperStep.js.map +1 -1
  73. package/dist/Stepper/index.js +1 -0
  74. package/dist/Stepper/index.js.map +1 -0
  75. package/dist/TransitionReplace/index.d.ts +54 -0
  76. package/dist/TransitionReplace/index.js +9 -60
  77. package/dist/TransitionReplace/index.js.map +1 -1
  78. package/dist/index.d.ts +4 -4
  79. package/dist/index.js +4 -8
  80. package/dist/index.js.map +1 -1
  81. package/dist/theme-urls.json +6 -6
  82. package/lib/__tests__/build-scss.test.js +90 -2
  83. package/lib/build-scss.js +17 -10
  84. package/package.json +1 -1
  85. package/src/Card/{CardFooter.jsx → CardFooter.tsx} +25 -34
  86. package/src/Card/{CardSection.jsx → CardSection.tsx} +25 -34
  87. package/src/Card/{CardStatus.jsx → CardStatus.tsx} +21 -33
  88. package/src/Collapsible/{Collapsible.test.jsx → Collapsible.test.tsx} +88 -21
  89. package/src/Collapsible/{CollapsibleAdvanced.jsx → CollapsibleAdvanced.tsx} +42 -43
  90. package/src/Collapsible/{CollapsibleBody.jsx → CollapsibleBody.tsx} +13 -22
  91. package/src/Collapsible/{CollapsibleTrigger.jsx → CollapsibleTrigger.tsx} +29 -36
  92. package/src/Collapsible/{CollapsibleVisible.jsx → CollapsibleVisible.tsx} +14 -20
  93. package/src/Collapsible/__snapshots__/{Collapsible.test.jsx.snap → Collapsible.test.tsx.snap} +0 -1
  94. package/src/Collapsible/index.tsx +91 -0
  95. package/src/DataTable/filters/{DropdownFilter.jsx → DropdownFilter.tsx} +27 -28
  96. package/src/Form/{FormAutosuggestOption.jsx → FormAutosuggestOption.tsx} +12 -19
  97. package/src/Form/FormControlDecorator.tsx +16 -0
  98. package/src/Form/{FormControlFloatingLabel.jsx → FormControlFloatingLabel.tsx} +6 -7
  99. package/src/Form/index.tsx +0 -1
  100. package/src/Modal/ModalCloseButton.tsx +48 -0
  101. package/src/Modal/ModalDialog.tsx +0 -1
  102. package/src/Modal/tests/ModalDialog.test.tsx +1 -1
  103. package/src/ProductTour/{Checkpoint.test.jsx → Checkpoint.test.tsx} +11 -1
  104. package/src/ProductTour/CheckpointBody.tsx +21 -0
  105. package/src/ProductTour/CheckpointTitle.tsx +15 -0
  106. package/src/StatefulButton/{StatefulButtontest.test.jsx → StatefulButtontest.test.tsx} +4 -4
  107. package/src/StatefulButton/{index.jsx → index.tsx} +47 -57
  108. package/src/Stepper/{Stepper.jsx → Stepper.tsx} +18 -12
  109. package/src/Stepper/StepperActionRow.tsx +41 -0
  110. package/src/Stepper/{StepperContext.jsx → StepperContext.tsx} +41 -17
  111. package/src/Stepper/{StepperHeader.jsx → StepperHeader.tsx} +47 -44
  112. package/src/Stepper/{StepperHeaderStep.jsx → StepperHeaderStep.tsx} +18 -26
  113. package/src/Stepper/{StepperStep.jsx → StepperStep.tsx} +30 -39
  114. package/src/Stepper/index.ts +1 -0
  115. package/src/Stepper/tests/{Stepper.test.jsx → Stepper.test.tsx} +156 -14
  116. package/src/TransitionReplace/{TransitionReplace.test.jsx → TransitionReplace.test.tsx} +12 -10
  117. package/src/TransitionReplace/{index.jsx → index.tsx} +63 -72
  118. package/src/index.ts +4 -8
  119. package/src/Collapsible/index.jsx +0 -99
  120. package/src/Form/FormControlDecorator.jsx +0 -21
  121. package/src/Modal/ModalCloseButton.jsx +0 -45
  122. package/src/ProductTour/CheckpointBody.jsx +0 -24
  123. package/src/ProductTour/CheckpointTitle.jsx +0 -18
  124. package/src/Stepper/StepperActionRow.jsx +0 -40
  125. /package/{src/Stepper/index.js → dist/Stepper/index.d.ts} +0 -0
  126. /package/src/StatefulButton/__snapshots__/{StatefulButtontest.test.jsx.snap → StatefulButtontest.test.tsx.snap} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"StepperContext.js","names":["React","useCallback","useEffect","useReducer","useState","PropTypes","StepperContext","createContext","activeKey","stepsReducer","stepsState","action","newStepsState","type","filter","step","eventKey","some","map","index","sort","a","b","StepperContextProvider","children","steps","dispatch","currentBoundary","setCurrentBoundary","registerStep","removeStep","getIsViewed","activeIndex","findIndex","prevState","createElement","Provider","value","propTypes","node","isRequired"],"sources":["../../src/Stepper/StepperContext.jsx"],"sourcesContent":["import React, {\n useCallback, useEffect, useReducer, useState,\n} from 'react';\nimport PropTypes from 'prop-types';\n\nexport const StepperContext = React.createContext({\n activeKey: '',\n});\n\nconst stepsReducer = (stepsState, action) => {\n let newStepsState = [];\n switch (action.type) {\n case 'remove':\n return stepsState.filter(step => step.eventKey !== action.eventKey);\n case 'register':\n default:\n // If it is existing step\n if (stepsState.some(step => step.eventKey === action.step.eventKey)) {\n newStepsState = stepsState.map(step => {\n if (step.eventKey === action.step.eventKey) {\n return action.step;\n }\n return step;\n });\n } else {\n newStepsState = [...stepsState, action.step];\n }\n\n // If using the index prop\n if (stepsState.some(step => step.index)) {\n return newStepsState.sort((a, b) => (\n a.index > b.index ? 1 : -1\n ));\n }\n return newStepsState;\n }\n};\n\nexport function StepperContextProvider({ children, activeKey }) {\n const [steps, dispatch] = useReducer(stepsReducer, []);\n const [currentBoundary, setCurrentBoundary] = useState(0);\n const registerStep = useCallback((step) => dispatch({ step, type: 'register' }), []);\n const removeStep = useCallback((eventKey) => dispatch({ eventKey, type: 'remove' }), []);\n\n const getIsViewed = (index) => index <= currentBoundary;\n\n useEffect(() => {\n const activeIndex = steps.findIndex(step => step.eventKey === activeKey);\n setCurrentBoundary((prevState) => (activeIndex >= prevState ? activeIndex : prevState));\n }, [activeKey, steps]);\n\n return (\n <StepperContext.Provider\n value={{\n activeKey,\n registerStep,\n steps,\n removeStep,\n getIsViewed,\n }}\n >\n {children}\n </StepperContext.Provider>\n );\n}\n\nStepperContextProvider.propTypes = {\n /** Specifies the content of the `ContextProvider`. */\n children: PropTypes.node.isRequired,\n /** Specifies the current step of the `Stepper`. */\n activeKey: PropTypes.node.is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"file":"StepperContext.js","names":["React","useCallback","useEffect","useReducer","useState","StepperContext","createContext","activeKey","registerStep","steps","removeStep","getIsViewed","stepsReducer","stepsState","action","newStepsState","type","filter","step","eventKey","some","map","index","undefined","sort","a","b","StepperContextProvider","children","dispatch","currentBoundary","setCurrentBoundary","activeIndex","findIndex","prevState","createElement","Provider","value"],"sources":["../../src/Stepper/StepperContext.tsx"],"sourcesContent":["import React, {\n useCallback, useEffect, useReducer, useState,\n} from 'react';\n\nexport interface Step {\n eventKey: string;\n title: string;\n description?: string;\n hasError?: boolean;\n index?: number;\n onClick?: () => void;\n}\n\nexport interface StepperContextValue {\n activeKey: string;\n registerStep: (step: Step) => void;\n steps: Step[];\n removeStep: (eventKey: string) => void;\n getIsViewed: (index: number) => boolean;\n}\n\nexport const StepperContext = React.createContext<StepperContextValue>({\n activeKey: '',\n registerStep: () => {},\n steps: [],\n removeStep: () => {},\n getIsViewed: () => false,\n});\n\ntype StepsAction =\n | { type: 'register'; step: Step }\n | { type: 'remove'; eventKey: string };\n\nconst stepsReducer = (stepsState: Step[], action: StepsAction): Step[] => {\n let newStepsState: Step[] = [];\n switch (action.type) {\n case 'remove':\n return stepsState.filter(step => step.eventKey !== action.eventKey);\n case 'register':\n default:\n // If it is existing step\n if (stepsState.some(step => step.eventKey === action.step.eventKey)) {\n newStepsState = stepsState.map(step => {\n if (step.eventKey === action.step.eventKey) {\n return action.step;\n }\n return step;\n });\n } else {\n newStepsState = [...stepsState, action.step];\n }\n\n // If using the index prop\n if (stepsState.some(step => step.index !== undefined)) {\n return newStepsState.sort((a, b) => (\n (a.index || 0) > (b.index || 0) ? 1 : -1\n ));\n }\n return newStepsState;\n }\n};\n\nexport interface StepperContextProviderProps {\n /** Specifies the content of the `ContextProvider`. */\n children: React.ReactNode;\n /** Specifies the current step of the `Stepper`. */\n activeKey: string;\n}\n\nexport function StepperContextProvider({ children, activeKey }: StepperContextProviderProps) {\n const [steps, dispatch] = useReducer(stepsReducer, []);\n const [currentBoundary, setCurrentBoundary] = useState(0);\n const registerStep = useCallback((step: Step) => dispatch({ step, type: 'register' }), []);\n const removeStep = useCallback((eventKey: string) => dispatch({ eventKey, type: 'remove' }), []);\n\n const getIsViewed = (index: number) => index <= currentBoundary;\n\n useEffect(() => {\n const activeIndex = steps.findIndex(step => step.eventKey === activeKey);\n setCurrentBoundary((prevState) => (activeIndex >= prevState ? activeIndex : prevState));\n }, [activeKey, steps]);\n\n return (\n <StepperContext.Provider\n value={{\n activeKey,\n registerStep,\n steps,\n removeStep,\n getIsViewed,\n }}\n >\n {children}\n </StepperContext.Provider>\n );\n}\n\nexport { stepsReducer };\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,WAAW,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,QACvC,OAAO;AAmBd,OAAO,MAAMC,cAAc,gBAAGL,KAAK,CAACM,aAAa,CAAsB;EACrEC,SAAS,EAAE,EAAE;EACbC,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,KAAK,EAAE,EAAE;EACTC,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,WAAW,EAAEA,CAAA,KAAM;AACrB,CAAC,CAAC;AAMF,MAAMC,YAAY,GAAGA,CAACC,UAAkB,EAAEC,MAAmB,KAAa;EACxE,IAAIC,aAAqB,GAAG,EAAE;EAC9B,QAAQD,MAAM,CAACE,IAAI;IACjB,KAAK,QAAQ;MACX,OAAOH,UAAU,CAACI,MAAM,CAACC,IAAI,IAAIA,IAAI,CAACC,QAAQ,KAAKL,MAAM,CAACK,QAAQ,CAAC;IACrE,KAAK,UAAU;IACf;MACE;MACA,IAAIN,UAAU,CAACO,IAAI,CAACF,IAAI,IAAIA,IAAI,CAACC,QAAQ,KAAKL,MAAM,CAACI,IAAI,CAACC,QAAQ,CAAC,EAAE;QACnEJ,aAAa,GAAGF,UAAU,CAACQ,GAAG,CAACH,IAAI,IAAI;UACrC,IAAIA,IAAI,CAACC,QAAQ,KAAKL,MAAM,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S,CAAC;IACxEwB,kBAAkB,CAAEG,SAAS,IAAMF,WAAW,IAAIE,SAAS,GAAGF,WAAW,GAAGE,SAAU,CAAC;EACzF,CAAC,EAAE,CAAC3B,SAAS,EAAEE,KAAK,CAAC,CAAC;EAEtB,oBACET,KAAA,CAAAmC,aAAA,CAAC9B,cAAc,CAAC+B,QAAQ;IACtBC,KAAK,EAAE;MACL9B,SAAS;MACTC,YAAY;MACZC,KAAK;MACLC,UAAU;MACVC;IACF;EAAE,GAEDiB,QACsB,CAAC;AAE9B;AAEA,SAAShB,YAAY","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import StepperHeaderStep from './StepperHeaderStep';
3
+ import { Step } from './StepperContext';
4
+ export interface StepListProps {
5
+ steps: Step[];
6
+ activeKey: string;
7
+ }
8
+ export interface PageCountProps {
9
+ activeStepIndex: number;
10
+ totalSteps: number;
11
+ }
12
+ export interface StepperHeaderProps {
13
+ /** Specifies class name to append to the base element. */
14
+ className?: string | null;
15
+ /** A component that receives `activeStepIndex` and `totalSteps` props to display them. */
16
+ PageCountComponent?: React.ComponentType<PageCountProps>;
17
+ /** The max width in which the compact view of the header will switch to display the step number that is
18
+ * currently in progress. Options include 'xs', 'sm', 'md', 'lg', 'xl', and 'xxl'.
19
+ */
20
+ compactWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
21
+ }
22
+ interface StepperHeaderComponent {
23
+ (props: StepperHeaderProps): JSX.Element | null;
24
+ Step: typeof StepperHeaderStep;
25
+ }
26
+ declare const StepperHeader: StepperHeaderComponent;
27
+ export default StepperHeader;
@@ -1,5 +1,4 @@
1
1
  import React, { useContext } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import classNames from 'classnames';
4
3
  import StepperHeaderStep from './StepperHeaderStep';
5
4
  import { StepperContext } from './StepperContext';
@@ -17,25 +16,24 @@ function StepList({
17
16
  }) {
18
17
  return /*#__PURE__*/React.createElement("ul", {
19
18
  className: "pgn__stepper-header-step-list"
20
- }, steps.map(({
21
- label,
22
- ...stepProps
23
- }, index) => /*#__PURE__*/React.createElement(React.Fragment, {
24
- key: stepProps.eventKey
19
+ }, steps.map((step, index) => /*#__PURE__*/React.createElement(React.Fragment, {
20
+ key: step.eventKey
25
21
  }, index !== 0 && /*#__PURE__*/React.createElement(StepListSeparator, null), /*#__PURE__*/React.createElement(StepperHeaderStep, {
26
- ...stepProps,
22
+ ...step,
27
23
  index: index,
28
- isActive: activeKey === stepProps.eventKey
29
- }, label))));
24
+ isActive: activeKey === step.eventKey
25
+ }))));
30
26
  }
31
- const PageCount = ({
27
+ function PageCount({
32
28
  activeStepIndex,
33
29
  totalSteps
34
- }) => `Step ${activeStepIndex + 1} of ${totalSteps}`;
35
- function StepperHeader({
36
- className,
37
- PageCountComponent,
38
- compactWidth
30
+ }) {
31
+ return /*#__PURE__*/React.createElement(React.Fragment, null, "Step ", activeStepIndex + 1, " of ", totalSteps);
32
+ }
33
+ const StepperHeader = function StepperHeader({
34
+ className = null,
35
+ PageCountComponent = PageCount,
36
+ compactWidth = 'sm'
39
37
  }) {
40
38
  const {
41
39
  steps,
@@ -44,10 +42,13 @@ function StepperHeader({
44
42
  const windowDimensions = useWindowSize();
45
43
  const size = Size[compactWidth] || 'small';
46
44
  const breakpointWidth = breakpoints[size].maxWidth || Infinity;
47
- const isCompactView = windowDimensions.width < breakpointWidth;
45
+ const isCompactView = windowDimensions.width !== undefined && windowDimensions.width < breakpointWidth;
48
46
  if (isCompactView) {
49
47
  const activeStepIndex = steps.findIndex(step => step.eventKey === activeKey);
50
48
  const activeStep = steps[activeStepIndex];
49
+ if (!activeStep) {
50
+ return null;
51
+ }
51
52
  return /*#__PURE__*/React.createElement("div", {
52
53
  className: classNames('pgn__stepper-header', className)
53
54
  }, /*#__PURE__*/React.createElement(StepperHeaderStep, {
@@ -69,33 +70,6 @@ function StepperHeader({
69
70
  steps: steps,
70
71
  activeKey: activeKey
71
72
  }));
72
- }
73
- StepperHeader.propTypes = {
74
- /** Specifies class name to append to the base element. */
75
- className: PropTypes.string,
76
- /** A component that receives `activeStepIndex` and `totalSteps` props to display them. */
77
- PageCountComponent: PropTypes.elementType,
78
- /** The max width in which the compact view of the header will switch to display the step number that is
79
- * currently in progress. Options include 'xs', 'sm', 'md', 'lg', 'xl', and 'xxl'.
80
- */
81
- compactWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', 'xxl'])
82
- };
83
- StepperHeader.defaultProps = {
84
- className: null,
85
- PageCountComponent: PageCount,
86
- compactWidth: 'sm'
87
- };
88
- StepList.propTypes = {
89
- steps: PropTypes.arrayOf(PropTypes.shape({
90
- eventKey: PropTypes.string,
91
- title: PropTypes.string,
92
- description: PropTypes.string,
93
- hasError: PropTypes.bool
94
- })),
95
- activeKey: PropTypes.string.isRequired
96
- };
97
- StepList.defaultProps = {
98
- steps: []
99
73
  };
100
74
  StepperHeader.Step = StepperHeaderStep;
101
75
  export default StepperHeader;
@@ -1 +1 @@
1
- {"version":3,"file":"StepperHeader.js","names":["React","useContext","PropTypes","classNames","StepperHeaderStep","StepperContext","useWindowSize","breakpoints","Size","StepListSeparator","createElement","className","StepList","steps","activeKey","map","label","stepProps","index","Fragment","key","eventKey","isActive","PageCount","activeStepIndex","totalSteps","StepperHeader","PageCountComponent","compactWidth","windowDimensions","size","breakpointWidth","maxWidth","Infinity","isCompactView","width","findIndex","step","activeStep","length","propTypes","string","elementType","oneOf","defaultProps","arrayOf","shape","title","description","hasError","bool","isRequired","Step"],"sources":["../../src/Stepper/StepperHeader.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport StepperHeaderStep from './StepperHeaderStep';\nimport { StepperContext } from './StepperContext';\nimport useWindowSize from '../hooks/useWindowSizeHook';\nimport breakpoints, { Size } from '../utils/breakpoints';\n\nfunction StepListSeparator() {\n return <li aria-hidden=\"true\" className=\"pgn__stepper-header-line\" />;\n}\n\nfunction StepList({ steps, activeKey }) {\n return (\n <ul className=\"pgn__stepper-header-step-list\">\n {steps.map(({ label, ...stepProps }, index) => (\n <React.Fragment key={stepProps.eventKey}>\n {index !== 0 && <StepListSeparator />}\n <StepperHeaderStep\n {...stepProps}\n index={index}\n isActive={activeKey === stepProps.eventKey}\n >\n {label}\n </StepperHeaderStep>\n </React.Fragment>\n ))}\n </ul>\n );\n}\n\nconst PageCount = ({ activeStepIndex, totalSteps }) => `Step ${activeStepIndex + 1} of ${totalSteps}`;\n\nfunction StepperHeader({ className, PageCountComponent, compactWidth }) {\n const { steps, activeKey } = useContext(StepperContext);\n const windowDimensions = useWindowSize();\n const size = Size[compactWidth] || 'small';\n const breakpointWidth = breakpoints[size].maxWidth || Infinity;\n const isCompactView = windowDimensions.width < breakpointWidth;\n\n if (isCompactView) {\n const activeStepIndex = steps.findIndex(step => step.eventKey === activeKey);\n const activeStep = steps[activeStepIndex];\n return (\n <div className={classNames('pgn__stepper-header', className)}>\n <StepperHeaderStep\n {...activeStep}\n index={activeStepIndex}\n isActive\n />\n <div className=\"flex-grow-1\" />\n <div>\n <PageCountComponent\n activeStepIndex={activeStepIndex}\n totalSteps={steps.length}\n />\n </div>\n </div>\n );\n }\n\n // Show all steps\n return (\n <div className={classNames('pgn__stepper-header', className)}>\n <StepList steps={steps} activeKey={activeKey} />\n </div>\n );\n}\n\nStepperHeader.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** A component that receives `activeStepIndex` and `totalSteps` props to display them. */\n PageCountComponent: PropTypes.elementType,\n /** The max width in which the compact view of the header will switch to display the step number that is\n * currently in progress. Options include 'xs', 'sm', 'md', 'lg', 'xl', and 'xxl'.\n */\n compactWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', 'xxl']),\n};\n\nStepperHeader.defaultProps = {\n className: null,\n PageCountComponent: PageCount,\n compactWidth: 'sm',\n};\n\nStepList.propTypes = {\n steps: PropTypes.arrayOf(PropTypes.shape({\n eventKey: PropTypes.string,\n title: PropTypes.string,\n description: PropTypes.string,\n hasError: PropTypes.bool,\n })),\n activeKey: PropTypes.string.isRequired,\n};\n\nStepList.defaultProps = {\n steps: [],\n};\n\nStepperHeader.Step = StepperHeaderStep;\n\nexport default StepperHeader;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,WAAW,IAAIC,IAAI,QAAQ,sBAAsB;AAExD,SAASC,iBAAiBA,CAAA,EAAG;EAC3B,oBAAOT,KAAA,CAAAU,aAAA;IAAI,eAAY,MAAM;IAACC,SAAS,EAAC;EAA0B,CAAE,CAAC;AACvE;AAEA,SAASC,QAAQA,CAAC;EAAEC,KAAK;EAAEC;AAAU,CAAC,EAAE;EACtC,oBACEd,KAAA,CAAAU,aAAA;IAAIC,SAAS,EAAC;EAA+B,GAC1CE,KAAK,CAACE,GAAG,CAAC,CAAC;IAAEC,KAAK;IAAE,GAAGC;EAAU,CAAC,EAAEC,KAAK,kBACxClB,KAAA,CAAAU,aAAA,CAACV,KAAK,CAACmB,QAAQ;IAACC,GAAG,EAAEH,SAAS,CAACI;EAAS,GACrCH,KAAK,KAAK,CAAC,iBAAIlB,KAAA,CAAAU,aAAA,CAACD,iBAAiB,MAAE,CAAC,eACrCT,KAAA,CAAAU,aAAA,CAACN,iBAAiB;IAAA,GACZa,SAAS;IACbC,KAAK,EAAEA,KAAM;IACbI,QAAQ,EAAER,SAAS,KAAKG,SAAS,CAACI;EAAS,GAE1CL,KACgB,CACL,CACjB,CACC,CAAC;AAET;AAEA,MAAMO,SAAS,GAAGA,CAAC;EAAEC,eAAe;EAAEC;AAAW,CAAC,KAAK,QAAQD,eAAe,GAAG,CAAC,OAAOC,UAAU,EAAE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EA;EAAU,CAAE,CAC5C,CAAC;AAEV;AAEAY,aAAa,CAACc,SAAS,GAAG;EACxB;EACA7B,SAAS,EAAET,SAAS,CAACuC,MAAM;EAC3B;EACAd,kBAAkB,EAAEzB,SAAS,CAACwC,WAAW;EACzC;AACF;AACA;EACEd,YAAY,EAAE1B,SAAS,CAACyC,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC;AACrE,CAAC;AAEDjB,aAAa,CAACkB,YAAY,GAAG;EAC3BjC,SAAS,EAAE,IAAI;EACfgB,kBAAkB,EAAEJ,SAAS;EAC7BK,YAAY,EAAE;AAChB,CAAC;AAEDhB,QAAQ,CAAC4B,SAAS,GAAG;EACnB3B,KAAK,EAAEX,SAAS,CAAC2C,OAAO,CAAC3C,SAAS,CAAC4C,KAAK,CAAC;IACvCzB,QAAQ,EAAEnB,SAAS,CAACuC,MAAM;IAC1BM,KAAK,EAAE7C,SAAS,CAACuC,MAAM;IACvBO,WAAW,EAAE9C,SAAS,CAACuC,MAAM;IAC7BQ,QAAQ,EAAE/C,SAAS,CAACgD;EACtB,CAAC,CAAC,CAAC;EACHpC,SAAS,EAAEZ,SAAS,CAACuC,MAAM,CAACU;AAC9B,CAAC;AAEDvC,QAAQ,CAACgC,YAAY,GAAG;EACtB/B,KAAK,EAAE;AACT,CAAC;AAEDa,aAAa,CAAC0B,IAAI,GAAGhD,iBAAiB;AAEtC,eAAesB,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"StepperHeader.js","names":["React","useContext","classNames","StepperHeaderStep","StepperContext","useWindowSize","breakpoints","Size","StepListSeparator","createElement","className","StepList","steps","activeKey","map","step","index","Fragment","key","eventKey","isActive","PageCount","activeStepIndex","totalSteps","StepperHeader","PageCountComponent","compactWidth","windowDimensions","size","breakpointWidth","maxWidth","Infinity","isCompactView","width","undefined","findIndex","activeStep","length","Step"],"sources":["../../src/Stepper/StepperHeader.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport StepperHeaderStep from './StepperHeaderStep';\nimport { StepperContext, Step } from './StepperContext';\nimport useWindowSize from '../hooks/useWindowSizeHook';\nimport breakpoints, { Size } from '../utils/breakpoints';\n\nfunction StepListSeparator() {\n return <li aria-hidden=\"true\" className=\"pgn__stepper-header-line\" />;\n}\n\nexport interface StepListProps {\n steps: Step[];\n activeKey: string;\n}\n\nfunction StepList({ steps, activeKey }: StepListProps) {\n return (\n <ul className=\"pgn__stepper-header-step-list\">\n {steps.map((step, index) => (\n <React.Fragment key={step.eventKey}>\n {index !== 0 && <StepListSeparator />}\n <StepperHeaderStep\n {...step}\n index={index}\n isActive={activeKey === step.eventKey}\n />\n </React.Fragment>\n ))}\n </ul>\n );\n}\n\nexport interface PageCountProps {\n activeStepIndex: number;\n totalSteps: number;\n}\n\nfunction PageCount({ activeStepIndex, totalSteps }: PageCountProps) {\n return <>Step {activeStepIndex + 1} of {totalSteps}</>;\n}\n\nexport interface StepperHeaderProps {\n /** Specifies class name to append to the base element. */\n className?: string | null;\n /** A component that receives `activeStepIndex` and `totalSteps` props to display them. */\n PageCountComponent?: React.ComponentType<PageCountProps>;\n /** The max width in which the compact view of the header will switch to display the step number that is\n * currently in progress. Options include 'xs', 'sm', 'md', 'lg', 'xl', and 'xxl'.\n */\n compactWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';\n}\n\ninterface StepperHeaderComponent {\n (props: StepperHeaderProps): JSX.Element | null;\n Step: typeof StepperHeaderStep;\n}\n\nconst StepperHeader: StepperHeaderComponent = function StepperHeader({\n className = null,\n PageCountComponent = PageCount,\n compactWidth = 'sm',\n}: StepperHeaderProps) {\n const { steps, activeKey } = useContext(StepperContext);\n const windowDimensions = useWindowSize();\n const size = Size[compactWidth] || 'small';\n const breakpointWidth = breakpoints[size].maxWidth || Infinity;\n const isCompactView = windowDimensions.width !== undefined && windowDimensions.width < breakpointWidth;\n\n if (isCompactView) {\n const activeStepIndex = steps.findIndex(step => step.eventKey === activeKey);\n const activeStep = steps[activeStepIndex];\n\n if (!activeStep) {\n return null;\n }\n\n return (\n <div className={classNames('pgn__stepper-header', className)}>\n <StepperHeaderStep\n {...activeStep}\n index={activeStepIndex}\n isActive\n />\n <div className=\"flex-grow-1\" />\n <div>\n <PageCountComponent\n activeStepIndex={activeStepIndex}\n totalSteps={steps.length}\n />\n </div>\n </div>\n );\n }\n\n // Show all steps\n return (\n <div className={classNames('pgn__stepper-header', className)}>\n <StepList steps={steps} activeKey={activeKey} />\n </div>\n );\n};\n\nStepperHeader.Step = StepperHeaderStep;\n\nexport default StepperHeader;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAASC,cAAc,QAAc,kBAAkB;AACvD,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,WAAW,IAAIC,IAAI,QAAQ,sBAAsB;AAExD,SAASC,iBAAiBA,CAAA,EAAG;EAC3B,oBAAOR,KAAA,CAAAS,aAAA;IAAI,eAAY,MAAM;IAACC,SAAS,EAAC;EAA0B,CAAE,CAAC;AACvE;AAOA,SAASC,QAAQA,CAAC;EAAEC,KAAK;EAAEC;AAAyB,CAAC,EAAE;EACrD,oBACEb,KAAA,CAAAS,aAAA;IAAIC,SAAS,EAAC;EAA+B,GAC1CE,KAAK,CAACE,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,kBACrBhB,KAAA,CAAAS,aAAA,CAACT,KAAK,CAACiB,QAAQ;IAACC,GAAG,EAAEH,IAAI,CAACI;EAAS,GAChCH,KAAK,KAAK,CAAC,iBAAIhB,KAAA,CAAAS,aAAA,CAACD,iBAAiB,MAAE,CAAC,eACrCR,KAAA,CAAAS,aAAA,CAACN,iBAAiB;IAAA,GACZY,IAAI;IACRC,KAAK,EAAEA,KAAM;IACbI,QAAQ,EAAEP,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,eACFpB,KAAA,CAAAS,aAAA;MAAKC,SAAS,EAAC;IAAa,CAAE,CAAC,eAC/BV,KAAA,CAAAS,aAAA,2BACET,KAAA,CAAAS,aAAA,CAACgB,kBAAkB;MACjBH,eAAe,EAAEA,eAAgB;MACjCC,UAAU,EAAEX,KAAK,CAACyB;IAAO,CAC1B,CACE,CACF,CAAC;EAEV;;EAEA;EACA,oBACErC,KAAA,CAAAS,aAAA;IAAKC,SAAS,EAAER,UAAU,CAAC,qBAAqB,EAAEQ,SAAS;EAAE,gBAC3DV,KAAA,CAAAS,aAAA,CAACE,QAAQ;IAACC,KAAK,EAAEA,KAAM;IAACC,SAAS,EAAEA;EAAU,CAAE,CAC5C,CAAC;AAEV,CAAC;AAEDW,aAAa,CAACc,IAAI,GAAGnC,iBAAiB;AAEtC,eAAeqB,aAAa","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ export interface StepperHeaderStepProps {
2
+ /** A number that will be display in the icon of the `HeaderStep`. */
3
+ index: number;
4
+ /** A text of the `HeaderStep`. */
5
+ title: string;
6
+ /** Specifies that this `HeaderStep` is active. */
7
+ isActive?: boolean;
8
+ /** Informs user if this `Step` has errors. */
9
+ hasError?: boolean;
10
+ /** A text under the `title`. */
11
+ description?: string;
12
+ /** Callback fired when element gets clicked. */
13
+ onClick?: () => void;
14
+ }
15
+ declare function StepperHeaderStep({ title, isActive, hasError, description, index, onClick, }: StepperHeaderStepProps): import("react/jsx-runtime").JSX.Element;
16
+ export default StepperHeaderStep;
@@ -1,5 +1,4 @@
1
1
  import React, { useContext } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import classNames from 'classnames';
4
3
  import { Check, Error } from '../../icons';
5
4
  import { StepperContext } from './StepperContext';
@@ -7,8 +6,8 @@ import Icon from '../Icon';
7
6
  import Bubble from '../Bubble';
8
7
  function StepperHeaderStep({
9
8
  title,
10
- isActive,
11
- hasError,
9
+ isActive = false,
10
+ hasError = false,
12
11
  description,
13
12
  index,
14
13
  onClick
@@ -65,25 +64,5 @@ function StepperHeaderStep({
65
64
  className: "pgn__stepper-header-step-description"
66
65
  }, description)));
67
66
  }
68
- StepperHeaderStep.propTypes = {
69
- /** A number that will be display in the icon of the `HeaderStep`. */
70
- index: PropTypes.number.isRequired,
71
- /** A text of the `HeaderStep`. */
72
- title: PropTypes.string.isRequired,
73
- /** Specifies that this `HeaderStep` is active. */
74
- isActive: PropTypes.bool,
75
- /** Informs user if this `Step` has errors. */
76
- hasError: PropTypes.bool,
77
- /** A text under the `title`. */
78
- description: PropTypes.string,
79
- /** Callback fired when element gets clicked. */
80
- onClick: PropTypes.func
81
- };
82
- StepperHeaderStep.defaultProps = {
83
- isActive: false,
84
- hasError: false,
85
- description: undefined,
86
- onClick: undefined
87
- };
88
67
  export default StepperHeaderStep;
89
68
  //# sourceMappingURL=StepperHeaderStep.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StepperHeaderStep.js","names":["React","useContext","PropTypes","classNames","Check","Error","StepperContext","Icon","Bubble","StepperHeaderStep","title","isActive","hasError","description","index","onClick","getIsViewed","isComplete","isViewed","stepIcon","createElement","src","errorIcon","isClickable","type","className","onKeyPress","variant","disabled","propTypes","number","isRequired","string","bool","func","defaultProps","undefined"],"sources":["../../src/Stepper/StepperHeaderStep.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport { Check, Error } from '../../icons';\nimport { StepperContext } from './StepperContext';\nimport Icon from '../Icon';\nimport Bubble from '../Bubble';\n\nfunction StepperHeaderStep({\n title,\n isActive,\n hasError,\n description,\n index,\n onClick,\n}) {\n const { getIsViewed } = useContext(StepperContext);\n const isComplete = getIsViewed(index + 1);\n const isViewed = getIsViewed(index);\n const stepIcon = isComplete ? <Icon src={Check} /> : <span>{index + 1}</span>;\n const errorIcon = <Icon src={Error} data-testid=\"step-error\" />;\n const isClickable = onClick && isViewed && !isActive;\n\n if (isClickable) {\n return (\n <button\n type=\"button\"\n aria-label={`${title} step`}\n className={classNames(\n 'pgn__stepper-header-step',\n {\n 'pgn__stepper-header-step-has-error': hasError,\n 'pgn__stepper-header-step-complete': isComplete,\n },\n )}\n onClick={onClick}\n onKeyPress={onClick}\n >\n <Bubble variant={hasError ? 'error' : 'primary'} disabled>\n {hasError ? errorIcon : stepIcon}\n </Bubble>\n <div className=\"pgn__stepper-header-step-title-description\">\n <div className=\"pgn__stepper-header-step-title\">{title}</div>\n <div className=\"pgn__stepper-header-step-description\">{description}</div>\n </div>\n </button>\n );\n }\n\n return (\n <li\n className={classNames(\n 'pgn__stepper-header-step',\n {\n 'pgn__stepper-header-step-active': isActive,\n 'pgn__stepper-header-step-has-error': hasError,\n 'pgn__stepper-header-step-complete': isComplete,\n },\n )}\n data-testid=\"step\"\n >\n <Bubble variant={hasError ? 'error' : 'primary'} disabled={!isActive}>\n {hasError ? errorIcon : stepIcon}\n </Bubble>\n <div className=\"pgn__stepper-header-step-title-description\">\n <div className=\"pgn__stepper-header-step-title\">{title}</div>\n <div className=\"pgn__stepper-header-step-description\">{description}</div>\n </div>\n </li>\n );\n}\n\nStepperHeaderStep.propTypes = {\n /** A number that will be display in the icon of the `HeaderStep`. */\n index: PropTypes.number.isRequired,\n /** A text of the `HeaderStep`. */\n title: PropTypes.string.isRequired,\n /** Specifies that this `HeaderStep` is active. */\n isActive: PropTypes.bool,\n /** Informs user if this `Step` has errors. */\n hasError: PropTypes.bool,\n /** A text under the `title`. */\n description: PropTypes.string,\n /** Callback fired when element gets clicked. */\n onClick: PropTypes.func,\n};\n\nStepperHeaderStep.defaultProps = {\n isActive: false,\n hasError: false,\n description: undefined,\n onClick: undefined,\n};\n\nexport default StepperHeaderStep;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,KAAK,EAAEC,KAAK,QAAQ,aAAa;AAC1C,SAASC,cAAc,QAAQ,k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rB,OAAO,EAAEqB;AACX,CAAC;AAED,eAAe3B,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"StepperHeaderStep.js","names":["React","useContext","classNames","Check","Error","StepperContext","Icon","Bubble","StepperHeaderStep","title","isActive","hasError","description","index","onClick","getIsViewed","isComplete","isViewed","stepIcon","createElement","src","errorIcon","isClickable","type","className","onKeyPress","variant","disabled"],"sources":["../../src/Stepper/StepperHeaderStep.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport classNames from 'classnames';\n\nimport { Check, Error } from '../../icons';\nimport { StepperContext } from './StepperContext';\nimport Icon from '../Icon';\nimport Bubble from '../Bubble';\n\nexport interface StepperHeaderStepProps {\n /** A number that will be display in the icon of the `HeaderStep`. */\n index: number;\n /** A text of the `HeaderStep`. */\n title: string;\n /** Specifies that this `HeaderStep` is active. */\n isActive?: boolean;\n /** Informs user if this `Step` has errors. */\n hasError?: boolean;\n /** A text under the `title`. */\n description?: string;\n /** Callback fired when element gets clicked. */\n onClick?: () => void;\n}\n\nfunction StepperHeaderStep({\n title,\n isActive = false,\n hasError = false,\n description,\n index,\n onClick,\n}: StepperHeaderStepProps) {\n const { getIsViewed } = useContext(StepperContext);\n const isComplete = getIsViewed(index + 1);\n const isViewed = getIsViewed(index);\n const stepIcon = isComplete ? <Icon src={Check} /> : <span>{index + 1}</span>;\n const errorIcon = <Icon src={Error} data-testid=\"step-error\" />;\n const isClickable = onClick && isViewed && !isActive;\n\n if (isClickable) {\n return (\n <button\n type=\"button\"\n aria-label={`${title} step`}\n className={classNames(\n 'pgn__stepper-header-step',\n {\n 'pgn__stepper-header-step-has-error': hasError,\n 'pgn__stepper-header-step-complete': isComplete,\n },\n )}\n onClick={onClick}\n onKeyPress={onClick}\n >\n <Bubble variant={hasError ? 'error' : 'primary'} disabled>\n {hasError ? errorIcon : stepIcon}\n </Bubble>\n <div className=\"pgn__stepper-header-step-title-description\">\n <div className=\"pgn__stepper-header-step-title\">{title}</div>\n <div className=\"pgn__stepper-header-step-description\">{description}</div>\n </div>\n </button>\n );\n }\n\n return (\n <li\n className={classNames(\n 'pgn__stepper-header-step',\n {\n 'pgn__stepper-header-step-active': isActive,\n 'pgn__stepper-header-step-has-error': hasError,\n 'pgn__stepper-header-step-complete': isComplete,\n },\n )}\n data-testid=\"step\"\n >\n <Bubble variant={hasError ? 'error' : 'primary'} disabled={!isActive}>\n {hasError ? errorIcon : stepIcon}\n </Bubble>\n <div className=\"pgn__stepper-header-step-title-description\">\n <div className=\"pgn__stepper-header-step-title\">{title}</div>\n <div className=\"pgn__stepper-header-step-description\">{description}</div>\n </div>\n </li>\n );\n}\n\nexport default StepperHeaderStep;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,KAAK,EAAEC,KAAK,QAAQ,aAAa;AAC1C,SAASC,cAAc,QAAQ,kBAAkB;AACjD,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,MAAM,MAAM,WAAW;AAiB9B,SAASC,iBAAiBA,CAAC;EACzBC,KAAK;EACLC,QAAQ,GAAG,KAAK;EAChBC,QAAQ,GAAG,KAAK;EAChBC,WAAW;EACXC,KAAK;EACLC;AACsB,CAAC,EAAE;EACzB,MAAM;IAAEC;EAAY,CAAC,GAAGd,UAAU,CAACI,cAAc,CAAC;EAClD,MAAMW,UAAU,GAAGD,WAAW,CAACF,KAAK,GAAG,CAAC,CAAC;EACzC,MAAMI,QAAQ,GAAGF,WAAW,CAACF,KAAK,CAAC;EACnC,MAAMK,QAAQ,GAAGF,UAAU,gBAAGhB,KAAA,CAAAmB,aAAA,CAACb,IAAI;IAACc,GAAG,EAAEjB;EAAM,CAAE,CAAC,gBAAGH,KAAA,CAAAmB,aAAA,eAAON,KAAK,GAAG,CAAQ,CAAC;EAC7E,MAAMQ,SAAS,gBAAGrB,KAAA,CAAAmB,aAAA,CAACb,IAAI;IAACc,GAAG,EAAEhB,KAAM;IAAC,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,SAAS,EAAC;EAAgC,GAAEf,KAAW,CAAC,eAC7DT,KAAA,CAAAmB,aAAA;IAAKK,SAAS,EAAC;EAAsC,GAAEZ,WAAiB,CACrE,CACH,CAAC;AAET;AAEA,eAAeJ,iBAAiB","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ export interface StepperStepProps {
3
+ /** Specifies the content of the `Step`. */
4
+ children: React.ReactNode;
5
+ /** Specifies class name to append to the base element */
6
+ className?: string;
7
+ /**
8
+ * An identifier of the `Step`. When `activeKey` on the
9
+ * `Stepper` equals to the `eventKey`, the `Step` will be displayed.
10
+ */
11
+ eventKey: string;
12
+ /** A text of the `Step`. */
13
+ title: string;
14
+ /** A text under the `title`. */
15
+ description?: string;
16
+ /** Informs user if this `Step` has errors. */
17
+ hasError?: boolean;
18
+ /**
19
+ * Position of the `Step`, only required if adding error state
20
+ * or conditionally rendering steps.
21
+ * */
22
+ index?: number;
23
+ /**
24
+ * Click handler for the `Step`. Takes effect only after the `Step` has been visited, making it clickable
25
+ * and invoking this function on click. Should be used to provide navigation between steps.
26
+ */
27
+ onClick?: () => void;
28
+ }
29
+ export default function StepperStep({ children, eventKey, className, title, index, description, hasError, onClick, }: StepperStepProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,4 @@
1
1
  import React, { useContext, useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import classNames from 'classnames';
4
3
  import { StepperContext } from './StepperContext';
5
4
  export default function StepperStep({
@@ -9,7 +8,7 @@ export default function StepperStep({
9
8
  title,
10
9
  index,
11
10
  description,
12
- hasError,
11
+ hasError = false,
13
12
  onClick
14
13
  }) {
15
14
  const {
@@ -36,38 +35,4 @@ export default function StepperStep({
36
35
  className: classNames('pgn__stepper-step', className)
37
36
  }, children);
38
37
  }
39
- StepperStep.propTypes = {
40
- /** Specifies the content of the `Step`. */
41
- children: PropTypes.node.isRequired,
42
- /** Specifies class name to append to the base element */
43
- className: PropTypes.string,
44
- /**
45
- * An identifier of the `Step`. When `activeKey` on the
46
- * `Stepper` equals to the `eventKey`, the `Step` will be displayed.
47
- */
48
- eventKey: PropTypes.string.isRequired,
49
- /** A text of the `Step`. */
50
- title: PropTypes.string.isRequired,
51
- /** A text under the `title`. */
52
- description: PropTypes.string,
53
- /** Informs user if this `Step` has errors. */
54
- hasError: PropTypes.bool,
55
- /**
56
- * Position of the `Step`, only required if adding error state
57
- * or conditionally rendering steps.
58
- * */
59
- index: PropTypes.number,
60
- /**
61
- * Click handler for the `Step`. Takes effect only after the `Step` has been visited, making it clickable
62
- * and invoking this function on click. Should be used to provide navigation between steps.
63
- */
64
- onClick: PropTypes.func
65
- };
66
- StepperStep.defaultProps = {
67
- className: undefined,
68
- description: undefined,
69
- hasError: false,
70
- index: undefined,
71
- onClick: undefined
72
- };
73
38
  //# sourceMappingURL=StepperStep.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StepperStep.js","names":["React","useContext","useEffect","PropTypes","classNames","StepperContext","StepperStep","children","eventKey","className","title","index","description","hasError","onClick","activeKey","registerStep","removeStep","isActive","createElement","propTypes","node","isRequired","string","bool","number","func","defaultProps","undefined"],"sources":["../../src/Stepper/StepperStep.jsx"],"sourcesContent":["import React, { useContext, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { StepperContext } from './StepperContext';\n\nexport default function StepperStep({\n children,\n eventKey,\n className,\n title,\n index,\n description,\n hasError,\n onClick,\n}) {\n const { activeKey, registerStep, removeStep } = useContext(StepperContext);\n\n useEffect(() => {\n registerStep({\n title,\n index,\n eventKey,\n description,\n hasError,\n onClick,\n });\n return () => removeStep(eventKey);\n }, [title, eventKey, description, hasError, index, registerStep, removeStep, onClick]);\n\n const isActive = activeKey === eventKey;\n\n if (!isActive) {\n return null;\n }\n\n return (\n <div className={classNames('pgn__stepper-step', className)}>\n {children}\n </div>\n );\n}\n\nStepperStep.propTypes = {\n /** Specifies the content of the `Step`. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /**\n * An identifier of the `Step`. When `activeKey` on the\n * `Stepper` equals to the `eventKey`, the `Step` will be displayed.\n */\n eventKey: PropTypes.string.isRequired,\n /** A text of the `Step`. */\n title: PropTypes.string.isRequired,\n /** A text under the `title`. */\n description: PropTypes.string,\n /** Informs user if this `Step` has errors. */\n hasError: PropTypes.bool,\n /**\n * Position of the `Step`, only required if adding error state\n * or conditionally rendering steps.\n * */\n index: PropTypes.number,\n /**\n * Click handler for the `Step`. Takes effect only after the `Step` has been visited, making it clickable\n * and invoking this function on click. Should be used to provide navigation between steps.\n */\n onClick: PropTypes.func,\n};\n\nStepperStep.defaultProps = {\n className: undefined,\n description: undefined,\n hasError: false,\n index: undefined,\n onClick: undefined,\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AACpD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,eAAe,SAASC,WAAWA,CAAC;EAClCC,QAAQ;EACRC,QAAQ;EACRC,SAAS;EACTC,KAAK;EACLC,KAAK;EACLC,WAAW;EACXC,QAAQ;EACRC;AACF,CAAC,EAAE;EACD,MAAM;IAAEC,SAAS;IAAEC,YAAY;IAAEC;EAAW,CAAC,GAAGhB,UAAU,CAACI,cAAc,CAAC;EAE1EH,SAAS,CAAC,MAAM;IACdc,YAAY,CAAC;MACXN,KAAK;MACLC,KAAK;MACLH,QAAQ;MACRI,WAAW;MACXC,QAAQ;MACRC;IACF,CAAC,CAAC;IACF,OAAO,MAAMG,UAAU,CAACT,QAAQ,CAAC;EACnC,CAAC,EAAE,CAACE,KAAK,EAAEF,QAAQ,EAAEI,WAAW,EAAEC,QAAQ,EAAEF,KAAK,EAAEK,YAAY,EAAEC,UAAU,EAAEH,OAAO,CAAC,CAAC;EAEtF,MAAMI,QAAQ,GAAGH,SAAS,KAAKP,QAAQ;EAEvC,IAAI,CAACU,QAAQ,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBACElB,KAAA,CAAAmB,aAAA;IAAKV,SAAS,EAAEL,UAAU,CAAC,mBAAmB,EAAEK,SAAS;EAAE,GACxDF,QACE,CAAC;AAEV;AAEAD,WAAW,CAACc,SAAS,GAAG;EACtB;EACAb,QAAQ,EAAEJ,SAAS,CAACkB,IAAI,CAACC,UAAU;EACnC;EACAb,SAAS,EAAEN,SAAS,CAACoB,MAAM;EAC3B;AACF;AACA;AACA;EACEf,QAAQ,EAAEL,SAAS,CAACoB,MAAM,CAACD,UAAU;EACrC;EACAZ,KAAK,EAAEP,SAAS,CAACoB,MAAM,CAACD,UAAU;EAClC;EACAV,WAAW,EAAET,SAAS,CAACoB,MAAM;EAC7B;EACAV,QAAQ,EAAEV,SAAS,CAACqB,IAAI;EACxB;AACF;AACA;AACA;EACEb,KAAK,EAAER,SAAS,CAACsB,MAAM;EACvB;AACF;AACA;AACA;EACEX,OAAO,EAAEX,SAAS,CAACuB;AACrB,CAAC;AAEDpB,WAAW,CAACqB,YAAY,GAAG;EACzBlB,SAAS,EAAEmB,SAAS;EACpBhB,WAAW,EAAEgB,SAAS;EACtBf,QAAQ,EAAE,KAAK;EACfF,KAAK,EAAEiB,SAAS;EAChBd,OAAO,EAAEc;AACX,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"StepperStep.js","names":["React","useContext","useEffect","classNames","StepperContext","StepperStep","children","eventKey","className","title","index","description","hasError","onClick","activeKey","registerStep","removeStep","isActive","createElement"],"sources":["../../src/Stepper/StepperStep.tsx"],"sourcesContent":["import React, { useContext, useEffect } from 'react';\nimport classNames from 'classnames';\nimport { StepperContext } from './StepperContext';\n\nexport interface StepperStepProps {\n /** Specifies the content of the `Step`. */\n children: React.ReactNode;\n /** Specifies class name to append to the base element */\n className?: string;\n /**\n * An identifier of the `Step`. When `activeKey` on the\n * `Stepper` equals to the `eventKey`, the `Step` will be displayed.\n */\n eventKey: string;\n /** A text of the `Step`. */\n title: string;\n /** A text under the `title`. */\n description?: string;\n /** Informs user if this `Step` has errors. */\n hasError?: boolean;\n /**\n * Position of the `Step`, only required if adding error state\n * or conditionally rendering steps.\n * */\n index?: number;\n /**\n * Click handler for the `Step`. Takes effect only after the `Step` has been visited, making it clickable\n * and invoking this function on click. Should be used to provide navigation between steps.\n */\n onClick?: () => void;\n}\n\nexport default function StepperStep({\n children,\n eventKey,\n className,\n title,\n index,\n description,\n hasError = false,\n onClick,\n}: StepperStepProps) {\n const { activeKey, registerStep, removeStep } = useContext(StepperContext);\n\n useEffect(() => {\n registerStep({\n title,\n index,\n eventKey,\n description,\n hasError,\n onClick,\n });\n return () => removeStep(eventKey);\n }, [title, eventKey, description, hasError, index, registerStep, removeStep, onClick]);\n\n const isActive = activeKey === eventKey;\n\n if (!isActive) {\n return null;\n }\n\n return (\n <div className={classNames('pgn__stepper-step', className)}>\n {children}\n </div>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AACpD,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,cAAc,QAAQ,kBAAkB;AA8BjD,eAAe,SAASC,WAAWA,CAAC;EAClCC,QAAQ;EACRC,QAAQ;EACRC,SAAS;EACTC,KAAK;EACLC,KAAK;EACLC,WAAW;EACXC,QAAQ,GAAG,KAAK;EAChBC;AACgB,CAAC,EAAE;EACnB,MAAM;IAAEC,SAAS;IAAEC,YAAY;IAAEC;EAAW,CAAC,GAAGf,UAAU,CAACG,cAAc,CAAC;EAE1EF,SAAS,CAAC,MAAM;IACda,YAAY,CAAC;MACXN,KAAK;MACLC,KAAK;MACLH,QAAQ;MACRI,WAAW;MACXC,QAAQ;MACRC;IACF,CAAC,CAAC;IACF,OAAO,MAAMG,UAAU,CAACT,QAAQ,CAAC;EACnC,CAAC,EAAE,CAACE,KAAK,EAAEF,QAAQ,EAAEI,WAAW,EAAEC,QAAQ,EAAEF,KAAK,EAAEK,YAAY,EAAEC,UAAU,EAAEH,OAAO,CAAC,CAAC;EAEtF,MAAMI,QAAQ,GAAGH,SAAS,KAAKP,QAAQ;EAEvC,IAAI,CAACU,QAAQ,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBACEjB,KAAA,CAAAkB,aAAA;IAAKV,SAAS,EAAEL,UAAU,CAAC,mBAAmB,EAAEK,SAAS;EAAE,GACxDF,QACE,CAAC;AAEV","ignoreList":[]}
@@ -1 +1,2 @@
1
1
  export { default } from './Stepper';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["default"],"sources":["../../src/Stepper/index.ts"],"sourcesContent":["export { default } from './Stepper';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,WAAW","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ interface TransitionStyles {
3
+ entering?: React.CSSProperties;
4
+ entered?: React.CSSProperties;
5
+ exiting?: React.CSSProperties;
6
+ exited?: React.CSSProperties;
7
+ }
8
+ export interface TransitionReplaceProps {
9
+ /** The content that will be displayed with a transition when it changes. */
10
+ children?: React.ReactElement | null;
11
+ /** Duration of the element appearance transition. */
12
+ enterDuration?: number;
13
+ /** Duration of the element dismiss transition. */
14
+ exitDuration?: number;
15
+ /** Specifies class name to append to the base element. */
16
+ className?: string;
17
+ /** A `Transition` callback fired immediately after the `enter` or `appear` class is applied. */
18
+ onChildEnter?: (node: HTMLElement) => void;
19
+ /** A `Transition` callback fired immediately after the `enter-active` or `appear-active` class is applied. */
20
+ onChildEntering?: (node: HTMLElement) => void;
21
+ /**
22
+ * A `Transition` callback fired immediately after the `enter` or
23
+ * `appear` classes are removed and the done class is added to the DOM node.
24
+ */
25
+ onChildEntered?: (node: HTMLElement) => void;
26
+ /** A `Transition` callback fired immediately after the `exit` class is applied. */
27
+ onChildExit?: (node: HTMLElement) => void;
28
+ /** A `Transition` callback fired immediately after the `exit-active` is applied. */
29
+ onChildExiting?: (node: HTMLElement) => void;
30
+ /**
31
+ * A `Transition` callback fired immediately after the `exit` classes
32
+ * are removed and the exit-done class is added to the DOM node.
33
+ */
34
+ onChildExited?: (node: HTMLElement) => void;
35
+ /** An object that specifies transition styles. */
36
+ transitionStyles?: TransitionStyles;
37
+ /** Specifies class name to append to the `Transition`. */
38
+ transitionClassNames?: string;
39
+ }
40
+ interface TransitionReplaceState {
41
+ height: number | null;
42
+ }
43
+ declare class TransitionReplace extends React.Component<TransitionReplaceProps, TransitionReplaceState> {
44
+ constructor(props: TransitionReplaceProps);
45
+ onChildEnter(htmlNode: HTMLElement): void;
46
+ onChildEntering(htmlNode: HTMLElement): void;
47
+ onChildEntered(htmlNode: HTMLElement): void;
48
+ onChildExit(htmlNode: HTMLElement): void;
49
+ onChildExiting(htmlNode: HTMLElement): void;
50
+ onChildExited(htmlNode: HTMLElement): void;
51
+ renderChildTransition: (child: React.ReactElement) => import("react/jsx-runtime").JSX.Element;
52
+ render(): import("react/jsx-runtime").JSX.Element;
53
+ }
54
+ export default TransitionReplace;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { CSSTransition, TransitionGroup } from 'react-transition-group';
4
3
  import classNames from 'classnames';
5
4
  class TransitionReplace extends React.Component {
@@ -72,11 +71,12 @@ class TransitionReplace extends React.Component {
72
71
  this.props.onChildExited(htmlNode);
73
72
  }
74
73
  }
75
- renderChildTransition(child) {
74
+ renderChildTransition = child => {
76
75
  if (!child.key && process.env.NODE_ENV === 'development') {
77
76
  // eslint-disable-next-line no-console
78
77
  console.warn("TransitionReplace: A child is missing a 'key' prop. Keys are required for any child of this component.");
79
78
  }
79
+
80
80
  // Makes the exiting and entering children occupy the same space
81
81
  // SCSS handles the crossfade so it can be easily overridden
82
82
  const commonChildStyles = {
@@ -97,8 +97,8 @@ class TransitionReplace extends React.Component {
97
97
  };
98
98
  return /*#__PURE__*/React.createElement(CSSTransition, {
99
99
  timeout: {
100
- enter: this.props.enterDuration,
101
- exit: this.props.exitDuration
100
+ enter: this.props.enterDuration ?? 300,
101
+ exit: this.props.exitDuration ?? 300
102
102
  },
103
103
  unmountOnExit: true,
104
104
  mountOnEnter: true,
@@ -108,76 +108,25 @@ class TransitionReplace extends React.Component {
108
108
  onExit: this.onChildExit,
109
109
  onExiting: this.onChildExiting,
110
110
  onExited: this.onChildExited,
111
- classNames: this.props.transitionClassNames
111
+ classNames: this.props.transitionClassNames ?? 'pgn__transition-replace'
112
112
  }, state => /*#__PURE__*/React.createElement("div", {
113
113
  style: {
114
114
  ...commonChildStyles,
115
115
  ...transitionStyles[state],
116
- ...this.props.transitionStyles[state]
116
+ ...(this.props.transitionStyles?.[state] || {})
117
117
  }
118
118
  }, child));
119
- }
119
+ };
120
120
  render() {
121
121
  return /*#__PURE__*/React.createElement(TransitionGroup, {
122
122
  className: classNames('pgn-transition-replace-group', 'position-relative', {
123
123
  'overflow-hidden': this.state.height !== null
124
124
  }, this.props.className),
125
125
  style: {
126
- height: this.state.height
126
+ height: this.state.height ?? undefined
127
127
  }
128
- }, React.Children.map(this.props.children, this.renderChildTransition, this));
128
+ }, React.Children.map(this.props.children, this.renderChildTransition));
129
129
  }
130
130
  }
131
- TransitionReplace.propTypes = {
132
- /** Specifies an additional class for the base element */
133
- children: PropTypes.element,
134
- /** Duration of the element appearance transition. */
135
- enterDuration: PropTypes.number,
136
- /** Duration of the element dismiss transition. */
137
- exitDuration: PropTypes.number,
138
- /** Specifies class name to append to the base element. */
139
- className: PropTypes.string,
140
- /** A `Transition` callback fired immediately after the `enter` or `appear` class is applied. */
141
- onChildEnter: PropTypes.func,
142
- /** A `Transition` callback fired immediately after the `enter-active` or `appear-active` class is applied. */
143
- onChildEntering: PropTypes.func,
144
- /**
145
- * A `Transition` callback fired immediately after the `enter` or
146
- * `appear` classes are removed and the done class is added to the DOM node.
147
- */
148
- onChildEntered: PropTypes.func,
149
- /** A `Transition` callback fired immediately after the `exit` class is applied. */
150
- onChildExit: PropTypes.func,
151
- /** A `Transition` callback fired immediately after the `exit-active` is applied. */
152
- onChildExiting: PropTypes.func,
153
- /**
154
- * A `Transition` callback fired immediately after the `exit` classes
155
- * are removed and the exit-done class is added to the DOM node.
156
- */
157
- onChildExited: PropTypes.func,
158
- /** An object that specifies transition styles. */
159
- transitionStyles: PropTypes.shape({
160
- entering: PropTypes.shape({}),
161
- entered: PropTypes.shape({}),
162
- exiting: PropTypes.shape({}),
163
- exited: PropTypes.shape({})
164
- }),
165
- /** Specifies class name to append to the `Transition`. */
166
- transitionClassNames: PropTypes.string
167
- };
168
- TransitionReplace.defaultProps = {
169
- children: undefined,
170
- enterDuration: 300,
171
- exitDuration: 300,
172
- className: undefined,
173
- onChildEnter: undefined,
174
- onChildEntering: undefined,
175
- onChildEntered: undefined,
176
- onChildExit: undefined,
177
- onChildExiting: undefined,
178
- onChildExited: undefined,
179
- transitionStyles: {},
180
- transitionClassNames: 'pgn__transition-replace'
181
- };
182
131
  export default TransitionReplace;
183
132
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","PropTypes","CSSTransition","TransitionGroup","classNames","TransitionReplace","Component","constructor","props","state","height","onChildEnter","bind","onChildEntering","onChildEntered","onChildExit","onChildExiting","onChildExited","htmlNode","setState","offsetHeight","renderChildTransition","child","key","process","env","NODE_ENV","console","warn","commonChildStyles","padding","transitionStyles","entering","entered","exiting","position","top","left","right","pointerEvents","exited","createElement","timeout","enter","enterDuration","exit","exitDuration","unmountOnExit","mountOnEnter","onEnter","onEntering","onEntered","onExit","onExiting","onExited","transitionClassNames","style","render","className","Children","map","children","propTypes","element","number","string","func","shape","defaultProps","undefined"],"sources":["../../src/TransitionReplace/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport classNames from 'classnames';\n\nclass TransitionReplace extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = { height: null };\n\n this.onChildEnter = this.onChildEnter.bind(this);\n this.onChildEntering = this.onChildEntering.bind(this);\n this.onChildEntered = this.onChildEntered.bind(this);\n this.onChildExit = this.onChildExit.bind(this);\n this.onChildExiting = this.onChildExiting.bind(this);\n this.onChildExited = this.onChildExited.bind(this);\n }\n\n // Transition events are fired in this order:\n //\n // onEnter > onEntering > onEntered\n // onExit > onExiting > onExited\n //\n // Keep in mind that we always have two transitions happening\n // both the entering and leaving children\n //\n // We set the container height (for animation) in this order:\n //\n // 1. onChildExit (explicitly set the height to match the current current)\n // 2. onChildEntering (set the height to match the new content)\n // 3. onChildExited (reset the height to null)\n\n onChildEnter(htmlNode) {\n if (this.props.onChildEnter) { this.props.onChildEnter(htmlNode); }\n }\n\n onChildEntering(htmlNode) {\n this.setState({ height: htmlNode.offsetHeight });\n if (this.props.onChildEntering) { this.props.onChildEntering(htmlNode); }\n }\n\n onChildEntered(htmlNode) {\n this.setState({ height: null });\n if (this.props.onChildEntered) { this.props.onChildEntered(htmlNode); }\n }\n\n onChildExit(htmlNode) {\n this.setState({ height: htmlNode.offsetHeight });\n if (this.props.onChildExit) { this.props.onChildExit(htmlNode); }\n }\n\n onChildExiting(htmlNode) {\n if (this.props.onChildExiting) { this.props.onChildExiting(htmlNode); }\n }\n\n onChildExited(htmlNode) {\n this.setState({ height: null });\n if (this.props.onChildExited) { this.props.onChildExited(htmlNode); }\n }\n\n renderChildTransition(child) {\n if (!child.key && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(\"TransitionReplace: A child is missing a 'key' prop. Keys are required for any child of this component.\");\n }\n // Makes the exiting and entering children occupy the same space\n // SCSS handles the crossfade so it can be easily overridden\n const commonChildStyles = {\n // Prevent margin-collapsing which throws off height calculations\n padding: '.1px 0',\n };\n\n const transitionStyles = {\n entering: {},\n entered: {},\n exiting: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n pointerEvents: 'none',\n },\n exited: {},\n };\n\n return (\n <CSSTransition\n timeout={{\n enter: this.props.enterDuration,\n exit: this.props.exitDuration,\n }}\n unmountOnExit\n mountOnEnter\n onEnter={this.onChildEnter}\n onEntering={this.onChildEntering}\n onEntered={this.onChildEntered}\n onExit={this.onChildExit}\n onExiting={this.onChildExiting}\n onExited={this.onChildExited}\n classNames={this.props.transitionClassNames}\n >\n {state => (\n <div\n style={{\n ...commonChildStyles,\n ...transitionStyles[state],\n ...this.props.transitionStyles[state],\n }}\n >\n {child}\n </div>\n )}\n </CSSTransition>\n );\n }\n\n render() {\n return (\n <TransitionGroup\n className={classNames(\n 'pgn-transition-replace-group',\n 'position-relative',\n { 'overflow-hidden': this.state.height !== null },\n this.props.className,\n )}\n style={{ height: this.state.height }}\n >\n {React.Children.map(this.props.children, this.renderChildTransition, this)}\n </TransitionGroup>\n );\n }\n}\n\nTransitionReplace.propTypes = {\n /** Specifies an additional class for the base element */\n children: PropTypes.element,\n /** Duration of the element appearance transition. */\n enterDuration: PropTypes.number,\n /** Duration of the element dismiss transition. */\n exitDuration: PropTypes.number,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** A `Transition` callback fired immediately after the `enter` or `appear` class is applied. */\n onChildEnter: PropTypes.func,\n /** A `Transition` callback fired immediately after the `enter-active` or `appear-active` class is applied. */\n onChildEntering: PropTypes.func,\n /**\n * A `Transition` callback fired immediately after the `enter` or\n * `appear` classes are removed and the done class is added to the DOM node.\n */\n onChildEntered: PropTypes.func,\n /** A `Transition` callback fired immediately after the `exit` class is applied. */\n onChildExit: PropTypes.func,\n /** A `Transition` callback fired immediately after the `exit-active` is applied. */\n onChildExiting: PropTypes.func,\n /**\n * A `Transition` callback fired immediately after the `exit` classes\n * are removed and the exit-done class is added to the DOM node.\n */\n onChildExited: PropTypes.func,\n /** An object that specifies transition styles. */\n transitionStyles: PropTypes.shape({\n entering: PropTypes.shape({}),\n entered: PropTypes.shape({}),\n exiting: PropTypes.shape({}),\n exited: PropTypes.shape({}),\n }),\n /** Specifies class name to append to the `Transition`. */\n transitionClassNames: PropTypes.string,\n};\n\nTransitionReplace.defaultProps = {\n children: undefined,\n enterDuration: 300,\n exitDuration: 300,\n className: undefined,\n onChildEnter: undefined,\n onChildEntering: undefined,\n onChildEntered: undefined,\n onChildExit: undefined,\n onChildExiting: undefined,\n onChildExited: undefined,\n transitionStyles: {},\n transitionClassNames: 'pgn__transition-replace',\n};\n\nexport default TransitionReplace;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,aAAa,EAAEC,eAAe,QAAQ,wBAAwB;AACvE,OAAOC,UAAU,MAAM,YAAY;AAEnC,MAAMC,iBAAiB,SAASL,KAAK,CAACM,SAAS,CAAC;EAC9CC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,KAAK,GAAG;MAAEC,MAAM,EAAE;IAAK,CAAC;IAE7B,IAAI,CAACC,YAAY,GAAG,IAAI,CAACA,YAAY,CAACC,IAAI,CAAC,IAAI,CAAC;IAChD,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACD,IAAI,CAAC,IAAI,CAAC;IACtD,IAAI,CAACE,cAAc,GAAG,IAAI,CAACA,cAAc,CAACF,IAAI,CAAC,IAAI,CAAC;IACpD,IAAI,CAACG,WAAW,GAAG,IAAI,CAACA,WAAW,CAACH,IAAI,CAAC,IAAI,CAAC;IAC9C,IAAI,CAACI,cAAc,GAAG,IAAI,CAACA,cAAc,CAACJ,IAAI,CAAC,IAAI,CAAC;IACpD,IAAI,CAACK,aAAa,GAAG,IAAI,CAACA,aAAa,CAACL,IAAI,CAAC,IAAI,CAAC;EACpD;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEAD,YAAYA,CAACO,QAAQ,EAAE;IACrB,IAAI,IAAI,CAACV,KAAK,CAACG,YAAY,EAAE;MAAE,IAAI,CAACH,KAAK,CAACG,YAAY,CAACO,Q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AAoB,EAAEtD,SAAS,CAACgE;AAClC,CAAC;AAED5D,iBAAiB,CAAC+D,YAAY,GAAG;EAC/BP,QAAQ,EAAEQ,SAAS;EACnBzB,aAAa,EAAE,GAAG;EAClBE,YAAY,EAAE,GAAG;EACjBY,SAAS,EAAEW,SAAS;EACpB1D,YAAY,EAAE0D,SAAS;EACvBxD,eAAe,EAAEwD,SAAS;EAC1BvD,cAAc,EAAEuD,SAAS;EACzBtD,WAAW,EAAEsD,SAAS;EACtBrD,cAAc,EAAEqD,SAAS;EACzBpD,aAAa,EAAEoD,SAAS;EACxBtC,gBAAgB,EAAE,CAAC,CAAC;EACpBwB,oBAAoB,EAAE;AACxB,CAAC;AAED,eAAelD,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","CSSTransition","TransitionGroup","classNames","TransitionReplace","Component","constructor","props","state","height","onChildEnter","bind","onChildEntering","onChildEntered","onChildExit","onChildExiting","onChildExited","htmlNode","setState","offsetHeight","renderChildTransition","child","key","process","env","NODE_ENV","console","warn","commonChildStyles","padding","transitionStyles","entering","entered","exiting","position","top","left","right","pointerEvents","exited","createElement","timeout","enter","enterDuration","exit","exitDuration","unmountOnExit","mountOnEnter","onEnter","onEntering","onEntered","onExit","onExiting","onExited","transitionClassNames","style","render","className","undefined","Children","map","children"],"sources":["../../src/TransitionReplace/index.tsx"],"sourcesContent":["import React from 'react';\nimport { CSSTransition, TransitionGroup } from 'react-transition-group';\nimport classNames from 'classnames';\n\ninterface TransitionStyles {\n entering?: React.CSSProperties;\n entered?: React.CSSProperties;\n exiting?: React.CSSProperties;\n exited?: React.CSSProperties;\n}\n\nexport interface TransitionReplaceProps {\n /** The content that will be displayed with a transition when it changes. */\n children?: React.ReactElement | null;\n /** Duration of the element appearance transition. */\n enterDuration?: number;\n /** Duration of the element dismiss transition. */\n exitDuration?: number;\n /** Specifies class name to append to the base element. */\n className?: string;\n /** A `Transition` callback fired immediately after the `enter` or `appear` class is applied. */\n onChildEnter?: (node: HTMLElement) => void;\n /** A `Transition` callback fired immediately after the `enter-active` or `appear-active` class is applied. */\n onChildEntering?: (node: HTMLElement) => void;\n /**\n * A `Transition` callback fired immediately after the `enter` or\n * `appear` classes are removed and the done class is added to the DOM node.\n */\n onChildEntered?: (node: HTMLElement) => void;\n /** A `Transition` callback fired immediately after the `exit` class is applied. */\n onChildExit?: (node: HTMLElement) => void;\n /** A `Transition` callback fired immediately after the `exit-active` is applied. */\n onChildExiting?: (node: HTMLElement) => void;\n /**\n * A `Transition` callback fired immediately after the `exit` classes\n * are removed and the exit-done class is added to the DOM node.\n */\n onChildExited?: (node: HTMLElement) => void;\n /** An object that specifies transition styles. */\n transitionStyles?: TransitionStyles;\n /** Specifies class name to append to the `Transition`. */\n transitionClassNames?: string;\n}\n\ninterface TransitionReplaceState {\n height: number | null;\n}\n\nclass TransitionReplace extends React.Component<TransitionReplaceProps, TransitionReplaceState> {\n constructor(props: TransitionReplaceProps) {\n super(props);\n\n this.state = { height: null };\n\n this.onChildEnter = this.onChildEnter.bind(this);\n this.onChildEntering = this.onChildEntering.bind(this);\n this.onChildEntered = this.onChildEntered.bind(this);\n this.onChildExit = this.onChildExit.bind(this);\n this.onChildExiting = this.onChildExiting.bind(this);\n this.onChildExited = this.onChildExited.bind(this);\n }\n\n // Transition events are fired in this order:\n //\n // onEnter > onEntering > onEntered\n // onExit > onExiting > onExited\n //\n // Keep in mind that we always have two transitions happening\n // both the entering and leaving children\n //\n // We set the container height (for animation) in this order:\n //\n // 1. onChildExit (explicitly set the height to match the current current)\n // 2. onChildEntering (set the height to match the new content)\n // 3. onChildExited (reset the height to null)\n\n onChildEnter(htmlNode: HTMLElement) {\n if (this.props.onChildEnter) { this.props.onChildEnter(htmlNode); }\n }\n\n onChildEntering(htmlNode: HTMLElement) {\n this.setState({ height: htmlNode.offsetHeight });\n if (this.props.onChildEntering) { this.props.onChildEntering(htmlNode); }\n }\n\n onChildEntered(htmlNode: HTMLElement) {\n this.setState({ height: null });\n if (this.props.onChildEntered) { this.props.onChildEntered(htmlNode); }\n }\n\n onChildExit(htmlNode: HTMLElement) {\n this.setState({ height: htmlNode.offsetHeight });\n if (this.props.onChildExit) { this.props.onChildExit(htmlNode); }\n }\n\n onChildExiting(htmlNode: HTMLElement) {\n if (this.props.onChildExiting) { this.props.onChildExiting(htmlNode); }\n }\n\n onChildExited(htmlNode: HTMLElement) {\n this.setState({ height: null });\n if (this.props.onChildExited) { this.props.onChildExited(htmlNode); }\n }\n\n renderChildTransition = (child: React.ReactElement) => {\n if (!child.key && process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(\"TransitionReplace: A child is missing a 'key' prop. Keys are required for any child of this component.\");\n }\n\n // Makes the exiting and entering children occupy the same space\n // SCSS handles the crossfade so it can be easily overridden\n const commonChildStyles: React.CSSProperties = {\n // Prevent margin-collapsing which throws off height calculations\n padding: '.1px 0',\n };\n\n const transitionStyles: Record<string, React.CSSProperties> = {\n entering: {},\n entered: {},\n exiting: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n pointerEvents: 'none',\n },\n exited: {},\n };\n\n return (\n <CSSTransition\n timeout={{\n enter: this.props.enterDuration ?? 300,\n exit: this.props.exitDuration ?? 300,\n }}\n unmountOnExit\n mountOnEnter\n onEnter={this.onChildEnter}\n onEntering={this.onChildEntering}\n onEntered={this.onChildEntered}\n onExit={this.onChildExit}\n onExiting={this.onChildExiting}\n onExited={this.onChildExited}\n classNames={this.props.transitionClassNames ?? 'pgn__transition-replace'}\n >\n {state => (\n <div\n style={{\n ...commonChildStyles,\n ...transitionStyles[state],\n ...(this.props.transitionStyles?.[state as keyof TransitionStyles] || {}),\n }}\n >\n {child}\n </div>\n )}\n </CSSTransition>\n );\n };\n\n render() {\n return (\n <TransitionGroup\n className={classNames(\n 'pgn-transition-replace-group',\n 'position-relative',\n { 'overflow-hidden': this.state.height !== null },\n this.props.className,\n )}\n style={{ height: this.state.height ?? undefined }}\n >\n {React.Children.map(this.props.children, this.renderChildTransition)}\n </TransitionGroup>\n );\n }\n}\n\nexport default TransitionReplace;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,EAAEC,eAAe,QAAQ,wBAAwB;AACvE,OAAOC,UAAU,MAAM,YAAY;AA8CnC,MAAMC,iBAAiB,SAASJ,KAAK,CAACK,SAAS,CAAiD;EAC9FC,WAAWA,CAACC,KAA6B,EAAE;IACzC,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,KAAK,GAAG;MAAEC,MAAM,EAAE;IAAK,CAAC;IAE7B,IAAI,CAACC,YAAY,GAAG,IAAI,CAACA,YAAY,CAACC,IAAI,CAAC,IAAI,CAAC;IAChD,IAAI,CAACC,eAAe,GAAG,IAAI,CAACA,eAAe,CAACD,IAAI,CAAC,IAAI,CAAC;IACtD,IAAI,CAACE,cAAc,GAAG,IAAI,CAACA,cAAc,CAACF,IAAI,CAAC,IAAI,CAAC;IACpD,IAAI,CAACG,WAAW,GAAG,IAAI,CAACA,WAAW,CAACH,IAAI,CAAC,IAAI,CAAC;IAC9C,IAAI,CAACI,cAAc,GAAG,IAAI,CAACA,cAAc,CAACJ,IAAI,CAAC,IAAI,CAAC;IACpD,IAAI,CAACK,aAAa,GAAG,IAAI,CAACA,aAAa,CAACL,IAAI,CAAC,IAAI,CAAC;EACpD;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEAD,YAAYA,CAACO,QAAqB,EAAE;IAClC,IAAI,IAAI,CAACV,KAAK,CAACG,YAAY,EAAE;MAAE,IAAI,CAACH,KAAK,CAACG,YAAY,CAACO,QAAQ,CAAC;IAAE;EACpE;EAEAL,eAAeA,CAACK,QAAqB,EAAE;IACrC,IAAI,CAACC,QAAQ,CAAC;MAAET,MAAM,EAAEQ,QAAQ,CAACE;IAAa,CAAC,CAAC;IAChD,IAAI,IAAI,CAACZ,KAAK,CAACK,eAAe,EAAE;MAAE,IAAI,CAAC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