@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
@@ -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;
@@ -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__*/React.forwardRef(({
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","PropTypes","classNames","Skeleton","CardContext","IS_LOADING_HEIGHT_VALUE","CardFooter","forwardRef","children","className","isStacked","textElement","skeletonHeight","skeletonWidth","orientation","ref","cardOrientation","isLoading","footerOrientation","wrapperClassName","textElementClassName","createElement","containerClassName","height","width","propTypes","node","string","bool","oneOf","number","defaultProps","undefined"],"sources":["../../src/Card/CardFooter.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport Skeleton from 'react-loading-skeleton';\nimport CardContext from './CardContext';\n\nconst IS_LOADING_HEIGHT_VALUE = 18;\n\nconst CardFooter = React.forwardRef(({\n children,\n className,\n isStacked,\n textElement,\n skeletonHeight,\n skeletonWidth,\n orientation,\n}, ref) => {\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\nCardFooter.propTypes = {\n /** Specifies contents of the component. */\n children: PropTypes.node,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Optional node to display near actions. Should be either a plain text or an element containing text (e.g. link). */\n textElement: PropTypes.node,\n /** Specifies whether to use stacked variant. */\n isStacked: PropTypes.bool,\n /** Specifies which orientation to use. This prop will override context value if provided. */\n orientation: PropTypes.oneOf(['horizontal', 'vertical']),\n /** Specifies height of skeleton in loading state. */\n skeletonHeight: PropTypes.number,\n /** Specifies width of skeleton in loading state. */\n skeletonWidth: PropTypes.number,\n};\n\nCardFooter.defaultProps = {\n children: null,\n className: undefined,\n textElement: undefined,\n isStacked: false,\n orientation: undefined,\n skeletonHeight: IS_LOADING_HEIGHT_VALUE,\n skeletonWidth: undefined,\n};\n\nexport default CardFooter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,uBAAuB,GAAG,EAAE;AAElC,MAAMC,UAAU,gBAAGP,KAAK,CAACQ,UAAU,CAAC,CAAC;EACnCC,QAAQ;EACRC,SAAS;EACTC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,aAAa;EACbC;AACF,CAAC,EAAEC,GAAG,KAAK;EACT,MAAM;IAAED,WAAW,EAAEE,eAAe;IAAEC;EAAU,CAAC,GAAGjB,UAAU,CAACI,WAAW,CAAC;EAC3E,MAAMc,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,oBACElB,KAAA,CAAAsB,aAAA;MAAKZ,SAAS,EAAEP,UAAU,CAACO,SAAS,EAAEU,gBAAgB;IAAE,gBACtDpB,KAAA,CAAAsB,aAAA,CAAClB,QAAQ;MACPmB,kBAAkB,EAAC,yBAAyB;MAC5CC,MAAM,EAAEX,cAAe;MACvBY,KAAK,EAAEX;IAAc,CACtB,CACE,CAAC;EAEV;EAEA,oBACEd,KAAA,CAAAsB,aAAA;IAAKZ,SAAS,EAAEP,UAAU,CAACO,SAAS,EAAEU,gBAAgB,CAAE;IAACJ,GAAG,EAAEA;EAAI,GAC/DJ,WAAW,iBAAIZ,KAAA,CAAAsB,aAAA;IAAKZ,SAAS,EAAEW;EAAqB,GAAET,WAAiB,CAAC,EACxEH,QACE,CAAC;AAEV,CAAC,CAAC;AAEFF,UAAU,CAACmB,SAAS,GAAG;EACrB;EACAjB,QAAQ,EAAEP,SAAS,CAACyB,IAAI;EACxB;EACAjB,SAAS,EAAER,SAAS,CAAC0B,MAAM;EAC3B;EACAhB,WAAW,EAAEV,SAAS,CAACyB,IAAI;EAC3B;EACAhB,SAAS,EAAET,SAAS,CAAC2B,IAAI;EACzB;EACAd,WAAW,EAAEb,SAAS,CAAC4B,KAAK,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;EACxD;EACAjB,cAAc,EAAEX,SAAS,CAAC6B,MAAM;EAChC;EACAjB,aAAa,EAAEZ,SAAS,CAAC6B;AAC3B,CAAC;AAEDxB,UAAU,CAACyB,YAAY,GAAG;EACxBvB,QAAQ,EAAE,IAAI;EACdC,SAAS,EAAEuB,SAAS;EACpBrB,WAAW,EAAEqB,SAAS;EACtBtB,SAAS,EAAE,KAAK;EAChBI,WAAW,EAAEkB,SAAS;EACtBpB,cAAc,EAAEP,uBAAuB;EACvCQ,aAAa,EAAEmB;AACjB,CAAC;AAED,eAAe1B,UAAU","ignoreList":[]}
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,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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;
@@ -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__*/React.forwardRef(({
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","PropTypes","classNames","Skeleton","CardContext","SKELETON_HEIGHT_VALUE","CardSection","forwardRef","className","children","title","actions","muted","skeletonHeight","skeletonWidth","ref","isLoading","createElement","containerClassName","height","width","propTypes","string","node","bool","number","defaultProps","undefined"],"sources":["../../src/Card/CardSection.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport Skeleton from 'react-loading-skeleton';\nimport CardContext from './CardContext';\n\nconst SKELETON_HEIGHT_VALUE = 100;\n\nconst CardSection = React.forwardRef(({\n className,\n children,\n title,\n actions,\n muted,\n skeletonHeight,\n skeletonWidth,\n}, ref) => {\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\nCardSection.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies contents of the component. */\n children: PropTypes.node,\n /** Specifies title of the `Section`. */\n title: PropTypes.node,\n /** Specifies node to render on the bottom right of the `Section` (i.e. `ActionRow`). */\n actions: PropTypes.node,\n /** Specifies whether to display `Section` with muted styling. */\n muted: PropTypes.bool,\n /** Specifies height of skeleton in loading state. */\n skeletonHeight: PropTypes.number,\n /** Specifies width of skeleton in loading state. */\n skeletonWidth: PropTypes.number,\n};\n\nCardSection.defaultProps = {\n children: null,\n className: undefined,\n title: undefined,\n actions: undefined,\n muted: false,\n skeletonHeight: SKELETON_HEIGHT_VALUE,\n skeletonWidth: undefined,\n};\n\nexport default CardSection;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,qBAAqB,GAAG,GAAG;AAEjC,MAAMC,WAAW,gBAAGP,KAAK,CAACQ,UAAU,CAAC,CAAC;EACpCC,SAAS;EACTC,QAAQ;EACRC,KAAK;EACLC,OAAO;EACPC,KAAK;EACLC,cAAc;EACdC;AACF,CAAC,EAAEC,GAAG,KAAK;EACT,MAAM;IAAEC;EAAU,CAAC,GAAGhB,UAAU,CAACI,WAAW,CAAC;EAE7C,IAAIY,SAAS,EAAE;IACb,oBACEjB,KAAA,CAAAkB,aAAA;MAAKT,SAAS,EAAEN,UAAU,CAAC,mBAAmB,EAAEM,SAAS,EAAE;QAAE,UAAU,EAAEI;MAAM,CAAC;IAAE,gBAChFb,KAAA,CAAAkB,aAAA,CAACd,QAAQ;MACPe,kBAAkB,EAAC,0BAA0B;MAC7CC,MAAM,EAAEN,cAAe;MACvBO,KAAK,EAAEN;IAAc,CACtB,CACE,CAAC;EAEV;EAEA,oBACEf,KAAA,CAAAkB,aAAA;IACET,SAAS,EAAEN,UAAU,CAAC,mBAAmB,EAAEM,SAAS,EAAE;MAAE,UAAU,EAAEI;IAAM,CAAC,CAAE;IAC7EG,GAAG,EAAEA;EAAI,GAERL,KAAK,iBAAIX,KAAA,CAAAkB,aAAA;IAAKT,SAAS,EAAC;EAAyB,GAAEE,KAAW,CAAC,EAC/DD,QAAQ,EACRE,OAAO,iBAAIZ,KAAA,CAAAkB,aAAA;IAAKT,SAAS,EAAC;EAA2B,GAAEG,OAAa,CAClE,CAAC;AAEV,CAAC,CAAC;AAEFL,WAAW,CAACe,SAAS,GAAG;EACtB;EACAb,SAAS,EAAEP,SAAS,CAACqB,MAAM;EAC3B;EACAb,QAAQ,EAAER,SAAS,CAACsB,IAAI;EACxB;EACAb,KAAK,EAAET,SAAS,CAACsB,IAAI;EACrB;EACAZ,OAAO,EAAEV,SAAS,CAACsB,IAAI;EACvB;EACAX,KAAK,EAAEX,SAAS,CAACuB,IAAI;EACrB;EACAX,cAAc,EAAEZ,SAAS,CAACwB,MAAM;EAChC;EACAX,aAAa,EAAEb,SAAS,CAACwB;AAC3B,CAAC;AAEDnB,WAAW,CAACoB,YAAY,GAAG;EACzBjB,QAAQ,EAAE,IAAI;EACdD,SAAS,EAAEmB,SAAS;EACpBjB,KAAK,EAAEiB,SAAS;EAChBhB,OAAO,EAAEgB,SAAS;EAClBf,KAAK,EAAE,KAAK;EACZC,cAAc,EAAER,qBAAqB;EACrCS,aAAa,EAAEa;AACjB,CAAC;AAED,eAAerB,WAAW","ignoreList":[]}
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;
@@ -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__*/React.forwardRef(({
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","PropTypes","classNames","Skeleton","Icon","CardContext","CardStatus","forwardRef","className","children","variant","icon","title","actions","props","ref","isLoading","createElement","src","propTypes","node","isRequired","string","func","oneOf","oneOfType","element","defaultProps","undefined"],"sources":["../../src/Card/CardStatus.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport Skeleton from 'react-loading-skeleton';\nimport Icon from '../Icon';\nimport CardContext from './CardContext';\n\nconst CardStatus = React.forwardRef(({\n className,\n children,\n variant,\n icon,\n title,\n actions,\n ...props\n}, ref) => {\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\nCardStatus.propTypes = {\n /** Specifies the content of the component. */\n children: PropTypes.node.isRequired,\n /** The class to append to the base element. */\n className: PropTypes.string,\n /** Icon that will be shown in the top-left corner. */\n icon: PropTypes.func,\n /** Specifies variant to use. */\n variant: PropTypes.oneOf([\n 'primary',\n 'success',\n 'danger',\n 'warning',\n ]),\n /** Specifies title for the `Card.Status`. */\n title: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),\n /** Specifies any optional actions, e.g. button(s). */\n actions: PropTypes.node,\n};\n\nCardStatus.defaultProps = {\n className: undefined,\n icon: undefined,\n variant: 'warning',\n title: undefined,\n actions: undefined,\n};\n\nexport default CardStatus;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,UAAU,gBAAGP,KAAK,CAACQ,UAAU,CAAC,CAAC;EACnCC,SAAS;EACTC,QAAQ;EACRC,OAAO;EACPC,IAAI;EACJC,KAAK;EACLC,OAAO;EACP,GAAGC;AACL,CAAC,EAAEC,GAAG,KAAK;EACT,MAAM;IAAEC;EAAU,CAAC,GAAGhB,UAAU,CAACK,WAAW,CAAC;EAE7C,IAAIW,SAAS,EAAE;IACb,oBACEjB,KAAA,CAAAkB,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CAACmB;AACrB,CAAC;AAEDd,UAAU,CAACqB,YAAY,GAAG;EACxBnB,SAAS,EAAEoB,SAAS;EACpBjB,IAAI,EAAEiB,SAAS;EACflB,OAAO,EAAE,SAAS;EAClBE,KAAK,EAAEgB,SAAS;EAChBf,OAAO,EAAEe;AACX,CAAC;AAED,eAAetB,UAAU","ignoreList":[]}
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
- import PropTypes from 'prop-types';
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","PropTypes","CollapsibleContext","createContext","CollapsibleAdvanced","Component","getDerivedStateFromProps","props","open","undefined","isOpen","constructor","state","defaultOpen","setState","onOpen","onToggle","close","onClose","toggle","render","children","className","unmountOnExit","createElement","Provider","value","propTypes","node","string","bool","func","defaultProps"],"sources":["../../src/Collapsible/CollapsibleAdvanced.jsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\n\nexport const CollapsibleContext = React.createContext();\n\nclass CollapsibleAdvanced extends React.Component {\n static getDerivedStateFromProps(props) {\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) {\n super(props);\n\n this.state = {\n isOpen: props.open !== undefined ? props.open : props.defaultOpen,\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,\n ...props\n } = this.props;\n\n // Unneeded for passthrough props\n delete props.defaultOpen;\n delete props.onToggle;\n delete props.onOpen;\n delete props.onClose;\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\nCollapsibleAdvanced.propTypes = {\n /** Specifies contents of the component. */\n children: PropTypes.node,\n /** Specifies classname to append to the base element. */\n className: PropTypes.string,\n /** Specifies whether `Collapsible` should be initially open. */\n defaultOpen: PropTypes.bool,\n /** Specifies whether `Collapsible` is open. */\n open: PropTypes.bool,\n /** Callback fired when `Collapsible's` state is toggled. */\n onToggle: PropTypes.func,\n /** Callback fired when `Collapsible` opens. */\n onOpen: PropTypes.func,\n /** Callback fired when `Collapsible` closes. */\n onClose: PropTypes.func,\n /** Unmount the component (remove it from the DOM) when it is collapsed. */\n unmountOnExit: PropTypes.bool,\n};\n\nCollapsibleAdvanced.defaultProps = {\n children: undefined,\n className: undefined,\n defaultOpen: false,\n open: undefined,\n onToggle: undefined,\n onOpen: undefined,\n onClose: undefined,\n unmountOnExit: true,\n};\n\nexport default CollapsibleAdvanced;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAO,MAAMC,kBAAkB,gBAAGH,KAAK,CAACI,aAAa,CAAC,CAAC;AAEvD,MAAMC,mBAAmB,SAASL,KAAK,CAACM,SAAS,CAAC;EAChD,OAAOC,wBAAwBA,CAACC,KAAK,EAAE;IACrC,IAAIA,KAAK,CAACC,IAAI,KAAKC,SAAS,EAAE;MAC5B,OAAO;QACL;QACA;QACA;QACAC,MAAM,EAAEH,KAAK,CAACC;MAChB,CAAC;IACH;IACA,OAAO,IAAI;EACb;EAEAG,WAAWA,CAACJ,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACK,KAAK,GAAG;MACXF,MAAM,EAAEH,KAAK,CAACC,IAAI,KAAKC,SAAS,GAAGF,KAAK,CAACC,IAAI,GAAGD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S,EAAE;QAClD,SAAS,EAAE,IAAI,CAACV,KAAK,CAACF;MACxB,CAAC;IAAE,gBAEHX,KAAA,CAAAyB,aAAA,CAACtB,kBAAkB,CAACuB,QAAQ;MAC1BC,KAAK,EAAE;QACLhB,MAAM,EAAE,IAAI,CAACE,KAAK,CAACF,MAAM;QACzBF,IAAI,EAAE,IAAI,CAACA,IAAI;QACfS,KAAK,EAAE,IAAI,CAACA,KAAK;QACjBE,MAAM,EAAE,IAAI,CAACA,MAAM;QACnBI;MACF;IAAE,GAEDF,QAC0B,CAC1B,CAAC;EAEV;AACF;AAEAjB,mBAAmB,CAACuB,SAAS,GAAG;EAC9B;EACAN,QAAQ,EAAEpB,SAAS,CAAC2B,IAAI;EACxB;EACAN,SAAS,EAAErB,SAAS,CAAC4B,MAAM;EAC3B;EACAhB,WAAW,EAAEZ,SAAS,CAAC6B,IAAI;EAC3B;EACAtB,IAAI,EAAEP,SAAS,CAAC6B,IAAI;EACpB;EACAd,QAAQ,EAAEf,SAAS,CAAC8B,IAAI;EACxB;EACAhB,MAAM,EAAEd,SAAS,CAAC8B,IAAI;EACtB;EACAb,OAAO,EAAEjB,SAAS,CAAC8B,IAAI;EACvB;EACAR,aAAa,EAAEtB,SAAS,CAAC6B;AAC3B,CAAC;AAED1B,mBAAmB,CAAC4B,YAAY,GAAG;EACjCX,QAAQ,EAAEZ,SAAS;EACnBa,SAAS,EAAEb,SAAS;EACpBI,WAAW,EAAE,KAAK;EAClBL,IAAI,EAAEC,SAAS;EACfO,QAAQ,EAAEP,SAAS;EACnBM,MAAM,EAAEN,SAAS;EACjBS,OAAO,EAAET,SAAS;EAClBc,aAAa,EAAE;AACjB,CAAC;AAED,eAAenB,mBAAmB","ignoreList":[]}
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,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EV;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
- } = useContext(CollapsibleContext);
16
-
17
- // Keys are added to these elements so that TransitionReplace
18
- // will recognize them as unique components and perform the
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","PropTypes","Collapse","CollapsibleContext","TransitionReplace","CollapsibleBody","children","transitionWrapper","tag","props","isOpen","unmountOnExit","content","createElement","key","transitionBody","cloneElement","in","propTypes","node","string","element","defaultProps","undefined"],"sources":["../../src/Collapsible/CollapsibleBody.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\n\nimport Collapse from '../Collapse';\nimport { CollapsibleContext } from './CollapsibleAdvanced';\nimport TransitionReplace from '../TransitionReplace';\n\nfunction CollapsibleBody({\n children, transitionWrapper, tag, ...props\n}) {\n const { isOpen, unmountOnExit } = useContext(CollapsibleContext);\n\n // Keys are added to these elements so that TransitionReplace\n // will recognize them as unique components and perform the\n // transition properly.\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\nCollapsibleBody.propTypes = {\n /** Specifies contents of the component. */\n children: PropTypes.node,\n /** Specifies content's base element. */\n tag: PropTypes.string,\n /** Specifies transition element. */\n transitionWrapper: PropTypes.element,\n};\n\nCollapsibleBody.defaultProps = {\n children: undefined,\n tag: 'div',\n transitionWrapper: undefined,\n};\n\nexport default CollapsibleBody;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,OAAOC,iBAAiB,MAAM,sBAAsB;AAEpD,SAASC,eAAeA,CAAC;EACvBC,QAAQ;EAAEC,iBAAiB;EAAEC,GAAG;EAAE,GAAGC;AACvC,CAAC,EAAE;EACD,MAAM;IAAEC,MAAM;IAAEC;EAAc,CAAC,GAAGX,UAAU,CAACG,kBAAkB,CAAC;;EAEhE;EACA;EACA;EACA,MAAMS,OAAO,gBAAGb,KAAK,CAACc,aAAa,CAACL,GAAG,EAAE;IAAEM,GAAG,EAAE,MAAM;IAAE,GAAGL;EAAM,CAAC,EAAEH,QAAQ,CAAC;EAC7E,MAAMS,cAAc,GAAGL,MAAM,GAAGE,OAAO,gBAAGb,KAAA,CAAAc,aAAA;IAAKC,GAAG,EAAC;EAAO,CAAE,CAAC;EAE7D,IAAIP,iBAAiB,EAAE;IACrB,oBAAOR,KAAK,CAACiB,YAAY,CAACT,iBAAiB,EAAE,CAAC,CAAC,EAAEQ,cAAc,CAAC;EAClE;EACA;EACA,OAAOJ,aAAa,gBAChBZ,KAAA,CAAAc,aAAA,CAACT,iBAAiB,QAAEW,cAAkC,CAAC,gBACvDhB,KAAA,CAAAc,aAAA,CAACX,QAAQ;IAACe,EAAE,EAAEP;EAAO,GAAEE,OAAkB,CAAC;AAChD;AAEAP,eAAe,CAACa,SAAS,GAAG;EAC1B;EACAZ,QAAQ,EAAEL,SAAS,CAACkB,IAAI;EACxB;EACAX,GAAG,EAAEP,SAAS,CAACmB,MAAM;EACrB;EACAb,iBAAiB,EAAEN,SAAS,CAACoB;AAC/B,CAAC;AAEDhB,eAAe,CAACiB,YAAY,GAAG;EAC7BhB,QAAQ,EAAEiB,SAAS;EACnBf,GAAG,EAAE,KAAK;EACVD,iBAAiB,EAAEgB;AACrB,CAAC;AAED,eAAelB,eAAe","ignoreList":[]}
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
- } = useContext(CollapsibleContext);
19
- const handleToggle = useCallback(e => {
18
+ } = context || {
19
+ isOpen: false,
20
+ open: () => {},
21
+ close: () => {},
22
+ toggle: () => {}
23
+ };
24
+ const handleToggle = useCallback(() => {
20
25
  if (openOnly) {
21
- open(e);
26
+ open();
22
27
  } else if (closeOnly) {
23
- close(e);
28
+ close();
24
29
  } else {
25
- toggle(e);
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(e);
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(e);
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