@recursica/mantine-adapter 0.9.3 → 1.0.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.
- package/README.md +275 -292
- package/dist/assets/src/components/Accordion/Accordion.css.ts.vanilla-BnZlbbJN.css +31 -0
- package/dist/index.d.ts +38 -0
- package/dist/mantine-adapter.cjs +94 -0
- package/dist/mantine-adapter.cjs.map +1 -0
- package/dist/mantine-adapter.css +0 -0
- package/dist/mantine-adapter.js +90 -0
- package/dist/mantine-adapter.js.map +1 -0
- package/package.json +80 -34
- package/dist/index.js +0 -917
- package/dist/index.js.map +0 -1
- package/dist/main.cjs +0 -924
- package/dist/main.cjs.map +0 -1
- package/dist/main.js +0 -922
- package/dist/main.js.map +0 -1
- package/dist/webworker.js +0 -787
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.recursica-15e76700 {
|
|
2
|
+
min-width: var(--accordion-size-min-width);
|
|
3
|
+
max-width: var(--accordion-size-max-width);
|
|
4
|
+
padding: var(--dimension-lg);
|
|
5
|
+
padding-bottom: var(--dimension-lg);
|
|
6
|
+
align-items: center;
|
|
7
|
+
}
|
|
8
|
+
.recursica-15e76701 {
|
|
9
|
+
font-family: var(--typography-subtitle-1-normal-font-family);
|
|
10
|
+
font-size: var(--typography-subtitle-1-normal-font-size);
|
|
11
|
+
font-weight: var(--typography-subtitle-1-normal-font-weight);
|
|
12
|
+
line-height: var(--typography-subtitle-1-normal-line-height);
|
|
13
|
+
letter-spacing: var(--typography-subtitle-1-normal-letter-spacing);
|
|
14
|
+
padding: 0;
|
|
15
|
+
}
|
|
16
|
+
.recursica-15e76702 {
|
|
17
|
+
min-width: var(--accordion-size-min-width);
|
|
18
|
+
max-width: var(--accordion-size-max-width);
|
|
19
|
+
border-color: undefined;
|
|
20
|
+
border: 1px solid;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
.recursica-15e76703 {
|
|
24
|
+
font-family: var(--typography-body-1-normal-font-family);
|
|
25
|
+
font-size: var(--typography-body-1-normal-font-size);
|
|
26
|
+
font-weight: var(--typography-body-1-normal-font-weight);
|
|
27
|
+
line-height: var(--typography-body-1-normal-line-height);
|
|
28
|
+
letter-spacing: var(--typography-body-1-normal-letter-spacing);
|
|
29
|
+
padding: var(--dimension-lg);
|
|
30
|
+
padding-top: 0;
|
|
31
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { AccordionProps as AccordionProps$1, Accordion as Accordion$1 } from '@mantine/core';
|
|
3
|
+
import React$1 from 'react';
|
|
4
|
+
|
|
5
|
+
type AccordionProps = AccordionProps$1;
|
|
6
|
+
declare const AccordionWrapper: (props: AccordionProps) => react_jsx_runtime.JSX.Element;
|
|
7
|
+
type AccordionComponent = typeof AccordionWrapper & {
|
|
8
|
+
Item: typeof Accordion$1.Item;
|
|
9
|
+
Control: typeof Accordion$1.Control;
|
|
10
|
+
Panel: typeof Accordion$1.Panel;
|
|
11
|
+
};
|
|
12
|
+
declare const Accordion: AccordionComponent;
|
|
13
|
+
|
|
14
|
+
interface ThemeProviderProps {
|
|
15
|
+
currentTheme?: string;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
declare function ThemeProvider({ children, currentTheme }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
interface ComboboxItem {
|
|
21
|
+
value: string;
|
|
22
|
+
label: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
icon?: string;
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type OmitStyles<T> = Omit<T, "style" | "classNames" | "className" | "styles">;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Helper function for copy text to clipboard
|
|
32
|
+
* @param {string} textToCopy The text string for copying to the clipboard
|
|
33
|
+
* @param {element|node} componentRef The ref of the component that we want to trigger the copy
|
|
34
|
+
*/
|
|
35
|
+
declare const copyToClipboard: (textToCopy: string, componentRef: React$1.RefObject<HTMLElement | null>) => Promise<void>;
|
|
36
|
+
|
|
37
|
+
export { Accordion, ThemeProvider, copyToClipboard };
|
|
38
|
+
export type { AccordionProps, ComboboxItem, OmitStyles };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var core = require('@mantine/core');
|
|
5
|
+
require('./assets/src/components/Accordion/Accordion.css.ts.vanilla-BnZlbbJN.css');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
|
|
8
|
+
var content = 'recursica-15e76703';
|
|
9
|
+
var control = 'recursica-15e76700';
|
|
10
|
+
var item = 'recursica-15e76702';
|
|
11
|
+
var label = 'recursica-15e76701';
|
|
12
|
+
|
|
13
|
+
var styles = /*#__PURE__*/Object.freeze({
|
|
14
|
+
__proto__: null,
|
|
15
|
+
content: content,
|
|
16
|
+
control: control,
|
|
17
|
+
item: item,
|
|
18
|
+
label: label
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const AccordionWrapper = (props) => {
|
|
22
|
+
return (jsxRuntime.jsx(core.Accordion, { ...props, classNames: {
|
|
23
|
+
...styles,
|
|
24
|
+
...props.classNames,
|
|
25
|
+
} }));
|
|
26
|
+
};
|
|
27
|
+
// Export the main Accordion component with dot notation
|
|
28
|
+
const Accordion = Object.assign(AccordionWrapper, {
|
|
29
|
+
Item: core.Accordion.Item,
|
|
30
|
+
Control: core.Accordion.Control,
|
|
31
|
+
Panel: core.Accordion.Panel,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const THEME_DATA_ATTRIBUTE = "data-current-theme";
|
|
35
|
+
function ThemeProvider({ children, currentTheme }) {
|
|
36
|
+
react.useEffect(() => {
|
|
37
|
+
if (!currentTheme)
|
|
38
|
+
return;
|
|
39
|
+
const root = document.documentElement;
|
|
40
|
+
// Get the previously applied theme class from data attribute
|
|
41
|
+
const previousTheme = root.getAttribute(THEME_DATA_ATTRIBUTE);
|
|
42
|
+
// Remove the previous theme class if it exists
|
|
43
|
+
if (previousTheme) {
|
|
44
|
+
root.classList.remove(previousTheme);
|
|
45
|
+
}
|
|
46
|
+
// Apply the new theme class
|
|
47
|
+
root.classList.add(currentTheme);
|
|
48
|
+
// Store the current theme class in the data attribute
|
|
49
|
+
root.setAttribute(THEME_DATA_ATTRIBUTE, currentTheme);
|
|
50
|
+
// Cleanup: remove current theme class and data attribute when component unmounts
|
|
51
|
+
return () => {
|
|
52
|
+
root.classList.remove(currentTheme);
|
|
53
|
+
root.removeAttribute(THEME_DATA_ATTRIBUTE);
|
|
54
|
+
};
|
|
55
|
+
}, [currentTheme]);
|
|
56
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Helper function for copy text to clipboard
|
|
61
|
+
* @param {string} textToCopy The text string for copying to the clipboard
|
|
62
|
+
* @param {element|node} componentRef The ref of the component that we want to trigger the copy
|
|
63
|
+
*/
|
|
64
|
+
const copyToClipboard = (textToCopy, componentRef) => {
|
|
65
|
+
const currentFocus = document.activeElement;
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
if (componentRef && componentRef.current) {
|
|
68
|
+
const textArea = document.createElement("textarea");
|
|
69
|
+
textArea.readOnly = true;
|
|
70
|
+
textArea.defaultValue = textToCopy;
|
|
71
|
+
componentRef.current.appendChild(textArea);
|
|
72
|
+
textArea.select();
|
|
73
|
+
const wasCopied = document.execCommand("copy");
|
|
74
|
+
componentRef.current.removeChild(textArea);
|
|
75
|
+
if (currentFocus) {
|
|
76
|
+
currentFocus.focus();
|
|
77
|
+
}
|
|
78
|
+
if (wasCopied) {
|
|
79
|
+
resolve();
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
reject(new Error("Failed to copy"));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
reject(new Error("Copy area reference is not defined"));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
exports.Accordion = Accordion;
|
|
92
|
+
exports.ThemeProvider = ThemeProvider;
|
|
93
|
+
exports.copyToClipboard = copyToClipboard;
|
|
94
|
+
//# sourceMappingURL=mantine-adapter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mantine-adapter.cjs","sources":["../src/components/Accordion/Accordion.tsx","../src/components/ThemeProvider/ThemeProvider.tsx","../src/utils/copyToClipboard.ts"],"sourcesContent":["import {\n Accordion as MantineAccordion,\n type AccordionProps as MantineAccordionProps,\n} from \"@mantine/core\";\nimport * as styles from \"./Accordion.css\";\n\n// interface FigmaVariantProps {\n// Open?: boolean;\n// Divider?: boolean;\n// Title?: string;\n// }\n\nexport type AccordionProps = MantineAccordionProps;\n\nconst AccordionWrapper = (props: AccordionProps) => {\n return (\n <MantineAccordion\n {...props}\n classNames={{\n ...styles,\n ...props.classNames,\n }}\n />\n );\n};\n\n// Define the type for our Accordion component with sub-components\ntype AccordionComponent = typeof AccordionWrapper & {\n Item: typeof MantineAccordion.Item;\n Control: typeof MantineAccordion.Control;\n Panel: typeof MantineAccordion.Panel;\n};\n\n// Export the main Accordion component with dot notation\nexport const Accordion: AccordionComponent = Object.assign(AccordionWrapper, {\n Item: MantineAccordion.Item,\n Control: MantineAccordion.Control,\n Panel: MantineAccordion.Panel,\n});\n","import { useEffect } from \"react\";\n\ninterface ThemeProviderProps {\n currentTheme?: string;\n children: React.ReactNode;\n}\n\nconst THEME_DATA_ATTRIBUTE = \"data-current-theme\";\n\nexport function ThemeProvider({ children, currentTheme }: ThemeProviderProps) {\n useEffect(() => {\n if (!currentTheme) return;\n\n const root = document.documentElement;\n\n // Get the previously applied theme class from data attribute\n const previousTheme = root.getAttribute(THEME_DATA_ATTRIBUTE);\n\n // Remove the previous theme class if it exists\n if (previousTheme) {\n root.classList.remove(previousTheme);\n }\n\n // Apply the new theme class\n root.classList.add(currentTheme);\n\n // Store the current theme class in the data attribute\n root.setAttribute(THEME_DATA_ATTRIBUTE, currentTheme);\n\n // Cleanup: remove current theme class and data attribute when component unmounts\n return () => {\n root.classList.remove(currentTheme);\n root.removeAttribute(THEME_DATA_ATTRIBUTE);\n };\n }, [currentTheme]);\n\n return <>{children}</>;\n}\n","import React from \"react\";\n\n/**\n * Helper function for copy text to clipboard\n * @param {string} textToCopy The text string for copying to the clipboard\n * @param {element|node} componentRef The ref of the component that we want to trigger the copy\n */\nconst copyToClipboard = (\n textToCopy: string,\n componentRef: React.RefObject<HTMLElement | null>,\n): Promise<void> => {\n const currentFocus = document.activeElement as HTMLInputElement;\n return new Promise((resolve, reject) => {\n if (componentRef && componentRef.current) {\n const textArea = document.createElement(\"textarea\");\n textArea.readOnly = true;\n textArea.defaultValue = textToCopy;\n componentRef.current.appendChild(textArea);\n textArea.select();\n const wasCopied = document.execCommand(\"copy\");\n componentRef.current.removeChild(textArea);\n if (currentFocus) {\n currentFocus.focus();\n }\n if (wasCopied) {\n resolve();\n } else {\n reject(new Error(\"Failed to copy\"));\n }\n } else {\n reject(new Error(\"Copy area reference is not defined\"));\n }\n });\n};\n\nexport { copyToClipboard };\n"],"names":["_jsx","MantineAccordion","useEffect","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,MAAM,gBAAgB,GAAG,CAAC,KAAqB,KAAI;AACjD,IAAA,QACEA,cAAA,CAACC,cAAgB,OACX,KAAK,EACT,UAAU,EAAE;AACV,YAAA,GAAG,MAAM;YACT,GAAG,KAAK,CAAC,UAAU;AACpB,SAAA,EAAA,CACD;AAEN,CAAC;AASD;MACa,SAAS,GAAuB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAC3E,IAAI,EAAEA,cAAgB,CAAC,IAAI;IAC3B,OAAO,EAAEA,cAAgB,CAAC,OAAO;I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Y,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC;YAC1C,QAAQ,CAAC,MAAM,EAAE;YACjB,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC;AAC9C,YAAA,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC;YAC1C,IAAI,YAAY,EAAE;gBAChB,YAAY,CAAC,KAAK,EAAE;YACtB;YACA,IAAI,SAAS,EAAE;AACb,gBAAA,OAAO,EAAE;YACX;iBAAO;AACL,gBAAA,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACrC;QACF;aAAO;AACL,YAAA,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACzD;AACF,IAAA,CAAC,CAAC;AACJ;;;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Accordion as Accordion$1 } from '@mantine/core';
|
|
3
|
+
import './assets/src/components/Accordion/Accordion.css.ts.vanilla-BnZlbbJN.css';
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
var content = 'recursica-15e76703';
|
|
7
|
+
var control = 'recursica-15e76700';
|
|
8
|
+
var item = 'recursica-15e76702';
|
|
9
|
+
var label = 'recursica-15e76701';
|
|
10
|
+
|
|
11
|
+
var styles = /*#__PURE__*/Object.freeze({
|
|
12
|
+
__proto__: null,
|
|
13
|
+
content: content,
|
|
14
|
+
control: control,
|
|
15
|
+
item: item,
|
|
16
|
+
label: label
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const AccordionWrapper = (props) => {
|
|
20
|
+
return (jsx(Accordion$1, { ...props, classNames: {
|
|
21
|
+
...styles,
|
|
22
|
+
...props.classNames,
|
|
23
|
+
} }));
|
|
24
|
+
};
|
|
25
|
+
// Export the main Accordion component with dot notation
|
|
26
|
+
const Accordion = Object.assign(AccordionWrapper, {
|
|
27
|
+
Item: Accordion$1.Item,
|
|
28
|
+
Control: Accordion$1.Control,
|
|
29
|
+
Panel: Accordion$1.Panel,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const THEME_DATA_ATTRIBUTE = "data-current-theme";
|
|
33
|
+
function ThemeProvider({ children, currentTheme }) {
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!currentTheme)
|
|
36
|
+
return;
|
|
37
|
+
const root = document.documentElement;
|
|
38
|
+
// Get the previously applied theme class from data attribute
|
|
39
|
+
const previousTheme = root.getAttribute(THEME_DATA_ATTRIBUTE);
|
|
40
|
+
// Remove the previous theme class if it exists
|
|
41
|
+
if (previousTheme) {
|
|
42
|
+
root.classList.remove(previousTheme);
|
|
43
|
+
}
|
|
44
|
+
// Apply the new theme class
|
|
45
|
+
root.classList.add(currentTheme);
|
|
46
|
+
// Store the current theme class in the data attribute
|
|
47
|
+
root.setAttribute(THEME_DATA_ATTRIBUTE, currentTheme);
|
|
48
|
+
// Cleanup: remove current theme class and data attribute when component unmounts
|
|
49
|
+
return () => {
|
|
50
|
+
root.classList.remove(currentTheme);
|
|
51
|
+
root.removeAttribute(THEME_DATA_ATTRIBUTE);
|
|
52
|
+
};
|
|
53
|
+
}, [currentTheme]);
|
|
54
|
+
return jsx(Fragment, { children: children });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Helper function for copy text to clipboard
|
|
59
|
+
* @param {string} textToCopy The text string for copying to the clipboard
|
|
60
|
+
* @param {element|node} componentRef The ref of the component that we want to trigger the copy
|
|
61
|
+
*/
|
|
62
|
+
const copyToClipboard = (textToCopy, componentRef) => {
|
|
63
|
+
const currentFocus = document.activeElement;
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
if (componentRef && componentRef.current) {
|
|
66
|
+
const textArea = document.createElement("textarea");
|
|
67
|
+
textArea.readOnly = true;
|
|
68
|
+
textArea.defaultValue = textToCopy;
|
|
69
|
+
componentRef.current.appendChild(textArea);
|
|
70
|
+
textArea.select();
|
|
71
|
+
const wasCopied = document.execCommand("copy");
|
|
72
|
+
componentRef.current.removeChild(textArea);
|
|
73
|
+
if (currentFocus) {
|
|
74
|
+
currentFocus.focus();
|
|
75
|
+
}
|
|
76
|
+
if (wasCopied) {
|
|
77
|
+
resolve();
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
reject(new Error("Failed to copy"));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
reject(new Error("Copy area reference is not defined"));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export { Accordion, ThemeProvider, copyToClipboard };
|
|
90
|
+
//# sourceMappingURL=mantine-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mantine-adapter.js","sources":["../src/components/Accordion/Accordion.tsx","../src/components/ThemeProvider/ThemeProvider.tsx","../src/utils/copyToClipboard.ts"],"sourcesContent":["import {\n Accordion as MantineAccordion,\n type AccordionProps as MantineAccordionProps,\n} from \"@mantine/core\";\nimport * as styles from \"./Accordion.css\";\n\n// interface FigmaVariantProps {\n// Open?: boolean;\n// Divider?: boolean;\n// Title?: string;\n// }\n\nexport type AccordionProps = MantineAccordionProps;\n\nconst AccordionWrapper = (props: AccordionProps) => {\n return (\n <MantineAccordion\n {...props}\n classNames={{\n ...styles,\n ...props.classNames,\n }}\n />\n );\n};\n\n// Define the type for our Accordion component with sub-components\ntype AccordionComponent = typeof AccordionWrapper & {\n Item: typeof MantineAccordion.Item;\n Control: typeof MantineAccordion.Control;\n Panel: typeof MantineAccordion.Panel;\n};\n\n// Export the main Accordion component with dot notation\nexport const Accordion: AccordionComponent = Object.assign(AccordionWrapper, {\n Item: MantineAccordion.Item,\n Control: MantineAccordion.Control,\n Panel: MantineAccordion.Panel,\n});\n","import { useEffect } from \"react\";\n\ninterface ThemeProviderProps {\n currentTheme?: string;\n children: React.ReactNode;\n}\n\nconst THEME_DATA_ATTRIBUTE = \"data-current-theme\";\n\nexport function ThemeProvider({ children, currentTheme }: ThemeProviderProps) {\n useEffect(() => {\n if (!currentTheme) return;\n\n const root = document.documentElement;\n\n // Get the previously applied theme class from data attribute\n const previousTheme = root.getAttribute(THEME_DATA_ATTRIBUTE);\n\n // Remove the previous theme class if it exists\n if (previousTheme) {\n root.classList.remove(previousTheme);\n }\n\n // Apply the new theme class\n root.classList.add(currentTheme);\n\n // Store the current theme class in the data attribute\n root.setAttribute(THEME_DATA_ATTRIBUTE, currentTheme);\n\n // Cleanup: remove current theme class and data attribute when component unmounts\n return () => {\n root.classList.remove(currentTheme);\n root.removeAttribute(THEME_DATA_ATTRIBUTE);\n };\n }, [currentTheme]);\n\n return <>{children}</>;\n}\n","import React from \"react\";\n\n/**\n * Helper function for copy text to clipboard\n * @param {string} textToCopy The text string for copying to the clipboard\n * @param {element|node} componentRef The ref of the component that we want to trigger the copy\n */\nconst copyToClipboard = (\n textToCopy: string,\n componentRef: React.RefObject<HTMLElement | null>,\n): Promise<void> => {\n const currentFocus = document.activeElement as HTMLInputElement;\n return new Promise((resolve, reject) => {\n if (componentRef && componentRef.current) {\n const textArea = document.createElement(\"textarea\");\n textArea.readOnly = true;\n textArea.defaultValue = textToCopy;\n componentRef.current.appendChild(textArea);\n textArea.select();\n const wasCopied = document.execCommand(\"copy\");\n componentRef.current.removeChild(textArea);\n if (currentFocus) {\n currentFocus.focus();\n }\n if (wasCopied) {\n resolve();\n } else {\n reject(new Error(\"Failed to copy\"));\n }\n } else {\n reject(new Error(\"Copy area reference is not defined\"));\n }\n });\n};\n\nexport { copyToClipboard };\n"],"names":["_jsx","MantineAccordion","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,MAAM,gBAAgB,GAAG,CAAC,KAAqB,KAAI;AACjD,IAAA,QACEA,GAAA,CAACC,WAAgB,OACX,KAAK,EACT,UAAU,EAAE;AACV,YAAA,GAAG,MAAM;YACT,G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,IAAI,YAAY,CAAC,OAAO,EAAE;YACxC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC;AACnD,YAAA,QAAQ,CAAC,QAAQ,GAAG,IAAI;AACxB,YAAA,QAAQ,CAAC,YAAY,GAAG,UAAU;AAClC,YAAA,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC;YAC1C,QAAQ,CAAC,MAAM,EAAE;YACjB,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC;AAC9C,YAAA,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC;YAC1C,IAAI,YAAY,EAAE;gBAChB,YAAY,CAAC,KAAK,EAAE;YACtB;YACA,IAAI,SAAS,EAAE;AACb,gBAAA,OAAO,EAAE;YACX;iBAAO;AACL,gBAAA,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACrC;QACF;aAAO;AACL,YAAA,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACzD;AACF,IAAA,CAAC,CAAC;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recursica/mantine-adapter",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.9.3",
|
|
3
|
+
"description": "Reusable UI components for Recursica applications based on Mantine 8+",
|
|
5
4
|
"private": false,
|
|
6
|
-
"homepage": "https://github.com/borderux/recursica
|
|
5
|
+
"homepage": "https://github.com/borderux/recursica/tree/main/packages/mantine-adapter",
|
|
7
6
|
"author": "hi@borderux.com",
|
|
8
7
|
"bugs": {
|
|
9
8
|
"url": "https://github.com/borderux/recursica/issues"
|
|
@@ -12,44 +11,91 @@
|
|
|
12
11
|
"type": "git",
|
|
13
12
|
"url": "git+https://github.com/borderux/recursica.git"
|
|
14
13
|
},
|
|
14
|
+
"version": "1.0.0",
|
|
15
15
|
"type": "module",
|
|
16
|
-
"main": "dist/
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
"main": "./dist/mantine-adapter.cjs",
|
|
17
|
+
"module": "./dist/mantine-adapter.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/mantine-adapter.js",
|
|
23
|
+
"require": "./dist/mantine-adapter.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./style.css": "./dist/mantine-adapter.css"
|
|
25
26
|
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
26
30
|
"keywords": [
|
|
27
|
-
"
|
|
28
|
-
"
|
|
31
|
+
"react",
|
|
32
|
+
"ui",
|
|
33
|
+
"components",
|
|
34
|
+
"typescript",
|
|
35
|
+
"mantine",
|
|
29
36
|
"recursica",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
37
|
+
"design system",
|
|
38
|
+
"design systems"
|
|
32
39
|
],
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"typescript": "^5.0.0"
|
|
40
|
+
"scripts": {
|
|
41
|
+
"dev": "npm run storybook",
|
|
42
|
+
"build": "rollup -c",
|
|
43
|
+
"build-storybook": "storybook build -o storybook-static",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"storybook": "storybook dev -p 6006"
|
|
40
46
|
},
|
|
47
|
+
"dependencies": {},
|
|
41
48
|
"devDependencies": {
|
|
42
|
-
"@recursica/
|
|
43
|
-
"@rollup
|
|
49
|
+
"@recursica/storybook-template": "*",
|
|
50
|
+
"@vanilla-extract/rollup-plugin": "^1.4.1",
|
|
51
|
+
"@vanilla-extract/vite-plugin": "^5.1.1",
|
|
52
|
+
"@babel/core": "^7.28.4",
|
|
53
|
+
"@babel/preset-react": "^7.27.1",
|
|
54
|
+
"@eslint/js": "^9.25.0",
|
|
55
|
+
"@recursica/official-release": "*",
|
|
56
|
+
"@repo/typescript-config": "*",
|
|
57
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
58
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
44
59
|
"@rollup/plugin-json": "^6.1.0",
|
|
45
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
46
|
-
"@rollup/plugin-
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
60
|
+
"@rollup/plugin-node-resolve": "^16.0.2",
|
|
61
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
62
|
+
"@storybook/addon-a11y": "^9.0.8",
|
|
63
|
+
"@storybook/addon-docs": "^9.0.8",
|
|
64
|
+
"@storybook/addon-onboarding": "^9.0.8",
|
|
65
|
+
"@storybook/addon-vitest": "^9.0.8",
|
|
66
|
+
"@storybook/react-vite": "^9.0.8",
|
|
67
|
+
"@svgr/rollup": "^8.1.0",
|
|
68
|
+
"@types/react": "^19.1.2",
|
|
69
|
+
"@types/react-dom": "^19.1.2",
|
|
70
|
+
"@vitejs/plugin-react": "^4.4.1",
|
|
71
|
+
"@vitest/browser": "^3.2.4",
|
|
72
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
73
|
+
"eslint": "^9.25.0",
|
|
74
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
75
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
76
|
+
"eslint-plugin-storybook": "^9.0.8",
|
|
77
|
+
"globals": "^16.0.0",
|
|
78
|
+
"playwright": "^1.53.0",
|
|
79
|
+
"postcss": "^8.4.40",
|
|
80
|
+
"postcss-preset-mantine": "^1.17.0",
|
|
81
|
+
"rollup": "^4.20.0",
|
|
82
|
+
"rollup-plugin-dts": "^6.2.3",
|
|
83
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
84
|
+
"sass": "^1.89.2",
|
|
85
|
+
"sirv": "^3.0.2",
|
|
86
|
+
"storybook": "^9.0.8",
|
|
87
|
+
"strip-literal": "^3.0.0",
|
|
88
|
+
"typescript": "~5.8.3",
|
|
89
|
+
"typescript-eslint": "^8.30.1",
|
|
90
|
+
"vite": "^6.3.5",
|
|
91
|
+
"vite-plugin-svgr": "^4.3.0",
|
|
92
|
+
"vitest": "^3.2.4"
|
|
53
93
|
},
|
|
54
|
-
"
|
|
94
|
+
"peerDependencies": {
|
|
95
|
+
"@mantine/core": ">=8.0.0",
|
|
96
|
+
"@mantine/dates": ">=8.0.0",
|
|
97
|
+
"@mantine/hooks": ">=8.0.0",
|
|
98
|
+
"react": ">=16.8.0",
|
|
99
|
+
"react-dom": ">=16.8.0"
|
|
100
|
+
}
|
|
55
101
|
}
|