@coveord/plasma-mantine 52.14.1 → 52.16.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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +32 -32
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/header/Header.d.ts +8 -21
- package/dist/cjs/components/header/Header.d.ts.map +1 -1
- package/dist/cjs/components/header/Header.js +36 -65
- package/dist/cjs/components/header/Header.js.map +1 -1
- package/dist/cjs/components/header/Header.styles.d.ts +14 -0
- package/dist/cjs/components/header/Header.styles.d.ts.map +1 -0
- package/dist/cjs/components/header/Header.styles.js +30 -0
- package/dist/cjs/components/header/Header.styles.js.map +1 -0
- package/dist/cjs/components/header/HeaderActions/HeaderActions.d.ts +8 -0
- package/dist/cjs/components/header/HeaderActions/HeaderActions.d.ts.map +1 -0
- package/dist/cjs/components/header/HeaderActions/HeaderActions.js +41 -0
- package/dist/cjs/components/header/HeaderActions/HeaderActions.js.map +1 -0
- package/dist/cjs/components/header/HeaderActions/HeaderActions.styles.d.ts +10 -0
- package/dist/cjs/components/header/HeaderActions/HeaderActions.styles.d.ts.map +1 -0
- package/dist/cjs/components/header/HeaderActions/HeaderActions.styles.js +20 -0
- package/dist/cjs/components/header/HeaderActions/HeaderActions.styles.js.map +1 -0
- package/dist/cjs/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.d.ts +8 -0
- package/dist/cjs/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.d.ts.map +1 -0
- package/dist/cjs/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.js +40 -0
- package/dist/cjs/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.js.map +1 -0
- package/dist/cjs/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.d.ts +11 -0
- package/dist/cjs/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.d.ts.map +1 -0
- package/dist/cjs/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.js +26 -0
- package/dist/cjs/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.js.map +1 -0
- package/dist/cjs/components/header/HeaderDocAnchor/HeaderDocAnchor.d.ts +22 -0
- package/dist/cjs/components/header/HeaderDocAnchor/HeaderDocAnchor.d.ts.map +1 -0
- package/dist/cjs/components/header/HeaderDocAnchor/HeaderDocAnchor.js +55 -0
- package/dist/cjs/components/header/HeaderDocAnchor/HeaderDocAnchor.js.map +1 -0
- package/dist/cjs/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.d.ts +11 -0
- package/dist/cjs/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.d.ts.map +1 -0
- package/dist/cjs/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.js +24 -0
- package/dist/cjs/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.js.map +1 -0
- package/dist/cjs/components/header/__tests__/__snapshots__/Header.spec.tsx.snap +8 -8
- package/dist/cjs/components/prompt/Prompt.d.ts.map +1 -1
- package/dist/cjs/components/prompt/Prompt.js +2 -1
- package/dist/cjs/components/prompt/Prompt.js.map +1 -1
- package/dist/esm/components/header/Header.d.ts +8 -21
- package/dist/esm/components/header/Header.d.ts.map +1 -1
- package/dist/esm/components/header/Header.js +30 -59
- package/dist/esm/components/header/Header.js.map +1 -1
- package/dist/esm/components/header/Header.styles.d.ts +14 -0
- package/dist/esm/components/header/Header.styles.d.ts.map +1 -0
- package/dist/esm/components/header/Header.styles.js +20 -0
- package/dist/esm/components/header/Header.styles.js.map +1 -0
- package/dist/esm/components/header/HeaderActions/HeaderActions.d.ts +8 -0
- package/dist/esm/components/header/HeaderActions/HeaderActions.d.ts.map +1 -0
- package/dist/esm/components/header/HeaderActions/HeaderActions.js +31 -0
- package/dist/esm/components/header/HeaderActions/HeaderActions.js.map +1 -0
- package/dist/esm/components/header/HeaderActions/HeaderActions.styles.d.ts +10 -0
- package/dist/esm/components/header/HeaderActions/HeaderActions.styles.d.ts.map +1 -0
- package/dist/esm/components/header/HeaderActions/HeaderActions.styles.js +10 -0
- package/dist/esm/components/header/HeaderActions/HeaderActions.styles.js.map +1 -0
- package/dist/esm/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.d.ts +8 -0
- package/dist/esm/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.d.ts.map +1 -0
- package/dist/esm/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.js +30 -0
- package/dist/esm/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.js.map +1 -0
- package/dist/esm/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.d.ts +11 -0
- package/dist/esm/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.d.ts.map +1 -0
- package/dist/esm/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.js +16 -0
- package/dist/esm/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.js.map +1 -0
- package/dist/esm/components/header/HeaderDocAnchor/HeaderDocAnchor.d.ts +22 -0
- package/dist/esm/components/header/HeaderDocAnchor/HeaderDocAnchor.d.ts.map +1 -0
- package/dist/esm/components/header/HeaderDocAnchor/HeaderDocAnchor.js +45 -0
- package/dist/esm/components/header/HeaderDocAnchor/HeaderDocAnchor.js.map +1 -0
- package/dist/esm/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.d.ts +11 -0
- package/dist/esm/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.d.ts.map +1 -0
- package/dist/esm/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.js +14 -0
- package/dist/esm/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.js.map +1 -0
- package/dist/esm/components/header/__tests__/__snapshots__/Header.spec.tsx.snap +8 -8
- package/dist/esm/components/prompt/Prompt.d.ts.map +1 -1
- package/dist/esm/components/prompt/Prompt.js +2 -1
- package/dist/esm/components/prompt/Prompt.js.map +1 -1
- package/package.json +12 -12
- package/src/components/button/__tests__/Button.spec.tsx +7 -5
- package/src/components/header/Header.styles.ts +20 -0
- package/src/components/header/Header.tsx +35 -52
- package/src/components/header/HeaderActions/HeaderActions.styles.ts +7 -0
- package/src/components/header/HeaderActions/HeaderActions.tsx +26 -0
- package/src/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.styles.ts +8 -0
- package/src/components/header/HeaderBreadcrumbs/HeaderBreadcrumbs.tsx +31 -0
- package/src/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.ts +11 -0
- package/src/components/header/HeaderDocAnchor/HeaderDocAnchor.tsx +55 -0
- package/src/components/header/__tests__/Header.spec.tsx +1 -1
- package/src/components/header/__tests__/__snapshots__/Header.spec.tsx.snap +8 -8
- package/src/components/prompt/Prompt.tsx +1 -0
- package/src/components/table/__tests__/Th.spec.tsx +4 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
+
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { QuestionSize16Px } from "@coveord/plasma-react-icons";
|
|
6
|
+
import { Anchor, Tooltip, useComponentDefaultProps } from "@mantine/core";
|
|
7
|
+
import { useStyles } from "./HeaderDocAnchor.styles";
|
|
8
|
+
var defaultProps = {
|
|
9
|
+
position: "right",
|
|
10
|
+
children: /*#__PURE__*/ _jsx(QuestionSize16Px, {
|
|
11
|
+
height: 16
|
|
12
|
+
})
|
|
13
|
+
};
|
|
14
|
+
export var HeaderDocAnchor = function(props) {
|
|
15
|
+
var _useComponentDefaultProps = useComponentDefaultProps("PlasmaHeaderActions", defaultProps, props), classNames = _useComponentDefaultProps.classNames, styles = _useComponentDefaultProps.styles, unstyled = _useComponentDefaultProps.unstyled, className = _useComponentDefaultProps.className, children = _useComponentDefaultProps.children, docLink = _useComponentDefaultProps.href, docLinkTooltipLabel = _useComponentDefaultProps.label, others = _object_without_properties(_useComponentDefaultProps, [
|
|
16
|
+
"classNames",
|
|
17
|
+
"styles",
|
|
18
|
+
"unstyled",
|
|
19
|
+
"className",
|
|
20
|
+
"children",
|
|
21
|
+
"href",
|
|
22
|
+
"label"
|
|
23
|
+
]);
|
|
24
|
+
var _useStyles = useStyles({}, {
|
|
25
|
+
name: "PlasmaHeaderActions",
|
|
26
|
+
classNames: classNames,
|
|
27
|
+
styles: styles,
|
|
28
|
+
unstyled: unstyled
|
|
29
|
+
}), classes = _useStyles.classes, cx = _useStyles.cx;
|
|
30
|
+
return /*#__PURE__*/ _jsx(Tooltip, _object_spread_props(_object_spread({
|
|
31
|
+
className: cx(className, classes.tooltip),
|
|
32
|
+
label: docLinkTooltipLabel,
|
|
33
|
+
disabled: !docLinkTooltipLabel
|
|
34
|
+
}, others), {
|
|
35
|
+
children: /*#__PURE__*/ _jsx(Anchor, {
|
|
36
|
+
className: classes.anchor,
|
|
37
|
+
inline: true,
|
|
38
|
+
href: docLink,
|
|
39
|
+
target: "_blank",
|
|
40
|
+
children: children
|
|
41
|
+
})
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=HeaderDocAnchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/header/HeaderDocAnchor/HeaderDocAnchor.tsx"],"sourcesContent":["import {QuestionSize16Px} from '@coveord/plasma-react-icons';\nimport {Anchor, DefaultProps, Selectors, Tooltip, TooltipProps, useComponentDefaultProps} from '@mantine/core';\nimport {FunctionComponent, ReactNode} from 'react';\nimport {HeaderDocAnchorStylesParams, useStyles} from './HeaderDocAnchor.styles';\n\ntype HeaderDocAnchorStylesNames = Selectors<typeof useStyles>;\n\nconst defaultProps: Partial<HeaderDocAnchorProps> = {\n position: 'right',\n children: <QuestionSize16Px height={16} />,\n};\n\nexport interface HeaderDocAnchorProps\n extends Pick<TooltipProps, 'position'>,\n DefaultProps<HeaderDocAnchorStylesNames, HeaderDocAnchorStylesParams> {\n /**\n * A href pointing to documentation related to the current panel.\n * When provided, an info icon is rendered next to the title as link to this documentation\n */\n href: string;\n /**\n * The tooltip text shown when hovering over the doc link icon\n */\n label?: string;\n /**\n * React component to add the tooltip and anchor on\n */\n children?: ReactNode;\n}\n\nexport const HeaderDocAnchor: FunctionComponent<HeaderDocAnchorProps> = (props: HeaderDocAnchorProps) => {\n const {\n classNames,\n styles,\n unstyled,\n className,\n children,\n href: docLink,\n label: docLinkTooltipLabel,\n ...others\n } = useComponentDefaultProps('PlasmaHeaderActions', defaultProps, props);\n const {classes, cx} = useStyles({}, {name: 'PlasmaHeaderActions', classNames, styles, unstyled});\n return (\n <Tooltip\n className={cx(className, classes.tooltip)}\n label={docLinkTooltipLabel}\n disabled={!docLinkTooltipLabel}\n {...others}\n >\n <Anchor className={classes.anchor} inline href={docLink} target=\"_blank\">\n {children}\n </Anchor>\n </Tooltip>\n );\n};\n"],"names":["QuestionSize16Px","Anchor","Tooltip","useComponentDefaultProps","useStyles","defaultProps","position","children","height","HeaderDocAnchor","props","classNames","styles","unstyled","className","href","docLink","label","docLinkTooltipLabel","others","name","classes","cx","tooltip","disabled","anchor","inline","target"],"mappings":";;;;AAAA,SAAQA,gBAAgB,QAAO,8BAA8B;AAC7D,SAAQC,MAAM,EAA2BC,OAAO,EAAgBC,wBAAwB,QAAO,gBAAgB;AAE/G,SAAqCC,SAAS,QAAO,2BAA2B;AAIhF,IAAMC,eAA8C;IAChDC,UAAU;IACVC,wBAAU,KAACP;QAAiBQ,QAAQ;;AACxC;AAoBA,OAAO,IAAMC,kBAA2D,SAACC;IACrE,IASIP,4BAAAA,yBAAyB,uBAAuBE,cAAcK,QAR9DC,aAQAR,0BARAQ,YACAC,SAOAT,0BAPAS,QACAC,WAMAV,0BANAU,UACAC,YAKAX,0BALAW,WACAP,WAIAJ,0BAJAI,UACAQ,AAAMC,UAGNb,0BAHAY,MACAE,AAAOC,sBAEPf,0BAFAc,OACGE,oCACHhB;QARAQ;QACAC;QACAC;QACAC;QACAP;QACAQ;QACAE;;IAGJ,IAAsBb,aAAAA,UAAU,CAAC,GAAG;QAACgB,MAAM;QAAuBT,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,IAAvFQ,UAAejB,WAAfiB,SAASC,KAAMlB,WAANkB;IAChB,qBACI,KAACpB;QACGY,WAAWQ,GAAGR,WAAWO,QAAQE,OAAO;QACxCN,OAAOC;QACPM,UAAU,CAACN;OACPC;kBAEJ,cAAA,KAAClB;YAAOa,WAAWO,QAAQI,MAAM;YAAEC,MAAM;YAACX,MAAMC;YAASW,QAAO;sBAC3DpB;;;AAIjB,EAAE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface HeaderDocAnchorStylesParams {
|
|
2
|
+
}
|
|
3
|
+
export declare const useStyles: (params: HeaderDocAnchorStylesParams, options?: import("@mantine/core").UseStylesOptions<string>) => {
|
|
4
|
+
classes: {
|
|
5
|
+
tooltip: string;
|
|
6
|
+
anchor: string;
|
|
7
|
+
};
|
|
8
|
+
cx: (...args: any) => string;
|
|
9
|
+
theme: import("@mantine/core").MantineTheme;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=HeaderDocAnchor.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderDocAnchor.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,2BAA2B;CAAG;AAE/C,eAAO,MAAM,SAAS;;;;;;;CAMnB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { _ as _object_destructuring_empty } from "@swc/helpers/_/_object_destructuring_empty";
|
|
2
|
+
import { createStyles } from "@mantine/core";
|
|
3
|
+
export var useStyles = createStyles(function(theme, param) {
|
|
4
|
+
var ref = _object_destructuring_empty(param);
|
|
5
|
+
return {
|
|
6
|
+
tooltip: {},
|
|
7
|
+
anchor: {
|
|
8
|
+
marginLeft: theme.spacing.xs,
|
|
9
|
+
verticalAlign: "middle"
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=HeaderDocAnchor.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/header/HeaderDocAnchor/HeaderDocAnchor.styles.ts"],"sourcesContent":["import {createStyles} from '@mantine/core';\n\nexport interface HeaderDocAnchorStylesParams {}\n\nexport const useStyles = createStyles((theme, {}: HeaderDocAnchorStylesParams) => ({\n tooltip: {},\n anchor: {\n marginLeft: theme.spacing.xs,\n verticalAlign: 'middle',\n },\n}));\n"],"names":["createStyles","useStyles","theme","tooltip","anchor","marginLeft","spacing","xs","verticalAlign"],"mappings":";AAAA,SAAQA,YAAY,QAAO,gBAAgB;AAI3C,OAAO,IAAMC,YAAYD,aAAa,SAACE;QAAO;WAAqC;QAC/EC,SAAS,CAAC;QACVC,QAAQ;YACJC,YAAYH,MAAMI,OAAO,CAACC,EAAE;YAC5BC,eAAe;QACnB;IACJ;GAAI"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`Header > renders the specified breadcrumbs above the title 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="mantine-Group-root mantine-
|
|
6
|
+
class="mantine-Group-root mantine-PlasmaHeader-root mantine-15aa8um"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
9
|
class="mantine-Stack-root mantine-1178y6y"
|
|
@@ -12,38 +12,38 @@ exports[`Header > renders the specified breadcrumbs above the title 1`] = `
|
|
|
12
12
|
class="mantine-Breadcrumbs-root mantine-1ujbd2v"
|
|
13
13
|
>
|
|
14
14
|
<a
|
|
15
|
-
class="mantine-Text-root mantine-Anchor-root mantine-Breadcrumbs-breadcrumb mantine-
|
|
15
|
+
class="mantine-Text-root mantine-Anchor-root mantine-PlasmaHeaderBreadcrumbs-breadcrumb mantine-Breadcrumbs-breadcrumb mantine-1p2lvqc"
|
|
16
16
|
>
|
|
17
17
|
One
|
|
18
18
|
</a>
|
|
19
19
|
<div
|
|
20
|
-
class="mantine-Text-root mantine-Breadcrumbs-separator mantine-
|
|
20
|
+
class="mantine-Text-root mantine-PlasmaHeaderBreadcrumbs-separator mantine-Breadcrumbs-separator mantine-1y8084r"
|
|
21
21
|
>
|
|
22
22
|
/
|
|
23
23
|
</div>
|
|
24
24
|
<a
|
|
25
|
-
class="mantine-Text-root mantine-Anchor-root mantine-Breadcrumbs-breadcrumb mantine-
|
|
25
|
+
class="mantine-Text-root mantine-Anchor-root mantine-PlasmaHeaderBreadcrumbs-breadcrumb mantine-Breadcrumbs-breadcrumb mantine-1p2lvqc"
|
|
26
26
|
>
|
|
27
27
|
Two
|
|
28
28
|
</a>
|
|
29
29
|
<div
|
|
30
|
-
class="mantine-Text-root mantine-Breadcrumbs-separator mantine-
|
|
30
|
+
class="mantine-Text-root mantine-PlasmaHeaderBreadcrumbs-separator mantine-Breadcrumbs-separator mantine-1y8084r"
|
|
31
31
|
>
|
|
32
32
|
/
|
|
33
33
|
</div>
|
|
34
34
|
<a
|
|
35
|
-
class="mantine-Text-root mantine-Anchor-root mantine-Breadcrumbs-breadcrumb mantine-
|
|
35
|
+
class="mantine-Text-root mantine-Anchor-root mantine-PlasmaHeaderBreadcrumbs-breadcrumb mantine-Breadcrumbs-breadcrumb mantine-1p2lvqc"
|
|
36
36
|
>
|
|
37
37
|
Three
|
|
38
38
|
</a>
|
|
39
39
|
</div>
|
|
40
40
|
<h1
|
|
41
|
-
class="mantine-Text-root mantine-Title-root mantine-
|
|
41
|
+
class="mantine-Text-root mantine-Title-root mantine-PlasmaHeader-title mantine-1o7jx33"
|
|
42
42
|
>
|
|
43
43
|
Title
|
|
44
44
|
</h1>
|
|
45
45
|
<div
|
|
46
|
-
class="mantine-Text-root mantine-
|
|
46
|
+
class="mantine-Text-root mantine-PlasmaHeader-description mantine-52dv7d"
|
|
47
47
|
/>
|
|
48
48
|
</div>
|
|
49
49
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/components/prompt/Prompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAW,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/components/prompt/Prompt.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAW,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AA+B5C,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;IACtD,QAAQ,EAAE,SAAS,CAAC;CACvB;AACD,UAAU,UAAU;IAChB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;IACnC,MAAM,EAAE,OAAO,YAAY,CAAC;CAC/B;AAED,eAAO,MAAM,MAAM,EAAE,UAqBpB,CAAC"}
|
|
@@ -23,7 +23,8 @@ var useStyles = createStyles(function(theme) {
|
|
|
23
23
|
width: "100%",
|
|
24
24
|
borderBottom: "1px solid ".concat(theme.colors.gray[3]),
|
|
25
25
|
fontSize: theme.headings.sizes.h3.fontSize,
|
|
26
|
-
lineHeight: theme.headings.sizes.h3.lineHeight
|
|
26
|
+
lineHeight: theme.headings.sizes.h3.lineHeight,
|
|
27
|
+
overflowWrap: "anywhere"
|
|
27
28
|
},
|
|
28
29
|
success: {
|
|
29
30
|
backgroundColor: theme.colors.lime[6],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => ({\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md} ${theme.spacing.xl} ${theme.spacing.lg}`,\n },\n header: {\n padding: `${theme.spacing.md} ${theme.spacing.xl}`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n },\n success: {backgroundColor: theme.colors.lime[6], color: color.primary.pureWhite},\n warning: {backgroundColor: theme.colors.yellow[5], color: color.primary.pureWhite},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: color.primary.pureWhite,\n },\n info: {backgroundColor: theme.colors.navy[5], color: color.primary.pureWhite},\n whiteClose: {color: color.primary.pureWhite, '&:hover': {backgroundColor: 'transparent'}},\n title: {\n color: color.primary.pureWhite,\n },\n}));\n\nexport interface PromptProps extends ModalProps {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {\n const {classes, cx} = useStyles();\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: classes.whiteClose,\n body: classes.body,\n modal: classes.modalType,\n title: classes.title,\n };\n\n return (\n <Modal variant=\"prompt\" padding={0} classNames={classNames} size={'sm'} {...otherProps}>\n <div className={classes.innerBody}>{otherChildren}</div>\n {footer}\n </Modal>\n );\n};\n\nPrompt.Footer = PromptFooter;\n"],"names":["color","createStyles","Modal","Children","PromptFooter","useStyles","theme","body","padding","modalType","overflow","width","innerBody","spacing","md","xl","lg","header","borderBottom","colors","gray","fontSize","headings","sizes","h3","lineHeight","success","backgroundColor","lime","primary","pureWhite","warning","yellow","critical","red","info","navy","whiteClose","title","Prompt","children","variant","otherProps","classes","cx","convertedChildren","toArray","otherChildren","filter","child","type","footer","find","classNames","close","modal","size","div","className","Footer"],"mappings":";;;;AAAA,SAAQA,KAAK,QAAO,yBAAyB;AAC7C,SAAQC,YAAY,EAAEC,KAAK,QAAmB,gBAAgB;AAC9D,SAAQC,QAAQ,QAAgC,QAAQ;AACxD,SAAQC,YAAY,QAAO,iBAAiB;AAE5C,IAAMC,YAAYJ,aAAa,SAACK;WAAW;QACvCC,MAAM;YACFC,SAAS;QACb;QACAC,WAAW;YAACC,UAAU;YAAUC,OAAO;QAAG;QAC1CC,WAAW;YACPJ,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAuBR,OAApBA,MAAMO,OAAO,CAACE,EAAE,EAAC,KAAoB,OAAjBT,MAAMO,OAAO,CAACG,EAAE;QACxE;QACAC,QAAQ;YACJT,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAoB,OAAjBR,MAAMO,OAAO,CAACE,EAAE;YAChDJ,OAAO;YACPO,cAAc,AAAC,aAAiC,OAArBZ,MAAMa,MAAM,CAACC,IAAI,CAAC,EAAE;YAC/CC,UAAUf,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACH,QAAQ;YAC1CI,YAAYnB,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACC,UAAU;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => ({\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md} ${theme.spacing.xl} ${theme.spacing.lg}`,\n },\n header: {\n padding: `${theme.spacing.md} ${theme.spacing.xl}`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n overflowWrap: 'anywhere',\n },\n success: {backgroundColor: theme.colors.lime[6], color: color.primary.pureWhite},\n warning: {backgroundColor: theme.colors.yellow[5], color: color.primary.pureWhite},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: color.primary.pureWhite,\n },\n info: {backgroundColor: theme.colors.navy[5], color: color.primary.pureWhite},\n whiteClose: {color: color.primary.pureWhite, '&:hover': {backgroundColor: 'transparent'}},\n title: {\n color: color.primary.pureWhite,\n },\n}));\n\nexport interface PromptProps extends ModalProps {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {\n const {classes, cx} = useStyles();\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: classes.whiteClose,\n body: classes.body,\n modal: classes.modalType,\n title: classes.title,\n };\n\n return (\n <Modal variant=\"prompt\" padding={0} classNames={classNames} size={'sm'} {...otherProps}>\n <div className={classes.innerBody}>{otherChildren}</div>\n {footer}\n </Modal>\n );\n};\n\nPrompt.Footer = PromptFooter;\n"],"names":["color","createStyles","Modal","Children","PromptFooter","useStyles","theme","body","padding","modalType","overflow","width","innerBody","spacing","md","xl","lg","header","borderBottom","colors","gray","fontSize","headings","sizes","h3","lineHeight","overflowWrap","success","backgroundColor","lime","primary","pureWhite","warning","yellow","critical","red","info","navy","whiteClose","title","Prompt","children","variant","otherProps","classes","cx","convertedChildren","toArray","otherChildren","filter","child","type","footer","find","classNames","close","modal","size","div","className","Footer"],"mappings":";;;;AAAA,SAAQA,KAAK,QAAO,yBAAyB;AAC7C,SAAQC,YAAY,EAAEC,KAAK,QAAmB,gBAAgB;AAC9D,SAAQC,QAAQ,QAAgC,QAAQ;AACxD,SAAQC,YAAY,QAAO,iBAAiB;AAE5C,IAAMC,YAAYJ,aAAa,SAACK;WAAW;QACvCC,MAAM;YACFC,SAAS;QACb;QACAC,WAAW;YAACC,UAAU;YAAUC,OAAO;QAAG;QAC1CC,WAAW;YACPJ,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAuBR,OAApBA,MAAMO,OAAO,CAACE,EAAE,EAAC,KAAoB,OAAjBT,MAAMO,OAAO,CAACG,EAAE;QACxE;QACAC,QAAQ;YACJT,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAoB,OAAjBR,MAAMO,OAAO,CAACE,EAAE;YAChDJ,OAAO;YACPO,cAAc,AAAC,aAAiC,OAArBZ,MAAMa,MAAM,CAACC,IAAI,CAAC,EAAE;YAC/CC,UAAUf,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACH,QAAQ;YAC1CI,YAAYnB,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACC,UAAU;YAC9CC,cAAc;QAClB;QACAC,SAAS;YAACC,iBAAiBtB,MAAMa,MAAM,CAACU,IAAI,CAAC,EAAE;YAAE7B,OAAOA,MAAM8B,OAAO,CAACC,SAAS;QAAA;QAC/EC,SAAS;YAACJ,iBAAiBtB,MAAMa,MAAM,CAACc,MAAM,CAAC,EAAE;YAAEjC,OAAOA,MAAM8B,OAAO,CAACC,SAAS;QAAA;QACjFG,UAAU;YACNN,iBAAiBtB,MAAMa,MAAM,CAACgB,GAAG,CAAC,EAAE;YACpCnC,OAAOA,MAAM8B,OAAO,CAACC,SAAS;QAClC;QACAK,MAAM;YAACR,iBAAiBtB,MAAMa,MAAM,CAACkB,IAAI,CAAC,EAAE;YAAErC,OAAOA,MAAM8B,OAAO,CAACC,SAAS;QAAA;QAC5EO,YAAY;YAACtC,OAAOA,MAAM8B,OAAO,CAACC,SAAS;YAAE,WAAW;gBAACH,iBAAiB;YAAa;QAAC;QACxFW,OAAO;YACHvC,OAAOA,MAAM8B,OAAO,CAACC,SAAS;QAClC;IACJ;;AAgBA,OAAO,IAAMS,SAAqB;QAAEC,kBAAAA,kCAAUC,SAAAA,sCAAU,yBAAWC;QAA/BF;QAAUC;;IAC1C,IAAsBrC,aAAAA,aAAfuC,UAAevC,WAAfuC,SAASC,KAAMxC,WAANwC;IAChB,IAAMC,oBAAoB3C,SAAS4C,OAAO,CAACN;IAE3C,IAAMO,gBAAgBF,kBAAkBG,MAAM,CAAC,SAACC;eAAUA,MAAMC,IAAI,KAAK/C;;IACzE,IAAMgD,SAASN,kBAAkBO,IAAI,CAAC,SAACH;eAAUA,MAAMC,IAAI,KAAK/C;;IAEhE,IAAMkD,aAAa;QACfrC,QAAQ4B,GAAGD,QAAQ3B,MAAM,EAAE2B,OAAO,CAACF,QAAQ;QAC3Ca,OAAOX,QAAQN,UAAU;QACzB/B,MAAMqC,QAAQrC,IAAI;QAClBiD,OAAOZ,QAAQnC,SAAS;QACxB8B,OAAOK,QAAQL,KAAK;IACxB;IAEA,qBACI,MAACrC;QAAMwC,SAAQ;QAASlC,SAAS;QAAG8C,YAAYA;QAAYG,MAAM;OAAUd;;0BACxE,KAACe;gBAAIC,WAAWf,QAAQhC,SAAS;0BAAGoC;;YACnCI;;;AAGb,EAAE;AAEFZ,OAAOoB,MAAM,GAAGxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coveord/plasma-mantine",
|
|
3
|
-
"version": "52.
|
|
3
|
+
"version": "52.16.0",
|
|
4
4
|
"description": "A Plasma flavoured Mantine theme",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plasma",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"lodash.debounce": "4.0.8",
|
|
42
42
|
"lodash.defaultsdeep": "4.6.1",
|
|
43
43
|
"monaco-editor": "0.41.0",
|
|
44
|
-
"@coveord/plasma-react-icons": "52.
|
|
45
|
-
"@coveord/plasma-tokens": "52.
|
|
44
|
+
"@coveord/plasma-react-icons": "52.16.0",
|
|
45
|
+
"@coveord/plasma-tokens": "52.16.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@emotion/react": "11.11.1",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@mantine/modals": "6.0.19",
|
|
55
55
|
"@mantine/notifications": "6.0.19",
|
|
56
56
|
"@swc/cli": "0.1.62",
|
|
57
|
-
"@swc/core": "1.3.
|
|
57
|
+
"@swc/core": "1.3.78",
|
|
58
58
|
"@swc/jest": "0.2.29",
|
|
59
|
-
"@testing-library/jest-dom": "6.0.
|
|
59
|
+
"@testing-library/jest-dom": "6.0.1",
|
|
60
60
|
"@testing-library/react": "14.0.0",
|
|
61
61
|
"@testing-library/user-event": "14.4.3",
|
|
62
62
|
"@types/jest": "29.5.3",
|
|
@@ -67,22 +67,22 @@
|
|
|
67
67
|
"@types/testing-library__jest-dom": "5.14.9",
|
|
68
68
|
"csstype": "3.1.2",
|
|
69
69
|
"embla-carousel-react": "7.1.0",
|
|
70
|
-
"eslint-plugin-testing-library": "
|
|
70
|
+
"eslint-plugin-testing-library": "6.0.0",
|
|
71
71
|
"eslint-plugin-vitest": "0.2.8",
|
|
72
72
|
"eslint-plugin-vitest-globals": "1.4.0",
|
|
73
73
|
"identity-obj-proxy": "3.0.0",
|
|
74
|
-
"jest": "29.6.
|
|
75
|
-
"jest-environment-jsdom": "29.6.
|
|
74
|
+
"jest": "29.6.3",
|
|
75
|
+
"jest-environment-jsdom": "29.6.3",
|
|
76
76
|
"jest-junit": "16.0.0",
|
|
77
77
|
"npm-run-all": "4.1.5",
|
|
78
|
-
"publint": "0.2.
|
|
78
|
+
"publint": "0.2.2",
|
|
79
79
|
"react": "18.2.0",
|
|
80
80
|
"react-dom": "18.2.0",
|
|
81
81
|
"rimraf": "5.0.1",
|
|
82
|
-
"tslib": "2.6.
|
|
82
|
+
"tslib": "2.6.2",
|
|
83
83
|
"typescript": "5.1.6",
|
|
84
|
-
"vitest": "0.34.
|
|
85
|
-
"eslint-config-plasma": "52.
|
|
84
|
+
"vitest": "0.34.2",
|
|
85
|
+
"eslint-config-plasma": "52.16.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@emotion/react": "^11.10.0",
|
|
@@ -20,11 +20,12 @@ describe('Button', () => {
|
|
|
20
20
|
);
|
|
21
21
|
expect(within(screen.getByRole('button', {name: /I am loading/i})).getByRole('presentation')).toBeVisible();
|
|
22
22
|
expect(
|
|
23
|
-
within(screen.
|
|
23
|
+
within(screen.getByRole('button', {name: /I am not loading/i})).queryByRole('presentation'),
|
|
24
24
|
).not.toBeInTheDocument();
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it('shows a loader while the promise is waiting to be resolved', async () => {
|
|
28
|
+
const user = userEvent.setup();
|
|
28
29
|
let resolve: () => void;
|
|
29
30
|
let isResolved = false;
|
|
30
31
|
|
|
@@ -37,7 +38,7 @@ describe('Button', () => {
|
|
|
37
38
|
|
|
38
39
|
render(<Button onClick={promise}>promise handler</Button>);
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
await user.click(screen.getByRole('button', {name: /promise handler/i}));
|
|
41
42
|
|
|
42
43
|
expect(
|
|
43
44
|
await within(screen.getByRole('button', {name: /promise handler/i})).findByRole('presentation'),
|
|
@@ -50,11 +51,12 @@ describe('Button', () => {
|
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
expect(
|
|
53
|
-
within(screen.
|
|
54
|
+
within(screen.getByRole('button', {name: /promise handler/i})).queryByRole('presentation'),
|
|
54
55
|
).not.toBeInTheDocument();
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
it('removes the loading if a promise is rejected', async () => {
|
|
59
|
+
const user = userEvent.setup();
|
|
58
60
|
let reject: () => void;
|
|
59
61
|
let isRejected = false;
|
|
60
62
|
|
|
@@ -67,7 +69,7 @@ describe('Button', () => {
|
|
|
67
69
|
|
|
68
70
|
render(<Button onClick={promise}>promise handler</Button>);
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
await user.click(screen.getByRole('button', {name: /promise handler/i}));
|
|
71
73
|
|
|
72
74
|
expect(
|
|
73
75
|
await within(screen.getByRole('button', {name: /promise handler/i})).findByRole('presentation'),
|
|
@@ -80,7 +82,7 @@ describe('Button', () => {
|
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
expect(
|
|
83
|
-
within(screen.
|
|
85
|
+
within(screen.getByRole('button', {name: /promise handler/i})).queryByRole('presentation'),
|
|
84
86
|
).not.toBeInTheDocument();
|
|
85
87
|
});
|
|
86
88
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {createStyles} from '@mantine/core';
|
|
2
|
+
|
|
3
|
+
export interface HeaderStylesParams {
|
|
4
|
+
variant?: 'page' | 'modal';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const useStyles = createStyles((theme, {variant}: HeaderStylesParams) => ({
|
|
8
|
+
root: {
|
|
9
|
+
padding: variant === 'page' ? theme.spacing.xl : undefined,
|
|
10
|
+
paddingBottom: variant === 'page' ? theme.spacing.lg : undefined,
|
|
11
|
+
},
|
|
12
|
+
title: {
|
|
13
|
+
wordBreak: 'break-word',
|
|
14
|
+
color: variant === 'page' ? theme.colors.gray[5] : undefined,
|
|
15
|
+
},
|
|
16
|
+
description: {
|
|
17
|
+
color: theme.colors.gray[6],
|
|
18
|
+
},
|
|
19
|
+
divider: {},
|
|
20
|
+
}));
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
DefaultProps,
|
|
3
|
+
Divider,
|
|
4
|
+
Group,
|
|
5
|
+
GroupProps,
|
|
6
|
+
Selectors,
|
|
7
|
+
Stack,
|
|
8
|
+
Text,
|
|
9
|
+
Title,
|
|
10
|
+
useComponentDefaultProps,
|
|
11
|
+
} from '@mantine/core';
|
|
12
|
+
import {Children, ReactElement, ReactNode} from 'react';
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
import {HeaderStylesParams, useStyles} from './Header.styles';
|
|
15
|
+
import {HeaderActions} from './HeaderActions/HeaderActions';
|
|
16
|
+
import {HeaderBreadcrumbs} from './HeaderBreadcrumbs/HeaderBreadcrumbs';
|
|
17
|
+
import {HeaderDocAnchor} from './HeaderDocAnchor/HeaderDocAnchor';
|
|
18
|
+
|
|
19
|
+
type HeaderStylesNames = Selectors<typeof useStyles>;
|
|
20
|
+
|
|
21
|
+
export interface HeaderProps extends Omit<GroupProps, 'styles'>, DefaultProps<HeaderStylesNames, HeaderStylesParams> {
|
|
6
22
|
/**
|
|
7
23
|
* The description text displayed inside the header underneath the title
|
|
8
24
|
*/
|
|
@@ -30,7 +46,17 @@ interface HeaderType {
|
|
|
30
46
|
DocAnchor: typeof HeaderDocAnchor;
|
|
31
47
|
}
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
const defaultProps: Partial<HeaderProps> = {
|
|
50
|
+
variant: 'page',
|
|
51
|
+
position: 'apart',
|
|
52
|
+
noWrap: true,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Header: HeaderType = (props: HeaderProps) => {
|
|
56
|
+
const {classNames, styles, unstyled, className, description, borderBottom, variant, children, ...others} =
|
|
57
|
+
useComponentDefaultProps('PlasmaHeader', defaultProps, props);
|
|
58
|
+
const {classes, cx} = useStyles({variant}, {name: 'PlasmaHeader', classNames, styles, unstyled});
|
|
59
|
+
|
|
34
60
|
const convertedChildren = Children.toArray(children) as ReactElement[];
|
|
35
61
|
const breadcrumbs = convertedChildren.find((child) => child.type === HeaderBreadcrumbs);
|
|
36
62
|
const actions = convertedChildren.find((child) => child.type === HeaderActions);
|
|
@@ -40,67 +66,24 @@ export const Header: HeaderType = ({description, borderBottom, children, variant
|
|
|
40
66
|
);
|
|
41
67
|
return (
|
|
42
68
|
<>
|
|
43
|
-
<Group
|
|
44
|
-
position="apart"
|
|
45
|
-
p={variant === 'page' ? 'xl' : undefined}
|
|
46
|
-
pb={variant === 'page' ? 'lg' : undefined}
|
|
47
|
-
noWrap
|
|
48
|
-
{...others}
|
|
49
|
-
>
|
|
69
|
+
<Group className={cx(className, classes.root)} {...others}>
|
|
50
70
|
<Stack spacing={0}>
|
|
51
71
|
{breadcrumbs}
|
|
52
|
-
<Title
|
|
53
|
-
order={variant === 'page' ? 1 : 3}
|
|
54
|
-
color={variant === 'page' ? 'gray.5' : undefined}
|
|
55
|
-
sx={{wordBreak: 'break-word'}}
|
|
56
|
-
>
|
|
72
|
+
<Title order={variant === 'page' ? 1 : 3} className={classes.title}>
|
|
57
73
|
{otherChildren}
|
|
58
74
|
{docAnchor}
|
|
59
75
|
</Title>
|
|
60
|
-
<Text size={variant === 'page' ? 'md' : 'sm'}
|
|
76
|
+
<Text className={classes.description} size={variant === 'page' ? 'md' : 'sm'}>
|
|
61
77
|
{description}
|
|
62
78
|
</Text>
|
|
63
79
|
</Stack>
|
|
64
80
|
{actions}
|
|
65
81
|
</Group>
|
|
66
|
-
{borderBottom ? <Divider size="xs" /> : null}
|
|
82
|
+
{borderBottom ? <Divider className={classes.divider} size="xs" /> : null}
|
|
67
83
|
</>
|
|
68
84
|
);
|
|
69
85
|
};
|
|
70
86
|
|
|
71
|
-
const HeaderBreadcrumbs: FunctionComponent<{children: ReactNode}> = ({children}) => (
|
|
72
|
-
<Breadcrumbs
|
|
73
|
-
styles={(theme) => ({
|
|
74
|
-
breadcrumb: {fontSize: theme.fontSizes.sm, fontWeight: 300},
|
|
75
|
-
separator: {color: theme.colors.gray[5]},
|
|
76
|
-
})}
|
|
77
|
-
>
|
|
78
|
-
{children}
|
|
79
|
-
</Breadcrumbs>
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const HeaderActions: FunctionComponent<{children: ReactNode}> = ({children}) => <Group spacing="sm">{children}</Group>;
|
|
83
|
-
|
|
84
|
-
export interface HeaderDocAnchorProps {
|
|
85
|
-
/**
|
|
86
|
-
* A href pointing to documentation related to the current panel.
|
|
87
|
-
* When provided, an info icon is rendered next to the title as link to this documentation
|
|
88
|
-
*/
|
|
89
|
-
href: string;
|
|
90
|
-
/**
|
|
91
|
-
* The tooltip text shown when hovering over the doc link icon
|
|
92
|
-
*/
|
|
93
|
-
label?: string;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const HeaderDocAnchor: FunctionComponent<HeaderDocAnchorProps> = ({href: docLink, label: docLinkTooltipLabel}) => (
|
|
97
|
-
<Tooltip label={docLinkTooltipLabel} disabled={!docLinkTooltipLabel} position="right">
|
|
98
|
-
<Anchor inline href={docLink} target="_blank" ml="xs" style={{verticalAlign: 'middle'}}>
|
|
99
|
-
<QuestionSize16Px height={16} />
|
|
100
|
-
</Anchor>
|
|
101
|
-
</Tooltip>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
87
|
Header.Breadcrumbs = HeaderBreadcrumbs;
|
|
105
88
|
Header.Actions = HeaderActions;
|
|
106
89
|
Header.DocAnchor = HeaderDocAnchor;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {DefaultProps, Group, GroupProps, Selectors, useComponentDefaultProps} from '@mantine/core';
|
|
2
|
+
import {FunctionComponent} from 'react';
|
|
3
|
+
import {HeaderActionsStylesParams, useStyles} from './HeaderActions.styles';
|
|
4
|
+
|
|
5
|
+
type HeaderActionsStylesNames = Selectors<typeof useStyles>;
|
|
6
|
+
|
|
7
|
+
export type HeaderActionsProps = GroupProps & DefaultProps<HeaderActionsStylesNames, HeaderActionsStylesParams>;
|
|
8
|
+
|
|
9
|
+
const defaultProps: Partial<HeaderActionsProps> = {
|
|
10
|
+
spacing: 'sm',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const HeaderActions: FunctionComponent<HeaderActionsProps> = (props: HeaderActionsProps) => {
|
|
14
|
+
const {classNames, styles, unstyled, className, children, ...others} = useComponentDefaultProps(
|
|
15
|
+
'PlasmaHeaderActions',
|
|
16
|
+
defaultProps,
|
|
17
|
+
props,
|
|
18
|
+
);
|
|
19
|
+
const {classes, cx} = useStyles({}, {name: 'PlasmaHeaderActions', classNames, styles, unstyled});
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Group className={cx(className, classes.root)} {...others}>
|
|
23
|
+
{children}
|
|
24
|
+
</Group>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {createStyles} from '@mantine/core';
|
|
2
|
+
|
|
3
|
+
export interface HeaderBreadcrumbsStylesParams {}
|
|
4
|
+
|
|
5
|
+
export const useStyles = createStyles((theme, {}: HeaderBreadcrumbsStylesParams) => ({
|
|
6
|
+
breadcrumb: {fontSize: theme.fontSizes.sm, fontWeight: 300},
|
|
7
|
+
separator: {color: theme.colors.gray[5]},
|
|
8
|
+
}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {Breadcrumbs, BreadcrumbsProps, DefaultProps, Selectors} from '@mantine/core';
|
|
2
|
+
import {FunctionComponent} from 'react';
|
|
3
|
+
import {HeaderBreadcrumbsStylesParams, useStyles} from './HeaderBreadcrumbs.styles';
|
|
4
|
+
|
|
5
|
+
type HeaderBreadcrumbsStylesNames = Selectors<typeof useStyles>;
|
|
6
|
+
|
|
7
|
+
export type HeaderBreadcrumbsProps = BreadcrumbsProps &
|
|
8
|
+
DefaultProps<HeaderBreadcrumbsStylesNames, HeaderBreadcrumbsStylesParams>;
|
|
9
|
+
|
|
10
|
+
export const HeaderBreadcrumbs: FunctionComponent<HeaderBreadcrumbsProps> = ({
|
|
11
|
+
classNames,
|
|
12
|
+
styles,
|
|
13
|
+
unstyled,
|
|
14
|
+
children,
|
|
15
|
+
...others
|
|
16
|
+
}) => {
|
|
17
|
+
const {classes} = useStyles(
|
|
18
|
+
{},
|
|
19
|
+
{
|
|
20
|
+
name: 'PlasmaHeaderBreadcrumbs',
|
|
21
|
+
classNames,
|
|
22
|
+
styles,
|
|
23
|
+
unstyled,
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
return (
|
|
27
|
+
<Breadcrumbs classNames={{breadcrumb: classes.breadcrumb, separator: classes.separator}} {...others}>
|
|
28
|
+
{children}
|
|
29
|
+
</Breadcrumbs>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {createStyles} from '@mantine/core';
|
|
2
|
+
|
|
3
|
+
export interface HeaderDocAnchorStylesParams {}
|
|
4
|
+
|
|
5
|
+
export const useStyles = createStyles((theme, {}: HeaderDocAnchorStylesParams) => ({
|
|
6
|
+
tooltip: {},
|
|
7
|
+
anchor: {
|
|
8
|
+
marginLeft: theme.spacing.xs,
|
|
9
|
+
verticalAlign: 'middle',
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {QuestionSize16Px} from '@coveord/plasma-react-icons';
|
|
2
|
+
import {Anchor, DefaultProps, Selectors, Tooltip, TooltipProps, useComponentDefaultProps} from '@mantine/core';
|
|
3
|
+
import {FunctionComponent, ReactNode} from 'react';
|
|
4
|
+
import {HeaderDocAnchorStylesParams, useStyles} from './HeaderDocAnchor.styles';
|
|
5
|
+
|
|
6
|
+
type HeaderDocAnchorStylesNames = Selectors<typeof useStyles>;
|
|
7
|
+
|
|
8
|
+
const defaultProps: Partial<HeaderDocAnchorProps> = {
|
|
9
|
+
position: 'right',
|
|
10
|
+
children: <QuestionSize16Px height={16} />,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface HeaderDocAnchorProps
|
|
14
|
+
extends Pick<TooltipProps, 'position'>,
|
|
15
|
+
DefaultProps<HeaderDocAnchorStylesNames, HeaderDocAnchorStylesParams> {
|
|
16
|
+
/**
|
|
17
|
+
* A href pointing to documentation related to the current panel.
|
|
18
|
+
* When provided, an info icon is rendered next to the title as link to this documentation
|
|
19
|
+
*/
|
|
20
|
+
href: string;
|
|
21
|
+
/**
|
|
22
|
+
* The tooltip text shown when hovering over the doc link icon
|
|
23
|
+
*/
|
|
24
|
+
label?: string;
|
|
25
|
+
/**
|
|
26
|
+
* React component to add the tooltip and anchor on
|
|
27
|
+
*/
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const HeaderDocAnchor: FunctionComponent<HeaderDocAnchorProps> = (props: HeaderDocAnchorProps) => {
|
|
32
|
+
const {
|
|
33
|
+
classNames,
|
|
34
|
+
styles,
|
|
35
|
+
unstyled,
|
|
36
|
+
className,
|
|
37
|
+
children,
|
|
38
|
+
href: docLink,
|
|
39
|
+
label: docLinkTooltipLabel,
|
|
40
|
+
...others
|
|
41
|
+
} = useComponentDefaultProps('PlasmaHeaderActions', defaultProps, props);
|
|
42
|
+
const {classes, cx} = useStyles({}, {name: 'PlasmaHeaderActions', classNames, styles, unstyled});
|
|
43
|
+
return (
|
|
44
|
+
<Tooltip
|
|
45
|
+
className={cx(className, classes.tooltip)}
|
|
46
|
+
label={docLinkTooltipLabel}
|
|
47
|
+
disabled={!docLinkTooltipLabel}
|
|
48
|
+
{...others}
|
|
49
|
+
>
|
|
50
|
+
<Anchor className={classes.anchor} inline href={docLink} target="_blank">
|
|
51
|
+
{children}
|
|
52
|
+
</Anchor>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -10,7 +10,7 @@ describe('Header', () => {
|
|
|
10
10
|
const header = screen.getByRole('heading');
|
|
11
11
|
expect(header).toMatchInlineSnapshot(`
|
|
12
12
|
<h1
|
|
13
|
-
class="mantine-Text-root mantine-Title-root mantine-
|
|
13
|
+
class="mantine-Text-root mantine-Title-root mantine-PlasmaHeader-title mantine-1o7jx33"
|
|
14
14
|
>
|
|
15
15
|
child
|
|
16
16
|
</h1>
|