@openedx/paragon 23.23.2 → 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.
- package/dist/Card/CardFooter.d.ts +19 -0
- package/dist/Card/CardFooter.js +5 -31
- package/dist/Card/CardFooter.js.map +1 -1
- package/dist/Card/CardSection.d.ts +19 -0
- package/dist/Card/CardSection.js +5 -31
- package/dist/Card/CardSection.js.map +1 -1
- package/dist/Card/CardStatus.d.ts +17 -0
- package/dist/Card/CardStatus.js +3 -25
- package/dist/Card/CardStatus.js.map +1 -1
- package/dist/Collapsible/CollapsibleAdvanced.d.ts +41 -0
- package/dist/Collapsible/CollapsibleAdvanced.js +8 -38
- package/dist/Collapsible/CollapsibleAdvanced.js.map +1 -1
- package/dist/Collapsible/CollapsibleBody.d.ts +11 -0
- package/dist/Collapsible/CollapsibleBody.js +6 -20
- package/dist/Collapsible/CollapsibleBody.js.map +1 -1
- package/dist/Collapsible/CollapsibleTrigger.d.ts +17 -0
- package/dist/Collapsible/CollapsibleTrigger.js +16 -33
- package/dist/Collapsible/CollapsibleTrigger.js.map +1 -1
- package/dist/Collapsible/CollapsibleVisible.d.ts +11 -0
- package/dist/Collapsible/CollapsibleVisible.js +6 -17
- package/dist/Collapsible/CollapsibleVisible.js.map +1 -1
- package/dist/Collapsible/index.d.ts +40 -0
- package/dist/Collapsible/index.js +23 -73
- package/dist/Collapsible/index.js.map +1 -1
- package/dist/DataTable/filters/DropdownFilter.d.ts +28 -0
- package/dist/DataTable/filters/DropdownFilter.js +0 -24
- package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
- package/dist/Form/FormAutosuggestOption.d.ts +11 -0
- package/dist/Form/FormAutosuggestOption.js +1 -15
- package/dist/Form/FormAutosuggestOption.js.map +1 -1
- package/dist/Form/FormControlDecorator.d.ts +7 -0
- package/dist/Form/FormControlDecorator.js +1 -9
- package/dist/Form/FormControlDecorator.js.map +1 -1
- package/dist/Form/FormControlFloatingLabel.d.ts +6 -0
- package/dist/Form/FormControlFloatingLabel.js +0 -4
- package/dist/Form/FormControlFloatingLabel.js.map +1 -1
- package/dist/Form/index.d.ts +1 -1
- package/dist/Form/index.js +0 -1
- package/dist/Form/index.js.map +1 -1
- package/dist/Modal/ModalCloseButton.d.ts +15 -0
- package/dist/Modal/ModalCloseButton.js +11 -25
- package/dist/Modal/ModalCloseButton.js.map +1 -1
- package/dist/Modal/ModalDialog.d.ts +1 -1
- package/dist/Modal/ModalDialog.js +0 -1
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/ProductTour/CheckpointBody.d.ts +6 -0
- package/dist/ProductTour/CheckpointBody.js +3 -10
- package/dist/ProductTour/CheckpointBody.js.map +1 -1
- package/dist/ProductTour/CheckpointTitle.d.ts +6 -0
- package/dist/ProductTour/CheckpointTitle.js +3 -10
- package/dist/ProductTour/CheckpointTitle.js.map +1 -1
- package/dist/StatefulButton/index.d.ts +45 -0
- package/dist/StatefulButton/index.js +15 -61
- package/dist/StatefulButton/index.js.map +1 -1
- package/dist/Stepper/Stepper.d.ts +22 -0
- package/dist/Stepper/Stepper.js +1 -12
- package/dist/Stepper/Stepper.js.map +1 -1
- package/dist/Stepper/StepperActionRow.d.ts +19 -0
- package/dist/Stepper/StepperActionRow.js +10 -21
- package/dist/Stepper/StepperActionRow.js.map +1 -1
- package/dist/Stepper/StepperContext.d.ts +33 -0
- package/dist/Stepper/StepperContext.js +7 -10
- package/dist/Stepper/StepperContext.js.map +1 -1
- package/dist/Stepper/StepperHeader.d.ts +27 -0
- package/dist/Stepper/StepperHeader.js +17 -43
- package/dist/Stepper/StepperHeader.js.map +1 -1
- package/dist/Stepper/StepperHeaderStep.d.ts +16 -0
- package/dist/Stepper/StepperHeaderStep.js +2 -23
- package/dist/Stepper/StepperHeaderStep.js.map +1 -1
- package/dist/Stepper/StepperStep.d.ts +29 -0
- package/dist/Stepper/StepperStep.js +1 -36
- package/dist/Stepper/StepperStep.js.map +1 -1
- package/dist/Stepper/index.js +1 -0
- package/dist/Stepper/index.js.map +1 -0
- package/dist/TransitionReplace/index.d.ts +54 -0
- package/dist/TransitionReplace/index.js +9 -60
- package/dist/TransitionReplace/index.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Card/{CardFooter.jsx → CardFooter.tsx} +25 -34
- package/src/Card/{CardSection.jsx → CardSection.tsx} +25 -34
- package/src/Card/{CardStatus.jsx → CardStatus.tsx} +21 -33
- package/src/Collapsible/{Collapsible.test.jsx → Collapsible.test.tsx} +88 -21
- package/src/Collapsible/{CollapsibleAdvanced.jsx → CollapsibleAdvanced.tsx} +42 -43
- package/src/Collapsible/{CollapsibleBody.jsx → CollapsibleBody.tsx} +13 -22
- package/src/Collapsible/{CollapsibleTrigger.jsx → CollapsibleTrigger.tsx} +29 -36
- package/src/Collapsible/{CollapsibleVisible.jsx → CollapsibleVisible.tsx} +14 -20
- package/src/Collapsible/__snapshots__/{Collapsible.test.jsx.snap → Collapsible.test.tsx.snap} +0 -1
- package/src/Collapsible/index.tsx +91 -0
- package/src/DataTable/filters/{DropdownFilter.jsx → DropdownFilter.tsx} +27 -28
- package/src/Form/{FormAutosuggestOption.jsx → FormAutosuggestOption.tsx} +12 -19
- package/src/Form/FormControlDecorator.tsx +16 -0
- package/src/Form/{FormControlFloatingLabel.jsx → FormControlFloatingLabel.tsx} +6 -7
- package/src/Form/index.tsx +0 -1
- package/src/Modal/ModalCloseButton.tsx +48 -0
- package/src/Modal/ModalDialog.tsx +0 -1
- package/src/Modal/tests/ModalDialog.test.tsx +1 -1
- package/src/ProductTour/{Checkpoint.test.jsx → Checkpoint.test.tsx} +11 -1
- package/src/ProductTour/CheckpointBody.tsx +21 -0
- package/src/ProductTour/CheckpointTitle.tsx +15 -0
- package/src/StatefulButton/{StatefulButtontest.test.jsx → StatefulButtontest.test.tsx} +4 -4
- package/src/StatefulButton/{index.jsx → index.tsx} +47 -57
- package/src/Stepper/{Stepper.jsx → Stepper.tsx} +18 -12
- package/src/Stepper/StepperActionRow.tsx +41 -0
- package/src/Stepper/{StepperContext.jsx → StepperContext.tsx} +41 -17
- package/src/Stepper/{StepperHeader.jsx → StepperHeader.tsx} +47 -44
- package/src/Stepper/{StepperHeaderStep.jsx → StepperHeaderStep.tsx} +18 -26
- package/src/Stepper/{StepperStep.jsx → StepperStep.tsx} +30 -39
- package/src/Stepper/index.ts +1 -0
- package/src/Stepper/tests/{Stepper.test.jsx → Stepper.test.tsx} +156 -14
- package/src/TransitionReplace/{TransitionReplace.test.jsx → TransitionReplace.test.tsx} +12 -10
- package/src/TransitionReplace/{index.jsx → index.tsx} +63 -72
- package/src/index.ts +4 -8
- package/src/Collapsible/index.jsx +0 -99
- package/src/Form/FormControlDecorator.jsx +0 -21
- package/src/Modal/ModalCloseButton.jsx +0 -45
- package/src/ProductTour/CheckpointBody.jsx +0 -24
- package/src/ProductTour/CheckpointTitle.jsx +0 -18
- package/src/Stepper/StepperActionRow.jsx +0 -40
- /package/{src/Stepper/index.js → dist/Stepper/index.d.ts} +0 -0
- /package/src/StatefulButton/__snapshots__/{StatefulButtontest.test.jsx.snap → StatefulButtontest.test.tsx.snap} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import { useContext, forwardRef, createElement } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import ModalContext from './ModalContext';
|
|
5
4
|
import Button from '../Button';
|
|
6
|
-
const ModalCloseButton = /*#__PURE__*/
|
|
7
|
-
as,
|
|
8
|
-
children,
|
|
5
|
+
const ModalCloseButton = /*#__PURE__*/forwardRef(({
|
|
6
|
+
as = Button,
|
|
7
|
+
children = null,
|
|
8
|
+
className,
|
|
9
|
+
onClick,
|
|
9
10
|
...props
|
|
10
11
|
}, ref) => {
|
|
11
12
|
const {
|
|
@@ -14,11 +15,11 @@ const ModalCloseButton = /*#__PURE__*/React.forwardRef(({
|
|
|
14
15
|
const type = as;
|
|
15
16
|
const componentProps = {
|
|
16
17
|
...props,
|
|
17
|
-
className: classNames('pgn__modal-close-button',
|
|
18
|
+
className: classNames('pgn__modal-close-button', className),
|
|
18
19
|
onClick: () => {
|
|
19
20
|
onClose();
|
|
20
|
-
if (
|
|
21
|
-
|
|
21
|
+
if (onClick) {
|
|
22
|
+
onClick();
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
ref
|
|
@@ -26,23 +27,8 @@ const ModalCloseButton = /*#__PURE__*/React.forwardRef(({
|
|
|
26
27
|
|
|
27
28
|
// Use the non-jsx syntax to create this element so we can more
|
|
28
29
|
// finely control the component type (defaulted to Button via defaultProps)
|
|
29
|
-
return /*#__PURE__*/
|
|
30
|
+
return /*#__PURE__*/createElement(type, componentProps, children);
|
|
30
31
|
});
|
|
31
|
-
ModalCloseButton.
|
|
32
|
-
/** Specifies the base element */
|
|
33
|
-
as: PropTypes.elementType,
|
|
34
|
-
/** Specifies the content of the button */
|
|
35
|
-
children: PropTypes.node,
|
|
36
|
-
/** Specifies class name to append to the base element */
|
|
37
|
-
className: PropTypes.string,
|
|
38
|
-
/** Specifies the callback function when the close button is clicked */
|
|
39
|
-
onClick: PropTypes.func
|
|
40
|
-
};
|
|
41
|
-
ModalCloseButton.defaultProps = {
|
|
42
|
-
as: Button,
|
|
43
|
-
onClick: undefined,
|
|
44
|
-
className: undefined,
|
|
45
|
-
children: null
|
|
46
|
-
};
|
|
32
|
+
ModalCloseButton.displayName = 'ModalCloseButton';
|
|
47
33
|
export default ModalCloseButton;
|
|
48
34
|
//# sourceMappingURL=ModalCloseButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalCloseButton.js","names":["
|
|
1
|
+
{"version":3,"file":"ModalCloseButton.js","names":["useContext","forwardRef","createElement","classNames","ModalContext","Button","ModalCloseButton","as","children","className","onClick","props","ref","onClose","type","componentProps","displayName"],"sources":["../../src/Modal/ModalCloseButton.tsx"],"sourcesContent":["import {\n useContext, ReactNode, ElementType, forwardRef, createElement,\n} from 'react';\nimport classNames from 'classnames';\nimport ModalContext from './ModalContext';\nimport Button, { type ButtonProps } from '../Button';\nimport type { ComponentWithAsProp } from '../utils/types/bootstrap';\n\nexport interface ModalCloseButtonProps extends Omit<ButtonProps, 'children' | 'onClick'> {\n /** Specifies the base element */\n as?: ElementType;\n /** Specifies the content of the button */\n children?: ReactNode;\n /** Specifies class name to append to the base element */\n className?: string;\n /** Specifies the callback function when the close button is clicked */\n onClick?: () => void;\n}\n\nconst ModalCloseButton: ComponentWithAsProp<'button', ModalCloseButtonProps> = forwardRef(({\n as = Button,\n children = null,\n className,\n onClick,\n ...props\n}: ModalCloseButtonProps, ref: React.ForwardedRef<HTMLButtonElement>) => {\n const { onClose } = useContext(ModalContext);\n const type = as;\n const componentProps = {\n ...props,\n className: classNames('pgn__modal-close-button', className),\n onClick: () => {\n onClose();\n if (onClick) {\n onClick();\n }\n },\n ref,\n };\n\n // Use the non-jsx syntax to create this element so we can more\n // finely control the component type (defaulted to Button via defaultProps)\n return createElement(type, componentProps, children);\n});\n\nModalCloseButton.displayName = 'ModalCloseButton';\n\nexport default ModalCloseButton;\n"],"mappings":"AAAA,SACEA,UAAU,EAA0BC,UAAU,EAAEC,aAAa,QACxD,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,MAAM,MAA4B,WAAW;AAcpD,MAAMC,gBAAsE,gBAAGL,UAAU,CAAC,CAAC;EACzFM,EAAE,GAAGF,MAAM;EACXG,QAAQ,GAAG,IAAI;EACfC,SAAS;EACTC,OAAO;EACP,GAAGC;AACkB,CAAC,EAAEC,GAA0C,KAAK;EACvE,MAAM;IAAEC;EAAQ,CAAC,GAAGb,UAAU,CAACI,YAAY,CAAC;EAC5C,MAAMU,IAAI,GAAGP,EAAE;EACf,MAAMQ,cAAc,GAAG;IACrB,GAAGJ,KAAK;IACRF,SAAS,EAAEN,UAAU,CAAC,yBAAyB,EAAEM,SAAS,CAAC;IAC3DC,OAAO,EAAEA,CAAA,KAAM;MACbG,OAAO,CAAC,CAAC;MACT,IAAIH,OAAO,EAAE;QACXA,OAAO,CAAC,CAAC;MACX;IACF,CAAC;IACDE;EACF,CAAC;;EAED;EACA;EACA,oBAAOV,aAAa,CAACY,IAAI,EAAEC,cAAc,EAAEP,QAAQ,CAAC;AACtD,CAAC,CAAC;AAEFF,gBAAgB,CAACU,WAAW,GAAG,kBAAkB;AAEjD,eAAeV,gBAAgB","ignoreList":[]}
|
|
@@ -43,7 +43,7 @@ declare namespace ModalDialog {
|
|
|
43
43
|
var Header: import("react-bootstrap/esm/helpers").BsPrefixRefForwardingComponent<"div", import("./ModalDialogHeader").Props>;
|
|
44
44
|
var Title: any;
|
|
45
45
|
var Footer: any;
|
|
46
|
-
var CloseButton:
|
|
46
|
+
var CloseButton: import("../utils/types/bootstrap").ComponentWithAsProp<"button", import("./ModalCloseButton").ModalCloseButtonProps>;
|
|
47
47
|
var Body: any;
|
|
48
48
|
var Hero: any;
|
|
49
49
|
}
|
|
@@ -3,7 +3,6 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { useMediaQuery } from 'react-responsive';
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
5
|
import ModalLayer from './ModalLayer';
|
|
6
|
-
// @ts-ignore for now - this needs to be converted to TypeScript
|
|
7
6
|
import ModalCloseButton from './ModalCloseButton';
|
|
8
7
|
import ModalDialogHeader from './ModalDialogHeader';
|
|
9
8
|
// @ts-ignore for now - this needs to be converted to TypeScript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalDialog.js","names":["React","classNames","useMediaQuery","useIntl","ModalLayer","ModalCloseButton","ModalDialogHeader","ModalDialogTitle","ModalDialogFooter","ModalDialogBody","ModalDialogHero","Icon","IconButton","Close","messages","ModalDialog","children","title","isOpen","onClose","size","variant","hasCloseButton","closeLabel","isFullscreenScroll","className","isFullscreenOnMobile","isBlocking","zIndex","isOverflowVisible","intl","closeButtonText","formatMessage","isMobile","query","showFullScreen","createElement","role","as","iconAs","invertColors","src","alt","Header","Title","Footer","CloseButton","Body","Hero"],"sources":["../../src/Modal/ModalDialog.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { useMediaQuery } from 'react-responsive';\nimport { useIntl } from 'react-intl';\nimport ModalLayer from './ModalLayer';\
|
|
1
|
+
{"version":3,"file":"ModalDialog.js","names":["React","classNames","useMediaQuery","useIntl","ModalLayer","ModalCloseButton","ModalDialogHeader","ModalDialogTitle","ModalDialogFooter","ModalDialogBody","ModalDialogHero","Icon","IconButton","Close","messages","ModalDialog","children","title","isOpen","onClose","size","variant","hasCloseButton","closeLabel","isFullscreenScroll","className","isFullscreenOnMobile","isBlocking","zIndex","isOverflowVisible","intl","closeButtonText","formatMessage","isMobile","query","showFullScreen","createElement","role","as","iconAs","invertColors","src","alt","Header","Title","Footer","CloseButton","Body","Hero"],"sources":["../../src/Modal/ModalDialog.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { useMediaQuery } from 'react-responsive';\nimport { useIntl } from 'react-intl';\nimport ModalLayer from './ModalLayer';\nimport ModalCloseButton from './ModalCloseButton';\nimport ModalDialogHeader from './ModalDialogHeader';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogTitle from './ModalDialogTitle';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogFooter from './ModalDialogFooter';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogBody from './ModalDialogBody';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ModalDialogHero from './ModalDialogHero';\n\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { Close } from '../../icons';\nimport messages from './messages';\n\ninterface Props {\n /** Specifies the content of the dialog */\n children: React.ReactNode;\n /** The aria-label of the dialog */\n title: string;\n /** A callback to close the modal dialog, e.g. when Escape is pressed */\n onClose: () => void;\n /** Is the modal dialog open or closed? */\n isOpen?: boolean;\n /** The close 'x' icon button in the top right of the dialog box */\n hasCloseButton?: boolean;\n /** Size determines the maximum width of the dialog box */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';\n /** The visual style of the dialog box */\n variant?: 'default' | 'warning' | 'danger' | 'success' | 'dark';\n /** The label supplied to the close icon button if one is rendered */\n closeLabel?: string;\n /** Specifies class name to append to the base element */\n className?: string;\n /**\n * Determines where a scrollbar should appear if a modal is too large for the\n * viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true\n * the browser window itself receives the scrollbar.\n */\n isFullscreenScroll?: boolean;\n /** To show full screen view on mobile screens */\n isFullscreenOnMobile?: boolean;\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking?: boolean;\n /** Specifies the z-index of the modal */\n zIndex?: number;\n /**\n * Specifies whether overflow content inside the modal should be visible.\n * - `true` - content that exceeds the modal boundaries will remain visible outside the modal's main viewport,\n * rather than being clipped or hidden.\n * - `false` - any overflow content will be clipped to fit within the modal's dimensions.\n */\n isOverflowVisible: boolean;\n}\n\nfunction ModalDialog({\n children,\n title,\n isOpen = false,\n onClose,\n size = 'md',\n variant = 'default',\n hasCloseButton = true,\n closeLabel,\n isFullscreenScroll = false,\n className,\n isFullscreenOnMobile = false,\n isBlocking = false,\n zIndex,\n isOverflowVisible,\n}: Props) {\n const intl = useIntl();\n const closeButtonText = closeLabel || intl.formatMessage(messages.closeButtonText);\n const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });\n const showFullScreen = (isFullscreenOnMobile && isMobile);\n return (\n <ModalLayer isOpen={isOpen} onClose={onClose} isBlocking={isBlocking} zIndex={zIndex}>\n <div\n role=\"dialog\"\n aria-label={title}\n className={classNames(\n 'pgn__modal',\n {\n [`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,\n [`pgn__modal-${variant}`]: variant,\n 'pgn__modal-scroll-fullscreen': isFullscreenScroll,\n 'pgn__modal-visible-overflow': isOverflowVisible,\n },\n className,\n )}\n >\n {hasCloseButton && (\n <div className=\"pgn__modal-close-container\">\n <ModalCloseButton\n as={IconButton}\n iconAs={Icon}\n invertColors={variant === 'dark'}\n src={Close}\n alt={closeButtonText}\n />\n </div>\n )}\n {children}\n </div>\n </ModalLayer>\n );\n}\n\nModalDialog.Header = ModalDialogHeader;\nModalDialog.Title = ModalDialogTitle;\nModalDialog.Footer = ModalDialogFooter;\nModalDialog.CloseButton = ModalCloseButton;\nModalDialog.Body = ModalDialogBody;\nModalDialog.Hero = ModalDialogHero;\n\nexport default ModalDialog;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,OAAO,QAAQ,YAAY;AACpC,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD;AACA,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD;AACA,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD;AACA,OAAOC,eAAe,MAAM,mBAAmB;AAC/C;AACA,OAAOC,eAAe,MAAM,mBAAmB;AAE/C,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,KAAK,QAAQ,aAAa;AACnC,OAAOC,QAAQ,MAAM,YAAY;AA0CjC,SAASC,WAAWA,CAAC;EACnBC,QAAQ;EACRC,KAAK;EACLC,MAAM,GAAG,KAAK;EACdC,OAAO;EACPC,IAAI,GAAG,IAAI;EACXC,OAAO,GAAG,SAAS;EACnBC,cAAc,GAAG,IAAI;EACrBC,UAAU;EACVC,kBAAkB,GAAG,KAAK;EAC1BC,SAAS;EACTC,oBAAoB,GAAG,KAAK;EAC5BC,UAAU,GAAG,KAAK;EAClBC,MAAM;EACNC;AACK,CAAC,EAAE;EACR,MAAMC,IAAI,GAAG3B,OAAO,CAAC,CAAC;EACtB,MAAM4B,eAAe,GAAGR,UAAU,IAAIO,IAAI,CAACE,aAAa,CAAClB,QAAQ,CAACiB,eAAe,CAAC;EAClF,MAAME,QAAQ,GAAG/B,aAAa,CAAC;IAAEgC,KAAK,EAAE;EAAwB,CAAC,CAAC;EAClE,MAAMC,cAAc,GAAIT,oBAAoB,IAAIO,QAAS;EACzD,oBACEjC,KAAA,CAAAoC,aAAA,CAAChC,UAAU;IAACc,MAAM,EAAEA,MAAO;IAACC,OAAO,EAAEA,OAAQ;IAACQ,UAAU,EAAEA,UAAW;IAACC,MAAM,EAAEA;EAAO,gBACnF5B,KAAA,CAAAoC,aAAA;IACEC,IAAI,EAAC,QAAQ;IACb,cAAYpB,KAAM;IAClBQ,SAAS,EAAExB,UAAU,CACnB,YAAY,EACZ;MACE,CAAC,cAAckC,cAAc,GAAG,YAAY,GAAGf,IAAI,EAAE,GAAGA,IAAI;MAC5D,CAAC,cAAcC,OAAO,EAAE,GAAGA,OAAO;MAClC,8BAA8B,EAAEG,kBAAkB;MAClD,6BAA6B,EAAEK;IACjC,CAAC,EACDJ,SACF;EAAE,GAEDH,cAAc,iBACbtB,KAAA,CAAAoC,aAAA;IAAKX,SAAS,EAAC;EAA4B,gBACzCzB,KAAA,CAAAoC,aAAA,CAAC/B,gBAAgB;IACfiC,EAAE,EAAE1B,UAAW;IACf2B,MAAM,EAAE5B,IAAK;IACb6B,YAAY,EAAEnB,OAAO,KAAK,MAAO;IACjCoB,GAAG,EAAE5B,KAAM;IACX6B,GAAG,EAAEX;EAAgB,CACtB,CACE,CACN,EACAf,QACE,CACK,CAAC;AAEjB;AAEAD,WAAW,CAAC4B,MAAM,GAAGrC,iBAAiB;AACtCS,WAAW,CAAC6B,KAAK,GAAGrC,gBAAgB;AACpCQ,WAAW,CAAC8B,MAAM,GAAGrC,iBAAiB;AACtCO,WAAW,CAAC+B,WAAW,GAAGzC,gBAAgB;AAC1CU,WAAW,CAACgC,IAAI,GAAGtC,eAAe;AAClCM,WAAW,CAACiC,IAAI,GAAGtC,eAAe;AAElC,eAAeK,WAAW","ignoreList":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
children
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
const CheckpointBody = /*#__PURE__*/forwardRef(({
|
|
3
|
+
children = null
|
|
5
4
|
}, ref) => {
|
|
6
5
|
if (!children) {
|
|
7
6
|
return null;
|
|
@@ -11,11 +10,5 @@ const CheckpointBody = /*#__PURE__*/React.forwardRef(({
|
|
|
11
10
|
ref: ref
|
|
12
11
|
}, children);
|
|
13
12
|
});
|
|
14
|
-
CheckpointBody.defaultProps = {
|
|
15
|
-
children: null
|
|
16
|
-
};
|
|
17
|
-
CheckpointBody.propTypes = {
|
|
18
|
-
children: PropTypes.node
|
|
19
|
-
};
|
|
20
13
|
export default CheckpointBody;
|
|
21
14
|
//# sourceMappingURL=CheckpointBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckpointBody.js","names":["React","
|
|
1
|
+
{"version":3,"file":"CheckpointBody.js","names":["React","forwardRef","CheckpointBody","children","ref","createElement","className"],"sources":["../../src/ProductTour/CheckpointBody.tsx"],"sourcesContent":["import React, { forwardRef, ForwardedRef, ReactNode } from 'react';\n\ninterface CheckpointBodyProps {\n children?: ReactNode;\n}\n\nconst CheckpointBody = forwardRef(({\n children = null,\n}: CheckpointBodyProps, ref: ForwardedRef<HTMLDivElement>) => {\n if (!children) {\n return null;\n }\n\n return (\n <div className=\"pgn__checkpoint-body\" ref={ref}>\n {children}\n </div>\n );\n});\n\nexport default CheckpointBody;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAiC,OAAO;AAMlE,MAAMC,cAAc,gBAAGD,UAAU,CAAC,CAAC;EACjCE,QAAQ,GAAG;AACQ,CAAC,EAAEC,GAAiC,KAAK;EAC5D,IAAI,CAACD,QAAQ,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBACEH,KAAA,CAAAK,aAAA;IAAKC,SAAS,EAAC,sBAAsB;IAACF,GAAG,EAAEA;EAAI,GAC5CD,QACE,CAAC;AAEV,CAAC,CAAC;AAEF,eAAeD,cAAc","ignoreList":[]}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
children
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
const CheckpointTitle = /*#__PURE__*/forwardRef(({
|
|
3
|
+
children = null
|
|
5
4
|
}, ref) => /*#__PURE__*/React.createElement("h2", {
|
|
6
5
|
id: "pgn__checkpoint-title",
|
|
7
6
|
ref: ref
|
|
8
7
|
}, children));
|
|
9
|
-
CheckpointTitle.defaultProps = {
|
|
10
|
-
children: null
|
|
11
|
-
};
|
|
12
|
-
CheckpointTitle.propTypes = {
|
|
13
|
-
children: PropTypes.node
|
|
14
|
-
};
|
|
15
8
|
export default CheckpointTitle;
|
|
16
9
|
//# sourceMappingURL=CheckpointTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckpointTitle.js","names":["React","
|
|
1
|
+
{"version":3,"file":"CheckpointTitle.js","names":["React","forwardRef","CheckpointTitle","children","ref","createElement","id"],"sources":["../../src/ProductTour/CheckpointTitle.tsx"],"sourcesContent":["import React, { forwardRef, ForwardedRef, ReactNode } from 'react';\n\ninterface CheckpointTitleProps {\n children?: ReactNode;\n}\n\nconst CheckpointTitle = forwardRef(({\n children = null,\n}: CheckpointTitleProps, ref: ForwardedRef<HTMLHeadingElement>) => (\n <h2 id=\"pgn__checkpoint-title\" ref={ref}>\n {children}\n </h2>\n));\n\nexport default CheckpointTitle;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAiC,OAAO;AAMlE,MAAMC,eAAe,gBAAGD,UAAU,CAAC,CAAC;EAClCE,QAAQ,GAAG;AACS,CAAC,EAAEC,GAAqC,kBAC5DJ,KAAA,CAAAK,aAAA;EAAIC,EAAE,EAAC,uBAAuB;EAACF,GAAG,EAAEA;AAAI,GACrCD,QACC,CACL,CAAC;AAEF,eAAeD,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '../Button';
|
|
3
|
+
export interface StatefulButtonProps extends React.ComponentPropsWithoutRef<typeof Button> {
|
|
4
|
+
/** Optionally specify additional CSS classes to give this button. */
|
|
5
|
+
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Each state has:
|
|
8
|
+
* - A label (required)
|
|
9
|
+
* - An icon
|
|
10
|
+
* - an option to be disabled
|
|
11
|
+
*
|
|
12
|
+
* Control the state with the `state` prop. Example usage:
|
|
13
|
+
*
|
|
14
|
+
* ```jsx
|
|
15
|
+
* <StatefulButton
|
|
16
|
+
* state="pending"
|
|
17
|
+
* labels={{
|
|
18
|
+
* default: 'Download',
|
|
19
|
+
* pending: 'Downloading',
|
|
20
|
+
* complete: 'Downloaded',
|
|
21
|
+
* }}
|
|
22
|
+
* icons={{
|
|
23
|
+
* default: <Icon className="fa fa-download" />,
|
|
24
|
+
* pending: <Icon className="fa fa-spinner fa-spin" />,
|
|
25
|
+
* complete: <Icon className="fa fa-check" />,
|
|
26
|
+
* }}
|
|
27
|
+
* disabledStates=['pending']
|
|
28
|
+
* className='btn-primary mr-2'
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
state?: string;
|
|
33
|
+
/** Each state has a `label`. Required. */
|
|
34
|
+
labels: {
|
|
35
|
+
[key: string]: React.ReactNode;
|
|
36
|
+
};
|
|
37
|
+
/** Each state has an `icon`. */
|
|
38
|
+
icons?: {
|
|
39
|
+
[key: string]: React.ReactNode;
|
|
40
|
+
};
|
|
41
|
+
/** States listed in `disabledStates` will not be clickable */
|
|
42
|
+
disabledStates?: string[];
|
|
43
|
+
}
|
|
44
|
+
declare function StatefulButton({ className, state, labels, icons, disabledStates, onClick, ...attributes }: StatefulButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export default StatefulButton;
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import { Cancel, CheckCircleOutline, SpinnerSimple } from '../../icons';
|
|
5
4
|
import Button from '../Button';
|
|
6
5
|
import Icon from '../Icon';
|
|
7
6
|
function StatefulButton({
|
|
8
7
|
className,
|
|
9
|
-
state,
|
|
8
|
+
state = 'default',
|
|
10
9
|
labels,
|
|
11
|
-
icons
|
|
12
|
-
|
|
10
|
+
icons = {
|
|
11
|
+
default: undefined,
|
|
12
|
+
pending: /*#__PURE__*/React.createElement(Icon, {
|
|
13
|
+
src: SpinnerSimple,
|
|
14
|
+
className: classNames('icon-spin')
|
|
15
|
+
}),
|
|
16
|
+
complete: /*#__PURE__*/React.createElement(Icon, {
|
|
17
|
+
src: CheckCircleOutline
|
|
18
|
+
}),
|
|
19
|
+
error: /*#__PURE__*/React.createElement(Icon, {
|
|
20
|
+
src: Cancel
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
disabledStates = ['pending', 'complete'],
|
|
13
24
|
onClick,
|
|
14
25
|
...attributes
|
|
15
26
|
}) {
|
|
@@ -45,62 +56,5 @@ function StatefulButton({
|
|
|
45
56
|
className: "sr-only"
|
|
46
57
|
}, state)));
|
|
47
58
|
}
|
|
48
|
-
StatefulButton.propTypes = {
|
|
49
|
-
className: PropTypes.string,
|
|
50
|
-
/**
|
|
51
|
-
* Each state has:
|
|
52
|
-
* - A label (required)
|
|
53
|
-
* - An icon
|
|
54
|
-
* - an option to be disabled
|
|
55
|
-
*
|
|
56
|
-
* Control the state with the `state` prop. Example usage:
|
|
57
|
-
*
|
|
58
|
-
* ```jsx
|
|
59
|
-
* <StatefulButton
|
|
60
|
-
* state="pending"
|
|
61
|
-
* labels={{
|
|
62
|
-
* default: 'Download',
|
|
63
|
-
* pending: 'Downloading',
|
|
64
|
-
* complete: 'Downloaded',
|
|
65
|
-
* }}
|
|
66
|
-
* icons={{
|
|
67
|
-
* default: <Icon className="fa fa-download" />,
|
|
68
|
-
* pending: <Icon className="fa fa-spinner fa-spin" />,
|
|
69
|
-
* complete: <Icon className="fa fa-check" />,
|
|
70
|
-
* }}
|
|
71
|
-
* disabledStates=['pending']
|
|
72
|
-
* className='btn-primary mr-2'
|
|
73
|
-
* />
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
state: PropTypes.string,
|
|
77
|
-
/** Required. Each state has a `label`. */
|
|
78
|
-
labels: PropTypes.objectOf(PropTypes.node).isRequired,
|
|
79
|
-
/** Required. Each state has an `icon`. */
|
|
80
|
-
icons: PropTypes.objectOf(PropTypes.node),
|
|
81
|
-
/** Required. Each state has a `disabledState` */
|
|
82
|
-
disabledStates: PropTypes.arrayOf(PropTypes.string),
|
|
83
|
-
/** Specifies the callback function when the button is clicked */
|
|
84
|
-
onClick: PropTypes.func
|
|
85
|
-
};
|
|
86
|
-
StatefulButton.defaultProps = {
|
|
87
|
-
className: undefined,
|
|
88
|
-
state: 'default',
|
|
89
|
-
icons: {
|
|
90
|
-
default: undefined,
|
|
91
|
-
pending: /*#__PURE__*/React.createElement(Icon, {
|
|
92
|
-
src: SpinnerSimple,
|
|
93
|
-
className: classNames('icon-spin')
|
|
94
|
-
}),
|
|
95
|
-
complete: /*#__PURE__*/React.createElement(Icon, {
|
|
96
|
-
src: CheckCircleOutline
|
|
97
|
-
}),
|
|
98
|
-
error: /*#__PURE__*/React.createElement(Icon, {
|
|
99
|
-
src: Cancel
|
|
100
|
-
})
|
|
101
|
-
},
|
|
102
|
-
disabledStates: ['pending', 'complete'],
|
|
103
|
-
onClick: undefined
|
|
104
|
-
};
|
|
105
59
|
export default StatefulButton;
|
|
106
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","Cancel","CheckCircleOutline","SpinnerSimple","Button","Icon","StatefulButton","className","state","labels","icons","default","undefined","pending","createElement","src","complete","error","disabledStates","onClick","attributes","isDisabled","indexOf","icon","label","disabled","e","preventDefault"],"sources":["../../src/StatefulButton/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { Cancel, CheckCircleOutline, SpinnerSimple } from '../../icons';\nimport Button from '../Button';\nimport Icon from '../Icon';\n\nexport interface StatefulButtonProps extends React.ComponentPropsWithoutRef<typeof Button> {\n /** Optionally specify additional CSS classes to give this button. */\n className?: string;\n /**\n * Each state has:\n * - A label (required)\n * - An icon\n * - an option to be disabled\n *\n * Control the state with the `state` prop. Example usage:\n *\n * ```jsx\n * <StatefulButton\n * state=\"pending\"\n * labels={{\n * default: 'Download',\n * pending: 'Downloading',\n * complete: 'Downloaded',\n * }}\n * icons={{\n * default: <Icon className=\"fa fa-download\" />,\n * pending: <Icon className=\"fa fa-spinner fa-spin\" />,\n * complete: <Icon className=\"fa fa-check\" />,\n * }}\n * disabledStates=['pending']\n * className='btn-primary mr-2'\n * />\n * ```\n */\n state?: string;\n /** Each state has a `label`. Required. */\n labels: { [key: string]: React.ReactNode };\n /** Each state has an `icon`. */\n icons?: { [key: string]: React.ReactNode };\n /** States listed in `disabledStates` will not be clickable */\n disabledStates?: string[];\n}\n\nfunction StatefulButton({\n className,\n state = 'default',\n labels,\n icons = {\n default: undefined,\n pending: <Icon src={SpinnerSimple} className={classNames('icon-spin')} />,\n complete: <Icon src={CheckCircleOutline} />,\n error: <Icon src={Cancel} />,\n },\n disabledStates = ['pending', 'complete'],\n onClick,\n ...attributes\n}: StatefulButtonProps) {\n const isDisabled = disabledStates.indexOf(state) !== -1;\n const icon = icons[state] !== undefined ? icons[state] : icons.default;\n const label = labels[state] !== undefined ? labels[state] : labels.default;\n\n return (\n <Button\n aria-live=\"assertive\"\n aria-disabled={isDisabled}\n className={classNames(\n 'pgn__stateful-btn',\n `pgn__stateful-btn-state-${state}`,\n className,\n { disabled: isDisabled },\n )}\n onClick={(e) => {\n // Swallow clicks if the button is disabled.\n // We do this instead of disabling the button to prevent\n // it from losing focus (disabled elements cannot have focus).\n if (isDisabled) {\n e.preventDefault();\n return;\n }\n\n if (onClick) {\n onClick(e);\n }\n }}\n {...attributes}\n >\n <span className=\"d-flex align-items-center justify-content-center\">\n {icon && <span className={classNames({ 'pgn__stateful-btn-icon': !!label })}>{icon}</span>}\n {label ? <span>{label}</span> : <span className=\"sr-only\">{state}</span>}\n </span>\n </Button>\n );\n}\n\nexport default StatefulButton;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,EAAEC,kBAAkB,EAAEC,aAAa,QAAQ,aAAa;AACvE,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,IAAI,MAAM,SAAS;AAwC1B,SAASC,cAAcA,CAAC;EACtBC,SAAS;EACTC,KAAK,GAAG,SAAS;EACjBC,MAAM;EACNC,KAAK,GAAG;IACNC,OAAO,EAAEC,SAAS;IAClBC,OAAO,eAAEd,KAAA,CAAAe,aAAA,CAACT,IAAI;MAACU,GAAG,EAAEZ,aAAc;MAACI,SAAS,EAAEP,UAAU,CAAC,WAAW;IAAE,CAAE,CAAC;IACzEgB,QAAQ,eAAEjB,KAAA,CAAAe,aAAA,CAACT,IAAI;MAACU,GAAG,EAAEb;IAAmB,CAAE,CAAC;IAC3Ce,KAAK,eAAElB,KAAA,CAAAe,aAAA,CAACT,IAAI;MAACU,GAAG,EAAEd;IAAO,CAAE;EAC7B,CAAC;EACDiB,cAAc,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC;EACxCC,OAAO;EACP,GAAGC;AACgB,CAAC,EAAE;EACtB,MAAMC,UAAU,GAAGH,cAAc,CAACI,OAAO,CAACd,KAAK,CAAC,KAAK,CAAC,CAAC;EACvD,MAAMe,IAAI,GAAGb,KAAK,CAACF,KAAK,CAAC,KAAKI,SAAS,GAAGF,KAAK,CAACF,KAAK,CAAC,GAAGE,KAAK,CAACC,OAAO;EACtE,MAAMa,KAAK,GAAGf,MAAM,CAACD,KAAK,CAAC,KAAKI,SAAS,GAAGH,MAAM,CAACD,KAAK,CAAC,GAAGC,MAAM,CAACE,OAAO;EAE1E,oBACEZ,KAAA,CAAAe,aAAA,CAACV,MAAM;IACL,aAAU,WAAW;IACrB,iBAAeiB,UAAW;IAC1Bd,SAAS,EAAEP,UAAU,CACnB,mBAAmB,EACnB,2BAA2BQ,KAAK,EAAE,EAClCD,SAAS,EACT;MAAEkB,QAAQ,EAAEJ;IAAW,CACzB,CAAE;IACFF,OAAO,EAAGO,CAAC,IAAK;MACd;MACA;MACA;MACA,IAAIL,UAAU,EAAE;QACdK,CAAC,CAACC,cAAc,CAAC,CAAC;QAClB;MACF;MAEA,IAAIR,OAAO,EAAE;QACXA,OAAO,CAACO,CAAC,CAAC;MACZ;IACF,CAAE;IAAA,GACEN;EAAU,gBAEdrB,KAAA,CAAAe,aAAA;IAAMP,SAAS,EAAC;EAAkD,GAC/DgB,IAAI,iBAAIxB,KAAA,CAAAe,aAAA;IAAMP,SAAS,EAAEP,UAAU,CAAC;MAAE,wBAAwB,EAAE,CAAC,CAACwB;IAAM,CAAC;EAAE,GAAED,IAAW,CAAC,EACzFC,KAAK,gBAAGzB,KAAA,CAAAe,aAAA,eAAOU,KAAY,CAAC,gBAAGzB,KAAA,CAAAe,aAAA;IAAMP,SAAS,EAAC;EAAS,GAAEC,KAAY,CACnE,CACA,CAAC;AAEb;AAEA,eAAeF,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import StepperStep from './StepperStep';
|
|
3
|
+
import StepperHeader from './StepperHeader';
|
|
4
|
+
import StepperActionRow from './StepperActionRow';
|
|
5
|
+
export interface StepperProps {
|
|
6
|
+
/**
|
|
7
|
+
* Specifies the content of the `Stepper`.
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* The eventKey of the step to display.
|
|
12
|
+
*/
|
|
13
|
+
activeKey: string;
|
|
14
|
+
}
|
|
15
|
+
interface StepperComponent {
|
|
16
|
+
(props: StepperProps): JSX.Element;
|
|
17
|
+
Step: typeof StepperStep;
|
|
18
|
+
Header: typeof StepperHeader;
|
|
19
|
+
ActionRow: typeof StepperActionRow;
|
|
20
|
+
}
|
|
21
|
+
declare const Stepper: StepperComponent;
|
|
22
|
+
export default Stepper;
|
package/dist/Stepper/Stepper.js
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import StepperStep from './StepperStep';
|
|
4
3
|
import StepperHeader from './StepperHeader';
|
|
5
4
|
import StepperActionRow from './StepperActionRow';
|
|
6
5
|
import { StepperContextProvider } from './StepperContext';
|
|
7
|
-
function Stepper({
|
|
6
|
+
const Stepper = function Stepper({
|
|
8
7
|
children,
|
|
9
8
|
activeKey
|
|
10
9
|
}) {
|
|
11
10
|
return /*#__PURE__*/React.createElement(StepperContextProvider, {
|
|
12
11
|
activeKey: activeKey
|
|
13
12
|
}, children);
|
|
14
|
-
}
|
|
15
|
-
Stepper.propTypes = {
|
|
16
|
-
/**
|
|
17
|
-
* Specifies the content of the `Stepper`.
|
|
18
|
-
*/
|
|
19
|
-
children: PropTypes.node.isRequired,
|
|
20
|
-
/**
|
|
21
|
-
* The eventKey of the step to display.
|
|
22
|
-
*/
|
|
23
|
-
activeKey: PropTypes.string.isRequired
|
|
24
13
|
};
|
|
25
14
|
Stepper.Step = StepperStep;
|
|
26
15
|
Stepper.Header = StepperHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stepper.js","names":["React","
|
|
1
|
+
{"version":3,"file":"Stepper.js","names":["React","StepperStep","StepperHeader","StepperActionRow","StepperContextProvider","Stepper","children","activeKey","createElement","Step","Header","ActionRow"],"sources":["../../src/Stepper/Stepper.tsx"],"sourcesContent":["import React from 'react';\nimport StepperStep from './StepperStep';\nimport StepperHeader from './StepperHeader';\nimport StepperActionRow from './StepperActionRow';\nimport { StepperContextProvider } from './StepperContext';\n\nexport interface StepperProps {\n /**\n * Specifies the content of the `Stepper`.\n */\n children: React.ReactNode;\n /**\n * The eventKey of the step to display.\n */\n activeKey: string;\n}\n\ninterface StepperComponent {\n (props: StepperProps): JSX.Element;\n Step: typeof StepperStep;\n Header: typeof StepperHeader;\n ActionRow: typeof StepperActionRow;\n}\n\nconst Stepper: StepperComponent = function Stepper({ children, activeKey }: StepperProps) {\n return (\n <StepperContextProvider activeKey={activeKey}>\n {children}\n </StepperContextProvider>\n );\n};\n\nStepper.Step = StepperStep;\nStepper.Header = StepperHeader;\nStepper.ActionRow = StepperActionRow;\n\nexport default Stepper;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,sBAAsB,QAAQ,kBAAkB;AAoBzD,MAAMC,OAAyB,GAAG,SAASA,OAAOA,CAAC;EAAEC,QAAQ;EAAEC;AAAwB,CAAC,EAAE;EACxF,oBACEP,KAAA,CAAAQ,aAAA,CAACJ,sBAAsB;IAACG,SAAS,EAAEA;EAAU,GAC1CD,QACqB,CAAC;AAE7B,CAAC;AAEDD,OAAO,CAACI,IAAI,GAAGR,WAAW;AAC1BI,OAAO,CAACK,MAAM,GAAGR,aAAa;AAC9BG,OAAO,CAACM,SAAS,GAAGR,gBAAgB;AAEpC,eAAeE,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ActionRow from '../ActionRow';
|
|
3
|
+
import type { ComponentWithAsProp } from '../utils/types/bootstrap';
|
|
4
|
+
export interface StepperActionRowProps {
|
|
5
|
+
/** Specifies the content of the `ActionRow`. */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* An identifier of the `ActionRow`. When `activeKey` on the
|
|
9
|
+
* `Stepper` equals to the `eventKey`, the `ActionRow` will be displayed.
|
|
10
|
+
*/
|
|
11
|
+
eventKey: string;
|
|
12
|
+
/** Specifies the base element */
|
|
13
|
+
as?: React.ElementType;
|
|
14
|
+
}
|
|
15
|
+
type StepperActionRowComponent = ComponentWithAsProp<'div', StepperActionRowProps> & {
|
|
16
|
+
Spacer: typeof ActionRow.Spacer;
|
|
17
|
+
};
|
|
18
|
+
declare const _default: StepperActionRowComponent;
|
|
19
|
+
export default _default;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { useContext, forwardRef } from 'react';
|
|
3
2
|
import { StepperContext } from './StepperContext';
|
|
4
3
|
import ActionRow from '../ActionRow';
|
|
5
|
-
|
|
6
|
-
as,
|
|
4
|
+
const StepperActionRow = /*#__PURE__*/forwardRef(({
|
|
5
|
+
as = ActionRow,
|
|
7
6
|
children,
|
|
8
7
|
eventKey,
|
|
9
8
|
...props
|
|
10
|
-
}) {
|
|
9
|
+
}, ref) => {
|
|
11
10
|
const {
|
|
12
11
|
activeKey
|
|
13
12
|
} = useContext(StepperContext);
|
|
@@ -15,22 +14,12 @@ function StepperActionRow({
|
|
|
15
14
|
if (!isActive) {
|
|
16
15
|
return null;
|
|
17
16
|
}
|
|
18
|
-
return /*#__PURE__*/React.createElement(as,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* An identifier of the `ActionRow`. When `activeKey` on the
|
|
25
|
-
* `Stepper` equals to the `eventKey`, the `ActionRow` will be displayed.
|
|
26
|
-
*/
|
|
27
|
-
eventKey: PropTypes.string.isRequired,
|
|
28
|
-
/** Specifies the base element */
|
|
29
|
-
as: PropTypes.elementType
|
|
30
|
-
};
|
|
31
|
-
StepperActionRow.defaultProps = {
|
|
32
|
-
as: ActionRow
|
|
33
|
-
};
|
|
17
|
+
return /*#__PURE__*/React.createElement(as, {
|
|
18
|
+
...props,
|
|
19
|
+
ref
|
|
20
|
+
}, children);
|
|
21
|
+
});
|
|
34
22
|
StepperActionRow.Spacer = ActionRow.Spacer;
|
|
23
|
+
StepperActionRow.displayName = 'StepperActionRow';
|
|
35
24
|
export default StepperActionRow;
|
|
36
25
|
//# sourceMappingURL=StepperActionRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepperActionRow.js","names":["React","useContext","
|
|
1
|
+
{"version":3,"file":"StepperActionRow.js","names":["React","useContext","forwardRef","StepperContext","ActionRow","StepperActionRow","as","children","eventKey","props","ref","activeKey","isActive","createElement","Spacer","displayName"],"sources":["../../src/Stepper/StepperActionRow.tsx"],"sourcesContent":["import React, { useContext, forwardRef } from 'react';\nimport { StepperContext } from './StepperContext';\nimport ActionRow from '../ActionRow';\nimport type { ComponentWithAsProp } from '../utils/types/bootstrap';\n\nexport interface StepperActionRowProps {\n /** Specifies the content of the `ActionRow`. */\n children: React.ReactNode;\n /**\n * An identifier of the `ActionRow`. When `activeKey` on the\n * `Stepper` equals to the `eventKey`, the `ActionRow` will be displayed.\n */\n eventKey: string;\n /** Specifies the base element */\n as?: React.ElementType;\n}\n\ntype StepperActionRowComponent = ComponentWithAsProp<'div', StepperActionRowProps> & {\n Spacer: typeof ActionRow.Spacer;\n};\n\nconst StepperActionRow: ComponentWithAsProp<'div', StepperActionRowProps> = forwardRef(({\n as = ActionRow,\n children,\n eventKey,\n ...props\n}: StepperActionRowProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const { activeKey } = useContext(StepperContext);\n const isActive = activeKey === eventKey;\n\n if (!isActive) {\n return null;\n }\n\n return React.createElement(as, { ...props, ref }, children);\n});\n\n(StepperActionRow as StepperActionRowComponent).Spacer = ActionRow.Spacer;\nStepperActionRow.displayName = 'StepperActionRow';\n\nexport default StepperActionRow as StepperActionRowComponent;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,UAAU,QAAQ,OAAO;AACrD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,OAAOC,SAAS,MAAM,cAAc;AAmBpC,MAAMC,gBAAmE,gBAAGH,UAAU,CAAC,CAAC;EACtFI,EAAE,GAAGF,SAAS;EACdG,QAAQ;EACRC,QAAQ;EACR,GAAGC;AACkB,CAAC,EAAEC,GAAuC,KAAK;EACpE,MAAM;IAAEC;EAAU,CAAC,GAAGV,UAAU,CAACE,cAAc,CAAC;EAChD,MAAMS,QAAQ,GAAGD,SAAS,KAAKH,QAAQ;EAEvC,IAAI,CAACI,QAAQ,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBAAOZ,KAAK,CAACa,aAAa,CAACP,EAAE,EAAE;IAAE,GAAGG,KAAK;IAAEC;EAAI,CAAC,EAAEH,QAAQ,CAAC;AAC7D,CAAC,CAAC;AAEDF,gBAAgB,CAA+BS,MAAM,GAAGV,SAAS,CAACU,MAAM;AACzET,gBAAgB,CAACU,WAAW,GAAG,kBAAkB;AAEjD,eAAeV,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface Step {
|
|
3
|
+
eventKey: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
hasError?: boolean;
|
|
7
|
+
index?: number;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface StepperContextValue {
|
|
11
|
+
activeKey: string;
|
|
12
|
+
registerStep: (step: Step) => void;
|
|
13
|
+
steps: Step[];
|
|
14
|
+
removeStep: (eventKey: string) => void;
|
|
15
|
+
getIsViewed: (index: number) => boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const StepperContext: React.Context<StepperContextValue>;
|
|
18
|
+
type StepsAction = {
|
|
19
|
+
type: 'register';
|
|
20
|
+
step: Step;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'remove';
|
|
23
|
+
eventKey: string;
|
|
24
|
+
};
|
|
25
|
+
declare const stepsReducer: (stepsState: Step[], action: StepsAction) => Step[];
|
|
26
|
+
export interface StepperContextProviderProps {
|
|
27
|
+
/** Specifies the content of the `ContextProvider`. */
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
/** Specifies the current step of the `Stepper`. */
|
|
30
|
+
activeKey: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function StepperContextProvider({ children, activeKey }: StepperContextProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export { stepsReducer };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useReducer, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
export const StepperContext = /*#__PURE__*/React.createContext({
|
|
4
|
-
activeKey: ''
|
|
3
|
+
activeKey: '',
|
|
4
|
+
registerStep: () => {},
|
|
5
|
+
steps: [],
|
|
6
|
+
removeStep: () => {},
|
|
7
|
+
getIsViewed: () => false
|
|
5
8
|
});
|
|
6
9
|
const stepsReducer = (stepsState, action) => {
|
|
7
10
|
let newStepsState = [];
|
|
@@ -23,8 +26,8 @@ const stepsReducer = (stepsState, action) => {
|
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
// If using the index prop
|
|
26
|
-
if (stepsState.some(step => step.index)) {
|
|
27
|
-
return newStepsState.sort((a, b) => a.index > b.index ? 1 : -1);
|
|
29
|
+
if (stepsState.some(step => step.index !== undefined)) {
|
|
30
|
+
return newStepsState.sort((a, b) => (a.index || 0) > (b.index || 0) ? 1 : -1);
|
|
28
31
|
}
|
|
29
32
|
return newStepsState;
|
|
30
33
|
}
|
|
@@ -58,11 +61,5 @@ export function StepperContextProvider({
|
|
|
58
61
|
}
|
|
59
62
|
}, children);
|
|
60
63
|
}
|
|
61
|
-
StepperContextProvider.propTypes = {
|
|
62
|
-
/** Specifies the content of the `ContextProvider`. */
|
|
63
|
-
children: PropTypes.node.isRequired,
|
|
64
|
-
/** Specifies the current step of the `Stepper`. */
|
|
65
|
-
activeKey: PropTypes.node.isRequired
|
|
66
|
-
};
|
|
67
64
|
export { stepsReducer };
|
|
68
65
|
//# sourceMappingURL=StepperContext.js.map
|