@openedx/paragon 23.22.1 → 23.22.2

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.
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/require-default-props */
2
1
  import React, { useCallback, useEffect, useState, forwardRef, cloneElement } from 'react';
3
2
  import classNames from 'classnames';
4
3
  import { Alert as BaseAlert } from 'react-bootstrap';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useEffect","useState","forwardRef","cloneElement","classNames","Alert","BaseAlert","divWithClassName","FormattedMessage","useMediaQuery","Icon","breakpoints","Button","ActionRow","ALERT_CLOSE_LABEL_TEXT","children","icon","actions","dismissible","onClose","closeLabel","stacked","show","props","ref","isStacked","setIsStacked","isExtraSmall","maxWidth","extraSmall","actionButtonSize","cloneActionElement","Action","addtlActionProps","size","key","createElement","className","src","length","Spacer","variant","onClick","id","defaultMessage","description","map","DivStyledAsH4","displayName","AlertHeading","as","bsPrefix","Heading","AlertLink","Link"],"sources":["../../src/Alert/index.tsx"],"sourcesContent":["/* eslint-disable react/require-default-props */\nimport React, {\n useCallback,\n useEffect,\n useState,\n ReactNode,\n ElementType,\n forwardRef,\n FC,\n ForwardRefExoticComponent,\n RefAttributes,\n cloneElement,\n} from 'react';\nimport classNames from 'classnames';\nimport {\n Alert as BaseAlert,\n AlertProps as BaseAlertProps,\n} from 'react-bootstrap';\nimport { type TransitionComponent } from 'react-bootstrap/helpers';\nimport divWithClassName from 'react-bootstrap/divWithClassName';\nimport { FormattedMessage } from 'react-intl';\nimport { useMediaQuery } from 'react-responsive';\nimport Icon, { IconProps } from '../Icon';\nimport breakpoints from '../utils/breakpoints';\nimport Button from '../Button';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ActionRow from '../ActionRow';\n\nexport const ALERT_CLOSE_LABEL_TEXT = 'Dismiss';\n\nexport type AlertVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light';\n\nexport type BaseProps = Omit<BaseAlertProps, 'children' | 'variant' | 'closeLabel'>;\n\nexport interface AlertProps extends BaseProps {\n /** Specifies class name to append to the base element */\n className?: string;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n /** Specifies variant to use. */\n variant?: AlertVariant;\n /**\n * Animate the entering and exiting of the Alert. `true` will use the `<Fade>` transition,\n * more detailed customization is also provided.\n */\n transition?: boolean | TransitionComponent;\n children?: ReactNode;\n /** Icon that will be shown in the alert */\n icon?: React.ComponentType<IconProps>;\n /** Whether the alert is shown. */\n show?: boolean;\n /** Whether the alert is dismissible. Defaults to false. */\n dismissible?: boolean;\n /** Optional callback function for when the alert it dismissed. */\n onClose?: () => void;\n /** Optional list of action elements. May include, at most, 2 actions, or 1 if dismissible is true. */\n actions?: React.ReactElement[];\n /** Position of the dismiss and call-to-action buttons. Defaults to `false`. */\n stacked?: boolean;\n /** Sets the text for alert close button, defaults to 'Dismiss'. */\n closeLabel?: string | ReactNode;\n}\n\nexport interface AlertHeadingProps {\n /** Specifies the base element */\n as?: ElementType;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n // eslint-disable-next-line react/no-unused-prop-types\n children?: ReactNode;\n}\n\nexport interface AlertLinkProps {\n /** Specifies the base element */\n as?: ElementType;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n // eslint-disable-next-line react/no-unused-prop-types\n children?: ReactNode;\n // eslint-disable-next-line react/no-unused-prop-types\n href?: string;\n}\n\nexport interface AlertComponent extends ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> {\n Heading: FC<AlertHeadingProps>;\n Link: FC<AlertLinkProps>;\n}\n\nconst Alert = forwardRef(({\n children,\n icon,\n actions,\n dismissible = false,\n onClose = () => {},\n closeLabel,\n stacked = false,\n show = true,\n ...props\n}: AlertProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const [isStacked, setIsStacked] = useState(stacked);\n const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth });\n const actionButtonSize = 'sm';\n\n useEffect(() => {\n if (isExtraSmall) {\n setIsStacked(true);\n } else {\n setIsStacked(stacked);\n }\n }, [isExtraSmall, stacked]);\n\n const cloneActionElement = useCallback(\n (Action: React.ReactElement) => {\n const addtlActionProps = { size: actionButtonSize, key: Action.props.children };\n return cloneElement(Action, addtlActionProps);\n },\n [],\n );\n\n return (\n <BaseAlert\n {...props}\n className={classNames('alert-content', props.className)}\n show={show}\n ref={ref}\n >\n {icon && <Icon src={icon} className=\"alert-icon\" />}\n <div\n className={classNames({\n 'pgn__alert-message-wrapper': !isStacked,\n 'pgn__alert-message-wrapper-stacked': isStacked,\n })}\n >\n <div className=\"alert-message-content\">\n {children}\n </div>\n {(dismissible || (actions && actions.length > 0)) && (\n <ActionRow className=\"pgn__alert-actions\">\n <ActionRow.Spacer />\n {dismissible && (\n <Button\n size={actionButtonSize}\n variant=\"tertiary\"\n onClick={onClose}\n >\n {closeLabel || (\n <FormattedMessage\n id=\"pgn.Alert.closeLabel\"\n defaultMessage=\"Dismiss\"\n description=\"Label of a close button on Alert component\"\n />\n )}\n </Button>\n )}\n {actions && actions.map(cloneActionElement)}\n </ActionRow>\n )}\n </div>\n </BaseAlert>\n );\n}) as AlertComponent;\n\n// This is needed to display a default prop for Alert.Heading element\n// Copied from react-bootstrap since BaseAlert.Heading component doesn't have defaultProps,\n// so there seems to be no other way of providing correct default prop for base element\nconst DivStyledAsH4 = divWithClassName('h4');\nDivStyledAsH4.displayName = 'DivStyledAsH4';\n\nfunction AlertHeading({\n as = DivStyledAsH4,\n bsPrefix = 'alert-heading',\n ...props\n}: AlertHeadingProps): JSX.Element {\n return <BaseAlert.Heading {...{ as, bsPrefix, ...props }} />;\n}\n\nfunction AlertLink({\n as = 'a',\n bsPrefix = 'alert-link',\n ...props\n}: AlertLinkProps): JSX.Element {\n return <BaseAlert.Link {...{ as, bsPrefix, ...props }} />;\n}\n\nAlert.Heading = AlertHeading;\nAlert.Link = AlertLink;\n\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AO,CAAC6B,GAAG,CAACf,kBAAkB,CACjC,CAEV,CACI,CAAC;AAEhB,CAAC,CAAmB;;AAEpB;AACA;AACA;AACA,MAAMgB,aAAa,GAAGxC,gBAAgB,CAAC,IAAI,CAAC;AAC5CwC,aAAa,CAACC,WAAW,GAAG,eAAe;AAE3C,SAASC,YAAYA,CAAC;EACpBC,EAAE,GAAGH,aAAa;EAClBI,QAAQ,GAAG,eAAe;EAC1B,GAAG5B;AACc,CAAC,EAAe;EACjC,oBAAOzB,KAAA,CAAAsC,aAAA,CAAC9B,SAAS,CAAC8C,OAAO;IAAOF,EAAE;IAAEC,QAAQ;IAAE,GAAG5B;EAAK,CAAK,CAAC;AAC9D;AAEA,SAAS8B,SAASA,CAAC;EACjBH,EAAE,GAAG,GAAG;EACRC,QAAQ,GAAG,YAAY;EACvB,GAAG5B;AACW,CAAC,EAAe;EAC9B,oBAAOzB,KAAA,CAAAsC,aAAA,CAAC9B,SAAS,CAACgD,IAAI;IAAOJ,EAAE;IAAEC,QAAQ;IAAE,GAAG5B;EAAK,CAAK,CAAC;AAC3D;AAEAlB,KAAK,CAAC+C,OAAO,GAAGH,YAAY;AAC5B5C,KAAK,CAACiD,IAAI,GAAGD,SAAS;AAEtB,eAAehD,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useEffect","useState","forwardRef","cloneElement","classNames","Alert","BaseAlert","divWithClassName","FormattedMessage","useMediaQuery","Icon","breakpoints","Button","ActionRow","ALERT_CLOSE_LABEL_TEXT","children","icon","actions","dismissible","onClose","closeLabel","stacked","show","props","ref","isStacked","setIsStacked","isExtraSmall","maxWidth","extraSmall","actionButtonSize","cloneActionElement","Action","addtlActionProps","size","key","createElement","className","src","length","Spacer","variant","onClick","id","defaultMessage","description","map","DivStyledAsH4","displayName","AlertHeading","as","bsPrefix","Heading","AlertLink","Link"],"sources":["../../src/Alert/index.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useState,\n ReactNode,\n ElementType,\n forwardRef,\n FC,\n ForwardRefExoticComponent,\n RefAttributes,\n cloneElement,\n} from 'react';\nimport classNames from 'classnames';\nimport {\n Alert as BaseAlert,\n AlertProps as BaseAlertProps,\n} from 'react-bootstrap';\nimport { type TransitionComponent } from 'react-bootstrap/helpers';\nimport divWithClassName from 'react-bootstrap/divWithClassName';\nimport { FormattedMessage } from 'react-intl';\nimport { useMediaQuery } from 'react-responsive';\nimport Icon, { IconProps } from '../Icon';\nimport breakpoints from '../utils/breakpoints';\nimport Button from '../Button';\n// @ts-ignore for now - this needs to be converted to TypeScript\nimport ActionRow from '../ActionRow';\n\nexport const ALERT_CLOSE_LABEL_TEXT = 'Dismiss';\n\nexport type AlertVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light';\n\nexport type BaseProps = Omit<BaseAlertProps, 'children' | 'variant' | 'closeLabel'>;\n\nexport interface AlertProps extends BaseProps {\n /** Specifies class name to append to the base element */\n className?: string;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n /** Specifies variant to use. */\n variant?: AlertVariant;\n /**\n * Animate the entering and exiting of the Alert. `true` will use the `<Fade>` transition,\n * more detailed customization is also provided.\n */\n transition?: boolean | TransitionComponent;\n children?: ReactNode;\n /** Icon that will be shown in the alert */\n icon?: React.ComponentType<IconProps>;\n /** Whether the alert is shown. */\n show?: boolean;\n /** Whether the alert is dismissible. Defaults to false. */\n dismissible?: boolean;\n /** Optional callback function for when the alert it dismissed. */\n onClose?: () => void;\n /** Optional list of action elements. May include, at most, 2 actions, or 1 if dismissible is true. */\n actions?: React.ReactElement[];\n /** Position of the dismiss and call-to-action buttons. Defaults to `false`. */\n stacked?: boolean;\n /** Sets the text for alert close button, defaults to 'Dismiss'. */\n closeLabel?: string | ReactNode;\n}\n\nexport interface AlertHeadingProps {\n /** Specifies the base element */\n as?: ElementType;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n // eslint-disable-next-line react/no-unused-prop-types\n children?: ReactNode;\n}\n\nexport interface AlertLinkProps {\n /** Specifies the base element */\n as?: ElementType;\n /** Overrides underlying component base CSS class name */\n bsPrefix?: string;\n // eslint-disable-next-line react/no-unused-prop-types\n children?: ReactNode;\n // eslint-disable-next-line react/no-unused-prop-types\n href?: string;\n}\n\nexport interface AlertComponent extends ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> {\n Heading: FC<AlertHeadingProps>;\n Link: FC<AlertLinkProps>;\n}\n\nconst Alert = forwardRef(({\n children,\n icon,\n actions,\n dismissible = false,\n onClose = () => {},\n closeLabel,\n stacked = false,\n show = true,\n ...props\n}: AlertProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const [isStacked, setIsStacked] = useState(stacked);\n const isExtraSmall = useMediaQuery({ maxWidth: breakpoints.extraSmall.maxWidth });\n const actionButtonSize = 'sm';\n\n useEffect(() => {\n if (isExtraSmall) {\n setIsStacked(true);\n } else {\n setIsStacked(stacked);\n }\n }, [isExtraSmall, stacked]);\n\n const cloneActionElement = useCallback(\n (Action: React.ReactElement) => {\n const addtlActionProps = { size: actionButtonSize, key: Action.props.children };\n return cloneElement(Action, addtlActionProps);\n },\n [],\n );\n\n return (\n <BaseAlert\n {...props}\n className={classNames('alert-content', props.className)}\n show={show}\n ref={ref}\n >\n {icon && <Icon src={icon} className=\"alert-icon\" />}\n <div\n className={classNames({\n 'pgn__alert-message-wrapper': !isStacked,\n 'pgn__alert-message-wrapper-stacked': isStacked,\n })}\n >\n <div className=\"alert-message-content\">\n {children}\n </div>\n {(dismissible || (actions && actions.length > 0)) && (\n <ActionRow className=\"pgn__alert-actions\">\n <ActionRow.Spacer />\n {dismissible && (\n <Button\n size={actionButtonSize}\n variant=\"tertiary\"\n onClick={onClose}\n >\n {closeLabel || (\n <FormattedMessage\n id=\"pgn.Alert.closeLabel\"\n defaultMessage=\"Dismiss\"\n description=\"Label of a close button on Alert component\"\n />\n )}\n </Button>\n )}\n {actions && actions.map(cloneActionElement)}\n </ActionRow>\n )}\n </div>\n </BaseAlert>\n );\n}) as AlertComponent;\n\n// This is needed to display a default prop for Alert.Heading element\n// Copied from react-bootstrap since BaseAlert.Heading component doesn't have defaultProps,\n// so there seems to be no other way of providing correct default prop for base element\nconst DivStyledAsH4 = divWithClassName('h4');\nDivStyledAsH4.displayName = 'DivStyledAsH4';\n\nfunction AlertHeading({\n as = DivStyledAsH4,\n bsPrefix = 'alert-heading',\n ...props\n}: AlertHeadingProps): JSX.Element {\n return <BaseAlert.Heading {...{ as, bsPrefix, ...props }} />;\n}\n\nfunction AlertLink({\n as = 'a',\n bsPrefix = 'alert-link',\n ...props\n}: AlertLinkProps): JSX.Element {\n return <BaseAlert.Link {...{ as, bsPrefix, ...props }} />;\n}\n\nAlert.Heading = AlertHeading;\nAlert.Link = AlertLink;\n\nexport default Alert;\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,QAAQ,EAGRC,UAAU,EAIVC,YAAY,QACP,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,SACEC,KAAK,IAAIC,SAAS,QAEb,iBAAiB;AAExB,OAAOC,gBAAgB,MAAM,kCAAkC;AAC/D,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,IAAI,MAAqB,SAAS;AACzC,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,MAAM,MAAM,WAAW;AAC9B;AACA,OAAOC,SAAS,MAAM,cAAc;AAEpC,OAAO,MAAMC,sBAAsB,GAAG,SAAS;AA4D/C,MAAMT,KAAK,gBAAGH,UAAU,CAAC,CAAC;EACxBa,QAAQ;EACRC,IAAI;EACJC,OAAO;EACPC,WAAW,GAAG,KAAK;EACnBC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClBC,UAAU;EACVC,OAAO,GAAG,KAAK;EACfC,IAAI,GAAG,IAAI;EACX,GAAGC;AACO,CAAC,EAAEC,GAAuC,KAAK;EAC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AI,GAAGD,SAAS;AAEtB,eAAehD,KAAK","ignoreList":[]}
