@openedx/paragon 23.0.0-alpha.2 → 23.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button/index.d.ts +35 -0
- package/dist/Button/index.js +37 -15
- package/dist/Button/index.js.map +1 -1
- package/dist/Chip/ChipIcon.d.ts +13 -8
- package/dist/Chip/ChipIcon.js +0 -2
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/constants.d.ts +4 -0
- package/dist/Chip/constants.js +3 -2
- package/dist/Chip/constants.js.map +1 -0
- package/dist/Chip/index.d.ts +4 -3
- package/dist/Chip/index.js +2 -4
- package/dist/Chip/index.js.map +1 -1
- package/dist/ChipCarousel/index.js +0 -2
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/Hyperlink/index.d.ts +24 -0
- package/dist/Hyperlink/index.js +20 -32
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Icon/index.d.ts +4 -2
- package/dist/Icon/index.js +1 -1
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.d.ts +342 -0
- package/dist/IconButton/index.js +18 -26
- package/dist/IconButton/index.js.map +1 -1
- package/dist/Modal/ModalPopup.js +7 -1
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/_ModalDialog.scss +4 -0
- package/dist/Overlay/index.d.ts +128 -0
- package/dist/Overlay/index.js +8 -2
- package/dist/Overlay/index.js.map +1 -1
- package/dist/Tooltip/index.d.ts +7 -0
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/core.css +3 -0
- package/dist/core.css.map +1 -1
- package/dist/core.min.css +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -7
- package/dist/setupTest.d.ts +2 -0
- package/dist/setupTest.js.map +1 -0
- package/dist/utils/types/bootstrap.d.ts +39 -0
- package/dist/utils/types/bootstrap.js +2 -0
- package/dist/utils/types/bootstrap.js.map +1 -0
- package/package.json +5 -5
- package/src/Button/{Button.test.jsx → Button.test.tsx} +14 -2
- package/src/Button/__snapshots__/{Button.test.jsx.snap → Button.test.tsx.snap} +19 -2
- package/src/Button/{index.jsx → index.tsx} +58 -16
- package/src/Chip/{Chip.test.jsx → Chip.test.tsx} +5 -7
- package/src/Chip/ChipIcon.tsx +8 -8
- package/src/Chip/{constants.js → constants.ts} +1 -1
- package/src/Chip/index.tsx +6 -8
- package/src/ChipCarousel/index.tsx +0 -2
- package/src/Hyperlink/{Hyperlink.test.jsx → Hyperlink.test.tsx} +21 -10
- package/src/Hyperlink/{index.jsx → index.tsx} +41 -37
- package/src/Icon/index.d.ts +4 -2
- package/src/Icon/index.jsx +1 -1
- package/src/IconButton/{IconButton.test.jsx → IconButton.test.tsx} +24 -3
- package/src/IconButton/__snapshots__/IconButton.test.tsx.snap +90 -0
- package/src/IconButton/{index.jsx → index.tsx} +66 -26
- package/src/Modal/ModalPopup.jsx +9 -1
- package/src/Modal/_ModalDialog.scss +4 -0
- package/src/Modal/tests/ModalPopupNoMock.test.jsx +29 -0
- package/src/Overlay/{index.jsx → index.tsx} +13 -8
- package/src/Tooltip/{index.jsx → index.tsx} +9 -3
- package/src/index.d.ts +5 -5
- package/src/index.js +7 -7
- package/src/{setupTest.js → setupTest.ts} +1 -0
- package/src/utils/types/bootstrap.test.tsx +86 -0
- package/src/utils/types/bootstrap.ts +43 -0
- package/src/IconButton/__snapshots__/IconButton.test.jsx.snap +0 -20
- /package/src/Button/{ButtonGroup.test.jsx → ButtonGroup.test.tsx} +0 -0
- /package/src/Button/{ButtonToolbar.test.jsx → ButtonToolbar.test.tsx} +0 -0
- /package/src/Button/__snapshots__/{ButtonGroup.test.jsx.snap → ButtonGroup.test.tsx.snap} +0 -0
- /package/src/Button/__snapshots__/{ButtonToolbar.test.jsx.snap → ButtonToolbar.test.tsx.snap} +0 -0
- /package/src/Chip/__snapshots__/{Chip.test.jsx.snap → Chip.test.tsx.snap} +0 -0
- /package/src/Tooltip/{Tooltip.test.jsx → Tooltip.test.tsx} +0 -0
package/dist/Icon/index.js
CHANGED
|
@@ -61,7 +61,7 @@ Icon.propTypes = {
|
|
|
61
61
|
* An icon component to render.
|
|
62
62
|
* Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';`
|
|
63
63
|
*/
|
|
64
|
-
src: PropTypes.
|
|
64
|
+
src: PropTypes.elementType,
|
|
65
65
|
/** HTML element attributes to pass through to the underlying svg element */
|
|
66
66
|
svgAttrs: PropTypes.shape({
|
|
67
67
|
'aria-label': PropTypes.string,
|
package/dist/Icon/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","newId","withDeprecatedProps","DeprTypes","Icon","_ref","Component","src","id","className","hidden","screenReaderText","svgAttrs","size","attrs","_objectWithoutProperties","_excluded","hasAriaLabel","mergedSvgProps","_objectSpread","undefined","createElement","_extends","_defineProperty","concat","role","focusable","Fragment","propTypes","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","newId","withDeprecatedProps","DeprTypes","Icon","_ref","Component","src","id","className","hidden","screenReaderText","svgAttrs","size","attrs","_objectWithoutProperties","_excluded","hasAriaLabel","mergedSvgProps","_objectSpread","undefined","createElement","_extends","_defineProperty","concat","role","focusable","Fragment","propTypes","elementType","shape","string","oneOf","bool","oneOfType","element","defaultProps","deprType","FORMAT","expect","value","transform","Array","isArray","join","message"],"sources":["../../src/Icon/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport newId from '../utils/newId';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\n/**\n * An svg with an \"img\" role must satisfy the following a11y requirements\n * - It needs a text alternative in the form of aria-label, aria-labelledby, or screen-reader only text.\n * - If no label is desired, aria-label will be set to an empty string and aria-hidden to \"true\".\n * - focusable is set to false on the svg in all cases as a workaround for an ie11 bug\n */\n\nfunction Icon({\n src: Component,\n id,\n className,\n hidden,\n screenReaderText,\n svgAttrs,\n size,\n ...attrs\n}) {\n if (Component) {\n // If no aria label is specified, hide this icon from screenreaders\n const hasAriaLabel = svgAttrs['aria-label'] || svgAttrs['aria-labelledby'];\n\n const mergedSvgProps = { ...svgAttrs };\n\n if (!hasAriaLabel) {\n mergedSvgProps['aria-label'] = undefined;\n mergedSvgProps['aria-hidden'] = true;\n }\n\n return (\n <span\n className={classNames('pgn__icon', { [`pgn__icon__${size}`]: !!size }, className)}\n id={id}\n {...attrs}\n >\n <Component\n role=\"img\"\n focusable={false}\n {...mergedSvgProps}\n />\n {screenReaderText && (\n <span className=\"sr-only\">\n {screenReaderText}\n </span>\n )}\n </span>\n );\n }\n\n return (\n <>\n <span\n id={id || newId('Icon')}\n className={className}\n aria-hidden={hidden}\n />\n {screenReaderText && (\n <span className=\"sr-only\">\n {screenReaderText}\n </span>\n )}\n </>\n );\n}\n\nIcon.propTypes = {\n /**\n * An icon component to render.\n * Example import of a Paragon icon component: `import { Check } from '@openedx/paragon/icons';`\n */\n src: PropTypes.elementType,\n /** HTML element attributes to pass through to the underlying svg element */\n svgAttrs: PropTypes.shape({\n 'aria-label': PropTypes.string,\n 'aria-labelledby': PropTypes.string,\n }),\n /**\n * the `id` property of the Icon element, by default this value is generated\n * with the `newId` function with the `prefix` of `Icon`.\n */\n id: PropTypes.string,\n /** The size of the icon. */\n size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),\n /** A class name that will define what the Icon looks like. */\n className: PropTypes.string,\n /**\n * a boolean that determines the value of `aria-hidden` attribute on the Icon span,\n * this value is `true` by default.\n */\n hidden: PropTypes.bool,\n /**\n * a string or an element that will be used on a secondary span leveraging the `sr-only` style\n * for screenreader only text, this value is `undefined` by default. This value is recommended for use unless\n * the Icon is being used in a way that is purely decorative or provides no additional context for screen\n * reader users. This field should be thought of the same way an `alt` attribute would be used for `image` tags.\n */\n screenReaderText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n};\n\nIcon.defaultProps = {\n src: null,\n svgAttrs: {},\n id: undefined,\n hidden: true,\n screenReaderText: undefined,\n size: undefined,\n className: undefined,\n};\n\nexport default withDeprecatedProps(Icon, 'Icon', {\n className: {\n deprType: DeprTypes.FORMAT,\n expect: value => typeof value === 'string',\n transform: value => (Array.isArray(value) ? value.join(' ') : value),\n message: 'It should be a string.',\n },\n});\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,KAAK,MAAM,gBAAgB;AAClC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;;AAEvE;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASC,IAAIA,CAAAC,IAAA,EASV;EAAA,IARIC,SAAS,GAAAD,IAAA,CAAdE,GAAG;IACHC,EAAE,GAAAH,IAAA,CAAFG,EAAE;IACFC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IACTC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,gBAAgB,GAAAN,IAAA,CAAhBM,gBAAgB;IAChBC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,IAAI,GAAAR,IAAA,CAAJQ,IAAI;IACDC,KAAK,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA;EAER,IAAIV,SAAS,EAAE;IACb;IACA,IAAMW,YAAY,GAAGL,QAAQ,CAAC,YAAY,CAAC,IAAIA,QAAQ,CAAC,iBAAiB,CAAC;IAE1E,IAAMM,cAAc,GAAAC,aAAA,KAAQP,QAAQ,CAAE;IAEtC,IAAI,CAACK,YAAY,EAAE;MACjBC,cAAc,CAAC,YAAY,CAAC,GAAGE,SAAS;MACxCF,cAAc,CAAC,aAAa,CAAC,GAAG,IAAI;IACtC;IAEA,oBACEpB,KAAA,CAAAuB,aAAA,SAAAC,QAAA;MACEb,SAAS,EAAET,UAAU,CAAC,WAAW,EAAAuB,eAAA,mBAAAC,MAAA,CAAmBX,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S,CAACgC,MAAM,EAAEhC,SAAS,CAACoC,OAAO,CAAC;AAC7E,CAAC;AAED/B,IAAI,CAACgC,YAAY,GAAG;EAClB7B,GAAG,EAAE,IAAI;EACTK,QAAQ,EAAE,CAAC,CAAC;EACZJ,EAAE,EAAEY,SAAS;EACbV,MAAM,EAAE,IAAI;EACZC,gBAAgB,EAAES,SAAS;EAC3BP,IAAI,EAAEO,SAAS;EACfX,SAAS,EAAEW;AACb,CAAC;AAED,eAAelB,mBAAmB,CAACE,IAAI,EAAE,MAAM,EAAE;EAC/CK,SAAS,EAAE;IACT4B,QAAQ,EAAElC,SAAS,CAACmC,MAAM;IAC1BC,MAAM,EAAE,SAAAA,OAAAC,KAAK;MAAA,OAAI,OAAOA,KAAK,KAAK,QAAQ;IAAA;IAC1CC,SAAS,EAAE,SAAAA,UAAAD,KAAK;MAAA,OAAKE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,CAACI,IAAI,CAAC,GAAG,CAAC,GAAGJ,KAAK;IAAA,CAAC;IACpEK,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { type Placement } from 'react-bootstrap/Overlay';
|
|
4
|
+
interface Props extends React.HTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
iconAs?: React.ComponentType<any>;
|
|
6
|
+
/** Additional CSS class[es] to apply to this button */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Alt text for your icon. For best practice, avoid using alt text to describe
|
|
9
|
+
* the image in the `IconButton`. Instead, we recommend describing the function
|
|
10
|
+
* of the button. */
|
|
11
|
+
alt: string;
|
|
12
|
+
/** Changes icon styles for dark background */
|
|
13
|
+
invertColors?: boolean;
|
|
14
|
+
/** An icon component to render. Example import of a Paragon icon component:
|
|
15
|
+
* `import { Check } from '@openedx/paragon/icons';`
|
|
16
|
+
* */
|
|
17
|
+
src?: React.ComponentType;
|
|
18
|
+
/** Extra class names that will be added to the icon */
|
|
19
|
+
iconClassNames?: string;
|
|
20
|
+
/** Click handler for the button */
|
|
21
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
22
|
+
/** whether to show the `IconButton` in an active state, whose styling is distinct from default state */
|
|
23
|
+
isActive?: boolean;
|
|
24
|
+
/** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */
|
|
25
|
+
icon?: {
|
|
26
|
+
prefix?: string;
|
|
27
|
+
iconName?: string;
|
|
28
|
+
icon?: any[];
|
|
29
|
+
};
|
|
30
|
+
/** Type of button (uses Bootstrap options) */
|
|
31
|
+
variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';
|
|
32
|
+
/** size of button to render */
|
|
33
|
+
size?: 'sm' | 'md' | 'inline';
|
|
34
|
+
/** no children */
|
|
35
|
+
children?: never;
|
|
36
|
+
}
|
|
37
|
+
interface PropsWithTooltip extends Props {
|
|
38
|
+
/** choose from https://popper.js.org/docs/v2/constructors/#options */
|
|
39
|
+
tooltipPlacement: Placement;
|
|
40
|
+
/** any content to pass to tooltip content area */
|
|
41
|
+
tooltipContent: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* An icon button wrapped in overlaytrigger to display a tooltip.
|
|
45
|
+
*/
|
|
46
|
+
declare function IconButtonWithTooltip({ tooltipPlacement, tooltipContent, ...props }: PropsWithTooltip): React.JSX.Element;
|
|
47
|
+
declare namespace IconButtonWithTooltip {
|
|
48
|
+
var defaultProps: {
|
|
49
|
+
tooltipPlacement: string;
|
|
50
|
+
iconAs?: React.ComponentType<any> | undefined;
|
|
51
|
+
className?: string | undefined;
|
|
52
|
+
alt?: string | undefined;
|
|
53
|
+
invertColors?: boolean | undefined;
|
|
54
|
+
src?: React.ComponentType<{}> | undefined;
|
|
55
|
+
iconClassNames?: string | undefined;
|
|
56
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
57
|
+
isActive?: boolean | undefined;
|
|
58
|
+
icon?: {
|
|
59
|
+
prefix?: string | undefined;
|
|
60
|
+
iconName?: string | undefined;
|
|
61
|
+
icon?: any[] | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
variant?: "primary" | "success" | "warning" | "secondary" | "danger" | "dark" | "light" | "black" | "brand" | undefined;
|
|
64
|
+
size?: "sm" | "md" | "inline" | undefined;
|
|
65
|
+
children?: undefined;
|
|
66
|
+
defaultChecked?: boolean | undefined;
|
|
67
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
68
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
69
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
70
|
+
accessKey?: string | undefined;
|
|
71
|
+
autoFocus?: boolean | undefined;
|
|
72
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
73
|
+
contextMenu?: string | undefined;
|
|
74
|
+
dir?: string | undefined;
|
|
75
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
76
|
+
hidden?: boolean | undefined;
|
|
77
|
+
id?: string | undefined;
|
|
78
|
+
lang?: string | undefined;
|
|
79
|
+
nonce?: string | undefined;
|
|
80
|
+
placeholder?: string | undefined;
|
|
81
|
+
slot?: string | undefined;
|
|
82
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
83
|
+
style?: React.CSSProperties | undefined;
|
|
84
|
+
tabIndex?: number | undefined;
|
|
85
|
+
title?: string | undefined;
|
|
86
|
+
translate?: "yes" | "no" | undefined;
|
|
87
|
+
radioGroup?: string | undefined;
|
|
88
|
+
role?: React.AriaRole | undefined;
|
|
89
|
+
about?: string | undefined;
|
|
90
|
+
content?: string | undefined;
|
|
91
|
+
datatype?: string | undefined;
|
|
92
|
+
inlist?: any;
|
|
93
|
+
prefix?: string | undefined;
|
|
94
|
+
property?: string | undefined;
|
|
95
|
+
rel?: string | undefined;
|
|
96
|
+
resource?: string | undefined;
|
|
97
|
+
rev?: string | undefined;
|
|
98
|
+
typeof?: string | undefined;
|
|
99
|
+
vocab?: string | undefined;
|
|
100
|
+
autoCapitalize?: string | undefined;
|
|
101
|
+
autoCorrect?: string | undefined;
|
|
102
|
+
autoSave?: string | undefined;
|
|
103
|
+
color?: string | undefined;
|
|
104
|
+
itemProp?: string | undefined;
|
|
105
|
+
itemScope?: boolean | undefined;
|
|
106
|
+
itemType?: string | undefined;
|
|
107
|
+
itemID?: string | undefined;
|
|
108
|
+
itemRef?: string | undefined;
|
|
109
|
+
results?: number | undefined;
|
|
110
|
+
security?: string | undefined;
|
|
111
|
+
unselectable?: "on" | "off" | undefined;
|
|
112
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
113
|
+
is?: string | undefined;
|
|
114
|
+
"aria-activedescendant"?: string | undefined;
|
|
115
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
116
|
+
"aria-autocomplete"?: "inline" | "list" | "none" | "both" | undefined;
|
|
117
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
118
|
+
"aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
119
|
+
"aria-colcount"?: number | undefined;
|
|
120
|
+
"aria-colindex"?: number | undefined;
|
|
121
|
+
"aria-colspan"?: number | undefined;
|
|
122
|
+
"aria-controls"?: string | undefined;
|
|
123
|
+
"aria-current"?: boolean | "time" | "step" | "true" | "false" | "page" | "location" | "date" | undefined;
|
|
124
|
+
"aria-describedby"?: string | undefined;
|
|
125
|
+
"aria-details"?: string | undefined;
|
|
126
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
127
|
+
"aria-dropeffect"?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
|
|
128
|
+
"aria-errormessage"?: string | undefined;
|
|
129
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
130
|
+
"aria-flowto"?: string | undefined;
|
|
131
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
132
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
133
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
134
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
135
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
136
|
+
"aria-label"?: string | undefined;
|
|
137
|
+
"aria-labelledby"?: string | undefined;
|
|
138
|
+
"aria-level"?: number | undefined;
|
|
139
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
140
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
141
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
142
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
143
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
144
|
+
"aria-owns"?: string | undefined;
|
|
145
|
+
"aria-placeholder"?: string | undefined;
|
|
146
|
+
"aria-posinset"?: number | undefined;
|
|
147
|
+
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
148
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
149
|
+
"aria-relevant"?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
150
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
151
|
+
"aria-roledescription"?: string | undefined;
|
|
152
|
+
"aria-rowcount"?: number | undefined;
|
|
153
|
+
"aria-rowindex"?: number | undefined;
|
|
154
|
+
"aria-rowspan"?: number | undefined;
|
|
155
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
156
|
+
"aria-setsize"?: number | undefined;
|
|
157
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
158
|
+
"aria-valuemax"?: number | undefined;
|
|
159
|
+
"aria-valuemin"?: number | undefined;
|
|
160
|
+
"aria-valuenow"?: number | undefined;
|
|
161
|
+
"aria-valuetext"?: string | undefined;
|
|
162
|
+
dangerouslySetInnerHTML?: {
|
|
163
|
+
__html: string | TrustedHTML;
|
|
164
|
+
} | undefined;
|
|
165
|
+
onCopy?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
166
|
+
onCopyCapture?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
167
|
+
onCut?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
168
|
+
onCutCapture?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
169
|
+
onPaste?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
170
|
+
onPasteCapture?: React.ClipboardEventHandler<HTMLButtonElement> | undefined;
|
|
171
|
+
onCompositionEnd?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
172
|
+
onCompositionEndCapture?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
173
|
+
onCompositionStart?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
174
|
+
onCompositionStartCapture?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
175
|
+
onCompositionUpdate?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
176
|
+
onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLButtonElement> | undefined;
|
|
177
|
+
onFocus?: React.FocusEventHandler<HTMLButtonElement> | undefined;
|
|
178
|
+
onFocusCapture?: React.FocusEventHandler<HTMLButtonElement> | undefined;
|
|
179
|
+
onBlur?: React.FocusEventHandler<HTMLButtonElement> | undefined;
|
|
180
|
+
onBlurCapture?: React.FocusEventHandler<HTMLButtonElement> | undefined;
|
|
181
|
+
onChange?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
182
|
+
onChangeCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
183
|
+
onBeforeInput?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
184
|
+
onBeforeInputCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
185
|
+
onInput?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
186
|
+
onInputCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
187
|
+
onReset?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
188
|
+
onResetCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
189
|
+
onSubmit?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
190
|
+
onSubmitCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
191
|
+
onInvalid?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
192
|
+
onInvalidCapture?: React.FormEventHandler<HTMLButtonElement> | undefined;
|
|
193
|
+
onLoad?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
194
|
+
onLoadCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
195
|
+
onError?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
196
|
+
onErrorCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
197
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
198
|
+
onKeyDownCapture?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
199
|
+
onKeyPress?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
200
|
+
onKeyPressCapture?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
201
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
202
|
+
onKeyUpCapture?: React.KeyboardEventHandler<HTMLButtonElement> | undefined;
|
|
203
|
+
onAbort?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
204
|
+
onAbortCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
205
|
+
onCanPlay?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
206
|
+
onCanPlayCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
207
|
+
onCanPlayThrough?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
208
|
+
onCanPlayThroughCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
209
|
+
onDurationChange?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
210
|
+
onDurationChangeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
211
|
+
onEmptied?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
212
|
+
onEmptiedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
213
|
+
onEncrypted?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
214
|
+
onEncryptedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
215
|
+
onEnded?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
216
|
+
onEndedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
217
|
+
onLoadedData?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
218
|
+
onLoadedDataCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
219
|
+
onLoadedMetadata?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
220
|
+
onLoadedMetadataCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
221
|
+
onLoadStart?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
222
|
+
onLoadStartCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
223
|
+
onPause?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
224
|
+
onPauseCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
225
|
+
onPlay?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
226
|
+
onPlayCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
227
|
+
onPlaying?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
228
|
+
onPlayingCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
229
|
+
onProgress?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
230
|
+
onProgressCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
231
|
+
onRateChange?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
232
|
+
onRateChangeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
233
|
+
onSeeked?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
234
|
+
onSeekedCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
235
|
+
onSeeking?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
236
|
+
onSeekingCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
237
|
+
onStalled?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
238
|
+
onStalledCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
239
|
+
onSuspend?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
240
|
+
onSuspendCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
241
|
+
onTimeUpdate?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
242
|
+
onTimeUpdateCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
243
|
+
onVolumeChange?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
244
|
+
onVolumeChangeCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
245
|
+
onWaiting?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
246
|
+
onWaitingCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
247
|
+
onAuxClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
248
|
+
onAuxClickCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
249
|
+
onClickCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
250
|
+
onContextMenu?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
251
|
+
onContextMenuCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
252
|
+
onDoubleClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
253
|
+
onDoubleClickCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
254
|
+
onDrag?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
255
|
+
onDragCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
256
|
+
onDragEnd?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
257
|
+
onDragEndCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
258
|
+
onDragEnter?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
259
|
+
onDragEnterCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
260
|
+
onDragExit?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
261
|
+
onDragExitCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
262
|
+
onDragLeave?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
263
|
+
onDragLeaveCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
264
|
+
onDragOver?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
265
|
+
onDragOverCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
266
|
+
onDragStart?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
267
|
+
onDragStartCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
268
|
+
onDrop?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
269
|
+
onDropCapture?: React.DragEventHandler<HTMLButtonElement> | undefined;
|
|
270
|
+
onMouseDown?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
271
|
+
onMouseDownCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
272
|
+
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
273
|
+
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
274
|
+
onMouseMove?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
275
|
+
onMouseMoveCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
276
|
+
onMouseOut?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
277
|
+
onMouseOutCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
278
|
+
onMouseOver?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
279
|
+
onMouseOverCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
280
|
+
onMouseUp?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
281
|
+
onMouseUpCapture?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
282
|
+
onSelect?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
283
|
+
onSelectCapture?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
284
|
+
onTouchCancel?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
285
|
+
onTouchCancelCapture?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
286
|
+
onTouchEnd?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
287
|
+
onTouchEndCapture?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
288
|
+
onTouchMove?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
289
|
+
onTouchMoveCapture?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
290
|
+
onTouchStart?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
291
|
+
onTouchStartCapture?: React.TouchEventHandler<HTMLButtonElement> | undefined;
|
|
292
|
+
onPointerDown?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
293
|
+
onPointerDownCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
294
|
+
onPointerMove?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
295
|
+
onPointerMoveCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
296
|
+
onPointerUp?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
297
|
+
onPointerUpCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
298
|
+
onPointerCancel?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
299
|
+
onPointerCancelCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
300
|
+
onPointerEnter?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
301
|
+
onPointerEnterCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
302
|
+
onPointerLeave?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
303
|
+
onPointerLeaveCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
304
|
+
onPointerOver?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
305
|
+
onPointerOverCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
306
|
+
onPointerOut?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
307
|
+
onPointerOutCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
308
|
+
onGotPointerCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
309
|
+
onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
310
|
+
onLostPointerCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
311
|
+
onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLButtonElement> | undefined;
|
|
312
|
+
onScroll?: React.UIEventHandler<HTMLButtonElement> | undefined;
|
|
313
|
+
onScrollCapture?: React.UIEventHandler<HTMLButtonElement> | undefined;
|
|
314
|
+
onWheel?: React.WheelEventHandler<HTMLButtonElement> | undefined;
|
|
315
|
+
onWheelCapture?: React.WheelEventHandler<HTMLButtonElement> | undefined;
|
|
316
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
317
|
+
onAnimationStartCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
318
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
319
|
+
onAnimationEndCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
320
|
+
onAnimationIteration?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
321
|
+
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
322
|
+
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
323
|
+
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
324
|
+
ref?: React.Ref<HTMLButtonElement> | undefined;
|
|
325
|
+
key?: React.Key | null | undefined;
|
|
326
|
+
};
|
|
327
|
+
var propTypes: {
|
|
328
|
+
/** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */
|
|
329
|
+
tooltipPlacement: PropTypes.Requireable<string>;
|
|
330
|
+
/** any valid JSX or text to be rendered as tooltip contents */
|
|
331
|
+
tooltipContent: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
332
|
+
/** Type of button (uses Bootstrap options) */
|
|
333
|
+
variant: PropTypes.Requireable<string>;
|
|
334
|
+
/** Changes icon styles for dark background */
|
|
335
|
+
invertColors: PropTypes.Requireable<boolean>;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLButtonElement>> & {
|
|
339
|
+
IconButtonWithTooltip: typeof IconButtonWithTooltip;
|
|
340
|
+
};
|
|
341
|
+
export default _default;
|
|
342
|
+
export { IconButtonWithTooltip };
|
package/dist/IconButton/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["className", "alt", "invertColors", "icon", "src", "iconClassNames", "onClick", "size", "variant", "iconAs", "isActive"],
|
|
3
|
-
_excluded2 = ["tooltipPlacement", "tooltipContent"
|
|
2
|
+
var _excluded = ["className", "alt", "invertColors", "icon", "src", "iconClassNames", "onClick", "size", "variant", "iconAs", "isActive", "children"],
|
|
3
|
+
_excluded2 = ["tooltipPlacement", "tooltipContent"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
6
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
@@ -25,6 +27,7 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25
27
|
variant = _ref.variant,
|
|
26
28
|
iconAs = _ref.iconAs,
|
|
27
29
|
isActive = _ref.isActive,
|
|
30
|
+
children = _ref.children,
|
|
28
31
|
attrs = _objectWithoutProperties(_ref, _excluded);
|
|
29
32
|
var invert = invertColors ? 'inverse-' : '';
|
|
30
33
|
var activeStyle = isActive ? "".concat(variant, "-") : '';
|
|
@@ -37,7 +40,7 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
37
40
|
ref: ref
|
|
38
41
|
}, attrs), /*#__PURE__*/React.createElement("span", {
|
|
39
42
|
className: "btn-icon__icon-container"
|
|
40
|
-
}, /*#__PURE__*/React.createElement(IconComponent, {
|
|
43
|
+
}, IconComponent && /*#__PURE__*/React.createElement(IconComponent, {
|
|
41
44
|
className: classNames('btn-icon__icon', iconClassNames),
|
|
42
45
|
icon: icon,
|
|
43
46
|
src: src
|
|
@@ -45,7 +48,7 @@ var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
45
48
|
});
|
|
46
49
|
IconButton.defaultProps = {
|
|
47
50
|
iconAs: Icon,
|
|
48
|
-
src:
|
|
51
|
+
src: undefined,
|
|
49
52
|
icon: undefined,
|
|
50
53
|
iconClassNames: undefined,
|
|
51
54
|
className: undefined,
|
|
@@ -53,7 +56,8 @@ IconButton.defaultProps = {
|
|
|
53
56
|
variant: 'primary',
|
|
54
57
|
size: 'md',
|
|
55
58
|
onClick: function onClick() {},
|
|
56
|
-
isActive: false
|
|
59
|
+
isActive: false,
|
|
60
|
+
children: undefined
|
|
57
61
|
};
|
|
58
62
|
IconButton.propTypes = {
|
|
59
63
|
/** A custom class name. */
|
|
@@ -61,9 +65,9 @@ IconButton.propTypes = {
|
|
|
61
65
|
/** Component that renders the icon, currently defaults to `Icon` */
|
|
62
66
|
iconAs: PropTypes.elementType,
|
|
63
67
|
/** An icon component to render. Example import of a Paragon icon component:
|
|
64
|
-
* `import { Check } from '@openedx/paragon/
|
|
68
|
+
* `import { Check } from '@openedx/paragon/icons';`
|
|
65
69
|
* */
|
|
66
|
-
src: PropTypes.
|
|
70
|
+
src: PropTypes.elementType,
|
|
67
71
|
/** Alt text for your icon. For best practice, avoid using alt text to describe
|
|
68
72
|
* the image in the `IconButton`. Instead, we recommend describing the function
|
|
69
73
|
* of the button. */
|
|
@@ -88,37 +92,25 @@ IconButton.propTypes = {
|
|
|
88
92
|
/** whether to show the `IconButton` in an active state, whose styling is distinct from default state */
|
|
89
93
|
isActive: PropTypes.bool
|
|
90
94
|
};
|
|
91
|
-
|
|
92
95
|
/**
|
|
93
|
-
*
|
|
94
|
-
* @param { object } args Arguments
|
|
95
|
-
* @param { string } args.tooltipPlacement choose from https://popper.js.org/docs/v2/constructors/#options
|
|
96
|
-
* @param { React.Component } args.tooltipContent any content to pass to tooltip content area
|
|
97
|
-
* @returns { IconButton } a button wrapped in overlaytrigger
|
|
96
|
+
* An icon button wrapped in overlaytrigger to display a tooltip.
|
|
98
97
|
*/
|
|
99
98
|
function IconButtonWithTooltip(_ref2) {
|
|
100
99
|
var tooltipPlacement = _ref2.tooltipPlacement,
|
|
101
100
|
tooltipContent = _ref2.tooltipContent,
|
|
102
|
-
variant = _ref2.variant,
|
|
103
|
-
invertColors = _ref2.invertColors,
|
|
104
101
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
105
|
-
var invert = invertColors ? 'inverse-' : '';
|
|
102
|
+
var invert = props.invertColors ? 'inverse-' : '';
|
|
106
103
|
return /*#__PURE__*/React.createElement(OverlayTrigger, {
|
|
107
104
|
placement: tooltipPlacement,
|
|
108
105
|
overlay: /*#__PURE__*/React.createElement(Tooltip, {
|
|
109
106
|
id: "iconbutton-tooltip-".concat(tooltipPlacement),
|
|
110
|
-
variant: invert ? 'light' :
|
|
107
|
+
variant: invert ? 'light' : undefined
|
|
111
108
|
}, tooltipContent)
|
|
112
|
-
}, /*#__PURE__*/React.createElement(IconButton,
|
|
113
|
-
variant: variant,
|
|
114
|
-
invertColors: invertColors
|
|
115
|
-
}, props)));
|
|
109
|
+
}, /*#__PURE__*/React.createElement(IconButton, props));
|
|
116
110
|
}
|
|
117
|
-
IconButtonWithTooltip.defaultProps = {
|
|
118
|
-
tooltipPlacement: 'top'
|
|
119
|
-
|
|
120
|
-
invertColors: false
|
|
121
|
-
};
|
|
111
|
+
IconButtonWithTooltip.defaultProps = _objectSpread(_objectSpread({}, IconButton.defaultProps), {}, {
|
|
112
|
+
tooltipPlacement: 'top'
|
|
113
|
+
});
|
|
122
114
|
IconButtonWithTooltip.propTypes = {
|
|
123
115
|
/** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */
|
|
124
116
|
tooltipPlacement: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","Icon","OverlayTrigger","Tooltip","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","attrs","_objectWithoutProperties","_excluded","invert","activeStyle","concat","IconComponent","createElement","_extends","_defineProperty","type","defaultProps","undefined","propTypes","string","elementType","oneOfType","element","isRequired","bool","shape","prefix","iconName","array","func","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","_excluded2","placement","overlay","id","node"],"sources":["../../src/IconButton/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport Icon from '../Icon';\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\n\nconst IconButton = React.forwardRef(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n const IconComponent = iconAs;\n\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon}\n src={src}\n />\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: Icon,\n src: null,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `Icon` */\n iconAs: PropTypes.elementType,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/dist/icon';`\n * */\n src: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a [Paragon icon](https://paragon-openedx.netlify.app/foundations/icons) */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }),\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n};\n\n/**\n *\n * @param { object } args Arguments\n * @param { string } args.tooltipPlacement choose from https://popper.js.org/docs/v2/constructors/#options\n * @param { React.Component } args.tooltipContent any content to pass to tooltip content area\n * @returns { IconButton } a button wrapped in overlaytrigger\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, variant, invertColors, ...props\n}) {\n const invert = invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : ''}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton variant={variant} invertColors={invertColors} {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n tooltipPlacement: 'top',\n variant: 'primary',\n invertColors: false,\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\nIconButton.IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton;\nexport { IconButtonWithTooltip };\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,cAAc,QAAQ,YAAY;AAC3C,OAAOC,OAAO,MAAM,YAAY;AAEhC,IAAMC,UAAU,gBAAGN,KAAK,CAACO,UAAU,CAAC,UAAAC,IAAA,EAajCC,GAAG,EAAK;EAAA,IAZTC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IACHC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,IAAI,GAAAL,IAAA,CAAJK,IAAI;IACJC,GAAG,GAAAN,IAAA,CAAHM,GAAG;IACHC,cAAc,GAAAP,IAAA,CAAdO,c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B,SAASyC,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","Icon","OverlayTrigger","Tooltip","IconButton","forwardRef","_ref","ref","className","alt","invertColors","icon","src","iconClassNames","onClick","size","variant","iconAs","isActive","children","attrs","_objectWithoutProperties","_excluded","invert","activeStyle","concat","IconComponent","createElement","_extends","_defineProperty","type","defaultProps","undefined","propTypes","string","elementType","isRequired","bool","shape","prefix","iconName","array","func","oneOf","IconButtonWithTooltip","_ref2","tooltipPlacement","tooltipContent","props","_excluded2","placement","overlay","id","_objectSpread","node"],"sources":["../../src/IconButton/index.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { type Placement } from 'react-bootstrap/Overlay';\nimport Icon from '../Icon';\nimport { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\n\ninterface Props extends React.HTMLAttributes<HTMLButtonElement> {\n iconAs?: React.ComponentType<any>,\n /** Additional CSS class[es] to apply to this button */\n className?: string;\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: string;\n /** Changes icon styles for dark background */\n invertColors?: boolean;\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n // Note: React.ComponentType is what we want here. React.ElementType would allow some element type strings like \"div\",\n // but we only want to allow components like 'Add' (a specific icon component function/class)\n src?: React.ComponentType;\n /** Extra class names that will be added to the icon */\n iconClassNames?: string;\n /** Click handler for the button */\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive?: boolean;\n /** @deprecated Using FontAwesome icons is deprecated. Instead, pass iconAs={Icon} src={...} */\n icon?: { prefix?: string; iconName?: string, icon?: any[] },\n /** Type of button (uses Bootstrap options) */\n variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'black' | 'brand';\n /** size of button to render */\n size?: 'sm' | 'md' | 'inline';\n /** no children */\n children?: never;\n}\n\nconst IconButton = React.forwardRef<HTMLButtonElement, Props>(({\n className,\n alt,\n invertColors,\n icon,\n src,\n iconClassNames,\n onClick,\n size,\n variant,\n iconAs,\n isActive,\n children, // unused, just here because we don't want it to be part of 'attrs'\n ...attrs\n}, ref) => {\n const invert = invertColors ? 'inverse-' : '';\n const activeStyle = isActive ? `${variant}-` : '';\n const IconComponent = iconAs;\n\n return (\n <button\n aria-label={alt}\n className={classNames(\n 'btn-icon',\n `btn-icon-${invert}${variant}`,\n `btn-icon-${size}`,\n {\n [`btn-icon-${invert}${activeStyle}active`]: isActive,\n },\n className,\n )}\n onClick={onClick}\n type=\"button\"\n ref={ref}\n {...attrs}\n >\n <span className=\"btn-icon__icon-container\">\n {IconComponent && (\n <IconComponent\n className={classNames('btn-icon__icon', iconClassNames)}\n icon={icon as any}\n src={src}\n />\n )}\n </span>\n </button>\n );\n});\n\nIconButton.defaultProps = {\n iconAs: Icon,\n src: undefined,\n icon: undefined,\n iconClassNames: undefined,\n className: undefined,\n invertColors: false,\n variant: 'primary',\n size: 'md',\n onClick: () => {},\n isActive: false,\n children: undefined,\n};\n\nIconButton.propTypes = {\n /** A custom class name. */\n className: PropTypes.string,\n /** Component that renders the icon, currently defaults to `Icon` */\n iconAs: PropTypes.elementType as any,\n /** An icon component to render. Example import of a Paragon icon component:\n * `import { Check } from '@openedx/paragon/icons';`\n * */\n src: PropTypes.elementType as any,\n /** Alt text for your icon. For best practice, avoid using alt text to describe\n * the image in the `IconButton`. Instead, we recommend describing the function\n * of the button. */\n alt: PropTypes.string.isRequired,\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n /** Accepts a [Paragon icon](https://paragon-openedx.netlify.app/foundations/icons) */\n icon: PropTypes.shape({\n prefix: PropTypes.string,\n iconName: PropTypes.string,\n // eslint-disable-next-line react/forbid-prop-types\n icon: PropTypes.array,\n }) as any,\n /** Extra class names that will be added to the icon */\n iconClassNames: PropTypes.string,\n /** Click handler for the button */\n onClick: PropTypes.func,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** size of button to render */\n size: PropTypes.oneOf(['sm', 'md', 'inline']),\n /** whether to show the `IconButton` in an active state, whose styling is distinct from default state */\n isActive: PropTypes.bool,\n};\n\ninterface PropsWithTooltip extends Props {\n /** choose from https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: Placement,\n /** any content to pass to tooltip content area */\n tooltipContent: React.ReactNode,\n}\n\n/**\n * An icon button wrapped in overlaytrigger to display a tooltip.\n */\nfunction IconButtonWithTooltip({\n tooltipPlacement, tooltipContent, ...props\n}: PropsWithTooltip) {\n const invert = props.invertColors ? 'inverse-' : '';\n return (\n <OverlayTrigger\n placement={tooltipPlacement}\n overlay={(\n <Tooltip\n id={`iconbutton-tooltip-${tooltipPlacement}`}\n variant={invert ? 'light' : undefined}\n >\n {tooltipContent}\n </Tooltip>\n )}\n >\n <IconButton {...props} />\n </OverlayTrigger>\n );\n}\n\nIconButtonWithTooltip.defaultProps = {\n ...IconButton.defaultProps,\n tooltipPlacement: 'top',\n};\n\nIconButtonWithTooltip.propTypes = {\n /** tooltip placement can be top, left, right etc, per https://popper.js.org/docs/v2/constructors/#options */\n tooltipPlacement: PropTypes.string,\n /** any valid JSX or text to be rendered as tooltip contents */\n tooltipContent: PropTypes.node.isRequired,\n /** Type of button (uses Bootstrap options) */\n variant: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'light', 'dark', 'black', 'brand']),\n /** Changes icon styles for dark background */\n invertColors: PropTypes.bool,\n};\n\n(IconButton as any).IconButtonWithTooltip = IconButtonWithTooltip;\n\nexport default IconButton as typeof IconButton & {\n IconButtonWithTooltip: typeof IconButtonWithTooltip,\n};\nexport { IconButtonWithTooltip };\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAA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AAc,EAAEhD,SAAS,CAACuD,IAAI,CAAClB,UAAU;EACzC;EACApB,OAAO,EAAEjB,SAAS,CAAC4C,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;EACrH;EACAjC,YAAY,EAAEX,SAAS,CAACsC;AAC1B,CAAC;AAEAjC,UAAU,CAASwC,qBAAqB,GAAGA,qBAAqB;AAEjE,eAAexC,UAAU;AAGzB,SAASwC,qBAAqB","ignoreList":[]}
|
package/dist/Modal/ModalPopup.js
CHANGED
|
@@ -37,6 +37,12 @@ function ModalPopup(_ref) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}];
|
|
40
|
+
var handleOnClickOutside = function handleOnClickOutside(e) {
|
|
41
|
+
if (e.type === 'touchstart') {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
onClose();
|
|
45
|
+
};
|
|
40
46
|
return /*#__PURE__*/React.createElement(ModalContextProvider, {
|
|
41
47
|
onClose: onClose,
|
|
42
48
|
isOpen: isOpen,
|
|
@@ -49,7 +55,7 @@ function ModalPopup(_ref) {
|
|
|
49
55
|
scrollLock: false,
|
|
50
56
|
enabled: isOpen,
|
|
51
57
|
onEscapeKey: onClose,
|
|
52
|
-
onClickOutside:
|
|
58
|
+
onClickOutside: handleOnClickOutside
|
|
53
59
|
}, isOpen && /*#__PURE__*/React.createElement("div", {
|
|
54
60
|
className: "pgn__modal-popup__tooltip"
|
|
55
61
|
}, children, hasArrow && /*#__PURE__*/React.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalPopup.js","names":["React","PropTypes","FocusOn","Portal","PopperElement","ModalContextProvider","PLACEMENT_OFFSETS","right","left","ModalPopup","_ref","children","onClose","isOpen","positionRef","isBlocking","withPortal","placement","hasArrow","popperProps","_objectWithoutProperties","_excluded","RootComponent","Fragment","placementOffsetValue","popperParams","name","options","scroll","offset","createElement","_extends","modifiers","target","scrollLock","enabled","onEscapeKey","onClickOutside","className","id","concat","propTypes","node","isRequired","func","bool","oneOfType","shape","current","defaultProps"],"sources":["../../src/Modal/ModalPopup.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FocusOn } from 'react-focus-on';\nimport Portal from './Portal';\nimport PopperElement from './PopperElement';\nimport { ModalContextProvider } from './ModalContext';\n\nconst PLACEMENT_OFFSETS = { right: [-2, 10], left: [-2, 10] };\n\nfunction ModalPopup({\n children,\n onClose,\n isOpen,\n positionRef,\n isBlocking,\n withPortal,\n placement,\n hasArrow,\n ...popperProps\n}) {\n const RootComponent = withPortal ? Portal : React.Fragment;\n const placementOffsetValue = PLACEMENT_OFFSETS[placement] || [0, 10];\n\n const popperParams = [\n {\n name: 'eventListeners',\n options: { scroll: false },\n },\n {\n name: 'offset',\n options: {\n offset: () => placementOffsetValue,\n },\n },\n ];\n\n return (\n <ModalContextProvider onClose={onClose} isOpen={isOpen} isBlocking={isBlocking}>\n <RootComponent>\n <PopperElement\n modifiers={hasArrow ? popperParams : null}\n target={positionRef}\n placement={placement}\n {...popperProps}\n >\n <FocusOn\n scrollLock={false}\n enabled={isOpen}\n onEscapeKey={onClose}\n onClickOutside={
|
|
1
|
+
{"version":3,"file":"ModalPopup.js","names":["React","PropTypes","FocusOn","Portal","PopperElement","ModalContextProvider","PLACEMENT_OFFSETS","right","left","ModalPopup","_ref","children","onClose","isOpen","positionRef","isBlocking","withPortal","placement","hasArrow","popperProps","_objectWithoutProperties","_excluded","RootComponent","Fragment","placementOffsetValue","popperParams","name","options","scroll","offset","handleOnClickOutside","e","type","createElement","_extends","modifiers","target","scrollLock","enabled","onEscapeKey","onClickOutside","className","id","concat","propTypes","node","isRequired","func","bool","oneOfType","shape","current","defaultProps"],"sources":["../../src/Modal/ModalPopup.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FocusOn } from 'react-focus-on';\nimport Portal from './Portal';\nimport PopperElement from './PopperElement';\nimport { ModalContextProvider } from './ModalContext';\n\nconst PLACEMENT_OFFSETS = { right: [-2, 10], left: [-2, 10] };\n\nfunction ModalPopup({\n children,\n onClose,\n isOpen,\n positionRef,\n isBlocking,\n withPortal,\n placement,\n hasArrow,\n ...popperProps\n}) {\n const RootComponent = withPortal ? Portal : React.Fragment;\n const placementOffsetValue = PLACEMENT_OFFSETS[placement] || [0, 10];\n\n const popperParams = [\n {\n name: 'eventListeners',\n options: { scroll: false },\n },\n {\n name: 'offset',\n options: {\n offset: () => placementOffsetValue,\n },\n },\n ];\n\n const handleOnClickOutside = (e) => {\n if (e.type === 'touchstart') {\n return;\n }\n\n onClose();\n };\n\n return (\n <ModalContextProvider onClose={onClose} isOpen={isOpen} isBlocking={isBlocking}>\n <RootComponent>\n <PopperElement\n modifiers={hasArrow ? popperParams : null}\n target={positionRef}\n placement={placement}\n {...popperProps}\n >\n <FocusOn\n scrollLock={false}\n enabled={isOpen}\n onEscapeKey={onClose}\n onClickOutside={handleOnClickOutside}\n >\n {isOpen && (\n <div className=\"pgn__modal-popup__tooltip\">\n {children}\n {hasArrow && (\n <div\n id=\"arrow\"\n data-testid=\"modal-popup-arrow\"\n className={`pgn__modal-popup__arrow pgn__modal-popup__arrow-${placement}`}\n data-popper-arrow=\"\"\n />\n )}\n </div>\n )}\n </FocusOn>\n </PopperElement>\n </RootComponent>\n </ModalContextProvider>\n );\n}\n\nModalPopup.propTypes = {\n /** Specifies the contents of the modal */\n children: PropTypes.node.isRequired,\n /** A callback function for when the modal is dismissed */\n onClose: PropTypes.func.isRequired,\n /** Is the modal dialog open or closed */\n isOpen: PropTypes.bool.isRequired,\n /** Prevent clicking on the backdrop or pressing Esc to close the modal */\n isBlocking: PropTypes.bool,\n /** Insert modal into a different location in the DOM */\n withPortal: PropTypes.bool,\n // This type: https://stackoverflow.com/questions/48007326/what-is-the-correct-proptype-for-a-ref-in-react\n /** Specifies an element near which the modal should be displayed */\n positionRef: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.shape({}) }),\n ]),\n /** Specifies position according to the element that the ``positionRef`` prop points to */\n placement: PopperElement.propTypes.placement,\n /** Caret to the modal popup pointing to the target */\n hasArrow: PropTypes.bool,\n};\n\nModalPopup.defaultProps = {\n isBlocking: false,\n withPortal: false,\n placement: 'bottom-start',\n positionRef: null,\n hasArrow: false,\n};\n\nexport default ModalPopup;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,oBAAoB,QAAQ,gBAAgB;AAErD,IAAMC,iBAAiB,GAAG;EAAEC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;AAAE,CAAC;AAE7D,SAASC,UAAUA,CAAAC,IAAA,EAUhB;EAAA,IATDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IACPC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,UAAU,GAAAL,IAAA,CAAVK,UAAU;IACVC,UAAU,GAAAN,IAAA,CAAVM,UAAU;IACVC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;IACLC,WAAW,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA;EAEd,IAAMC,aAAa,GAAGN,UAAU,GAAGb,MAAM,GAAGH,KAAK,CAACuB,QAAQ;EAC1D,IAAMC,oBAAoB,GAAGlB,iBAAiB,CAACW,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,C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