@coveord/plasma-mantine 52.8.0 → 52.8.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 +30 -30
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/table/TablePredicate.d.ts.map +1 -1
- package/dist/cjs/components/table/TablePredicate.js +1 -2
- package/dist/cjs/components/table/TablePredicate.js.map +1 -1
- package/dist/esm/components/table/TablePredicate.d.ts.map +1 -1
- package/dist/esm/components/table/TablePredicate.js +1 -2
- package/dist/esm/components/table/TablePredicate.js.map +1 -1
- package/package.json +1 -1
- package/src/components/table/TablePredicate.tsx +1 -2
- package/src/components/table/__tests__/TablePredicate.spec.tsx +10 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePredicate.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePredicate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAuB,UAAU,EAAE,SAAS,EAAO,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAKxC,QAAA,MAAM,SAAS;;;;;;;;CAIZ,CAAC;AAEJ,KAAK,yBAAyB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D,UAAU,mBAAoB,SAAQ,YAAY,CAAC,yBAAyB,CAAC;IACzE;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"TablePredicate.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePredicate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAuB,UAAU,EAAE,SAAS,EAAO,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAKxC,QAAA,MAAM,SAAS;;;;;;;;CAIZ,CAAC;AAEJ,KAAK,yBAAyB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D,UAAU,mBAAoB,SAAQ,YAAY,CAAC,yBAAyB,CAAC;IACzE;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CA+BjE,CAAC"}
|
|
@@ -38,10 +38,9 @@ var TablePredicate = function(_param) {
|
|
|
38
38
|
styles: styles,
|
|
39
39
|
unstyled: unstyled
|
|
40
40
|
}).classes;
|
|
41
|
-
var
|
|
41
|
+
var form = (0, _TableContext.useTable)().form;
|
|
42
42
|
var onUpdate = function(newValue) {
|
|
43
43
|
form.setFieldValue("predicates", _object_spread_props._(_object_spread._({}, form.values.predicates), _define_property._({}, id, newValue)));
|
|
44
|
-
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
45
44
|
};
|
|
46
45
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Grid.Col, _object_spread_props._(_object_spread._({
|
|
47
46
|
span: "content",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/table/TablePredicate.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Grid, Group, Select, SelectItem, Selectors, Text} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {TableComponentsOrder} from './Table.styles';\nimport {useTable} from './TableContext';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n wrapper: {},\n label: {},\n}));\n\ntype TablePredicateStylesNames = Selectors<typeof useStyles>;\n\ninterface TablePredicateProps extends DefaultProps<TablePredicateStylesNames> {\n /**\n * Unique identifier for this predicate. Will be used to access the selected value in the table state\n */\n id: string;\n /**\n * The values to display in the predicate\n */\n data: SelectItem[];\n /**\n * Input label (not displayed for now)\n *\n * @default default to the predicate id\n */\n label?: string;\n}\n\nexport const TablePredicate: FunctionComponent<TablePredicateProps> = ({\n id,\n data,\n label,\n classNames,\n styles,\n unstyled,\n ...others\n}) => {\n const {classes} = useStyles(null, {name: 'TablePredicate', classNames, styles, unstyled});\n const {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/table/TablePredicate.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Grid, Group, Select, SelectItem, Selectors, Text} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {TableComponentsOrder} from './Table.styles';\nimport {useTable} from './TableContext';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n wrapper: {},\n label: {},\n}));\n\ntype TablePredicateStylesNames = Selectors<typeof useStyles>;\n\ninterface TablePredicateProps extends DefaultProps<TablePredicateStylesNames> {\n /**\n * Unique identifier for this predicate. Will be used to access the selected value in the table state\n */\n id: string;\n /**\n * The values to display in the predicate\n */\n data: SelectItem[];\n /**\n * Input label (not displayed for now)\n *\n * @default default to the predicate id\n */\n label?: string;\n}\n\nexport const TablePredicate: FunctionComponent<TablePredicateProps> = ({\n id,\n data,\n label,\n classNames,\n styles,\n unstyled,\n ...others\n}) => {\n const {classes} = useStyles(null, {name: 'TablePredicate', classNames, styles, unstyled});\n const {form} = useTable();\n\n const onUpdate = (newValue: string) => {\n form.setFieldValue('predicates', {...form.values.predicates, [id]: newValue});\n };\n\n return (\n <Grid.Col span=\"content\" order={TableComponentsOrder.Predicate} py=\"sm\" className={classes.root} {...others}>\n <Group spacing=\"xs\" className={classes.wrapper}>\n {label ? <Text className={classes.label}>{label}:</Text> : null}\n <Select\n withinPortal\n value={form.values.predicates[id]}\n onChange={onUpdate}\n data={data}\n aria-label={label ?? id}\n searchable={data.length > 7}\n />\n </Group>\n </Grid.Col>\n );\n};\n"],"names":["TablePredicate","useStyles","createStyles","theme","root","wrapper","label","id","data","classNames","styles","unstyled","others","classes","name","form","useTable","onUpdate","newValue","setFieldValue","values","predicates","Grid","Col","span","order","TableComponentsOrder","Predicate","py","className","Group","spacing","Text","Select","withinPortal","value","onChange","aria-label","searchable","length"],"mappings":";;;;+BA+BaA;;;eAAAA;;;;;;;;oBA/B8E;2BAGxD;4BACZ;AAEvB,IAAMC,YAAYC,IAAAA,oBAAa,SAACC;WAAW;QACvCC,MAAM,CAAC;QACPC,SAAS,CAAC;QACVC,OAAO,CAAC;IACZ;;AAqBO,IAAMN,iBAAyD;QAClEO,YAAAA,IACAC,cAAAA,MACAF,eAAAA,OACAG,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACGC;QANHL;QACAC;QACAF;QACAG;QACAC;QACAC;;IAGA,IAAM,AAACE,UAAWZ,UAAU,MAAM;QAACa,MAAM;QAAkBL,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,GAAhFE;IACP,IAAM,AAACE,OAAQC,IAAAA,0BAARD;IAEP,IAAME,WAAW,SAACC;QACdH,KAAKI,cAAc,cAAc,4CAAIJ,KAAKK,OAAOC,aAAY,uBAACd,IAAKW;IACvE;IAEA,qBACI,qBAACI,WAAKC;QAAIC,MAAK;QAAUC,OAAOC,kCAAqBC;QAAWC,IAAG;QAAKC,WAAWhB,QAAQT;OAAUQ;kBACjG,cAAA,sBAACkB;YAAMC,SAAQ;YAAKF,WAAWhB,QAAQR;;gBAClCC,sBAAQ,sBAAC0B;oBAAKH,WAAWhB,QAAQP;;wBAAQA;wBAAM;;qBAAW;8BAC3D,qBAAC2B;oBACGC,YAAY;oBACZC,OAAOpB,KAAKK,OAAOC,UAAU,CAACd,GAAG;oBACjC6B,UAAUnB;oBACVT,MAAMA;oBACN6B,cAAY/B,kBAAAA,mBAAAA,QAASC;oBACrB+B,YAAY9B,KAAK+B,SAAS;;;;;AAK9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePredicate.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePredicate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAuB,UAAU,EAAE,SAAS,EAAO,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAKxC,QAAA,MAAM,SAAS;;;;;;;;CAIZ,CAAC;AAEJ,KAAK,yBAAyB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D,UAAU,mBAAoB,SAAQ,YAAY,CAAC,yBAAyB,CAAC;IACzE;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"TablePredicate.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TablePredicate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAuB,UAAU,EAAE,SAAS,EAAO,MAAM,eAAe,CAAC;AAC3G,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAKxC,QAAA,MAAM,SAAS;;;;;;;;CAIZ,CAAC;AAEJ,KAAK,yBAAyB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D,UAAU,mBAAoB,SAAQ,YAAY,CAAC,yBAAyB,CAAC;IACzE;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CA+BjE,CAAC"}
|
|
@@ -28,10 +28,9 @@ export var TablePredicate = function(_param) {
|
|
|
28
28
|
styles: styles,
|
|
29
29
|
unstyled: unstyled
|
|
30
30
|
}).classes;
|
|
31
|
-
var
|
|
31
|
+
var form = useTable().form;
|
|
32
32
|
var onUpdate = function(newValue) {
|
|
33
33
|
form.setFieldValue("predicates", _object_spread_props(_object_spread({}, form.values.predicates), _define_property({}, id, newValue)));
|
|
34
|
-
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
35
34
|
};
|
|
36
35
|
return /*#__PURE__*/ _jsx(Grid.Col, _object_spread_props(_object_spread({
|
|
37
36
|
span: "content",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/table/TablePredicate.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Grid, Group, Select, SelectItem, Selectors, Text} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {TableComponentsOrder} from './Table.styles';\nimport {useTable} from './TableContext';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n wrapper: {},\n label: {},\n}));\n\ntype TablePredicateStylesNames = Selectors<typeof useStyles>;\n\ninterface TablePredicateProps extends DefaultProps<TablePredicateStylesNames> {\n /**\n * Unique identifier for this predicate. Will be used to access the selected value in the table state\n */\n id: string;\n /**\n * The values to display in the predicate\n */\n data: SelectItem[];\n /**\n * Input label (not displayed for now)\n *\n * @default default to the predicate id\n */\n label?: string;\n}\n\nexport const TablePredicate: FunctionComponent<TablePredicateProps> = ({\n id,\n data,\n label,\n classNames,\n styles,\n unstyled,\n ...others\n}) => {\n const {classes} = useStyles(null, {name: 'TablePredicate', classNames, styles, unstyled});\n const {
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/table/TablePredicate.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Grid, Group, Select, SelectItem, Selectors, Text} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nimport {TableComponentsOrder} from './Table.styles';\nimport {useTable} from './TableContext';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n wrapper: {},\n label: {},\n}));\n\ntype TablePredicateStylesNames = Selectors<typeof useStyles>;\n\ninterface TablePredicateProps extends DefaultProps<TablePredicateStylesNames> {\n /**\n * Unique identifier for this predicate. Will be used to access the selected value in the table state\n */\n id: string;\n /**\n * The values to display in the predicate\n */\n data: SelectItem[];\n /**\n * Input label (not displayed for now)\n *\n * @default default to the predicate id\n */\n label?: string;\n}\n\nexport const TablePredicate: FunctionComponent<TablePredicateProps> = ({\n id,\n data,\n label,\n classNames,\n styles,\n unstyled,\n ...others\n}) => {\n const {classes} = useStyles(null, {name: 'TablePredicate', classNames, styles, unstyled});\n const {form} = useTable();\n\n const onUpdate = (newValue: string) => {\n form.setFieldValue('predicates', {...form.values.predicates, [id]: newValue});\n };\n\n return (\n <Grid.Col span=\"content\" order={TableComponentsOrder.Predicate} py=\"sm\" className={classes.root} {...others}>\n <Group spacing=\"xs\" className={classes.wrapper}>\n {label ? <Text className={classes.label}>{label}:</Text> : null}\n <Select\n withinPortal\n value={form.values.predicates[id]}\n onChange={onUpdate}\n data={data}\n aria-label={label ?? id}\n searchable={data.length > 7}\n />\n </Group>\n </Grid.Col>\n );\n};\n"],"names":["createStyles","Grid","Group","Select","Text","TableComponentsOrder","useTable","useStyles","theme","root","wrapper","label","TablePredicate","id","data","classNames","styles","unstyled","others","classes","name","form","onUpdate","newValue","setFieldValue","values","predicates","Col","span","order","Predicate","py","className","spacing","withinPortal","value","onChange","aria-label","searchable","length"],"mappings":";;;;;AAAA,SAAQA,YAAY,EAAgBC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAyBC,IAAI,QAAO,gBAAgB;AAG3G,SAAQC,oBAAoB,QAAO,iBAAiB;AACpD,SAAQC,QAAQ,QAAO,iBAAiB;AAExC,IAAMC,YAAYP,aAAa,SAACQ;WAAW;QACvCC,MAAM,CAAC;QACPC,SAAS,CAAC;QACVC,OAAO,CAAC;IACZ;;AAqBA,OAAO,IAAMC,iBAAyD;QAClEC,YAAAA,IACAC,cAAAA,MACAH,eAAAA,OACAI,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACGC;QANHL;QACAC;QACAH;QACAI;QACAC;QACAC;;IAGA,IAAM,AAACE,UAAWZ,UAAU,MAAM;QAACa,MAAM;QAAkBL,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,GAAhFE;IACP,IAAM,AAACE,OAAQf,WAARe;IAEP,IAAMC,WAAW,SAACC;QACdF,KAAKG,cAAc,cAAc,wCAAIH,KAAKI,OAAOC,aAAY,qBAACb,IAAKU;IACvE;IAEA,qBACI,KAACtB,KAAK0B;QAAIC,MAAK;QAAUC,OAAOxB,qBAAqByB;QAAWC,IAAG;QAAKC,WAAWb,QAAQV;OAAUS;kBACjG,cAAA,MAAChB;YAAM+B,SAAQ;YAAKD,WAAWb,QAAQT;;gBAClCC,sBAAQ,MAACP;oBAAK4B,WAAWb,QAAQR;;wBAAQA;wBAAM;;qBAAW;8BAC3D,KAACR;oBACG+B,YAAY;oBACZC,OAAOd,KAAKI,OAAOC,UAAU,CAACb,GAAG;oBACjCuB,UAAUd;oBACVR,MAAMA;oBACNuB,cAAY1B,kBAAAA,mBAAAA,QAASE;oBACrByB,YAAYxB,KAAKyB,SAAS;;;;;AAK9C,EAAE"}
|
package/package.json
CHANGED
|
@@ -39,11 +39,10 @@ export const TablePredicate: FunctionComponent<TablePredicateProps> = ({
|
|
|
39
39
|
...others
|
|
40
40
|
}) => {
|
|
41
41
|
const {classes} = useStyles(null, {name: 'TablePredicate', classNames, styles, unstyled});
|
|
42
|
-
const {
|
|
42
|
+
const {form} = useTable();
|
|
43
43
|
|
|
44
44
|
const onUpdate = (newValue: string) => {
|
|
45
45
|
form.setFieldValue('predicates', {...form.values.predicates, [id]: newValue});
|
|
46
|
-
onChange?.();
|
|
47
46
|
};
|
|
48
47
|
|
|
49
48
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ColumnDef, createColumnHelper} from '@tanstack/table-core';
|
|
2
|
-
import {render, screen, userEvent, waitFor} from '@test-utils';
|
|
2
|
+
import {act, render, screen, userEvent, waitFor} from '@test-utils';
|
|
3
3
|
|
|
4
4
|
import {Table} from '../Table';
|
|
5
5
|
|
|
@@ -75,7 +75,7 @@ describe('Table.Predicate', () => {
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it('calls onChange when changing the predicate', async () => {
|
|
78
|
-
const user = userEvent.setup({
|
|
78
|
+
const user = userEvent.setup({advanceTimers: vi.advanceTimersByTime});
|
|
79
79
|
const onChange = vi.fn();
|
|
80
80
|
render(
|
|
81
81
|
<Table
|
|
@@ -96,33 +96,18 @@ describe('Table.Predicate', () => {
|
|
|
96
96
|
</Table>
|
|
97
97
|
);
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
expect(
|
|
101
|
-
screen.getByRole('searchbox', {
|
|
102
|
-
name: 'rank',
|
|
103
|
-
})
|
|
104
|
-
).toHaveValue('Second');
|
|
105
|
-
});
|
|
99
|
+
expect(screen.getByRole('searchbox', {name: 'rank'})).toHaveValue('Second');
|
|
106
100
|
|
|
107
|
-
await user.click(
|
|
108
|
-
screen.getByRole('searchbox', {
|
|
109
|
-
name: 'rank',
|
|
110
|
-
})
|
|
111
|
-
);
|
|
101
|
+
await user.click(screen.getByRole('searchbox', {name: 'rank'}));
|
|
112
102
|
|
|
113
|
-
await user.click(
|
|
114
|
-
screen.getByRole('option', {
|
|
115
|
-
name: 'First',
|
|
116
|
-
})
|
|
117
|
-
);
|
|
103
|
+
await user.click(screen.getByRole('option', {name: 'First'}));
|
|
118
104
|
|
|
119
|
-
expect(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
).toHaveValue('First');
|
|
124
|
-
vi.advanceTimersByTime(500);
|
|
105
|
+
expect(screen.getByRole('searchbox', {name: 'rank'})).toHaveValue('First');
|
|
106
|
+
act(() => {
|
|
107
|
+
vi.advanceTimersByTime(500);
|
|
108
|
+
});
|
|
125
109
|
|
|
110
|
+
expect(onChange).toHaveBeenCalledTimes(1);
|
|
126
111
|
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({predicates: {rank: 'first'}}));
|
|
127
112
|
});
|
|
128
113
|
});
|