@@ -5,12 +5,19 @@ declare const textVariants: readonly ["white", "muted"];
5
5
  type ColorVariant = typeof colorVariants[number];
6
6
  type TextVariant = typeof textVariants[number];
7
7
  interface Props extends BsPropsWithAs {
8
+ /** Prefix for component CSS classes. */
8
9
  prefix?: string;
10
+ /** Background color of the card. */
9
11
  bgColor?: ColorVariant;
12
+ /** Text color of the card. */
10
13
  textColor?: ColorVariant | TextVariant;
14
+ /** Border color of the card. */
11
15
  borderColor?: ColorVariant;
16
+ /** Determines whether the card should render its children inside a `CardBody` wrapper. */
12
17
  hasBody?: boolean;
18
+ /** Additional CSS class names to apply to the card element. */
13
19
  className?: string;
20
+ /** The content to render inside the card. */
14
21
  children: React.ReactNode;
15
22
  }
16
23
  type BaseCardType = ComponentWithAsProp<'div', Props>;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import classNames from 'classnames';
4
3
  // @ts-ignore
5
4
  import CardBody from './CardBody';
@@ -24,25 +23,5 @@ const BaseCard = /*#__PURE__*/React.forwardRef(({
24
23
  className: classes
25
24
  }, hasBody ? /*#__PURE__*/React.createElement(CardBody, null, children) : children);
26
25
  });
27
-
28
- /* eslint-disable react/require-default-props */
29
- BaseCard.propTypes = {
30
- /** Prefix for component CSS classes. */
31
- prefix: PropTypes.string,
32
- /** Background color of the card. */
33
- bgColor: PropTypes.oneOf(colorVariants),
34
- /** Text color of the card. */
35
- textColor: PropTypes.oneOf([...colorVariants, ...textVariants]),
36
- /** Border color of the card. */
37
- borderColor: PropTypes.oneOf(colorVariants),
38
- /** Determines whether the card should render its children inside a `CardBody` wrapper. */
39
- hasBody: PropTypes.bool,
40
- /** Set a custom element for this component. */
41
- as: PropTypes.elementType,
42
- /** Additional CSS class names to apply to the card element. */
43
- className: PropTypes.string,
44
- /** The content to render inside the card. */
45
- children: PropTypes.node
46
- };
47
26
  export default BaseCard;
