@deix/rossini-core 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/package.json +1 -1
- package/lib/src/components/display/Accordion/Accordion.d.ts +4 -3
- package/lib/src/components/display/Accordion/Accordion.d.ts.map +1 -1
- package/lib/src/components/display/Accordion/Accordion.js +7 -2
- package/lib/tsconfig-lib.tsbuildinfo +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { AccordionProps as MUIAccordionProps, TypographyProps } from '@mui/material';
|
|
3
|
+
import { StringTranslation } from '../../../types';
|
|
3
4
|
interface RossiniAccordionProps {
|
|
4
|
-
title: string;
|
|
5
|
+
title: StringTranslation | string;
|
|
5
6
|
titleProps?: Partial<TypographyProps>;
|
|
6
|
-
subtitle?: string;
|
|
7
|
+
subtitle?: StringTranslation | string;
|
|
7
8
|
subtitleProps?: Partial<TypographyProps>;
|
|
8
9
|
icon?: ReactNode;
|
|
9
10
|
tooltip?: string;
|
|
10
11
|
expandIcon?: ReactNode;
|
|
11
12
|
}
|
|
12
|
-
export type AccordionProps = RossiniAccordionProps & MUIAccordionProps
|
|
13
|
+
export type AccordionProps = RossiniAccordionProps & Omit<MUIAccordionProps, 'title'>;
|
|
13
14
|
declare const Accordion: React.FC<AccordionProps>;
|
|
14
15
|
export default Accordion;
|
|
15
16
|
//# sourceMappingURL=Accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../../src/components/display/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAEL,cAAc,IAAI,iBAAiB,EAKnC,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../../src/components/display/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAEL,cAAc,IAAI,iBAAiB,EAKnC,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAuB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,UAAU,qBAAqB;IAC7B,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAChD,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAEnC,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAqCvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -23,17 +23,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import React from 'react';
|
|
24
24
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
25
25
|
import { Accordion as MUIAccordion, AccordionDetails, AccordionSummary, Tooltip, Typography, } from '@mui/material';
|
|
26
|
+
import { isStringTranslation } from '../../../types';
|
|
27
|
+
import { useLocale } from '../../../utils';
|
|
26
28
|
var Accordion = function (_a) {
|
|
27
29
|
var title = _a.title, _b = _a.titleProps, titleProps = _b === void 0 ? { variant: 'h6', color: 'textPrimary' } : _b, subtitle = _a.subtitle, _c = _a.subtitleProps, subtitleProps = _c === void 0 ? { variant: 'subtitle1', gutterBottom: true } : _c, icon = _a.icon, tooltip = _a.tooltip, _d = _a.expandIcon, expandIcon = _d === void 0 ? React.createElement(ExpandMoreIcon, null) : _d, children = _a.children, muiProps = __rest(_a, ["title", "titleProps", "subtitle", "subtitleProps", "icon", "tooltip", "expandIcon", "children"]);
|
|
30
|
+
var locale = useLocale();
|
|
31
|
+
var titleString = isStringTranslation(title) ? title[locale] : title;
|
|
32
|
+
var subtitleString = subtitle && isStringTranslation(subtitle) ? subtitle[locale] : subtitle;
|
|
28
33
|
return (React.createElement(Tooltip, { title: tooltip || '' },
|
|
29
34
|
React.createElement(React.Fragment, null,
|
|
30
35
|
React.createElement(MUIAccordion, __assign({}, muiProps),
|
|
31
36
|
React.createElement(AccordionSummary, { expandIcon: expandIcon },
|
|
32
37
|
icon && React.createElement("div", { style: { marginRight: '16px' } }, icon),
|
|
33
|
-
React.createElement(Typography, __assign({}, titleProps),
|
|
38
|
+
React.createElement(Typography, __assign({}, titleProps), titleString)),
|
|
34
39
|
React.createElement(AccordionDetails, null,
|
|
35
40
|
React.createElement(React.Fragment, null,
|
|
36
|
-
subtitle && React.createElement(Typography, __assign({}, subtitleProps),
|
|
41
|
+
subtitle && (React.createElement(Typography, __assign({}, subtitleProps), subtitleString)),
|
|
37
42
|
children))))));
|
|
38
43
|
};
|
|
39
44
|
export default Accordion;
|