@coveord/plasma-mantine 52.13.2 → 52.14.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.
Files changed (52) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +31 -31
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/components/copyToClipboard/CopyToClipboard.d.ts.map +1 -1
  5. package/dist/cjs/components/copyToClipboard/CopyToClipboard.js +1 -0
  6. package/dist/cjs/components/copyToClipboard/CopyToClipboard.js.map +1 -1
  7. package/dist/cjs/components/header/Header.d.ts.map +1 -1
  8. package/dist/cjs/components/header/Header.js +2 -1
  9. package/dist/cjs/components/header/Header.js.map +1 -1
  10. package/dist/cjs/components/header/__tests__/__snapshots__/Header.spec.tsx.snap +1 -1
  11. package/dist/cjs/components/inline-confirm/InlineConfirm.d.ts +1 -1
  12. package/dist/cjs/components/inline-confirm/InlineConfirm.d.ts.map +1 -1
  13. package/dist/cjs/components/inline-confirm/InlineConfirm.js.map +1 -1
  14. package/dist/cjs/components/table/TableFilter.d.ts.map +1 -1
  15. package/dist/cjs/components/table/TableFilter.js +17 -8
  16. package/dist/cjs/components/table/TableFilter.js.map +1 -1
  17. package/dist/cjs/components/table/TablePredicate.d.ts +1 -0
  18. package/dist/cjs/components/table/TablePredicate.d.ts.map +1 -1
  19. package/dist/cjs/components/table/TablePredicate.js +4 -2
  20. package/dist/cjs/components/table/TablePredicate.js.map +1 -1
  21. package/dist/cjs/theme/Plasmantine.d.ts +1 -1
  22. package/dist/cjs/theme/Plasmantine.d.ts.map +1 -1
  23. package/dist/cjs/theme/Plasmantine.js.map +1 -1
  24. package/dist/esm/components/copyToClipboard/CopyToClipboard.d.ts.map +1 -1
  25. package/dist/esm/components/copyToClipboard/CopyToClipboard.js +1 -0
  26. package/dist/esm/components/copyToClipboard/CopyToClipboard.js.map +1 -1
  27. package/dist/esm/components/header/Header.d.ts.map +1 -1
  28. package/dist/esm/components/header/Header.js +2 -1
  29. package/dist/esm/components/header/Header.js.map +1 -1
  30. package/dist/esm/components/header/__tests__/__snapshots__/Header.spec.tsx.snap +1 -1
  31. package/dist/esm/components/inline-confirm/InlineConfirm.d.ts +1 -1
  32. package/dist/esm/components/inline-confirm/InlineConfirm.d.ts.map +1 -1
  33. package/dist/esm/components/inline-confirm/InlineConfirm.js.map +1 -1
  34. package/dist/esm/components/table/TableFilter.d.ts.map +1 -1
  35. package/dist/esm/components/table/TableFilter.js +18 -9
  36. package/dist/esm/components/table/TableFilter.js.map +1 -1
  37. package/dist/esm/components/table/TablePredicate.d.ts +1 -0
  38. package/dist/esm/components/table/TablePredicate.d.ts.map +1 -1
  39. package/dist/esm/components/table/TablePredicate.js +4 -2
  40. package/dist/esm/components/table/TablePredicate.js.map +1 -1
  41. package/dist/esm/theme/Plasmantine.d.ts +1 -1
  42. package/dist/esm/theme/Plasmantine.d.ts.map +1 -1
  43. package/dist/esm/theme/Plasmantine.js.map +1 -1
  44. package/package.json +17 -17
  45. package/src/components/copyToClipboard/CopyToClipboard.tsx +1 -0
  46. package/src/components/header/Header.tsx +1 -0
  47. package/src/components/header/__tests__/__snapshots__/Header.spec.tsx.snap +1 -1
  48. package/src/components/inline-confirm/InlineConfirm.tsx +1 -1
  49. package/src/components/table/TableFilter.tsx +15 -10
  50. package/src/components/table/TablePredicate.tsx +2 -0
  51. package/src/components/table/__tests__/TableFilter.spec.tsx +20 -5
  52. package/src/theme/Plasmantine.tsx +1 -1
@@ -10,7 +10,8 @@ var useStyles = createStyles(function(theme) {
10
10
  return {
11
11
  root: {},
12
12
  wrapper: {},
13
- label: {}
13
+ label: {},
14
+ select: {}
14
15
  };
15
16
  });