48
27
  //# sourceMappingURL=BaseCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseCard.js","names":["React","PropTypes","classNames","CardBody","BASE_CARD_CLASSNAME","colorVariants","textVariants","BaseCard","forwardRef","prefix","className","bgColor","textColor","borderColor","hasBody","children","as","Component","props","ref","classes","createElement","propTypes","string","oneOf","bool","elementType","node"],"sources":["../../src/Card/BaseCard.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport type { ComponentWithAsProp, BsPropsWithAs } from '../utils/types/bootstrap';\n\n// @ts-ignore\nimport CardBody from './CardBody';\n\nconst BASE_CARD_CLASSNAME = 'card';\n\nconst colorVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'danger',\n 'warning',\n 'info',\n 'dark',\n 'light',\n] as const;\n\nconst textVariants = [\n 'white',\n 'muted',\n] as const;\n\ntype ColorVariant = typeof colorVariants[number];\ntype TextVariant = typeof textVariants[number];\ninterface Props extends BsPropsWithAs {\n prefix?: string;\n bgColor?: ColorVariant;\n textColor?: ColorVariant | TextVariant;\n borderColor?: ColorVariant;\n hasBody?: boolean;\n className?: string;\n children: React.ReactNode;\n}\ntype BaseCardType = ComponentWithAsProp<'div', Props>;\n\nconst BaseCard : BaseCardType = React.forwardRef<HTMLDivElement, Props>(\n (\n {\n prefix,\n className,\n bgColor,\n textColor,\n borderColor,\n hasBody = false,\n children,\n as: Component = 'div',\n ...props\n },\n ref,\n ) => {\n const classes = classNames(\n className,\n prefix ? `${prefix}-${BASE_CARD_CLASSNAME}` : BASE_CARD_CLASSNAME,\n bgColor && `bg-${bgColor}`,\n textColor && `text-${textColor}`,\n borderColor && `border-${borderColor}`,\n );\n\n return (\n <Component ref={ref} {...props} className={classes}>\n {hasBody ? <CardBody>{children}</CardBody> : children}\n </Component>\n );\n },\n);\n\n/* eslint-disable react/require-default-props */\nBaseCard.propTypes = {\n /** Prefix for component CSS classes. */\n prefix: PropTypes.string,\n /** Background color of the card. */\n bgColor: PropTypes.oneOf(colorVariants),\n /** Text color of the card. */\n textColor: PropTypes.oneOf([...colorVariants, ...textVariants]),\n /** Border color of the card. */\n borderColor: PropTypes.oneOf(colorVariants),\n /** Determines whether the card should render its children inside a `CardBody` wrapper. */\n hasBody: PropTypes.bool,\n /** Set a custom element for this component. */\n as: PropTypes.elementType,\n /** Additional CSS class names to apply to the card element. */\n className: PropTypes.string,\n /** The content to render inside the card. */\n children: PropTypes.node,\n};\n\nexport default BaseCard;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAInC;AACA,OAAOC,QAAQ,MAAM,YAAY;AAEjC,MAAMC,mBAAmB,GAAG,MAAM;AAElC,MAAMC,aAAa,GAAG,CACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,MAAM,EACN,MAAM,EACN,OAAO,CACC;AAEV,MAAMC,YAAY,GAAG,CACnB,OAAO,EACP,OAAO,CACC;AAeV,MAAMC,QAAuB,gBAAGP,KAAK,CAACQ,UAAU,CAC9C,CACE;EACEC,MAAM;EACNC,SAAS;EACTC,OAAO;EACPC,SAAS;EACTC,WAAW;EACXC,OAAO,GAAG,KAAK;EACfC,QAAQ;EACRC,EAAE,EAAEC,SAAS,GAAG,KAAK;EACrB,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,OAAO,GAAGlB,UAAU,CACxBQ,SAAS,EACTD,MAAM,GAAG,GAAGA,MAAM,IAAIL,mBAAmB,EAAE,GAAGA,mBAAmB,EACjEO,OAAO,IAAI,MAAMA,OAAO,EAAE,EAC1BC,SAAS,IAAI,QAAQA,SAAS,EAAE,EAChCC,WAAW,IAAI,UAAUA,WAAW,EACtC,CAAC;EAED,oBACEb,KAAA,CAAAqB,aAAA,CAACJ,SAAS;IAACE,GAAG,EAAEA,GAAI;IAAA,GAAKD,KAAK;IAAER,SAAS,EAAEU;EAAQ,GAChDN,OAAO,gBAAGd,KAAA,CAAAqB,aAAA,CAAClB,QAAQ,QAAEY,QAAmB,CAAC,GAAGA,QACpC,CAAC;AAEhB,CACF,CAAC;;AAED;AACAR,QAAQ,CAACe,SAAS,GAAG;EACnB;EACAb,MAAM,EAAER,SAAS,CAACsB,MAAM;EACxB;EACAZ,OAAO,EAAEV,SAAS,CAACuB,KAAK,CAACnB,aAAa,CAAC;EACvC;EACAO,SAAS,EAAEX,SAAS,CAACuB,KAAK,CAAC,CAAC,GAAGnB,aAAa,EAAE,GAAGC,YAAY,CAAC,CAAC;EAC/D;EACAO,WAAW,EAAEZ,SAAS,CAACuB,KAAK,CAACnB,aAAa,CAAC;EAC3C;EACAS,OAAO,EAAEb,SAAS,CAACwB,IAAI;EACvB;EACAT,EAAE,EAAEf,SAAS,CAACyB,WAAW;EACzB;EACAhB,SAAS,EAAET,SAAS,CAACsB,MAAM;EAC3B;EACAR,QAAQ,EAAEd,SAAS,CAAC0B;AACtB,CAAC;AAED,eAAepB,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"BaseCard.js","names":["React","classNames","CardBody","BASE_CARD_CLASSNAME","colorVariants","textVariants","BaseCard","forwardRef","prefix","className","bgColor","textColor","borderColor","hasBody","children","as","Component","props","ref","classes","createElement"],"sources":["../../src/Card/BaseCard.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\n\nimport type { ComponentWithAsProp, BsPropsWithAs } from '../utils/types/bootstrap';\n\n// @ts-ignore\nimport CardBody from './CardBody';\n\nconst BASE_CARD_CLASSNAME = 'card';\n\nconst colorVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'danger',\n 'warning',\n 'info',\n 'dark',\n 'light',\n] as const;\n\nconst textVariants = [\n 'white',\n 'muted',\n] as const;\n\ntype ColorVariant = typeof colorVariants[number];\ntype TextVariant = typeof textVariants[number];\ninterface Props extends BsPropsWithAs {\n /** Prefix for component CSS classes. */\n prefix?: string;\n /** Background color of the card. */\n bgColor?: ColorVariant;\n /** Text color of the card. */\n textColor?: ColorVariant | TextVariant;\n /** Border color of the card. */\n borderColor?: ColorVariant;\n /** Determines whether the card should render its children inside a `CardBody` wrapper. */\n hasBody?: boolean;\n /** Additional CSS class names to apply to the card element. */\n className?: string;\n /** The content to render inside the card. */\n children: React.ReactNode;\n}\ntype BaseCardType = ComponentWithAsProp<'div', Props>;\n\nconst BaseCard : BaseCardType = React.forwardRef<HTMLDivElement, Props>(\n (\n {\n prefix,\n className,\n bgColor,\n textColor,\n borderColor,\n hasBody = false,\n children,\n as: Component = 'div',\n ...props\n },\n ref,\n ) => {\n const classes = classNames(\n className,\n prefix ? `${prefix}-${BASE_CARD_CLASSNAME}` : BASE_CARD_CLASSNAME,\n bgColor && `bg-${bgColor}`,\n textColor && `text-${textColor}`,\n borderColor && `border-${borderColor}`,\n );\n\n return (\n <Component ref={ref} {...props} className={classes}>\n {hasBody ? <CardBody>{children}</CardBody> : children}\n </Component>\n );\n },\n);\n\nexport default BaseCard;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAInC;AACA,OAAOC,QAAQ,MAAM,YAAY;AAEjC,MAAMC,mBAAmB,GAAG,MAAM;AAElC,MAAMC,aAAa,GAAG,CACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,MAAM,EACN,MAAM,EACN,OAAO,CACC;AAEV,MAAMC,YAAY,GAAG,CACnB,OAAO,EACP,OAAO,CACC;AAsBV,MAAMC,QAAuB,gBAAGN,KAAK,CAACO,UAAU,CAC9C,CACE;EACEC,MAAM;EACNC,SAAS;EACTC,OAAO;EACPC,SAAS;EACTC,WAAW;EACXC,OAAO,GAAG,KAAK;EACfC,QAAQ;EACRC,EAAE,EAAEC,SAAS,GAAG,KAAK;EACrB,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,OAAO,GAAGlB,UAAU,CACxBQ,SAAS,EACTD,MAAM,GAAG,GAAGA,MAAM,IAAIL,mBAAmB,EAAE,GAAGA,mBAAmB,EACjEO,OAAO,IAAI,MAAMA,OAAO,EAAE,EAC1BC,SAAS,IAAI,QAAQA,SAAS,EAAE,EAChCC,WAAW,IAAI,UAAUA,WAAW,EACtC,CAAC;EAED,oBACEZ,KAAA,CAAAoB,aAAA,CAACJ,SAAS;IAACE,GAAG,EAAEA,GAAI;IAAA,GAAKD,KAAK;IAAER,SAAS,EAAEU;EAAQ,GAChDN,OAAO,gBAAGb,KAAA,CAAAoB,aAAA,CAAClB,QAAQ,QAAEY,QAAmB,CAAC,GAAGA,QACpC,CAAC;AAEhB,CACF,CAAC;AAED,eAAeR,QAAQ","ignoreList":[]}
