@coveord/plasma-mantine 55.6.0 → 55.7.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 (79) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +50 -50
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/components/index.d.ts +1 -0
  5. package/dist/cjs/components/index.d.ts.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/modal/Modal.d.ts +11 -0
  9. package/dist/cjs/components/modal/Modal.d.ts.map +1 -0
  10. package/dist/cjs/components/modal/Modal.js +32 -0
  11. package/dist/cjs/components/modal/Modal.js.map +1 -0
  12. package/dist/cjs/components/modal/Modal.module.css +9 -0
  13. package/dist/cjs/components/modal/ModalFooter.d.ts +20 -0
  14. package/dist/cjs/components/modal/ModalFooter.d.ts.map +1 -0
  15. package/dist/cjs/components/modal/ModalFooter.js +46 -0
  16. package/dist/cjs/components/modal/ModalFooter.js.map +1 -0
  17. package/dist/cjs/components/modal/index.d.ts +3 -0
  18. package/dist/cjs/components/modal/index.d.ts.map +1 -0
  19. package/dist/cjs/components/modal/index.js +9 -0
  20. package/dist/cjs/components/modal/index.js.map +1 -0
  21. package/dist/cjs/components/prompt/Prompt.d.ts +3 -3
  22. package/dist/cjs/components/prompt/Prompt.d.ts.map +1 -1
  23. package/dist/cjs/components/prompt/Prompt.js +14 -16
  24. package/dist/cjs/components/prompt/Prompt.js.map +1 -1
  25. package/dist/cjs/components/sticky-footer/StickyFooter.d.ts +2 -0
  26. package/dist/cjs/components/sticky-footer/StickyFooter.d.ts.map +1 -1
  27. package/dist/cjs/components/sticky-footer/StickyFooter.js.map +1 -1
  28. package/dist/cjs/index.d.ts +1 -1
  29. package/dist/cjs/index.d.ts.map +1 -1
  30. package/dist/cjs/index.js +3 -0
  31. package/dist/cjs/index.js.map +1 -1
  32. package/dist/esm/components/index.d.ts +1 -0
  33. package/dist/esm/components/index.d.ts.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/modal/Modal.d.ts +11 -0
  37. package/dist/esm/components/modal/Modal.d.ts.map +1 -0
  38. package/dist/esm/components/modal/Modal.js +20 -0
  39. package/dist/esm/components/modal/Modal.js.map +1 -0
  40. package/dist/esm/components/modal/Modal.module.css +9 -0
  41. package/dist/esm/components/modal/ModalFooter.d.ts +20 -0
  42. package/dist/esm/components/modal/ModalFooter.d.ts.map +1 -0
  43. package/dist/esm/components/modal/ModalFooter.js +32 -0
  44. package/dist/esm/components/modal/ModalFooter.js.map +1 -0
  45. package/dist/esm/components/modal/index.d.ts +3 -0
  46. package/dist/esm/components/modal/index.d.ts.map +1 -0
  47. package/dist/esm/components/modal/index.js +4 -0
  48. package/dist/esm/components/modal/index.js.map +1 -0
  49. package/dist/esm/components/prompt/Prompt.d.ts +3 -3
  50. package/dist/esm/components/prompt/Prompt.d.ts.map +1 -1
  51. package/dist/esm/components/prompt/Prompt.js +9 -7
  52. package/dist/esm/components/prompt/Prompt.js.map +1 -1
  53. package/dist/esm/components/sticky-footer/StickyFooter.d.ts +2 -0
  54. package/dist/esm/components/sticky-footer/StickyFooter.d.ts.map +1 -1
  55. package/dist/esm/components/sticky-footer/StickyFooter.js.map +1 -1
  56. package/dist/esm/index.d.ts +1 -1
  57. package/dist/esm/index.d.ts.map +1 -1
  58. package/dist/esm/index.js +1 -1
  59. package/dist/esm/index.js.map +1 -1
  60. package/package.json +24 -24
  61. package/src/components/index.ts +1 -0
  62. package/src/components/modal/Modal.module.css +9 -0
  63. package/src/components/modal/Modal.tsx +33 -0
  64. package/src/components/modal/ModalFooter.tsx +47 -0
  65. package/src/components/modal/__tests__/Modal.spec.tsx +25 -0
  66. package/src/components/modal/__tests__/ModalFooter.spec.tsx +35 -0
  67. package/src/components/modal/index.ts +2 -0
  68. package/src/components/prompt/Prompt.tsx +9 -8
  69. package/src/components/sticky-footer/StickyFooter.tsx +2 -0
  70. package/src/index.ts +2 -0
  71. package/dist/cjs/components/prompt/PromptFooter.d.ts +0 -6
  72. package/dist/cjs/components/prompt/PromptFooter.d.ts.map +0 -1
  73. package/dist/cjs/components/prompt/PromptFooter.js +0 -27
  74. package/dist/cjs/components/prompt/PromptFooter.js.map +0 -1
  75. package/dist/esm/components/prompt/PromptFooter.d.ts +0 -6
  76. package/dist/esm/components/prompt/PromptFooter.d.ts.map +0 -1
  77. package/dist/esm/components/prompt/PromptFooter.js +0 -9
  78. package/dist/esm/components/prompt/PromptFooter.js.map +0 -1
  79. package/src/components/prompt/PromptFooter.tsx +0 -10
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useRef, useEffect } from 'react';
3
+ import clsx from 'clsx';
4
+ import { factory } from '@mantine/core';
5
+ import { StickyFooter } from '../sticky-footer';
6
+ import classes from './Modal.module.css';
7
+ const ensuresFooterHasEvenHeight = (footer)=>{
8
+ const remainder = footer.offsetHeight % 2;
9
+ footer.style.height = `${footer.offsetHeight - remainder + 2}px`;
10
+ };
11
+ export const ModalFooter = factory(({ sticky, ...props }, ref)=>{
12
+ const _ref = useRef();
13
+ const footerRef = ref || _ref;
14
+ useEffect(()=>{
15
+ if (typeof footerRef !== 'function' && footerRef.current) {
16
+ ensuresFooterHasEvenHeight(footerRef.current);
17
+ }
18
+ // if ref === 'function', this is a callback ref. Haven't found any solution for adjusting the height in this case
19
+ }, [
20
+ ref,
21
+ props.h
22
+ ]);
23
+ return /*#__PURE__*/ _jsx(StickyFooter, {
24
+ className: clsx(classes.footer, {
25
+ [classes.modalFooterSticky]: !!sticky
26
+ }),
27
+ ref: footerRef,
28
+ ...props
29
+ });
30
+ });
31
+
32
+ //# sourceMappingURL=ModalFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/modal/ModalFooter.tsx"],"sourcesContent":["import {useRef, useEffect} from 'react';\nimport clsx from 'clsx';\nimport {Factory, factory} from '@mantine/core';\nimport {StickyFooter, StickyFooterProps, StickyFooterStylesNames} from '../sticky-footer';\nimport classes from './Modal.module.css';\n\nexport interface ModalFooterProps extends Omit<StickyFooterProps, 'variant'> {\n /**\n * If the footer is sticky, its margin will be adjusted to counteract the padding of the Modal.Body, ensuring the footer visually sticks to the bottom of the modal.\n */\n sticky?: boolean;\n}\n\nexport type ModalFooterStylesNames = StickyFooterStylesNames;\n\nexport type ModalFooterFactory = Factory<{\n props: ModalFooterProps;\n ref: HTMLDivElement;\n stylesNames: ModalFooterStylesNames;\n}>;\n\nconst ensuresFooterHasEvenHeight = (footer: HTMLElement) => {\n const remainder = footer.offsetHeight % 2;\n footer.style.height = `${footer.offsetHeight - remainder + 2}px`;\n};\n\nexport const ModalFooter = factory<ModalFooterFactory>(({sticky, ...props}, ref) => {\n const _ref = useRef<HTMLDivElement>();\n\n const footerRef = ref || _ref;\n\n useEffect(() => {\n if (typeof footerRef !== 'function' && footerRef.current) {\n ensuresFooterHasEvenHeight(footerRef.current);\n }\n\n // if ref === 'function', this is a callback ref. Haven't found any solution for adjusting the height in this case\n }, [ref, props.h]);\n\n return (\n <StickyFooter\n className={clsx(classes.footer, {[classes.modalFooterSticky]: !!sticky})}\n ref={footerRef}\n {...props}\n />\n );\n});\n"],"names":["useRef","useEffect","clsx","factory","StickyFooter","classes","ensuresFooterHasEvenHeight","footer","remainder","offsetHeight","style","height","ModalFooter","sticky","props","ref","_ref","footerRef","current","h","className","modalFooterSticky"],"mappings":";AAAA,SAAQA,MAAM,EAAEC,SAAS,QAAO,QAAQ;AACxC,OAAOC,UAAU,OAAO;AACxB,SAAiBC,OAAO,QAAO,gBAAgB;AAC/C,SAAQC,YAAY,QAAmD,mBAAmB;AAC1F,OAAOC,aAAa,qBAAqB;AAiBzC,MAAMC,6BAA6B,CAACC;IAChC,MAAMC,YAAYD,OAAOE,YAAY,GAAG;IACxCF,OAAOG,KAAK,CAACC,MAAM,GAAG,GAAGJ,OAAOE,YAAY,GAAGD,YAAY,EAAE,EAAE,CAAC;AACpE;AAEA,OAAO,MAAMI,cAAcT,QAA4B,CAAC,EAACU,MAAM,EAAE,GAAGC,OAAM,EAAEC;IACxE,MAAMC,OAAOhB;IAEb,MAAMiB,YAAYF,OAAOC;IAEzBf,UAAU;QACN,IAAI,OAAOgB,cAAc,cAAcA,UAAUC,OAAO,EAAE;YACtDZ,2BAA2BW,UAAUC,OAAO;QAChD;IAEA,kHAAkH;IACtH,GAAG;QAACH;QAAKD,MAAMK,CAAC;KAAC;IAEjB,qBACI,KAACf;QACGgB,WAAWlB,KAAKG,QAAQE,MAAM,EAAE;YAAC,CAACF,QAAQgB,iBAAiB,CAAC,EAAE,CAAC,CAACR;QAAM;QACtEE,KAAKE;QACJ,GAAGH,KAAK;;AAGrB,GAAG"}
@@ -0,0 +1,3 @@
1
+ export * from './Modal';
2
+ export * from './ModalFooter';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/modal/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './Modal';
2
+ export * from './ModalFooter';
3
+
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/modal/index.ts"],"sourcesContent":["export * from './Modal';\nexport * from './ModalFooter';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,gBAAgB"}
@@ -1,8 +1,8 @@
1
1
  import { Factory, ModalRootProps, ModalStylesNames, StylesApiProps } from '@mantine/core';
