@openedx/paragon 23.14.9 → 23.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Card/CardBody.d.ts +9 -0
- package/dist/Card/CardBody.js +0 -11
- package/dist/Card/CardBody.js.map +1 -1
- package/dist/Card/CardContext.d.ts +17 -0
- package/dist/Card/CardContext.js +8 -21
- package/dist/Card/CardContext.js.map +1 -1
- package/dist/Card/CardDivider.d.ts +7 -0
- package/dist/Card/CardDivider.js +2 -10
- package/dist/Card/CardDivider.js.map +1 -1
- package/dist/Card/CardFallbackDefaultImage.d.ts +1 -0
- package/dist/Card/CardFallbackDefaultImage.js +1 -0
- package/dist/Card/CardFallbackDefaultImage.js.map +1 -0
- package/dist/Card/CardGrid.d.ts +22 -0
- package/dist/Card/CardGrid.js +6 -31
- package/dist/Card/CardGrid.js.map +1 -1
- package/dist/DataTable/DataTableContext.d.ts +3 -0
- package/dist/DataTable/DataTableContext.js.map +1 -1
- package/dist/DataTable/TableCell.d.ts +14 -0
- package/dist/DataTable/TableCell.js +0 -12
- package/dist/DataTable/TableCell.js.map +1 -1
- package/dist/DataTable/TableHeaderCell.d.ts +26 -0
- package/dist/DataTable/TableHeaderCell.js +4 -32
- package/dist/DataTable/TableHeaderCell.js.map +1 -1
- package/dist/Menu/MenuItem.d.ts +17 -0
- package/dist/Menu/MenuItem.js +5 -27
- package/dist/Menu/MenuItem.js.map +1 -1
- package/dist/Menu/index.d.ts +16 -0
- package/dist/Menu/index.js +4 -24
- package/dist/Menu/index.js.map +1 -1
- package/dist/OverflowScroll/data/constants.d.ts +1 -0
- package/dist/OverflowScroll/data/constants.js +1 -0
- package/dist/OverflowScroll/data/constants.js.map +1 -0
- package/dist/PageBanner/index.d.ts +27 -0
- package/dist/PageBanner/index.js +5 -28
- package/dist/PageBanner/index.js.map +1 -1
- package/dist/Sheet/SheetContainer.js +30 -8
- package/dist/Sheet/SheetContainer.js.map +1 -1
- package/dist/Sheet/index.js +15 -5
- package/dist/Sheet/index.js.map +1 -1
- package/dist/Stack/index.d.ts +20 -0
- package/dist/Stack/index.js +3 -28
- package/dist/Stack/index.js.map +1 -1
- package/dist/Tabs/Tab.d.ts +19 -0
- package/dist/Tabs/Tab.js +0 -23
- package/dist/Tabs/Tab.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Card/CardBody.tsx +19 -0
- package/src/Card/{CardContext.jsx → CardContext.tsx} +24 -25
- package/src/Card/CardDivider.tsx +13 -0
- package/src/Card/{CardGrid.jsx → CardGrid.tsx} +28 -35
- package/src/DataTable/{TableCell.jsx → TableCell.tsx} +13 -15
- package/src/DataTable/{TableHeaderCell.jsx → TableHeaderCell.tsx} +32 -33
- package/src/Menu/MenuItem.tsx +49 -0
- package/src/Menu/{index.jsx → index.tsx} +18 -27
- package/src/PageBanner/{index.jsx → index.tsx} +27 -29
- package/src/Sheet/Sheet.test.jsx +63 -3
- package/src/Sheet/SheetContainer.jsx +34 -7
- package/src/Sheet/SheetContainer.test.jsx +34 -1
- package/src/Sheet/__snapshots__/Sheet.test.jsx.snap +15 -6
- package/src/Sheet/index.jsx +12 -2
- package/src/Stack/{index.jsx → index.tsx} +22 -35
- package/src/Tabs/{Tab.jsx → Tab.tsx} +10 -18
- package/src/index.ts +1 -2
- package/src/Card/CardBody.jsx +0 -23
- package/src/Card/CardDivider.jsx +0 -18
- package/src/Menu/MenuItem.jsx +0 -57
- /package/src/Card/{CardFallbackDefaultImage.js → CardFallbackDefaultImage.ts} +0 -0
- /package/src/DataTable/{DataTableContext.jsx → DataTableContext.tsx} +0 -0
- /package/src/OverflowScroll/data/{constants.js → constants.ts} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CardBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Specifies the content of the component. */
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
/** The class to append to the base element. */
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const CardBody: React.ForwardRefExoticComponent<CardBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default CardBody;
|
package/dist/Card/CardBody.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
const CardBody = /*#__PURE__*/React.forwardRef(({
|
|
5
4
|
className,
|
|
@@ -10,15 +9,5 @@ const CardBody = /*#__PURE__*/React.forwardRef(({
|
|
|
10
9
|
ref: ref,
|
|
11
10
|
...rest
|
|
12
11
|
}, children));
|
|
13
|
-
CardBody.propTypes = {
|
|
14
|
-
/** Specifies the content of the component. */
|
|
15
|
-
children: PropTypes.node,
|
|
16
|
-
/** The class to append to the base element. */
|
|
17
|
-
className: PropTypes.string
|
|
18
|
-
};
|
|
19
|
-
CardBody.defaultProps = {
|
|
20
|
-
children: undefined,
|
|
21
|
-
className: undefined
|
|
22
|
-
};
|
|
23
12
|
export default CardBody;
|
|
24
13
|
//# sourceMappingURL=CardBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardBody.js","names":["React","
|
|
1
|
+
{"version":3,"file":"CardBody.js","names":["React","classNames","CardBody","forwardRef","className","children","rest","ref","createElement"],"sources":["../../src/Card/CardBody.tsx"],"sourcesContent":["import React, { ForwardedRef } from 'react';\nimport classNames from 'classnames';\n\ninterface CardBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Specifies the content of the component. */\n children?: React.ReactNode;\n /** The class to append to the base element. */\n className?: string;\n}\n\nconst CardBody = React.forwardRef(({\n className, children, ...rest\n}: CardBodyProps, ref: ForwardedRef<HTMLDivElement>) => (\n <div className={classNames('pgn__card-body', className)} ref={ref} {...rest}>\n {children}\n </div>\n));\n\nexport default CardBody;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAC3C,OAAOC,UAAU,MAAM,YAAY;AASnC,MAAMC,QAAQ,gBAAGF,KAAK,CAACG,UAAU,CAAC,CAAC;EACjCC,SAAS;EAAEC,QAAQ;EAAE,GAAGC;AACX,CAAC,EAAEC,GAAiC,kBACjDP,KAAA,CAAAQ,aAAA;EAAKJ,SAAS,EAAEH,UAAU,CAAC,gBAAgB,EAAEG,SAAS,CAAE;EAACG,GAAG,EAAEA,GAAI;EAAA,GAAKD;AAAI,GACxED,QACE,CACN,CAAC;AAEF,eAAeH,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface CardContextData {
|
|
3
|
+
/** Specifies which orientation to use. */
|
|
4
|
+
orientation: 'horizontal' | 'vertical';
|
|
5
|
+
/** Specifies loading state. */
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
/** Specifies `Card` style variant */
|
|
8
|
+
variant: 'light' | 'dark' | 'muted';
|
|
9
|
+
}
|
|
10
|
+
declare const CardContext: React.Context<CardContextData>;
|
|
11
|
+
interface CardContextProviderProps extends Partial<CardContextData> {
|
|
12
|
+
/** Specifies content of the component. */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare function CardContextProvider({ orientation, children, isLoading, variant, }: CardContextProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export { CardContextProvider };
|
|
17
|
+
export default CardContext;
|
package/dist/Card/CardContext.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React, { createContext } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const CardContext = /*#__PURE__*/createContext({
|
|
3
|
+
orientation: 'vertical',
|
|
4
|
+
isLoading: false,
|
|
5
|
+
variant: 'light'
|
|
6
|
+
});
|
|
4
7
|
function CardContextProvider({
|
|
5
|
-
orientation,
|
|
8
|
+
orientation = 'vertical',
|
|
6
9
|
children,
|
|
7
|
-
isLoading,
|
|
8
|
-
variant
|
|
10
|
+
isLoading = false,
|
|
11
|
+
variant = 'light'
|
|
9
12
|
}) {
|
|
10
13
|
return /*#__PURE__*/React.createElement(CardContext.Provider, {
|
|
11
14
|
value: {
|
|
@@ -15,22 +18,6 @@ function CardContextProvider({
|
|
|
15
18
|
}
|
|
16
19
|
}, children);
|
|
17
20
|
}
|
|
18
|
-
CardContextProvider.propTypes = {
|
|
19
|
-
/** Specifies which orientation to use. */
|
|
20
|
-
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
21
|
-
/** Specifies loading state. */
|
|
22
|
-
isLoading: PropTypes.bool,
|
|
23
|
-
/** Specifies content of the component. */
|
|
24
|
-
children: PropTypes.node,
|
|
25
|
-
/** Specifies `Card` style variant */
|
|
26
|
-
variant: PropTypes.oneOf(['light', 'dark', 'muted'])
|
|
27
|
-
};
|
|
28
|
-
CardContextProvider.defaultProps = {
|
|
29
|
-
orientation: 'vertical',
|
|
30
|
-
isLoading: false,
|
|
31
|
-
children: null,
|
|
32
|
-
variant: 'light'
|
|
33
|
-
};
|
|
34
21
|
export { CardContextProvider };
|
|
35
22
|
export default CardContext;
|
|
36
23
|
//# sourceMappingURL=CardContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContext.js","names":["React","createContext","
|
|
1
|
+
{"version":3,"file":"CardContext.js","names":["React","createContext","CardContext","orientation","isLoading","variant","CardContextProvider","children","createElement","Provider","value"],"sources":["../../src/Card/CardContext.tsx"],"sourcesContent":["import React, { createContext, ReactNode } from 'react';\n\ninterface CardContextData {\n /** Specifies which orientation to use. */\n orientation: 'horizontal' | 'vertical';\n /** Specifies loading state. */\n isLoading: boolean;\n /** Specifies `Card` style variant */\n variant: 'light' | 'dark' | 'muted';\n}\n\nconst CardContext = createContext<CardContextData>({\n orientation: 'vertical',\n isLoading: false,\n variant: 'light',\n});\n\ninterface CardContextProviderProps extends Partial<CardContextData> {\n /** Specifies content of the component. */\n children?: ReactNode;\n}\n\nfunction CardContextProvider({\n orientation = 'vertical',\n children,\n isLoading = false,\n variant = 'light',\n}: CardContextProviderProps) {\n return (\n <CardContext.Provider value={{ orientation, isLoading, variant }}>\n {children}\n </CardContext.Provider>\n );\n}\n\nexport { CardContextProvider };\nexport default CardContext;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAmB,OAAO;AAWvD,MAAMC,WAAW,gBAAGD,aAAa,CAAkB;EACjDE,WAAW,EAAE,UAAU;EACvBC,SAAS,EAAE,KAAK;EAChBC,OAAO,EAAE;AACX,CAAC,CAAC;AAOF,SAASC,mBAAmBA,CAAC;EAC3BH,WAAW,GAAG,UAAU;EACxBI,QAAQ;EACRH,SAAS,GAAG,KAAK;EACjBC,OAAO,GAAG;AACc,CAAC,EAAE;EAC3B,oBACEL,KAAA,CAAAQ,aAAA,CAACN,WAAW,CAACO,QAAQ;IAACC,KAAK,EAAE;MAAEP,WAAW;MAAEC,SAAS;MAAEC;IAAQ;EAAE,GAC9DE,QACmB,CAAC;AAE3B;AAEA,SAASD,mBAAmB;AAC5B,eAAeJ,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CardDividerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Specifies class name to append to the base element. */
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const CardDivider: React.ForwardRefExoticComponent<CardDividerProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default CardDivider;
|
package/dist/Card/CardDivider.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
|
-
const CardDivider = /*#__PURE__*/
|
|
3
|
+
const CardDivider = /*#__PURE__*/forwardRef(({
|
|
5
4
|
className,
|
|
6
5
|
...props
|
|
7
6
|
}, ref) => /*#__PURE__*/React.createElement("div", {
|
|
@@ -9,12 +8,5 @@ const CardDivider = /*#__PURE__*/React.forwardRef(({
|
|
|
9
8
|
ref: ref,
|
|
10
9
|
...props
|
|
11
10
|
}));
|
|
12
|
-
CardDivider.propTypes = {
|
|
13
|
-
/** Specifies class name to append to the base element. */
|
|
14
|
-
className: PropTypes.string
|
|
15
|
-
};
|
|
16
|
-
CardDivider.defaultProps = {
|
|
17
|
-
className: undefined
|
|
18
|
-
};
|
|
19
11
|
export default CardDivider;
|
|
20
12
|
//# sourceMappingURL=CardDivider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardDivider.js","names":["React","
|
|
1
|
+
{"version":3,"file":"CardDivider.js","names":["React","forwardRef","classNames","CardDivider","className","props","ref","createElement"],"sources":["../../src/Card/CardDivider.tsx"],"sourcesContent":["import React, { forwardRef, ForwardedRef } from 'react';\nimport classNames from 'classnames';\n\ninterface CardDividerProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Specifies class name to append to the base element. */\n className?: string;\n}\n\nconst CardDivider = forwardRef(({ className, ...props }: CardDividerProps, ref: ForwardedRef<HTMLDivElement>) => (\n <div className={classNames('pgn__card-divider', className)} ref={ref} {...props} />\n));\n\nexport default CardDivider;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAsB,OAAO;AACvD,OAAOC,UAAU,MAAM,YAAY;AAOnC,MAAMC,WAAW,gBAAGF,UAAU,CAAC,CAAC;EAAEG,SAAS;EAAE,GAAGC;AAAwB,CAAC,EAAEC,GAAiC,kBAC1GN,KAAA,CAAAO,aAAA;EAAKH,SAAS,EAAEF,UAAU,CAAC,mBAAmB,EAAEE,SAAS,CAAE;EAACE,GAAG,EAAEA,GAAI;EAAA,GAAKD;AAAK,CAAG,CACnF,CAAC;AAEF,eAAeF,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cardSrcFallbackImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAACMCAYAAAB/AhJnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH6SURBVHgB7dRBEYBADACxwuDf5j0QUXywiYhc7zk7APzd3gNAgvABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIp4BaNpp2Q/3/wfPkGyXOQAAAABJRU5ErkJggg==";
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export const cardSrcFallbackImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAACMCAYAAAB/AhJnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH6SURBVHgB7dRBEYBADACxwuDf5j0QUXywiYhc7zk7APzd3gNAgvABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIp4BaNpp2Q/3/wfPkGyXOQAAAABJRU5ErkJggg==';
|
|
2
|
+
//# sourceMappingURL=CardFallbackDefaultImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardFallbackDefaultImage.js","names":["cardSrcFallbackImg"],"sources":["../../src/Card/CardFallbackDefaultImage.ts"],"sourcesContent":["export const cardSrcFallbackImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAACMCAYAAAB/AhJnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH6SURBVHgB7dRBEYBADACxwuDf5j0QUXywiYhc7zk7APzd3gNAgvABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIoQPECF8gAjhA0QIHyBC+AARwgeIED5AhPABIp4BaNpp2Q/3/wfPkGyXOQAAAABJRU5ErkJggg==';\n"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,GAAG,40BAA40B","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface CardGridProps {
|
|
3
|
+
/** The class name for the CardGrid component */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** The Card components to organize into a responsive grid */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* An object containing the desired column size at each breakpoint, following a similar
|
|
9
|
+
* props API as ``react-bootstrap/Col``
|
|
10
|
+
*/
|
|
11
|
+
columnSizes?: {
|
|
12
|
+
xs?: number;
|
|
13
|
+
sm?: number;
|
|
14
|
+
md?: number;
|
|
15
|
+
lg?: number;
|
|
16
|
+
xl?: number;
|
|
17
|
+
};
|
|
18
|
+
/** Whether to disable the default equal height cards across rows in the card grid */
|
|
19
|
+
hasEqualColumnHeights?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare function CardGrid({ className, children, columnSizes, hasEqualColumnHeights, }: CardGridProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export default CardGrid;
|
package/dist/Card/CardGrid.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import Row from 'react-bootstrap/Row';
|
|
5
4
|
import Col from 'react-bootstrap/Col';
|
|
6
5
|
function CardGrid({
|
|
7
6
|
className,
|
|
8
7
|
children,
|
|
9
|
-
columnSizes
|
|
10
|
-
|
|
8
|
+
columnSizes = {
|
|
9
|
+
sm: 12,
|
|
10
|
+
lg: 6,
|
|
11
|
+
xl: 4
|
|
12
|
+
},
|
|
13
|
+
hasEqualColumnHeights = true
|
|
11
14
|
}) {
|
|
12
15
|
const cards = useMemo(() => React.Children.map(children, card => /*#__PURE__*/React.createElement(Col, {
|
|
13
16
|
...columnSizes,
|
|
@@ -19,33 +22,5 @@ function CardGrid({
|
|
|
19
22
|
className: classNames('pgn__card-grid', className)
|
|
20
23
|
}, /*#__PURE__*/React.createElement(Row, null, cards));
|
|
21
24
|
}
|
|
22
|
-
CardGrid.propTypes = {
|
|
23
|
-
/** The class name for the CardGrid component */
|
|
24
|
-
className: PropTypes.string,
|
|
25
|
-
/** The Card components to organize into a responsive grid */
|
|
26
|
-
children: PropTypes.node.isRequired,
|
|
27
|
-
/**
|
|
28
|
-
* An object containing the desired column size at each breakpoint, following a similar
|
|
29
|
-
* props API as ``react-bootstrap/Col``
|
|
30
|
-
*/
|
|
31
|
-
columnSizes: PropTypes.shape({
|
|
32
|
-
xs: PropTypes.number,
|
|
33
|
-
sm: PropTypes.number,
|
|
34
|
-
md: PropTypes.number,
|
|
35
|
-
lg: PropTypes.number,
|
|
36
|
-
xl: PropTypes.number
|
|
37
|
-
}),
|
|
38
|
-
/** Whether to disable the default equal height cards across rows in the card grid */
|
|
39
|
-
hasEqualColumnHeights: PropTypes.bool
|
|
40
|
-
};
|
|
41
|
-
CardGrid.defaultProps = {
|
|
42
|
-
className: undefined,
|
|
43
|
-
columnSizes: {
|
|
44
|
-
sm: 12,
|
|
45
|
-
lg: 6,
|
|
46
|
-
xl: 4
|
|
47
|
-
},
|
|
48
|
-
hasEqualColumnHeights: true
|
|
49
|
-
};
|
|
50
25
|
export default CardGrid;
|
|
51
26
|
//# sourceMappingURL=CardGrid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardGrid.js","names":["React","useMemo","classNames","
|
|
1
|
+
{"version":3,"file":"CardGrid.js","names":["React","useMemo","classNames","Row","Col","CardGrid","className","children","columnSizes","sm","lg","xl","hasEqualColumnHeights","cards","Children","map","card","createElement"],"sources":["../../src/Card/CardGrid.tsx"],"sourcesContent":["import React, { useMemo, ReactNode } from 'react';\nimport classNames from 'classnames';\nimport Row from 'react-bootstrap/Row';\nimport Col from 'react-bootstrap/Col';\n\ninterface CardGridProps {\n /** The class name for the CardGrid component */\n className?: string;\n /** The Card components to organize into a responsive grid */\n children: ReactNode;\n /**\n * An object containing the desired column size at each breakpoint, following a similar\n * props API as ``react-bootstrap/Col``\n */\n columnSizes?: {\n xs?: number;\n sm?: number;\n md?: number;\n lg?: number;\n xl?: number;\n };\n /** Whether to disable the default equal height cards across rows in the card grid */\n hasEqualColumnHeights?: boolean;\n}\n\nfunction CardGrid({\n className,\n children,\n columnSizes = {\n sm: 12,\n lg: 6,\n xl: 4,\n },\n hasEqualColumnHeights = true,\n}: CardGridProps) {\n const cards = useMemo(\n () => React.Children.map(children, (card) => (\n <Col\n {...columnSizes}\n className={classNames(\n 'pgn__card-grid__card-item',\n {\n 'pgn__card__disable-equal-column-heights': !hasEqualColumnHeights,\n },\n )}\n >\n {card}\n </Col>\n )),\n [children, columnSizes, hasEqualColumnHeights],\n );\n\n return (\n <div className={classNames('pgn__card-grid', className)}>\n <Row>\n {cards}\n </Row>\n </div>\n );\n}\n\nexport default CardGrid;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAmB,OAAO;AACjD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,GAAG,MAAM,qBAAqB;AACrC,OAAOC,GAAG,MAAM,qBAAqB;AAsBrC,SAASC,QAAQA,CAAC;EAChBC,SAAS;EACTC,QAAQ;EACRC,WAAW,GAAG;IACZC,EAAE,EAAE,EAAE;IACNC,EAAE,EAAE,CAAC;IACLC,EAAE,EAAE;EACN,CAAC;EACDC,qBAAqB,GAAG;AACX,CAAC,EAAE;EAChB,MAAMC,KAAK,GAAGZ,OAAO,CACnB,MAAMD,KAAK,CAACc,QAAQ,CAACC,GAAG,CAACR,QAAQ,EAAGS,IAAI,iBACtChB,KAAA,CAAAiB,aAAA,CAACb,GAAG;IAAA,GACEI,WAAW;IACfF,SAAS,EAAEJ,UAAU,CACnB,2BAA2B,EAC3B;MACE,yCAAyC,EAAE,CAACU;IAC9C,CACF;EAAE,GAEDI,IACE,CACN,CAAC,EACF,CAACT,QAAQ,EAAEC,WAAW,EAAEI,qBAAqB,CAC/C,CAAC;EAED,oBACEZ,KAAA,CAAAiB,aAAA;IAAKX,SAAS,EAAEJ,UAAU,CAAC,gBAAgB,EAAEI,SAAS;EAAE,gBACtDN,KAAA,CAAAiB,aAAA,CAACd,GAAG,QACDU,KACE,CACF,CAAC;AAEV;AAEA,eAAeR,QAAQ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableContext.js","names":["createContext","DataTableContext"],"sources":["../../src/DataTable/DataTableContext.
|
|
1
|
+
{"version":3,"file":"DataTableContext.js","names":["createContext","DataTableContext"],"sources":["../../src/DataTable/DataTableContext.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nconst DataTableContext = createContext({});\n\nexport default DataTableContext;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,OAAO;AAErC,MAAMC,gBAAgB,gBAAGD,aAAa,CAAC,CAAC,CAAC,CAAC;AAE1C,eAAeC,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode, TdHTMLAttributes } from 'react';
|
|
2
|
+
interface TableCellProps {
|
|
3
|
+
/** Props for the td element */
|
|
4
|
+
getCellProps: () => TdHTMLAttributes<HTMLTableCellElement>;
|
|
5
|
+
/** Function that renders the cell contents. Will be called with the string 'Cell' */
|
|
6
|
+
render: (type: 'Cell') => ReactNode;
|
|
7
|
+
/** Table column */
|
|
8
|
+
column: {
|
|
9
|
+
/** Class(es) to be applied to the cells in the given column */
|
|
10
|
+
cellClassName?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
declare function TableCell({ getCellProps, render, column }: TableCellProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default TableCell;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
function TableCell({
|
|
5
4
|
getCellProps,
|
|
@@ -15,16 +14,5 @@ function TableCell({
|
|
|
15
14
|
className: classNames('pgn__data-table-cell-wrap', className, column.cellClassName)
|
|
16
15
|
}, render('Cell'));
|
|
17
16
|
}
|
|
18
|
-
TableCell.propTypes = {
|
|
19
|
-
/** Props for the td element */
|
|
20
|
-
getCellProps: PropTypes.func.isRequired,
|
|
21
|
-
/** Function that renders the cell contents. Will be called with the string 'Cell' */
|
|
22
|
-
render: PropTypes.func.isRequired,
|
|
23
|
-
/** Table column */
|
|
24
|
-
column: PropTypes.shape({
|
|
25
|
-
/** Class(es) to be applied to the cells in the given column */
|
|
26
|
-
cellClassName: PropTypes.string
|
|
27
|
-
}).isRequired
|
|
28
|
-
};
|
|
29
17
|
export default TableCell;
|
|
30
18
|
//# sourceMappingURL=TableCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.js","names":["React","
|
|
1
|
+
{"version":3,"file":"TableCell.js","names":["React","classNames","TableCell","getCellProps","render","column","className","rest","createElement","cellClassName"],"sources":["../../src/DataTable/TableCell.tsx"],"sourcesContent":["import React, { ReactNode, TdHTMLAttributes } from 'react';\nimport classNames from 'classnames';\n\ninterface TableCellProps {\n /** Props for the td element */\n getCellProps: () => TdHTMLAttributes<HTMLTableCellElement>;\n /** Function that renders the cell contents. Will be called with the string 'Cell' */\n render: (type: 'Cell') => ReactNode;\n /** Table column */\n column: {\n /** Class(es) to be applied to the cells in the given column */\n cellClassName?: string;\n };\n}\nfunction TableCell({ getCellProps, render, column }: TableCellProps) {\n const { className, ...rest } = getCellProps();\n return (\n <td {...rest} className={classNames('pgn__data-table-cell-wrap', className, column.cellClassName)}>\n {render('Cell')}\n </td>\n );\n}\n\nexport default TableCell;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAuC,OAAO;AAC1D,OAAOC,UAAU,MAAM,YAAY;AAanC,SAASC,SAASA,CAAC;EAAEC,YAAY;EAAEC,MAAM;EAAEC;AAAuB,CAAC,EAAE;EACnE,MAAM;IAAEC,SAAS;IAAE,GAAGC;EAAK,CAAC,GAAGJ,YAAY,CAAC,CAAC;EAC7C,oBACEH,KAAA,CAAAQ,aAAA;IAAA,GAAQD,IAAI;IAAED,SAAS,EAAEL,UAAU,CAAC,2BAA2B,EAAEK,SAAS,EAAED,MAAM,CAACI,aAAa;EAAE,GAC/FL,MAAM,CAAC,MAAM,CACZ,CAAC;AAET;AAEA,eAAeF,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SortIndicatorProps {
|
|
3
|
+
/** Indicates whether or not a column is sorted */
|
|
4
|
+
isSorted: boolean;
|
|
5
|
+
/** Indicates whether the column is sorted in descending order */
|
|
6
|
+
isSortedDesc: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function SortIndicator({ isSorted, isSortedDesc }: SortIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface TableHeaderCellProps {
|
|
10
|
+
/** Returns props for the th element */
|
|
11
|
+
getHeaderProps: (...args: any[]) => Record<string, any>;
|
|
12
|
+
/** Indicates whether or not a column is sorted */
|
|
13
|
+
isSorted?: boolean;
|
|
14
|
+
/** Renders the header content. Passed the string 'Header' */
|
|
15
|
+
render: (type: 'Header') => React.ReactNode;
|
|
16
|
+
/** Indicates whether the column is sorted in descending order */
|
|
17
|
+
isSortedDesc?: boolean;
|
|
18
|
+
/** Gets props related to sorting that will be passed to th */
|
|
19
|
+
getSortByToggleProps?: (...args: any[]) => Record<string, any>;
|
|
20
|
+
/** Indicates whether a column is sortable */
|
|
21
|
+
canSort?: boolean;
|
|
22
|
+
/** Class(es) to be applied to header cells */
|
|
23
|
+
headerClassName?: string;
|
|
24
|
+
}
|
|
25
|
+
declare function TableHeaderCell({ getHeaderProps, render, canSort, getSortByToggleProps, isSorted, isSortedDesc, headerClassName, }: TableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export default TableHeaderCell;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import Icon from '../Icon';
|
|
5
4
|
import { ArrowDropDown, ArrowDropUp, ArrowDropUpDown } from '../../icons';
|
|
@@ -27,17 +26,13 @@ export function SortIndicator({
|
|
|
27
26
|
"data-testid": "arrow-drop-up"
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
|
-
SortIndicator.propTypes = {
|
|
31
|
-
isSorted: PropTypes.bool.isRequired,
|
|
32
|
-
isSortedDesc: PropTypes.bool.isRequired
|
|
33
|
-
};
|
|
34
29
|
function TableHeaderCell({
|
|
35
30
|
getHeaderProps,
|
|
36
31
|
render,
|
|
37
|
-
canSort,
|
|
38
|
-
getSortByToggleProps,
|
|
39
|
-
isSorted,
|
|
40
|
-
isSortedDesc,
|
|
32
|
+
canSort = false,
|
|
33
|
+
getSortByToggleProps = () => ({}),
|
|
34
|
+
isSorted = false,
|
|
35
|
+
isSortedDesc = false,
|
|
41
36
|
headerClassName
|
|
42
37
|
}) {
|
|
43
38
|
const toggleProps = canSort && getSortByToggleProps ? getSortByToggleProps() : {};
|
|
@@ -50,28 +45,5 @@ function TableHeaderCell({
|
|
|
50
45
|
isSortedDesc: isSortedDesc || false
|
|
51
46
|
})));
|
|
52
47
|
}
|
|
53
|
-
TableHeaderCell.defaultProps = {
|
|
54
|
-
headerClassName: null,
|
|
55
|
-
isSorted: false,
|
|
56
|
-
isSortedDesc: false,
|
|
57
|
-
canSort: false,
|
|
58
|
-
getSortByToggleProps: () => {}
|
|
59
|
-
};
|
|
60
|
-
TableHeaderCell.propTypes = {
|
|
61
|
-
/** Returns props for the th element */
|
|
62
|
-
getHeaderProps: PropTypes.func.isRequired,
|
|
63
|
-
/** Indicates whether or not a column is sorted */
|
|
64
|
-
isSorted: PropTypes.bool,
|
|
65
|
-
/** Renders the header content. Passed the string 'Header' */
|
|
66
|
-
render: PropTypes.func.isRequired,
|
|
67
|
-
/** Indicates whether the column is sorted in descending order */
|
|
68
|
-
isSortedDesc: PropTypes.bool,
|
|
69
|
-
/** Gets props related to sorting that will be passed to th */
|
|
70
|
-
getSortByToggleProps: PropTypes.func,
|
|
71
|
-
/** Indicates whether a column is sortable */
|
|
72
|
-
canSort: PropTypes.bool,
|
|
73
|
-
/** Class(es) to be applied to header cells */
|
|
74
|
-
headerClassName: PropTypes.string
|
|
75
|
-
};
|
|
76
48
|
export default TableHeaderCell;
|
|
77
49
|
//# sourceMappingURL=TableHeaderCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeaderCell.js","names":["React","
|
|
1
|
+
{"version":3,"file":"TableHeaderCell.js","names":["React","classNames","Icon","ArrowDropDown","ArrowDropUp","ArrowDropUpDown","SortIndicator","isSorted","isSortedDesc","createElement","style","opacity","src","TableHeaderCell","getHeaderProps","render","canSort","getSortByToggleProps","headerClassName","toggleProps","className"],"sources":["../../src/DataTable/TableHeaderCell.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport Icon from '../Icon';\nimport { ArrowDropDown, ArrowDropUp, ArrowDropUpDown } from '../../icons';\n\ninterface SortIndicatorProps {\n /** Indicates whether or not a column is sorted */\n isSorted: boolean;\n /** Indicates whether the column is sorted in descending order */\n isSortedDesc: boolean;\n}\n\nexport function SortIndicator({ isSorted, isSortedDesc }: SortIndicatorProps) {\n if (!isSorted) {\n return <Icon style={{ opacity: 0.5 }} src={ArrowDropUpDown} data-testid=\"arrow-drop-up-down\" />;\n }\n\n if (isSortedDesc) {\n return <Icon src={ArrowDropDown} data-testid=\"arrow-drop-down\" />;\n }\n\n return <Icon src={ArrowDropUp} data-testid=\"arrow-drop-up\" />;\n}\n\ninterface TableHeaderCellProps {\n /** Returns props for the th element */\n getHeaderProps: (...args: any[]) => Record<string, any>;\n /** Indicates whether or not a column is sorted */\n isSorted?: boolean;\n /** Renders the header content. Passed the string 'Header' */\n render: (type: 'Header') => React.ReactNode;\n /** Indicates whether the column is sorted in descending order */\n isSortedDesc?: boolean;\n /** Gets props related to sorting that will be passed to th */\n getSortByToggleProps?: (...args: any[]) => Record<string, any>;\n /** Indicates whether a column is sortable */\n canSort?: boolean;\n /** Class(es) to be applied to header cells */\n headerClassName?: string;\n}\n\nfunction TableHeaderCell({\n getHeaderProps,\n render,\n canSort = false,\n getSortByToggleProps = () => ({}),\n isSorted = false,\n isSortedDesc = false,\n headerClassName,\n}: TableHeaderCellProps) {\n const toggleProps = canSort && getSortByToggleProps ? getSortByToggleProps() : {};\n\n return (\n <th {...getHeaderProps(toggleProps)}>\n <span className={classNames('d-flex align-items-center', headerClassName)}>\n <span>{render('Header')}</span>\n {canSort && <SortIndicator isSorted={isSorted} isSortedDesc={isSortedDesc || false} />}\n </span>\n </th>\n );\n}\n\nexport default TableHeaderCell;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,aAAa,EAAEC,WAAW,EAAEC,eAAe,QAAQ,aAAa;AASzE,OAAO,SAASC,aAAaA,CAAC;EAAEC,QAAQ;EAAEC;AAAiC,CAAC,EAAE;EAC5E,IAAI,CAACD,QAAQ,EAAE;IACb,oBAAOP,KAAA,CAAAS,aAAA,CAACP,IAAI;MAACQ,KAAK,EAAE;QAAEC,OAAO,EAAE;MAAI,CAAE;MAACC,GAAG,EAAEP,eAAgB;MAAC,eAAY;IAAoB,CAAE,CAAC;EACjG;EAEA,IAAIG,YAAY,EAAE;IAChB,oBAAOR,KAAA,CAAAS,aAAA,CAACP,IAAI;MAACU,GAAG,EAAET,aAAc;MAAC,eAAY;IAAiB,CAAE,CAAC;EACnE;EAEA,oBAAOH,KAAA,CAAAS,aAAA,CAACP,IAAI;IAACU,GAAG,EAAER,WAAY;IAAC,eAAY;EAAe,CAAE,CAAC;AAC/D;AAmBA,SAASS,eAAeA,CAAC;EACvBC,cAAc;EACdC,MAAM;EACNC,OAAO,GAAG,KAAK;EACfC,oBAAoB,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC;EACjCV,QAAQ,GAAG,KAAK;EAChBC,YAAY,GAAG,KAAK;EACpBU;AACoB,CAAC,EAAE;EACvB,MAAMC,WAAW,GAAGH,OAAO,IAAIC,oBAAoB,GAAGA,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC;EAEjF,oBACEjB,KAAA,CAAAS,aAAA;IAAA,GAAQK,cAAc,CAACK,WAAW;EAAC,gBACjCnB,KAAA,CAAAS,aAAA;IAAMW,SAAS,EAAEnB,UAAU,CAAC,2BAA2B,EAAEiB,eAAe;EAAE,gBACxElB,KAAA,CAAAS,aAAA,eAAOM,MAAM,CAAC,QAAQ,CAAQ,CAAC,EAC9BC,OAAO,iBAAIhB,KAAA,CAAAS,aAAA,CAACH,aAAa;IAACC,QAAQ,EAAEA,QAAS;IAACC,YAAY,EAAEA,YAAY,IAAI;EAAM,CAAE,CACjF,CACJ,CAAC;AAET;AAEA,eAAeK,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode, ElementType } from 'react';
|
|
2
|
+
interface MenuItemProps {
|
|
3
|
+
/** Specifies that this `MenuItem` is selected inside the `SelectMenu` */
|
|
4
|
+
defaultSelected?: boolean;
|
|
5
|
+
/** Specifies class name to append to the base element */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Specifies the content of the `MenuItem` */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Specifies the base element */
|
|
10
|
+
as?: ElementType;
|
|
11
|
+
/** Specifies the jsx before the content of the `MenuItem` */
|
|
12
|
+
iconBefore?: ReactElement | ElementType;
|
|
13
|
+
/** Specifies the jsx after the content of the `MenuItem` */
|
|
14
|
+
iconAfter?: ReactElement | ElementType;
|
|
15
|
+
}
|
|
16
|
+
declare function MenuItem({ as, children, defaultSelected, iconAfter, iconBefore, ...props }: MenuItemProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
17
|
+
export default MenuItem;
|
package/dist/Menu/MenuItem.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { createElement } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import Icon from '../Icon';
|
|
5
4
|
function MenuItem({
|
|
6
|
-
as,
|
|
5
|
+
as = 'button',
|
|
7
6
|
children,
|
|
8
|
-
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
+
defaultSelected = false,
|
|
9
9
|
iconAfter,
|
|
10
10
|
iconBefore,
|
|
11
11
|
...props
|
|
12
12
|
}) {
|
|
13
13
|
const className = classNames(props.className, 'pgn__menu-item');
|
|
14
|
-
return /*#__PURE__*/
|
|
14
|
+
return /*#__PURE__*/createElement(as, {
|
|
15
15
|
...props,
|
|
16
16
|
className
|
|
17
17
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, iconBefore && /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -26,27 +26,5 @@ function MenuItem({
|
|
|
26
26
|
src: iconAfter
|
|
27
27
|
})));
|
|
28
28
|
}
|
|
29
|
-
MenuItem.propTypes = {
|
|
30
|
-
/** Specifies that this ``MenuItem`` is selected inside the ``SelectMenu`` */
|
|
31
|
-
defaultSelected: PropTypes.bool,
|
|
32
|
-
/** Specifies class name to append to the base element */
|
|
33
|
-
className: PropTypes.string,
|
|
34
|
-
/** Specifies the content of the ``MenuItem`` */
|
|
35
|
-
children: PropTypes.node,
|
|
36
|
-
/** Specifies the base element */
|
|
37
|
-
as: PropTypes.elementType,
|
|
38
|
-
/** Specifies the jsx before the content of the ``MenuItem`` */
|
|
39
|
-
iconBefore: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),
|
|
40
|
-
/** Specifies the jsx after the content of the ``MenuItem`` */
|
|
41
|
-
iconAfter: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType])
|
|
42
|
-
};
|
|
43
|
-
MenuItem.defaultProps = {
|
|
44
|
-
defaultSelected: false,
|
|
45
|
-
as: 'button',
|
|
46
|
-
className: undefined,
|
|
47
|
-
children: null,
|
|
48
|
-
iconBefore: undefined,
|
|
49
|
-
iconAfter: undefined
|
|
50
|
-
};
|
|
51
29
|
export default MenuItem;
|
|
52
30
|
//# sourceMappingURL=MenuItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.js","names":["React","
|
|
1
|
+
{"version":3,"file":"MenuItem.js","names":["React","createElement","classNames","Icon","MenuItem","as","children","defaultSelected","iconAfter","iconBefore","props","className","Fragment","src"],"sources":["../../src/Menu/MenuItem.tsx"],"sourcesContent":["import React, {\n ReactElement, ReactNode, ElementType, createElement, ComponentType,\n} from 'react';\nimport classNames from 'classnames';\nimport Icon from '../Icon';\n\ninterface MenuItemProps {\n /** Specifies that this `MenuItem` is selected inside the `SelectMenu` */\n defaultSelected?: boolean;\n /** Specifies class name to append to the base element */\n className?: string;\n /** Specifies the content of the `MenuItem` */\n children: ReactNode;\n /** Specifies the base element */\n as?: ElementType;\n /** Specifies the jsx before the content of the `MenuItem` */\n iconBefore?: ReactElement | ElementType;\n /** Specifies the jsx after the content of the `MenuItem` */\n iconAfter?: ReactElement | ElementType;\n}\nfunction MenuItem({\n as = 'button',\n children,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n defaultSelected = false,\n iconAfter,\n iconBefore,\n ...props\n}: MenuItemProps) {\n const className = classNames(props.className, 'pgn__menu-item');\n\n return createElement(\n as,\n {\n ...props,\n className,\n },\n (\n <>\n {iconBefore && <Icon className=\"btn-icon-before\" src={iconBefore as ComponentType} />}\n <span className=\"pgn__menu-item-text\">{children}</span>\n <span className=\"pgn__menu-item-content-spacer\" />\n {iconAfter && <Icon className=\"btn-icon-after\" src={iconAfter as ComponentType} />}\n </>\n ),\n );\n}\n\nexport default MenuItem;\n"],"mappings":"AAAA,OAAOA,KAAK,IAC4BC,aAAa,QAC9C,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,IAAI,MAAM,SAAS;AAgB1B,SAASC,QAAQA,CAAC;EAChBC,EAAE,GAAG,QAAQ;EACbC,QAAQ;EACR;EACAC,eAAe,GAAG,KAAK;EACvBC,SAAS;EACTC,UAAU;EACV,GAAGC;AACU,CAAC,EAAE;EAChB,MAAMC,SAAS,GAAGT,UAAU,CAACQ,KAAK,CAACC,SAAS,EAAE,gBAAgB,CAAC;EAE/D,oBAAOV,aAAa,CAClBI,EAAE,EACF;IACE,GAAGK,KAAK;IACRC;EACF,CAAC,eAECX,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAY,QAAA,QACGH,UAAU,iBAAIT,KAAA,CAAAC,aAAA,CAACE,IAAI;IAACQ,SAAS,EAAC,iBAAiB;IAACE,GAAG,EAAEJ;EAA4B,CAAE,CAAC,eACrFT,KAAA,CAAAC,aAAA;IAAMU,SAAS,EAAC;EAAqB,GAAEL,QAAe,CAAC,eACvDN,KAAA,CAAAC,aAAA;IAAMU,SAAS,EAAC;EAA+B,CAAE,CAAC,EACjDH,SAAS,iBAAIR,KAAA,CAAAC,aAAA,CAACE,IAAI;IAACQ,SAAS,EAAC,gBAAgB;IAACE,GAAG,EAAEL;EAA2B,CAAE,CACjF,CAEN,CAAC;AACH;AAEA,eAAeJ,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ElementType, ReactNode } from 'react';
|
|
2
|
+
interface MenuProps {
|
|
3
|
+
/** Specifies class name to append to the base element */
|
|
4
|
+
className?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Specifies the CSS selector string that indicates to which elements
|
|
7
|
+
* the user can navigate using the arrow keys
|
|
8
|
+
*/
|
|
9
|
+
arrowKeyNavigationSelector?: string;
|
|
10
|
+
/** Specifies the base element */
|
|
11
|
+
as?: ElementType;
|
|
12
|
+
/** Specifies the content of the menu */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare function Menu({ as, arrowKeyNavigationSelector, children, ...props }: MenuProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
16
|
+
export default Menu;
|
package/dist/Menu/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { createElement } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';
|
|
5
4
|
function Menu({
|
|
6
|
-
as,
|
|
7
|
-
arrowKeyNavigationSelector,
|
|
5
|
+
as = 'div',
|
|
6
|
+
arrowKeyNavigationSelector = 'a:not(:disabled),button:not(:disabled),input:not(:disabled)',
|
|
8
7
|
children,
|
|
9
8
|
...props
|
|
10
9
|
}) {
|
|
@@ -12,7 +11,7 @@ function Menu({
|
|
|
12
11
|
selectors: arrowKeyNavigationSelector
|
|
13
12
|
});
|
|
14
13
|
const className = classNames(props.className, 'pgn__menu');
|
|
15
|
-
return /*#__PURE__*/
|
|
14
|
+
return /*#__PURE__*/createElement(as, {
|
|
16
15
|
...props,
|
|
17
16
|
ref: parentRef,
|
|
18
17
|
className
|
|
@@ -21,24 +20,5 @@ function Menu({
|
|
|
21
20
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
22
21
|
React.createElement(React.Fragment, null, children));
|
|
23
22
|
}
|
|
24
|
-
Menu.propTypes = {
|
|
25
|
-
/** Specifies class name to append to the base element */
|
|
26
|
-
className: PropTypes.string,
|
|
27
|
-
/**
|
|
28
|
-
* Specifies the CSS selector string that indicates to which elements
|
|
29
|
-
* the user can navigate using the arrow keys
|
|
30
|
-
*/
|
|
31
|
-
arrowKeyNavigationSelector: PropTypes.string,
|
|
32
|
-
/** Specifies the base element */
|
|
33
|
-
as: PropTypes.elementType,
|
|
34
|
-
/** Specifies the content of the menu */
|
|
35
|
-
children: PropTypes.node
|
|
36
|
-
};
|
|
37
|
-
Menu.defaultProps = {
|
|
38
|
-
className: undefined,
|
|
39
|
-
arrowKeyNavigationSelector: 'a:not(:disabled),button:not(:disabled),input:not(:disabled)',
|
|
40
|
-
as: 'div',
|
|
41
|
-
children: null
|
|
42
|
-
};
|
|
43
23
|
export default Menu;
|
|
44
24
|
//# sourceMappingURL=index.js.map
|
package/dist/Menu/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","createElement","classNames","useArrowKeyNavigation","Menu","as","arrowKeyNavigationSelector","children","props","parentRef","selectors","className","ref","Fragment"],"sources":["../../src/Menu/index.tsx"],"sourcesContent":["import React, { ElementType, ReactNode, createElement } from 'react';\nimport classNames from 'classnames';\nimport useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';\n\ninterface MenuProps {\n /** Specifies class name to append to the base element */\n className?: string;\n /**\n * Specifies the CSS selector string that indicates to which elements\n * the user can navigate using the arrow keys\n */\n arrowKeyNavigationSelector?: string;\n /** Specifies the base element */\n as?: ElementType;\n /** Specifies the content of the menu */\n children?: ReactNode;\n}\nfunction Menu({\n as = 'div',\n arrowKeyNavigationSelector = 'a:not(:disabled),button:not(:disabled),input:not(:disabled)',\n children,\n ...props\n}: MenuProps) {\n const parentRef = useArrowKeyNavigation({ selectors: arrowKeyNavigationSelector });\n const className = classNames(props.className, 'pgn__menu');\n\n return createElement(\n as,\n {\n ...props,\n ref: parentRef,\n className,\n },\n (\n // eslint-disable-next-line react/jsx-no-useless-fragment\n <>\n {children}\n </>\n ),\n );\n}\n\nexport default Menu;\n"],"mappings":"AAAA,OAAOA,KAAK,IAA4BC,aAAa,QAAQ,OAAO;AACpE,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,qBAAqB,MAAM,oCAAoC;AAetE,SAASC,IAAIA,CAAC;EACZC,EAAE,GAAG,KAAK;EACVC,0BAA0B,GAAG,6DAA6D;EAC1FC,QAAQ;EACR,GAAGC;AACM,CAAC,EAAE;EACZ,MAAMC,SAAS,GAAGN,qBAAqB,CAAC;IAAEO,SAAS,EAAEJ;EAA2B,CAAC,CAAC;EAClF,MAAMK,SAAS,GAAGT,UAAU,CAACM,KAAK,CAACG,SAAS,EAAE,WAAW,CAAC;EAE1D,oBAAOV,aAAa,CAClBI,EAAE,EACF;IACE,GAAGG,KAAK;IACRI,GAAG,EAAEH,SAAS;IACdE;EACF,CAAC;EAAA;EAEC;EACAX,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAa,QAAA,QACGN,QACD,CAEN,CAAC;AACH;AAEA,eAAeH,IAAI","ignoreList":[]}
|