@@ -1,33 +1,22 @@
1
1
  import React, { KeyboardEventHandler, MouseEventHandler } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { STYLE_VARIANTS } from './constants';
4
3
  export type ChipIconProps = {
4
+ /** Additional CSS class name(s) to append to the base element. */
5
5
  className: string;
6
+ /** The icon component to render. */
6
7
  src: React.ComponentType;
7
- variant: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS];
8
+ /** The visual style variant of the chip icon. */
9
+ variant?: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS];
10
+ /** Whether the icon is in a disabled state. */
8
11
  disabled?: boolean;
9
12
  } & ({
13
+ /** Callback for click and keyboard events on the icon button. */
10
14
  onClick: KeyboardEventHandler<HTMLButtonElement> & MouseEventHandler<HTMLButtonElement>;
15
+ /** Accessible label for the icon button. Required when `onClick` is provided. */
11
16
  alt: string;
12
17
  } | {
13
18
  onClick?: undefined;
14
19
  alt?: undefined;
15
20
  });
16
21
  declare function ChipIcon({ className, src, onClick, alt, variant, disabled, }: ChipIconProps): import("react/jsx-runtime").JSX.Element;
17
- declare namespace ChipIcon {
18
- var propTypes: {
19
- className: PropTypes.Validator<string>;
20
- src: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>>;
21
- onClick: PropTypes.Requireable<(...args: any[]) => any>;
22
- alt: PropTypes.Requireable<string>;
23
- variant: PropTypes.Requireable<string>;
24
- disabled: PropTypes.Requireable<boolean>;
25
- };
26
- var defaultProps: {
27
- onClick: undefined;
28
- alt: undefined;
29
- variant: "light";
30
- disabled: boolean;
31
- };
32
- }
33
22
  export default ChipIcon;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import Icon from '../Icon';
4
3
  import IconButton from '../IconButton';
5
4
  import { STYLE_VARIANTS } from './constants';