2
2
  import { ReactNode } from 'react';
3
+ import { Modal } from '../modal';
3
4
  import { PromptCancelButton, PromptCancelButtonStylesNamesVariant } from './PromptCancelButton';
4
5
  import { PromptConfirmButton, PromptConfirmButtonStylesNamesVariant } from './PromptConfirmButton';
5
- import { PromptFooter } from './PromptFooter';
6
6
  export type PromptVariant = 'success' | 'warning' | 'critical' | 'info';
7
7
  export type PromptVars = {
8
8
  root: '--prompt-icon-size';
@@ -28,7 +28,7 @@ export type PromptFactory = Factory<{
28
28
  staticComponents: {
29
29
  CancelButton: typeof PromptCancelButton;
30
30
  ConfirmButton: typeof PromptConfirmButton;
31
- Footer: typeof PromptFooter;
31
+ Footer: typeof Modal.Footer;
32
32
  };
33
33
  }>;
34
34
  export declare const Prompt: import("@mantine/core").MantineComponent<{
@@ -40,7 +40,7 @@ export declare const Prompt: import("@mantine/core").MantineComponent<{
40
40
  staticComponents: {
41
41
  CancelButton: typeof PromptCancelButton;
42
42
  ConfirmButton: typeof PromptConfirmButton;
43
- Footer: typeof PromptFooter;
43
+ Footer: typeof Modal.Footer;
44
44
  };
45
45
  }>;
46
46
  //# sourceMappingURL=Prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/components/prompt/Prompt.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIH,OAAO,EAGP,cAAc,EACd,gBAAgB,EAChB,cAAc,EAGjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAyB,SAAS,EAAC,MAAM,OAAO,CAAC;AAOxD,OAAO,EAAC,kBAAkB,EAAE,oCAAoC,EAAC,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAC,mBAAmB,EAAE,qCAAqC,EAAC,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AACxE,MAAM,MAAM,UAAU,GAAG;IAAC,IAAI,EAAE,oBAAoB,CAAA;CAAC,CAAC;AACtD,MAAM,MAAM,iBAAiB,GACvB,gBAAgB,GAChB,MAAM,GACN,oCAAoC,GACpC,qCAAqC,CAAC;AAE5C,MAAM,WAAW,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olver, factory, Image, Modal, useProps, useStyles } from '@mantine/core';
2
+ import { Box, createVarsResolver, factory, Image, useProps, useStyles } from '@mantine/core';
3
3
  import { Children } from 'react';
4
+ import { Modal } from '../modal';
4
5
  import Critical from './icons/critical.svg';
5
6
  import Info from './icons/info.svg';
6
7
  import Success from './icons/success.svg';
@@ -9,7 +10,6 @@ import { PromptContextProvider } from './Prompt.context';
9
10
  import classes from './Prompt.module.css';
10
11
  import { PromptCancelButton } from './PromptCancelButton';
11
12
  import { PromptConfirmButton } from './PromptConfirmButton';
12
- import { PromptFooter } from './PromptFooter';
13
13
  const PROMPT_VARIANT_ICONS_SRC = {
14
14
  success: Success,
15
15
  warning: Warning,
@@ -44,9 +44,11 @@ export const Prompt = factory((_props, ref)=>{
44
44
  classNames,
45
45
  styles
46
46
  };
47
- const convertedChildren = Children.toArray(children);
48
- const otherChildren = convertedChildren.filter((child)=>child.type !== PromptFooter);
49
- const footer = convertedChildren.find((child)=>child.type === PromptFooter);
47
+ const footers = [];
48
+ const otherChildren = [];
49
+ Children.forEach(children, (child)=>{
50
+ (child.type === Modal.Footer ? footers : otherChildren).push(child);
51
+ });
50
52
  return /*#__PURE__*/ _jsx(PromptContextProvider, {
51
53
  value: {
52
54
  variant,
@@ -90,7 +92,7 @@ export const Prompt = factory((_props, ref)=>{
90
92
  children: otherChildren
91
93
  })
92
94
  }),
93
- footer
95
+ footers
94
96
  ]
95
97
  })
96
98
  ]
@@ -99,6 +101,6 @@ export const Prompt = factory((_props, ref)=>{
99
101
  });
100
102
  Prompt.CancelButton = PromptCancelButton;
101
103
  Prompt.ConfirmButton = PromptConfirmButton;
102
- Prompt.Footer = PromptFooter;
104
+ Prompt.Footer = Modal.Footer;
103
105
 
104
106
  //# sourceMappingURL=Prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {\n Box,\n createVarsResolver,\n factory,\n Factory,\n Image,\n Modal,\n ModalRootProps,\n ModalStylesNames,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport Critical from './icons/critical.svg';\nimport Info from './icons/info.svg';\nimport Success from './icons/success.svg';\nimport Warning from './icons/warning.svg';\nimport {PromptContextProvider} from './Prompt.context';\nimport classes from './Prompt.module.css';\nimport {PromptCancelButton, PromptCancelButtonStylesNamesVariant} from './PromptCancelButton';\nimport {PromptConfirmButton, PromptConfirmButtonStylesNamesVariant} from './PromptConfirmButton';\nimport {PromptFooter} from './PromptFooter';\n\nexport type PromptVariant = 'success' | 'warning' | 'critical' | 'info';\nexport type PromptVars = {root: '--prompt-icon-size'};\nexport type PromptStylesNames =\n | ModalStylesNames\n | 'icon'\n | PromptCancelButtonStylesNamesVariant\n | PromptConfirmButtonStylesNamesVariant;\n\nexport interface PromptProps\n extends StylesApiProps<PromptFactory>,\n Omit<ModalRootProps, 'classNames' | 'styles' | 'vars'> {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: PromptVariant;\n children: ReactNode;\n title: ReactNode;\n icon?: ReactNode;\n}\n\nexport type PromptFactory = Factory<{\n props: PromptProps;\n ref: HTMLDivElement;\n vars: PromptVars;\n variant: PromptVariant;\n stylesNames: PromptStylesNames;\n staticComponents: {\n CancelButton: typeof PromptCancelButton;\n ConfirmButton: typeof PromptConfirmButton;\n Footer: typeof PromptFooter;\n };\n}>;\n\nconst PROMPT_VARIANT_ICONS_SRC: Record<PromptVariant, string> = {\n success: Success,\n warning: Warning,\n critical: Critical,\n info: Info,\n};\n\nconst defaultProps: Partial<PromptProps> = {\n variant: 'info',\n centered: true,\n};\n\nconst varsResolver = createVarsResolver<PromptFactory>((_theme, {icon}) => ({\n root: {\n '--prompt-icon-size': icon ? undefined : '88px',\n },\n}));\n\nexport const Prompt = factory<PromptFactory>((_props, ref) => {\n const props = useProps('Prompt', defaultProps, _props);\n const {variant, title, icon, children, className, classNames, style, styles, unstyled, vars, ...others} = props;\n const getStyles = useStyles<PromptFactory>({\n name: 'Prompt',\n props,\n classes,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n });\n const stylesApiProps = {classNames, styles};\n\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 return (\n <PromptContextProvider value={{variant, getStyles}}>\n <Modal.Root ref={ref} variant=\"prompt\" size=\"sm\" {...others} {...getStyles('root')}>\n <Modal.Overlay {...getStyles('overlay', stylesApiProps)} />\n <Modal.Content {...getStyles('content', stylesApiProps)}>\n <Modal.Header {...getStyles('header', stylesApiProps)}>\n {icon || icon === null ? (\n icon\n ) : (\n <Image\n alt=\"\"\n role=\"presentation\"\n {...getStyles('icon', stylesApiProps)}\n src={PROMPT_VARIANT_ICONS_SRC[variant]}\n />\n )}\n <Modal.Title {...getStyles('title', stylesApiProps)}>{title}</Modal.Title>\n <Modal.CloseButton {...getStyles('close', stylesApiProps)} />\n </Modal.Header>\n <Modal.Body {...getStyles('body', stylesApiProps)}>\n <Box {...getStyles('inner', stylesApiProps)}>{otherChildren}</Box>\n </Modal.Body>\n {footer}\n </Modal.Content>\n </Modal.Root>\n </PromptContextProvider>\n );\n});\n\nPrompt.CancelButton = PromptCancelButton;\nPrompt.ConfirmButton = PromptConfirmButton;\nPrompt.Footer = PromptFooter;\n"],"names":["Box","createVarsResolver","factory","Image","Modal","useProps","useStyles","Children","Critical","Info","Success","Warning","PromptContextProvider","classes","PromptCancelButton","PromptConfirmButton","PromptFooter","PROMPT_VARIANT_ICONS_SRC","success","warning","critical","info","defaultProps","variant","centered","varsResolver","_theme","icon","root","undefined","Prompt","_props","ref","props","title","children","className","classNames","style","styles","unstyled","vars","others","getStyles","name","stylesApiProps","convertedChildren","toArray","otherChildren","filter","child","type","footer","find","value","Root","size","Overlay","Content","Header","alt","role","src","Title","CloseButton","Body","CancelButton","ConfirmButton","Footer"],"mappings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,IAAI,KAAKnC;IACzE,MAAMoC,SAASN,kBAAkBO,IAAI,CAAC,CAACH,QAAUA,MAAMC,IAAI,KAAKnC;IAEhE,qBACI,KAACJ;QAAsB0C,OAAO;YAAC/B;YAASoB;QAAS;kBAC7C,cAAA,MAACvC,MAAMmD,IAAI;YAACvB,KAAKA;YAAKT,SAAQ;YAASiC,MAAK;YAAM,GAAGd,MAAM;YAAG,GAAGC,UAAU,OAAO;;8BAC9E,KAACvC,MAAMqD,OAAO;oBAAE,GAAGd,UAAU,WAAWE,eAAe;;8BACvD,MAACzC,MAAMsD,OAAO;oBAAE,GAAGf,UAAU,WAAWE,eAAe;;sCACnD,MAACzC,MAAMuD,MAAM;4BAAE,GAAGhB,UAAU,UAAUE,eAAe;;gCAChDlB,QAAQA,SAAS,OACdA,qBAEA,KAACxB;oCACGyD,KAAI;oCACJC,MAAK;oCACJ,GAAGlB,UAAU,QAAQE,eAAe;oCACrCiB,KAAK7C,wBAAwB,CAACM,QAAQ;;8CAG9C,KAACnB,MAAM2D,KAAK;oCAAE,GAAGpB,UAAU,SAASE,eAAe;8CAAGX;;8CACtD,KAAC9B,MAAM4D,WAAW;oCAAE,GAAGrB,UAAU,SAASE,eAAe;;;;sCAE7D,KAACzC,MAAM6D,IAAI;4BAAE,GAAGtB,UAAU,QAAQE,eAAe;sCAC7C,cAAA,KAAC7C;gCAAK,GAAG2C,UAAU,SAASE,eAAe;0CAAGG;;;wBAEjDI;;;;;;AAKrB,GAAG;AAEHtB,OAAOoC,YAAY,GAAGpD;AACtBgB,OAAOqC,aAAa,GAAGpD;AACvBe,OAAOsC,MAAM,GAAGpD"}
1
+ {"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {\n Box,\n createVarsResolver,\n factory,\n Factory,\n Image,\n ModalRootProps,\n ModalStylesNames,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {Modal} from '../modal';\nimport Critical from './icons/critical.svg';\nimport Info from './icons/info.svg';\nimport Success from './icons/success.svg';\nimport Warning from './icons/warning.svg';\nimport {PromptContextProvider} from './Prompt.context';\nimport classes from './Prompt.module.css';\nimport {PromptCancelButton, PromptCancelButtonStylesNamesVariant} from './PromptCancelButton';\nimport {PromptConfirmButton, PromptConfirmButtonStylesNamesVariant} from './PromptConfirmButton';\n\nexport type PromptVariant = 'success' | 'warning' | 'critical' | 'info';\nexport type PromptVars = {root: '--prompt-icon-size'};\nexport type PromptStylesNames =\n | ModalStylesNames\n | 'icon'\n | PromptCancelButtonStylesNamesVariant\n | PromptConfirmButtonStylesNamesVariant;\n\nexport interface PromptProps\n extends StylesApiProps<PromptFactory>,\n Omit<ModalRootProps, 'classNames' | 'styles' | 'vars'> {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: PromptVariant;\n children: ReactNode;\n title: ReactNode;\n icon?: ReactNode;\n}\n\nexport type PromptFactory = Factory<{\n props: PromptProps;\n ref: HTMLDivElement;\n vars: PromptVars;\n variant: PromptVariant;\n stylesNames: PromptStylesNames;\n staticComponents: {\n CancelButton: typeof PromptCancelButton;\n ConfirmButton: typeof PromptConfirmButton;\n Footer: typeof Modal.Footer;\n };\n}>;\n\nconst PROMPT_VARIANT_ICONS_SRC: Record<PromptVariant, string> = {\n success: Success,\n warning: Warning,\n critical: Critical,\n info: Info,\n};\n\nconst defaultProps: Partial<PromptProps> = {\n variant: 'info',\n centered: true,\n};\n\nconst varsResolver = createVarsResolver<PromptFactory>((_theme, {icon}) => ({\n root: {\n '--prompt-icon-size': icon ? undefined : '88px',\n },\n}));\n\nexport const Prompt = factory<PromptFactory>((_props, ref) => {\n const props = useProps('Prompt', defaultProps, _props);\n const {variant, title, icon, children, className, classNames, style, styles, unstyled, vars, ...others} = props;\n const getStyles = useStyles<PromptFactory>({\n name: 'Prompt',\n props,\n classes,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n });\n const stylesApiProps = {classNames, styles};\n\n const footers: ReactElement[] = [];\n const otherChildren: ReactElement[] = [];\n\n Children.forEach(children, (child: ReactElement) => {\n (child.type === Modal.Footer ? footers : otherChildren).push(child);\n });\n\n return (\n <PromptContextProvider value={{variant, getStyles}}>\n <Modal.Root ref={ref} variant=\"prompt\" size=\"sm\" {...others} {...getStyles('root')}>\n <Modal.Overlay {...getStyles('overlay', stylesApiProps)} />\n <Modal.Content {...getStyles('content', stylesApiProps)}>\n <Modal.Header {...getStyles('header', stylesApiProps)}>\n {icon || icon === null ? (\n icon\n ) : (\n <Image\n alt=\"\"\n role=\"presentation\"\n {...getStyles('icon', stylesApiProps)}\n src={PROMPT_VARIANT_ICONS_SRC[variant]}\n />\n )}\n <Modal.Title {...getStyles('title', stylesApiProps)}>{title}</Modal.Title>\n <Modal.CloseButton {...getStyles('close', stylesApiProps)} />\n </Modal.Header>\n <Modal.Body {...getStyles('body', stylesApiProps)}>\n <Box {...getStyles('inner', stylesApiProps)}>{otherChildren}</Box>\n </Modal.Body>\n {footers}\n </Modal.Content>\n </Modal.Root>\n </PromptContextProvider>\n );\n});\n\nPrompt.CancelButton = PromptCancelButton;\nPrompt.ConfirmButton = PromptConfirmButton;\nPrompt.Footer = Modal.Footer;\n"],"names":["Box","createVarsResolver","factory","Image","useProps","useStyles","Children","Modal","Critical","Info","Success","Warning","PromptContextProvider","classes","PromptCancelButton","PromptConfirmButton","PROMPT_VARIANT_ICONS_SRC","success","warning","critical","info","defaultProps","variant","centered","varsResolver","_theme","icon","root","undefined","Prompt","_props","ref","props","title","children","className","classNames","style","styles","unstyled","vars","others","getStyles","name","stylesApiProps","footers","otherChildren","forEach","child","type","Footer","push","value","Root","size","Overlay","Content","Header","alt","role","src","Title","CloseButton","Body","CancelButton","ConfirmButton"],"mappings":";AAAA,SACIA,GAAG,EACHC,kBAAkB,EAClBC,OAAO,EAEPC,KAAK,EAILC,QAAQ,EACRC,SAAS,QACN,gBAAgB;AACvB,SAAQC,QAAQ,QAAgC,QAAQ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,cAAA,MAACnC,MAAM8C,IAAI;YAACtB,KAAKA;YAAKT,SAAQ;YAASgC,MAAK;YAAM,GAAGb,MAAM;YAAG,GAAGC,UAAU,OAAO;;8BAC9E,KAACnC,MAAMgD,OAAO;oBAAE,GAAGb,UAAU,WAAWE,eAAe;;8BACvD,MAACrC,MAAMiD,OAAO;oBAAE,GAAGd,UAAU,WAAWE,eAAe;;sCACnD,MAACrC,MAAMkD,MAAM;4BAAE,GAAGf,UAAU,UAAUE,eAAe;;gCAChDlB,QAAQA,SAAS,OACdA,qBAEA,KAACvB;oCACGuD,KAAI;oCACJC,MAAK;oCACJ,GAAGjB,UAAU,QAAQE,eAAe;oCACrCgB,KAAK5C,wBAAwB,CAACM,QAAQ;;8CAG9C,KAACf,MAAMsD,KAAK;oCAAE,GAAGnB,UAAU,SAASE,eAAe;8CAAGX;;8CACtD,KAAC1B,MAAMuD,WAAW;oCAAE,GAAGpB,UAAU,SAASE,eAAe;;;;sCAE7D,KAACrC,MAAMwD,IAAI;4BAAE,GAAGrB,UAAU,QAAQE,eAAe;sCAC7C,cAAA,KAAC5C;gCAAK,GAAG0C,UAAU,SAASE,eAAe;0CAAGE;;;wBAEjDD;;;;;;AAKrB,GAAG;AAEHhB,OAAOmC,YAAY,GAAGlD;AACtBe,OAAOoC,aAAa,GAAGlD;AACvBc,OAAOqB,MAAM,GAAG3C,MAAM2C,MAAM"}
@@ -14,6 +14,8 @@ export interface StickyFooterProps extends Omit<GroupProps, 'classNames' | 'styl
14
14
  *
