@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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface CardFooterProps {
|
|
3
|
+
/** Specifies contents of the component. */
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** Specifies class name to append to the base element. */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Optional node to display near actions. Should be either a plain text or an element containing text (e.g. link). */
|
|
8
|
+
textElement?: ReactNode;
|
|
9
|
+
/** Specifies whether to use stacked variant. */
|
|
10
|
+
isStacked?: boolean;
|
|
11
|
+
/** Specifies which orientation to use. This prop will override context value if provided. */
|
|
12
|
+
orientation?: 'horizontal' | 'vertical';
|
|
13
|
+
/** Specifies height of skeleton in loading state. */
|
|
14
|
+
skeletonHeight?: number;
|
|
15
|
+
/** Specifies width of skeleton in loading state. */
|
|
16
|
+
skeletonWidth?: number;
|
|
17
|
+
}
|
|
18
|
+
declare const CardFooter: React.ForwardRefExoticComponent<CardFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export default CardFooter;
|
package/dist/Card/CardFooter.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { useContext, forwardRef } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import Skeleton from 'react-loading-skeleton';
|
|
5
4
|
import CardContext from './CardContext';
|
|
6
5
|
const IS_LOADING_HEIGHT_VALUE = 18;
|
|
7
|
-
const CardFooter = /*#__PURE__*/
|
|
8
|
-
children,
|
|
6
|
+
const CardFooter = /*#__PURE__*/forwardRef(({
|
|
7
|
+
children = null,
|
|
9
8
|
className,
|
|
10
|
-
isStacked,
|
|
9
|
+
isStacked = false,
|
|
11
10
|
textElement,
|
|
12
|
-
skeletonHeight,
|
|
11
|
+
skeletonHeight = IS_LOADING_HEIGHT_VALUE,
|
|
13
12
|
skeletonWidth,
|
|
14
13
|
orientation
|
|
15
14
|
}, ref) => {
|
|
@@ -36,30 +35,5 @@ const CardFooter = /*#__PURE__*/React.forwardRef(({
|
|
|
36
35
|
className: textElementClassName
|
|
37
36
|
}, textElement), children);
|
|
38
37
|
});
|
|
39
|
-
CardFooter.propTypes = {
|
|
40
|
-
/** Specifies contents of the component. */
|
|
41
|
-
children: PropTypes.node,
|
|
42
|
-
/** Specifies class name to append to the base element. */
|
|
43
|
-
className: PropTypes.string,
|
|
44
|
-
/** Optional node to display near actions. Should be either a plain text or an element containing text (e.g. link). */
|
|
45
|
-
textElement: PropTypes.node,
|
|
46
|
-
/** Specifies whether to use stacked variant. */
|
|
47
|
-
isStacked: PropTypes.bool,
|
|
48
|
-
/** Specifies which orientation to use. This prop will override context value if provided. */
|
|
49
|
-
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
50
|
-
/** Specifies height of skeleton in loading state. */
|
|
51
|
-
skeletonHeight: PropTypes.number,
|
|
52
|
-
/** Specifies width of skeleton in loading state. */
|
|
53
|
-
skeletonWidth: PropTypes.number
|
|
54
|
-
};
|
|
55
|
-
CardFooter.defaultProps = {
|
|
56
|
-
children: null,
|
|
57
|
-
className: undefined,
|
|
58
|
-
textElement: undefined,
|
|
59
|
-
isStacked: false,
|
|
60
|
-
orientation: undefined,
|
|
61
|
-
skeletonHeight: IS_LOADING_HEIGHT_VALUE,
|
|
62
|
-
skeletonWidth: undefined
|
|
63
|
-
};
|
|
64
38
|
export default CardFooter;
|
|
65
39
|
//# sourceMappingURL=CardFooter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardFooter.js","names":["React","useContext","
|
|
1
|
+
{"version":3,"file":"CardFooter.js","names":["React","useContext","forwardRef","classNames","Skeleton","CardContext","IS_LOADING_HEIGHT_VALUE","CardFooter","children","className","isStacked","textElement","skeletonHeight","skeletonWidth","orientation","ref","cardOrientation","isLoading","footerOrientation","wrapperClassName","textElementClassName","createElement","containerClassName","height","width"],"sources":["../../src/Card/CardFooter.tsx"],"sourcesContent":["import React, {\n useContext, forwardRef, ForwardedRef, ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport Skeleton from 'react-loading-skeleton';\nimport CardContext from './CardContext';\n\nconst IS_LOADING_HEIGHT_VALUE = 18;\n\ninterface CardFooterProps {\n /** Specifies contents of the component. */\n children?: ReactNode;\n /** Specifies class name to append to the base element. */\n className?: string;\n /** Optional node to display near actions. Should be either a plain text or an element containing text (e.g. link). */\n textElement?: ReactNode;\n /** Specifies whether to use stacked variant. */\n isStacked?: boolean;\n /** Specifies which orientation to use. This prop will override context value if provided. */\n orientation?: 'horizontal' | 'vertical';\n /** Specifies height of skeleton in loading state. */\n skeletonHeight?: number;\n /** Specifies width of skeleton in loading state. */\n skeletonWidth?: number;\n}\n\nconst CardFooter = forwardRef(({\n children = null,\n className,\n isStacked = false,\n textElement,\n skeletonHeight = IS_LOADING_HEIGHT_VALUE,\n skeletonWidth,\n orientation,\n}: CardFooterProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { orientation: cardOrientation, isLoading } = useContext(CardContext);\n const footerOrientation = orientation || cardOrientation;\n const wrapperClassName = `pgn__card-footer ${footerOrientation}${isStacked ? '-stacked' : ''}`;\n const textElementClassName = `pgn__card-footer-text ${footerOrientation}${isStacked ? '-stacked' : ''}`;\n\n if (isLoading) {\n return (\n <div className={classNames(className, wrapperClassName)}>\n <Skeleton\n containerClassName=\"pgn__card-footer-loader\"\n height={skeletonHeight}\n width={skeletonWidth}\n />\n </div>\n );\n }\n\n return (\n <div className={classNames(className, wrapperClassName)} ref={ref}>\n {textElement && <div className={textElementClassName}>{textElement}</div>}\n {children}\n </div>\n );\n});\n\nexport default CardFooter;\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,UAAU,EAAEC,UAAU,QACjB,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,uBAAuB,GAAG,EAAE;AAmBlC,MAAMC,UAAU,gBAAGL,UAAU,CAAC,CAAC;EAC7BM,QAAQ,GAAG,IAAI;EACfC,SAAS;EACTC,SAAS,GAAG,KAAK;EACjBC,WAAW;EACXC,cAAc,GAAGN,uBAAuB;EACxCO,aAAa;EACbC;AACe,CAAC,EAAEC,GAAiC,KAAK;EACxD,MAAM;IAAED,WAAW,EAAEE,eAAe;IAAEC;EAAU,CAAC,GAAGhB,UAAU,CAACI,WAAW,CAAC;EAC3E,MAAMa,iBAAiB,GAAGJ,WAAW,IAAIE,eAAe;EACxD,MAAMG,gBAAgB,GAAG,oBAAoBD,iBAAiB,GAAGR,SAAS,GAAG,UAAU,GAAG,EAAE,EAAE;EAC9F,MAAMU,oBAAoB,GAAG,yBAAyBF,iBAAiB,GAAGR,SAAS,GAAG,UAAU,GAAG,EAAE,EAAE;EAEvG,IAAIO,SAAS,EAAE;IACb,oBACEjB,KAAA,CAAAqB,aAAA;MAAKZ,SAAS,EAAEN,UAAU,CAACM,SAAS,EAAEU,gBAAgB;IAAE,gBACtDnB,KAAA,CAAAqB,aAAA,CAACjB,QAAQ;MACPkB,kBAAkB,EAAC,yBAAyB;MAC5CC,MAAM,EAAEX,cAAe;MACvBY,KAAK,EAAEX;IAAc,CACtB,CACE,CAAC;EAEV;EAEA,oBACEb,KAAA,CAAAqB,aAAA;IAAKZ,SAAS,EAAEN,UAAU,CAACM,SAAS,EAAEU,gBAAgB,CAAE;IAACJ,GAAG,EAAEA;EAAI,GAC/DJ,WAAW,iBAAIX,KAAA,CAAAqB,aAAA;IAAKZ,SAAS,EAAEW;EAAqB,GAAET,WAAiB,CAAC,EACxEH,QACE,CAAC;AAEV,CAAC,CAAC;AAEF,eAAeD,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface CardSectionProps {
|
|
3
|
+
/** Specifies class name to append to the base element. */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Specifies contents of the component. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/** Specifies title of the `Section`. */
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
/** Specifies node to render on the bottom right of the `Section` (i.e. `ActionRow`). */
|
|
10
|
+
actions?: ReactNode;
|
|
11
|
+
/** Specifies whether to display `Section` with muted styling. */
|
|
12
|
+
muted?: boolean;
|
|
13
|
+
/** Specifies height of skeleton in loading state. */
|
|
14
|
+
skeletonHeight?: number;
|
|
15
|
+
/** Specifies width of skeleton in loading state. */
|
|
16
|
+
skeletonWidth?: number;
|
|
17
|
+
}
|
|
18
|
+
declare const CardSection: React.ForwardRefExoticComponent<CardSectionProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export default CardSection;
|
package/dist/Card/CardSection.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { useContext, forwardRef } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import Skeleton from 'react-loading-skeleton';
|
|
5
4
|
import CardContext from './CardContext';
|
|
6
5
|
const SKELETON_HEIGHT_VALUE = 100;
|
|
7
|
-
const CardSection = /*#__PURE__*/
|
|
6
|
+
const CardSection = /*#__PURE__*/forwardRef(({
|
|
8
7
|
className,
|
|
9
|
-
children,
|
|
8
|
+
children = null,
|
|
10
9
|
title,
|
|
11
10
|
actions,
|
|
12
|
-
muted,
|
|
13
|
-
skeletonHeight,
|
|
11
|
+
muted = false,
|
|
12
|
+
skeletonHeight = SKELETON_HEIGHT_VALUE,
|
|
14
13
|
skeletonWidth
|
|
15
14
|
}, ref) => {
|
|
16
15
|
const {
|
|
@@ -38,30 +37,5 @@ const CardSection = /*#__PURE__*/React.forwardRef(({
|
|
|
38
37
|
className: "pgn__card-section-actions"
|
|
39
38
|
}, actions));
|
|
40
39
|
});
|
|
41
|
-
CardSection.propTypes = {
|
|
42
|
-
/** Specifies class name to append to the base element. */
|
|
43
|
-
className: PropTypes.string,
|
|
44
|
-
/** Specifies contents of the component. */
|
|
45
|
-
children: PropTypes.node,
|
|
46
|
-
/** Specifies title of the `Section`. */
|
|
47
|
-
title: PropTypes.node,
|
|
48
|
-
/** Specifies node to render on the bottom right of the `Section` (i.e. `ActionRow`). */
|
|
49
|
-
actions: PropTypes.node,
|
|
50
|
-
/** Specifies whether to display `Section` with muted styling. */
|
|
51
|
-
muted: PropTypes.bool,
|
|
52
|
-
/** Specifies height of skeleton in loading state. */
|
|
53
|
-
skeletonHeight: PropTypes.number,
|
|
54
|
-
/** Specifies width of skeleton in loading state. */
|
|
55
|
-
skeletonWidth: PropTypes.number
|
|
56
|
-
};
|
|
57
|
-
CardSection.defaultProps = {
|
|
58
|
-
children: null,
|
|
59
|
-
className: undefined,
|
|
60
|
-
title: undefined,
|
|
61
|
-
actions: undefined,
|
|
62
|
-
muted: false,
|
|
63
|
-
skeletonHeight: SKELETON_HEIGHT_VALUE,
|
|
64
|
-
skeletonWidth: undefined
|
|
65
|
-
};
|
|
66
40
|
export default CardSection;
|
|
67
41
|
//# sourceMappingURL=CardSection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardSection.js","names":["React","useContext","
|
|
1
|
+
{"version":3,"file":"CardSection.js","names":["React","useContext","forwardRef","classNames","Skeleton","CardContext","SKELETON_HEIGHT_VALUE","CardSection","className","children","title","actions","muted","skeletonHeight","skeletonWidth","ref","isLoading","createElement","containerClassName","height","width"],"sources":["../../src/Card/CardSection.tsx"],"sourcesContent":["import React, {\n useContext, forwardRef, ForwardedRef, ReactNode,\n} from 'react';\nimport classNames from 'classnames';\nimport Skeleton from 'react-loading-skeleton';\nimport CardContext from './CardContext';\n\nconst SKELETON_HEIGHT_VALUE = 100;\n\ninterface CardSectionProps {\n /** Specifies class name to append to the base element. */\n className?: string;\n /** Specifies contents of the component. */\n children?: ReactNode;\n /** Specifies title of the `Section`. */\n title?: ReactNode;\n /** Specifies node to render on the bottom right of the `Section` (i.e. `ActionRow`). */\n actions?: ReactNode;\n /** Specifies whether to display `Section` with muted styling. */\n muted?: boolean;\n /** Specifies height of skeleton in loading state. */\n skeletonHeight?: number;\n /** Specifies width of skeleton in loading state. */\n skeletonWidth?: number;\n}\n\nconst CardSection = forwardRef(({\n className,\n children = null,\n title,\n actions,\n muted = false,\n skeletonHeight = SKELETON_HEIGHT_VALUE,\n skeletonWidth,\n}: CardSectionProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { isLoading } = useContext(CardContext);\n\n if (isLoading) {\n return (\n <div className={classNames('pgn__card-section', className, { 'is-muted': muted })}>\n <Skeleton\n containerClassName=\"pgn__card-section-loader\"\n height={skeletonHeight}\n width={skeletonWidth}\n />\n </div>\n );\n }\n\n return (\n <div\n className={classNames('pgn__card-section', className, { 'is-muted': muted })}\n ref={ref}\n >\n {title && <div className=\"pgn__card-section-title\">{title}</div>}\n {children}\n {actions && <div className=\"pgn__card-section-actions\">{actions}</div>}\n </div>\n );\n});\n\nexport default CardSection;\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,UAAU,EAAEC,UAAU,QACjB,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,qBAAqB,GAAG,GAAG;AAmBjC,MAAMC,WAAW,gBAAGL,UAAU,CAAC,CAAC;EAC9BM,SAAS;EACTC,QAAQ,GAAG,IAAI;EACfC,KAAK;EACLC,OAAO;EACPC,KAAK,GAAG,KAAK;EACbC,cAAc,GAAGP,qBAAqB;EACtCQ;AACgB,CAAC,EAAEC,GAAiC,KAAK;EACzD,MAAM;IAAEC;EAAU,CAAC,GAAGf,UAAU,CAACI,WAAW,CAAC;EAE7C,IAAIW,SAAS,EAAE;IACb,oBACEhB,KAAA,CAAAiB,aAAA;MAAKT,SAAS,EAAEL,UAAU,CAAC,mBAAmB,EAAEK,SAAS,EAAE;QAAE,UAAU,EAAEI;MAAM,CAAC;IAAE,gBAChFZ,KAAA,CAAAiB,aAAA,CAACb,QAAQ;MACPc,kBAAkB,EAAC,0BAA0B;MAC7CC,MAAM,EAAEN,cAAe;MACvBO,KAAK,EAAEN;IAAc,CACtB,CACE,CAAC;EAEV;EAEA,oBACEd,KAAA,CAAAiB,aAAA;IACET,SAAS,EAAEL,UAAU,CAAC,mBAAmB,EAAEK,SAAS,EAAE;MAAE,UAAU,EAAEI;IAAM,CAAC,CAAE;IAC7EG,GAAG,EAAEA;EAAI,GAERL,KAAK,iBAAIV,KAAA,CAAAiB,aAAA;IAAKT,SAAS,EAAC;EAAyB,GAAEE,KAAW,CAAC,EAC/DD,QAAQ,EACRE,OAAO,iBAAIX,KAAA,CAAAiB,aAAA;IAAKT,SAAS,EAAC;EAA2B,GAAEG,OAAa,CAClE,CAAC;AAEV,CAAC,CAAC;AAEF,eAAeJ,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { ReactNode, FC } from 'react';
|
|
2
|
+
interface CardStatusProps {
|
|
3
|
+
/** The class to append to the base element. */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Specifies the content of the component. */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Specifies variant to use. */
|
|
8
|
+
variant?: 'primary' | 'success' | 'danger' | 'warning';
|
|
9
|
+
/** Icon that will be shown in the top-left corner. */
|
|
10
|
+
icon?: FC;
|
|
11
|
+
/** Specifies title for the `Card.Status`. */
|
|
12
|
+
title?: ReactNode | string;
|
|
13
|
+
/** Specifies any optional actions, e.g. button(s). */
|
|
14
|
+
actions?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const CardStatus: React.ForwardRefExoticComponent<CardStatusProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export default CardStatus;
|
package/dist/Card/CardStatus.js
CHANGED
|
@@ -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 classNames from 'classnames';
|
|
4
3
|
import Skeleton from 'react-loading-skeleton';
|
|
5
4
|
import Icon from '../Icon';
|
|
6
5
|
import CardContext from './CardContext';
|
|
7
|
-
const CardStatus = /*#__PURE__*/
|
|
6
|
+
const CardStatus = /*#__PURE__*/forwardRef(({
|
|
8
7
|
className,
|
|
9
8
|
children,
|
|
10
|
-
variant,
|
|
9
|
+
variant = 'warning',
|
|
11
10
|
icon,
|
|
12
11
|
title,
|
|
13
12
|
actions,
|
|
@@ -40,26 +39,5 @@ const CardStatus = /*#__PURE__*/React.forwardRef(({
|
|
|
40
39
|
className: "pgn__card-status__actions"
|
|
41
40
|
}, actions));
|
|
42
41
|
});
|
|
43
|
-
CardStatus.propTypes = {
|
|
44
|
-
/** Specifies the content of the component. */
|
|
45
|
-
children: PropTypes.node.isRequired,
|
|
46
|
-
/** The class to append to the base element. */
|
|
47
|
-
className: PropTypes.string,
|
|
48
|
-
/** Icon that will be shown in the top-left corner. */
|
|
49
|
-
icon: PropTypes.func,
|
|
50
|
-
/** Specifies variant to use. */
|
|
51
|
-
variant: PropTypes.oneOf(['primary', 'success', 'danger', 'warning']),
|
|
52
|
-
/** Specifies title for the `Card.Status`. */
|
|
53
|
-
title: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
|
|
54
|
-
/** Specifies any optional actions, e.g. button(s). */
|
|
55
|
-
actions: PropTypes.node
|
|
56
|
-
};
|
|
57
|
-
CardStatus.defaultProps = {
|
|
58
|
-
className: undefined,
|
|
59
|
-
icon: undefined,
|
|
60
|
-
variant: 'warning',
|
|
61
|
-
title: undefined,
|
|
62
|
-
actions: undefined
|
|
63
|
-
};
|
|
64
42
|
export default CardStatus;
|
|
65
43
|
//# sourceMappingURL=CardStatus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardStatus.js","names":["React","useContext","
|
|
1
|
+
{"version":3,"file":"CardStatus.js","names":["React","useContext","forwardRef","classNames","Skeleton","Icon","CardContext","CardStatus","className","children","variant","icon","title","actions","props","ref","isLoading","createElement","src"],"sources":["../../src/Card/CardStatus.tsx"],"sourcesContent":["import React, {\n useContext, forwardRef, ReactNode, FC, ForwardedRef,\n} from 'react';\nimport classNames from 'classnames';\nimport Skeleton from 'react-loading-skeleton';\nimport Icon from '../Icon';\nimport CardContext from './CardContext';\n\ninterface CardStatusProps {\n /** The class to append to the base element. */\n className?: string;\n /** Specifies the content of the component. */\n children: ReactNode;\n /** Specifies variant to use. */\n variant?: 'primary' | 'success' | 'danger' | 'warning';\n /** Icon that will be shown in the top-left corner. */\n icon?: FC;\n /** Specifies title for the `Card.Status`. */\n title?: ReactNode | string;\n /** Specifies any optional actions, e.g. button(s). */\n actions?: ReactNode;\n}\n\nconst CardStatus = forwardRef(({\n className,\n children,\n variant = 'warning',\n icon,\n title,\n actions,\n ...props\n}: CardStatusProps, ref: ForwardedRef<HTMLDivElement>) => {\n const { isLoading } = useContext(CardContext);\n\n if (isLoading) {\n return (\n <div\n className={classNames(\n 'pgn__card-status',\n className,\n )}\n data-testid=\"card-status-skeleton\"\n ref={ref}\n >\n <Skeleton />\n </div>\n );\n }\n\n return (\n <div\n className={classNames(\n 'pgn__card-status',\n `pgn__card-status__${variant}`,\n className,\n )}\n ref={ref}\n {...props}\n >\n <div className=\"pgn__card-status__content\">\n {icon && <Icon className=\"pgn__card-status__content-icon\" src={icon} />}\n <div className=\"pgn__card-status__message-content\">\n {title && <div className=\"pgn__card-status__heading\">{title}</div>}\n {children}\n </div>\n </div>\n {!!actions && (\n <div className=\"pgn__card-status__actions\">\n {actions}\n </div>\n )}\n </div>\n );\n});\n\nexport default CardStatus;\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,UAAU,EAAEC,UAAU,QACjB,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,WAAW,MAAM,eAAe;AAiBvC,MAAMC,UAAU,gBAAGL,UAAU,CAAC,CAAC;EAC7BM,SAAS;EACTC,QAAQ;EACRC,OAAO,GAAG,SAAS;EACnBC,IAAI;EACJC,KAAK;EACLC,OAAO;EACP,GAAGC;AACY,CAAC,EAAEC,GAAiC,KAAK;EACxD,MAAM;IAAEC;EAAU,CAAC,GAAGf,UAAU,CAACK,WAAW,CAAC;EAE7C,IAAIU,SAAS,EAAE;IACb,oBACEhB,KAAA,CAAAiB,aAAA;MACET,SAAS,EAAEL,UAAU,CACnB,kBAAkB,EAClBK,SACF,CAAE;MACF,eAAY,sBAAsB;MAClCO,GAAG,EAAEA;IAAI,gBAETf,KAAA,CAAAiB,aAAA,CAACb,QAAQ,MAAE,CACR,CAAC;EAEV;EAEA,oBACEJ,KAAA,CAAAiB,aAAA;IACET,SAAS,EAAEL,UAAU,CACnB,kBAAkB,EAClB,qBAAqBO,OAAO,EAAE,EAC9BF,SACF,CAAE;IACFO,GAAG,EAAEA,GAAI;IAAA,GACLD;EAAK,gBAETd,KAAA,CAAAiB,aAAA;IAAKT,SAAS,EAAC;EAA2B,GACvCG,IAAI,iBAAIX,KAAA,CAAAiB,aAAA,CAACZ,IAAI;IAACG,SAAS,EAAC,gCAAgC;IAACU,GAAG,EAAEP;EAAK,CAAE,CAAC,eACvEX,KAAA,CAAAiB,aAAA;IAAKT,SAAS,EAAC;EAAmC,GAC/CI,KAAK,iBAAIZ,KAAA,CAAAiB,aAAA;IAAKT,SAAS,EAAC;EAA2B,GAAEI,KAAW,CAAC,EACjEH,QACE,CACF,CAAC,EACL,CAAC,CAACI,OAAO,iBACRb,KAAA,CAAAiB,aAAA;IAAKT,SAAS,EAAC;EAA2B,GACvCK,OACE,CAEJ,CAAC;AAEV,CAAC,CAAC;AAEF,eAAeN,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CollapsibleContextValue {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
open: () => void;
|
|
5
|
+
close: () => void;
|
|
6
|
+
toggle: () => void;
|
|
7
|
+
unmountOnExit: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const CollapsibleContext: React.Context<CollapsibleContextValue | undefined>;
|
|
10
|
+
export interface CollapsibleAdvancedProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
11
|
+
/** Specifies contents of the component. */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/** Specifies classname to append to the base element. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Specifies whether `Collapsible` should be initially open. */
|
|
16
|
+
defaultOpen?: boolean;
|
|
17
|
+
/** Specifies whether `Collapsible` is open. */
|
|
18
|
+
open?: boolean;
|
|
19
|
+
/** Callback fired when `Collapsible's` state is toggled. */
|
|
20
|
+
onToggle?: (isOpen: boolean) => void;
|
|
21
|
+
/** Callback fired when `Collapsible` opens. */
|
|
22
|
+
onOpen?: () => void;
|
|
23
|
+
/** Callback fired when `Collapsible` closes. */
|
|
24
|
+
onClose?: () => void;
|
|
25
|
+
/** Unmount the component (remove it from the DOM) when it is collapsed. */
|
|
26
|
+
unmountOnExit?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface CollapsibleAdvancedState {
|
|
29
|
+
isOpen: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare class CollapsibleAdvanced extends React.Component<CollapsibleAdvancedProps, CollapsibleAdvancedState> {
|
|
32
|
+
static getDerivedStateFromProps(props: CollapsibleAdvancedProps): {
|
|
33
|
+
isOpen: boolean;
|
|
34
|
+
} | null;
|
|
35
|
+
constructor(props: CollapsibleAdvancedProps);
|
|
36
|
+
open: () => void;
|
|
37
|
+
close: () => void;
|
|
38
|
+
toggle: () => void;
|
|
39
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
}
|
|
41
|
+
export default CollapsibleAdvanced;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
|
|
4
|
-
export const CollapsibleContext = /*#__PURE__*/React.createContext();
|
|
3
|
+
export const CollapsibleContext = /*#__PURE__*/React.createContext(undefined);
|
|
5
4
|
class CollapsibleAdvanced extends React.Component {
|
|
6
5
|
static getDerivedStateFromProps(props) {
|
|
7
6
|
if (props.open !== undefined) {
|
|
@@ -17,7 +16,7 @@ class CollapsibleAdvanced extends React.Component {
|
|
|
17
16
|
constructor(props) {
|
|
18
17
|
super(props);
|
|
19
18
|
this.state = {
|
|
20
|
-
isOpen: props.open !== undefined ? props.open : props.defaultOpen
|
|
19
|
+
isOpen: props.open !== undefined ? props.open : props.defaultOpen ?? false
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
22
|
open = () => {
|
|
@@ -53,15 +52,14 @@ class CollapsibleAdvanced extends React.Component {
|
|
|
53
52
|
const {
|
|
54
53
|
children,
|
|
55
54
|
className,
|
|
56
|
-
unmountOnExit,
|
|
55
|
+
unmountOnExit = true,
|
|
56
|
+
onToggle,
|
|
57
|
+
onOpen,
|
|
58
|
+
onClose,
|
|
59
|
+
open,
|
|
60
|
+
defaultOpen,
|
|
57
61
|
...props
|
|
58
62
|
} = this.props;
|
|
59
|
-
|
|
60
|
-
// Unneeded for passthrough props
|
|
61
|
-
delete props.defaultOpen;
|
|
62
|
-
delete props.onToggle;
|
|
63
|
-
delete props.onOpen;
|
|
64
|
-
delete props.onClose;
|
|
65
63
|
return /*#__PURE__*/React.createElement("div", {
|
|
66
64
|
...props,
|
|
67
65
|
className: classNames('pgn_collapsible', className, {
|
|
@@ -78,33 +76,5 @@ class CollapsibleAdvanced extends React.Component {
|
|
|
78
76
|
}, children));
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
|
-
CollapsibleAdvanced.propTypes = {
|
|
82
|
-
/** Specifies contents of the component. */
|
|
83
|
-
children: PropTypes.node,
|
|
84
|
-
/** Specifies classname to append to the base element. */
|
|
85
|
-
className: PropTypes.string,
|
|
86
|
-
/** Specifies whether `Collapsible` should be initially open. */
|
|
87
|
-
defaultOpen: PropTypes.bool,
|
|
88
|
-
/** Specifies whether `Collapsible` is open. */
|
|
89
|
-
open: PropTypes.bool,
|
|
90
|
-
/** Callback fired when `Collapsible's` state is toggled. */
|
|
91
|
-
onToggle: PropTypes.func,
|
|
92
|
-
/** Callback fired when `Collapsible` opens. */
|
|
93
|
-
onOpen: PropTypes.func,
|
|
94
|
-
/** Callback fired when `Collapsible` closes. */
|
|
95
|
-
onClose: PropTypes.func,
|
|
96
|
-
/** Unmount the component (remove it from the DOM) when it is collapsed. */
|
|
97
|
-
unmountOnExit: PropTypes.bool
|
|
98
|
-
};
|
|
99
|
-
CollapsibleAdvanced.defaultProps = {
|
|
100
|
-
children: undefined,
|
|
101
|
-
className: undefined,
|
|
102
|
-
defaultOpen: false,
|
|
103
|
-
open: undefined,
|
|
104
|
-
onToggle: undefined,
|
|
105
|
-
onOpen: undefined,
|
|
106
|
-
onClose: undefined,
|
|
107
|
-
unmountOnExit: true
|
|
108
|
-
};
|
|
109
79
|
export default CollapsibleAdvanced;
|
|
110
80
|
//# sourceMappingURL=CollapsibleAdvanced.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleAdvanced.js","names":["React","classNames","
|
|
1
|
+
{"version":3,"file":"CollapsibleAdvanced.js","names":["React","classNames","CollapsibleContext","createContext","undefined","CollapsibleAdvanced","Component","getDerivedStateFromProps","props","open","isOpen","constructor","state","defaultOpen","setState","onOpen","onToggle","close","onClose","toggle","render","children","className","unmountOnExit","createElement","Provider","value"],"sources":["../../src/Collapsible/CollapsibleAdvanced.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\n\nexport interface CollapsibleContextValue {\n isOpen: boolean;\n open: () => void;\n close: () => void;\n toggle: () => void;\n unmountOnExit: boolean;\n}\n\nexport const CollapsibleContext = React.createContext<CollapsibleContextValue | undefined>(undefined);\n\nexport interface CollapsibleAdvancedProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Specifies contents of the component. */\n children?: React.ReactNode;\n /** Specifies classname to append to the base element. */\n className?: string;\n /** Specifies whether `Collapsible` should be initially open. */\n defaultOpen?: boolean;\n /** Specifies whether `Collapsible` is open. */\n open?: boolean;\n /** Callback fired when `Collapsible's` state is toggled. */\n onToggle?: (isOpen: boolean) => void;\n /** Callback fired when `Collapsible` opens. */\n onOpen?: () => void;\n /** Callback fired when `Collapsible` closes. */\n onClose?: () => void;\n /** Unmount the component (remove it from the DOM) when it is collapsed. */\n unmountOnExit?: boolean;\n}\n\ninterface CollapsibleAdvancedState {\n isOpen: boolean;\n}\n\nclass CollapsibleAdvanced extends React.Component<CollapsibleAdvancedProps, CollapsibleAdvancedState> {\n static getDerivedStateFromProps(props: CollapsibleAdvancedProps) {\n if (props.open !== undefined) {\n return {\n // Since this method fires on both props and state changes, local updates\n // to the controlled value will be ignored, because the props version\n // always overrides it. In this case, this is exactly what we want.\n isOpen: props.open,\n };\n }\n return null;\n }\n\n constructor(props: CollapsibleAdvancedProps) {\n super(props);\n\n this.state = {\n isOpen: props.open !== undefined ? props.open : props.defaultOpen ?? false,\n };\n }\n\n open = () => {\n this.setState({ isOpen: true });\n\n if (this.props.onOpen) {\n this.props.onOpen();\n }\n if (this.props.onToggle) {\n this.props.onToggle(true);\n }\n };\n\n close = () => {\n this.setState({ isOpen: false });\n\n if (this.props.onClose) {\n this.props.onClose();\n }\n if (this.props.onToggle) {\n this.props.onToggle(false);\n }\n };\n\n toggle = () => {\n if (this.state.isOpen) {\n this.close();\n } else {\n this.open();\n }\n };\n\n render() {\n const {\n children,\n className,\n unmountOnExit = true,\n onToggle,\n onOpen,\n onClose,\n open,\n defaultOpen,\n ...props\n } = this.props;\n\n return (\n <div\n {...props}\n className={classNames('pgn_collapsible', className, {\n 'is-open': this.state.isOpen,\n })}\n >\n <CollapsibleContext.Provider\n value={{\n isOpen: this.state.isOpen,\n open: this.open,\n close: this.close,\n toggle: this.toggle,\n unmountOnExit,\n }}\n >\n {children}\n </CollapsibleContext.Provider>\n </div>\n );\n }\n}\n\nexport default CollapsibleAdvanced;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAUnC,OAAO,MAAMC,kBAAkB,gBAAGF,KAAK,CAACG,aAAa,CAAsCC,SAAS,CAAC;AAyBrG,MAAMC,mBAAmB,SAASL,KAAK,CAACM,SAAS,CAAqD;EACpG,OAAOC,wBAAwBA,CAACC,KAA+B,EAAE;IAC/D,IAAIA,KAAK,CAACC,IAAI,KAAKL,SAAS,EAAE;MAC5B,OAAO;QACL;QACA;QACA;QACAM,MAAM,EAAEF,KAAK,CAACC;MAChB,CAAC;IACH;IACA,OAAO,IAAI;EACb;EAEAE,WAAWA,CAACH,KAA+B,EAAE;IAC3C,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACI,KAAK,GAAG;MACXF,MAAM,EAAEF,KAAK,CAACC,IAAI,KAAKL,SAAS,GAAGI,KAAK,CAACC,IAAI,GAAGD,KAAK,CAACK,WAAW,IAAI;IACvE,CAAC;EACH;EAEAJ,IAAI,GAAGA,CAAA,KAAM;IACX,IAAI,CAACK,QAAQ,CAAC;MAAEJ,MAAM,EAAE;IAAK,CAAC,CAAC;IAE/B,IAAI,IAAI,CAACF,KAAK,CAACO,MAAM,EAAE;MACrB,IAAI,CAACP,KAAK,CAACO,MAAM,CAAC,CAAC;IACrB;IACA,IAAI,IAAI,CAACP,KAAK,CAACQ,QAAQ,EAAE;MACvB,IAAI,CAACR,KAAK,CAACQ,QAAQ,CAAC,IAAI,CAAC;IAC3B;EACF,CAAC;EAEDC,KAAK,GAAGA,CAAA,KAAM;IACZ,IAAI,CAACH,QAAQ,CAAC;MAAEJ,MAAM,EAAE;IAAM,CAAC,CAAC;IAEhC,IAAI,IAAI,CAACF,KAAK,CAACU,OAAO,EAAE;MACtB,IAAI,CAACV,KAAK,CAACU,OAAO,CAAC,CAAC;IACtB;IACA,IAAI,IAAI,CAACV,KAAK,CAACQ,QAAQ,EAAE;MACvB,IAAI,CAACR,KAAK,CAACQ,QAAQ,CAAC,KAAK,CAAC;IAC5B;EACF,CAAC;EAEDG,MAAM,GAAGA,CAAA,KAAM;IACb,IAAI,IAAI,CAACP,KAAK,CAACF,MAAM,EAAE;MACrB,IAAI,CAACO,KAAK,CAAC,CAAC;IACd,CAAC,MAAM;MACL,IAAI,CAACR,IAAI,CAAC,CAAC;IACb;EACF,CAAC;EAEDW,MAAMA,CAAA,EAAG;IACP,MAAM;MACJC,QAAQ;MACRC,SAAS;MACTC,aAAa,GAAG,IAAI;MACpBP,QAAQ;MACRD,MAAM;MACNG,OAAO;MACPT,IAAI;MACJI,WAAW;MACX,GAAGL;IACL,CAAC,GAAG,IAAI,CAACA,KAAK;IAEd,oBACER,KAAA,CAAAwB,aAAA;MAAA,GACMhB,KAAK;MACTc,SAAS,EAAErB,UAAU,CAAC,iBAAiB,EAAEqB,SAAS,EAAE;QAClD,SAAS,EAAE,IAAI,CAACV,KAAK,CAACF;MACxB,CAAC;IAAE,gBAEHV,KAAA,CAAAwB,aAAA,CAACtB,kBAAkB,CAACuB,QAAQ;MAC1BC,KAAK,EAAE;QACLhB,MAAM,EAAE,IAAI,CAACE,KAAK,CAACF,MAAM;QACzBD,IAAI,EAAE,IAAI,CAACA,IAAI;QACfQ,KAAK,EAAE,IAAI,CAACA,KAAK;QACjBE,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBI;MACF;IAAE,GAEDF,QAC0B,CAC1B,CAAC;EAEV;AACF;AAEA,eAAehB,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CollapsibleBodyProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
/** Specifies contents of the component. */
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
/** Specifies content's base element. */
|
|
6
|
+
tag?: string;
|
|
7
|
+
/** Specifies transition element. */
|
|
8
|
+
transitionWrapper?: React.ReactElement;
|
|
9
|
+
}
|
|
10
|
+
declare function CollapsibleBody({ children, transitionWrapper, tag, ...props }: CollapsibleBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default CollapsibleBody;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import Collapse from '../Collapse';
|
|
4
3
|
import { CollapsibleContext } from './CollapsibleAdvanced';
|
|
5
4
|
import TransitionReplace from '../TransitionReplace';
|
|
6
5
|
function CollapsibleBody({
|
|
7
6
|
children,
|
|
8
7
|
transitionWrapper,
|
|
9
|
-
tag,
|
|
8
|
+
tag = 'div',
|
|
10
9
|
...props
|
|
11
10
|
}) {
|
|
11
|
+
const context = useContext(CollapsibleContext);
|
|
12
12
|
const {
|
|
13
13
|
isOpen,
|
|
14
14
|
unmountOnExit
|
|
15
|
-
} =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// transition properly.
|
|
15
|
+
} = context || {
|
|
16
|
+
isOpen: false,
|
|
17
|
+
unmountOnExit: true
|
|
18
|
+
};
|
|
20
19
|
const content = /*#__PURE__*/React.createElement(tag, {
|
|
21
20
|
key: 'body',
|
|
22
21
|
...props
|
|
@@ -32,18 +31,5 @@ function CollapsibleBody({
|
|
|
32
31
|
in: isOpen
|
|
33
32
|
}, content);
|
|
34
33
|
}
|
|
35
|
-
CollapsibleBody.propTypes = {
|
|
36
|
-
/** Specifies contents of the component. */
|
|
37
|
-
children: PropTypes.node,
|
|
38
|
-
/** Specifies content's base element. */
|
|
39
|
-
tag: PropTypes.string,
|
|
40
|
-
/** Specifies transition element. */
|
|
41
|
-
transitionWrapper: PropTypes.element
|
|
42
|
-
};
|
|
43
|
-
CollapsibleBody.defaultProps = {
|
|
44
|
-
children: undefined,
|
|
45
|
-
tag: 'div',
|
|
46
|
-
transitionWrapper: undefined
|
|
47
|
-
};
|
|
48
34
|
export default CollapsibleBody;
|
|
49
35
|
//# sourceMappingURL=CollapsibleBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleBody.js","names":["React","useContext","
|
|
1
|
+
{"version":3,"file":"CollapsibleBody.js","names":["React","useContext","Collapse","CollapsibleContext","TransitionReplace","CollapsibleBody","children","transitionWrapper","tag","props","context","isOpen","unmountOnExit","content","createElement","key","transitionBody","cloneElement","in"],"sources":["../../src/Collapsible/CollapsibleBody.tsx"],"sourcesContent":["import React, { useContext } from 'react';\n\nimport Collapse from '../Collapse';\nimport { CollapsibleContext } from './CollapsibleAdvanced';\nimport TransitionReplace from '../TransitionReplace';\n\nexport interface CollapsibleBodyProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Specifies contents of the component. */\n children?: React.ReactNode;\n /** Specifies content's base element. */\n tag?: string;\n /** Specifies transition element. */\n transitionWrapper?: React.ReactElement;\n}\n\nfunction CollapsibleBody({\n children, transitionWrapper, tag = 'div', ...props\n}: CollapsibleBodyProps) {\n const context = useContext(CollapsibleContext);\n const { isOpen, unmountOnExit } = context || { isOpen: false, unmountOnExit: true };\n\n const content = React.createElement(tag, { key: 'body', ...props }, children);\n const transitionBody = isOpen ? content : <div key=\"empty\" />;\n\n if (transitionWrapper) {\n return React.cloneElement(transitionWrapper, {}, transitionBody);\n }\n /* istanbul ignore next */\n return unmountOnExit\n ? <TransitionReplace>{transitionBody}</TransitionReplace>\n : <Collapse in={isOpen}>{content}</Collapse>;\n}\n\nexport default CollapsibleBody;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,OAAOC,iBAAiB,MAAM,sBAAsB;AAWpD,SAASC,eAAeA,CAAC;EACvBC,QAAQ;EAAEC,iBAAiB;EAAEC,GAAG,GAAG,KAAK;EAAE,GAAGC;AACzB,CAAC,EAAE;EACvB,MAAMC,OAAO,GAAGT,UAAU,CAACE,kBAAkB,CAAC;EAC9C,MAAM;IAAEQ,MAAM;IAAEC;EAAc,CAAC,GAAGF,OAAO,IAAI;IAAEC,MAAM,EAAE,KAAK;IAAEC,aAAa,EAAE;EAAK,CAAC;EAEnF,MAAMC,OAAO,gBAAGb,KAAK,CAACc,aAAa,CAACN,GAAG,EAAE;IAAEO,GAAG,EAAE,MAAM;IAAE,GAAGN;EAAM,CAAC,EAAEH,QAAQ,CAAC;EAC7E,MAAMU,cAAc,GAAGL,MAAM,GAAGE,OAAO,gBAAGb,KAAA,CAAAc,aAAA;IAAKC,GAAG,EAAC;EAAO,CAAE,CAAC;EAE7D,IAAIR,iBAAiB,EAAE;IACrB,oBAAOP,KAAK,CAACiB,YAAY,CAACV,iBAAiB,EAAE,CAAC,CAAC,EAAES,cAAc,CAAC;EAClE;EACA;EACA,OAAOJ,aAAa,gBAChBZ,KAAA,CAAAc,aAAA,CAACV,iBAAiB,QAAEY,cAAkC,CAAC,gBACvDhB,KAAA,CAAAc,aAAA,CAACZ,QAAQ;IAACgB,EAAE,EAAEP;EAAO,GAAEE,OAAkB,CAAC;AAChD;AAEA,eAAeR,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CollapsibleTriggerProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
/** Specifies contents of the component. */
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
/** Specifies base element. */
|
|
6
|
+
tag?: string | React.ElementType;
|
|
7
|
+
/** Specifies whether toggling `Collapsible's` state will always trigger only open action. */
|
|
8
|
+
openOnly?: boolean;
|
|
9
|
+
/** Specifies whether toggling `Collapsible's` state will always trigger only close action. */
|
|
10
|
+
closeOnly?: boolean;
|
|
11
|
+
/** Callback fired when element gets clicked. */
|
|
12
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
13
|
+
/** Callback fired when a key is pressed. */
|
|
14
|
+
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
15
|
+
}
|
|
16
|
+
declare function CollapsibleTrigger({ tag, children, openOnly, closeOnly, onClick, onKeyDown, ...props }: CollapsibleTriggerProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
17
|
+
export default CollapsibleTrigger;
|
|
@@ -1,42 +1,47 @@
|
|
|
1
1
|
import React, { useContext, useCallback } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { CollapsibleContext } from './CollapsibleAdvanced';
|
|
4
3
|
function CollapsibleTrigger({
|
|
5
|
-
tag,
|
|
4
|
+
tag = 'div',
|
|
6
5
|
children,
|
|
7
|
-
openOnly,
|
|
8
|
-
closeOnly,
|
|
6
|
+
openOnly = false,
|
|
7
|
+
closeOnly = false,
|
|
9
8
|
onClick,
|
|
10
9
|
onKeyDown,
|
|
11
10
|
...props
|
|
12
11
|
}) {
|
|
12
|
+
const context = useContext(CollapsibleContext);
|
|
13
13
|
const {
|
|
14
14
|
isOpen,
|
|
15
15
|
open,
|
|
16
16
|
close,
|
|
17
17
|
toggle
|
|
18
|
-
} =
|
|
19
|
-
|
|
18
|
+
} = context || {
|
|
19
|
+
isOpen: false,
|
|
20
|
+
open: () => {},
|
|
21
|
+
close: () => {},
|
|
22
|
+
toggle: () => {}
|
|
23
|
+
};
|
|
24
|
+
const handleToggle = useCallback(() => {
|
|
20
25
|
if (openOnly) {
|
|
21
|
-
open(
|
|
26
|
+
open();
|
|
22
27
|
} else if (closeOnly) {
|
|
23
|
-
close(
|
|
28
|
+
close();
|
|
24
29
|
} else {
|
|
25
|
-
toggle(
|
|
30
|
+
toggle();
|
|
26
31
|
}
|
|
27
32
|
}, [openOnly, open, closeOnly, close, toggle]);
|
|
28
33
|
const handleClick = useCallback(e => {
|
|
29
34
|
if (onClick) {
|
|
30
35
|
onClick(e);
|
|
31
36
|
}
|
|
32
|
-
handleToggle(
|
|
37
|
+
handleToggle();
|
|
33
38
|
}, [onClick, handleToggle]);
|
|
34
39
|
const handleKeyDown = useCallback(e => {
|
|
35
40
|
if (onKeyDown) {
|
|
36
41
|
onKeyDown(e);
|
|
37
42
|
}
|
|
38
43
|
if (e.key === 'Enter') {
|
|
39
|
-
handleToggle(
|
|
44
|
+
handleToggle();
|
|
40
45
|
}
|
|
41
46
|
}, [onKeyDown, handleToggle]);
|
|
42
47
|
return /*#__PURE__*/React.createElement(tag, {
|
|
@@ -48,27 +53,5 @@ function CollapsibleTrigger({
|
|
|
48
53
|
'aria-expanded': isOpen
|
|
49
54
|
}, children);
|
|
50
55
|
}
|
|
51
|
-
CollapsibleTrigger.propTypes = {
|
|
52
|
-
/** Specifies contents of the component. */
|
|
53
|
-
children: PropTypes.node,
|
|
54
|
-
/** Specifies base element. */
|
|
55
|
-
tag: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
56
|
-
/** Specifies whether toggling `Collapsible's` state will always trigger only open action. */
|
|
57
|
-
openOnly: PropTypes.bool,
|
|
58
|
-
/** Specifies whether toggling `Collapsible's` state will always trigger only close action. */
|
|
59
|
-
closeOnly: PropTypes.bool,
|
|
60
|
-
/** Callback fired when element gets clicked. */
|
|
61
|
-
onClick: PropTypes.func,
|
|
62
|
-
/** Callback fired when a key is pressed. */
|
|
63
|
-
onKeyDown: PropTypes.func
|
|
64
|
-
};
|
|
65
|
-
CollapsibleTrigger.defaultProps = {
|
|
66
|
-
children: undefined,
|
|
67
|
-
tag: 'div',
|
|
68
|
-
openOnly: false,
|
|
69
|
-
closeOnly: false,
|
|
70
|
-
onClick: undefined,
|
|
71
|
-
onKeyDown: undefined
|
|
72
|
-
};
|
|
73
56
|
export default CollapsibleTrigger;
|
|
74
57
|
//# sourceMappingURL=CollapsibleTrigger.js.map
|