@openedx/paragon 23.0.0-alpha.4 → 23.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Card/BaseCard.d.ts +18 -0
- package/dist/Card/BaseCard.js +53 -0
- package/dist/Card/BaseCard.js.map +1 -0
- package/dist/Card/index.js +1 -1
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.scss +2 -0
- package/dist/Container/index.d.ts +16 -0
- package/dist/Container/index.js +15 -13
- package/dist/Container/index.js.map +1 -1
- package/dist/IconButton/index.js +1 -1
- package/dist/IconButton/index.js.map +1 -1
- package/dist/Menu/SelectMenu.js +9 -4
- package/dist/Menu/SelectMenu.js.map +1 -1
- package/dist/Modal/ModalContext.d.ts +15 -0
- package/dist/Modal/ModalContext.js +7 -14
- package/dist/Modal/ModalContext.js.map +1 -1
- package/dist/Modal/ModalDialog.d.ts +110 -0
- package/dist/Modal/ModalDialog.js +23 -21
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.d.ts +10 -0
- package/dist/Modal/ModalDialogHeader.js +6 -7
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Modal/ModalLayer.d.ts +53 -0
- package/dist/Modal/ModalLayer.js +5 -14
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/Modal/Portal.d.ts +11 -0
- package/dist/Modal/Portal.js +5 -6
- package/dist/Modal/Portal.js.map +1 -1
- package/dist/core.css +2 -0
- package/dist/core.css.map +1 -1
- package/dist/core.min.css +1 -1
- package/dist/hooks/useArrowKeyNavigation.js +2 -3
- package/dist/hooks/useArrowKeyNavigation.js.map +1 -1
- package/dist/index.d.ts +19 -5
- package/dist/index.js +5 -5
- package/icons/es5/Newsstand.js +15 -0
- package/icons/es5/index.js +1 -0
- package/icons/es5/index.ts +1 -0
- package/icons/jsx/Newsstand.jsx +17 -0
- package/icons/jsx/index.jsx +1 -0
- package/icons/svg/newsstand.svg +1 -0
- package/package.json +2 -2
- package/src/Card/BaseCard.tsx +92 -0
- package/src/Card/README.md +0 -2
- package/src/Card/index.jsx +1 -1
- package/src/Card/index.scss +2 -0
- package/src/Card/tests/BaseCard.test.jsx +82 -0
- package/src/Container/{Container.test.jsx → Container.test.tsx} +14 -8
- package/src/Container/README.md +4 -0
- package/src/Container/index.tsx +64 -0
- package/src/DataTable/selection/tests/ControlledSelectHeader.test.jsx +7 -7
- package/src/IconButton/index.tsx +1 -1
- package/src/Menu/SelectMenu.jsx +5 -0
- package/src/Menu/SelectMenu.test.jsx +6 -0
- package/src/Menu/select-menu.md +8 -0
- package/src/Modal/{ModalContext.jsx → ModalContext.tsx} +19 -16
- package/src/Modal/{ModalDialog.jsx → ModalDialog.tsx} +50 -23
- package/src/Modal/{ModalDialogHeader.jsx → ModalDialogHeader.tsx} +17 -11
- package/src/Modal/{ModalLayer.jsx → ModalLayer.tsx} +17 -17
- package/src/Modal/{Portal.jsx → Portal.tsx} +10 -7
- package/src/Modal/tests/{ModalDialog.test.jsx → ModalDialog.test.tsx} +16 -10
- package/src/Modal/tests/{ModalLayer.test.jsx → ModalLayer.test.tsx} +5 -5
- package/src/Modal/tests/{Portal.test.jsx → Portal.test.tsx} +3 -3
- package/src/hooks/useArrowKeyNavigation.jsx +1 -2
- package/src/index.d.ts +19 -5
- package/src/index.js +5 -5
- package/src/Container/index.jsx +0 -49
- /package/src/Truncate/{Truncate.test.js → utils.test.js} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ComponentWithAsProp, BsPropsWithAs } from '../utils/types/bootstrap';
|
|
3
|
+
declare const colorVariants: readonly ["primary", "secondary", "success", "danger", "warning", "info", "dark", "light"];
|
|
4
|
+
declare const textVariants: readonly ["white", "muted"];
|
|
5
|
+
type ColorVariant = typeof colorVariants[number];
|
|
6
|
+
type TextVariant = typeof textVariants[number];
|
|
7
|
+
interface Props extends BsPropsWithAs {
|
|
8
|
+
prefix?: string;
|
|
9
|
+
bgColor?: ColorVariant;
|
|
10
|
+
textColor?: ColorVariant | TextVariant;
|
|
11
|
+
borderColor?: ColorVariant;
|
|
12
|
+
hasBody?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
type BaseCardType = ComponentWithAsProp<'div', Props>;
|
|
17
|
+
declare const BaseCard: BaseCardType;
|
|
18
|
+
export default BaseCard;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var _excluded = ["prefix", "className", "bgColor", "textColor", "borderColor", "hasBody", "children", "as"];
|
|
2
|
+
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); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import CardBody from './CardBody';
|
|
10
|
+
var BASE_CARD_CLASSNAME = 'card';
|
|
11
|
+
var colorVariants = ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'];
|
|
12
|
+
var textVariants = ['white', 'muted'];
|
|
13
|
+
var BaseCard = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
14
|
+
var prefix = _ref.prefix,
|
|
15
|
+
className = _ref.className,
|
|
16
|
+
bgColor = _ref.bgColor,
|
|
17
|
+
textColor = _ref.textColor,
|
|
18
|
+
borderColor = _ref.borderColor,
|
|
19
|
+
_ref$hasBody = _ref.hasBody,
|
|
20
|
+
hasBody = _ref$hasBody === void 0 ? false : _ref$hasBody,
|
|
21
|
+
children = _ref.children,
|
|
22
|
+
_ref$as = _ref.as,
|
|
23
|
+
Component = _ref$as === void 0 ? 'div' : _ref$as,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
var classes = classNames(className, prefix ? "".concat(prefix, "-").concat(BASE_CARD_CLASSNAME) : BASE_CARD_CLASSNAME, bgColor && "bg-".concat(bgColor), textColor && "text-".concat(textColor), borderColor && "border-".concat(borderColor));
|
|
26
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
27
|
+
ref: ref
|
|
28
|
+
}, props, {
|
|
29
|
+
className: classes
|
|
30
|
+
}), hasBody ? /*#__PURE__*/React.createElement(CardBody, null, children) : children);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/* eslint-disable react/require-default-props */
|
|
34
|
+
BaseCard.propTypes = {
|
|
35
|
+
/** Prefix for component CSS classes. */
|
|
36
|
+
prefix: PropTypes.string,
|
|
37
|
+
/** Background color of the card. */
|
|
38
|
+
bgColor: PropTypes.oneOf(colorVariants),
|
|
39
|
+
/** Text color of the card. */
|
|
40
|
+
textColor: PropTypes.oneOf([].concat(colorVariants, textVariants)),
|
|
41
|
+
/** Border color of the card. */
|
|
42
|
+
borderColor: PropTypes.oneOf(colorVariants),
|
|
43
|
+
/** Determines whether the card should render its children inside a `CardBody` wrapper. */
|
|
44
|
+
hasBody: PropTypes.bool,
|
|
45
|
+
/** Set a custom element for this component. */
|
|
46
|
+
as: PropTypes.elementType,
|
|
47
|
+
/** Additional CSS class names to apply to the card element. */
|
|
48
|
+
className: PropTypes.string,
|
|
49
|
+
/** The content to render inside the card. */
|
|
50
|
+
children: PropTypes.node
|
|
51
|
+
};
|
|
52
|
+
export default BaseCard;
|
|
53
|
+
//# sourceMappingURL=BaseCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCard.js","names":["React","PropTypes","classNames","CardBody","BASE_CARD_CLASSNAME","colorVariants","textVariants","BaseCard","forwardRef","_ref","ref","prefix","className","bgColor","textColor","borderColor","_ref$hasBody","hasBody","children","_ref$as","as","Component","props","_objectWithoutProperties","_excluded","classes","concat","createElement","_extends","propTypes","string","oneOf","bool","elementType","node"],"sources":["../../src/Card/BaseCard.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nimport type { ComponentWithAsProp, BsPropsWithAs } from '../utils/types/bootstrap';\n\n// @ts-ignore\nimport CardBody from './CardBody';\n\nconst BASE_CARD_CLASSNAME = 'card';\n\nconst colorVariants = [\n 'primary',\n 'secondary',\n 'success',\n 'danger',\n 'warning',\n 'info',\n 'dark',\n 'light',\n] as const;\n\nconst textVariants = [\n 'white',\n 'muted',\n] as const;\n\ntype ColorVariant = typeof colorVariants[number];\ntype TextVariant = typeof textVariants[number];\ninterface Props extends BsPropsWithAs {\n prefix?: string;\n bgColor?: ColorVariant;\n textColor?: ColorVariant | TextVariant;\n borderColor?: ColorVariant;\n hasBody?: boolean;\n className?: string;\n children: React.ReactNode;\n}\ntype BaseCardType = ComponentWithAsProp<'div', Props>;\n\nconst BaseCard : BaseCardType = React.forwardRef<HTMLDivElement, Props>(\n (\n {\n prefix,\n className,\n bgColor,\n textColor,\n borderColor,\n hasBody = false,\n children,\n as: Component = 'div',\n ...props\n },\n ref,\n ) => {\n const classes = classNames(\n className,\n prefix ? `${prefix}-${BASE_CARD_CLASSNAME}` : BASE_CARD_CLASSNAME,\n bgColor && `bg-${bgColor}`,\n textColor && `text-${textColor}`,\n borderColor && `border-${borderColor}`,\n );\n\n return (\n <Component ref={ref} {...props} className={classes}>\n {hasBody ? <CardBody>{children}</CardBody> : children}\n </Component>\n );\n },\n);\n\n/* eslint-disable react/require-default-props */\nBaseCard.propTypes = {\n /** Prefix for component CSS classes. */\n prefix: PropTypes.string,\n /** Background color of the card. */\n bgColor: PropTypes.oneOf(colorVariants),\n /** Text color of the card. */\n textColor: PropTypes.oneOf([...colorVariants, ...textVariants]),\n /** Border color of the card. */\n borderColor: PropTypes.oneOf(colorVariants),\n /** Determines whether the card should render its children inside a `CardBody` wrapper. */\n hasBody: PropTypes.bool,\n /** Set a custom element for this component. */\n as: PropTypes.elementType,\n /** Additional CSS class names to apply to the card element. */\n className: PropTypes.string,\n /** The content to render inside the card. */\n children: PropTypes.node,\n};\n\nexport default BaseCard;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAInC;AACA,OAAOC,QAAQ,MAAM,YAAY;AAEjC,IAAMC,mBAAmB,GAAG,MAAM;AAElC,IAAMC,aAAa,GAAG,CACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,MAAM,EACN,MAAM,EACN,OAAO,CACC;AAEV,IAAMC,YAAY,GAAG,CACnB,OAAO,EACP,OAAO,CACC;AAeV,IAAMC,QAAuB,gBAAGP,KAAK,CAACQ,UAAU,CAC9C,UAAAC,IAAA,EAYEC,GAAG,EACA;EAAA,IAXDC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,SAAS,GAAAL,IAAA,CAATK,SAAS;IACTC,WAAW,GAAAN,IAAA,CAAXM,WAAW;IAAAC,YAAA,GAAAP,IAAA,CACXQ,OAAO;IAAPA,OAAO,GAAAD,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C;AACtB,CAAC;AAED,eAAe3B,QAAQ","ignoreList":[]}
|
package/dist/Card/index.js
CHANGED
|
@@ -9,9 +9,9 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
9
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
11
|
import React from 'react';
|
|
12
|
-
import BaseCard from 'react-bootstrap/Card';
|
|
13
12
|
import PropTypes from 'prop-types';
|
|
14
13
|
import classNames from 'classnames';
|
|
14
|
+
import BaseCard from './BaseCard';
|
|
15
15
|
import CardContext, { CardContextProvider } from './CardContext';
|
|
16
16
|
import CardHeader from './CardHeader';
|
|
17
17
|
import CardDivider from './CardDivider';
|
package/dist/Card/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classNames","BaseCard","CardContext","CardContextProvider","CardHeader","CardDivider","CardSection","CardFooter","CardImageCap","CardBody","CardStatus","withDeprecatedProps","DeprTypes","CARD_VARIANTS","Card","forwardRef","_ref","ref","orientation","isLoading","className","isClickable","muted","variant","props","_objectWithoutProperties","_excluded","resolvedVariant","createElement","_extends","_defineProperty","horizontal","clickable","concat","tabIndex","default","CardColumns","CardDeck","CardCarousel","CardImg","CardGroup","CardGrid","propTypes","string","oneOf","bool","defaultProps","_objectSpread","undefined","CardWithDeprecatedProp","deprType","REMOVED","message","Status","Header","Divider","Section","Footer","ImageCap","Context","Body"],"sources":["../../src/Card/index.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport BaseCard from './BaseCard';\nimport CardContext, { CardContextProvider } from './CardContext';\nimport CardHeader from './CardHeader';\nimport CardDivider from './CardDivider';\nimport CardSection from './CardSection';\nimport CardFooter from './CardFooter';\nimport CardImageCap from './CardImageCap';\nimport CardBody from './CardBody';\nimport CardStatus from './CardStatus';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const CARD_VARIANTS = ['light', 'dark', 'muted'];\n\nconst Card = React.forwardRef(({\n orientation,\n isLoading,\n className,\n isClickable,\n muted,\n variant,\n ...props\n}, ref) => {\n const resolvedVariant = muted ? 'muted' : variant;\n\n return (\n <CardContextProvider\n orientation={orientation}\n isLoading={isLoading}\n variant={resolvedVariant}\n >\n <BaseCard\n {...props}\n className={classNames(className, 'pgn__card', {\n horizontal: orientation === 'horizontal',\n clickable: isClickable,\n [`pgn__card-${resolvedVariant}`]: resolvedVariant,\n })}\n ref={ref}\n tabIndex={isClickable ? 0 : -1}\n />\n </CardContextProvider>\n );\n});\n\nexport { default as CardColumns } from 'react-bootstrap/CardColumns';\nexport { default as CardDeck } from './CardDeck';\nexport { default as CardCarousel } from './CardCarousel/CardCarousel';\nexport { default as CardImg } from 'react-bootstrap/CardImg';\nexport { default as CardGroup } from 'react-bootstrap/CardGroup';\nexport { default as CardGrid } from './CardGrid';\n\nCard.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies which orientation to use. */\n orientation: PropTypes.oneOf(['vertical', 'horizontal']),\n /** Specifies whether the `Card` is clickable, if `true` appropriate `hover` and `focus` styling will be added. */\n isClickable: PropTypes.bool,\n /** Specifies loading state. */\n isLoading: PropTypes.bool,\n /** Specifies `Card` style variant. */\n variant: PropTypes.oneOf(CARD_VARIANTS),\n /** **Deprecated**. Specifies whether `Card` uses `muted` variant. Use `variant=\"muted\"` instead. */\n muted: PropTypes.bool,\n};\n\nCard.defaultProps = {\n ...BaseCard.defaultProps,\n className: undefined,\n orientation: 'vertical',\n isClickable: false,\n variant: 'light',\n isLoading: false,\n};\n\nconst CardWithDeprecatedProp = withDeprecatedProps(Card, 'Card', {\n muted: {\n deprType: DeprTypes.REMOVED,\n message: 'Use \"variant\" prop instead, i.e. variant=\"muted\"',\n },\n});\n\nCardWithDeprecatedProp.Status = CardStatus;\nCardWithDeprecatedProp.Header = CardHeader;\nCardWithDeprecatedProp.Divider = CardDivider;\nCardWithDeprecatedProp.Section = CardSection;\nCardWithDeprecatedProp.Footer = CardFooter;\nCardWithDeprecatedProp.ImageCap = CardImageCap;\nCardWithDeprecatedProp.Context = CardContext;\nCardWithDeprecatedProp.Body = CardBody;\n\nexport default CardWithDeprecatedProp;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,WAAW,IAAIC,mBAAmB,QAAQ,eAAe;AAChE,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,mBAAmB,IAAIC,SAAS,QAAQ,wBAAwB;AAEvE,OAAO,IAAMC,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;AAEvD,IAAMC,IAAI,gBAAGhB,KAAK,CAACiB,UAAU,CAAC,UAAAC,IAAA,EAQ3BC,GAAG,EAAK;EAAA,IAP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EnB,SAAS,CAAC6C,KAAK,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;EACxD;EACAvB,WAAW,EAAEtB,SAAS,CAAC8C,IAAI;EAC3B;EACA1B,SAAS,EAAEpB,SAAS,CAAC8C,IAAI;EACzB;EACAtB,OAAO,EAAExB,SAAS,CAAC6C,KAAK,CAAC/B,aAAa,CAAC;EACvC;EACAS,KAAK,EAAEvB,SAAS,CAAC8C;AACnB,CAAC;AAED/B,IAAI,CAACgC,YAAY,GAAAC,aAAA,CAAAA,aAAA,KACZ9C,QAAQ,CAAC6C,YAAY;EACxB1B,SAAS,EAAE4B,SAAS;EACpB9B,WAAW,EAAE,UAAU;EACvBG,WAAW,EAAE,KAAK;EAClBE,OAAO,EAAE,OAAO;EAChBJ,SAAS,EAAE;AAAK,EACjB;AAED,IAAM8B,sBAAsB,GAAGtC,mBAAmB,CAACG,IAAI,EAAE,MAAM,EAAE;EAC/DQ,KAAK,EAAE;IACL4B,QAAQ,EAAEtC,SAAS,CAACuC,OAAO;IAC3BC,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAEFH,sBAAsB,CAACI,MAAM,GAAG3C,UAAU;AAC1CuC,sBAAsB,CAACK,MAAM,GAAGlD,UAAU;AAC1C6C,sBAAsB,CAACM,OAAO,GAAGlD,WAAW;AAC5C4C,sBAAsB,CAACO,OAAO,GAAGlD,WAAW;AAC5C2C,sBAAsB,CAACQ,MAAM,GAAGlD,UAAU;AAC1C0C,sBAAsB,CAACS,QAAQ,GAAGlD,YAAY;AAC9CyC,sBAAsB,CAACU,OAAO,GAAGzD,WAAW;AAC5C+C,sBAAsB,CAACW,IAAI,GAAGnD,QAAQ;AAEtC,eAAewC,sBAAsB","ignoreList":[]}
|
package/dist/Card/index.scss
CHANGED
|
@@ -352,6 +352,8 @@ a.pgn__card {
|
|
|
352
352
|
bottom: calc(-1 * var(--pgn-spacing-card-logo-bottom-offset-base));
|
|
353
353
|
width: var(--pgn-size-card-logo-width);
|
|
354
354
|
height: var(--pgn-size-card-logo-height);
|
|
355
|
+
object-fit: scale-down;
|
|
356
|
+
object-position: center center;
|
|
355
357
|
border-radius: var(--pgn-size-card-border-radius-logo);
|
|
356
358
|
box-shadow: var(--pgn-elevation-box-shadow-level-1);
|
|
357
359
|
padding: map_get($spacers, 2);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ContainerProps as RBContainerProps } from 'react-bootstrap/Container';
|
|
2
|
+
import type { ComponentWithAsProp } from '../utils/types/bootstrap';
|
|
3
|
+
declare enum ContainerSizeClass {
|
|
4
|
+
xs = "container-mw-xs",
|
|
5
|
+
sm = "container-mw-sm",
|
|
6
|
+
md = "container-mw-md",
|
|
7
|
+
lg = "container-mw-lg",
|
|
8
|
+
xl = "container-mw-xl"
|
|
9
|
+
}
|
|
10
|
+
export type ContainerSize = keyof typeof ContainerSizeClass;
|
|
11
|
+
interface ContainerProps extends RBContainerProps {
|
|
12
|
+
size?: ContainerSize;
|
|
13
|
+
}
|
|
14
|
+
type ContainerType = ComponentWithAsProp<'div', ContainerProps>;
|
|
15
|
+
declare const Container: ContainerType;
|
|
16
|
+
export default Container;
|
package/dist/Container/index.js
CHANGED
|
@@ -8,24 +8,26 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
8
|
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); }
|
|
9
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
-
|
|
11
|
+
/* eslint-disable react/require-default-props */
|
|
12
|
+
import React from 'react';
|
|
12
13
|
import classNames from 'classnames';
|
|
13
|
-
import RBContainer from 'react-bootstrap/Container';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
import RBContainer from 'react-bootstrap/Container';
|
|
16
|
+
var ContainerSizeClass = /*#__PURE__*/function (ContainerSizeClass) {
|
|
17
|
+
ContainerSizeClass["xs"] = "container-mw-xs";
|
|
18
|
+
ContainerSizeClass["sm"] = "container-mw-sm";
|
|
19
|
+
ContainerSizeClass["md"] = "container-mw-md";
|
|
20
|
+
ContainerSizeClass["lg"] = "container-mw-lg";
|
|
21
|
+
ContainerSizeClass["xl"] = "container-mw-xl";
|
|
22
|
+
return ContainerSizeClass;
|
|
23
|
+
}(ContainerSizeClass || {});
|
|
24
|
+
var Container = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
23
25
|
var size = _ref.size,
|
|
24
26
|
children = _ref.children,
|
|
25
27
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
28
|
return /*#__PURE__*/React.createElement(RBContainer, _extends({}, props, {
|
|
27
29
|
ref: ref,
|
|
28
|
-
className: classNames(props.className,
|
|
30
|
+
className: classNames(props.className, size && ContainerSizeClass[size])
|
|
29
31
|
}), children);
|
|
30
32
|
});
|
|
31
33
|
Container.propTypes = _objectSpread(_objectSpread({}, RBContainer.propTypes), {}, {
|
|
@@ -35,8 +37,8 @@ Container.propTypes = _objectSpread(_objectSpread({}, RBContainer.propTypes), {}
|
|
|
35
37
|
children: PropTypes.node,
|
|
36
38
|
/** Fill all available space at any breakpoint */
|
|
37
39
|
fluid: PropTypes.bool,
|
|
38
|
-
/** Set the maximum width for the container */
|
|
39
|
-
size: PropTypes.oneOf(
|
|
40
|
+
/** Set the maximum width for the container. Omiting the prop will remove the max-width */
|
|
41
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
40
42
|
/** Overrides underlying component base CSS class name */
|
|
41
43
|
bsPrefix: PropTypes.string
|
|
42
44
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classNames","PropTypes","RBContainer","ContainerSizeClass","Container","forwardRef","_ref","ref","size","children","props","_objectWithoutProperties","_excluded","createElement","_extends","className","propTypes","_objectSpread","as","elementType","node","fluid","bool","oneOf","bsPrefix","string","defaultProps","undefined"],"sources":["../../src/Container/index.tsx"],"sourcesContent":["/* eslint-disable react/require-default-props */\nimport React from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport RBContainer, { type ContainerProps as RBContainerProps } from 'react-bootstrap/Container';\n\nimport type { ComponentWithAsProp } from '../utils/types/bootstrap';\n\nenum ContainerSizeClass {\n xs = 'container-mw-xs',\n sm = 'container-mw-sm',\n md = 'container-mw-md',\n lg = 'container-mw-lg',\n xl = 'container-mw-xl',\n}\n\nexport type ContainerSize = keyof typeof ContainerSizeClass;\n\ninterface ContainerProps extends RBContainerProps {\n size?: ContainerSize;\n}\n\ntype ContainerType = ComponentWithAsProp<'div', ContainerProps>;\n\nconst Container: ContainerType = React.forwardRef<Element, ContainerProps>(({\n size,\n children,\n ...props\n}, ref) => (\n <RBContainer\n {...props}\n ref={ref}\n className={classNames(\n props.className,\n size && ContainerSizeClass[size],\n )}\n >\n {children}\n </RBContainer>\n));\n\nContainer.propTypes = {\n ...RBContainer.propTypes,\n /** Override the base element */\n as: PropTypes.elementType,\n /** Specifies the contents of the container */\n children: PropTypes.node,\n /** Fill all available space at any breakpoint */\n fluid: PropTypes.bool,\n /** Set the maximum width for the container. Omiting the prop will remove the max-width */\n size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),\n /** Overrides underlying component base CSS class name */\n bsPrefix: PropTypes.string,\n};\n\nContainer.defaultProps = {\n as: 'div',\n children: undefined,\n fluid: true,\n size: undefined,\n bsPrefix: 'container',\n};\n\nexport default Container;\n"],"mappings":";;;;;;;;;;AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,WAAW,MAAmD,2BAA2B;AAAC,IAI5FC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA,EAAlBA,kBAAkB;AAgBvB,IAAMC,SAAwB,gBAAGL,KAAK,CAACM,UAAU,CAA0B,UAAAC,IAAA,EAIxEC,GAAG;EAAA,IAHJC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACLC,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAAA,oBAERb,KAAA,CAAAc,aAAA,CAACX,WAAW,EAAAY,QAAA,KACNJ,KAAK;IACTH,GAAG,EAAEA,GAAI;IACTQ,SAAS,EAAEf,UAAU,CACnBU,KAAK,CAACK,SAAS,EACfP,IAAI,IAAIL,kBAAkB,CAACK,IAAI,CACjC;EAAE,IAEDC,QACU,CAAC;AAAA,CACf,CAAC;AAEFL,SAAS,CAACY,SAAS,GAAAC,aAAA,CAAAA,aAAA,KACdf,WAAW,CAACc,SAAS;EACxB;EACAE,EAAE,EAAEjB,SAAS,CAACkB,WAAW;EACzB;EACAV,QAAQ,EAAER,SAAS,CAACmB,IAAI;EACxB;EACAC,KAAK,EAAEpB,SAAS,CAACqB,IAAI;EACrB;EACAd,IAAI,EAAEP,SAAS,CAACsB,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;EACrD;EACAC,QAAQ,EAAEvB,SAAS,CAACwB;AAAM,EAC3B;AAEDrB,SAAS,CAACsB,YAAY,GAAG;EACvBR,EAAE,EAAE,KAAK;EACTT,QAAQ,EAAEkB,SAAS;EACnBN,KAAK,EAAE,IAAI;EACXb,IAAI,EAAEmB,SAAS;EACfH,QAAQ,EAAE;AACZ,CAAC;AAED,eAAepB,SAAS","ignoreList":[]}
|
package/dist/IconButton/index.js
CHANGED
|
@@ -12,9 +12,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
|
-
import Icon from '../Icon';
|
|
16
15
|
import { OverlayTrigger } from '../Overlay';
|
|
17
16
|
import Tooltip from '../Tooltip';
|
|
17
|
+
import Icon from '../Icon';
|
|
18
18
|
var IconButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
19
19
|
var className = _ref.className,
|
|
20
20
|
alt = _ref.alt,
|
|
@@ -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","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,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;AAkChC,IAAMC,UAAU,gBAAGN,KAAK,CAACO,UAAU,CAA2B,UAAAC,IAAA,EAc3DC,GAAG,EAAK;EAAA,IAbTC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IACHC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,IAAI,GAAAL,IAAA,CAAJK,IAAI;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layTrigger","Tooltip","Icon","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 { OverlayTrigger } from '../Overlay';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\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,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AA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AAC4C,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/Menu/SelectMenu.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["defaultMessage", "children", "className", "variant"];
|
|
1
|
+
var _excluded = ["defaultMessage", "children", "className", "variant", "disabled"];
|
|
2
2
|
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); }
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -23,6 +23,7 @@ function SelectMenu(_ref) {
|
|
|
23
23
|
children = _ref.children,
|
|
24
24
|
className = _ref.className,
|
|
25
25
|
variant = _ref.variant,
|
|
26
|
+
disabled = _ref.disabled,
|
|
26
27
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
28
|
var _useState = useState(null),
|
|
28
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -106,7 +107,8 @@ function SelectMenu(_ref) {
|
|
|
106
107
|
ref: setTriggerTarget,
|
|
107
108
|
variant: variant,
|
|
108
109
|
iconAfter: ExpandMore,
|
|
109
|
-
onClick: open
|
|
110
|
+
onClick: open,
|
|
111
|
+
disabled: disabled
|
|
110
112
|
}, selected !== undefined && children[selected] ? children[selected].props.children : defaultMessage), /*#__PURE__*/React.createElement("div", {
|
|
111
113
|
className: "pgn__menu-select-popup"
|
|
112
114
|
}, /*#__PURE__*/React.createElement(ModalPopup, {
|
|
@@ -140,12 +142,15 @@ SelectMenu.propTypes = {
|
|
|
140
142
|
/** Specifies class name to append to the base element */
|
|
141
143
|
className: PropTypes.string,
|
|
142
144
|
/** Specifies variant to use. */
|
|
143
|
-
variant: PropTypes.string
|
|
145
|
+
variant: PropTypes.string,
|
|
146
|
+
/** Specifies if the `SelectMenu` is disabled. */
|
|
147
|
+
disabled: PropTypes.bool
|
|
144
148
|
};
|
|
145
149
|
SelectMenu.defaultProps = {
|
|
146
150
|
defaultMessage: SELECT_MENU_DEFAULT_MESSAGE,
|
|
147
151
|
className: undefined,
|
|
148
|
-
variant: 'outline-primary'
|
|
152
|
+
variant: 'outline-primary',
|
|
153
|
+
disabled: false
|
|
149
154
|
};
|
|
150
155
|
var SelectMenuWithDeprecatedProp = withDeprecatedProps(SelectMenu, 'SelectMenu', {
|
|
151
156
|
isLink: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.js","names":["React","useState","useEffect","useCallback","PropTypes","classNames","ExpandMore","Button","ModalPopup","useToggle","Menu","withDeprecatedProps","DeprTypes","SELECT_MENU_DEFAULT_MESSAGE","SelectMenu","_ref","defaultMessage","children","className","variant","props","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","triggerTarget","setTriggerTarget","focusMenuRef","useRef","itemsCollection","useMemo","Array","from","length","map","createRef","defaultIndex","i","defaultSelected","undefined","_useState3","_useState4","selected","setSelected","_useToggle","_useToggle2","isOpen","open","close","createMenuItems","Children","child","index","newProps","onClick","e","current","id","concat","toString","role","cloneElement","prevOpenRef","numItems","scrollIntoView","block","focus","preventScroll","createElement","_extends","ref","iconAfter","placement","positionRef","onClose","modifiers","name","options","padding","top","bottom","key","propTypes","string","node","isRequired","defaultProps","SelectMenuWithDeprecatedProp","isLink","deprType","MOVED_AND_FORMAT","message","newName","transform"],"sources":["../../src/Menu/SelectMenu.jsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { ExpandMore } from '../../icons';\nimport Button from '../Button';\nimport ModalPopup from '../Modal/ModalPopup';\nimport useToggle from '../hooks/useToggle';\nimport Menu from '.';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const SELECT_MENU_DEFAULT_MESSAGE = 'Select...';\n\nfunction SelectMenu({\n defaultMessage,\n children,\n className,\n variant,\n ...props\n}) {\n const [triggerTarget, setTriggerTarget] = useState(null);\n // this ref is used to focus the menu open button after any menu option is clicked.\n // triggerTarget.current.focus() inside the onCLick() function didn't guarantee element focus.\n const focusMenuRef = React.useRef(false);\n const itemsCollection = React.useMemo(\n () => Array.from({ length: children.length }).map(() => React.createRef()),\n [children.length],\n );\n\n const defaultIndex = useCallback(() => {\n for (let i = 0; i < children.length; i++) {\n if (children[i].props && children[i].props.defaultSelected) {\n return i;\n }\n }\n return undefined;\n }, [children]);\n\n const [selected, setSelected] = useState(defaultIndex());\n const [isOpen, open, close] = useToggle(false);\n\n const createMenuItems = () => React.Children.map(children, (child, index) => {\n const newProps = {\n onClick(e) {\n if (child.props.onClick) {\n child.props.onClick(e);\n }\n setSelected(index);\n close();\n focusMenuRef.current = true;\n },\n id: `${index.toString()}_pgn__menu-item`,\n role: 'link',\n };\n if (selected === index) {\n newProps['aria-current'] = 'page';\n }\n return React.cloneElement(child, newProps);\n });\n\n const prevOpenRef = React.useRef();\n\n useEffect(() => {\n if (isOpen && selected) {\n const numItems = children.length;\n if (numItems > 6 && selected > 1 && numItems - selected > 2) {\n // on \"middle elements\", set offset to center of block and scroll to center\n itemsCollection[selected].current.children[0].scrollIntoView({\n block: 'center',\n });\n }\n }\n // set focus on open\n if (isOpen && !prevOpenRef.current && selected) {\n itemsCollection[selected].current.children[0].focus({ preventScroll: (defaultIndex() === selected) });\n }\n if (focusMenuRef.current) {\n triggerTarget.focus();\n focusMenuRef.current = false;\n }\n prevOpenRef.current = isOpen;\n }, [isOpen, children.length, defaultIndex, itemsCollection, selected, triggerTarget]);\n\n return (\n <div className={classNames('pgn__menu-select', className)} {...props}>\n <Button\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n ref={setTriggerTarget}\n variant={variant}\n iconAfter={ExpandMore}\n onClick={open}\n >\n {selected !== undefined && children[selected] ? children[selected].props.children : defaultMessage}\n </Button>\n <div className=\"pgn__menu-select-popup\">\n <ModalPopup\n placement=\"bottom-start\"\n positionRef={triggerTarget}\n isOpen={isOpen}\n onClose={close}\n modifiers={\n [\n {\n name: 'flip',\n options: {\n padding: { top: 150, bottom: 150 },\n },\n },\n ]\n }\n >\n <Menu aria-label=\"Select Menu\">\n {createMenuItems().map((child, index) => (\n <div key={child.props.id} ref={itemsCollection[index]}>\n {child}\n </div>\n ))}\n </Menu>\n </ModalPopup>\n </div>\n </div>\n );\n}\n\nSelectMenu.propTypes = {\n /** String that is displayed for default value of the ``SelectMenu`` */\n defaultMessage: PropTypes.string,\n /** Specifies the content of the ``SelectMenu`` */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies variant to use. */\n variant: PropTypes.string,\n};\n\nSelectMenu.defaultProps = {\n defaultMessage: SELECT_MENU_DEFAULT_MESSAGE,\n className: undefined,\n variant: 'outline-primary',\n};\n\nconst SelectMenuWithDeprecatedProp = withDeprecatedProps(SelectMenu, 'SelectMenu', {\n isLink: {\n deprType: DeprTypes.MOVED_AND_FORMAT,\n message: 'Use \"variant\" prop instead, i.e. variant=\"link\"',\n newName: 'variant',\n transform: () => 'link',\n },\n});\n\nexport default SelectMenuWithDeprecatedProp;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ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vE,cAAc,EAAEH,2BAA2B;EAC3CK,SAAS,EAAEsB,SAAS;EACpBrB,OAAO,EAAE;AACX,CAAC;AAED,IAAMqE,4BAA4B,GAAG7E,mBAAmB,CAACG,UAAU,EAAE,YAAY,EAAE;EACjF2E,MAAM,EAAE;IACNC,QAAQ,EAAE9E,SAAS,CAAC+E,gBAAgB;IACpCC,OAAO,EAAE,iDAAiD;IAC1DC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAE,SAAAA,UAAA;MAAA,OAAM,MAAM;IAAA;EACzB;AACF,CAAC,CAAC;AAEF,eAAeN,4BAA4B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SelectMenu.js","names":["React","useState","useEffect","useCallback","PropTypes","classNames","ExpandMore","Button","ModalPopup","useToggle","Menu","withDeprecatedProps","DeprTypes","SELECT_MENU_DEFAULT_MESSAGE","SelectMenu","_ref","defaultMessage","children","className","variant","disabled","props","_objectWithoutProperties","_excluded","_useState","_useState2","_slicedToArray","triggerTarget","setTriggerTarget","focusMenuRef","useRef","itemsCollection","useMemo","Array","from","length","map","createRef","defaultIndex","i","defaultSelected","undefined","_useState3","_useState4","selected","setSelected","_useToggle","_useToggle2","isOpen","open","close","createMenuItems","Children","child","index","newProps","onClick","e","current","id","concat","toString","role","cloneElement","prevOpenRef","numItems","scrollIntoView","block","focus","preventScroll","createElement","_extends","ref","iconAfter","placement","positionRef","onClose","modifiers","name","options","padding","top","bottom","key","propTypes","string","node","isRequired","bool","defaultProps","SelectMenuWithDeprecatedProp","isLink","deprType","MOVED_AND_FORMAT","message","newName","transform"],"sources":["../../src/Menu/SelectMenu.jsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { ExpandMore } from '../../icons';\nimport Button from '../Button';\nimport ModalPopup from '../Modal/ModalPopup';\nimport useToggle from '../hooks/useToggle';\nimport Menu from '.';\nimport withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps';\n\nexport const SELECT_MENU_DEFAULT_MESSAGE = 'Select...';\n\nfunction SelectMenu({\n defaultMessage,\n children,\n className,\n variant,\n disabled,\n ...props\n}) {\n const [triggerTarget, setTriggerTarget] = useState(null);\n // this ref is used to focus the menu open button after any menu option is clicked.\n // triggerTarget.current.focus() inside the onCLick() function didn't guarantee element focus.\n const focusMenuRef = React.useRef(false);\n const itemsCollection = React.useMemo(\n () => Array.from({ length: children.length }).map(() => React.createRef()),\n [children.length],\n );\n\n const defaultIndex = useCallback(() => {\n for (let i = 0; i < children.length; i++) {\n if (children[i].props && children[i].props.defaultSelected) {\n return i;\n }\n }\n return undefined;\n }, [children]);\n\n const [selected, setSelected] = useState(defaultIndex());\n const [isOpen, open, close] = useToggle(false);\n\n const createMenuItems = () => React.Children.map(children, (child, index) => {\n const newProps = {\n onClick(e) {\n if (child.props.onClick) {\n child.props.onClick(e);\n }\n setSelected(index);\n close();\n focusMenuRef.current = true;\n },\n id: `${index.toString()}_pgn__menu-item`,\n role: 'link',\n };\n if (selected === index) {\n newProps['aria-current'] = 'page';\n }\n return React.cloneElement(child, newProps);\n });\n\n const prevOpenRef = React.useRef();\n\n useEffect(() => {\n if (isOpen && selected) {\n const numItems = children.length;\n if (numItems > 6 && selected > 1 && numItems - selected > 2) {\n // on \"middle elements\", set offset to center of block and scroll to center\n itemsCollection[selected].current.children[0].scrollIntoView({\n block: 'center',\n });\n }\n }\n // set focus on open\n if (isOpen && !prevOpenRef.current && selected) {\n itemsCollection[selected].current.children[0].focus({ preventScroll: (defaultIndex() === selected) });\n }\n if (focusMenuRef.current) {\n triggerTarget.focus();\n focusMenuRef.current = false;\n }\n prevOpenRef.current = isOpen;\n }, [isOpen, children.length, defaultIndex, itemsCollection, selected, triggerTarget]);\n\n return (\n <div className={classNames('pgn__menu-select', className)} {...props}>\n <Button\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n ref={setTriggerTarget}\n variant={variant}\n iconAfter={ExpandMore}\n onClick={open}\n disabled={disabled}\n >\n {selected !== undefined && children[selected] ? children[selected].props.children : defaultMessage}\n </Button>\n <div className=\"pgn__menu-select-popup\">\n <ModalPopup\n placement=\"bottom-start\"\n positionRef={triggerTarget}\n isOpen={isOpen}\n onClose={close}\n modifiers={\n [\n {\n name: 'flip',\n options: {\n padding: { top: 150, bottom: 150 },\n },\n },\n ]\n }\n >\n <Menu aria-label=\"Select Menu\">\n {createMenuItems().map((child, index) => (\n <div key={child.props.id} ref={itemsCollection[index]}>\n {child}\n </div>\n ))}\n </Menu>\n </ModalPopup>\n </div>\n </div>\n );\n}\n\nSelectMenu.propTypes = {\n /** String that is displayed for default value of the ``SelectMenu`` */\n defaultMessage: PropTypes.string,\n /** Specifies the content of the ``SelectMenu`` */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element */\n className: PropTypes.string,\n /** Specifies variant to use. */\n variant: PropTypes.string,\n /** Specifies if the `SelectMenu` is disabled. */\n disabled: PropTypes.bool,\n};\n\nSelectMenu.defaultProps = {\n defaultMessage: SELECT_MENU_DEFAULT_MESSAGE,\n className: undefined,\n variant: 'outline-primary',\n disabled: false,\n};\n\nconst SelectMenuWithDeprecatedProp = withDeprecatedProps(SelectMenu, 'SelectMenu', {\n isLink: {\n deprType: DeprTypes.MOVED_AND_FORMAT,\n message: 'Use \"variant\" prop instead, i.e. variant=\"link\"',\n newName: 'variant',\n transform: () => 'link',\n },\n});\n\nexport default SelectMenuWithDeprecatedProp;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,IAAI,MAAM,GAAG;AACpB,OAAOC,mB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B,GAAG/E,mBAAmB,CAACG,UAAU,EAAE,YAAY,EAAE;EACjF6E,MAAM,EAAE;IACNC,QAAQ,EAAEhF,SAAS,CAACiF,gBAAgB;IACpCC,OAAO,EAAE,iDAAiD;IAC1DC,OAAO,EAAE,SAAS;IAClBC,SAAS,EAAE,SAAAA,UAAA;MAAA,OAAM,MAAM;IAAA;EACzB;AACF,CAAC,CAAC;AAEF,eAAeN,4BAA4B","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ContextData {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
isBlocking: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const ModalContext: React.Context<ContextData>;
|
|
8
|
+
declare function ModalContextProvider({ onClose, isOpen, isBlocking, children, }: {
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
isBlocking?: boolean;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export { ModalContextProvider };
|
|
15
|
+
export default ModalContext;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
var ModalContext = /*#__PURE__*/React.createContext({
|
|
4
|
-
onClose: function onClose() {}
|
|
3
|
+
onClose: function onClose() {},
|
|
4
|
+
isOpen: false,
|
|
5
|
+
isBlocking: false
|
|
5
6
|
});
|
|
6
7
|
function ModalContextProvider(_ref) {
|
|
7
8
|
var onClose = _ref.onClose,
|
|
8
9
|
isOpen = _ref.isOpen,
|
|
9
|
-
isBlocking = _ref.isBlocking,
|
|
10
|
-
|
|
10
|
+
_ref$isBlocking = _ref.isBlocking,
|
|
11
|
+
isBlocking = _ref$isBlocking === void 0 ? false : _ref$isBlocking,
|
|
12
|
+
_ref$children = _ref.children,
|
|
13
|
+
children = _ref$children === void 0 ? null : _ref$children;
|
|
11
14
|
var modalContextValue = useMemo(function () {
|
|
12
15
|
return {
|
|
13
16
|
onClose: onClose,
|
|
@@ -19,16 +22,6 @@ function ModalContextProvider(_ref) {
|
|
|
19
22
|
value: modalContextValue
|
|
20
23
|
}, children);
|
|
21
24
|
}
|
|
22
|
-
ModalContextProvider.propTypes = {
|
|
23
|
-
children: PropTypes.node,
|
|
24
|
-
onClose: PropTypes.func.isRequired,
|
|
25
|
-
isBlocking: PropTypes.bool,
|
|
26
|
-
isOpen: PropTypes.bool.isRequired
|
|
27
|
-
};
|
|
28
|
-
ModalContextProvider.defaultProps = {
|
|
29
|
-
children: null,
|
|
30
|
-
isBlocking: false
|
|
31
|
-
};
|
|
32
25
|
export { ModalContextProvider };
|
|
33
26
|
export default ModalContext;
|
|
34
27
|
//# sourceMappingURL=ModalContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContext.js","names":["React","useMemo","
|
|
1
|
+
{"version":3,"file":"ModalContext.js","names":["React","useMemo","ModalContext","createContext","onClose","isOpen","isBlocking","ModalContextProvider","_ref","_ref$isBlocking","_ref$children","children","modalContextValue","createElement","Provider","value"],"sources":["../../src/Modal/ModalContext.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\n\ninterface ContextData {\n onClose: () => void;\n isOpen: boolean;\n isBlocking: boolean;\n}\n\nconst ModalContext = React.createContext<ContextData>({\n onClose: () => {},\n isOpen: false,\n isBlocking: false,\n});\n\nfunction ModalContextProvider({\n onClose,\n isOpen,\n isBlocking = false,\n children = null,\n}: {\n onClose: () => void;\n isOpen: boolean;\n isBlocking?: boolean;\n children?: React.ReactNode;\n}) {\n const modalContextValue = useMemo<ContextData>(\n () => ({ onClose, isOpen, isBlocking }),\n [onClose, isOpen, isBlocking],\n );\n\n return (\n <ModalContext.Provider value={modalContextValue}>\n {children}\n </ModalContext.Provider>\n );\n}\n\nexport { ModalContextProvider };\nexport default ModalContext;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAQtC,IAAMC,YAAY,gBAAGF,KAAK,CAACG,aAAa,CAAc;EACpDC,OAAO,EAAE,SAAAA,QAAA,EAAM,CAAC,CAAC;EACjBC,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE;AACd,CAAC,CAAC;AAEF,SAASC,oBAAoBA,CAAAC,IAAA,EAU1B;EAAA,IATDJ,OAAO,GAAAI,IAAA,CAAPJ,OAAO;IACPC,MAAM,GAAAG,IAAA,CAANH,MAAM;IAAAI,eAAA,GAAAD,IAAA,CACNF,UAAU;IAAVA,UAAU,GAAAG,eAAA,cAAG,KAAK,GAAAA,eAAA;IAAAC,aAAA,GAAAF,IAAA,CAClBG,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,IAAI,GAAAA,aAAA;EAOf,IAAME,iBAAiB,GAAGX,OAAO,CAC/B;IAAA,OAAO;MAAEG,OAAO,EAAPA,OAAO;MAAEC,MAAM,EAANA,MAAM;MAAEC,UAAU,EAAVA;IAAW,CAAC;EAAA,CAAC,EACvC,CAACF,OAAO,EAAEC,MAAM,EAAEC,UAAU,CAC9B,CAAC;EAED,oBACEN,KAAA,CAAAa,aAAA,CAACX,YAAY,CAACY,QAAQ;IAACC,KAAK,EAAEH;EAAkB,GAC7CD,QACoB,CAAC;AAE5B;AAEA,SAASJ,oBAAoB;AAC7B,eAAeL,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
export declare const MODAL_DIALOG_CLOSE_LABEL = "Close";
|
|
4
|
+
interface Props {
|
|
5
|
+
/** Specifies the content of the dialog */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** The aria-label of the dialog */
|
|
8
|
+
title: string;
|
|
9
|
+
/** A callback to close the modal dialog, e.g. when Escape is pressed */
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
/** Is the modal dialog open or closed? */
|
|
12
|
+
isOpen?: boolean;
|
|
13
|
+
/** The close 'x' icon button in the top right of the dialog box */
|
|
14
|
+
hasCloseButton?: boolean;
|
|
15
|
+
/** Size determines the maximum width of the dialog box */
|
|
16
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';
|
|
17
|
+
/** The visual style of the dialog box */
|
|
18
|
+
variant?: 'default' | 'warning' | 'danger' | 'success' | 'dark';
|
|
19
|
+
/** The label supplied to the close icon button if one is rendered */
|
|
20
|
+
closeLabel?: string;
|
|
21
|
+
/** Specifies class name to append to the base element */
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Determines where a scrollbar should appear if a modal is too large for the
|
|
25
|
+
* viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true
|
|
26
|
+
* the browser window itself receives the scrollbar.
|
|
27
|
+
*/
|
|
28
|
+
isFullscreenScroll?: boolean;
|
|
29
|
+
/** To show full screen view on mobile screens */
|
|
30
|
+
isFullscreenOnMobile?: boolean;
|
|
31
|
+
/** Prevent clicking on the backdrop or pressing Esc to close the modal */
|
|
32
|
+
isBlocking?: boolean;
|
|
33
|
+
/** Specifies the z-index of the modal */
|
|
34
|
+
zIndex?: number;
|
|
35
|
+
/** Specifies whether overflow is visible in the modal */
|
|
36
|
+
isOverflowVisible?: boolean;
|
|
37
|
+
}
|
|
38
|
+
declare function ModalDialog({ children, title, isOpen, onClose, size, variant, hasCloseButton, closeLabel, isFullscreenScroll, className, isFullscreenOnMobile, isBlocking, zIndex, isOverflowVisible, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
declare namespace ModalDialog {
|
|
40
|
+
var propTypes: {
|
|
41
|
+
/**
|
|
42
|
+
* Specifies the content of the dialog
|
|
43
|
+
*/
|
|
44
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
45
|
+
/**
|
|
46
|
+
* The aria-label of the dialog
|
|
47
|
+
*/
|
|
48
|
+
title: PropTypes.Validator<string>;
|
|
49
|
+
/**
|
|
50
|
+
* A callback to close the modal dialog
|
|
51
|
+
*/
|
|
52
|
+
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
53
|
+
/**
|
|
54
|
+
* Is the modal dialog open or closed
|
|
55
|
+
*/
|
|
56
|
+
isOpen: PropTypes.Requireable<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* The close 'x' icon button in the top right of the dialog box
|
|
59
|
+
*/
|
|
60
|
+
hasCloseButton: PropTypes.Requireable<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Sizes determine the maximum width of the dialog box
|
|
63
|
+
*/
|
|
64
|
+
size: PropTypes.Requireable<string>;
|
|
65
|
+
/**
|
|
66
|
+
* The visual style of the dialog box
|
|
67
|
+
*/
|
|
68
|
+
variant: PropTypes.Requireable<string>;
|
|
69
|
+
/**
|
|
70
|
+
* The label supplied to the close icon button if one is rendered
|
|
71
|
+
*/
|
|
72
|
+
closeLabel: PropTypes.Requireable<string>;
|
|
73
|
+
/**
|
|
74
|
+
* Specifies class name to append to the base element
|
|
75
|
+
*/
|
|
76
|
+
className: PropTypes.Requireable<string>;
|
|
77
|
+
/**
|
|
78
|
+
* Determines where a scrollbar should appear if a modal is too large for the
|
|
79
|
+
* viewport. When false, the ``ModalDialog``. Body receives a scrollbar, when true
|
|
80
|
+
* the browser window itself receives the scrollbar.
|
|
81
|
+
*/
|
|
82
|
+
isFullscreenScroll: PropTypes.Requireable<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* To show full screen view on mobile screens
|
|
85
|
+
*/
|
|
86
|
+
isFullscreenOnMobile: PropTypes.Requireable<boolean>;
|
|
87
|
+
/**
|
|
88
|
+
* Prevent clicking on the backdrop or pressing Esc to close the modal
|
|
89
|
+
*/
|
|
90
|
+
isBlocking: PropTypes.Requireable<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Specifies the z-index of the modal
|
|
93
|
+
*/
|
|
94
|
+
zIndex: PropTypes.Requireable<number>;
|
|
95
|
+
/**
|
|
96
|
+
* Specifies whether overflow content inside the modal should be visible.
|
|
97
|
+
* - `true` - content that exceeds the modal boundaries will remain visible outside the modal's main viewport,
|
|
98
|
+
* rather than being clipped or hidden.
|
|
99
|
+
* - `false` - any overflow content will be clipped to fit within the modal's dimensions.
|
|
100
|
+
*/
|
|
101
|
+
isOverflowVisible: PropTypes.Validator<boolean>;
|
|
102
|
+
};
|
|
103
|
+
var Header: import("react-bootstrap/esm/helpers").BsPrefixRefForwardingComponent<"div", import("./ModalDialogHeader").Props>;
|
|
104
|
+
var Title: any;
|
|
105
|
+
var Footer: any;
|
|
106
|
+
var CloseButton: any;
|
|
107
|
+
var Body: any;
|
|
108
|
+
var Hero: any;
|
|
109
|
+
}
|
|
110
|
+
export default ModalDialog;
|