15
15
  * The 'modal-footer' removes the modal's default padding so that the footer properly hugs the bottom of the modal.
16
16
  * It also adds a border on top of the footer.
17
+ *
18
+ * @deprecated Use Modal.Footer from @coveord/plasma-mantine/Modal for modal footers. For other cases, the 'default' variant should suffice.
17
19
  */
18
20
  variant?: 'default' | 'modal-footer';
19
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StickyFooter.d.ts","sourceRoot":"","sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAS,UAAU,EAAE,cAAc,EAA+B,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhC,MAAM,WAAW,iBACb,SAAQ,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC,EAClE,cAAc,CAAC,mBAAmB,CAAC;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC;CACxC;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE7C,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;IACtC,KAAK,EAAE,iBAAiB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;IACpB,WAAW,EAAE,uBAAuB,CAAC;CACxC,CAAC,CAAC;AAOH,eAAO,MAAM,YAAY;WAVd,iBAAiB;SACnB,cAAc;iBACN,uBAAuB;EAoCtC,CAAC"}
1
+ {"version":3,"file":"StickyFooter.d.ts","sourceRoot":"","sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAS,UAAU,EAAE,cAAc,EAA+B,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhC,MAAM,WAAW,iBACb,SAAQ,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC,EAClE,cAAc,CAAC,mBAAmB,CAAC;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,cAAc,CAAC;CACxC;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAE7C,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;IACtC,KAAK,EAAE,iBAAiB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;IACpB,WAAW,EAAE,uBAAuB,CAAC;CACxC,CAAC,CAAC;AAOH,eAAO,MAAM,YAAY;WAVd,iBAAiB;SACnB,cAAc;iBACN,uBAAuB;EAoCtC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"sourcesContent":["import {Factory, Group, GroupProps, StylesApiProps, factory, useProps, useStyles} from '@mantine/core';\nimport clsx from 'clsx';\nimport {ReactNode} from 'react';\nimport classes from './StickyFooter.module.css';\n\nexport interface StickyFooterProps\n extends Omit<GroupProps, 'classNames' | 'styles' | 'vars' | 'variant'>,\n StylesApiProps<StickyFooterFactory> {\n /**\n * Whether a border is render on top of the footer\n */\n borderTop?: boolean;\n /**\n * Footer's children, usually buttons\n */\n children?: ReactNode;\n /**\n * Use variant 'modal-footer' when rendering the `StickyFooter` inside `Modal`.\n *\n * The 'modal-footer' removes the modal's default padding so that the footer properly hugs the bottom of the modal.\n * It also adds a border on top of the footer.\n */\n variant?: 'default' | 'modal-footer';\n}\n\nexport type StickyFooterStylesNames = 'root';\n\nexport type StickyFooterFactory = Factory<{\n props: StickyFooterProps;\n ref: HTMLDivElement;\n stylesNames: StickyFooterStylesNames;\n}>;\n\nconst defaultProps: Partial<StickyFooterProps> = {\n gap: 'sm',\n justify: 'flex-end',\n};\n\nexport const StickyFooter = factory<StickyFooterFactory>((props, ref) => {\n const {borderTop, justify, gap, children, className, classNames, style, styles, unstyled, vars, ...others} =\n useProps('StickyFooter', defaultProps, props);\n const getStyles = useStyles<StickyFooterFactory>({\n name: 'StickyFooter',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n });\n\n const css = getStyles('root');\n\n return (\n <Group\n justify={justify}\n gap={gap}\n className={clsx(css.className, {[classes.border]: !!borderTop})}\n style={css.style}\n ref={ref}\n {...others}\n >\n {children}\n </Group>\n );\n});\n"],"names":["Group","factory","useProps","useStyles","clsx","classes","defaultProps","gap","justify","StickyFooter","props","ref","borderTop","children","className","classNames","style","styles","unstyled","vars","others","getStyles","name","css","border"],"mappings":";AAAA,SAAiBA,KAAK,EAA8BC,OAAO,EAAEC,QAAQ,EAAEC,SAAS,QAAO,gBAAgB;AACvG,OAAOC,UAAU,OAAO;AAExB,OAAOC,aAAa,4BAA4B;AA8BhD,MAAMC,eAA2C;IAC7CC,KAAK;IACLC,SAAS;AACb;AAEA,OAAO,MAAMC,eAAeR,QAA6B,CAACS,OAAOC;IAC7D,MAAM,EAACC,SAAS,EAAEJ,OAAO,EAAED,GAAG,EAAEM,QAAQ,EAAEC,SAAS,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC,QAAO,GACtGlB,SAAS,gBAAgBI,cAAcI;IAC3C,MAAMW,YAAYlB,UAA+B;QAC7CmB,MAAM;QACNjB;QACAK;QACAI;QACAE;QACAD;QACAE;QACAC;IACJ;IAEA,MAAMK,MAAMF,UAAU;IAEtB,qBACI,KAACrB;QACGQ,SAASA;QACTD,KAAKA;QACLO,WAAWV,KAAKmB,IAAIT,SAAS,EAAE;YAAC,CAACT,QAAQmB,MAAM,CAAC,EAAE,CAAC,CAACZ;QAAS;QAC7DI,OAAOO,IAAIP,KAAK;QAChBL,KAAKA;QACJ,GAAGS,MAAM;kBAETP;;AAGb,GAAG"}
1
+ {"version":3,"sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"sourcesContent":["import {Factory, Group, GroupProps, StylesApiProps, factory, useProps, useStyles} from '@mantine/core';\nimport clsx from 'clsx';\nimport {ReactNode} from 'react';\nimport classes from './StickyFooter.module.css';\n\nexport interface StickyFooterProps\n extends Omit<GroupProps, 'classNames' | 'styles' | 'vars' | 'variant'>,\n StylesApiProps<StickyFooterFactory> {\n /**\n * Whether a border is render on top of the footer\n */\n borderTop?: boolean;\n /**\n * Footer's children, usually buttons\n */\n children?: ReactNode;\n /**\n * Use variant 'modal-footer' when rendering the `StickyFooter` inside `Modal`.\n *\n * The 'modal-footer' removes the modal's default padding so that the footer properly hugs the bottom of the modal.\n * It also adds a border on top of the footer.\n *\n * @deprecated Use Modal.Footer from @coveord/plasma-mantine/Modal for modal footers. For other cases, the 'default' variant should suffice.\n */\n variant?: 'default' | 'modal-footer';\n}\n\nexport type StickyFooterStylesNames = 'root';\n\nexport type StickyFooterFactory = Factory<{\n props: StickyFooterProps;\n ref: HTMLDivElement;\n stylesNames: StickyFooterStylesNames;\n}>;\n\nconst defaultProps: Partial<StickyFooterProps> = {\n gap: 'sm',\n justify: 'flex-end',\n};\n\nexport const StickyFooter = factory<StickyFooterFactory>((props, ref) => {\n const {borderTop, justify, gap, children, className, classNames, style, styles, unstyled, vars, ...others} =\n useProps('StickyFooter', defaultProps, props);\n const getStyles = useStyles<StickyFooterFactory>({\n name: 'StickyFooter',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n });\n\n const css = getStyles('root');\n\n return (\n <Group\n justify={justify}\n gap={gap}\n className={clsx(css.className, {[classes.border]: !!borderTop})}\n style={css.style}\n ref={ref}\n {...others}\n >\n {children}\n </Group>\n );\n});\n"],"names":["Group","factory","useProps","useStyles","clsx","classes","defaultProps","gap","justify","StickyFooter","props","ref","borderTop","children","className","classNames","style","styles","unstyled","vars","others","getStyles","name","css","border"],"mappings":";AAAA,SAAiBA,KAAK,EAA8BC,OAAO,EAAEC,QAAQ,EAAEC,SAAS,QAAO,gBAAgB;AACvG,OAAOC,UAAU,OAAO;AAExB,OAAOC,aAAa,4BAA4B;AAgChD,MAAMC,eAA2C;IAC7CC,KAAK;IACLC,SAAS;AACb;AAEA,OAAO,MAAMC,eAAeR,QAA6B,CAACS,OAAOC;IAC7D,MAAM,EAACC,SAAS,EAAEJ,OAAO,EAAED,GAAG,EAAEM,QAAQ,EAAEC,SAAS,EAAEC,UAAU,EAAEC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC,QAAO,GACtGlB,SAAS,gBAAgBI,cAAcI;IAC3C,MAAMW,YAAYlB,UAA+B;QAC7CmB,MAAM;QACNjB;QACAK;QACAI;QACAE;QACAD;QACAE;QACAC;IACJ;IAEA,MAAMK,MAAMF,UAAU;IAEtB,qBACI,KAACrB;QACGQ,SAASA;QACTD,KAAKA;QACLO,WAAWV,KAAKmB,IAAIT,SAAS,EAAE;YAAC,CAACT,QAAQmB,MAAM,CAAC,EAAE,CAAC,CAACZ;QAAS;QAC7DI,OAAOO,IAAIP,KAAK;QAChBL,KAAKA;QACJ,GAAGS,MAAM;kBAETP;;AAGb,GAAG"}
@@ -11,7 +11,7 @@ export { type NotificationsProps } from '@mantine/notifications';
11
11
  export * from '@tanstack/table-core';
12
12
  export * from './components';
13
13
  export { noop };
14
- export { ActionIcon, BrowserPreview, Button, CopyToClipboard, Header, Menu, PasswordInput, Select, Table, type ActionIconProps, type ButtonProps, type CopyToClipboardProps, type HeaderProps, type MenuItemProps, type TableProps, type TableState, } from './components';
14
+ export { ActionIcon, BrowserPreview, Button, CopyToClipboard, Header, Menu, Modal, PasswordInput, Select, Table, type ActionIconProps, type ButtonProps, type CopyToClipboardProps, type HeaderProps, type MenuItemProps, type ModalFactory, type TableProps, type TableState, } from './components';
15
15
  export * from './theme';
16
16
  declare module '@mantine/core' {
17
17
  interface MantineThemeColorsOverride {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAC,KAAK,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEv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9B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAC,KAAK,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC/D,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,IAAI,EAAC,CAAC;AAGd,OAAO,EACH,UAAU,EACV,cAAc,EACd,MAAM,EACN,eAAe,EACf,MAAM,EACN,IAAI,EACJ,KAAK,EACL,aAAa,EACb,MAAM,EACN,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,UAAU,GAClB,MAAM,cAAc,CAAC;AAEtB,cAAc,SAAS,CAAC;AAExB,OAAO,QAAQ,eAAe,CAAC;IAC3B,UAAiB,0BAA0B;QACvC,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,kBAAkB,CAAC,CAAC;KACjF;CACJ;AAED,OAAO,QAAQ,uBAAuB,CAAC;IACnC,UAAU,UAAU,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM;QAC9C;;;;WAIG;QACH,aAAa,EAAE,OAAO,CAAC;KAC1B;CACJ"}
package/dist/esm/index.js CHANGED
@@ -9,7 +9,7 @@ export * from '@tanstack/table-core';
9
9
  export * from './components';
10
10
  export { noop };
11
11
  // explicitly overriding mantine components
12
- export { ActionIcon, BrowserPreview, Button, CopyToClipboard, Header, Menu, PasswordInput, Select, Table } from './components';
12
+ export { ActionIcon, BrowserPreview, Button, CopyToClipboard, Header, Menu, Modal, PasswordInput, Select, Table } from './components';
13
13
  export * from './theme';
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {MantineColorsTuple, noop} from '@mantine/core';\nimport {type RowData} from '@tanstack/table-core';\nimport {type PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport {Pagination} from '@mantine/core';\nexport * from '@mantine/form';\nexport * from '@mantine/hooks';\nexport * from '@mantine/notifications';\nexport {type NotificationsProps} from '@mantine/notifications';\nexport * from '@tanstack/table-core';\nexport * from './components';\nexport {noop};\n\n// explicitly overriding mantine components\nexport {\n ActionIcon,\n BrowserPreview,\n Button,\n CopyToClipboard,\n Header,\n Menu,\n PasswordInput,\n Select,\n Table,\n type ActionIconProps,\n type ButtonProps,\n type CopyToClipboardProps,\n type HeaderProps,\n type MenuItemProps,\n type TableProps,\n type TableState,\n} from './components';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n colors: Record<keyof typeof PlasmaColors | (string & {}), MantineColorsTuple>;\n }\n}\n\ndeclare module '@tanstack/react-table' {\n interface ColumnMeta<TData extends RowData, TValue> {\n /**\n * Whether the column is a control column.\n * Control columns are columns that are not part of the data but are used to control the table.\n * For example, a column that contains checkboxes to select rows.\n */\n controlColumn: boolean;\n }\n}\n"],"names":["noop","Pagination","ActionIcon","BrowserPreview","Button","CopyToClipboard","Header","Menu","PasswordInput","Select","Table"],"mappings":"AAAA,SAA4BA,IAAI,QAAO,gBAAgB;AAIvD,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,SAAQC,UAAU,QAAO,gBAAgB;AACzC,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,yBAAyB;AAEvC,cAAc,uBAAuB;AACrC,cAAc,eAAe;AAC7B,SAAQD,IAAI,GAAE;AAEd,2CAA2C;AAC3C,SACIE,UAAU,EACVC,cAAc,EACdC,MAAM,EACNC,eAAe,EACfC,MAAM,EACNC,IAAI,EACJC,aAAa,EACbC,MAAM,EACNC,KAAK,QAQF,eAAe;AAEtB,cAAc,UAAU"}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {MantineColorsTuple, noop} from '@mantine/core';\nimport {type RowData} from '@tanstack/table-core';\nimport {type PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport {Pagination} from '@mantine/core';\nexport * from '@mantine/form';\nexport * from '@mantine/hooks';\nexport * from '@mantine/notifications';\nexport {type NotificationsProps} from '@mantine/notifications';\nexport * from '@tanstack/table-core';\nexport * from './components';\nexport {noop};\n\n// explicitly overriding mantine components\nexport {\n ActionIcon,\n BrowserPreview,\n Button,\n CopyToClipboard,\n Header,\n Menu,\n Modal,\n PasswordInput,\n Select,\n Table,\n type ActionIconProps,\n type ButtonProps,\n type CopyToClipboardProps,\n type HeaderProps,\n type MenuItemProps,\n type ModalFactory,\n type TableProps,\n type TableState,\n} from './components';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n colors: Record<keyof typeof PlasmaColors | (string & {}), MantineColorsTuple>;\n }\n}\n\ndeclare module '@tanstack/react-table' {\n interface ColumnMeta<TData extends RowData, TValue> {\n /**\n * Whether the column is a control column.\n * Control columns are columns that are not part of the data but are used to control the table.\n * For example, a column that contains checkboxes to select rows.\n */\n controlColumn: boolean;\n }\n}\n"],"names":["noop","Pagination","ActionIcon","BrowserPreview","Button","CopyToClipboard","Header","Menu","Modal","PasswordInput","Select","Table"],"mappings":"AAAA,SAA4BA,IAAI,QAAO,gBAAgB;AAIvD,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,SAAQC,UAAU,QAAO,gBAAgB;AACzC,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,yBAAyB;AAEvC,cAAc,uBAAuB;AACrC,cAAc,eAAe;AAC7B,SAAQD,IAAI,GAAE;AAEd,2CAA2C;AAC3C,SACIE,UAAU,EACVC,cAAc,EACdC,MAAM,EACNC,eAAe,EACfC,MAAM,EACNC,IAAI,EACJC,KAAK,EACLC,aAAa,EACbC,MAAM,EACNC,KAAK,QASF,eAAe;AAEtB,cAAc,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveord/plasma-mantine",
3
- "version": "55.6.0",
3
+ "version": "55.7.0",
4
4
  "description": "A Plasma flavoured Mantine theme",
5
5
  "keywords": [
6
6
  "plasma",
@@ -27,56 +27,56 @@
27
27
  "main": "./dist/cjs/index.js",
28
28
  "module": "./dist/esm/index.js",
29
29
  "dependencies": {
30
- "@dnd-kit/core": "6.2.0",
30
+ "@dnd-kit/core": "6.3.1",
31
31
  "@dnd-kit/modifiers": "9.0.0",
32
32
  "@dnd-kit/sortable": "10.0.0",
33
33
  "@dnd-kit/utilities": "3.2.2",
34
34
  "@mantine/utils": "6.0.22",
35
35
  "@monaco-editor/react": "4.6.0",
36
36
  "@swc/helpers": "0.5.15",
37
- "@tanstack/react-table": "8.20.5",
37
+ "@tanstack/react-table": "8.20.6",
38
38
  "@tanstack/table-core": "8.20.5",
39
39
  "clsx": "2.1.1",
40
40
  "dayjs": "1.11.13",
41
41
  "fast-deep-equal": "3.1.3",
42
42
  "lodash.debounce": "4.0.8",
43
43
  "lodash.defaultsdeep": "4.6.1",
44
- "monaco-editor": "0.52.0",
45
- "@coveord/plasma-react-icons": "55.4.0",
46
- "@coveord/plasma-tokens": "55.4.0"
44
+ "monaco-editor": "0.52.2",
45
+ "@coveord/plasma-react-icons": "55.7.0",
46
+ "@coveord/plasma-tokens": "55.7.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@mantine/carousel": "7.14.3",
50
- "@mantine/code-highlight": "7.14.3",
51
- "@mantine/core": "7.14.3",
52
- "@mantine/dates": "7.14.3",
53
- "@mantine/form": "7.14.3",
54
- "@mantine/hooks": "7.14.3",
55
- "@mantine/modals": "7.14.3",
56
- "@mantine/notifications": "7.14.3",
57
- "@swc/cli": "0.5.2",
58
- "@swc/core": "1.9.3",
49
+ "@mantine/carousel": "7.16.0",
50
+ "@mantine/code-highlight": "7.16.0",
51
+ "@mantine/core": "7.16.0",
52
+ "@mantine/dates": "7.16.0",
53
+ "@mantine/form": "7.16.0",
54
+ "@mantine/hooks": "7.16.0",
55
+ "@mantine/modals": "7.16.0",
56
+ "@mantine/notifications": "7.16.0",
57
+ "@swc/cli": "0.6.0",
58
+ "@swc/core": "1.10.7",
59
59
  "@testing-library/dom": "10.4.0",
60
60
  "@testing-library/jest-dom": "6.6.3",
61
- "@testing-library/react": "16.0.1",
62
- "@testing-library/user-event": "14.5.2",
61
+ "@testing-library/react": "16.2.0",
62
+ "@testing-library/user-event": "14.6.0",
63
63
  "@types/lodash.debounce": "4.0.9",
64
64
  "@types/lodash.defaultsdeep": "4.6.9",
65
- "@types/react": "18.3.12",
66
- "@types/react-dom": "18.3.1",
65
+ "@types/react": "18.3.18",
66
+ "@types/react-dom": "18.3.5",
67
67
  "embla-carousel-react": "7.1.0",
68
68
  "identity-obj-proxy": "3.0.0",
69
69
  "jsdom": "26.0.0",
70
- "postcss": "8.4.49",
70
+ "postcss": "8.5.1",
71
71
  "postcss-preset-mantine": "^1.11.0",
72
72
  "postcss-simple-vars": "^7.0.1",
73
- "publint": "0.2.12",
73
+ "publint": "0.3.2",
74
74
  "react": "18.3.1",
75
75
  "react-dom": "18.3.1",
76
76
  "rimraf": "6.0.1",
77
- "sass": "1.81.1",
77
+ "sass": "1.83.4",
78
78
  "tslib": "2.8.1",
79
- "typescript": "5.7.2",
79
+ "typescript": "5.7.3",
80
80
  "vitest": "2.1.8"
81
81
  },
82
82
  "peerDependencies": {
@@ -10,6 +10,7 @@ export * from './ellipsis-text';
10
10
  export * from './header';
11
11
  export * from './inline-confirm';
12
12
  export * from './menu';
13
+ export * from './modal';
13
14
  export * from './prompt';
14
15
  export * from './read-only';
15
16
  export * from './sticky-footer';
@@ -0,0 +1,9 @@
1
+ .footer {
2
+ border-top: 1px solid var(--mantine-color-gray-3);
3
+ }
4
+
5
+ .modalFooterSticky {
6
+ padding-bottom: 0;
7
+ margin: var(--mb-padding) calc(-1 * var(--mb-padding)) calc(var(--mantine-spacing-md) - var(--mb-padding))
8
+ calc(-1 * var(--mb-padding));
9
+ }
@@ -0,0 +1,33 @@
1
+ import {
2
+ factory,
3
+ Modal as MantineModal,
4
+ ModalFactory as MantineModalFactory,
5
+ ModalProps as MantineModalProps,
6
+ } from '@mantine/core';
7
+ import {ModalFooter, ModalFooter as PlasmaModalFooter} from './ModalFooter';
8
+
9
+ // Need to redeclare the factory to override and add footer to the props type
10
+ type PlasmaModalFactory = Omit<MantineModalFactory, 'staticComponents'> & {
11
+ staticComponents: MantineModalFactory['staticComponents'] & {
12
+ Footer: typeof ModalFooter;
13
+ };
14
+ };
15
+
16
+ const PlasmaModal = factory<PlasmaModalFactory>((props: MantineModalProps, ref) => (
17
+ <MantineModal ref={ref} {...props} />
18
+ ));
19
+
20
+ PlasmaModal.displayName = '@coveord/plasma-mantine/Modal';
21
+ PlasmaModal.Root = MantineModal.Root;
22
+ PlasmaModal.Body = MantineModal.Body;
23
+ PlasmaModal.Overlay = MantineModal.Overlay;
24
+ PlasmaModal.Content = MantineModal.Content;
25
+ PlasmaModal.Header = MantineModal.Header;
26
+ PlasmaModal.Title = MantineModal.Title;
27
+ PlasmaModal.CloseButton = MantineModal.CloseButton;
28
+ PlasmaModal.Stack = MantineModal.Stack;
29
+ PlasmaModal.Footer = PlasmaModalFooter;
30
+
31
+ export const Modal = PlasmaModal;
32
+
33
+ export type ModalFactory = PlasmaModalFactory;
@@ -0,0 +1,47 @@
1
+ import {useRef, useEffect} from 'react';
2
+ import clsx from 'clsx';
3
+ import {Factory, factory} from '@mantine/core';
4
+ import {StickyFooter, StickyFooterProps, StickyFooterStylesNames} from '../sticky-footer';
5
+ import classes from './Modal.module.css';
6
+
7
+ export interface ModalFooterProps extends Omit<StickyFooterProps, 'variant'> {
8
+ /**
9
+ * If the footer is sticky, its margin will be adjusted to counteract the padding of the Modal.Body, ensuring the footer visually sticks to the bottom of the modal.
10
+ */
11
+ sticky?: boolean;
12
+ }
13
+
14
+ export type ModalFooterStylesNames = StickyFooterStylesNames;
15
+
16
+ export type ModalFooterFactory = Factory<{
17
+ props: ModalFooterProps;
18
+ ref: HTMLDivElement;
19
+ stylesNames: ModalFooterStylesNames;
20
+ }>;
21
+
22
+ const ensuresFooterHasEvenHeight = (footer: HTMLElement) => {
23
+ const remainder = footer.offsetHeight % 2;
24
+ footer.style.height = `${footer.offsetHeight - remainder + 2}px`;
25
+ };
26
+
27
+ export const ModalFooter = factory<ModalFooterFactory>(({sticky, ...props}, ref) => {
28
+ const _ref = useRef<HTMLDivElement>();
29
+
30
+ const footerRef = ref || _ref;
31
+
32
+ useEffect(() => {
33
+ if (typeof footerRef !== 'function' && footerRef.current) {
34
+ ensuresFooterHasEvenHeight(footerRef.current);
35
+ }
36
+
37
+ // if ref === 'function', this is a callback ref. Haven't found any solution for adjusting the height in this case
38
+ }, [ref, props.h]);
39
+
40
+ return (
41
+ <StickyFooter
42
+ className={clsx(classes.footer, {[classes.modalFooterSticky]: !!sticky})}
43
+ ref={footerRef}
44
+ {...props}
45
+ />
46
+ );
47
+ });
@@ -0,0 +1,25 @@
1
+ import {render, screen} from '@test-utils';
2
+
3
+ import {Modal} from '../Modal';
4
+
5
+ // Since most part of the modal component directly inherits @mantine/core, many tests are likely covered by Mantine, so we only add tests about our customizations
6
+ describe('Modal', () => {
7
+ it('renders footer', () => {
8
+ render(
9
+ <Modal opened={true} onClose={vi.fn()}>
10
+ <Modal.Footer sticky>im the footer</Modal.Footer>
11
+ </Modal>,
12
+ );
13
+
14
+ expect(screen.getByText('im the footer')).toBeInTheDocument();
15
+ });
16
+ it('renders footer in root', () => {
17
+ render(
18
+ <Modal.Root opened={true} onClose={vi.fn()}>
19
+ <Modal.Footer>im the footer</Modal.Footer>
20
+ </Modal.Root>,
21
+ );
22
+
23
+ expect(screen.getByText('im the footer')).toBeInTheDocument();
24
+ });
25
+ });
@@ -0,0 +1,35 @@
1
+ import {render, screen} from '@test-utils';
2
+
3
+ import {Modal} from '../Modal';
4
+
5
+ describe('ModalFooter', () => {
6
+ it('renders children', () => {
7
+ render(
8
+ <Modal.Footer>
9
+ <div>im the children</div>
10
+ </Modal.Footer>,
11
+ );
12
+
13
+ expect(screen.getByText('im the children')).toBeInTheDocument();
14
+ });
15
+ it('includes the .modalFooterSticky class styling if set to sticky', () => {
16
+ render(
17
+ <Modal.Footer sticky>
18
+ <div>im the children</div>
19
+ </Modal.Footer>,
20
+ );
21
+
22
+ const footer = screen.getByText('im the children').parentElement;
23
+ expect(footer.className).contains('modalFooterSticky');
24
+ });
25
+ it('has an even height value to ensure the footer sticks completely to the bottom as a workaround to the footer positioning issue when height value is odd', () => {
26
+ render(
27
+ <Modal.Footer h={99}>
28
+ <div>im the children</div>
29
+ </Modal.Footer>,
30
+ );
31
+
32
+ const footer = screen.getByText('im the children').parentElement;
33
+ expect(footer.offsetHeight % 2).lessThanOrEqual(Number.EPSILON);
34
+ });
35
+ });
@@ -0,0 +1,2 @@
1
+ export * from './Modal';
2
+ export * from './ModalFooter';
@@ -4,7 +4,6 @@ import {
4
4
  factory,
5
5
  Factory,
6
6
  Image,
7
- Modal,
8
7
  ModalRootProps,
9
8
  ModalStylesNames,
10
9
  StylesApiProps,
@@ -12,6 +11,7 @@ import {
12
11
  useStyles,
13
12
  } from '@mantine/core';
14
13
  import {Children, ReactElement, ReactNode} from 'react';
14
+ import {Modal} from '../modal';
15
15
  import Critical from './icons/critical.svg';
16
16
  import Info from './icons/info.svg';
17
17
  import Success from './icons/success.svg';
@@ -20,7 +20,6 @@ import {PromptContextProvider} from './Prompt.context';
20
20
  import classes from './Prompt.module.css';
21
21
  import {PromptCancelButton, PromptCancelButtonStylesNamesVariant} from './PromptCancelButton';
22
22
  import {PromptConfirmButton, PromptConfirmButtonStylesNamesVariant} from './PromptConfirmButton';
23
- import {PromptFooter} from './PromptFooter';
24
23
 
25
24
  export type PromptVariant = 'success' | 'warning' | 'critical' | 'info';
26
25
  export type PromptVars = {root: '--prompt-icon-size'};
@@ -53,7 +52,7 @@ export type PromptFactory = Factory<{
53
52
  staticComponents: {
54
53
  CancelButton: typeof PromptCancelButton;
55
54
  ConfirmButton: typeof PromptConfirmButton;
56
- Footer: typeof PromptFooter;
55
+ Footer: typeof Modal.Footer;
57
56
  };
58
57
  }>;
59
58
 
@@ -92,10 +91,12 @@ export const Prompt = factory<PromptFactory>((_props, ref) => {
92
91
  });
93
92
  const stylesApiProps = {classNames, styles};
94
93
 
95
- const convertedChildren = Children.toArray(children) as ReactElement[];
94
+ const footers: ReactElement[] = [];
95
+ const otherChildren: ReactElement[] = [];
96
96
 
97
- const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);
98
- const footer = convertedChildren.find((child) => child.type === PromptFooter);
97
+ Children.forEach(children, (child: ReactElement) => {
98
+ (child.type === Modal.Footer ? footers : otherChildren).push(child);
99
+ });
99
100
 
100
101
  return (
101
102
  <PromptContextProvider value={{variant, getStyles}}>
@@ -119,7 +120,7 @@ export const Prompt = factory<PromptFactory>((_props, ref) => {
119
120
  <Modal.Body {...getStyles('body', stylesApiProps)}>
120
121
  <Box {...getStyles('inner', stylesApiProps)}>{otherChildren}</Box>
121
122
  </Modal.Body>
122
- {footer}
123
+ {footers}
123
124
  </Modal.Content>
124
125
  </Modal.Root>
125
126
  </PromptContextProvider>
@@ -128,4 +129,4 @@ export const Prompt = factory<PromptFactory>((_props, ref) => {
128
129
 
129
130
  Prompt.CancelButton = PromptCancelButton;
130
131
  Prompt.ConfirmButton = PromptConfirmButton;
131
- Prompt.Footer = PromptFooter;
132
+ Prompt.Footer = Modal.Footer;
@@ -19,6 +19,8 @@ export interface StickyFooterProps
19
19
  *
20
20
  * The 'modal-footer' removes the modal's default padding so that the footer properly hugs the bottom of the modal.
21
21
  * It also adds a border on top of the footer.
22
+ *
23
+ * @deprecated Use Modal.Footer from @coveord/plasma-mantine/Modal for modal footers. For other cases, the 'default' variant should suffice.
22
24
  */
23
25
  variant?: 'default' | 'modal-footer';
24
26
  }
package/src/index.ts CHANGED
@@ -21,6 +21,7 @@ export {
21
21
  CopyToClipboard,
22
22
  Header,
23
23
  Menu,
24
+ Modal,
24
25
  PasswordInput,
25
26
  Select,
26
27
  Table,
@@ -29,6 +30,7 @@ export {
29
30
  type CopyToClipboardProps,
30
31
  type HeaderProps,
31
32
  type MenuItemProps,
33
+ type ModalFactory,
32
34
  type TableProps,
33
35
  type TableState,
34
36
  } from './components';
@@ -1,6 +0,0 @@
1
- import { FunctionComponent, PropsWithChildren } from 'react';
2
- import { StickyFooterProps } from '../sticky-footer';
3
- export interface PromptFooterProps extends StickyFooterProps {
4
- }
5
- export declare const PromptFooter: FunctionComponent<PropsWithChildren<PromptFooterProps>>;
6
- //# sourceMappingURL=PromptFooter.d.ts.map