@openedx/paragon 23.22.1 → 23.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -54
- package/dist/Alert/index.js +0 -1
- package/dist/Alert/index.js.map +1 -1
- package/dist/Card/BaseCard.d.ts +7 -0
- package/dist/Card/BaseCard.js +0 -21
- package/dist/Card/BaseCard.js.map +1 -1
- package/dist/Chip/ChipIcon.d.ts +7 -18
- package/dist/Chip/ChipIcon.js +2 -17
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/index.js +6 -2
- package/dist/Chip/index.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.d.ts +3 -0
- package/dist/Modal/ModalDialogHeader.js +0 -13
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Overlay/index.d.ts +86 -123
- package/dist/Overlay/index.js +25 -123
- package/dist/Overlay/index.js.map +1 -1
- package/dist/Tooltip/index.d.ts +16 -0
- package/dist/Tooltip/index.js +4 -48
- package/dist/Tooltip/index.js.map +1 -1
- package/lib/__tests__/build-scss.test.js +1 -1
- package/lib/__tests__/install-theme.test.js +2 -2
- package/lib/install-theme.js +1 -1
- package/package.json +4 -4
- package/src/Alert/index.tsx +0 -1
- package/src/Card/BaseCard.tsx +7 -21
- package/src/Chip/ChipIcon.tsx +16 -24
- package/src/Chip/index.tsx +8 -4
- package/src/Modal/ModalDialogHeader.tsx +5 -17
- package/src/Overlay/index.tsx +88 -120
- package/src/Tooltip/index.tsx +21 -69
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ Use `paragon help` to see more information.
|
|
|
90
90
|
|
|
91
91
|
## Internationalization
|
|
92
92
|
|
|
93
|
-
Paragon supports internationalization for its components out of the box with the support of [react-intl](https://formatjs.io/docs/react-intl/). You may view translated strings for each component on the documentation website by switching languages in the settings.
|
|
93
|
+
Paragon supports internationalization for its components out of the box with the support of [react-intl](https://formatjs.io/docs/react-intl/). ``react-intl`` 5.x, 6.x, or 10.1.20+ may be used. You may view translated strings for each component on the documentation website by switching languages in the settings.
|
|
94
94
|
|
|
95
95
|
Due to Paragon's dependence on ``react-intl``, that means that your whole app needs to be wrapped in its provider, e.g.:
|
|
96
96
|
|
|
@@ -265,59 +265,30 @@ When developing a new component you should generally follow three rules:
|
|
|
265
265
|
/>
|
|
266
266
|
```
|
|
267
267
|
|
|
268
|
-
- For places where the display string has to be a plain JavaScript string use ``formatMessage``, this would require access to ``intl`` object from ``react-intl``,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
export default injectIntl(MyClassComponent);
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
- For functional components use ``useIntl`` hook
|
|
298
|
-
|
|
299
|
-
```javascript
|
|
300
|
-
import { useIntl } from 'react-intl';
|
|
301
|
-
|
|
302
|
-
const MyFunctionComponent = ({ altText }) => {
|
|
303
|
-
const intls = useIntl();
|
|
304
|
-
const intlAltText = altText || intl.formatMessage({
|
|
305
|
-
id: 'pgn.MyComponent.altText',
|
|
306
|
-
defaultMessage: 'Close',
|
|
307
|
-
description: 'Close label for Toast component',
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
return (
|
|
311
|
-
<IconButton
|
|
312
|
-
alt={intlCloseLabel}
|
|
313
|
-
onClick={() => {}}
|
|
314
|
-
variant="primary"
|
|
315
|
-
/>
|
|
316
|
-
)
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export default MyFunctionComponent;
|
|
320
|
-
```
|
|
268
|
+
- For places where the display string has to be a plain JavaScript string use ``formatMessage``, this would require access to ``intl`` object from ``react-intl``, which is provided by the ``useIntl`` hook (the ``injectIntl`` HOC must not be used, as it was removed in ``react-intl`` 10)
|
|
269
|
+
|
|
270
|
+
```javascript
|
|
271
|
+
import { useIntl } from 'react-intl';
|
|
272
|
+
|
|
273
|
+
const MyFunctionComponent = ({ altText }) => {
|
|
274
|
+
const intl = useIntl();
|
|
275
|
+
const intlAltText = altText || intl.formatMessage({
|
|
276
|
+
id: 'pgn.MyComponent.altText',
|
|
277
|
+
defaultMessage: 'Close',
|
|
278
|
+
description: 'Close label for Toast component',
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
return (
|
|
282
|
+
<IconButton
|
|
283
|
+
alt={intlAltText}
|
|
284
|
+
onClick={() => {}}
|
|
285
|
+
variant="primary"
|
|
286
|
+
/>
|
|
287
|
+
)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export default MyFunctionComponent;
|
|
291
|
+
```
|
|
321
292
|
|
|
322
293
|
**Notes on the format above**:
|
|
323
294
|
- `id` is required and must be a dot-separated string of the format `pgn.<componentName>.<subcomponentName>.<propName>`
|
package/dist/Alert/index.js
CHANGED
package/dist/Alert/index.js.map
CHANGED
|
@@ -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":["
|
|
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,MA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C,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":[]}
|
package/dist/Card/BaseCard.d.ts
CHANGED
|
@@ -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>;
|
package/dist/Card/BaseCard.js
CHANGED
|
@@ -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","
|
|
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":[]}
|
package/dist/Chip/ChipIcon.d.ts
CHANGED
|
@@ -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
|
|
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;
|
package/dist/Chip/ChipIcon.js
CHANGED
|
@@ -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","
|
|
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":[]}
|
package/dist/Chip/index.js
CHANGED
|
@@ -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,
|
package/dist/Chip/index.js.map
CHANGED
|
@@ -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,
|
|
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,QAA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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","
|
|
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":[]}
|