16
17
  export var TablePredicate = function(_param) {
@@ -55,7 +56,8 @@ export var TablePredicate = function(_param) {
55
56
  onChange: onUpdate,
56
57
  data: data,
57
58
  "aria-label": label !== null && label !== void 0 ? label : id,
58
- searchable: data.length > 7
59
+ searchable: data.length > 7,
60
+ className: classes.select
59
61
  })
60
62
  ]
61
63
  })
@@ -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 {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,aAAa,CAAC,cAAc,wCAAIH,KAAKI,MAAM,CAACC,UAAU,GAAE,qBAACb,IAAKU;IACvE;IAEA,qBACI,KAACtB,KAAK0B,GAAG;QAACC,MAAK;QAAUC,OAAOxB,qBAAqByB,SAAS;QAAEC,IAAG;QAAKC,WAAWb,QAAQV,IAAI;OAAMS;kBACjG,cAAA,MAAChB;YAAM+B,SAAQ;YAAKD,WAAWb,QAAQT,OAAO;;gBACzCC,sBAAQ,MAACP;oBAAK4B,WAAWb,QAAQR,KAAK;;wBAAGA;wBAAM;;qBAAW;8BAC3D,KAACR;oBACG+B,YAAY;oBACZC,OAAOd,KAAKI,MAAM,CAACC,UAAU,CAACb,GAAG;oBACjCuB,UAAUd;oBACVR,MAAMA;oBACNuB,cAAY1B,kBAAAA,mBAAAA,QAASE;oBACrByB,YAAYxB,KAAKyB,MAAM,GAAG;;;;;AAK9C,EAAE"}
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 select: {}\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 className={classes.select}\n />\n </Group>\n </Grid.Col>\n );\n};\n"],"names":["createStyles","Grid","Group","Select","Text","TableComponentsOrder","useTable","useStyles","theme","root","wrapper","label","select","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;QACRC,QAAQ,CAAC;IACb;;AAqBA,OAAO,IAAMC,iBAAyD;QAClEC,YAAAA,IACAC,cAAAA,MACAJ,eAAAA,OACAK,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACGC;QANHL;QACAC;QACAJ;QACAK;QACAC;QACAC;;IAGA,IAAM,AAACE,UAAWb,UAAU,MAAM;QAACc,MAAM;QAAkBL,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,GAAhFE;IACP,IAAM,AAACE,OAAQhB,WAARgB;IAEP,IAAMC,WAAW,SAACC;QACdF,KAAKG,aAAa,CAAC,cAAc,wCAAIH,KAAKI,MAAM,CAACC,UAAU,GAAE,qBAACb,IAAKU;IACvE;IAEA,qBACI,KAACvB,KAAK2B,GAAG;QAACC,MAAK;QAAUC,OAAOzB,qBAAqB0B,SAAS;QAAEC,IAAG;QAAKC,WAAWb,QAAQX,IAAI;OAAMU;kBACjG,cAAA,MAACjB;YAAMgC,SAAQ;YAAKD,WAAWb,QAAQV,OAAO;;gBACzCC,sBAAQ,MAACP;oBAAK6B,WAAWb,QAAQT,KAAK;;wBAAGA;wBAAM;;qBAAW;8BAC3D,KAACR;oBACGgC,YAAY;oBACZC,OAAOd,KAAKI,MAAM,CAACC,UAAU,CAACb,GAAG;oBACjCuB,UAAUd;oBACVR,MAAMA;oBACNuB,cAAY3B,kBAAAA,mBAAAA,QAASG;oBACrByB,YAAYxB,KAAKyB,MAAM,GAAG;oBAC1BP,WAAWb,QAAQR,MAAM;;;;;AAK7C,EAAE"}
@@ -1,3 +1,3 @@
1
1
  import { FunctionComponent, PropsWithChildren } from 'react';
2
- export declare const Plasmantine: FunctionComponent<PropsWithChildren>;
2
+ export declare const Plasmantine: FunctionComponent<PropsWithChildren<unknown>>;
3
3
  //# sourceMappingURL=Plasmantine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Plasmantine.d.ts","sourceRoot":"","sources":["../../../src/theme/Plasmantine.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAI3D,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,iBAAiB,CAI5D,CAAC"}
