@coveord/plasma-mantine 52.26.6 → 52.27.1
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 +35 -34
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/table/Table.d.ts.map +1 -1
- package/dist/cjs/components/table/Table.js +7 -3
- package/dist/cjs/components/table/Table.js.map +1 -1
- package/dist/cjs/components/table/Table.styles.d.ts +1 -0
- package/dist/cjs/components/table/Table.styles.d.ts.map +1 -1
- package/dist/cjs/components/table/Table.styles.js +6 -5
- package/dist/cjs/components/table/Table.styles.js.map +1 -1
- package/dist/cjs/components/table/Table.types.d.ts +8 -2
- package/dist/cjs/components/table/Table.types.d.ts.map +1 -1
- package/dist/cjs/components/table/layouts/RowLayout.js +2 -1
- package/dist/cjs/components/table/layouts/RowLayout.js.map +1 -1
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.d.ts +4 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.d.ts.map +1 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.js +99 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.js.map +1 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.styles.d.ts +10 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.styles.d.ts.map +1 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.styles.js +23 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.styles.js.map +1 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.types.d.ts +46 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.types.d.ts.map +1 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.types.js +6 -0
- package/dist/cjs/components/table/table-columns-selector/TableColumnsSelector.types.js.map +1 -0
- package/dist/cjs/theme/Theme.d.ts.map +1 -1
- package/dist/cjs/theme/Theme.js +10 -0
- package/dist/cjs/theme/Theme.js.map +1 -1
- package/dist/esm/components/table/Table.d.ts.map +1 -1
- package/dist/esm/components/table/Table.js +6 -2
- package/dist/esm/components/table/Table.js.map +1 -1
- package/dist/esm/components/table/Table.styles.d.ts +1 -0
- package/dist/esm/components/table/Table.styles.d.ts.map +1 -1
- package/dist/esm/components/table/Table.styles.js +6 -5
- package/dist/esm/components/table/Table.styles.js.map +1 -1
- package/dist/esm/components/table/Table.types.d.ts +8 -2
- package/dist/esm/components/table/Table.types.d.ts.map +1 -1
- package/dist/esm/components/table/Table.types.js.map +1 -1
- package/dist/esm/components/table/layouts/RowLayout.js +1 -1
- package/dist/esm/components/table/layouts/RowLayout.js.map +1 -1
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.d.ts +4 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.d.ts.map +1 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.js +84 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.js.map +1 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.styles.d.ts +10 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.styles.d.ts.map +1 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.styles.js +11 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.styles.js.map +1 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.types.d.ts +46 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.types.d.ts.map +1 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.types.js +3 -0
- package/dist/esm/components/table/table-columns-selector/TableColumnsSelector.types.js.map +1 -0
- package/dist/esm/theme/Theme.d.ts.map +1 -1
- package/dist/esm/theme/Theme.js +8 -0
- package/dist/esm/theme/Theme.js.map +1 -1
- package/package.json +3 -3
- package/src/components/table/Table.styles.ts +6 -5
- package/src/components/table/Table.tsx +6 -1
- package/src/components/table/Table.types.ts +8 -1
- package/src/components/table/__tests__/TableColumnsSelector.spec.tsx +260 -0
- package/src/components/table/layouts/RowLayout.tsx +1 -1
- package/src/components/table/table-columns-selector/TableColumnsSelector.styles.ts +8 -0
- package/src/components/table/table-columns-selector/TableColumnsSelector.tsx +78 -0
- package/src/components/table/table-columns-selector/TableColumnsSelector.types.ts +46 -0
- package/src/theme/Theme.tsx +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.tsx"],"sourcesContent":["import {Button, Checkbox, Divider, Grid, Popover, ScrollArea, Stack, Tooltip} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {TableComponentsOrder} from '../Table.styles';\nimport {useTable} from '../TableContext';\nimport useStyles from './TableColumnsSelector.styles';\nimport {TableColumnsSelectorProps} from './TableColumnsSelector.types';\n\nconst COLUMNS_IDS_TO_EXCLUDE = ['collapsible', 'select'];\n\nexport const TableColumnsSelector: FunctionComponent<TableColumnsSelectorProps> = ({\n classNames,\n styles,\n unstyled,\n label = 'Edit columns',\n buttonVariant = 'outline',\n showVisibleCountLabel = false,\n nonHideableColumns = [],\n maxSelectableColumns,\n footer,\n limitReachedTooltip = 'You have reached the maximum display limit.',\n columnNames,\n}) => {\n const {classes} = useStyles(null, {name: 'TableColumnsSelector', classNames, styles, unstyled});\n const {getAllColumns} = useTable();\n\n const columnsToExclude = [...nonHideableColumns, ...COLUMNS_IDS_TO_EXCLUDE];\n\n const filteredColumns = getAllColumns().filter((column) => !columnsToExclude.includes(column.id));\n\n const selectedColumnsCount = filteredColumns.filter((column) => column.getIsVisible()).length;\n\n if (filteredColumns.length <= 0) {\n return null;\n }\n\n return (\n <Grid.Col span=\"content\" order={TableComponentsOrder.ColumnsSelector} py=\"sm\" className={classes.root}>\n <Popover withinPortal position=\"bottom\" shadow=\"md\">\n <Popover.Target>\n <Button variant={buttonVariant}>{`${label}${\n showVisibleCountLabel ? ` (${selectedColumnsCount})` : ''\n }`}</Button>\n </Popover.Target>\n <Popover.Dropdown miw={240}>\n <ScrollArea.Autosize mah={154}>\n <Stack>\n {filteredColumns.map((column) => {\n const isDisabled =\n selectedColumnsCount >= maxSelectableColumns && !column.getIsVisible();\n return (\n <Tooltip label={limitReachedTooltip} disabled={!isDisabled} position=\"left\">\n <div>\n <Checkbox\n key={column.id}\n label={columnNames?.[column.id] || column.id}\n name={column.id}\n checked={column.getIsVisible()}\n disabled={isDisabled}\n onChange={column.getToggleVisibilityHandler()}\n />\n </div>\n </Tooltip>\n );\n })}\n </Stack>\n </ScrollArea.Autosize>\n {maxSelectableColumns && (\n <>\n <Divider mb=\"xs\" mt=\"sm\" />\n {footer}\n </>\n )}\n </Popover.Dropdown>\n </Popover>\n </Grid.Col>\n );\n};\n"],"names":["Button","Checkbox","Divider","Grid","Popover","ScrollArea","Stack","Tooltip","TableComponentsOrder","useTable","useStyles","COLUMNS_IDS_TO_EXCLUDE","TableColumnsSelector","classNames","styles","unstyled","label","buttonVariant","showVisibleCountLabel","nonHideableColumns","maxSelectableColumns","footer","limitReachedTooltip","columnNames","classes","name","getAllColumns","columnsToExclude","filteredColumns","filter","column","includes","id","selectedColumnsCount","getIsVisible","length","Col","span","order","ColumnsSelector","py","className","root","withinPortal","position","shadow","Target","variant","Dropdown","miw","Autosize","mah","map","isDisabled","disabled","div","checked","onChange","getToggleVisibilityHandler","mb","mt"],"mappings":";AAAA,SAAQA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,QAAO,gBAAgB;AAGnG,SAAQC,oBAAoB,QAAO,kBAAkB;AACrD,SAAQC,QAAQ,QAAO,kBAAkB;AACzC,OAAOC,eAAe,gCAAgC;AAGtD,MAAMC,yBAAyB;IAAC;IAAe;CAAS;AAExD,OAAO,MAAMC,uBAAqE,CAAC,EAC/EC,UAAU,EACVC,MAAM,EAC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DACjE,cAAA,KAACW;sDACG,cAAA,KAACtD;gDAEGe,OAAOO,aAAa,CAACO,OAAOE,EAAE,CAAC,IAAIF,OAAOE,EAAE;gDAC5CP,MAAMK,OAAOE,EAAE;gDACfwB,SAAS1B,OAAOI,YAAY;gDAC5BoB,UAAUD;gDACVI,UAAU3B,OAAO4B,0BAA0B;+CALtC5B,OAAOE,EAAE;;;gCAUlC;;;wBAGPZ,sCACG;;8CACI,KAAClB;oCAAQyD,IAAG;oCAAKC,IAAG;;gCACnBvC;;;;;;;;AAO7B,EAAE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: (params: void, options?: import("@mantine/core").UseStylesOptions<string>) => {
|
|
2
|
+
classes: {
|
|
3
|
+
root: string;
|
|
4
|
+
wrapper: string;
|
|
5
|
+
};
|
|
6
|
+
cx: (...args: any) => string;
|
|
7
|
+
theme: import("@mantine/core").MantineTheme;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=TableColumnsSelector.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableColumnsSelector.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.styles.ts"],"names":[],"mappings":";;;;;;;;AAEA,wBAKI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.styles.ts"],"sourcesContent":["import {createStyles} from '@mantine/core';\n\nexport default createStyles((theme) => ({\n root: {maxWidth: '100%'},\n wrapper: {\n display: 'inline-flex',\n },\n}));\n"],"names":["createStyles","theme","root","maxWidth","wrapper","display"],"mappings":"AAAA,SAAQA,YAAY,QAAO,gBAAgB;AAE3C,eAAeA,aAAa,CAACC,QAAW,CAAA;QACpCC,MAAM;YAACC,UAAU;QAAM;QACvBC,SAAS;YACLC,SAAS;QACb;IACJ,CAAA,GAAI"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DefaultProps, Selectors } from '@mantine/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import useStyles from './TableColumnsSelector.styles';
|
|
4
|
+
type TableColumnsSelectorStylesNames = Selectors<typeof useStyles>;
|
|
5
|
+
export interface TableColumnsSelectorProps extends DefaultProps<TableColumnsSelectorStylesNames> {
|
|
6
|
+
/**
|
|
7
|
+
* The label of the button
|
|
8
|
+
* @default 'Edit columns'
|
|
9
|
+
*/
|
|
10
|
+
label?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The style variant of the button
|
|
13
|
+
* @default 'outline'
|
|
14
|
+
*/
|
|
15
|
+
buttonVariant?: string;
|
|
16
|
+
/**
|
|
17
|
+
* An array of column ids that the user cannot hide. This is useful for columns that are required for the table to function properly.
|
|
18
|
+
* @default []
|
|
19
|
+
*/
|
|
20
|
+
nonHideableColumns?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Whether the count of visible columns is shown in the button label.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
showVisibleCountLabel?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The maximum number of columns that can be selected at the same time.
|
|
28
|
+
* If defined a footer will render with the remaining number of columns that can be selected.
|
|
29
|
+
*/
|
|
30
|
+
maxSelectableColumns?: number;
|
|
31
|
+
/**
|
|
32
|
+
* A dictionary of column ids and names to use for the checkbox labels.
|
|
33
|
+
*/
|
|
34
|
+
columnNames: Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* The content to display in the footer when maxSelectableColumns is defined.
|
|
37
|
+
*/
|
|
38
|
+
footer?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* The tooltip to display when the user hovers over a disabled checkbox.
|
|
41
|
+
* @default 'You have reached the maximum display limit.'
|
|
42
|
+
*/
|
|
43
|
+
limitReachedTooltip?: string;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=TableColumnsSelector.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableColumnsSelector.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,SAAS,MAAM,+BAA+B,CAAC;AAEtD,KAAK,+BAA+B,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAEnE,MAAM,WAAW,yBAA0B,SAAQ,YAAY,CAAC,+BAA+B,CAAC;IAC5F;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/table/table-columns-selector/TableColumnsSelector.types.ts"],"sourcesContent":["import {DefaultProps, Selectors} from '@mantine/core';\nimport {ReactNode} from 'react';\nimport useStyles from './TableColumnsSelector.styles';\n\ntype TableColumnsSelectorStylesNames = Selectors<typeof useStyles>;\n\nexport interface TableColumnsSelectorProps extends DefaultProps<TableColumnsSelectorStylesNames> {\n /**\n * The label of the button\n * @default 'Edit columns'\n */\n label?: ReactNode;\n /**\n * The style variant of the button\n * @default 'outline'\n */\n buttonVariant?: string;\n /**\n * An array of column ids that the user cannot hide. This is useful for columns that are required for the table to function properly.\n * @default []\n */\n nonHideableColumns?: string[];\n /**\n * Whether the count of visible columns is shown in the button label.\n * @default false\n */\n showVisibleCountLabel?: boolean;\n /**\n * The maximum number of columns that can be selected at the same time.\n * If defined a footer will render with the remaining number of columns that can be selected.\n */\n maxSelectableColumns?: number;\n /**\n * A dictionary of column ids and names to use for the checkbox labels.\n */\n columnNames: Record<string, string>;\n /**\n * The content to display in the footer when maxSelectableColumns is defined.\n */\n footer?: ReactNode;\n /**\n * The tooltip to display when the user hovers over a disabled checkbox.\n * @default 'You have reached the maximum display limit.'\n */\n limitReachedTooltip?: string;\n}\n"],"names":[],"mappings":"AAAA,WA6CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../src/theme/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIH,KAAK,oBAAoB,EAI5B,MAAM,eAAe,CAAC;AAIvB,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../src/theme/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIH,KAAK,oBAAoB,EAI5B,MAAM,eAAe,CAAC;AAIvB,eAAO,MAAM,WAAW,EAAE,oBAgazB,CAAC"}
|
package/dist/esm/theme/Theme.js
CHANGED
|
@@ -17,6 +17,14 @@ export const plasmaTheme = {
|
|
|
17
17
|
lg: '32px',
|
|
18
18
|
xl: '40px'
|
|
19
19
|
},
|
|
20
|
+
globalStyles: (theme)=>({
|
|
21
|
+
body: {
|
|
22
|
+
...theme.fn.fontStyles(),
|
|
23
|
+
fontSize: theme.fontSizes.sm,
|
|
24
|
+
lineHeight: theme.lineHeight,
|
|
25
|
+
fontWeight: 300
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
20
28
|
primaryColor: 'action',
|
|
21
29
|
headings: {
|
|
22
30
|
fontFamily: 'canada-type-gibson, sans-serif',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {CheckSize16Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {\n getSize,\n getStylesRef,\n rem,\n type MantineThemeOverride,\n type NotificationProps,\n type StepperStylesParams,\n type TabsStylesParams,\n} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n // These are overrides over https://github.com/mantinedev/mantine/blob/master/src/mantine-styles/src/theme/default-theme.ts\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n lineHeight: 1.5,\n spacing: {\n xs: '8px',\n sm: '16px',\n md: '24px',\n lg: '32px',\n xl: '40px',\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: '48px', lineHeight: undefined, fontWeight: 300},\n h2: {fontSize: '32px', lineHeight: undefined, fontWeight: 500},\n h3: {fontSize: '24px', lineHeight: undefined, fontWeight: 500},\n h4: {fontSize: '18px', lineHeight: undefined, fontWeight: 300},\n h5: {fontSize: '14px', lineHeight: undefined, fontWeight: 500},\n h6: {fontSize: '12px', lineHeight: undefined, fontWeight: 500},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: {\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em'},\n },\n },\n },\n Text: {\n defaultProps: {\n weight: 300,\n },\n styles: (theme, {}, {size}) => ({\n root: {\n fontSize: getSize({size: size ?? 'sm', sizes: theme.fontSizes}),\n },\n }),\n },\n Button: {\n styles: () => ({\n root: {\n fontWeight: 400,\n },\n }),\n variants: {\n outline: () => ({\n root: {\n backgroundColor: 'white',\n },\n }),\n },\n },\n Modal: {\n styles: (theme, {fullScreen, padding}, {size, variant}) => ({\n content: {\n flex: fullScreen\n ? '0 0 100%'\n : `0 0 ${getSize({\n size,\n sizes: {\n xs: rem(432),\n sm: rem(664),\n md: rem(896),\n lg: rem(1120),\n xl: rem('88%'),\n },\n })}`,\n overflow: 'auto',\n },\n title: {\n width: '100%',\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n fontWeight: 500,\n },\n header: {\n borderBottom: variant !== 'prompt' ? `1px solid ${color.primary.gray[3]}` : null,\n },\n body: {\n '&:not(:only-child)': {\n paddingTop: variant === 'prompt' ? 0 : getSize({size: padding, sizes: plasmaTheme.spacing}),\n },\n },\n }),\n },\n ModalOverlay: {\n defaultProps: {\n color: color.primary.navy[9],\n opacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n styles: (theme) => ({\n label: {\n marginBottom: theme.spacing.xs,\n },\n description: {\n fontSize: theme.fontSizes.sm,\n color: theme.colors.gray[7],\n marginBottom: theme.spacing.xs,\n lineHeight: theme.lineHeight,\n },\n invalid: {\n color: theme.colors.red[9],\n borderColor: theme.colors.red[6],\n },\n error: {\n color: theme.colors.red[9],\n lineHeight: theme.lineHeight,\n },\n }),\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n maw: 300,\n multiline: true,\n withArrow: true,\n withinPortal: true,\n zIndex: 10000,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action.6',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n styles: (theme) => ({\n label: {\n fontSize: theme.fontSizes.sm,\n fontWeight: 300,\n },\n }),\n },\n List: {\n styles: () => ({\n root: {\n listStyleType: 'disc',\n },\n }),\n },\n Radio: {\n styles: {\n labelWrapper: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n },\n },\n Popover: {\n defaultProps: {\n shadow: 'md',\n withArrow: true,\n },\n },\n Badge: {\n styles: {\n root: {\n textTransform: 'none',\n padding: '4px 8px',\n fontWeight: 500,\n },\n },\n },\n ColorSwatch: {\n defaultProps: {\n size: 8,\n withShadow: false,\n },\n },\n MenuItem: {\n defaultProps: {\n fw: 300,\n },\n },\n Notification: {\n styles: (theme, {color: notificationType}: NotificationProps) => ({\n root: {\n borderColor: theme.colors.gray[3],\n backgroundColor: theme.colors.gray[0],\n boxShadow: theme.shadows.lg,\n padding: theme.spacing.sm,\n '&[data-with-icon]': {\n paddingLeft: theme.spacing.sm,\n },\n },\n icon: {\n backgroundColor: 'transparent',\n marginRight: theme.spacing.sm,\n color: theme.colors?.[notificationType][6],\n },\n closeButton: {\n margin: theme.spacing.xs,\n color: theme.colors.gray[5],\n },\n }),\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'info',\n },\n },\n Skeleton: {\n styles: {\n visible: {\n '&::before': {zIndex: 'unset'},\n '&::after': {zIndex: 'unset'},\n },\n },\n },\n SegmentedControl: {\n styles: (theme) => ({\n root: {\n backgroundColor: theme.colors.gray[2],\n },\n }),\n },\n Stepper: {\n defaultProps: {\n size: 'xs',\n completedIcon: <CheckSize16Px />,\n },\n styles: (theme, {}: StepperStylesParams, {size}) => ({\n step: {\n '&[disabled]': {\n color: theme.colors.gray[5],\n '& .mantine-Stepper-stepDescription': {\n color: theme.colors.gray[5],\n },\n '& .mantine-Stepper-stepIcon': {\n borderColor: theme.colors.gray[1],\n },\n },\n },\n stepIcon: {\n fontWeight: 500,\n backgroundColor: theme.colors.gray[1],\n color: 'inherit',\n border: `${rem(1)} solid ${theme.colors.gray[3]}`,\n '&[data-progress]': {\n backgroundColor: theme.white,\n },\n\n '&[data-completed]': {\n backgroundColor: theme.white,\n borderColor: theme.colors.lime[6],\n color: theme.colors.lime[6],\n },\n },\n stepCompletedIcon: {\n color: theme.colors.lime[6],\n fontSize: rem(16),\n },\n stepDescription: {\n color: theme.colors.gray[7],\n fontSize: getSize({size, sizes: theme.fontSizes}),\n },\n separator: {\n height: rem(1),\n backgroundColor: theme.colors.gray[3],\n },\n separatorActive: {\n backgroundColor: theme.colors.gray[3],\n },\n verticalSeparator: {\n borderLeft: `${rem(1)} solid ${theme.colors.gray[3]}`,\n },\n verticalSeparatorActive: {\n borderColor: theme.colors.gray[3],\n },\n }),\n },\n Tabs: {\n styles: (theme, {orientation}: TabsStylesParams) => ({\n tabsList: {\n [orientation === 'horizontal' ? 'borderBottom' : 'borderRight']: `${rem(1)} solid ${\n theme.colors.gray[3]\n }`,\n },\n tab: {\n [orientation === 'horizontal' ? 'borderBottom' : 'borderRight']: `${rem(1)} solid transparent`,\n [orientation === 'horizontal' ? 'marginBottom' : 'marginRight']: rem(-1),\n },\n }),\n },\n Select: {\n styles: (theme) => ({\n input: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],\n },\n item: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],\n\n '&[data-hovered]': {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[1],\n },\n\n '&[data-selected]': {\n backgroundColor: theme.fn.variant({variant: 'light'}).background,\n color: theme.fn.variant({variant: 'light'}).color,\n ...theme.fn.hover({backgroundColor: theme.fn.variant({variant: 'light'}).hover}),\n },\n },\n }),\n },\n NavLink: {\n styles: (theme) => ({\n root: {\n color: theme.colors.gray[6],\n borderRadius: `${theme.defaultRadius}px 0px 0px ${theme.defaultRadius}px`,\n ...theme.fn.hover({\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[1],\n }),\n },\n label: {\n ref: getStylesRef('label'),\n fontWeight: 500,\n },\n children: {\n [`.${getStylesRef('label')}`]: {\n fontWeight: 300,\n },\n },\n }),\n },\n Navbar: {\n styles: (theme) => ({\n root: {\n borderColor: theme.colors.gray[3],\n },\n }),\n },\n ScrollArea: {\n styles: {\n viewport: {\n // https://github.com/radix-ui/primitives/issues/926\n '&[data-radix-scroll-area-viewport]': {\n '& > :first-of-type': {\n display: 'block !important',\n },\n },\n },\n },\n },\n Divider: {\n defaultProps: {\n color: 'gray.3',\n },\n },\n },\n};\n"],"names":["CheckSize16Px","InfoSize24Px","color","getSize","getStylesRef","rem","PlasmaColors","plasmaTheme","colorScheme","fontFamily","black","primary","gray","defaultRadius","lineHeight","spacing","xs","sm","md","lg","xl","primaryColor","headings","fontWeight","sizes","h1","fontSize","undefined","h2","h3","h4","h5","h6","shadows","colors","components","Alert","defaultProps","icon","height","styles","title","Title","root","letterSpacing","Text","weight","theme","size","fontSizes","Button","variants","outline","backgroundColor","Modal","fullScreen","padding","variant","content","flex","overflow","width","header","borderBottom","body","paddingTop","ModalOverlay","navy","opacity","InputWrapper","withAsterisk","label","marginBottom","description","invalid","red","borderColor","error","TextInput","radius","Tooltip","maw","multiline","withArrow","withinPortal","zIndex","Loader","DateRangePicker","cell","textAlign","Anchor","fn","hover","textDecoration","action","Checkbox","List","listStyleType","Radio","labelWrapper","display","alignItems","Popover","shadow","Badge","textTransform","ColorSwatch","withShadow","MenuItem","fw","Notification","notificationType","boxShadow","paddingLeft","marginRight","closeButton","margin","Skeleton","visible","SegmentedControl","Stepper","completedIcon","step","stepIcon","border","white","lime","stepCompletedIcon","stepDescription","separator","separatorActive","verticalSeparator","borderLeft","verticalSeparatorActive","Tabs","orientation","tabsList","tab","Select","input","dark","item","background","NavLink","borderRadius","ref","children","Navbar","ScrollArea","viewport","Divider"],"mappings":";AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,8BAA8B;AACxE,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,SACIC,OAAO,EACPC,YAAY,EACZC,GAAG,QAKA,gBAAgB;AAEvB,SAAQC,YAAY,QAAO,iBAAiB;AAE5C,OAAO,MAAMC,cAAoC;IAC7C,2HAA2H;IAC3HC,aAAa;IACbC,YAAY;IACZC,OAAOR,MAAMS,OAAO,CAACC,IAAI,CAAC,EAAE;IAC5BC,eAAe;IACfC,YAAY;IACZC,SAAS;QACLC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;IACR;IACAC,cAAc;IACdC,UAAU;QACNb,YAAY;QACZc,YAAY;QACZC,OAAO;YACHC,IAAI;gBAACC,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DK,IAAI;gBAACF,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DM,IAAI;gBAACH,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DO,IAAI;gBAACJ,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DQ,IAAI;gBAACL,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DS,IAAI;gBAACN,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;QACjE;IACJ;IACAU,SAAS;QACLjB,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;IACR;IACAc,QAAQ5B;IACR6B,YAAY;QACRC,OAAO;YACHC,cAAc;gBACVC,oBAAM,KAACrC;oBAAasC,QAAQ;;gBAC5BrC,OAAO;YACX;YACAsC,QAAQ;gBACJC,OAAO;oBACHlB,YAAY;gBAChB;YACJ;QACJ;QAC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W,KAAK,SAASuC,MAAMb,MAAM,CAAC0G,IAAI,CAAC,EAAE,GAAG7F,MAAMb,MAAM,CAACtB,IAAI,CAAC,EAAE;wBAC/F,EAAE;oBACN;oBACA2D,OAAO;wBACH0E,KAAK7I,aAAa;wBAClBmB,YAAY;oBAChB;oBACA2H,UAAU;wBACN,CAAC,CAAC,CAAC,EAAE9I,aAAa,SAAS,CAAC,CAAC,EAAE;4BAC3BmB,YAAY;wBAChB;oBACJ;gBACJ,CAAA;QACJ;QACA4H,QAAQ;YACJ3G,QAAQ,CAACO,QAAW,CAAA;oBAChBJ,MAAM;wBACFiC,aAAa7B,MAAMb,MAAM,CAACtB,IAAI,CAAC,EAAE;oBACrC;gBACJ,CAAA;QACJ;QACAwI,YAAY;YACR5G,QAAQ;gBACJ6G,UAAU;oBACN,oDAAoD;oBACpD,sCAAsC;wBAClC,sBAAsB;4BAClBjD,SAAS;wBACb;oBACJ;gBACJ;YACJ;QACJ;QACAkD,SAAS;YACLjH,cAAc;gBACVnC,OAAO;YACX;QACJ;IACJ;AACJ,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {CheckSize16Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {\n getSize,\n getStylesRef,\n rem,\n type MantineThemeOverride,\n type NotificationProps,\n type StepperStylesParams,\n type TabsStylesParams,\n} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n // These are overrides over https://github.com/mantinedev/mantine/blob/master/src/mantine-styles/src/theme/default-theme.ts\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n lineHeight: 1.5,\n spacing: {\n xs: '8px',\n sm: '16px',\n md: '24px',\n lg: '32px',\n xl: '40px',\n },\n globalStyles: (theme) => ({\n body: {\n ...theme.fn.fontStyles(),\n fontSize: theme.fontSizes.sm,\n lineHeight: theme.lineHeight,\n fontWeight: 300,\n },\n }),\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: '48px', lineHeight: undefined, fontWeight: 300},\n h2: {fontSize: '32px', lineHeight: undefined, fontWeight: 500},\n h3: {fontSize: '24px', lineHeight: undefined, fontWeight: 500},\n h4: {fontSize: '18px', lineHeight: undefined, fontWeight: 300},\n h5: {fontSize: '14px', lineHeight: undefined, fontWeight: 500},\n h6: {fontSize: '12px', lineHeight: undefined, fontWeight: 500},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: {\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em'},\n },\n },\n },\n Text: {\n defaultProps: {\n weight: 300,\n },\n styles: (theme, {}, {size}) => ({\n root: {\n fontSize: getSize({size: size ?? 'sm', sizes: theme.fontSizes}),\n },\n }),\n },\n Button: {\n styles: () => ({\n root: {\n fontWeight: 400,\n },\n }),\n variants: {\n outline: () => ({\n root: {\n backgroundColor: 'white',\n },\n }),\n },\n },\n Modal: {\n styles: (theme, {fullScreen, padding}, {size, variant}) => ({\n content: {\n flex: fullScreen\n ? '0 0 100%'\n : `0 0 ${getSize({\n size,\n sizes: {\n xs: rem(432),\n sm: rem(664),\n md: rem(896),\n lg: rem(1120),\n xl: rem('88%'),\n },\n })}`,\n overflow: 'auto',\n },\n title: {\n width: '100%',\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n fontWeight: 500,\n },\n header: {\n borderBottom: variant !== 'prompt' ? `1px solid ${color.primary.gray[3]}` : null,\n },\n body: {\n '&:not(:only-child)': {\n paddingTop: variant === 'prompt' ? 0 : getSize({size: padding, sizes: plasmaTheme.spacing}),\n },\n },\n }),\n },\n ModalOverlay: {\n defaultProps: {\n color: color.primary.navy[9],\n opacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n styles: (theme) => ({\n label: {\n marginBottom: theme.spacing.xs,\n },\n description: {\n fontSize: theme.fontSizes.sm,\n color: theme.colors.gray[7],\n marginBottom: theme.spacing.xs,\n lineHeight: theme.lineHeight,\n },\n invalid: {\n color: theme.colors.red[9],\n borderColor: theme.colors.red[6],\n },\n error: {\n color: theme.colors.red[9],\n lineHeight: theme.lineHeight,\n },\n }),\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n maw: 300,\n multiline: true,\n withArrow: true,\n withinPortal: true,\n zIndex: 10000,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action.6',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n styles: (theme) => ({\n label: {\n fontSize: theme.fontSizes.sm,\n fontWeight: 300,\n },\n }),\n },\n List: {\n styles: () => ({\n root: {\n listStyleType: 'disc',\n },\n }),\n },\n Radio: {\n styles: {\n labelWrapper: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n },\n },\n Popover: {\n defaultProps: {\n shadow: 'md',\n withArrow: true,\n },\n },\n Badge: {\n styles: {\n root: {\n textTransform: 'none',\n padding: '4px 8px',\n fontWeight: 500,\n },\n },\n },\n ColorSwatch: {\n defaultProps: {\n size: 8,\n withShadow: false,\n },\n },\n MenuItem: {\n defaultProps: {\n fw: 300,\n },\n },\n Notification: {\n styles: (theme, {color: notificationType}: NotificationProps) => ({\n root: {\n borderColor: theme.colors.gray[3],\n backgroundColor: theme.colors.gray[0],\n boxShadow: theme.shadows.lg,\n padding: theme.spacing.sm,\n '&[data-with-icon]': {\n paddingLeft: theme.spacing.sm,\n },\n },\n icon: {\n backgroundColor: 'transparent',\n marginRight: theme.spacing.sm,\n color: theme.colors?.[notificationType][6],\n },\n closeButton: {\n margin: theme.spacing.xs,\n color: theme.colors.gray[5],\n },\n }),\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'info',\n },\n },\n Skeleton: {\n styles: {\n visible: {\n '&::before': {zIndex: 'unset'},\n '&::after': {zIndex: 'unset'},\n },\n },\n },\n SegmentedControl: {\n styles: (theme) => ({\n root: {\n backgroundColor: theme.colors.gray[2],\n },\n }),\n },\n Stepper: {\n defaultProps: {\n size: 'xs',\n completedIcon: <CheckSize16Px />,\n },\n styles: (theme, {}: StepperStylesParams, {size}) => ({\n step: {\n '&[disabled]': {\n color: theme.colors.gray[5],\n '& .mantine-Stepper-stepDescription': {\n color: theme.colors.gray[5],\n },\n '& .mantine-Stepper-stepIcon': {\n borderColor: theme.colors.gray[1],\n },\n },\n },\n stepIcon: {\n fontWeight: 500,\n backgroundColor: theme.colors.gray[1],\n color: 'inherit',\n border: `${rem(1)} solid ${theme.colors.gray[3]}`,\n '&[data-progress]': {\n backgroundColor: theme.white,\n },\n\n '&[data-completed]': {\n backgroundColor: theme.white,\n borderColor: theme.colors.lime[6],\n color: theme.colors.lime[6],\n },\n },\n stepCompletedIcon: {\n color: theme.colors.lime[6],\n fontSize: rem(16),\n },\n stepDescription: {\n color: theme.colors.gray[7],\n fontSize: getSize({size, sizes: theme.fontSizes}),\n },\n separator: {\n height: rem(1),\n backgroundColor: theme.colors.gray[3],\n },\n separatorActive: {\n backgroundColor: theme.colors.gray[3],\n },\n verticalSeparator: {\n borderLeft: `${rem(1)} solid ${theme.colors.gray[3]}`,\n },\n verticalSeparatorActive: {\n borderColor: theme.colors.gray[3],\n },\n }),\n },\n Tabs: {\n styles: (theme, {orientation}: TabsStylesParams) => ({\n tabsList: {\n [orientation === 'horizontal' ? 'borderBottom' : 'borderRight']: `${rem(1)} solid ${\n theme.colors.gray[3]\n }`,\n },\n tab: {\n [orientation === 'horizontal' ? 'borderBottom' : 'borderRight']: `${rem(1)} solid transparent`,\n [orientation === 'horizontal' ? 'marginBottom' : 'marginRight']: rem(-1),\n },\n }),\n },\n Select: {\n styles: (theme) => ({\n input: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],\n },\n item: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],\n\n '&[data-hovered]': {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[1],\n },\n\n '&[data-selected]': {\n backgroundColor: theme.fn.variant({variant: 'light'}).background,\n color: theme.fn.variant({variant: 'light'}).color,\n ...theme.fn.hover({backgroundColor: theme.fn.variant({variant: 'light'}).hover}),\n },\n },\n }),\n },\n NavLink: {\n styles: (theme) => ({\n root: {\n color: theme.colors.gray[6],\n borderRadius: `${theme.defaultRadius}px 0px 0px ${theme.defaultRadius}px`,\n ...theme.fn.hover({\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[1],\n }),\n },\n label: {\n ref: getStylesRef('label'),\n fontWeight: 500,\n },\n children: {\n [`.${getStylesRef('label')}`]: {\n fontWeight: 300,\n },\n },\n }),\n },\n Navbar: {\n styles: (theme) => ({\n root: {\n borderColor: theme.colors.gray[3],\n },\n }),\n },\n ScrollArea: {\n styles: {\n viewport: {\n // https://github.com/radix-ui/primitives/issues/926\n '&[data-radix-scroll-area-viewport]': {\n '& > :first-of-type': {\n display: 'block !important',\n },\n },\n },\n },\n },\n Divider: {\n defaultProps: {\n color: 'gray.3',\n },\n },\n },\n};\n"],"names":["CheckSize16Px","InfoSize24Px","color","getSize","getStylesRef","rem","PlasmaColors","plasmaTheme","colorScheme","fontFamily","black","primary","gray","defaultRadius","lineHeight","spacing","xs","sm","md","lg","xl","globalStyles","theme","body","fn","fontStyles","fontSize","fontSizes","fontWeight","primaryColor","headings","sizes","h1","undefined","h2","h3","h4","h5","h6","shadows","colors","components","Alert","defaultProps","icon","height","styles","title","Title","root","letterSpacing","Text","weight","size","Button","variants","outline","backgroundColor","Modal","fullScreen","padding","variant","content","flex","overflow","width","header","borderBottom","paddingTop","ModalOverlay","navy","opacity","InputWrapper","withAsterisk","label","marginBottom","description","invalid","red","borderColor","error","TextInput","radius","Tooltip","maw","multiline","withArrow","withinPortal","zIndex","Loader","DateRangePicker","cell","textAlign","Anchor","hover","textDecoration","action","Checkbox","List","listStyleType","Radio","labelWrapper","display","alignItems","Popover","shadow","Badge","textTransform","ColorSwatch","withShadow","MenuItem","fw","Notification","notificationType","boxShadow","paddingLeft","marginRight","closeButton","margin","Skeleton","visible","SegmentedControl","Stepper","completedIcon","step","stepIcon","border","white","lime","stepCompletedIcon","stepDescription","separator","separatorActive","verticalSeparator","borderLeft","verticalSeparatorActive","Tabs","orientation","tabsList","tab","Select","input","dark","item","background","NavLink","borderRadius","ref","children","Navbar","ScrollArea","viewport","Divider"],"mappings":";AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,8BAA8B;AACxE,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,SACIC,OAAO,EACPC,YAAY,EACZC,GAAG,QAKA,gBAAgB;AAEvB,SAAQC,YAAY,QAAO,iBAAiB;AAE5C,OAAO,MAAMC,cAAoC;IAC7C,2HAA2H;IAC3HC,aAAa;IACbC,YAAY;IACZC,OAAOR,MAAMS,OAAO,CAACC,IAAI,CAAC,EAAE;IAC5BC,eAAe;IACfC,YAAY;IACZC,SAAS;QACLC,IAAI;QACJC,IAAI;QAC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BACN,CAAC,CAAC,CAAC,EAAEhJ,aAAa,SAAS,CAAC,CAAC,EAAE;4BAC3BwB,YAAY;wBAChB;oBACJ;gBACJ,CAAA;QACJ;QACAyH,QAAQ;YACJvG,QAAQ,CAACxB,QAAW,CAAA;oBAChB2B,MAAM;wBACF8B,aAAazD,MAAMkB,MAAM,CAAC5B,IAAI,CAAC,EAAE;oBACrC;gBACJ,CAAA;QACJ;QACA0I,YAAY;YACRxG,QAAQ;gBACJyG,UAAU;oBACN,oDAAoD;oBACpD,sCAAsC;wBAClC,sBAAsB;4BAClBjD,SAAS;wBACb;oBACJ;gBACJ;YACJ;QACJ;QACAkD,SAAS;YACL7G,cAAc;gBACVzC,OAAO;YACX;QACJ;IACJ;AACJ,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coveord/plasma-mantine",
|
|
3
|
-
"version": "52.
|
|
3
|
+
"version": "52.27.1",
|
|
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-
|
|
45
|
-
"@coveord/plasma-
|
|
44
|
+
"@coveord/plasma-tokens": "52.23.1",
|
|
45
|
+
"@coveord/plasma-react-icons": "52.26.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@emotion/react": "11.11.1",
|
|
@@ -26,11 +26,12 @@ const useStyles = createStyles<string>((theme) => ({
|
|
|
26
26
|
}));
|
|
27
27
|
|
|
28
28
|
export const TableComponentsOrder = {
|
|
29
|
-
MultiSelectInfo:
|
|
30
|
-
Actions:
|
|
31
|
-
Predicate:
|
|
32
|
-
Filter:
|
|
33
|
-
DateRangePicker:
|
|
29
|
+
MultiSelectInfo: 7,
|
|
30
|
+
Actions: 6,
|
|
31
|
+
Predicate: 5,
|
|
32
|
+
Filter: 4,
|
|
33
|
+
DateRangePicker: 3,
|
|
34
|
+
ColumnsSelector: 2,
|
|
34
35
|
LayoutControl: 1,
|
|
35
36
|
};
|
|
36
37
|
|
|
@@ -21,6 +21,7 @@ import {TableLayouts} from './layouts/TableLayouts';
|
|
|
21
21
|
import {TableActions} from './table-actions/TableActions';
|
|
22
22
|
import {TableAccordionColumn, TableCollapsibleColumn} from './table-column/TableCollapsibleColumn';
|
|
23
23
|
import {TableSelectableColumn} from './table-column/TableSelectableColumn';
|
|
24
|
+
import {TableColumnsSelector} from './table-columns-selector/TableColumnsSelector';
|
|
24
25
|
import {TableConsumer} from './table-consumer/TableConsumer';
|
|
25
26
|
import {TableDateRangePicker} from './table-date-range-picker/TableDateRangePicker';
|
|
26
27
|
import {TableFilter} from './table-filter/TableFilter';
|
|
@@ -91,6 +92,8 @@ export const Table: TableType = <T,>({
|
|
|
91
92
|
...options,
|
|
92
93
|
});
|
|
93
94
|
|
|
95
|
+
const getAllColumns = table.getAllFlatColumns;
|
|
96
|
+
|
|
94
97
|
const [state, setState] = useState<TableState<T>>(table.initialState as TableState<T>);
|
|
95
98
|
table.setOptions((prev) => ({
|
|
96
99
|
...prev,
|
|
@@ -144,7 +147,7 @@ export const Table: TableType = <T,>({
|
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
const Layout = layouts.find(({name}) => name === form.values.layout);
|
|
147
|
-
const hasRows = table.getRowModel()
|
|
150
|
+
const hasRows = table.getRowModel()?.rows.length > 0;
|
|
148
151
|
|
|
149
152
|
return (
|
|
150
153
|
<Box ref={outsideClickRef}>
|
|
@@ -164,6 +167,7 @@ export const Table: TableType = <T,>({
|
|
|
164
167
|
getPageCount: table.getPageCount,
|
|
165
168
|
disableRowSelection,
|
|
166
169
|
layouts,
|
|
170
|
+
getAllColumns,
|
|
167
171
|
}}
|
|
168
172
|
>
|
|
169
173
|
{consumer}
|
|
@@ -217,6 +221,7 @@ export const Table: TableType = <T,>({
|
|
|
217
221
|
);
|
|
218
222
|
};
|
|
219
223
|
|
|
224
|
+
Table.ColumnsSelector = TableColumnsSelector;
|
|
220
225
|
Table.Actions = TableActions;
|
|
221
226
|
Table.Filter = TableFilter;
|
|
222
227
|
Table.Footer = TableFooter;
|
|
@@ -2,6 +2,7 @@ import {Icon} from '@coveord/plasma-react-icons';
|
|
|
2
2
|
import {DefaultProps, Selectors} from '@mantine/core';
|
|
3
3
|
import {UseFormReturnType} from '@mantine/form';
|
|
4
4
|
import {
|
|
5
|
+
Column,
|
|
5
6
|
ColumnDef,
|
|
6
7
|
CoreOptions,
|
|
7
8
|
TableOptions,
|
|
@@ -11,10 +12,12 @@ import {
|
|
|
11
12
|
import {Dispatch, ReactElement, ReactNode, RefObject} from 'react';
|
|
12
13
|
|
|
13
14
|
import {DateRangePickerValue} from '../date-range-picker/DateRangePickerInlineCalendar';
|
|
15
|
+
import useStyles from './Table.styles';
|
|
14
16
|
import {TableLayoutProps} from './layouts/RowLayout.types'; // TODO https://coveord.atlassian.net/browse/ADUI-9182
|
|
15
17
|
import {TableLayouts} from './layouts/TableLayouts';
|
|
16
18
|
import {TableActions} from './table-actions/TableActions';
|
|
17
19
|
import {TableAccordionColumn, TableCollapsibleColumn} from './table-column/TableCollapsibleColumn';
|
|
20
|
+
import {TableColumnsSelector} from './table-columns-selector/TableColumnsSelector';
|
|
18
21
|
import {TableConsumer} from './table-consumer/TableConsumer';
|
|
19
22
|
import {TableDateRangePicker} from './table-date-range-picker/TableDateRangePicker';
|
|
20
23
|
import {TableFilter} from './table-filter/TableFilter';
|
|
@@ -25,7 +28,6 @@ import {TableLoading} from './table-loading/TableLoading';
|
|
|
25
28
|
import {TablePagination} from './table-pagination/TablePagination';
|
|
26
29
|
import {TablePerPage} from './table-per-page/TablePerPage';
|
|
27
30
|
import {TablePredicate} from './table-predicate/TablePredicate';
|
|
28
|
-
import useStyles from './Table.styles';
|
|
29
31
|
|
|
30
32
|
export type RowSelectionWithData<TData> = Record<string, TData>;
|
|
31
33
|
export interface RowSelectionState<TData> {
|
|
@@ -84,6 +86,10 @@ export type TableFormType = {
|
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
export type TableContextType<TData> = {
|
|
89
|
+
/**
|
|
90
|
+
* Returns all flat columns in the table.
|
|
91
|
+
*/
|
|
92
|
+
getAllColumns: () => Array<Column<TData, unknown>>;
|
|
87
93
|
/**
|
|
88
94
|
* Function to call when the table needs an update
|
|
89
95
|
*/
|
|
@@ -262,6 +268,7 @@ export interface TableProps<T> extends DefaultProps<TableStylesNames> {
|
|
|
262
268
|
|
|
263
269
|
export interface TableType {
|
|
264
270
|
<T>(props: TableProps<T>): ReactElement;
|
|
271
|
+
ColumnsSelector: typeof TableColumnsSelector;
|
|
265
272
|
Actions: typeof TableActions;
|
|
266
273
|
Filter: typeof TableFilter;
|
|
267
274
|
Footer: typeof TableFooter;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import {Box} from '@mantine/core';
|
|
2
|
+
import {ColumnDef, createColumnHelper} from '@tanstack/table-core';
|
|
3
|
+
import {render, screen, userEvent} from '@test-utils';
|
|
4
|
+
import {Table} from '../Table';
|
|
5
|
+
import {TableColumnsSelector} from '../table-columns-selector/TableColumnsSelector';
|
|
6
|
+
|
|
7
|
+
const mockData = [
|
|
8
|
+
{
|
|
9
|
+
name: 'John Doe',
|
|
10
|
+
age: 30,
|
|
11
|
+
email: 'john.doe@example.com',
|
|
12
|
+
phone: '123-456-7890',
|
|
13
|
+
body: 'coucou',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'Jane Doe',
|
|
17
|
+
age: 25,
|
|
18
|
+
email: 'jane.doe@example.com',
|
|
19
|
+
phone: '098-765-4321',
|
|
20
|
+
body: 'coucou 2',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const columnNames: Record<string, string> = {
|
|
25
|
+
name: 'Name',
|
|
26
|
+
age: 'Age',
|
|
27
|
+
email: 'Email',
|
|
28
|
+
phone: 'Phone',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type RowData = {
|
|
32
|
+
name: string;
|
|
33
|
+
age: number;
|
|
34
|
+
email: string;
|
|
35
|
+
phone: string;
|
|
36
|
+
body: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const columnHelper = createColumnHelper<RowData>();
|
|
40
|
+
const columns: Array<ColumnDef<RowData>> = [
|
|
41
|
+
columnHelper.accessor('name', {enableSorting: false}),
|
|
42
|
+
columnHelper.accessor('age', {enableSorting: false}),
|
|
43
|
+
columnHelper.accessor('email', {enableSorting: false}),
|
|
44
|
+
columnHelper.accessor('phone', {enableSorting: false}),
|
|
45
|
+
Table.CollapsibleColumn as ColumnDef<RowData>,
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
describe('TableColumnsSelector', () => {
|
|
49
|
+
it('render the edit button in the table header', () => {
|
|
50
|
+
render(
|
|
51
|
+
<Table data={mockData} columns={columns}>
|
|
52
|
+
<Table.Header>
|
|
53
|
+
<TableColumnsSelector columnNames={columnNames} />
|
|
54
|
+
</Table.Header>
|
|
55
|
+
</Table>,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
expect(screen.getByRole('button', {name: 'Edit columns'})).toBeVisible();
|
|
59
|
+
expect(screen.queryByRole('button', {name: 'Edit columns (4)'})).not.toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('renders the custom label when defined', () => {
|
|
63
|
+
render(
|
|
64
|
+
<Table data={mockData} columns={columns}>
|
|
65
|
+
<Table.Header>
|
|
66
|
+
<TableColumnsSelector columnNames={columnNames} label="Custom label" />
|
|
67
|
+
</Table.Header>
|
|
68
|
+
</Table>,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
expect(screen.getByRole('button', {name: 'Custom label'})).toBeVisible();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('renders the count of visible columns if showVisibleCountLabel is true', () => {
|
|
75
|
+
render(
|
|
76
|
+
<Table data={mockData} columns={columns}>
|
|
77
|
+
<Table.Header>
|
|
78
|
+
<TableColumnsSelector columnNames={columnNames} showVisibleCountLabel />
|
|
79
|
+
</Table.Header>
|
|
80
|
+
</Table>,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
expect(screen.getByRole('button', {name: 'Edit columns (4)'})).toBeVisible();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('renders all columns in the dropdown, except the collapsible and the multiselectRow by default', async () => {
|
|
87
|
+
const user = userEvent.setup();
|
|
88
|
+
render(
|
|
89
|
+
<Table
|
|
90
|
+
data={mockData}
|
|
91
|
+
columns={columns}
|
|
92
|
+
multiRowSelectionEnabled
|
|
93
|
+
getExpandChildren={(datum) => <Box py="xs">{datum.body}</Box>}
|
|
94
|
+
>
|
|
95
|
+
<Table.Header>
|
|
96
|
+
<TableColumnsSelector columnNames={columnNames} />
|
|
97
|
+
</Table.Header>
|
|
98
|
+
</Table>,
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
await user.click(screen.getByRole('button', {name: 'Edit columns'}));
|
|
102
|
+
|
|
103
|
+
// columns are rendered
|
|
104
|
+
expect(screen.getAllByRole('button', {name: /arrowheaddown/i})).toHaveLength(2);
|
|
105
|
+
expect(screen.getAllByRole('checkbox', {name: /select row/i})).toHaveLength(2);
|
|
106
|
+
|
|
107
|
+
expect(screen.getByRole('checkbox', {name: 'Name'})).toBeVisible();
|
|
108
|
+
expect(screen.getByRole('checkbox', {name: 'Age'})).toBeVisible();
|
|
109
|
+
expect(screen.getByRole('checkbox', {name: 'Email'})).toBeVisible();
|
|
110
|
+
expect(screen.getByRole('checkbox', {name: 'Phone'})).toBeVisible();
|
|
111
|
+
|
|
112
|
+
// columns are not in the dropdown
|
|
113
|
+
expect(screen.queryByRole('checkbox', {name: /collapsible/i})).not.toBeInTheDocument();
|
|
114
|
+
expect(screen.queryByRole('checkbox', {name: 'select'})).not.toBeInTheDocument();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('renders all checkboxes checked by default', async () => {
|
|
118
|
+
const user = userEvent.setup();
|
|
119
|
+
render(
|
|
120
|
+
<Table data={mockData} columns={columns}>
|
|
121
|
+
<Table.Header>
|
|
122
|
+
<TableColumnsSelector columnNames={columnNames} />
|
|
123
|
+
</Table.Header>
|
|
124
|
+
</Table>,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
await user.click(screen.getByRole('button', {name: 'Edit columns'}));
|
|
128
|
+
|
|
129
|
+
expect(screen.getByRole('checkbox', {name: 'Name'})).toBeChecked();
|
|
130
|
+
expect(screen.getByRole('checkbox', {name: 'Age'})).toBeChecked();
|
|
131
|
+
expect(screen.getByRole('checkbox', {name: 'Email'})).toBeChecked();
|
|
132
|
+
expect(screen.getByRole('checkbox', {name: 'Phone'})).toBeChecked();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('does not render the checkboxes for the columns that are in the nonHideableColumns prop', async () => {
|
|
136
|
+
const user = userEvent.setup();
|
|
137
|
+
render(
|
|
138
|
+
<Table data={mockData} columns={columns}>
|
|
139
|
+
<Table.Header>
|
|
140
|
+
<TableColumnsSelector columnNames={columnNames} nonHideableColumns={['name']} />
|
|
141
|
+
</Table.Header>
|
|
142
|
+
</Table>,
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
await user.click(screen.getByRole('button', {name: 'Edit columns'}));
|
|
146
|
+
|
|
147
|
+
expect(screen.queryByRole('checkbox', {name: 'Name'})).not.toBeInTheDocument();
|
|
148
|
+
expect(screen.getByRole('checkbox', {name: 'Age'})).toBeChecked();
|
|
149
|
+
expect(screen.getByRole('checkbox', {name: 'Email'})).toBeChecked();
|
|
150
|
+
expect(screen.getByRole('checkbox', {name: 'Phone'})).toBeChecked();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('renders unchecked checkboxes for the columns that are not visible in the inital state of the table', async () => {
|
|
154
|
+
const user = userEvent.setup();
|
|
155
|
+
render(
|
|
156
|
+
<Table data={mockData} columns={columns} initialState={{columnVisibility: {email: false}}}>
|
|
157
|
+
<Table.Header>
|
|
158
|
+
<TableColumnsSelector columnNames={columnNames} />
|
|
159
|
+
</Table.Header>
|
|
160
|
+
</Table>,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
await user.click(screen.getByRole('button', {name: 'Edit columns'}));
|
|
164
|
+
|
|
165
|
+
expect(screen.getByRole('checkbox', {name: 'Name'})).toBeChecked();
|
|
166
|
+
expect(screen.getByRole('checkbox', {name: 'Age'})).toBeChecked();
|
|
167
|
+
expect(screen.getByRole('checkbox', {name: 'Email'})).not.toBeChecked();
|
|
168
|
+
expect(screen.getByRole('checkbox', {name: 'Phone'})).toBeChecked();
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('renders disabled checkboxes when the maxSelectableColumns is set and the maximum number of columns is checked', async () => {
|
|
172
|
+
const user = userEvent.setup();
|
|
173
|
+
render(
|
|
174
|
+
<Table data={mockData} columns={columns} initialState={{columnVisibility: {email: false}}}>
|
|
175
|
+
<Table.Header>
|
|
176
|
+
<TableColumnsSelector columnNames={columnNames} maxSelectableColumns={3} />
|
|
177
|
+
</Table.Header>
|
|
178
|
+
</Table>,
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
await user.click(screen.getByRole('button', {name: 'Edit columns'}));
|
|
182
|
+
|
|
183
|
+
const nameCheckBox = screen.getByRole('checkbox', {name: /name/i});
|
|
184
|
+
const ageCheckBox = screen.getByRole('checkbox', {name: /age/i});
|
|
185
|
+
const emailCheckBox = screen.getByRole('checkbox', {name: /email/i});
|
|
186
|
+
const phoneCheckBox = screen.getByRole('checkbox', {name: /phone/i});
|
|
187
|
+
|
|
188
|
+
expect(nameCheckBox).toBeChecked();
|
|
189
|
+
expect(nameCheckBox).toBeEnabled();
|
|
190
|
+
expect(ageCheckBox).toBeChecked();
|
|
191
|
+
expect(ageCheckBox).toBeEnabled();
|
|
192
|
+
expect(emailCheckBox).not.toBeChecked();
|
|
193
|
+
expect(emailCheckBox).toBeDisabled();
|
|
194
|
+
expect(phoneCheckBox).toBeChecked();
|
|
195
|
+
expect(phoneCheckBox).toBeEnabled();
|
|
196
|
+
|
|
197
|
+
await user.click(nameCheckBox);
|
|
198
|
+
|
|
199
|
+
expect(nameCheckBox).toBeEnabled();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('renders a tooltip when the maxSelectableColumns is set and the maximum number of columns is checked and the user hover a disabled checkbox', async () => {
|
|
203
|
+
const user = userEvent.setup();
|
|
204
|
+
render(
|
|
205
|
+
<Table data={mockData} columns={columns} initialState={{columnVisibility: {email: false}}}>
|
|
206
|
+
<Table.Header>
|
|
207
|
+
<TableColumnsSelector
|
|
208
|
+
columnNames={columnNames}
|
|
209
|
+
maxSelectableColumns={3}
|
|
210
|
+
limitReachedTooltip="You can display up to 3 columns"
|
|
211
|
+
/>
|
|
212
|
+
</Table.Header>
|
|
213
|
+
</Table>,
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
await user.click(screen.getByRole('button', {name: 'Edit columns'}));
|
|
217
|
+
|
|
218
|
+
const emailCheckBoxWrapper = screen.getByRole('checkbox', {name: /email/i}).parentElement;
|
|
219
|
+
|
|
220
|
+
await user.hover(emailCheckBoxWrapper);
|
|
221
|
+
|
|
222
|
+
expect(screen.getByText('You can display up to 3 columns')).toBeVisible();
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe('footer', () => {
|
|
226
|
+
it('does not render the footer when maxSelectableColumns is not defined', async () => {
|
|
227
|
+
const user = userEvent.setup();
|
|
228
|
+
render(
|
|
229
|
+
<Table data={mockData} columns={columns}>
|
|
230
|
+
<Table.Header>
|
|
231
|
+
<TableColumnsSelector columnNames={columnNames} />
|
|
232
|
+
</Table.Header>
|
|
233
|
+
</Table>,
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
await user.click(screen.getByRole('button', {name: 'Edit columns'}));
|
|
237
|
+
|
|
238
|
+
expect(screen.queryByText('You can display up to 3 columns')).not.toBeInTheDocument();
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('renders the footer when maxSelectableColumns is defined and footer is defined', async () => {
|
|
242
|
+
const user = userEvent.setup();
|
|
243
|
+
render(
|
|
244
|
+
<Table data={mockData} columns={columns}>
|
|
245
|
+
<Table.Header>
|
|
246
|
+
<TableColumnsSelector
|
|
247
|
+
columnNames={columnNames}
|
|
248
|
+
maxSelectableColumns={3}
|
|
249
|
+
footer="You can display so many patate"
|
|
250
|
+
/>
|
|
251
|
+
</Table.Header>
|
|
252
|
+
</Table>,
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
await user.click(screen.getByRole('button', {name: 'Edit columns'}));
|
|
256
|
+
|
|
257
|
+
expect(screen.getByText('You can display so many patate')).toBeVisible();
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
});
|