@coveord/plasma-mantine 48.10.1 → 48.13.2

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.
@@ -78,8 +78,8 @@ var ModalWizard = function(_param) {
78
78
  title: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_header.Header, {
79
79
  docLink: currentStep.props.docLink,
80
80
  description: typeof currentStep.props.description === "function" ? currentStep.props.description(currentStepIndex + 1, numberOfSteps) : currentStep.props.description,
81
- py: null,
82
- px: null,
81
+ py: 0,
82
+ px: 0,
83
83
  children: typeof currentStep.props.title === "function" ? currentStep.props.title(currentStepIndex + 1, numberOfSteps) : currentStep.props.title
84
84
  }),
85
85
  onClose: closeModalWizard
@@ -92,10 +92,10 @@ var ModalWizard = function(_param) {
92
92
  }),
93
93
  currentStep,
94
94
  /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_stickyFooter.StickyFooter, {
95
+ py: 0,
96
+ px: 0,
97
+ pt: "sm",
95
98
  borderTop: true,
96
- py: null,
97
- px: null,
98
- pt: "md",
99
99
  children: [
100
100
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Button, {
101
101
  name: isFirstStep ? cancelButtonLabel : previousButtonLabel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Button, Modal, ModalProps, Progress} from '@mantine/core';\nimport {Children, ReactElement, useMemo, useState} from 'react';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep} from './ModalWizardStep';\nimport {Header} from '../header';\n\ninterface ModalWizardProps extends Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: () => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: () => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n children,\n ...modalProps\n}) => {\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const numberOfStepsCountAsProgress = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n const isModalDirty = isDirty && isDirty();\n\n const closeModalWizard = () => {\n if (isModalDirty && handleDirtyState) {\n handleDirtyState() && onClose?.();\n } else {\n onClose?.();\n }\n };\n\n const getProgress = (currStepIndex: number) => {\n const validSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (validSteps / numberOfStepsCountAsProgress) * 100;\n };\n\n const getProgressMemo = useMemo(() => getProgress(currentStepIndex), [currentStepIndex]);\n\n return (\n <Modal\n opened={opened}\n classNames={classNames}\n centered\n title={\n <Header\n docLink={currentStep.props.docLink}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={null}\n px={null}\n >\n {typeof currentStep.props.title === 'function'\n ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.title}\n </Header>\n }\n onClose={closeModalWizard}\n {...modalProps}\n >\n {currentStep.props.showProgressBar && <Progress color=\"teal\" size=\"lg\" value={getProgressMemo} />}\n {currentStep}\n <StickyFooter borderTop py={null} px={null} pt=\"md\">\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n disabled={false}\n size=\"sm\"\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n closeModalWizard();\n } else {\n onPrevious?.();\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n size=\"sm\"\n onClick={() => {\n if (isLastStep) {\n onFinish ? onFinish() : onClose();\n } else {\n onNext?.();\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["ModalWizard","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","children","modalProps","currentStep","useState","currentStepIndex","setCurrentStepIndex","modalSteps","Children","toArray","filter","child","type","ModalWizardStep","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","useMemo","Modal","centered","title","Header","docLink","description","py","px","showProgressBar","Progress","color","size","value","StickyFooter","borderTop","pt","Button","name","disabled","variant","onClick","Step"],"mappings":"AAAA;;;;+BA0EaA;;;eAAAA;;;;;;;;oBA1EqC;qBACM;4BAC7B;+BACG;sBACT;AAsEd,IAAMA,cAA+B,iBAetC;0CAdFC,mBAAAA,0DAAoB,qEACpBC,iBAAAA,sDAAkB,qEAClBC,qBAAAA,8DAAsB,2EACtBC,mBAAAA,0DAAoB,qCACpBC,gBAAAA,QACAC,gBAAAA,QACAC,oBAAAA,YACAC,iBAAAA,SACAC,kBAAAA,UACAC,iBAAAA,SACAC,0BAAAA,kBACAC,oBAAAA,YACAC,kBAAAA,UACGC;QAbHb;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;;QAYkBE;IATlB,IAAgDC,2BAAAA,IAAAA,eAAQ,EAAC,QAAlDC,mBAAyCD,cAAvBE,sBAAuBF;IAChD,IAAMG,aAAa,AAACC,eAAQ,CAACC,OAAO,CAACR,UAA6BS,MAAM,CAAC,SAACC;eAAUA,MAAMC,IAAI,KAAKC,gCAAe;;IAElH,IAAMC,gBAAgBP,WAAWQ,MAAM;IACvC,IAAMC,+BAA+BT,WAAWG,MAAM,CAAC,SAACO;eAASA,KAAKC,KAAK,CAACC,gBAAgB;OAAEJ,MAAM;IACpG,IAAMK,cAAcf,qBAAqB;IACzC,IAAMgB,aAAahB,qBAAqBS,gBAAgB;IACxD,IAAMX,cAAcI,WAAWG,MAAM,CAAC,SAACO,MAAoBK;eAAkBA,UAAUjB;MAAiB,CAAC,EAAE;QAEzFF;IAAlB,IAAM,AAACoB,UAAWpB,CAAAA,CAAAA,OAAAA,wBAAAA,yBAAAA,KAAAA,IAAAA,CAAAA,qBAAAA,YAAae,KAAK,cAAlBf,gCAAAA,KAAAA,IAAAA,mCAAAA,mBAAoBqB,uEAApBrB,KAAAA,IAAAA,gCAAAA,KAAAA,oBAAmCE,kBAAkBS,4BAArDX,kBAAAA,OAAuE;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;wBACHC,MAAM7B,cAAc/B,oBAAoBE,mBAAmB;wBAC3D2D,UAAU,KAAK;wBACfP,MAAK;wBACLQ,SAAQ;wBACRC,SAAS,WAAM;4BACX,IAAIhC,aAAa;gCACbM;4BACJ,OAAO;gCACH/B,uBAAAA,wBAAAA,KAAAA,IAAAA;gCACAW,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECe,cAAc/B,oBAAoBE,mBAAmB;;kCAG1D,qBAACyD,YAAM;wBACHE,UAAU,CAAC3B;wBACXoB,MAAK;wBACLS,SAAS,WAAM;4BACX,IAAI/B,YAAY;gCACZxB,WAAWA,aAAaD,SAAS;4BACrC,OAAO;gCACHF,mBAAAA,oBAAAA,KAAAA,IAAAA;gCACAY,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECgB,aAAa7B,oBAAoBF,eAAe;;;;;;AAKrE;AAEAF,YAAYiE,IAAI,GAAGxC,gCAAe"}
1
+ {"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Button, Modal, ModalProps, Progress} from '@mantine/core';\nimport {Children, ReactElement, useMemo, useState} from 'react';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep} from './ModalWizardStep';\nimport {Header} from '../header';\n\ninterface ModalWizardProps extends Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: () => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: () => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n children,\n ...modalProps\n}) => {\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const numberOfStepsCountAsProgress = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n const isModalDirty = isDirty && isDirty();\n\n const closeModalWizard = () => {\n if (isModalDirty && handleDirtyState) {\n handleDirtyState() && onClose?.();\n } else {\n onClose?.();\n }\n };\n\n const getProgress = (currStepIndex: number) => {\n const validSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (validSteps / numberOfStepsCountAsProgress) * 100;\n };\n\n const getProgressMemo = useMemo(() => getProgress(currentStepIndex), [currentStepIndex]);\n\n return (\n <Modal\n opened={opened}\n classNames={classNames}\n centered\n title={\n <Header\n docLink={currentStep.props.docLink}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={0}\n px={0}\n >\n {typeof currentStep.props.title === 'function'\n ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.title}\n </Header>\n }\n onClose={closeModalWizard}\n {...modalProps}\n >\n {currentStep.props.showProgressBar && <Progress color=\"teal\" size=\"lg\" value={getProgressMemo} />}\n {currentStep}\n <StickyFooter py={0} px={0} pt=\"sm\" borderTop>\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n disabled={false}\n size=\"sm\"\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n closeModalWizard();\n } else {\n onPrevious?.();\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n size=\"sm\"\n onClick={() => {\n if (isLastStep) {\n onFinish ? onFinish() : onClose();\n } else {\n onNext?.();\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["ModalWizard","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","children","modalProps","currentStep","useState","currentStepIndex","setCurrentStepIndex","modalSteps","Children","toArray","filter","child","type","ModalWizardStep","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","useMemo","Modal","centered","title","Header","docLink","description","py","px","showProgressBar","Progress","color","size","value","StickyFooter","pt","borderTop","Button","name","disabled","variant","onClick","Step"],"mappings":"AAAA;;;;+BA0EaA;;;eAAAA;;;;;;;;oBA1EqC;qBACM;4BAC7B;+BACG;sBACT;AAsEd,IAAMA,cAA+B,iBAetC;0CAdFC,mBAAAA,0DAA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BAAmB;4BAC3C,CAAC;wBACL;kCAECe,cAAc/B,oBAAoBE,mBAAmB;;kCAG1D,qBAACyD,YAAM;wBACHE,UAAU,CAAC3B;wBACXoB,MAAK;wBACLS,SAAS,WAAM;4BACX,IAAI/B,YAAY;gCACZxB,WAAWA,aAAaD,SAAS;4BACrC,OAAO;gCACHF,mBAAAA,oBAAAA,KAAAA,IAAAA;gCACAY,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECgB,aAAa7B,oBAAoBF,eAAe;;;;;;AAKrE;AAEAF,YAAYiE,IAAI,GAAGxC,gCAAe"}
@@ -8,11 +8,14 @@ Object.defineProperty(exports, "TableHeader", {
8
8
  return TableHeader;
9
9
  }
10
10
  });
11
+ var _objectSpread = require("@swc/helpers/lib/_object_spread.js").default;
12
+ var _objectSpreadProps = require("@swc/helpers/lib/_object_spread_props.js").default;
13
+ var _objectWithoutProperties = require("@swc/helpers/lib/_object_without_properties.js").default;
11
14
  var _jsxRuntime = require("react/jsx-runtime");
12
15
  var _core = require("@mantine/core");
13
16
  var useStyles = (0, _core.createStyles)(function(theme) {
14
17
  return {
15
- header: {
18
+ root: {
16
19
  position: "sticky",
17
20
  top: 0,
18
21
  zIndex: 13,
@@ -21,17 +24,28 @@ var useStyles = (0, _core.createStyles)(function(theme) {
21
24
  }
22
25
  };
23
26
  });
24
- var TableHeader = function(param) {
25
- var children = param.children;
26
- var classes = useStyles().classes;
27
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Group, {
27
+ var TableHeader = function(_param) {
28
+ var classNames = _param.classNames, styles = _param.styles, unstyled = _param.unstyled, children = _param.children, others = _objectWithoutProperties(_param, [
29
+ "classNames",
30
+ "styles",
31
+ "unstyled",
32
+ "children"
33
+ ]);
34
+ var classes = useStyles(null, {
35
+ name: "TableHeader",
36
+ classNames: classNames,
37
+ styles: styles,
38
+ unstyled: unstyled
39
+ }).classes;
40
+ return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Group, _objectSpreadProps(_objectSpread({
28
41
  position: "right",
29
42
  spacing: "lg",
30
- className: classes.header,
43
+ className: classes.root,
31
44
  px: "md",
32
- py: "sm",
45
+ py: "sm"
46
+ }, others), {
33
47
  children: children
34
- });
48
+ }));
35
49
  };
36
50
 
37
51
  //# sourceMappingURL=TableHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/TableHeader.tsx"],"sourcesContent":["import {createStyles, Group} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nconst useStyles = createStyles((theme) => ({\n header: {\n position: 'sticky',\n top: 0,\n zIndex: 13, // skeleton is 11\n backgroundColor: theme.colors.gray[1],\n borderBottom: `1px solid ${theme.colors.gray[4]}`,\n },\n}));\n\nexport const TableHeader: FunctionComponent<PropsWithChildren> = ({children}) => {\n const {classes} = useStyles();\n return (\n <Group position=\"right\" spacing=\"lg\" className={classes.header} px=\"md\" py=\"sm\">\n {children}\n </Group>\n );\n};\n"],"names":["TableHeader","useStyles","createStyles","theme","header","position","top","zIndex","backgroundColor","colors","gray","borderBottom","children","classes","Group","spacing","className","px","py"],"mappings":"AAAA;;;;+BAaaA;;;eAAAA;;;;oBAbqB;AAGlC,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,QAAQ;YACJC,UAAU;YACVC,KAAK;YACLC,QAAQ;YACRC,iBAAiBL,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;YACrCC,cAAc,AAAC,aAAiC,OAArBR,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;QACnD;IACJ;;AAEO,IAAMV,cAAoD,gBAAgB;QAAdY,iBAAAA;IAC/D,IAAM,AAACC,UAAWZ,YAAXY;IACP,qBACI,qBAACC,WAAK;QAACT,UAAS;QAAQU,SAAQ;QAAKC,WAAWH,QAAQT,MAAM;QAAEa,IAAG;QAAKC,IAAG;kBACtEN;;AAGb"}
1
+ {"version":3,"sources":["../../../../src/components/table/TableHeader.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Group, Selectors} from '@mantine/core';\nimport {FunctionComponent, ReactNode} from 'react';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n position: 'sticky',\n top: 0,\n zIndex: 13, // skeleton is 11\n backgroundColor: theme.colors.gray[1],\n borderBottom: `1px solid ${theme.colors.gray[4]}`,\n },\n}));\n\ntype TableHeaderStylesNames = Selectors<typeof useStyles>;\ninterface TableHeaderProps extends DefaultProps<TableHeaderStylesNames> {\n /* Children of header (ie: actions, datepicker, etc.) */\n children?: ReactNode;\n}\nexport const TableHeader: FunctionComponent<TableHeaderProps> = ({\n classNames,\n styles,\n unstyled,\n children,\n ...others\n}) => {\n const {classes} = useStyles(null, {name: 'TableHeader', classNames, styles, unstyled});\n return (\n <Group position=\"right\" spacing=\"lg\" className={classes.root} px=\"md\" py=\"sm\" {...others}>\n {children}\n </Group>\n );\n};\n"],"names":["TableHeader","useStyles","createStyles","theme","root","position","top","zIndex","backgroundColor","colors","gray","borderBottom","classNames","styles","unstyled","children","others","classes","name","Group","spacing","className","px","py"],"mappings":"AAAA;;;;+BAkBaA;;;eAAAA;;;;;;;oBAlB8C;AAG3D,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,MAAM;YACFC,UAAU;YACVC,KAAK;YACLC,QAAQ;YACRC,iBAAiBL,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;YACrCC,cAAc,AAAC,aAAiC,OAArBR,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;QACnD;IACJ;;AAOO,IAAMV,cAAmD,iBAM1D;QALFY,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACAC,kBAAAA,UACGC;QAJHJ;QACAC;QACAC;QACAC;;IAGA,IAAM,AAACE,UAAWhB,UAAU,IAAI,EAAE;QAACiB,MAAM;QAAeN,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,GAA7EG;IACP,qBACI,qBAACE,WAAK;QAACd,UAAS;QAAQe,SAAQ;QAAKC,WAAWJ,QAAQb,IAAI;QAAEkB,IAAG;QAAKC,IAAG;OAASP;kBAC7ED;;AAGb"}
@@ -1,3 +1,14 @@
1
- import { FunctionComponent, PropsWithChildren } from 'react';
2
- export declare const TableHeader: FunctionComponent<PropsWithChildren>;
1
+ import { DefaultProps, Selectors } from '@mantine/core';
2
+ import { FunctionComponent, ReactNode } from 'react';
3
+ declare const useStyles: (params: void, options?: import("@mantine/core").UseStylesOptions<"root">) => {
4
+ classes: Record<"root", string>;
5
+ cx: (...args: any) => string;
6
+ theme: import("@mantine/core").MantineTheme;
7
+ };
8
+ declare type TableHeaderStylesNames = Selectors<typeof useStyles>;
9
+ interface TableHeaderProps extends DefaultProps<TableHeaderStylesNames> {
10
+ children?: ReactNode;
11
+ }
12
+ export declare const TableHeader: FunctionComponent<TableHeaderProps>;
13
+ export {};
3
14
  //# sourceMappingURL=TableHeader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableHeader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAY3D,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,iBAAiB,CAO5D,CAAC"}
1
+ {"version":3,"file":"TableHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAS,SAAS,EAAC,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAEnD,QAAA,MAAM,SAAS;;;;CAQZ,CAAC;AAEJ,aAAK,sBAAsB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAC1D,UAAU,gBAAiB,SAAQ,YAAY,CAAC,sBAAsB,CAAC;IAEnE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AACD,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAa3D,CAAC"}
@@ -68,8 +68,8 @@ export var ModalWizard = function(_param) {
68
68
  title: /*#__PURE__*/ _jsx(Header, {
69
69
  docLink: currentStep.props.docLink,
70
70
  description: typeof currentStep.props.description === "function" ? currentStep.props.description(currentStepIndex + 1, numberOfSteps) : currentStep.props.description,
71
- py: null,
72
- px: null,
71
+ py: 0,
72
+ px: 0,
73
73
  children: typeof currentStep.props.title === "function" ? currentStep.props.title(currentStepIndex + 1, numberOfSteps) : currentStep.props.title
74
74
  }),
75
75
  onClose: closeModalWizard
@@ -82,10 +82,10 @@ export var ModalWizard = function(_param) {
82
82
  }),
83
83
  currentStep,
84
84
  /*#__PURE__*/ _jsxs(StickyFooter, {
85
+ py: 0,
86
+ px: 0,
87
+ pt: "sm",
85
88
  borderTop: true,
86
- py: null,
87
- px: null,
88
- pt: "md",
89
89
  children: [
90
90
  /*#__PURE__*/ _jsx(Button, {
91
91
  name: isFirstStep ? cancelButtonLabel : previousButtonLabel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Button, Modal, ModalProps, Progress} from '@mantine/core';\nimport {Children, ReactElement, useMemo, useState} from 'react';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep} from './ModalWizardStep';\nimport {Header} from '../header';\n\ninterface ModalWizardProps extends Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: () => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: () => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n children,\n ...modalProps\n}) => {\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const numberOfStepsCountAsProgress = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n const isModalDirty = isDirty && isDirty();\n\n const closeModalWizard = () => {\n if (isModalDirty && handleDirtyState) {\n handleDirtyState() && onClose?.();\n } else {\n onClose?.();\n }\n };\n\n const getProgress = (currStepIndex: number) => {\n const validSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (validSteps / numberOfStepsCountAsProgress) * 100;\n };\n\n const getProgressMemo = useMemo(() => getProgress(currentStepIndex), [currentStepIndex]);\n\n return (\n <Modal\n opened={opened}\n classNames={classNames}\n centered\n title={\n <Header\n docLink={currentStep.props.docLink}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={null}\n px={null}\n >\n {typeof currentStep.props.title === 'function'\n ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.title}\n </Header>\n }\n onClose={closeModalWizard}\n {...modalProps}\n >\n {currentStep.props.showProgressBar && <Progress color=\"teal\" size=\"lg\" value={getProgressMemo} />}\n {currentStep}\n <StickyFooter borderTop py={null} px={null} pt=\"md\">\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n disabled={false}\n size=\"sm\"\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n closeModalWizard();\n } else {\n onPrevious?.();\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n size=\"sm\"\n onClick={() => {\n if (isLastStep) {\n onFinish ? onFinish() : onClose();\n } else {\n onNext?.();\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["Button","Modal","Progress","Children","useMemo","useState","StickyFooter","ModalWizardStep","Header","ModalWizard","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","children","modalProps","currentStep","currentStepIndex","setCurrentStepIndex","modalSteps","toArray","filter","child","type","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","centered","title","docLink","description","py","px","showProgressBar","color","size","value","borderTop","pt","name","disabled","variant","onClick","Step"],"mappings":"AAAA;;;;;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAcC,QAA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MvB,cAAc5B,oBAAoBE,mBAAmB;wBAC3DkD,UAAU,KAAK;wBACfL,MAAK;wBACLM,SAAQ;wBACRC,SAAS,WAAM;4BACX,IAAI1B,aAAa;gCACbM;4BACJ,OAAO;gCACH5B,uBAAAA,wBAAAA,KAAAA,IAAAA;gCACAU,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECa,cAAc5B,oBAAoBE,mBAAmB;;kCAG1D,KAACZ;wBACG8D,UAAU,CAACrB;wBACXgB,MAAK;wBACLO,SAAS,WAAM;4BACX,IAAIzB,YAAY;gCACZrB,WAAWA,aAAaD,SAAS;4BACrC,OAAO;gCACHF,mBAAAA,oBAAAA,KAAAA,IAAAA;gCACAW,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECc,aAAa1B,oBAAoBF,eAAe;;;;;;AAKrE,EAAE;AAEFF,YAAYwD,IAAI,GAAG1D"}
1
+ {"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Button, Modal, ModalProps, Progress} from '@mantine/core';\nimport {Children, ReactElement, useMemo, useState} from 'react';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep} from './ModalWizardStep';\nimport {Header} from '../header';\n\ninterface ModalWizardProps extends Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: () => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: () => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n children,\n ...modalProps\n}) => {\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const numberOfStepsCountAsProgress = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n const isModalDirty = isDirty && isDirty();\n\n const closeModalWizard = () => {\n if (isModalDirty && handleDirtyState) {\n handleDirtyState() && onClose?.();\n } else {\n onClose?.();\n }\n };\n\n const getProgress = (currStepIndex: number) => {\n const validSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (validSteps / numberOfStepsCountAsProgress) * 100;\n };\n\n const getProgressMemo = useMemo(() => getProgress(currentStepIndex), [currentStepIndex]);\n\n return (\n <Modal\n opened={opened}\n classNames={classNames}\n centered\n title={\n <Header\n docLink={currentStep.props.docLink}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={0}\n px={0}\n >\n {typeof currentStep.props.title === 'function'\n ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.title}\n </Header>\n }\n onClose={closeModalWizard}\n {...modalProps}\n >\n {currentStep.props.showProgressBar && <Progress color=\"teal\" size=\"lg\" value={getProgressMemo} />}\n {currentStep}\n <StickyFooter py={0} px={0} pt=\"sm\" borderTop>\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n disabled={false}\n size=\"sm\"\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n closeModalWizard();\n } else {\n onPrevious?.();\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n size=\"sm\"\n onClick={() => {\n if (isLastStep) {\n onFinish ? onFinish() : onClose();\n } else {\n onNext?.();\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["Button","Modal","Progress","Children","useMemo","useState","StickyFooter","ModalWizardStep","Header","ModalWizard","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","children","modalProps","currentStep","currentStepIndex","setCurrentStepIndex","modalSteps","toArray","filter","child","type","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","centered","title","docLink","description","py","px","showProgressBar","color","size","value","pt","borderTop","name","disabled","variant","onClick","Step"],"mappings":"AAAA;;;;;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAcC,QAAQ,QAAO,gBAAgB;AAClE,SAAQC,QAAQ,EAAgBC,OAAO,EAAEC,QAAQ,QAAO,QAAQ;AAChE,SAAQC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AAa;gCACbM;4BACJ,OAAO;gCACH5B,uBAAAA,wBAAAA,KAAAA,IAAAA;gCACAU,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECa,cAAc5B,oBAAoBE,mBAAmB;;kCAG1D,KAACZ;wBACG8D,UAAU,CAACrB;wBACXgB,MAAK;wBACLO,SAAS,WAAM;4BACX,IAAIzB,YAAY;gCACZrB,WAAWA,aAAaD,SAAS;4BACrC,OAAO;gCACHF,mBAAAA,oBAAAA,KAAAA,IAAAA;gCACAW,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECc,aAAa1B,oBAAoBF,eAAe;;;;;;AAKrE,EAAE;AAEFF,YAAYwD,IAAI,GAAG1D"}
@@ -1,8 +1,11 @@
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";
1
4
  import { jsx as _jsx } from "react/jsx-runtime";
2
5
  import { createStyles, Group } from "@mantine/core";
3
6
  var useStyles = createStyles(function(theme) {
4
7
  return {
5
- header: {
8
+ root: {
6
9
  position: "sticky",
7
10
  top: 0,
8
11
  zIndex: 13,
@@ -11,17 +14,28 @@ var useStyles = createStyles(function(theme) {
11
14
  }
12
15
  };
13
16
  });
14
- export var TableHeader = function(param) {
15
- var children = param.children;
16
- var classes = useStyles().classes;
17
- return /*#__PURE__*/ _jsx(Group, {
17
+ export var TableHeader = function(_param) {
18
+ var classNames = _param.classNames, styles = _param.styles, unstyled = _param.unstyled, children = _param.children, others = _object_without_properties(_param, [
19
+ "classNames",
20
+ "styles",
21
+ "unstyled",
22
+ "children"
23
+ ]);
24
+ var classes = useStyles(null, {
25
+ name: "TableHeader",
26
+ classNames: classNames,
27
+ styles: styles,
28
+ unstyled: unstyled
29
+ }).classes;
30
+ return /*#__PURE__*/ _jsx(Group, _object_spread_props(_object_spread({
18
31
  position: "right",
19
32
  spacing: "lg",
20
- className: classes.header,
33
+ className: classes.root,
21
34
  px: "md",
22
- py: "sm",
35
+ py: "sm"
36
+ }, others), {
23
37
  children: children
24
- });
38
+ }));
25
39
  };
26
40
 
27
41
  //# sourceMappingURL=TableHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/TableHeader.tsx"],"sourcesContent":["import {createStyles, Group} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nconst useStyles = createStyles((theme) => ({\n header: {\n position: 'sticky',\n top: 0,\n zIndex: 13, // skeleton is 11\n backgroundColor: theme.colors.gray[1],\n borderBottom: `1px solid ${theme.colors.gray[4]}`,\n },\n}));\n\nexport const TableHeader: FunctionComponent<PropsWithChildren> = ({children}) => {\n const {classes} = useStyles();\n return (\n <Group position=\"right\" spacing=\"lg\" className={classes.header} px=\"md\" py=\"sm\">\n {children}\n </Group>\n );\n};\n"],"names":["createStyles","Group","useStyles","theme","header","position","top","zIndex","backgroundColor","colors","gray","borderBottom","TableHeader","children","classes","spacing","className","px","py"],"mappings":"AAAA;AAAA,SAAQA,YAAY,EAAEC,KAAK,QAAO,gBAAgB;AAGlD,IAAMC,YAAYF,aAAa,SAACG;WAAW;QACvCC,QAAQ;YACJC,UAAU;YACVC,KAAK;YACLC,QAAQ;YACRC,iBAAiBL,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;YACrCC,cAAc,AAAC,aAAiC,OAArBR,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;QACnD;IACJ;;AAEA,OAAO,IAAME,cAAoD,gBAAgB;QAAdC,iBAAAA;IAC/D,IAAM,AAACC,UAAWZ,YAAXY;IACP,qBACI,KAACb;QAAMI,UAAS;QAAQU,SAAQ;QAAKC,WAAWF,QAAQV,MAAM;QAAEa,IAAG;QAAKC,IAAG;kBACtEL;;AAGb,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/table/TableHeader.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Group, Selectors} from '@mantine/core';\nimport {FunctionComponent, ReactNode} from 'react';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n position: 'sticky',\n top: 0,\n zIndex: 13, // skeleton is 11\n backgroundColor: theme.colors.gray[1],\n borderBottom: `1px solid ${theme.colors.gray[4]}`,\n },\n}));\n\ntype TableHeaderStylesNames = Selectors<typeof useStyles>;\ninterface TableHeaderProps extends DefaultProps<TableHeaderStylesNames> {\n /* Children of header (ie: actions, datepicker, etc.) */\n children?: ReactNode;\n}\nexport const TableHeader: FunctionComponent<TableHeaderProps> = ({\n classNames,\n styles,\n unstyled,\n children,\n ...others\n}) => {\n const {classes} = useStyles(null, {name: 'TableHeader', classNames, styles, unstyled});\n return (\n <Group position=\"right\" spacing=\"lg\" className={classes.root} px=\"md\" py=\"sm\" {...others}>\n {children}\n </Group>\n );\n};\n"],"names":["createStyles","Group","useStyles","theme","root","position","top","zIndex","backgroundColor","colors","gray","borderBottom","TableHeader","classNames","styles","unstyled","children","others","classes","name","spacing","className","px","py"],"mappings":"AAAA;;;;AAAA,SAAQA,YAAY,EAAgBC,KAAK,QAAkB,gBAAgB;AAG3E,IAAMC,YAAYF,aAAa,SAACG;WAAW;QACvCC,MAAM;YACFC,UAAU;YACVC,KAAK;YACLC,QAAQ;YACRC,iBAAiBL,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;YACrCC,cAAc,AAAC,aAAiC,OAArBR,MAAMM,MAAM,CAACC,IAAI,CAAC,EAAE;QACnD;IACJ;;AAOA,OAAO,IAAME,cAAmD,iBAM1D;QALFC,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACAC,kBAAAA,UACGC;QAJHJ;QACAC;QACAC;QACAC;;IAGA,IAAM,AAACE,UAAWhB,UAAU,IAAI,EAAE;QAACiB,MAAM;QAAeN,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,GAA7EG;IACP,qBACI,KAACjB;QAAMI,UAAS;QAAQe,SAAQ;QAAKC,WAAWH,QAAQd,IAAI;QAAEkB,IAAG;QAAKC,IAAG;OAASN;kBAC7ED;;AAGb,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveord/plasma-mantine",
3
- "version": "48.10.1",
3
+ "version": "48.13.2",
4
4
  "description": "A Plasma flavoured Mantine theme",
5
5
  "keywords": [
6
6
  "plasma",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@emotion/react": "11.10.5",
30
- "@mantine/carousel": "5.6.4",
31
- "@mantine/core": "5.6.2",
32
- "@mantine/dates": "5.6.2",
33
- "@mantine/form": "5.6.2",
34
- "@mantine/hooks": "5.6.2",
35
- "@mantine/modals": "5.6.2",
30
+ "@mantine/carousel": "5.8.3",
31
+ "@mantine/core": "5.8.3",
32
+ "@mantine/dates": "5.8.3",
33
+ "@mantine/form": "5.8.3",
34
+ "@mantine/hooks": "5.8.3",
35
+ "@mantine/modals": "5.8.3",
36
36
  "@swc/cli": "0.1.57",
37
37
  "@swc/core": "1.3.16",
38
38
  "@swc/jest": "0.2.23",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@emotion/react": "^11.10.0",
65
- "@mantine/carousel": "5.6.4",
65
+ "@mantine/carousel": "5.8.3",
66
66
  "@mantine/core": "^5.6.2",
67
67
  "@mantine/dates": "^5.6.2",
68
68
  "@mantine/form": "^5.6.2",
@@ -130,8 +130,8 @@ export const ModalWizard: ModalWizardType = ({
130
130
  ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)
131
131
  : currentStep.props.description
132
132
  }
133
- py={null}
134
- px={null}
133
+ py={0}
134
+ px={0}
135
135
  >
136
136
  {typeof currentStep.props.title === 'function'
137
137
  ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)
@@ -143,7 +143,7 @@ export const ModalWizard: ModalWizardType = ({
143
143
  >
144
144
  {currentStep.props.showProgressBar && <Progress color="teal" size="lg" value={getProgressMemo} />}
145
145
  {currentStep}
146
- <StickyFooter borderTop py={null} px={null} pt="md">
146
+ <StickyFooter py={0} px={0} pt="sm" borderTop>
147
147
  <Button
148
148
  name={isFirstStep ? cancelButtonLabel : previousButtonLabel}
149
149
  disabled={false}
@@ -1,8 +1,8 @@
1
- import {createStyles, Group} from '@mantine/core';
2
- import {FunctionComponent, PropsWithChildren} from 'react';
1
+ import {createStyles, DefaultProps, Group, Selectors} from '@mantine/core';
2
+ import {FunctionComponent, ReactNode} from 'react';
3
3
 
4
4
  const useStyles = createStyles((theme) => ({
5
- header: {
5
+ root: {
6
6
  position: 'sticky',
7
7
  top: 0,
8
8
  zIndex: 13, // skeleton is 11
@@ -11,10 +11,21 @@ const useStyles = createStyles((theme) => ({
11
11
  },
12
12
  }));
13
13
 
14
- export const TableHeader: FunctionComponent<PropsWithChildren> = ({children}) => {
15
- const {classes} = useStyles();
14
+ type TableHeaderStylesNames = Selectors<typeof useStyles>;
15
+ interface TableHeaderProps extends DefaultProps<TableHeaderStylesNames> {
16
+ /* Children of header (ie: actions, datepicker, etc.) */
17
+ children?: ReactNode;
18
+ }
19
+ export const TableHeader: FunctionComponent<TableHeaderProps> = ({
20
+ classNames,
21
+ styles,
22
+ unstyled,
23
+ children,
24
+ ...others
25
+ }) => {
26
+ const {classes} = useStyles(null, {name: 'TableHeader', classNames, styles, unstyled});
16
27
  return (
17
- <Group position="right" spacing="lg" className={classes.header} px="md" py="sm">
28
+ <Group position="right" spacing="lg" className={classes.root} px="md" py="sm" {...others}>
18
29
  {children}
19
30
  </Group>
20
31
  );