1
+ {"version":3,"file":"Plasmantine.d.ts","sourceRoot":"","sources":["../../../src/theme/Plasmantine.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAI3D,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAIrE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/theme/Plasmantine.tsx"],"sourcesContent":["import {MantineProvider} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nimport {plasmaTheme} from './Theme';\n\nexport const Plasmantine: FunctionComponent<PropsWithChildren> = ({children}) => (\n <MantineProvider withGlobalStyles withNormalizeCSS theme={plasmaTheme}>\n {children}\n </MantineProvider>\n);\n"],"names":["MantineProvider","plasmaTheme","Plasmantine","children","withGlobalStyles","withNormalizeCSS","theme"],"mappings":";AAAA,SAAQA,eAAe,QAAO,gBAAgB;AAG9C,SAAQC,WAAW,QAAO,UAAU;AAEpC,OAAO,IAAMC,cAAoD;QAAEC,iBAAAA;yBAC/D,KAACH;QAAgBI,gBAAgB;QAACC,gBAAgB;QAACC,OAAOL;kBACrDE;;EAEP"}
1
+ {"version":3,"sources":["../../../src/theme/Plasmantine.tsx"],"sourcesContent":["import {MantineProvider} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nimport {plasmaTheme} from './Theme';\n\nexport const Plasmantine: FunctionComponent<PropsWithChildren<unknown>> = ({children}) => (\n <MantineProvider withGlobalStyles withNormalizeCSS theme={plasmaTheme}>\n {children}\n </MantineProvider>\n);\n"],"names":["MantineProvider","plasmaTheme","Plasmantine","children","withGlobalStyles","withNormalizeCSS","theme"],"mappings":";AAAA,SAAQA,eAAe,QAAO,gBAAgB;AAG9C,SAAQC,WAAW,QAAO,UAAU;AAEpC,OAAO,IAAMC,cAA6D;QAAEC,iBAAAA;yBACxE,KAACH;QAAgBI,gBAAgB;QAACC,gBAAgB;QAACC,OAAOL;kBACrDE;;EAEP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveord/plasma-mantine",
3
- "version": "52.13.2",
3
+ "version": "52.14.1",
4
4
  "description": "A Plasma flavoured Mantine theme",
5
5
  "keywords": [
6
6
  "plasma",
@@ -31,7 +31,7 @@
31
31
  "@dnd-kit/modifiers": "6.0.1",
32
32
  "@dnd-kit/sortable": "7.0.2",
33
33
  "@dnd-kit/utilities": "3.2.1",
34
- "@mantine/utils": "6.0.17",
34
+ "@mantine/utils": "6.0.19",
35
35
  "@monaco-editor/react": "4.5.1",
36
36
  "@swc/helpers": "0.5.1",
37
37
  "@tanstack/react-table": "8.9.3",
@@ -41,33 +41,33 @@
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.13.2",
45
- "@coveord/plasma-tokens": "52.13.2"
44
+ "@coveord/plasma-react-icons": "52.14.1",
45
+ "@coveord/plasma-tokens": "52.14.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@emotion/react": "11.11.1",
49
- "@mantine/carousel": "6.0.17",
50
- "@mantine/core": "6.0.17",
51
- "@mantine/dates": "6.0.17",
52
- "@mantine/form": "6.0.17",
53
- "@mantine/hooks": "6.0.17",
54
- "@mantine/modals": "6.0.17",
55
- "@mantine/notifications": "6.0.17",
49
+ "@mantine/carousel": "6.0.19",
50
+ "@mantine/core": "6.0.19",
51
+ "@mantine/dates": "6.0.19",
52
+ "@mantine/form": "6.0.19",
53
+ "@mantine/hooks": "6.0.19",
54
+ "@mantine/modals": "6.0.19",
55
+ "@mantine/notifications": "6.0.19",
56
56
  "@swc/cli": "0.1.62",
57
- "@swc/core": "1.3.74",
58
- "@swc/jest": "0.2.27",
59
- "@testing-library/jest-dom": "5.17.0",
57
+ "@swc/core": "1.3.76",
58
+ "@swc/jest": "0.2.29",
59
+ "@testing-library/jest-dom": "6.0.0",
60
60
  "@testing-library/react": "14.0.0",
61
61
  "@testing-library/user-event": "14.4.3",
62
62
  "@types/jest": "29.5.3",
63
63
  "@types/lodash.debounce": "^4.0.7",
64
64
  "@types/lodash.defaultsdeep": "4.6.7",
65
- "@types/react": "18.2.18",
65
+ "@types/react": "18.2.20",
66
66
  "@types/react-dom": "18.2.7",
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": "5.11.0",
70
+ "eslint-plugin-testing-library": "5.11.1",
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",
@@ -82,7 +82,7 @@
82
82
  "tslib": "2.6.1",
83
83
  "typescript": "5.1.6",
84
84
  "vitest": "0.34.1",
85
- "eslint-config-plasma": "52.13.2"
85
+ "eslint-config-plasma": "52.14.1"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@emotion/react": "^11.10.0",
@@ -52,6 +52,7 @@ export const CopyToClipboard: React.FunctionComponent<CopyToClipboardProps> = ({
52
52
  }}
53
53
  value={others.value}
54
54
  readOnly
55
+ autoComplete="off"
55
56
  rightSection={<CopyToClipboardButton {...others} />}
56
57
  />
57
58
  ) : (
@@ -44,6 +44,7 @@ export const Header: HeaderType = ({description, borderBottom, children, variant
44
44
  position="apart"
45
45
  p={variant === 'page' ? 'xl' : undefined}
46
46
  pb={variant === 'page' ? 'lg' : undefined}
47
+ noWrap
47
48
  {...others}
48
49
  >
49
50
  <Stack spacing={0}>
@@ -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-ogmezo"
6
+ class="mantine-Group-root mantine-1arn2xu"
7
7
  >
8
8
  <div
9
9
  class="mantine-Stack-root mantine-1178y6y"
@@ -5,7 +5,7 @@ import {InlineConfirmContext} from './InlineConfirmContext';
5
5
  import {InlineConfirmMenuItem} from './InlineConfirmMenuItem';
6
6
  import {InlineConfirmPrompt} from './InlineConfirmPrompt';
7
7
 
8
- type InlineConfirmType = FunctionComponent<PropsWithChildren> & {
8
+ type InlineConfirmType = FunctionComponent<PropsWithChildren<unknown>> & {
9
9
  Prompt: typeof InlineConfirmPrompt;
10
10
  Button: typeof InlineConfirmButton;
11
11
  MenuItem: typeof InlineConfirmMenuItem;
@@ -1,7 +1,8 @@
1
1
  import {CrossSize16Px, SearchSize16Px} from '@coveord/plasma-react-icons';
2
- import {ActionIcon, createStyles, DefaultProps, Grid, Selectors, TextInput} from '@mantine/core';
3
- import {ChangeEventHandler, FunctionComponent, MouseEventHandler} from 'react';
2
+ import {ActionIcon, DefaultProps, Grid, Selectors, TextInput, createStyles} from '@mantine/core';
3
+ import {ChangeEventHandler, FunctionComponent, MouseEventHandler, useState} from 'react';
4
4
 
5
+ import {useDebouncedValue, useDidUpdate} from '@mantine/hooks';
5
6
  import {TableComponentsOrder} from './Table.styles';
6
7
  import {useTable} from './TableContext';
7
8
 
@@ -34,24 +35,27 @@ export const TableFilter: FunctionComponent<TableFilterProps> = ({
34
35
  }) => {
35
36
  const {classes} = useStyles(null, {name: 'TableFilter', classNames, styles, unstyled});
36
37
  const {state, setState} = useTable();
38
+ const [filter, setFilter] = useState(state.globalFilter);
39
+ const [debounced, cancel] = useDebouncedValue(filter, 300);
37
40
 
38
- const changeFilterValue = (value: string) => {
41
+ useDidUpdate(() => {
39
42
  setState((prevState) => ({
40
43
  ...prevState,
41
44
  pagination: prevState.pagination
42
45
  ? {pageIndex: 0, pageSize: prevState.pagination.pageSize}
43
46
  : prevState.pagination,
44
- globalFilter: value,
47
+ globalFilter: debounced,
45
48
  }));
46
- };
49
+ return cancel;
50
+ }, [debounced]);
47
51
 
48
52
  const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {
49
53
  const {value} = event.currentTarget;
50
- changeFilterValue(value);
54
+ setFilter(value);
51
55
  };
52
56
 
53
57
  const handleClear: MouseEventHandler<HTMLButtonElement> = () => {
54
- changeFilterValue('');
58
+ setFilter('');
55
59
  };
56
60
 
57
61
  return (
@@ -59,17 +63,18 @@ export const TableFilter: FunctionComponent<TableFilterProps> = ({
59
63
  <TextInput
60
64
  className={classes.wrapper}
61
65
  placeholder={placeholder}
66
+ autoComplete="off"
62
67
  mb="md"
63
68
  rightSection={
64
- state.globalFilter ? (
69
+ filter ? (
65
70
  <ActionIcon onClick={handleClear}>
66
71
  <CrossSize16Px height={16} />
67
72
  </ActionIcon>
68
73
  ) : (
69
- <SearchSize16Px height={14} className={classes.empty} />
74
+ <SearchSize16Px height={16} className={classes.empty} />
70
75
  )
71
76
  }
72
- value={state.globalFilter}
77
+ value={filter}
73
78
  onChange={handleChange}
74
79
  {...others}
75
80
  />
@@ -8,6 +8,7 @@ const useStyles = createStyles((theme) => ({
8
8
  root: {},
9
9
  wrapper: {},
10
10
  label: {},
11
+ select: {}
11
12
  }));
12
13
 
13
14
  type TablePredicateStylesNames = Selectors<typeof useStyles>;
@@ -56,6 +57,7 @@ export const TablePredicate: FunctionComponent<TablePredicateProps> = ({
56
57
  data={data}
57
58
  aria-label={label ?? id}
58
59
  searchable={data.length > 7}
60
+ className={classes.select}
59
61
  />
60
62
  </Group>
61
63
  </Grid.Col>
@@ -1,5 +1,5 @@
1
1
  import {ColumnDef, createColumnHelper} from '@tanstack/table-core';
2
- import {render, screen, userEvent, within} from '@test-utils';
2
+ import {act, render, screen, userEvent, within} from '@test-utils';
3
3
 
4
4
  import {Table} from '../Table';
5
5
 
@@ -29,7 +29,7 @@ describe('Table.Filter', () => {
29
29
  });
30
30
 
31
31
  it('calls onChange when typing something in the filter', async () => {
32
- const user = userEvent.setup({delay: null});
32
+ const user = userEvent.setup({advanceTimers: vi.advanceTimersByTime});
33
33
  const onChange = vi.fn();
34
34
  render(
35
35
  <Table data={[{name: 'fruit'}, {name: 'vegetable'}]} columns={columns} onChange={onChange}>
@@ -40,13 +40,21 @@ describe('Table.Filter', () => {
40
40
  );
41
41
 
42
42
  await user.type(screen.getByRole('textbox'), 'vegetable');
43
- vi.advanceTimersByTime(500);
43
+
44
+ act(() => {
45
+ // 300 ms debounce on TableFilter input
46
+ vi.advanceTimersByTime(300);
47
+ });
48
+ act(() => {
49
+ // 500 ms debounce on Table onChange callback
50
+ vi.advanceTimersByTime(500);
51
+ });
44
52
 
45
53
  expect(onChange).toHaveBeenCalledWith(expect.objectContaining({globalFilter: 'vegetable'}));
46
54
  });
47
55
 
48
56
  it('goes back to the first page when changing the filter', async () => {
49
- const user = userEvent.setup({delay: null});
57
+ const user = userEvent.setup({advanceTimers: vi.advanceTimersByTime});
50
58
  const onChange = vi.fn();
51
59
  render(
52
60
  <Table data={[{name: 'fruit'}, {name: 'vegetable'}]} columns={columns} onChange={onChange}>
@@ -61,7 +69,14 @@ describe('Table.Filter', () => {
61
69
  );
62
70
 
63
71
  await user.type(screen.getByRole('textbox'), 'veg');
64
- vi.advanceTimersByTime(500);
72
+ act(() => {
73
+ // 300 ms debounce on TableFilter input
74
+ vi.advanceTimersByTime(300);
75
+ });
76
+ act(() => {
77
+ // 500 ms debounce on Table onChange callback
78
+ vi.advanceTimersByTime(500);
79
+ });
65
80
 
66
81
  expect(onChange).toHaveBeenCalledWith(
67
82
  expect.objectContaining({globalFilter: 'veg', pagination: {pageIndex: 0, pageSize: 50}}),
@@ -3,7 +3,7 @@ import {FunctionComponent, PropsWithChildren} from 'react';
3
3
 
4
4
  import {plasmaTheme} from './Theme';
5
5
 
6
- export const Plasmantine: FunctionComponent<PropsWithChildren> = ({children}) => (
6
+ export const Plasmantine: FunctionComponent<PropsWithChildren<unknown>> = ({children}) => (
7
7
  <MantineProvider withGlobalStyles withNormalizeCSS theme={plasmaTheme}>
8
8
  {children}
9
9
  </MantineProvider>