@coveord/plasma-mantine 47.7.0 → 47.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +9 -8
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/components/date-range-picker/EditableDateRangePicker.js +6 -6
  5. package/dist/cjs/components/date-range-picker/EditableDateRangePicker.js.map +1 -1
  6. package/dist/cjs/components/index.js +1 -0
  7. package/dist/cjs/components/index.js.map +1 -1
  8. package/dist/cjs/components/prompt/Prompt.js +100 -0
  9. package/dist/cjs/components/prompt/Prompt.js.map +1 -0
  10. package/dist/cjs/components/prompt/PromptFooter.js +25 -0
  11. package/dist/cjs/components/prompt/PromptFooter.js.map +1 -0
  12. package/dist/cjs/components/prompt/index.js +8 -0
  13. package/dist/cjs/components/prompt/index.js.map +1 -0
  14. package/dist/cjs/components/sticky-footer/StickyFooter.js.map +1 -1
  15. package/dist/cjs/components/table/TableDateRangePicker.js +1 -13
  16. package/dist/cjs/components/table/TableDateRangePicker.js.map +1 -1
  17. package/dist/cjs/components/table/Th.js +10 -1
  18. package/dist/cjs/components/table/Th.js.map +1 -1
  19. package/dist/definitions/components/date-range-picker/EditableDateRangePicker.d.ts.map +1 -1
  20. package/dist/definitions/components/index.d.ts +1 -0
  21. package/dist/definitions/components/index.d.ts.map +1 -1
  22. package/dist/definitions/components/prompt/Prompt.d.ts +14 -0
  23. package/dist/definitions/components/prompt/Prompt.d.ts.map +1 -0
  24. package/dist/definitions/components/prompt/PromptFooter.d.ts +6 -0
  25. package/dist/definitions/components/prompt/PromptFooter.d.ts.map +1 -0
  26. package/dist/definitions/components/prompt/index.d.ts +2 -0
  27. package/dist/definitions/components/prompt/index.d.ts.map +1 -0
  28. package/dist/definitions/components/sticky-footer/StickyFooter.d.ts +1 -2
  29. package/dist/definitions/components/sticky-footer/StickyFooter.d.ts.map +1 -1
  30. package/dist/definitions/components/table/TableDateRangePicker.d.ts.map +1 -1
  31. package/dist/definitions/components/table/Th.d.ts.map +1 -1
  32. package/dist/esm/components/date-range-picker/EditableDateRangePicker.js +5 -6
  33. package/dist/esm/components/date-range-picker/EditableDateRangePicker.js.map +1 -1
  34. package/dist/esm/components/index.js +1 -0
  35. package/dist/esm/components/index.js.map +1 -1
  36. package/dist/esm/components/prompt/Prompt.js +90 -0
  37. package/dist/esm/components/prompt/Prompt.js.map +1 -0
  38. package/dist/esm/components/prompt/PromptFooter.js +15 -0
  39. package/dist/esm/components/prompt/PromptFooter.js.map +1 -0
  40. package/dist/esm/components/prompt/index.js +3 -0
  41. package/dist/esm/components/prompt/index.js.map +1 -0
  42. package/dist/esm/components/sticky-footer/StickyFooter.js.map +1 -1
  43. package/dist/esm/components/table/TableDateRangePicker.js +1 -13
  44. package/dist/esm/components/table/TableDateRangePicker.js.map +1 -1
  45. package/dist/esm/components/table/Th.js +10 -1
  46. package/dist/esm/components/table/Th.js.map +1 -1
  47. package/package.json +1 -1
  48. package/src/components/date-range-picker/EditableDateRangePicker.tsx +5 -4
  49. package/src/components/date-range-picker/__tests__/DateRangePickerInlineCalendar.spec.tsx +5 -1
  50. package/src/components/date-range-picker/__tests__/DateRangePickerPopoverCalendar.spec.tsx +1 -1
  51. package/src/components/date-range-picker/__tests__/EditableDateRangePicker.spec.tsx +1 -1
  52. package/src/components/index.ts +1 -0
  53. package/src/components/prompt/Prompt.tsx +66 -0
  54. package/src/components/prompt/PromptFooter.tsx +8 -0
  55. package/src/components/prompt/__tests__/Prompt.spec.tsx +29 -0
  56. package/src/components/prompt/index.ts +1 -0
  57. package/src/components/sticky-footer/StickyFooter.tsx +1 -1
  58. package/src/components/table/TableDateRangePicker.tsx +1 -7
  59. package/src/components/table/Th.tsx +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => {\n const white = '#fff';\n return {\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md}px ${theme.spacing.xl}px ${theme.spacing.lg}px`,\n },\n header: {\n padding: `${theme.spacing.md}px ${theme.spacing.xl}px`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h4.fontSize,\n lineHeight: theme.headings.sizes.h4.fontSize,\n },\n default: {},\n success: {backgroundColor: theme.colors.lime[6], color: white},\n warning: {backgroundColor: theme.colors.yellow[5], color: white},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: white,\n },\n info: {backgroundColor: theme.colors.navy[5], color: white},\n whiteClose: {color: white, '&:hover': {backgroundColor: 'transparent'}},\n };\n});\n\nexport interface PromptProps extends ModalProps {\n variant: 'default' | 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant, size, ...otherProps}) => {\n const {classes, cx} = useStyles();\n const defaultVariant = variant === 'default';\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: !defaultVariant && classes.whiteClose,\n body: classes.body,\n modal: !defaultVariant && classes.modalType,\n };\n\n return (\n <Modal padding={0} classNames={classNames} size={defaultVariant ? size : 'sm'} {...otherProps}>\n <div className={classes.innerBody}>{otherChildren}</div>\n {footer}\n </Modal>\n );\n};\n\nPrompt.Footer = PromptFooter;\n"],"names":["createStyles","Modal","Children","PromptFooter","useStyles","theme","white","body","padding","modalType","overflow","width","innerBody","spacing","md","xl","lg","header","borderBottom","colors","gray","fontSize","headings","sizes","h4","lineHeight","default","success","backgroundColor","lime","color","warning","yellow","critical","red","info","navy","whiteClose","Prompt","children","variant","size","otherProps","classes","cx","defaultVariant","convertedChildren","toArray","otherChildren","filter","child","type","footer","find","classNames","close","modal","div","className","Footer"],"mappings":"AAAA;;;;AAAA,SAAQA,YAAY,EAAEC,KAAK,QAAmB,eAAe,CAAC;AAC9D,SAAQC,QAAQ,QAAgC,OAAO,CAAC;AACxD,SAAQC,YAAY,QAAO,gBAAgB,CAAC;AAE5C,IAAMC,SAAS,GAAGJ,YAAY,CAAC,SAACK,KAAK,EAAK;IACtC,IAAMC,KAAK,GAAG,MAAM,AAAC;IACrB,OAAO;QACHC,IAAI,EAAE;YACFC,OAAO,EAAE,CAAC;SACb;QACDC,SAAS,EAAE;YAACC,QAAQ,EAAE,QAAQ;YAAEC,KAAK,EAAE,GAAG;SAAC;QAC3CC,SAAS,EAAE;YACPJ,OAAO,EAAE,AAAC,EAAA,CAAwBH,MAAgB,CAAtCA,KAAK,CAACQ,OAAO,CAACC,EAAE,EAAC,KAAG,CAAmB,CAAKT,MAAgB,CAAtCA,KAAK,CAACQ,OAAO,CAACE,EAAE,EAAC,KAAG,CAAmB,CAAA,MAAE,CAAnBV,KAAK,CAACQ,OAAO,CAACG,EAAE,EAAC,IAAE,CAAC;SAC/E;QACDC,MAAM,EAAE;YACJT,OAAO,EAAE,AAAC,EAAA,CAAwBH,MAAgB,CAAtCA,KAAK,CAACQ,OAAO,CAACC,EAAE,EAAC,KAAG,CAAmB,CAAA,MAAE,CAAnBT,KAAK,CAACQ,OAAO,CAACE,EAAE,EAAC,IAAE,CAAC;YACtDJ,KAAK,EAAE,MAAM;YACbO,YAAY,EAAE,AAAC,YAAU,CAAuB,MAAA,CAArBb,KAAK,CAACc,MAAM,CAACC,IAAI,CAAC,CAAC,CAAC,CAAE;YACjDC,QAAQ,EAAEhB,KAAK,CAACiB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACH,QAAQ;YAC1CI,UAAU,E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,KAAK;eAAKA,KAAK,CAACC,IAAI,KAAKhD,YAAY;KAAA,CAAC,AAAC;IACvF,IAAMiD,MAAM,GAAGN,iBAAiB,CAACO,IAAI,CAAC,SAACH,KAAK;eAAKA,KAAK,CAACC,IAAI,KAAKhD,YAAY;KAAA,CAAC,AAAC;IAE9E,IAAMmD,UAAU,GAAG;QACfrC,MAAM,EAAE2B,EAAE,CAACD,OAAO,CAAC1B,MAAM,EAAE0B,OAAO,CAACH,OAAO,CAAC,CAAC;QAC5Ce,KAAK,EAAE,CAACV,cAAc,IAAIF,OAAO,CAACN,UAAU;QAC5C9B,IAAI,EAAEoC,OAAO,CAACpC,IAAI;QAClBiD,KAAK,EAAE,CAACX,cAAc,IAAIF,OAAO,CAAClC,SAAS;KAC9C,AAAC;IAEF,qBACI,MAACR,KAAK;QAACO,OAAO,EAAE,CAAC;QAAE8C,UAAU,EAAEA,UAAU;QAAEb,IAAI,EAAEI,cAAc,GAAGJ,IAAI,GAAG,IAAI;OAAMC,UAAU;;0BACzF,KAACe,KAAG;gBAACC,SAAS,EAAEf,OAAO,CAAC/B,SAAS;0BAAGoC,aAAa;cAAO;YACvDI,MAAM;;OACH,CACV;AACN,CAAC,CAAC;AAEFd,MAAM,CAACqB,MAAM,GAAGxD,YAAY,CAAC"}
@@ -0,0 +1,15 @@
1
+ import _object_spread from "@swc/helpers/src/_object_spread.mjs";
2
+ import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
3
+ import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { StickyFooter } from "../sticky-footer";
6
+ export var PromptFooter = function(_param) /*#__PURE__*/ {
7
+ var children = _param.children, otherProps = _object_without_properties(_param, [
8
+ "children"
9
+ ]);
10
+ return _jsx(StickyFooter, _object_spread_props(_object_spread({}, otherProps), {
11
+ children: children
12
+ }));
13
+ };
14
+
15
+ //# sourceMappingURL=PromptFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/prompt/PromptFooter.tsx"],"sourcesContent":["import {FunctionComponent} from 'react';\nimport {StickyFooter, StickyFooterProps} from '../sticky-footer';\n\nexport interface PromptFooterProps extends StickyFooterProps {}\n\nexport const PromptFooter: FunctionComponent<PromptFooterProps> = ({children, ...otherProps}) => (\n <StickyFooter {...otherProps}>{children}</StickyFooter>\n);\n"],"names":["StickyFooter","PromptFooter","children","otherProps"],"mappings":"AAAA;;;;AACA,SAAQA,YAAY,QAA0B,kBAAkB,CAAC;AAIjE,OAAO,IAAMC,YAAY,GAAyC,+BAC9D;QADgEC,QAAQ,UAARA,QAAQ,EAAKC,UAAU;QAAvBD,UAAQ;;WACxE,KAACF,YAAY,0CAAKG,UAAU;kBAAGD,QAAQ;OAAgB;AAAD,CACzD,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./Prompt";
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/prompt/index.ts"],"sourcesContent":["export * from './Prompt';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Divider, Group, Paper} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\ninterface StickyFooterProps extends DefaultProps {\n /**\n * Whether a border is render on top of the footer\n */\n borderTop?: boolean;\n}\n\nconst useStyles = createStyles(() => ({\n footer: {\n position: 'sticky',\n bottom: 0,\n zIndex: 1,\n maxHeight: '80px',\n },\n}));\n\nexport const StickyFooter: FunctionComponent<StickyFooterProps> = ({borderTop, children, ...others}) => {\n const {classes} = useStyles();\n\n return (\n <Paper className={classes.footer}>\n {borderTop ? <Divider size=\"xs\" /> : null}\n <Group position=\"right\" spacing=\"xs\" py=\"md\" px=\"xl\" {...others}>\n {children}\n </Group>\n </Paper>\n );\n};\n"],"names":["createStyles","Divider","Group","Paper","useStyles","footer","position","bottom","zIndex","maxHeight","StickyFooter","borderTop","children","others","classes","className","size","spacing","py","px"],"mappings":"AAAA;;;;AAAA,SAAQA,YAAY,EAAgBC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAO,eAAe,CAAC;AAUhF,IAAMC,SAAS,GAAGJ,YAAY,CAAC;WAAO;QAClCK,MAAM,EAAE;YACJC,QAAQ,EAAE,QAAQ;YAClBC,MAAM,EAAE,CAAC;YACTC,MAAM,EAAE,CAAC;YACTC,SAAS,EAAE,MAAM;SACpB;KACJ;CAAC,CAAC,AAAC;AAEJ,OAAO,IAAMC,YAAY,GAAyC,iBAAsC;QAApCC,SAAS,UAATA,SAAS,EAAEC,QAAQ,UAARA,QAAQ,EAAKC,MAAM;QAA9BF,WAAS;QAAEC,UAAQ;;IACnF,IAAM,AAACE,OAAO,GAAIV,SAAS,EAAE,CAAtBU,OAAO,AAAe,AAAC;IAE9B,qBACI,MAACX,KAAK;QAACY,SAAS,EAAED,OAAO,CAACT,MAAM;;YAC3BM,SAAS,iBAAG,KAACV,OAAO;gBAACe,IAAI,EAAC,IAAI;cAAG,GAAG,IAAI;0BACzC,KAACd,KAAK;gBAACI,QAAQ,EAAC,OAAO;gBAACW,OAAO,EAAC,IAAI;gBAACC,EAAE,EAAC,IAAI;gBAACC,EAAE,EAAC,IAAI;eAAKN,MAAM;0BAC1DD,QAAQ;eACL;;MACJ,CACV;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Divider, Group, Paper} from '@mantine/core';\nimport {FunctionComponent} from 'react';\n\nexport interface StickyFooterProps extends DefaultProps {\n /**\n * Whether a border is render on top of the footer\n */\n borderTop?: boolean;\n}\n\nconst useStyles = createStyles(() => ({\n footer: {\n position: 'sticky',\n bottom: 0,\n zIndex: 1,\n maxHeight: '80px',\n },\n}));\n\nexport const StickyFooter: FunctionComponent<StickyFooterProps> = ({borderTop, children, ...others}) => {\n const {classes} = useStyles();\n\n return (\n <Paper className={classes.footer}>\n {borderTop ? <Divider size=\"xs\" /> : null}\n <Group position=\"right\" spacing=\"xs\" py=\"md\" px=\"xl\" {...others}>\n {children}\n </Group>\n </Paper>\n );\n};\n"],"names":["createStyles","Divider","Group","Paper","useStyles","footer","position","bottom","zIndex","maxHeight","StickyFooter","borderTop","children","others","classes","className","size","spacing","py","px"],"mappings":"AAAA;;;;AAAA,SAAQA,YAAY,EAAgBC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAO,eAAe,CAAC;AAUhF,IAAMC,SAAS,GAAGJ,YAAY,CAAC;WAAO;QAClCK,MAAM,EAAE;YACJC,QAAQ,EAAE,QAAQ;YAClBC,MAAM,EAAE,CAAC;YACTC,MAAM,EAAE,CAAC;YACTC,SAAS,EAAE,MAAM;SACpB;KACJ;CAAC,CAAC,AAAC;AAEJ,OAAO,IAAMC,YAAY,GAAyC,iBAAsC;QAApCC,SAAS,UAATA,SAAS,EAAEC,QAAQ,UAARA,QAAQ,EAAKC,MAAM;QAA9BF,WAAS;QAAEC,UAAQ;;IACnF,IAAM,AAACE,OAAO,GAAIV,SAAS,EAAE,CAAtBU,OAAO,AAAe,AAAC;IAE9B,qBACI,MAACX,KAAK;QAACY,SAAS,EAAED,OAAO,CAACT,MAAM;;YAC3BM,SAAS,iBAAG,KAACV,OAAO;gBAACe,IAAI,EAAC,IAAI;cAAG,GAAG,IAAI;0BACzC,KAACd,KAAK;gBAACI,QAAQ,EAAC,OAAO;gBAACW,OAAO,EAAC,IAAI;gBAACC,EAAE,EAAC,IAAI;gBAACC,EAAE,EAAC,IAAI;eAAKN,MAAM;0BAC1DD,QAAQ;eACL;;MACJ,CACV;AACN,CAAC,CAAC"}
@@ -11,19 +11,7 @@ export var TableDateRangePicker = function(param) {
11
11
  var ref = _sliced_to_array(useState(false), 2), opened = ref[0], setOpened = ref[1];
12
12
  var form = useTable().form;
13
13
  var onApply = function(dates) {
14
- if (dates[0] !== null && dates[1] !== null) {
15
- form.setFieldValue("dateRange", dates);
16
- } else if (dates[1] === null) {
17
- form.setFieldValue("dateRange", [
18
- dates[0],
19
- dates[0]
20
- ]);
21
- } else {
22
- form.setFieldValue("dateRange", [
23
- dates[1],
24
- dates[1]
25
- ]);
26
- }
14
+ form.setFieldValue("dateRange", dates);
27
15
  setOpened(false);
28
16
  };
29
17
  var onCancel = function() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/TableDateRangePicker.tsx"],"sourcesContent":["import {CalendarSize24Px} from '@coveord/plasma-react-icons';\nimport {Popover, Button} from '@mantine/core';\nimport {DateRangePickerValue} from '@mantine/dates';\nimport dayjs from 'dayjs';\nimport {FunctionComponent, useState} from 'react';\nimport {DateRangePickerInlineCalendar, DateRangePickerInlineCalendarProps} from '../date-range-picker';\nimport {DateRangePickerPreset} from '../date-range-picker/DateRangePickerPresetSelect';\nimport {useTable} from './useTable';\n\ninterface TableDateRangePickerProps\n extends Pick<DateRangePickerInlineCalendarProps, 'startProps' | 'endProps' | 'rangeCalendarProps'> {\n /**\n * An object containing date presets.\n * If empty the preset dropdown won't be shown\n *\n * @example\n * {\n * january: {label: 'January', range: [new Date(2022, 0, 1), new Date(2022, 0, 31)]},\n * february: {label: 'February', range: [new Date(2022, 1, 1), new Date(2022, 1, 28)]}\n * }\n * @default {}\n */\n presets?: Record<string, DateRangePickerPreset>;\n}\n\nexport const TableDateRangePicker: FunctionComponent<TableDateRangePickerProps> = ({\n presets = {},\n rangeCalendarProps,\n}) => {\n const [opened, setOpened] = useState(false);\n const {form} = useTable();\n\n const onApply = (dates: DateRangePickerValue) => {\n if (dates[0] !== null && dates[1] !== null) {\n form.setFieldValue('dateRange', dates);\n } else if (dates[1] === null) {\n form.setFieldValue('dateRange', [dates[0], dates[0]]);\n } else {\n form.setFieldValue('dateRange', [dates[1], dates[1]]);\n }\n setOpened(false);\n };\n const onCancel = () => {\n setOpened(false);\n };\n\n const formatDate = (date: Date) => dayjs(date).format('MMM DD, YYYY');\n const formatedRange = `${formatDate(form.values.dateRange[0])} - ${formatDate(form.values.dateRange[1])}`;\n\n return (\n <>\n {formatedRange}\n <Popover opened={opened} onChange={setOpened}>\n <Popover.Target>\n <Button variant=\"outline\" color=\"gray\" onClick={() => setOpened(true)} px=\"xs\">\n <CalendarSize24Px width={24} height={24} />\n </Button>\n </Popover.Target>\n <Popover.Dropdown p={0}>\n <DateRangePickerInlineCalendar\n initialRange={form.values.dateRange}\n onApply={onApply}\n onCancel={onCancel}\n presets={presets}\n rangeCalendarProps={rangeCalendarProps}\n />\n </Popover.Dropdown>\n </Popover>\n </>\n );\n};\n"],"names":["CalendarSize24Px","Popover","Button","dayjs","useState","DateRangePickerInlineCalendar","useTable","TableDateRangePicker","presets","rangeCalendarProps","opened","setOpened","form","onApply","dates","setFieldValue","onCancel","formatDate","date","format","formatedRange","values","dateRange","onChange","Target","variant","color","onClick","px","width","height","Dropdown","p","initialRange"],"mappings":"AAAA;;AAAA,SAAQA,gBAAgB,QAAO,6BAA6B,CAAC;AAC7D,SAAQC,OAAO,EAAEC,MAAM,QAAO,eAAe,CAAC;AAE9C,OAAOC,KAAK,MAAM,OAAO,CAAC;AAC1B,SAA2BC,QAAQ,QAAO,OAAO,CAAC;AAClD,SAAQC,6BAA6B,QAA2C,sBAAsB,CAAC;AAEvG,SAAQC,QAAQ,QAAO,YAAY,CAAC;AAkBpC,OAAO,IAAMC,oBAAoB,GAAiD,gBAG5E;yBAFFC,OAAO,EAAPA,OAAO,yBAAG,EAAE,WAAA,EACZC,kBAAkB,SAAlBA,kBAAkB;IAElB,IAA4BL,GAAe,oBAAfA,QAAQ,CAAC,KAAK,CAAC,IAAA,EAApCM,MAAM,GAAeN,GAAe,GAA9B,EAAEO,SAAS,GAAIP,GAAe,GAAnB,AAAoB;IAC5C,IAAM,AAACQ,IAAI,GAAIN,QAAQ,EAAE,CAAlBM,IAAI,AAAc,AAAC;IAE1B,IAAMC,OAAO,GAAG,SAACC,KA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,EAAE;uCAAMhB,SAAS,CAAC,IAAI,CAAC;6BAAA;4BAAEiB,EAAE,EAAC,IAAI;sCAC1E,cAAA,KAAC5B,gBAAgB;gCAAC6B,KAAK,EAAE,EAAE;gCAAEC,MAAM,EAAE,EAAE;8BAAI;0BACtC;sBACI;kCACjB,KAAC7B,OAAO,CAAC8B,QAAQ;wBAACC,CAAC,EAAE,CAAC;kCAClB,cAAA,KAAC3B,6BAA6B;4BAC1B4B,YAAY,EAAErB,IAAI,CAACS,MAAM,CAACC,SAAS;4BACnCT,OAAO,EAAEA,OAAO;4BAChBG,QAAQ,EAAEA,QAAQ;4BAClBR,OAAO,EAAEA,OAAO;4BAChBC,kBAAkB,EAAEA,kBAAkB;0BACxC;sBACa;;cACb;;MACX,CACL;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/table/TableDateRangePicker.tsx"],"sourcesContent":["import {CalendarSize24Px} from '@coveord/plasma-react-icons';\nimport {Popover, Button} from '@mantine/core';\nimport {DateRangePickerValue} from '@mantine/dates';\nimport dayjs from 'dayjs';\nimport {FunctionComponent, useState} from 'react';\nimport {DateRangePickerInlineCalendar, DateRangePickerInlineCalendarProps} from '../date-range-picker';\nimport {DateRangePickerPreset} from '../date-range-picker/DateRangePickerPresetSelect';\nimport {useTable} from './useTable';\n\ninterface TableDateRangePickerProps\n extends Pick<DateRangePickerInlineCalendarProps, 'startProps' | 'endProps' | 'rangeCalendarProps'> {\n /**\n * An object containing date presets.\n * If empty the preset dropdown won't be shown\n *\n * @example\n * {\n * january: {label: 'January', range: [new Date(2022, 0, 1), new Date(2022, 0, 31)]},\n * february: {label: 'February', range: [new Date(2022, 1, 1), new Date(2022, 1, 28)]}\n * }\n * @default {}\n */\n presets?: Record<string, DateRangePickerPreset>;\n}\n\nexport const TableDateRangePicker: FunctionComponent<TableDateRangePickerProps> = ({\n presets = {},\n rangeCalendarProps,\n}) => {\n const [opened, setOpened] = useState(false);\n const {form} = useTable();\n\n const onApply = (dates: DateRangePickerValue) => {\n form.setFieldValue('dateRange', dates);\n setOpened(false);\n };\n const onCancel = () => {\n setOpened(false);\n };\n\n const formatDate = (date: Date) => dayjs(date).format('MMM DD, YYYY');\n const formatedRange = `${formatDate(form.values.dateRange[0])} - ${formatDate(form.values.dateRange[1])}`;\n\n return (\n <>\n {formatedRange}\n <Popover opened={opened} onChange={setOpened}>\n <Popover.Target>\n <Button variant=\"outline\" color=\"gray\" onClick={() => setOpened(true)} px=\"xs\">\n <CalendarSize24Px width={24} height={24} />\n </Button>\n </Popover.Target>\n <Popover.Dropdown p={0}>\n <DateRangePickerInlineCalendar\n initialRange={form.values.dateRange}\n onApply={onApply}\n onCancel={onCancel}\n presets={presets}\n rangeCalendarProps={rangeCalendarProps}\n />\n </Popover.Dropdown>\n </Popover>\n </>\n );\n};\n"],"names":["CalendarSize24Px","Popover","Button","dayjs","useState","DateRangePickerInlineCalendar","useTable","TableDateRangePicker","presets","rangeCalendarProps","opened","setOpened","form","onApply","dates","setFieldValue","onCancel","formatDate","date","format","formatedRange","values","dateRange","onChange","Target","variant","color","onClick","px","width","height","Dropdown","p","initialRange"],"mappings":"AAAA;;AAAA,SAAQA,gBAAgB,QAAO,6BAA6B,CAAC;AAC7D,SAAQC,OAAO,EAAEC,MAAM,QAAO,eAAe,CAAC;AAE9C,OAAOC,KAAK,MAAM,OAAO,CAAC;AAC1B,SAA2BC,QAAQ,QAAO,OAAO,CAAC;AAClD,SAAQC,6BAA6B,QAA2C,sBAAsB,CAAC;AAEvG,SAAQC,QAAQ,QAAO,YAAY,CAAC;AAkBpC,OAAO,IAAMC,oBAAoB,GAAiD,gBAG5E;yBAFFC,OAAO,EAAPA,OAAO,yBAAG,EAAE,WAAA,EACZC,kBAAkB,SAAlBA,kBAAkB;IAElB,IAA4BL,GAAe,oBAAfA,QAAQ,CAAC,KAAK,CAAC,IAAA,EAApCM,MAAM,GAAeN,GAAe,GAA9B,EAAEO,SAAS,GAAIP,GAAe,GAAnB,AAAoB;IAC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nCT,OAAO,EAAEA,OAAO;4BAChBG,QAAQ,EAAEA,QAAQ;4BAClBR,OAAO,EAAEA,OAAO;4BAChBC,kBAAkB,EAAEA,kBAAkB;0BACxC;sBACa;;cACb;;MACX,CACL;AACN,CAAC,CAAC"}
@@ -7,7 +7,16 @@ var useStyles = createStyles(function(theme) {
7
7
  th: {
8
8
  padding: "0 !important",
9
9
  fontWeight: "400 !important",
10
- color: theme.black + "!important"
10
+ color: theme.black + "!important",
11
+ button: {
12
+ padding: "8px 16px",
13
+ div: {
14
+ padding: "0px !important"
15
+ }
16
+ },
17
+ div: {
18
+ padding: "8px 16px"
19
+ }
11
20
  },
12
21
  noSort: {
13
22
  padding: "".concat(theme.spacing.xs, "px ").concat(theme.spacing.md, "px")
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/Th.tsx"],"sourcesContent":["import {ArrowHeadDownSize16Px, ArrowHeadUpSize16Px} from '@coveord/plasma-react-icons';\nimport {Center, createStyles, Group, Text, UnstyledButton} from '@mantine/core';\nimport {defaultColumnSizing, flexRender, Header} from '@tanstack/react-table';\n\nconst useStyles = createStyles((theme) => ({\n th: {\n padding: '0 !important',\n fontWeight: '400 !important' as any,\n color: theme.black + '!important',\n },\n\n noSort: {\n padding: `${theme.spacing.xs}px ${theme.spacing.md}px`,\n },\n\n control: {\n width: '100%',\n padding: `${theme.spacing.xs}px ${theme.spacing.md}px`,\n\n '&:hover': {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.gray[6] : theme.colors.gray[2],\n },\n },\n}));\n\ninterface ThProps<T> {\n header: Header<T, unknown>;\n}\n\nconst SortingIcons = {\n asc: ArrowHeadDownSize16Px,\n desc: ArrowHeadUpSize16Px,\n};\n\nconst SortingLabels = {\n asc: 'ascending',\n desc: 'descending',\n} as const;\n\nexport const Th = <T,>({header}: ThProps<T>) => {\n const {classes} = useStyles();\n const size = header.column.getSize();\n const width = size !== defaultColumnSizing.size ? size : undefined;\n\n if (header.isPlaceholder) {\n return null;\n }\n\n if (!header.column.getCanSort()) {\n return (\n <th className={classes.th} style={{width}}>\n <Text className={classes.noSort} size=\"xs\">\n {flexRender(header.column.columnDef.header, header.getContext())}\n </Text>\n </th>\n );\n }\n\n const onSort = header.column.getToggleSortingHandler();\n const sortingOrder = header.column.getIsSorted();\n const Icon = SortingIcons[sortingOrder || header.column.getFirstSortDir()];\n\n return (\n <th className={classes.th} style={{width}} aria-sort={sortingOrder ? SortingLabels[sortingOrder] : 'none'}>\n <UnstyledButton onClick={onSort} className={classes.control}>\n <Group position=\"apart\">\n <Text size=\"xs\">{flexRender(header.column.columnDef.header, header.getContext())}</Text>\n <Center sx={(theme) => ({color: sortingOrder ? theme.colors.action[8] : undefined})}>\n <Icon height={14} />\n </Center>\n </Group>\n </UnstyledButton>\n </th>\n );\n};\n"],"names":["ArrowHeadDownSize16Px","ArrowHeadUpSize16Px","Center","createStyles","Group","Text","UnstyledButton","defaultColumnSizing","flexRender","useStyles","theme","th","padding","fontWeight","color","black","noSort","spacing","xs","md","control","width","backgroundColor","colorScheme","colors","gray","SortingIcons","asc","desc","SortingLabels","Th","header","classes","size","column","getSize","undefined","isPlaceholder","getCanSort","className","style","columnDef","getContext","onSort","getToggleSortingHandler","sortingOrder","getIsSorted","Icon","getFirstSortDir","aria-sort","onClick","position","sx","action","height"],"mappings":"AAAA;AAAA,SAAQA,qBAAqB,EAAEC,mBAAmB,QAAO,6BAA6B,CAAC;AACvF,SAAQC,MAAM,EAAEC,YAAY,EAAEC,KAAK,EAAEC,IAAI,EAAEC,cAAc,QAAO,eAAe,CAAC;AAChF,SAAQC,mBAAmB,EAAEC,UAAU,QAAe,uBAAuB,CAAC;AAE9E,IAAMC,SAAS,GAAGN,YAAY,CAAC,SAACO,KAAK;WAAM;QACvCC,EAAE,EAAE;YACAC,OAAO,EAAE,cAAc;YACvBC,UAAU,EAAE,gBAAgB;YAC5BC,KAAK,EAAEJ,KAAK,CAACK,KAAK,GAAG,YAAY;SACpC;QAEDC,MAA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M,CAAC6B,MAAM,CAAC,CAAC,CAAC,GAAGjB,SAAS;6BAAC;yBAAC;kCAC/E,cAAA,KAACW,IAAI;4BAACO,MAAM,EAAE,EAAE;0BAAI;sBACf;;cACL;UACK;MAChB,CACP;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/components/table/Th.tsx"],"sourcesContent":["import {ArrowHeadDownSize16Px, ArrowHeadUpSize16Px} from '@coveord/plasma-react-icons';\nimport {Center, createStyles, Group, Text, UnstyledButton} from '@mantine/core';\nimport {defaultColumnSizing, flexRender, Header} from '@tanstack/react-table';\n\nconst useStyles = createStyles((theme) => ({\n th: {\n padding: '0 !important',\n fontWeight: '400 !important' as any,\n color: theme.black + '!important',\n button: {\n padding: '8px 16px',\n div: {\n padding: '0px !important',\n },\n },\n div: {\n padding: '8px 16px',\n },\n },\n\n noSort: {\n padding: `${theme.spacing.xs}px ${theme.spacing.md}px`,\n },\n\n control: {\n width: '100%',\n padding: `${theme.spacing.xs}px ${theme.spacing.md}px`,\n\n '&:hover': {\n backgroundColor: theme.colorScheme === 'dark' ? theme.colors.gray[6] : theme.colors.gray[2],\n },\n },\n}));\n\ninterface ThProps<T> {\n header: Header<T, unknown>;\n}\n\nconst SortingIcons = {\n asc: ArrowHeadDownSize16Px,\n desc: ArrowHeadUpSize16Px,\n};\n\nconst SortingLabels = {\n asc: 'ascending',\n desc: 'descending',\n} as const;\n\nexport const Th = <T,>({header}: ThProps<T>) => {\n const {classes} = useStyles();\n const size = header.column.getSize();\n const width = size !== defaultColumnSizing.size ? size : undefined;\n\n if (header.isPlaceholder) {\n return null;\n }\n\n if (!header.column.getCanSort()) {\n return (\n <th className={classes.th} style={{width}}>\n <Text className={classes.noSort} size=\"xs\">\n {flexRender(header.column.columnDef.header, header.getContext())}\n </Text>\n </th>\n );\n }\n\n const onSort = header.column.getToggleSortingHandler();\n const sortingOrder = header.column.getIsSorted();\n const Icon = SortingIcons[sortingOrder || header.column.getFirstSortDir()];\n\n return (\n <th className={classes.th} style={{width}} aria-sort={sortingOrder ? SortingLabels[sortingOrder] : 'none'}>\n <UnstyledButton onClick={onSort} className={classes.control}>\n <Group position=\"apart\">\n <Text size=\"xs\">{flexRender(header.column.columnDef.header, header.getContext())}</Text>\n <Center sx={(theme) => ({color: sortingOrder ? theme.colors.action[8] : undefined})}>\n <Icon height={14} />\n </Center>\n </Group>\n </UnstyledButton>\n </th>\n );\n};\n"],"names":["ArrowHeadDownSize16Px","ArrowHeadUpSize16Px","Center","createStyles","Group","Text","UnstyledButton","defaultColumnSizing","flexRender","useStyles","theme","th","padding","fontWeight","color","black","button","div","noSort","spacing","xs","md","control","width","backgroundColor","colorScheme","colors","gray","SortingIcons","asc","desc","SortingLabels","Th","header","classes","size","column","getSize","undefined","isPlaceholder","getCanSort","className","style","columnDef","getContext","onSort","getToggleSortingHandler","sortingOrder","getIsSorted","Icon","getFirstSortDir","aria-sort","onClick","position","sx","action","height"],"mappings":"AAAA;AAAA,SAAQA,qBAAqB,EAAEC,mBAAmB,QAAO,6BAA6B,CAAC;AACvF,SAAQC,MAAM,EAAEC,YAAY,EAAEC,KAAK,EAAEC,IAAI,EAAEC,cAAc,QAAO,eAAe,CAAC;AAChF,SAAQC,mBAAmB,EAAEC,UAAU,QAAe,uBAAuB,CAAC;AAE9E,IAAMC,SAAS,GAAGN,YAAY,CAAC,SAACO,KAAK;WAAM;QACvCC,EAAE,EAAE;YACAC,OAAO,EAAE,cAAc;YACvBC,UAAU,EAAE,gBAAgB;YAC5BC,KAAK,EAAEJ,KAAK,CAACK,KAAK,GAAG,YAAY;YACjCC,MAAM,EAAE;gBACJJ,OAAO,EAAE,UAAU;gBACnBK,GAAG,EAAE;oBACDL,OAAO,EAAE,gBAAgB;iBAC5B;aACJ;YACDK,GAAG,EAAE;gBACDL,OAAO,EAAE,UAAU;aACtB;SACJ;QAEDM,MAAM,EAAE;YACJN,OAAO,EAAE,AAAC,EAAA,CAAwBF,MAAgB,CAAtCA,KAAK,CAACS,OAAO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AACW,IAAI;4BAACO,MAAM,EAAE,EAAE;0BAAI;sBACf;;cACL;UACK;MAChB,CACP;AACN,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveord/plasma-mantine",
3
- "version": "47.7.0",
3
+ "version": "47.9.0",
4
4
  "description": "A Plasma flavoured Mantine theme",
5
5
  "keywords": [
6
6
  "plasma",
@@ -1,4 +1,5 @@
1
1
  import {DatePicker, DatePickerProps, DateRangePickerValue} from '@mantine/dates';
2
+ import dayjs from 'dayjs';
2
3
  import {ReactNode} from 'react';
3
4
 
4
5
  export interface EditableDateRangePickerProps {
@@ -24,11 +25,11 @@ export const EditableDateRangePicker = ({
24
25
  startProps = {},
25
26
  endProps = {},
26
27
  }: EditableDateRangePickerProps) => {
27
- const onChangeStart = (date: Date | null) => {
28
- onChange?.([date, value?.[1] ?? null]);
28
+ const onChangeStart = (date: Date) => {
29
+ onChange?.([dayjs(date).startOf('day').toDate(), value?.[1]]);
29
30
  };
30
- const onChangeEnd = (date: Date | null) => {
31
- onChange?.([value?.[0] ?? null, date]);
31
+ const onChangeEnd = (date: Date) => {
32
+ onChange?.([value?.[0], dayjs(date).endOf('day').toDate()]);
32
33
  };
33
34
 
34
35
  return (
@@ -1,4 +1,5 @@
1
1
  import {render, screen, userEvent} from '@test-utils';
2
+ import dayjs from 'dayjs';
2
3
 
3
4
  import {DateRangePickerInlineCalendar} from '../DateRangePickerInlineCalendar';
4
5
 
@@ -86,6 +87,9 @@ describe('DateRangePickerInlineCalendar', () => {
86
87
 
87
88
  userEvent.click(screen.getByRole('button', {name: 'Apply'}));
88
89
 
89
- expect(onApply).toHaveBeenCalledWith([new Date(2022, 0, 8), new Date(2022, 0, 14)]);
90
+ expect(onApply).toHaveBeenCalledWith([
91
+ dayjs(new Date(2022, 0, 8)).startOf('day').toDate(),
92
+ dayjs(new Date(2022, 0, 14)).endOf('day').toDate(),
93
+ ]);
90
94
  });
91
95
  });
@@ -96,6 +96,6 @@ describe('DateRangePickerPopoverCalendar', () => {
96
96
  userEvent.clear(endInput);
97
97
  userEvent.type(endInput, 'Jan 14, 2022');
98
98
 
99
- expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T00:00:00.000Z"]');
99
+ expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T23:59:59.999Z"]');
100
100
  });
101
101
  });
@@ -42,6 +42,6 @@ describe('EditableDateRangePicker', () => {
42
42
  userEvent.clear(endInput);
43
43
  userEvent.type(endInput, 'Jan 14, 2022');
44
44
 
45
- expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T00:00:00.000Z"]');
45
+ expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T23:59:59.999Z"]');
46
46
  });
47
47
  });
@@ -6,4 +6,5 @@ export * from './sticky-footer';
6
6
  export * from './header';
7
7
  export * from './inline-confirm';
8
8
  export * from './table';
9
+ export * from './prompt';
9
10
  export * from './modal-wizard';
@@ -0,0 +1,66 @@
1
+ import {createStyles, Modal, ModalProps} from '@mantine/core';
2
+ import {Children, ReactElement, ReactNode} from 'react';
3
+ import {PromptFooter} from './PromptFooter';
4
+
5
+ const useStyles = createStyles((theme) => {
6
+ const white = '#fff';
7
+ return {
8
+ body: {
9
+ padding: 0,
10
+ },
11
+ modalType: {overflow: 'hidden', width: 550},
12
+ innerBody: {
13
+ padding: `${theme.spacing.md}px ${theme.spacing.xl}px ${theme.spacing.lg}px`,
14
+ },
15
+ header: {
16
+ padding: `${theme.spacing.md}px ${theme.spacing.xl}px`,
17
+ width: '100%',
18
+ borderBottom: `1px solid ${theme.colors.gray[3]}`,
19
+ fontSize: theme.headings.sizes.h4.fontSize,
20
+ lineHeight: theme.headings.sizes.h4.fontSize,
21
+ },
22
+ default: {},
23
+ success: {backgroundColor: theme.colors.lime[6], color: white},
24
+ warning: {backgroundColor: theme.colors.yellow[5], color: white},
25
+ critical: {
26
+ backgroundColor: theme.colors.red[6],
27
+ color: white,
28
+ },
29
+ info: {backgroundColor: theme.colors.navy[5], color: white},
30
+ whiteClose: {color: white, '&:hover': {backgroundColor: 'transparent'}},
31
+ };
32
+ });
33
+
34
+ export interface PromptProps extends ModalProps {
35
+ variant: 'default' | 'success' | 'warning' | 'critical' | 'info';
36
+ children: ReactNode;
37
+ }
38
+ interface PromptType {
39
+ (props: PromptProps): ReactElement;
40
+ Footer: typeof PromptFooter;
41
+ }
42
+
43
+ export const Prompt: PromptType = ({children, variant, size, ...otherProps}) => {
44
+ const {classes, cx} = useStyles();
45
+ const defaultVariant = variant === 'default';
46
+ const convertedChildren = Children.toArray(children) as ReactElement[];
47
+
48
+ const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);
49
+ const footer = convertedChildren.find((child) => child.type === PromptFooter);
50
+
51
+ const classNames = {
52
+ header: cx(classes.header, classes[variant]),
53
+ close: !defaultVariant && classes.whiteClose,
54
+ body: classes.body,
55
+ modal: !defaultVariant && classes.modalType,
56
+ };
57
+
58
+ return (
59
+ <Modal padding={0} classNames={classNames} size={defaultVariant ? size : 'sm'} {...otherProps}>
60
+ <div className={classes.innerBody}>{otherChildren}</div>
61
+ {footer}
62
+ </Modal>
63
+ );
64
+ };
65
+
66
+ Prompt.Footer = PromptFooter;
@@ -0,0 +1,8 @@
1
+ import {FunctionComponent} from 'react';
2
+ import {StickyFooter, StickyFooterProps} from '../sticky-footer';
3
+
4
+ export interface PromptFooterProps extends StickyFooterProps {}
5
+
6
+ export const PromptFooter: FunctionComponent<PromptFooterProps> = ({children, ...otherProps}) => (
7
+ <StickyFooter {...otherProps}>{children}</StickyFooter>
8
+ );
@@ -0,0 +1,29 @@
1
+ import {render, screen} from '@test-utils';
2
+ import {Prompt} from '../Prompt';
3
+
4
+ describe('Prompt', () => {
5
+ it('displays the title, body and close button', () => {
6
+ render(
7
+ <Prompt variant="default" opened onClose={jest.fn()} title="title modal">
8
+ content modal
9
+ <Prompt.Footer>footer content</Prompt.Footer>
10
+ </Prompt>
11
+ );
12
+ expect(screen.getByText(/content modal/i)).toBeInTheDocument();
13
+ expect(screen.getByText(/footer content/i)).toBeInTheDocument();
14
+ expect(screen.getByText(/title modal/i)).toBeInTheDocument();
15
+ expect(screen.getByRole('button')).toBeInTheDocument();
16
+ });
17
+
18
+ it('calls onClose when clicking on the close button', () => {
19
+ const onClose = jest.fn();
20
+ render(
21
+ <Prompt variant="default" opened onClose={onClose} title="title modal">
22
+ content modal
23
+ </Prompt>
24
+ );
25
+
26
+ screen.getByRole('button').click();
27
+ expect(onClose).toHaveBeenCalledTimes(1);
28
+ });
29
+ });
@@ -0,0 +1 @@
1
+ export * from './Prompt';
@@ -1,7 +1,7 @@
1
1
  import {createStyles, DefaultProps, Divider, Group, Paper} from '@mantine/core';
2
2
  import {FunctionComponent} from 'react';
3
3
 
4
- interface StickyFooterProps extends DefaultProps {
4
+ export interface StickyFooterProps extends DefaultProps {
5
5
  /**
6
6
  * Whether a border is render on top of the footer
7
7
  */
@@ -31,13 +31,7 @@ export const TableDateRangePicker: FunctionComponent<TableDateRangePickerProps>
31
31
  const {form} = useTable();
32
32
 
33
33
  const onApply = (dates: DateRangePickerValue) => {
34
- if (dates[0] !== null && dates[1] !== null) {
35
- form.setFieldValue('dateRange', dates);
36
- } else if (dates[1] === null) {
37
- form.setFieldValue('dateRange', [dates[0], dates[0]]);
38
- } else {
39
- form.setFieldValue('dateRange', [dates[1], dates[1]]);
40
- }
34
+ form.setFieldValue('dateRange', dates);
41
35
  setOpened(false);
42
36
  };
43
37
  const onCancel = () => {
@@ -7,6 +7,15 @@ const useStyles = createStyles((theme) => ({
7
7
  padding: '0 !important',
8
8
  fontWeight: '400 !important' as any,
9
9
  color: theme.black + '!important',
10
+ button: {
11
+ padding: '8px 16px',
12
+ div: {
13
+ padding: '0px !important',
14
+ },
15
+ },
16
+ div: {
17
+ padding: '8px 16px',
18
+ },
10
19
  },
11
20
 
12
21
  noSort: {