@@ -8,8 +7,8 @@ function ChipIcon({
8
7
  src,
9
8
  onClick,
10
9
  alt,
11
- variant,
12
- disabled
10
+ variant = STYLE_VARIANTS.LIGHT,
11
+ disabled = false
13
12
  }) {
14
13
  if (onClick) {
15
14
  return /*#__PURE__*/React.createElement(IconButton, {
@@ -28,19 +27,5 @@ function ChipIcon({
28
27
  size: "sm"
29
28
  });
30
29
  }
31
- ChipIcon.propTypes = {
32
- className: PropTypes.string.isRequired,
33
- src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
34
- onClick: PropTypes.func,
35
- alt: PropTypes.string,
36
- variant: PropTypes.string,
37
- disabled: PropTypes.bool
38
- };
39
- ChipIcon.defaultProps = {
40
- onClick: undefined,
41
- alt: undefined,
42
- variant: STYLE_VARIANTS.LIGHT,
43
- disabled: false
44
- };
45
30
  export default ChipIcon;
46
31
  //# sourceMappingURL=ChipIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChipIcon.js","names":["React","PropTypes","Icon","IconButton","STYLE_VARIANTS","ChipIcon","className","src","onClick","alt","variant","disabled","createElement","iconAs","invertColors","DARK","tabIndex","size","propTypes","string","isRequired","oneOfType","element","func","bool","defaultProps","undefined","LIGHT"],"sources":["../../src/Chip/ChipIcon.tsx"],"sourcesContent":["import React, { KeyboardEventHandler, MouseEventHandler } from 'react';\nimport PropTypes from 'prop-types';\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { STYLE_VARIANTS } from './constants';\n\nexport type ChipIconProps = {\n className: string,\n src: React.ComponentType,\n variant: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS],\n disabled?: boolean,\n} & (\n // Either _both_ onClick and alt are provided, or neither is:\n | { onClick: KeyboardEventHandler<HTMLButtonElement> & MouseEventHandler<HTMLButtonElement>, alt: string }\n | { onClick?: undefined, alt?: undefined }\n);\n\nfunction ChipIcon({\n className, src, onClick, alt, variant, disabled,\n}: ChipIconProps) {\n if (onClick) {\n return (\n <IconButton\n className={className}\n src={src}\n onClick={onClick}\n iconAs={Icon}\n alt={alt}\n invertColors={variant === STYLE_VARIANTS.DARK}\n tabIndex={disabled ? -1 : 0}\n />\n );\n }\n\n return <Icon src={src} className={className} size=\"sm\" />;\n}\n\nChipIcon.propTypes = {\n className: PropTypes.string.isRequired,\n src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,\n onClick: PropTypes.func,\n alt: PropTypes.string,\n variant: PropTypes.string,\n disabled: PropTypes.bool,\n};\n\nChipIcon.defaultProps = {\n onClick: undefined,\n alt: undefined,\n variant: STYLE_VARIANTS.LIGHT,\n disabled: false,\n};\n\nexport default ChipIcon;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAmD,OAAO;AACtE,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,cAAc,QAAQ,aAAa;AAa5C,SAASC,QAAQA,CAAC;EAChBC,SAAS;EAAEC,GAAG;EAAEC,OAAO;EAAEC,GAAG;EAAEC,OAAO;EAAEC;AAC1B,CAAC,EAAE;EAChB,IAAIH,OAAO,EAAE;IACX,oBACER,KAAA,CAAAY,aAAA,CAACT,UAAU;MACTG,SAAS,EAAEA,SAAU;MACrBC,GAAG,EAAEA,GAAI;MACTC,OAAO,EAAEA,OAAQ;MACjBK,MAAM,EAAEX,IAAK;MACbO,GAAG,EAAEA,GAAI;MACTK,YAAY,EAAEJ,OAAO,KAAKN,cAAc,CAACW,IAAK;MAC9CC,QAAQ,EAAEL,QAAQ,GAAG,CAAC,CAAC,GAAG;IAAE,CAC7B,CAAC;EAEN;EAEA,oBAAOX,KAAA,CAAAY,aAAA,CAACV,IAAI;IAACK,GAAG,EAAEA,GAAI;IAACD,SAAS,EAAEA,SAAU;IAACW,IAAI,EAAC;EAAI,CAAE,CAAC;AAC3D;AAEAZ,QAAQ,CAACa,SAAS,GAAG;EACnBZ,SAAS,EAAEL,SAAS,CAACkB,MAAM,CAACC,UAAU;EACtCb,GAAG,EAAEN,SAAS,CAACoB,SAAS,CAAC,CAACpB,SAAS,CAACqB,OAAO,EAAErB,SAAS,CAACsB,IAAI,CAAC,CAAC,CAACH,UAAU;EACxEZ,OAAO,EAAEP,SAAS,CAACsB,IAAI;EACvBd,GAAG,EAAER,SAAS,CAACkB,MAAM;EACrBT,OAAO,EAAET,SAAS,CAACkB,MAAM;EACzBR,QAAQ,EAAEV,SAAS,CAACuB;AACtB,CAAC;AAEDnB,QAAQ,CAACoB,YAAY,GAAG;EACtBjB,OAAO,EAAEkB,SAAS;EAClBjB,GAAG,EAAEiB,SAAS;EACdhB,OAAO,EAAEN,cAAc,CAACuB,KAAK;EAC7BhB,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeN,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"ChipIcon.js","names":["React","Icon","IconButton","STYLE_VARIANTS","ChipIcon","className","src","onClick","alt","variant","LIGHT","disabled","createElement","iconAs","invertColors","DARK","tabIndex","size"],"sources":["../../src/Chip/ChipIcon.tsx"],"sourcesContent":["import React, { KeyboardEventHandler, MouseEventHandler } from 'react';\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport { STYLE_VARIANTS } from './constants';\n\nexport type ChipIconProps = {\n /** Additional CSS class name(s) to append to the base element. */\n className: string;\n /** The icon component to render. */\n src: React.ComponentType;\n /** The visual style variant of the chip icon. */\n variant?: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS];\n /** Whether the icon is in a disabled state. */\n disabled?: boolean;\n} & (\n // Either _both_ onClick and alt are provided, or neither is:\n | {\n /** Callback for click and keyboard events on the icon button. */\n onClick: KeyboardEventHandler<HTMLButtonElement> & MouseEventHandler<HTMLButtonElement>;\n /** Accessible label for the icon button. Required when `onClick` is provided. */\n alt: string;\n }\n | { onClick?: undefined; alt?: undefined }\n);\n\nfunction ChipIcon({\n className, src, onClick, alt, variant = STYLE_VARIANTS.LIGHT, disabled = false,\n}: ChipIconProps) {\n if (onClick) {\n return (\n <IconButton\n className={className}\n src={src}\n onClick={onClick}\n iconAs={Icon}\n alt={alt}\n invertColors={variant === STYLE_VARIANTS.DARK}\n tabIndex={disabled ? -1 : 0}\n />\n );\n }\n\n return <Icon src={src} className={className} size=\"sm\" />;\n}\n\nexport default ChipIcon;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAmD,OAAO;AACtE,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,cAAc,QAAQ,aAAa;AAsB5C,SAASC,QAAQA,CAAC;EAChBC,SAAS;EAAEC,GAAG;EAAEC,OAAO;EAAEC,GAAG;EAAEC,OAAO,GAAGN,cAAc,CAACO,KAAK;EAAEC,QAAQ,GAAG;AAC5D,CAAC,EAAE;EAChB,IAAIJ,OAAO,EAAE;IACX,oBACEP,KAAA,CAAAY,aAAA,CAACV,UAAU;MACTG,SAAS,EAAEA,SAAU;MACrBC,GAAG,EAAEA,GAAI;MACTC,OAAO,EAAEA,OAAQ;MACjBM,MAAM,EAAEZ,IAAK;MACbO,GAAG,EAAEA,GAAI;MACTM,YAAY,EAAEL,OAAO,KAAKN,cAAc,CAACY,IAAK;MAC9CC,QAAQ,EAAEL,QAAQ,GAAG,CAAC,CAAC,GAAG;IAAE,CAC7B,CAAC;EAEN;EAEA,oBAAOX,KAAA,CAAAY,aAAA,CAACX,IAAI;IAACK,GAAG,EAAEA,GAAI;IAACD,SAAS,EAAEA,SAAU;IAACY,IAAI,EAAC;EAAI,CAAE,CAAC;AAC3D;AAEA,eAAeb,QAAQ","ignoreList":[]}
@@ -36,7 +36,9 @@ const Chip = /*#__PURE__*/React.forwardRef(({
36
36
  ...props
37
37
  }, iconBefore && /*#__PURE__*/React.createElement(ChipIcon, {
38
38
  className: `${CHIP_PGN_CLASS}__icon-before`,
39
- src: iconBefore,
39
+ src: iconBefore
40
+ /* The following two props should only be passed if _both_ are defined, but we haven't been checking that nor
41
+ enforcing it at runtime, so doing so now would be a breaking change. Hence the `!` */,
40
42
  onClick: onIconBeforeClick,
41
43
  alt: iconBeforeAlt,
42
44
  variant: variant,
@@ -48,7 +50,9 @@ const Chip = /*#__PURE__*/React.forwardRef(({
48
50
  })
49
51
  }, children), iconAfter && /*#__PURE__*/React.createElement(ChipIcon, {
50
52
  className: `${CHIP_PGN_CLASS}__icon-after`,
51
- src: iconAfter,
53
+ src: iconAfter
54
+ /* The following two props should only be passed if _both_ are defined, but we haven't been checking that nor
55
+ enforcing it at runtime, so doing so now would be a breaking change. Hence the `!` */,
52
56
  onClick: onIconAfterClick,
53
57
  alt: iconAfterAlt,
54
58
  variant: variant,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","classNames","ChipIcon","CHIP_PGN_CLASS","Chip","forwardRef","children","className","variant","iconBefore","iconBeforeAlt","iconAfter","iconAfterAlt","onIconBeforeClick","onIconAfterClick","disabled","isSelected","onClick","props","ref","hasInteractiveIcons","isChipInteractive","interactionProps","onKeyPress","tabIndex","role","createElement","selected","interactive","src","alt"],"sources":["../../src/Chip/index.tsx"],"sourcesContent":["import React, { ForwardedRef, KeyboardEventHandler, MouseEventHandler } from 'react';\nimport classNames from 'classnames';\nimport ChipIcon from './ChipIcon';\nimport { STYLE_VARIANTS } from './constants';\n\nexport const CHIP_PGN_CLASS = 'pgn__chip';\n\nexport interface IChip {\n /** Specifies the content of the `Chip`. */\n children: React.ReactNode,\n /** Click handler for the whole `Chip`, has effect only when Chip does not have any interactive icons. */\n onClick?: KeyboardEventHandler & MouseEventHandler,\n /** Specifies an additional `className` to add to the base element. */\n className?: string,\n /** The `Chip` style [variant](https://github.com/openedx/paragon/blob/release-23.x/src/Chip/constants.ts) to use. */\n variant?: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS],\n /**\n * An icon component to render before the content.\n * Example import of a Paragon icon component:\n *\n * `import { Check } from '@openedx/paragon/icons';`\n */\n iconBefore?: React.ComponentType,\n /** Specifies icon alt text. */\n iconBeforeAlt?: string,\n /**\n * An icon component to render before after the content.\n * Example import of a Paragon icon component:\n *\n * `import { Check } from '@openedx/paragon/icons';`\n */\n iconAfter?: React.ComponentType,\n /** Specifies icon alt text. */\n iconAfterAlt?: string,\n /** A click handler for the `Chip` icon before. */\n onIconBeforeClick?: KeyboardEventHandler & MouseEventHandler,\n /** A click handler for the `Chip` icon after. */\n onIconAfterClick?: KeyboardEventHandler & MouseEventHandler,\n /** Disables the `Chip`. */\n disabled?: boolean,\n /** Indicates if `Chip` has been selected. */\n isSelected?: boolean,\n}\n\nconst Chip = React.forwardRef(({\n children,\n className,\n variant = 'light',\n iconBefore,\n iconBeforeAlt,\n iconAfter,\n iconAfterAlt,\n onIconBeforeClick,\n onIconAfterClick,\n disabled = false,\n isSelected = false,\n onClick,\n ...props\n}: IChip, ref: ForwardedRef<HTMLDivElement>) => {\n const hasInteractiveIcons = !!(onIconBeforeClick || onIconAfterClick);\n const isChipInteractive = !hasInteractiveIcons && !!onClick;\n\n const interactionProps = isChipInteractive ? {\n onClick,\n onKeyPress: onClick,\n tabIndex: 0,\n role: 'button',\n } : {};\n\n return (\n <div\n className={classNames(\n CHIP_PGN_CLASS,\n `pgn__chip-${variant}`,\n className,\n { disabled, selected: isSelected, interactive: isChipInteractive },\n )}\n ref={ref}\n {...interactionProps}\n {...props}\n >\n {iconBefore && (\n <ChipIcon\n className={`${CHIP_PGN_CLASS}__icon-before`}\n src={iconBefore}\n onClick={onIconBeforeClick}\n alt={iconBeforeAlt}\n variant={variant}\n disabled={disabled}\n />\n )}\n <div\n className={classNames(`${CHIP_PGN_CLASS}__label`, {\n 'p-before': iconBefore,\n 'p-after': iconAfter,\n })}\n >\n {children}\n </div>\n {iconAfter && (\n <ChipIcon\n className={`${CHIP_PGN_CLASS}__icon-after`}\n src={iconAfter}\n onClick={onIconAfterClick}\n alt={iconAfterAlt}\n variant={variant}\n disabled={disabled}\n />\n )}\n </div>\n );\n});\n\nexport default Chip;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAiE,OAAO;AACpF,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,YAAY;AAGjC,OAAO,MAAMC,cAAc,GAAG,WAAW;AAuCzC,MAAMC,IAAI,gBAAGJ,KAAK,CAACK,UAAU,CAAC,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,OAAO,GAAG,OAAO;EACjBC,UAAU;EACVC,aAAa;EACbC,SAAS;EACTC,YAAY;EACZC,iBAAiB;EACjBC,gBAAgB;EAChBC,QAAQ,GAAG,KAAK;EAChBC,UAAU,GAAG,KAAK;EAClBC,OAAO;EACP,GAAGC;AACE,CAAC,EAAEC,GAAiC,KAAK;EAC9C,MAAMC,mBAAmB,GAAG,CAAC,EAAEP,iBAAiB,IAAIC,gBAAgB,CAAC;EACrE,MAAMO,iBAAiB,GAAG,CAACD,mBAAmB,IAAI,CAAC,CAACH,OAAO;EAE3D,MAAMK,gBAAgB,GAAGD,iBAAiB,GAAG;IAC3CJ,OAAO;IACPM,UAAU,EAAEN,OAAO;IACnBO,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE;EACR,CAAC,GAAG,CAAC,CAAC;EAEN,oBACEzB,KAAA,CAAA0B,aAAA;IACEnB,SAAS,EAAEN,UAAU,CACnBE,cAAc,EACd,aAAaK,OAAO,EAAE,EACtBD,SAAS,EACT;MAAEQ,QAAQ;MAAEY,QAAQ,EAAEX,UAAU;MAAEY,WAAW,EAAEP;IAAkB,CACnE,CAAE;IACFF,GAAG,EAAEA,GAAI;IAAA,GACLG,gBAAgB;IAAA,GAChBJ;EAAK,GAERT,UAAU,iBACTT,KAAA,CAAA0B,aAAA,CAACxB,QAAQ;IACPK,SAAS,EAAE,GAAGJ,cAAc,eAAgB;IAC5C0B,GAAG,EAAEpB,UAAW;IAChBQ,OAAO,EAAEJ,iBAAkB;IAC3BiB,GAAG,EAAEpB,aAAc;IACnBF,OAAO,EAAEA,OAAQ;IACjBO,QAAQ,EAAEA;EAAS,CACpB,CACF,eACDf,KAAA,CAAA0B,aAAA;IACEnB,SAAS,EAAEN,UAAU,CAAC,GAAGE,cAAc,SAAS,EAAE;MAChD,UAAU,EAAEM,UAAU;MACtB,SAAS,EAAEE;IACb,CAAC;EAAE,GAEFL,QACE,CAAC,EACLK,SAAS,iBACRX,KAAA,CAAA0B,aAAA,CAACxB,QAAQ;IACPK,SAAS,EAAE,GAAGJ,cAAc,cAAe;IAC3C0B,GAAG,EAAElB,SAAU;IACfM,OAAO,EAAEH,gBAAiB;IAC1BgB,GAAG,EAAElB,YAAa;IAClBJ,OAAO,EAAEA,OAAQ;IACjBO,QAAQ,EAAEA;EAAS,CACpB,CAEA,CAAC;AAEV,CAAC,CAAC;AAEF,eAAeX,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","classNames","ChipIcon","CHIP_PGN_CLASS","Chip","forwardRef","children","className","variant","iconBefore","iconBeforeAlt","iconAfter","iconAfterAlt","onIconBeforeClick","onIconAfterClick","disabled","isSelected","onClick","props","ref","hasInteractiveIcons","isChipInteractive","interactionProps","onKeyPress","tabIndex","role","createElement","selected","interactive","src","alt"],"sources":["../../src/Chip/index.tsx"],"sourcesContent":["import React, { ForwardedRef, KeyboardEventHandler, MouseEventHandler } from 'react';\nimport classNames from 'classnames';\nimport ChipIcon from './ChipIcon';\nimport { STYLE_VARIANTS } from './constants';\n\nexport const CHIP_PGN_CLASS = 'pgn__chip';\n\nexport interface IChip {\n /** Specifies the content of the `Chip`. */\n children: React.ReactNode,\n /** Click handler for the whole `Chip`, has effect only when Chip does not have any interactive icons. */\n onClick?: KeyboardEventHandler & MouseEventHandler,\n /** Specifies an additional `className` to add to the base element. */\n className?: string,\n /** The `Chip` style [variant](https://github.com/openedx/paragon/blob/release-23.x/src/Chip/constants.ts) to use. */\n variant?: typeof STYLE_VARIANTS[keyof typeof STYLE_VARIANTS],\n /**\n * An icon component to render before the content.\n * Example import of a Paragon icon component:\n *\n * `import { Check } from '@openedx/paragon/icons';`\n */\n iconBefore?: React.ComponentType,\n /** Specifies icon alt text. */\n iconBeforeAlt?: string,\n /**\n * An icon component to render before after the content.\n * Example import of a Paragon icon component:\n *\n * `import { Check } from '@openedx/paragon/icons';`\n */\n iconAfter?: React.ComponentType,\n /** Specifies icon alt text. */\n iconAfterAlt?: string,\n /** A click handler for the `Chip` icon before. */\n onIconBeforeClick?: KeyboardEventHandler & MouseEventHandler,\n /** A click handler for the `Chip` icon after. */\n onIconAfterClick?: KeyboardEventHandler & MouseEventHandler,\n /** Disables the `Chip`. */\n disabled?: boolean,\n /** Indicates if `Chip` has been selected. */\n isSelected?: boolean,\n}\n\nconst Chip = React.forwardRef(({\n children,\n className,\n variant = 'light',\n iconBefore,\n iconBeforeAlt,\n iconAfter,\n iconAfterAlt,\n onIconBeforeClick,\n onIconAfterClick,\n disabled = false,\n isSelected = false,\n onClick,\n ...props\n}: IChip, ref: ForwardedRef<HTMLDivElement>) => {\n const hasInteractiveIcons = !!(onIconBeforeClick || onIconAfterClick);\n const isChipInteractive = !hasInteractiveIcons && !!onClick;\n\n const interactionProps = isChipInteractive ? {\n onClick,\n onKeyPress: onClick,\n tabIndex: 0,\n role: 'button',\n } : {};\n\n return (\n <div\n className={classNames(\n CHIP_PGN_CLASS,\n `pgn__chip-${variant}`,\n className,\n { disabled, selected: isSelected, interactive: isChipInteractive },\n )}\n ref={ref}\n {...interactionProps}\n {...props}\n >\n {iconBefore && (\n <ChipIcon\n className={`${CHIP_PGN_CLASS}__icon-before`}\n src={iconBefore}\n /* The following two props should only be passed if _both_ are defined, but we haven't been checking that nor\n enforcing it at runtime, so doing so now would be a breaking change. Hence the `!` */\n onClick={onIconBeforeClick!}\n alt={iconBeforeAlt!}\n variant={variant}\n disabled={disabled}\n />\n )}\n <div\n className={classNames(`${CHIP_PGN_CLASS}__label`, {\n 'p-before': iconBefore,\n 'p-after': iconAfter,\n })}\n >\n {children}\n </div>\n {iconAfter && (\n <ChipIcon\n className={`${CHIP_PGN_CLASS}__icon-after`}\n src={iconAfter}\n /* The following two props should only be passed if _both_ are defined, but we haven't been checking that nor\n enforcing it at runtime, so doing so now would be a breaking change. Hence the `!` */\n onClick={onIconAfterClick!}\n alt={iconAfterAlt!}\n variant={variant}\n disabled={disabled}\n />\n )}\n </div>\n );\n});\n\nexport default Chip;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAiE,OAAO;AACpF,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,YAAY;AAGjC,OAAO,MAAMC,cAAc,GAAG,WAAW;AAuCzC,MAAMC,IAAI,gBAAGJ,KAAK,CAACK,UAAU,CAAC,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,OAAO,GAAG,OAAO;EACjBC,UAAU;EACVC,aAAa;EACbC,SAAS;EACTC,YAAY;EACZC,iBAAiB;EACjBC,gBAAgB;EAChBC,QAAQ,GAAG,KAAK;EAChBC,UAAU,GAAG,KAAK;EAClBC,OAAO;EACP,GAAGC;AACE,CAAC,EAAEC,GAAiC,KAAK;EAC9C,MAAMC,mBAAmB,GAAG,CAAC,EAAEP,iBAAiB,IAAIC,gBAAgB,CAAC;EACrE,MAAMO,iBAAiB,GAAG,CAACD,mBAAmB,IAAI,CAAC,CAACH,OAAO;EAE3D,MAAMK,gBAAgB,GAAGD,iBAAiB,GAAG;IAC3CJ,OAAO;IACPM,UAAU,EAAEN,OAAO;IACnBO,QAAQ,EAAE,CAAC;IACXC,IAAI,EAAE;EACR,CAAC,GAAG,CAAC,CAAC;EAEN,oBACEzB,KAAA,CAAA0B,aAAA;IACEnB,SAAS,EAAEN,UAAU,CACnBE,cAAc,EACd,aAAaK,OAAO,EAAE,EACtBD,SAAS,EACT;MAAEQ,QAAQ;MAAEY,QAAQ,EAAEX,UAAU;MAAEY,WAAW,EAAEP;IAAkB,CACnE,CAAE;IACFF,GAAG,EAAEA,GAAI;IAAA,GACLG,gBAAgB;IAAA,GAChBJ;EAAK,GAERT,UAAU,iBACTT,KAAA,CAAA0B,aAAA,CAACxB,QAAQ;IACPK,SAAS,EAAE,GAAGJ,cAAc,eAAgB;IAC5C0B,GAAG,EAAEpB;IACL;AACV,4FADU;IAEAQ,OAAO,EAAEJ,iBAAmB;IAC5BiB,GAAG,EAAEpB,aAAe;IACpBF,OAAO,EAAEA,OAAQ;IACjBO,QAAQ,EAAEA;EAAS,CACpB,CACF,eACDf,KAAA,CAAA0B,aAAA;IACEnB,SAAS,EAAEN,UAAU,CAAC,GAAGE,cAAc,SAAS,EAAE;MAChD,UAAU,EAAEM,UAAU;MACtB,SAAS,EAAEE;IACb,CAAC;EAAE,GAEFL,QACE,CAAC,EACLK,SAAS,iBACRX,KAAA,CAAA0B,aAAA,CAACxB,QAAQ;IACPK,SAAS,EAAE,GAAGJ,cAAc,cAAe;IAC3C0B,GAAG,EAAElB;IACL;AACV,4FADU;IAEAM,OAAO,EAAEH,gBAAkB;IAC3BgB,GAAG,EAAElB,YAAc;IACnBJ,OAAO,EAAEA,OAAQ;IACjBO,QAAQ,EAAEA;EAAS,CACpB,CAEA,CAAC;AAEV,CAAC,CAAC;AAEF,eAAeX,IAAI","ignoreList":[]}
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { ComponentWithAsProp } from '../utils/types/bootstrap';
3
3
  export interface Props {
4
+ /** Specifies the base element. */
4
5
  as?: string;
6
+ /** Specifies the contents of the header. */
5
7
  children: React.ReactNode;
8
+ /** Specifies class name to append to the base element. */
6
9
  className?: string;
7
10
  }
8
11
  type HeaderType = ComponentWithAsProp<'div', Props>;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import classNames from 'classnames';
4
3
  const ModalDialogHeader = /*#__PURE__*/React.forwardRef(({
5
4
  as = 'div',
@@ -10,17 +9,5 @@ const ModalDialogHeader = /*#__PURE__*/React.forwardRef(({
10
9
  ref,
11
10
  className: classNames('pgn__modal-header', props.className)
12
11
  }, children)));
13
- ModalDialogHeader.propTypes = {
14
- /** Specifies the base element */
15
- as: PropTypes.elementType,
16
- /** Specifies the contents of the header */
17
- children: PropTypes.node.isRequired,
18
- /** Specifies class name to append to the base element */
19
- className: PropTypes.string
20
- };
21
- ModalDialogHeader.defaultProps = {
22
- as: 'div',
23
- className: ''
24
- };
25
12
  export default ModalDialogHeader;
26
13
  //# sourceMappingURL=ModalDialogHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalDialogHeader.js","names":["React","PropTypes","classNames","ModalDialogHeader","forwardRef","as","children","props","ref","createElement","className","propTypes","elementType","node","isRequired","string","defaultProps"],"sources":["../../src/Modal/ModalDialogHeader.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport type { ComponentWithAsProp } from '../utils/types/bootstrap';\n\nexport interface Props {\n as?: string;\n children: React.ReactNode;\n className?: string;\n}\n\ntype HeaderType = ComponentWithAsProp<'div', Props>;\n\nconst ModalDialogHeader: HeaderType = React.forwardRef<HTMLDivElement, Props>(({\n as = 'div',\n children,\n ...props\n}, ref) => (\n React.createElement(\n as,\n {\n ...props,\n ref,\n className: classNames('pgn__modal-header', props.className),\n },\n children,\n )\n));\n\nModalDialogHeader.propTypes = {\n /** Specifies the base element */\n as: PropTypes.elementType,\n /** Specifies the contents of the header */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n};\n\nModalDialogHeader.defaultProps = {\n as: 'div',\n className: '',\n};\n\nexport default ModalDialogHeader;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAWnC,MAAMC,iBAA6B,gBAAGH,KAAK,CAACI,UAAU,CAAwB,CAAC;EAC7EC,EAAE,GAAG,KAAK;EACVC,QAAQ;EACR,GAAGC;AACL,CAAC,EAAEC,GAAG,mBACJR,KAAK,CAACS,aAAa,CACjBJ,EAAE,EACF;EACE,GAAGE,KAAK;EACRC,GAAG;EACHE,SAAS,EAAER,UAAU,CAAC,mBAAmB,EAAEK,KAAK,CAACG,SAAS;AAC5D,CAAC,EACDJ,QACF,CAAC,CACF,CAAC;AAEFH,iBAAiB,CAACQ,SAAS,GAAG;EAC5B;EACAN,EAAE,EAAEJ,SAAS,CAACW,WAAW;EACzB;EACAN,QAAQ,EAAEL,SAAS,CAACY,IAAI,CAACC,UAAU;EACnC;EACAJ,SAAS,EAAET,SAAS,CAACc;AACvB,CAAC;AAEDZ,iBAAiB,CAACa,YAAY,GAAG;EAC/BX,EAAE,EAAE,KAAK;EACTK,SAAS,EAAE;AACb,CAAC;AAED,eAAeP,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"ModalDialogHeader.js","names":["React","classNames","ModalDialogHeader","forwardRef","as","children","props","ref","createElement","className"],"sources":["../../src/Modal/ModalDialogHeader.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport type { ComponentWithAsProp } from '../utils/types/bootstrap';\n\nexport interface Props {\n /** Specifies the base element. */\n as?: string;\n /** Specifies the contents of the header. */\n children: React.ReactNode;\n /** Specifies class name to append to the base element. */\n className?: string;\n}\n\ntype HeaderType = ComponentWithAsProp<'div', Props>;\n\nconst ModalDialogHeader: HeaderType = React.forwardRef(({\n as = 'div',\n children,\n ...props\n}: Props, ref: React.ForwardedRef<HTMLDivElement>) => (\n React.createElement(\n as,\n {\n ...props,\n ref,\n className: classNames('pgn__modal-header', props.className),\n },\n children,\n )\n));\n\nexport default ModalDialogHeader;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAcnC,MAAMC,iBAA6B,gBAAGF,KAAK,CAACG,UAAU,CAAC,CAAC;EACtDC,EAAE,GAAG,KAAK;EACVC,QAAQ;EACR,GAAGC;AACE,CAAC,EAAEC,GAAuC,mBAC/CP,KAAK,CAACQ,aAAa,CACjBJ,EAAE,EACF;EACE,GAAGE,KAAK;EACRC,GAAG;EACHE,SAAS,EAAER,UAAU,CAAC,mBAAmB,EAAEK,KAAK,CAACG,SAAS;AAC5D,CAAC,EACDJ,QACF,CAAC,CACF,CAAC;AAEF,eAAeH,iBAAiB","ignoreList":[]}
@@ -1,128 +1,91 @@
1
- import React from 'react';
2
- import { type OverlayProps } from 'react-bootstrap/Overlay';
1
+ import { type OverlayProps, type OverlayChildren, type Placement } from 'react-bootstrap/Overlay';
3
2
  import { type OverlayTriggerProps, type OverlayTriggerType } from 'react-bootstrap/OverlayTrigger';
4
- import PropTypes from 'prop-types';
5
- declare function Overlay(props: OverlayProps): import("react/jsx-runtime").JSX.Element;
6
- declare namespace Overlay {
7
- var propTypes: {
8
- /** Specifies the content of the `Overlay`. */
9
- children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
10
- /**
11
- * A component instance, DOM node, or function that returns either.
12
- * The overlay will be positioned in relation to the target.
13
- */
14
- container: PropTypes.Requireable<NonNullable<PropTypes.ReactComponentLike | ((...args: any[]) => any) | null | undefined>>;
15
- /** Callback fired before the `Overlay` transitions in. */
16
- onEnter: PropTypes.Requireable<(...args: any[]) => any>;
17
- /** Callback fired after the `Overlay` finishes transitioning in. */
18
- onEntered: PropTypes.Requireable<(...args: any[]) => any>;
19
- /** Callback fired as the `Overlay` begins to transition in. */
20
- onEntering: PropTypes.Requireable<(...args: any[]) => any>;
21
- /** Callback fired right before the `Overlay` transitions out */
22
- onExit: PropTypes.Requireable<(...args: any[]) => any>;
23
- /** Callback fired after the `Overlay` finishes transitioning out. */
24
- onExited: PropTypes.Requireable<(...args: any[]) => any>;
25
- /** Callback fired as the Overlay begins to transition out. */
26
- onExiting: PropTypes.Requireable<(...args: any[]) => any>;
27
- /**
28
- * A callback invoked by the overlay when it wishes to be hidden.
29
- * Required if `rootClose` is specified.
30
- */
31
- onHide: PropTypes.Requireable<(...args: any[]) => any>;
32
- /** The placement of the `Overlay` in relation to it's target. */
33
- placement: PropTypes.Requireable<import("@popperjs/core").Placement>;
34
- /** A set of popper options and props passed directly to `Popper`. */
35
- popperConfig: PropTypes.Requireable<PropTypes.InferProps<{}>>;
36
- /** Specify whether the overlay should trigger `onHide` when the user clicks outside the overlay. */
37
- rootClose: PropTypes.Requireable<boolean>;
38
- /** Specify event for triggering a “root close” toggle. */
39
- rootCloseEvent: PropTypes.Requireable<string>;
40
- /** Set the visibility of the `Overlay`. */
41
- show: PropTypes.Requireable<boolean>;
42
- /**
43
- * The visibility of the `Overlay`. `show` is a controlled prop so should
44
- * be paired with `onToggle` to avoid breaking user interactions.
45
- *
46
- * Manually toggling show does not wait for delay to change the visibility.
47
- *
48
- * Controls `onToggle`.
49
- */
50
- target: PropTypes.Requireable<NonNullable<PropTypes.ReactComponentLike | ((...args: any[]) => any) | null | undefined>>;
51
- /**
52
- * Animate the entering and exiting of the Overlay. `true` will use the `<Fade>` transition,
53
- * or a custom react-transition-group `<Transition>` component can be provided.
54
- */
55
- transition: PropTypes.Requireable<NonNullable<boolean | object | null | undefined>>;
56
- };
57
- var defaultProps: {
58
- container: undefined;
59
- onEnter: undefined;
60
- onEntered: undefined;
61
- onEntering: undefined;
62
- onExit: undefined;
63
- onExited: undefined;
64
- onExiting: undefined;
65
- onHide: undefined;
66
- placement: string;
67
- popperConfig: {};
68
- rootClose: boolean;
69
- rootCloseEvent: undefined;
70
- show: boolean;
71
- target: undefined;
72
- transition: React.ForwardRefExoticComponent<import("react-bootstrap/Fade").FadeProps & React.RefAttributes<import("react-transition-group/Transition").default<any>>>;
73
- };
3
+ export interface ParagonOverlayProps extends Omit<OverlayProps, 'target'> {
4
+ /** Specifies the content of the `Overlay`. */
5
+ children: OverlayChildren;
6
+ /**
7
+ * A component instance, DOM node, or function that returns either.
8
+ * The overlay will be positioned in relation to the target.
9
+ */
10
+ container?: OverlayProps['container'];
11
+ /** Callback fired before the `Overlay` transitions in. */
12
+ onEnter?: (node: HTMLElement, isAppearing: boolean) => any;
13
+ /** Callback fired after the `Overlay` finishes transitioning in. */
14
+ onEntered?: (node: HTMLElement, isAppearing: boolean) => any;
15
+ /** Callback fired as the `Overlay` begins to transition in. */
16
+ onEntering?: (node: HTMLElement, isAppearing: boolean) => any;
17
+ /** Callback fired right before the `Overlay` transitions out. */
18
+ onExit?: (node: HTMLElement) => any;
19
+ /** Callback fired after the `Overlay` finishes transitioning out. */
20
+ onExited?: (node: HTMLElement) => any;
21
+ /** Callback fired as the Overlay begins to transition out. */
22
+ onExiting?: (node: HTMLElement) => any;
23
+ /**
24
+ * A callback invoked by the overlay when it wishes to be hidden.
25
+ * Required if `rootClose` is specified.
26
+ */
27
+ onHide?: (e: Event) => void;
28
+ /**
29
+ * The placement of the `Overlay` in relation to its target.
30
+ *
31
+ * Valid values are: `auto`, `auto-start`, `auto-end`, `top`, `bottom`, `right`, `left`,
32
+ * `top-start`, `top-end`, `bottom-start`, `bottom-end`, `right-start`, `right-end`, `left-start`, `left-end`.
33
+ */
34
+ placement?: Placement;
35
+ /** A set of popper options and props passed directly to `Popper`. */
36
+ popperConfig?: OverlayProps['popperConfig'];
37
+ /** Specify whether the overlay should trigger `onHide` when the user clicks outside the overlay. */
38
+ rootClose?: boolean;
39
+ /** Specify event for triggering a "root close" toggle. */
40
+ rootCloseEvent?: OverlayProps['rootCloseEvent'];
41
+ /** Set the visibility of the `Overlay`. */
42
+ show?: boolean;
43
+ /**
44
+ * The target element the `Overlay` is positioned in relation to.
45
+ * Note: this is marked optional for backwards compatibility, but it is required for the overlay to work,
46
+ * and the upstream types mark it as required.
47
+ */
48
+ target?: OverlayProps['target'];
49
+ /**
50
+ * Animate the entering and exiting of the Overlay. `true` will use the `<Fade>` transition,
51
+ * or a custom react-transition-group `<Transition>` component can be provided.
52
+ */
53
+ transition?: OverlayProps['transition'];
74
54
  }
75
- declare function OverlayTrigger(props: OverlayTriggerProps): import("react/jsx-runtime").JSX.Element;
76
- declare namespace OverlayTrigger {
77
- var propTypes: {
78
- /** Specifies the content of the `OverlayTrigger`. */
79
- children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>>;
80
- /** An element or text to overlay next to the target. */
81
- overlay: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>>;
82
- /** The initial visibility state of the `Overlay`. */
83
- defaultShow: PropTypes.Requireable<boolean>;
84
- /** A millisecond delay amount to show and hide the `Overlay` once triggered. */
85
- delay: PropTypes.Requireable<PropTypes.InferPropsInner<Pick<{}, never>> & Partial<PropTypes.InferPropsInner<Pick<{}, never>>>>;
86
- /** The initial flip state of the `Overlay`. */
87
- flip: PropTypes.Requireable<boolean>;
88
- onHide: PropTypes.Requireable<(...args: any[]) => any>;
89
- /**
90
- * A callback that fires when the user triggers a change in tooltip visibility.
91
- * `onToggle` is called with the desired next show, and generally should be
92
- * passed back to the `show` prop. `onToggle` fires after the configured `delay`.
93
- *
94
- * Controls `show`.
95
- */
96
- onToggle: PropTypes.Requireable<(...args: any[]) => any>;
97
- /** The placement of the `Overlay` in relation to it's target. */
98
- placement: PropTypes.Requireable<import("@popperjs/core").Placement>;
99
- /** A `Popper.js` config object passed to the the underlying popper instance. */
100
- popperConfig: PropTypes.Requireable<PropTypes.InferProps<{}>>;
101
- /**
102
- * The visibility of the `Overlay`. `show` is a controlled prop so should
103
- * be paired with `onToggle` to avoid breaking user interactions.
104
- *
105
- * Manually toggling show does not wait for delay to change the visibility.
106
- *
107
- * Controls `onToggle`.
108
- */
109
- show: PropTypes.Requireable<boolean>;
110
- target: PropTypes.Requireable<EventTarget>;
111
- /** Specify which action or actions trigger `Overlay` visibility. */
112
- trigger: PropTypes.Requireable<NonNullable<OverlayTriggerType | (OverlayTriggerType | null | undefined)[] | null | undefined>>;
113
- };
114
- var defaultProps: {
115
- defaultShow: boolean;
116
- delay: undefined;
117
- flip: undefined;
118
- onHide: undefined;
119
- onToggle: undefined;
120
- placement: undefined;
121
- popperConfig: {};
122
- show: undefined;
123
- target: undefined;
124
- trigger: string[];
125
- };
55
+ export interface ParagonOverlayTriggerProps extends OverlayTriggerProps {
56
+ /** Specifies the content of the `OverlayTrigger`. */
57
+ children: OverlayTriggerProps['children'];
58
+ /** An element or text to overlay next to the target. */
59
+ overlay: OverlayTriggerProps['overlay'];
60
+ /** The initial visibility state of the `Overlay`. */
61
+ defaultShow?: boolean;
62
+ /** A millisecond delay amount to show and hide the `Overlay` once triggered. */
63
+ delay?: OverlayTriggerProps['delay'];
64
+ /** The initial flip state of the `Overlay`. */
65
+ flip?: boolean;
66
+ /** Callback fired when the visibility of the overlay changes. */
67
+ onHide?: OverlayTriggerProps['onHide'];
68
+ /**
69
+ * A callback that fires when the user triggers a change in tooltip visibility.
70
+ * `onToggle` is called with the desired next show, and generally should be
71
+ * passed back to the `show` prop. `onToggle` fires after the configured `delay`.
72
+ */
73
+ onToggle?: OverlayTriggerProps['onToggle'];
74
+ /** The placement of the `Overlay` in relation to its target. */
75
+ placement?: Placement;
76
+ /** A `Popper.js` config object passed to the underlying popper instance. */
77
+ popperConfig?: OverlayTriggerProps['popperConfig'];
78
+ /**
79
+ * The visibility of the `Overlay`. `show` is a controlled prop so should be
80
+ * paired with `onToggle` to avoid breaking user interactions.
81
+ */
82
+ show?: boolean;
83
+ /** The target element the `Overlay` is positioned in relation to. */
84
+ target?: OverlayTriggerProps['target'];
85
+ /** Specify which action or actions trigger `Overlay` visibility. */
86
+ trigger?: OverlayTriggerType | OverlayTriggerType[];
126
87
  }
88
+ declare function Overlay({ placement, popperConfig, rootClose, show, transition, ...props }: ParagonOverlayProps): import("react/jsx-runtime").JSX.Element;
89
+ declare function OverlayTrigger({ defaultShow, popperConfig, trigger, ...props }: ParagonOverlayTriggerProps): import("react/jsx-runtime").JSX.Element;
127
90
  export { OverlayTrigger };
128
91
  export default Overlay;