@ethisyscore/plugin-ui 1.15.0 → 1.17.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.
@@ -0,0 +1,130 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var material = require('@mui/material');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ // src/components/layout/FillGrid.tsx
8
+
9
+ // src/components/layout/fillGridClasses.ts
10
+ var CLASSES = {
11
+ xs: {
12
+ 5: {
13
+ 2.4: "basis-[calc(20%-1rem)]",
14
+ 3: "basis-[calc(25%-0.9375rem)]",
15
+ 4: "basis-[calc(33.333%-0.8333rem)]",
16
+ 5: "basis-[calc(41.667%-0.7292rem)]",
17
+ 6: "basis-[calc(50%-0.625rem)]",
18
+ 7: "basis-[calc(58.333%-0.5208rem)]",
19
+ 8: "basis-[calc(66.667%-0.4167rem)]",
20
+ 9: "basis-[calc(75%-0.3125rem)]",
21
+ 12: "basis-full"
22
+ },
23
+ 2.5: {
24
+ 2.4: "basis-[calc(20%-0.5rem)]",
25
+ 3: "basis-[calc(25%-0.46875rem)]",
26
+ 4: "basis-[calc(33.333%-0.41667rem)]",
27
+ 5: "basis-[calc(41.667%-0.36458rem)]",
28
+ 6: "basis-[calc(50%-0.3125rem)]",
29
+ 7: "basis-[calc(58.333%-0.26042rem)]",
30
+ 8: "basis-[calc(66.667%-0.20833rem)]",
31
+ 9: "basis-[calc(75%-0.15625rem)]",
32
+ 12: "basis-full"
33
+ }
34
+ },
35
+ sm: {
36
+ 5: {
37
+ 2.4: "sm:basis-[calc(20%-1rem)]",
38
+ 3: "sm:basis-[calc(25%-0.9375rem)]",
39
+ 4: "sm:basis-[calc(33.333%-0.8333rem)]",
40
+ 5: "sm:basis-[calc(41.667%-0.7292rem)]",
41
+ 6: "sm:basis-[calc(50%-0.625rem)]",
42
+ 7: "sm:basis-[calc(58.333%-0.5208rem)]",
43
+ 8: "sm:basis-[calc(66.667%-0.4167rem)]",
44
+ 9: "sm:basis-[calc(75%-0.3125rem)]",
45
+ 12: "sm:basis-full"
46
+ },
47
+ 2.5: {
48
+ 2.4: "sm:basis-[calc(20%-0.5rem)]",
49
+ 3: "sm:basis-[calc(25%-0.46875rem)]",
50
+ 4: "sm:basis-[calc(33.333%-0.41667rem)]",
51
+ 5: "sm:basis-[calc(41.667%-0.36458rem)]",
52
+ 6: "sm:basis-[calc(50%-0.3125rem)]",
53
+ 7: "sm:basis-[calc(58.333%-0.26042rem)]",
54
+ 8: "sm:basis-[calc(66.667%-0.20833rem)]",
55
+ 9: "sm:basis-[calc(75%-0.15625rem)]",
56
+ 12: "sm:basis-full"
57
+ }
58
+ },
59
+ md: {
60
+ 5: {
61
+ 2.4: "md:basis-[calc(20%-1rem)]",
62
+ 3: "md:basis-[calc(25%-0.9375rem)]",
63
+ 4: "md:basis-[calc(33.333%-0.8333rem)]",
64
+ 5: "md:basis-[calc(41.667%-0.7292rem)]",
65
+ 6: "md:basis-[calc(50%-0.625rem)]",
66
+ 7: "md:basis-[calc(58.333%-0.5208rem)]",
67
+ 8: "md:basis-[calc(66.667%-0.4167rem)]",
68
+ 9: "md:basis-[calc(75%-0.3125rem)]",
69
+ 12: "md:basis-full"
70
+ },
71
+ 2.5: {
72
+ 2.4: "md:basis-[calc(20%-0.5rem)]",
73
+ 3: "md:basis-[calc(25%-0.46875rem)]",
74
+ 4: "md:basis-[calc(33.333%-0.41667rem)]",
75
+ 5: "md:basis-[calc(41.667%-0.36458rem)]",
76
+ 6: "md:basis-[calc(50%-0.3125rem)]",
77
+ 7: "md:basis-[calc(58.333%-0.26042rem)]",
78
+ 8: "md:basis-[calc(66.667%-0.20833rem)]",
79
+ 9: "md:basis-[calc(75%-0.15625rem)]",
80
+ 12: "md:basis-full"
81
+ }
82
+ },
83
+ lg: {
84
+ 5: {
85
+ 2.4: "lg:basis-[calc(20%-1rem)]",
86
+ 3: "lg:basis-[calc(25%-0.9375rem)]",
87
+ 4: "lg:basis-[calc(33.333%-0.8333rem)]",
88
+ 5: "lg:basis-[calc(41.667%-0.7292rem)]",
89
+ 6: "lg:basis-[calc(50%-0.625rem)]",
90
+ 7: "lg:basis-[calc(58.333%-0.5208rem)]",
91
+ 8: "lg:basis-[calc(66.667%-0.4167rem)]",
92
+ 9: "lg:basis-[calc(75%-0.3125rem)]",
93
+ 12: "lg:basis-full"
94
+ },
95
+ 2.5: {
96
+ 2.4: "lg:basis-[calc(20%-0.5rem)]",
97
+ 3: "lg:basis-[calc(25%-0.46875rem)]",
98
+ 4: "lg:basis-[calc(33.333%-0.41667rem)]",
99
+ 5: "lg:basis-[calc(41.667%-0.36458rem)]",
100
+ 6: "lg:basis-[calc(50%-0.3125rem)]",
101
+ 7: "lg:basis-[calc(58.333%-0.26042rem)]",
102
+ 8: "lg:basis-[calc(66.667%-0.20833rem)]",
103
+ 9: "lg:basis-[calc(75%-0.15625rem)]",
104
+ 12: "lg:basis-full"
105
+ }
106
+ }
107
+ };
108
+ var BREAKPOINTS = ["xs", "sm", "md", "lg"];
109
+ function fillItemClass(span, gap) {
110
+ const parts = ["min-w-0", "grow"];
111
+ for (const bp of BREAKPOINTS) {
112
+ const n = span[bp];
113
+ if (n !== void 0) parts.push(CLASSES[bp][gap][n]);
114
+ }
115
+ return parts.join(" ");
116
+ }
117
+ var FillGapContext = react.createContext(5);
118
+ function FillGrid({ gap = 5, className, children }) {
119
+ const gapClass = gap === 2.5 ? "gap-2.5" : "gap-5";
120
+ return /* @__PURE__ */ jsxRuntime.jsx(FillGapContext.Provider, { value: gap, children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: ["flex w-full flex-wrap", gapClass, className].filter(Boolean).join(" "), children }) });
121
+ }
122
+ function FillGridItem({ span = { xs: 12 }, className, children }) {
123
+ const gap = react.useContext(FillGapContext);
124
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: [fillItemClass(span, gap), className].filter(Boolean).join(" "), children });
125
+ }
126
+
127
+ exports.FillGrid = FillGrid;
128
+ exports.FillGridItem = FillGridItem;
129
+ //# sourceMappingURL=index.cjs.map
130
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/layout/fillGridClasses.ts","../../../src/components/layout/FillGrid.tsx"],"names":["createContext","jsx","Box","useContext"],"mappings":";;;;;;;;;AAyBA,IAAM,OAAA,GAAyE;AAAA,EAC7E,EAAA,EAAI;AAAA,IACF,CAAA,EAAG;AAAA,MACD,GAAA,EAAK,wBAAA;AAAA,MACL,CAAA,EAAG,6BAAA;AAAA,MACH,CAAA,EAAG,iCAAA;AAAA,MACH,CAAA,EAAG,iCAAA;AAAA,MACH,CAAA,EAAG,4BAAA;AAAA,MACH,CAAA,EAAG,iCAAA;AAAA,MACH,CAAA,EAAG,iCAAA;AAAA,MACH,CAAA,EAAG,6BAAA;AAAA,MACH,EAAA,EAAI;AAAA,KACN;AAAA,IACA,GAAA,EAAK;AAAA,MACH,GAAA,EAAK,0BAAA;AAAA,MACL,CAAA,EAAG,8BAAA;AAAA,MACH,CAAA,EAAG,kCAAA;AAAA,MACH,CAAA,EAAG,kCAAA;AAAA,MACH,CAAA,EAAG,6BAAA;AAAA,MACH,CAAA,EAAG,kCAAA;AAAA,MACH,CAAA,EAAG,kCAAA;AAAA,MACH,CAAA,EAAG,8BAAA;AAAA,MACH,EAAA,EAAI;AAAA;AACN,GACF;AAAA,EACA,EAAA,EAAI;AAAA,IACF,CAAA,EAAG;AAAA,MACD,GAAA,EAAK,2BAAA;AAAA,MACL,CAAA,EAAG,gCAAA;AAAA,MACH,CAAA,EAAG,oCAAA;AAAA,MACH,CAAA,EAAG,oCAAA;AAAA,MACH,CAAA,EAAG,+BAAA;AAAA,MACH,CAAA,EAAG,oCAAA;AAAA,MACH,CAAA,EAAG,oCAAA;AAAA,MACH,CAAA,EAAG,gCAAA;AAAA,MACH,EAAA,EAAI;AAAA,KACN;AAAA,IACA,GAAA,EAAK;AAAA,MACH,GAAA,EAAK,6BAA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AAE,IAAI,EAAA,EAAG,EAAG,SAAA,EAAW,QAAA,EAAS,EAAsB;AAC1F,EAAA,MAAM,GAAA,GAAMC,iBAAW,cAAc,CAAA;AACrC,EAAA,sCACGD,YAAA,EAAA,EAAI,SAAA,EAAW,CAAC,aAAA,CAAc,MAAM,GAAG,CAAA,EAAG,SAAS,CAAA,CAAE,OAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,GAC3E,QAAA,EACH,CAAA;AAEJ","file":"index.cjs","sourcesContent":["/**\n * Static Tailwind basis classes for {@link FillGridItem}.\n *\n * Tailwind's content scanner extracts class candidates from raw source text and\n * cannot follow string concatenation — `\"sm:\" + \"basis-[...]\"` is invisible to\n * it. So every fully-prefixed class is spelled out as a literal below, indexed\n * by breakpoint → gap → span. `fillItemClass` only ever *looks up* a literal; it\n * never builds one. This is what guarantees the responsive classes survive a\n * production purge (no fragile safelist comment to keep in sync).\n *\n * NOTE: because these literals live in the SDK, a CONSUMER's Tailwind build must\n * scan this package's dist (add it to `content`) or the classes won't generate.\n *\n * basis(n, g) = calc(n/12 * 100% - g * (1 - n/12)), g = gap in rem.\n * gap-5 => g = 1.25rem; gap-2.5 => g = 0.625rem. Span 12 => basis-full.\n */\nexport type Twelfths = 2.4 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12;\nexport type FillGap = 2.5 | 5;\ntype Breakpoint = \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type FillSpan = Partial<Record<Breakpoint, Twelfths>>;\n\n/**\n * Full literal class per breakpoint × gap × span. `xs` is unprefixed; `sm`/`md`/\n * `lg` carry the Tailwind prefix. Every string here is a real, scannable literal.\n */\nconst CLASSES: Record<Breakpoint, Record<FillGap, Record<Twelfths, string>>> = {\n xs: {\n 5: {\n 2.4: \"basis-[calc(20%-1rem)]\",\n 3: \"basis-[calc(25%-0.9375rem)]\",\n 4: \"basis-[calc(33.333%-0.8333rem)]\",\n 5: \"basis-[calc(41.667%-0.7292rem)]\",\n 6: \"basis-[calc(50%-0.625rem)]\",\n 7: \"basis-[calc(58.333%-0.5208rem)]\",\n 8: \"basis-[calc(66.667%-0.4167rem)]\",\n 9: \"basis-[calc(75%-0.3125rem)]\",\n 12: \"basis-full\",\n },\n 2.5: {\n 2.4: \"basis-[calc(20%-0.5rem)]\",\n 3: \"basis-[calc(25%-0.46875rem)]\",\n 4: \"basis-[calc(33.333%-0.41667rem)]\",\n 5: \"basis-[calc(41.667%-0.36458rem)]\",\n 6: \"basis-[calc(50%-0.3125rem)]\",\n 7: \"basis-[calc(58.333%-0.26042rem)]\",\n 8: \"basis-[calc(66.667%-0.20833rem)]\",\n 9: \"basis-[calc(75%-0.15625rem)]\",\n 12: \"basis-full\",\n },\n },\n sm: {\n 5: {\n 2.4: \"sm:basis-[calc(20%-1rem)]\",\n 3: \"sm:basis-[calc(25%-0.9375rem)]\",\n 4: \"sm:basis-[calc(33.333%-0.8333rem)]\",\n 5: \"sm:basis-[calc(41.667%-0.7292rem)]\",\n 6: \"sm:basis-[calc(50%-0.625rem)]\",\n 7: \"sm:basis-[calc(58.333%-0.5208rem)]\",\n 8: \"sm:basis-[calc(66.667%-0.4167rem)]\",\n 9: \"sm:basis-[calc(75%-0.3125rem)]\",\n 12: \"sm:basis-full\",\n },\n 2.5: {\n 2.4: \"sm:basis-[calc(20%-0.5rem)]\",\n 3: \"sm:basis-[calc(25%-0.46875rem)]\",\n 4: \"sm:basis-[calc(33.333%-0.41667rem)]\",\n 5: \"sm:basis-[calc(41.667%-0.36458rem)]\",\n 6: \"sm:basis-[calc(50%-0.3125rem)]\",\n 7: \"sm:basis-[calc(58.333%-0.26042rem)]\",\n 8: \"sm:basis-[calc(66.667%-0.20833rem)]\",\n 9: \"sm:basis-[calc(75%-0.15625rem)]\",\n 12: \"sm:basis-full\",\n },\n },\n md: {\n 5: {\n 2.4: \"md:basis-[calc(20%-1rem)]\",\n 3: \"md:basis-[calc(25%-0.9375rem)]\",\n 4: \"md:basis-[calc(33.333%-0.8333rem)]\",\n 5: \"md:basis-[calc(41.667%-0.7292rem)]\",\n 6: \"md:basis-[calc(50%-0.625rem)]\",\n 7: \"md:basis-[calc(58.333%-0.5208rem)]\",\n 8: \"md:basis-[calc(66.667%-0.4167rem)]\",\n 9: \"md:basis-[calc(75%-0.3125rem)]\",\n 12: \"md:basis-full\",\n },\n 2.5: {\n 2.4: \"md:basis-[calc(20%-0.5rem)]\",\n 3: \"md:basis-[calc(25%-0.46875rem)]\",\n 4: \"md:basis-[calc(33.333%-0.41667rem)]\",\n 5: \"md:basis-[calc(41.667%-0.36458rem)]\",\n 6: \"md:basis-[calc(50%-0.3125rem)]\",\n 7: \"md:basis-[calc(58.333%-0.26042rem)]\",\n 8: \"md:basis-[calc(66.667%-0.20833rem)]\",\n 9: \"md:basis-[calc(75%-0.15625rem)]\",\n 12: \"md:basis-full\",\n },\n },\n lg: {\n 5: {\n 2.4: \"lg:basis-[calc(20%-1rem)]\",\n 3: \"lg:basis-[calc(25%-0.9375rem)]\",\n 4: \"lg:basis-[calc(33.333%-0.8333rem)]\",\n 5: \"lg:basis-[calc(41.667%-0.7292rem)]\",\n 6: \"lg:basis-[calc(50%-0.625rem)]\",\n 7: \"lg:basis-[calc(58.333%-0.5208rem)]\",\n 8: \"lg:basis-[calc(66.667%-0.4167rem)]\",\n 9: \"lg:basis-[calc(75%-0.3125rem)]\",\n 12: \"lg:basis-full\",\n },\n 2.5: {\n 2.4: \"lg:basis-[calc(20%-0.5rem)]\",\n 3: \"lg:basis-[calc(25%-0.46875rem)]\",\n 4: \"lg:basis-[calc(33.333%-0.41667rem)]\",\n 5: \"lg:basis-[calc(41.667%-0.36458rem)]\",\n 6: \"lg:basis-[calc(50%-0.3125rem)]\",\n 7: \"lg:basis-[calc(58.333%-0.26042rem)]\",\n 8: \"lg:basis-[calc(66.667%-0.20833rem)]\",\n 9: \"lg:basis-[calc(75%-0.15625rem)]\",\n 12: \"lg:basis-full\",\n },\n },\n};\n\nconst BREAKPOINTS: readonly Breakpoint[] = [\"xs\", \"sm\", \"md\", \"lg\"];\n\n/**\n * Full class string for one item: always `min-w-0 grow`, plus the literal basis\n * class for each supplied breakpoint (looked up, never concatenated).\n */\nexport function fillItemClass(span: FillSpan, gap: FillGap): string {\n const parts = [\"min-w-0\", \"grow\"];\n for (const bp of BREAKPOINTS) {\n const n = span[bp];\n if (n !== undefined) parts.push(CLASSES[bp][gap][n]);\n }\n return parts.join(\" \");\n}\n","import { createContext, useContext } from \"react\";\nimport { Box } from \"@mui/material\";\nimport { fillItemClass, type FillGap, type FillSpan } from \"./fillGridClasses\";\n\nconst FillGapContext = createContext<FillGap>(5);\n\ninterface FillGridProps {\n /** Gutter width. 5 = 20px (default), 2.5 = 10px. Matches MUI spacing values. */\n gap?: FillGap;\n className?: string;\n children: React.ReactNode;\n}\n\n/**\n * A flex-wrap row whose items `grow` to fill a partially-filled last row — the\n * dashboard/overview convention. NOT for forms, tables, or single full-width cards.\n *\n * Renders `w-full` so it always spans its container: a `FillGrid` is itself often\n * a flex item of a parent MUI `<Grid container>` / flex row, where without an\n * explicit width it would shrink-wrap to its content instead of filling the row\n * (the behaviour a `<Grid container size={12}>` used to give).\n */\nexport function FillGrid({ gap = 5, className, children }: FillGridProps) {\n const gapClass = gap === 2.5 ? \"gap-2.5\" : \"gap-5\";\n return (\n <FillGapContext.Provider value={gap}>\n <Box className={[\"flex w-full flex-wrap\", gapClass, className].filter(Boolean).join(\" \")}>\n {children}\n </Box>\n </FillGapContext.Provider>\n );\n}\n\ninterface FillGridItemProps {\n /** 12-column span per breakpoint, mirroring MUI Grid's `size`. Default { xs: 12 }. */\n span?: FillSpan;\n className?: string;\n children: React.ReactNode;\n}\n\nexport function FillGridItem({ span = { xs: 12 }, className, children }: FillGridItemProps) {\n const gap = useContext(FillGapContext);\n return (\n <Box className={[fillItemClass(span, gap), className].filter(Boolean).join(\" \")}>\n {children}\n </Box>\n );\n}\n"]}
@@ -0,0 +1,48 @@
1
+ import * as react from 'react';
2
+
3
+ /**
4
+ * Static Tailwind basis classes for {@link FillGridItem}.
5
+ *
6
+ * Tailwind's content scanner extracts class candidates from raw source text and
7
+ * cannot follow string concatenation — `"sm:" + "basis-[...]"` is invisible to
8
+ * it. So every fully-prefixed class is spelled out as a literal below, indexed
9
+ * by breakpoint → gap → span. `fillItemClass` only ever *looks up* a literal; it
10
+ * never builds one. This is what guarantees the responsive classes survive a
11
+ * production purge (no fragile safelist comment to keep in sync).
12
+ *
13
+ * NOTE: because these literals live in the SDK, a CONSUMER's Tailwind build must
14
+ * scan this package's dist (add it to `content`) or the classes won't generate.
15
+ *
16
+ * basis(n, g) = calc(n/12 * 100% - g * (1 - n/12)), g = gap in rem.
17
+ * gap-5 => g = 1.25rem; gap-2.5 => g = 0.625rem. Span 12 => basis-full.
18
+ */
19
+ type Twelfths = 2.4 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12;
20
+ type FillGap = 2.5 | 5;
21
+ type Breakpoint = "xs" | "sm" | "md" | "lg";
22
+ type FillSpan = Partial<Record<Breakpoint, Twelfths>>;
23
+
24
+ interface FillGridProps {
25
+ /** Gutter width. 5 = 20px (default), 2.5 = 10px. Matches MUI spacing values. */
26
+ gap?: FillGap;
27
+ className?: string;
28
+ children: React.ReactNode;
29
+ }
30
+ /**
31
+ * A flex-wrap row whose items `grow` to fill a partially-filled last row — the
32
+ * dashboard/overview convention. NOT for forms, tables, or single full-width cards.
33
+ *
34
+ * Renders `w-full` so it always spans its container: a `FillGrid` is itself often
35
+ * a flex item of a parent MUI `<Grid container>` / flex row, where without an
36
+ * explicit width it would shrink-wrap to its content instead of filling the row
37
+ * (the behaviour a `<Grid container size={12}>` used to give).
38
+ */
39
+ declare function FillGrid({ gap, className, children }: FillGridProps): react.JSX.Element;
40
+ interface FillGridItemProps {
41
+ /** 12-column span per breakpoint, mirroring MUI Grid's `size`. Default { xs: 12 }. */
42
+ span?: FillSpan;
43
+ className?: string;
44
+ children: React.ReactNode;
45
+ }
46
+ declare function FillGridItem({ span, className, children }: FillGridItemProps): react.JSX.Element;
47
+
48
+ export { type FillGap, FillGrid, FillGridItem, type FillSpan, type Twelfths };
@@ -0,0 +1,48 @@
1
+ import * as react from 'react';
2
+
3
+ /**
4
+ * Static Tailwind basis classes for {@link FillGridItem}.
5
+ *
6
+ * Tailwind's content scanner extracts class candidates from raw source text and
7
+ * cannot follow string concatenation — `"sm:" + "basis-[...]"` is invisible to
8
+ * it. So every fully-prefixed class is spelled out as a literal below, indexed
9
+ * by breakpoint → gap → span. `fillItemClass` only ever *looks up* a literal; it
10
+ * never builds one. This is what guarantees the responsive classes survive a
11
+ * production purge (no fragile safelist comment to keep in sync).
12
+ *
13
+ * NOTE: because these literals live in the SDK, a CONSUMER's Tailwind build must
14
+ * scan this package's dist (add it to `content`) or the classes won't generate.
15
+ *
16
+ * basis(n, g) = calc(n/12 * 100% - g * (1 - n/12)), g = gap in rem.
17
+ * gap-5 => g = 1.25rem; gap-2.5 => g = 0.625rem. Span 12 => basis-full.
18
+ */
19
+ type Twelfths = 2.4 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12;
20
+ type FillGap = 2.5 | 5;
21
+ type Breakpoint = "xs" | "sm" | "md" | "lg";
22
+ type FillSpan = Partial<Record<Breakpoint, Twelfths>>;
23
+
24
+ interface FillGridProps {
25
+ /** Gutter width. 5 = 20px (default), 2.5 = 10px. Matches MUI spacing values. */
26
+ gap?: FillGap;
27
+ className?: string;
28
+ children: React.ReactNode;
29
+ }
30
+ /**
31
+ * A flex-wrap row whose items `grow` to fill a partially-filled last row — the
32
+ * dashboard/overview convention. NOT for forms, tables, or single full-width cards.
33
+ *
34
+ * Renders `w-full` so it always spans its container: a `FillGrid` is itself often
35
+ * a flex item of a parent MUI `<Grid container>` / flex row, where without an
36
+ * explicit width it would shrink-wrap to its content instead of filling the row
37
+ * (the behaviour a `<Grid container size={12}>` used to give).
38
+ */
39
+ declare function FillGrid({ gap, className, children }: FillGridProps): react.JSX.Element;
40
+ interface FillGridItemProps {
41
+ /** 12-column span per breakpoint, mirroring MUI Grid's `size`. Default { xs: 12 }. */
42
+ span?: FillSpan;
43
+ className?: string;
44
+ children: React.ReactNode;
45
+ }
46
+ declare function FillGridItem({ span, className, children }: FillGridItemProps): react.JSX.Element;
47
+
48
+ export { type FillGap, FillGrid, FillGridItem, type FillSpan, type Twelfths };
@@ -0,0 +1,127 @@
1
+ import { createContext, useContext } from 'react';
2
+ import { Box } from '@mui/material';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ // src/components/layout/FillGrid.tsx
6
+
7
+ // src/components/layout/fillGridClasses.ts
8
+ var CLASSES = {
9
+ xs: {
10
+ 5: {
11
+ 2.4: "basis-[calc(20%-1rem)]",
12
+ 3: "basis-[calc(25%-0.9375rem)]",
13
+ 4: "basis-[calc(33.333%-0.8333rem)]",
14
+ 5: "basis-[calc(41.667%-0.7292rem)]",
15
+ 6: "basis-[calc(50%-0.625rem)]",
16
+ 7: "basis-[calc(58.333%-0.5208rem)]",
17
+ 8: "basis-[calc(66.667%-0.4167rem)]",
18
+ 9: "basis-[calc(75%-0.3125rem)]",
19
+ 12: "basis-full"
20
+ },
21
+ 2.5: {
22
+ 2.4: "basis-[calc(20%-0.5rem)]",
23
+ 3: "basis-[calc(25%-0.46875rem)]",
24
+ 4: "basis-[calc(33.333%-0.41667rem)]",
25
+ 5: "basis-[calc(41.667%-0.36458rem)]",
26
+ 6: "basis-[calc(50%-0.3125rem)]",
27
+ 7: "basis-[calc(58.333%-0.26042rem)]",
28
+ 8: "basis-[calc(66.667%-0.20833rem)]",
29
+ 9: "basis-[calc(75%-0.15625rem)]",
30
+ 12: "basis-full"
31
+ }
32
+ },
33
+ sm: {
34
+ 5: {
35
+ 2.4: "sm:basis-[calc(20%-1rem)]",
36
+ 3: "sm:basis-[calc(25%-0.9375rem)]",
37
+ 4: "sm:basis-[calc(33.333%-0.8333rem)]",
38
+ 5: "sm:basis-[calc(41.667%-0.7292rem)]",
39
+ 6: "sm:basis-[calc(50%-0.625rem)]",
40
+ 7: "sm:basis-[calc(58.333%-0.5208rem)]",
41
+ 8: "sm:basis-[calc(66.667%-0.4167rem)]",
42
+ 9: "sm:basis-[calc(75%-0.3125rem)]",
43
+ 12: "sm:basis-full"
44
+ },
45
+ 2.5: {
46
+ 2.4: "sm:basis-[calc(20%-0.5rem)]",
47
+ 3: "sm:basis-[calc(25%-0.46875rem)]",
48
+ 4: "sm:basis-[calc(33.333%-0.41667rem)]",
49
+ 5: "sm:basis-[calc(41.667%-0.36458rem)]",
50
+ 6: "sm:basis-[calc(50%-0.3125rem)]",
51
+ 7: "sm:basis-[calc(58.333%-0.26042rem)]",
52
+ 8: "sm:basis-[calc(66.667%-0.20833rem)]",
53
+ 9: "sm:basis-[calc(75%-0.15625rem)]",
54
+ 12: "sm:basis-full"
55
+ }
56
+ },
57
+ md: {
58
+ 5: {
59
+ 2.4: "md:basis-[calc(20%-1rem)]",
60
+ 3: "md:basis-[calc(25%-0.9375rem)]",
61
+ 4: "md:basis-[calc(33.333%-0.8333rem)]",
62
+ 5: "md:basis-[calc(41.667%-0.7292rem)]",
63
+ 6: "md:basis-[calc(50%-0.625rem)]",
64
+ 7: "md:basis-[calc(58.333%-0.5208rem)]",
65
+ 8: "md:basis-[calc(66.667%-0.4167rem)]",
66
+ 9: "md:basis-[calc(75%-0.3125rem)]",
67
+ 12: "md:basis-full"
68
+ },
69
+ 2.5: {
70
+ 2.4: "md:basis-[calc(20%-0.5rem)]",
71
+ 3: "md:basis-[calc(25%-0.46875rem)]",
72
+ 4: "md:basis-[calc(33.333%-0.41667rem)]",
73
+ 5: "md:basis-[calc(41.667%-0.36458rem)]",
74
+ 6: "md:basis-[calc(50%-0.3125rem)]",
75
+ 7: "md:basis-[calc(58.333%-0.26042rem)]",
76
+ 8: "md:basis-[calc(66.667%-0.20833rem)]",
77
+ 9: "md:basis-[calc(75%-0.15625rem)]",
78
+ 12: "md:basis-full"
79
+ }
80
+ },
81
+ lg: {
82
+ 5: {
83
+ 2.4: "lg:basis-[calc(20%-1rem)]",
84
+ 3: "lg:basis-[calc(25%-0.9375rem)]",
85
+ 4: "lg:basis-[calc(33.333%-0.8333rem)]",
86
+ 5: "lg:basis-[calc(41.667%-0.7292rem)]",
87
+ 6: "lg:basis-[calc(50%-0.625rem)]",
88
+ 7: "lg:basis-[calc(58.333%-0.5208rem)]",
89
+ 8: "lg:basis-[calc(66.667%-0.4167rem)]",
90
+ 9: "lg:basis-[calc(75%-0.3125rem)]",
91
+ 12: "lg:basis-full"
92
+ },
93
+ 2.5: {
94
+ 2.4: "lg:basis-[calc(20%-0.5rem)]",
95
+ 3: "lg:basis-[calc(25%-0.46875rem)]",
96
+ 4: "lg:basis-[calc(33.333%-0.41667rem)]",
97
+ 5: "lg:basis-[calc(41.667%-0.36458rem)]",
98
+ 6: "lg:basis-[calc(50%-0.3125rem)]",
99
+ 7: "lg:basis-[calc(58.333%-0.26042rem)]",
100
+ 8: "lg:basis-[calc(66.667%-0.20833rem)]",
101
+ 9: "lg:basis-[calc(75%-0.15625rem)]",
102
+ 12: "lg:basis-full"
103
+ }
104
+ }
105
+ };
106
+ var BREAKPOINTS = ["xs", "sm", "md", "lg"];
107
+ function fillItemClass(span, gap) {
108
+ const parts = ["min-w-0", "grow"];
109
+ for (const bp of BREAKPOINTS) {
110
+ const n = span[bp];
111
+ if (n !== void 0) parts.push(CLASSES[bp][gap][n]);
112
+ }
113
+ return parts.join(" ");
114
+ }
115
+ var FillGapContext = createContext(5);
116
+ function FillGrid({ gap = 5, className, children }) {
117
+ const gapClass = gap === 2.5 ? "gap-2.5" : "gap-5";
118
+ return /* @__PURE__ */ jsx(FillGapContext.Provider, { value: gap, children: /* @__PURE__ */ jsx(Box, { className: ["flex w-full flex-wrap", gapClass, className].filter(Boolean).join(" "), children }) });
119
+ }
120
+ function FillGridItem({ span = { xs: 12 }, className, children }) {
121
+ const gap = useContext(FillGapContext);
122
+ return /* @__PURE__ */ jsx(Box, { className: [fillItemClass(span, gap), className].filter(Boolean).join(" "), children });
123
+ }
124
+
125
+ export { FillGrid, FillGridItem };
126
+ //# sourceMappingURL=index.js.map
127
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/layout/fillGridClasses.ts","../../../src/components/layout/FillGrid.tsx"],"names":[],"mappings":";;;;;;;AAyBA,IAAM,OAAA,GAAyE;AAAA,EAC7E,EAAA,EAAI;AAAA,IACF,CAAA,EAAG;AAAA,MACD,GAAA,EAAK,wBAAA;AAAA,MACL,CAAA,EAAG,6BAAA;AAAA,MACH,CAAA,EAAG,iCAAA;AAAA,MACH,CAAA,EAAG,iCAAA;AAAA,MACH,CAAA,EAAG,4BAAA;AAAA,MACH,CAAA,EAAG,iCAAA;AAAA,MACH,CAAA,EAAG,iCAAA;AAAA,MACH,CAAA,EAAG,6BAAA;AAAA,MACH,EAAA,EAAI;AAAA,KACN;AAAA,IACA,GAAA,EAAK;AAAA,MACH,GAAA,EAAK,0BAAA;AAAA,MACL,CAAA,EAAG,8BAAA;AAAA,MACH,CAAA,EAAG,kCAAA;AAAA,MACH,CAAA,EAAG,kCAAA;AAAA,MACH,CAAA,EAAG,6BAAA;AAAA,MACH,CAAA,EAAG,kCAAA;AAAA,MACH,CAAA,EAAG,kCAAA;AAAA,MACH,CAAA,EAAG,8BAAA;AAAA,MACH,EAAA,EAAI;AAAA;AACN,GACF;AAAA,EACA,EAAA,EAAI;AAAA,IACF,CAAA,EAAG;AAAA,MACD,GAAA,EAAK,2BAAA;AAAA,MACL,CAAA,EAAG,gCAAA;AAAA,MACH,CAAA,EAAG,oCAAA;AAAA,MACH,CAAA,EAAG,oCAAA;AAAA,MACH,CAAA,EAAG,+BAAA;AAAA,MACH,CAAA,EAAG,oCAAA;AAAA,MACH,CAAA,EAAG,oCAAA;AAAA,MACH,CAAA,EAAG,gCAAA;AAAA,MACH,EAAA,EAAI;AAAA,KACN;AAAA,IACA,GAAA,EAAK;AAAA,MACH,GAAA,EAAK,6BAAA;AAAA,MACL,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AG,EAAG,SAAA,EAAW,QAAA,EAAS,EAAsB;AAC1F,EAAA,MAAM,GAAA,GAAM,WAAW,cAAc,CAAA;AACrC,EAAA,2BACG,GAAA,EAAA,EAAI,SAAA,EAAW,CAAC,aAAA,CAAc,MAAM,GAAG,CAAA,EAAG,SAAS,CAAA,CAAE,OAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,GAC3E,QAAA,EACH,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * Static Tailwind basis classes for {@link FillGridItem}.\n *\n * Tailwind's content scanner extracts class candidates from raw source text and\n * cannot follow string concatenation — `\"sm:\" + \"basis-[...]\"` is invisible to\n * it. So every fully-prefixed class is spelled out as a literal below, indexed\n * by breakpoint → gap → span. `fillItemClass` only ever *looks up* a literal; it\n * never builds one. This is what guarantees the responsive classes survive a\n * production purge (no fragile safelist comment to keep in sync).\n *\n * NOTE: because these literals live in the SDK, a CONSUMER's Tailwind build must\n * scan this package's dist (add it to `content`) or the classes won't generate.\n *\n * basis(n, g) = calc(n/12 * 100% - g * (1 - n/12)), g = gap in rem.\n * gap-5 => g = 1.25rem; gap-2.5 => g = 0.625rem. Span 12 => basis-full.\n */\nexport type Twelfths = 2.4 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12;\nexport type FillGap = 2.5 | 5;\ntype Breakpoint = \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type FillSpan = Partial<Record<Breakpoint, Twelfths>>;\n\n/**\n * Full literal class per breakpoint × gap × span. `xs` is unprefixed; `sm`/`md`/\n * `lg` carry the Tailwind prefix. Every string here is a real, scannable literal.\n */\nconst CLASSES: Record<Breakpoint, Record<FillGap, Record<Twelfths, string>>> = {\n xs: {\n 5: {\n 2.4: \"basis-[calc(20%-1rem)]\",\n 3: \"basis-[calc(25%-0.9375rem)]\",\n 4: \"basis-[calc(33.333%-0.8333rem)]\",\n 5: \"basis-[calc(41.667%-0.7292rem)]\",\n 6: \"basis-[calc(50%-0.625rem)]\",\n 7: \"basis-[calc(58.333%-0.5208rem)]\",\n 8: \"basis-[calc(66.667%-0.4167rem)]\",\n 9: \"basis-[calc(75%-0.3125rem)]\",\n 12: \"basis-full\",\n },\n 2.5: {\n 2.4: \"basis-[calc(20%-0.5rem)]\",\n 3: \"basis-[calc(25%-0.46875rem)]\",\n 4: \"basis-[calc(33.333%-0.41667rem)]\",\n 5: \"basis-[calc(41.667%-0.36458rem)]\",\n 6: \"basis-[calc(50%-0.3125rem)]\",\n 7: \"basis-[calc(58.333%-0.26042rem)]\",\n 8: \"basis-[calc(66.667%-0.20833rem)]\",\n 9: \"basis-[calc(75%-0.15625rem)]\",\n 12: \"basis-full\",\n },\n },\n sm: {\n 5: {\n 2.4: \"sm:basis-[calc(20%-1rem)]\",\n 3: \"sm:basis-[calc(25%-0.9375rem)]\",\n 4: \"sm:basis-[calc(33.333%-0.8333rem)]\",\n 5: \"sm:basis-[calc(41.667%-0.7292rem)]\",\n 6: \"sm:basis-[calc(50%-0.625rem)]\",\n 7: \"sm:basis-[calc(58.333%-0.5208rem)]\",\n 8: \"sm:basis-[calc(66.667%-0.4167rem)]\",\n 9: \"sm:basis-[calc(75%-0.3125rem)]\",\n 12: \"sm:basis-full\",\n },\n 2.5: {\n 2.4: \"sm:basis-[calc(20%-0.5rem)]\",\n 3: \"sm:basis-[calc(25%-0.46875rem)]\",\n 4: \"sm:basis-[calc(33.333%-0.41667rem)]\",\n 5: \"sm:basis-[calc(41.667%-0.36458rem)]\",\n 6: \"sm:basis-[calc(50%-0.3125rem)]\",\n 7: \"sm:basis-[calc(58.333%-0.26042rem)]\",\n 8: \"sm:basis-[calc(66.667%-0.20833rem)]\",\n 9: \"sm:basis-[calc(75%-0.15625rem)]\",\n 12: \"sm:basis-full\",\n },\n },\n md: {\n 5: {\n 2.4: \"md:basis-[calc(20%-1rem)]\",\n 3: \"md:basis-[calc(25%-0.9375rem)]\",\n 4: \"md:basis-[calc(33.333%-0.8333rem)]\",\n 5: \"md:basis-[calc(41.667%-0.7292rem)]\",\n 6: \"md:basis-[calc(50%-0.625rem)]\",\n 7: \"md:basis-[calc(58.333%-0.5208rem)]\",\n 8: \"md:basis-[calc(66.667%-0.4167rem)]\",\n 9: \"md:basis-[calc(75%-0.3125rem)]\",\n 12: \"md:basis-full\",\n },\n 2.5: {\n 2.4: \"md:basis-[calc(20%-0.5rem)]\",\n 3: \"md:basis-[calc(25%-0.46875rem)]\",\n 4: \"md:basis-[calc(33.333%-0.41667rem)]\",\n 5: \"md:basis-[calc(41.667%-0.36458rem)]\",\n 6: \"md:basis-[calc(50%-0.3125rem)]\",\n 7: \"md:basis-[calc(58.333%-0.26042rem)]\",\n 8: \"md:basis-[calc(66.667%-0.20833rem)]\",\n 9: \"md:basis-[calc(75%-0.15625rem)]\",\n 12: \"md:basis-full\",\n },\n },\n lg: {\n 5: {\n 2.4: \"lg:basis-[calc(20%-1rem)]\",\n 3: \"lg:basis-[calc(25%-0.9375rem)]\",\n 4: \"lg:basis-[calc(33.333%-0.8333rem)]\",\n 5: \"lg:basis-[calc(41.667%-0.7292rem)]\",\n 6: \"lg:basis-[calc(50%-0.625rem)]\",\n 7: \"lg:basis-[calc(58.333%-0.5208rem)]\",\n 8: \"lg:basis-[calc(66.667%-0.4167rem)]\",\n 9: \"lg:basis-[calc(75%-0.3125rem)]\",\n 12: \"lg:basis-full\",\n },\n 2.5: {\n 2.4: \"lg:basis-[calc(20%-0.5rem)]\",\n 3: \"lg:basis-[calc(25%-0.46875rem)]\",\n 4: \"lg:basis-[calc(33.333%-0.41667rem)]\",\n 5: \"lg:basis-[calc(41.667%-0.36458rem)]\",\n 6: \"lg:basis-[calc(50%-0.3125rem)]\",\n 7: \"lg:basis-[calc(58.333%-0.26042rem)]\",\n 8: \"lg:basis-[calc(66.667%-0.20833rem)]\",\n 9: \"lg:basis-[calc(75%-0.15625rem)]\",\n 12: \"lg:basis-full\",\n },\n },\n};\n\nconst BREAKPOINTS: readonly Breakpoint[] = [\"xs\", \"sm\", \"md\", \"lg\"];\n\n/**\n * Full class string for one item: always `min-w-0 grow`, plus the literal basis\n * class for each supplied breakpoint (looked up, never concatenated).\n */\nexport function fillItemClass(span: FillSpan, gap: FillGap): string {\n const parts = [\"min-w-0\", \"grow\"];\n for (const bp of BREAKPOINTS) {\n const n = span[bp];\n if (n !== undefined) parts.push(CLASSES[bp][gap][n]);\n }\n return parts.join(\" \");\n}\n","import { createContext, useContext } from \"react\";\nimport { Box } from \"@mui/material\";\nimport { fillItemClass, type FillGap, type FillSpan } from \"./fillGridClasses\";\n\nconst FillGapContext = createContext<FillGap>(5);\n\ninterface FillGridProps {\n /** Gutter width. 5 = 20px (default), 2.5 = 10px. Matches MUI spacing values. */\n gap?: FillGap;\n className?: string;\n children: React.ReactNode;\n}\n\n/**\n * A flex-wrap row whose items `grow` to fill a partially-filled last row — the\n * dashboard/overview convention. NOT for forms, tables, or single full-width cards.\n *\n * Renders `w-full` so it always spans its container: a `FillGrid` is itself often\n * a flex item of a parent MUI `<Grid container>` / flex row, where without an\n * explicit width it would shrink-wrap to its content instead of filling the row\n * (the behaviour a `<Grid container size={12}>` used to give).\n */\nexport function FillGrid({ gap = 5, className, children }: FillGridProps) {\n const gapClass = gap === 2.5 ? \"gap-2.5\" : \"gap-5\";\n return (\n <FillGapContext.Provider value={gap}>\n <Box className={[\"flex w-full flex-wrap\", gapClass, className].filter(Boolean).join(\" \")}>\n {children}\n </Box>\n </FillGapContext.Provider>\n );\n}\n\ninterface FillGridItemProps {\n /** 12-column span per breakpoint, mirroring MUI Grid's `size`. Default { xs: 12 }. */\n span?: FillSpan;\n className?: string;\n children: React.ReactNode;\n}\n\nexport function FillGridItem({ span = { xs: 12 }, className, children }: FillGridItemProps) {\n const gap = useContext(FillGapContext);\n return (\n <Box className={[fillItemClass(span, gap), className].filter(Boolean).join(\" \")}>\n {children}\n </Box>\n );\n}\n"]}
@@ -0,0 +1,186 @@
1
+ 'use strict';
2
+
3
+ var material = require('@mui/material');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ // src/components/ui/index.ts
7
+ function Dialog(props) {
8
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Dialog, { disableScrollLock: true, disableRestoreFocus: true, ...props });
9
+ }
10
+ function ConfirmActionDialog({
11
+ open,
12
+ onOpenChange,
13
+ onConfirm,
14
+ isLoading = false,
15
+ labels,
16
+ icon,
17
+ confirmVariant = "default",
18
+ children,
19
+ disableConfirm
20
+ }) {
21
+ const description = labels.description ?? "Are you sure you want to continue?";
22
+ const btnCancel = labels.btnCancel ?? "Cancel";
23
+ const btnConfirm = labels.btnConfirm ?? "Confirm";
24
+ const btnLoading = labels.btnLoading ?? "Processing...";
25
+ const handleClose = () => {
26
+ if (!isLoading) onOpenChange(false);
27
+ };
28
+ return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { open, onClose: handleClose, maxWidth: "xs", fullWidth: true, role: "alertdialog", children: [
29
+ /* @__PURE__ */ jsxRuntime.jsxs(material.DialogTitle, { className: "flex items-center gap-2", children: [
30
+ icon,
31
+ labels.title
32
+ ] }),
33
+ /* @__PURE__ */ jsxRuntime.jsxs(material.DialogContent, { children: [
34
+ typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(material.DialogContentText, { children: description }) : /* @__PURE__ */ jsxRuntime.jsx(material.DialogContentText, { component: "div", children: description }),
35
+ children
36
+ ] }),
37
+ /* @__PURE__ */ jsxRuntime.jsxs(material.DialogActions, { children: [
38
+ /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: handleClose, disabled: isLoading, children: btnCancel }),
39
+ /* @__PURE__ */ jsxRuntime.jsx(
40
+ material.Button,
41
+ {
42
+ variant: "contained",
43
+ color: confirmVariant === "destructive" ? "error" : "primary",
44
+ onClick: onConfirm,
45
+ disabled: isLoading || disableConfirm,
46
+ children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
47
+ /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 16, color: "inherit", className: "mr-2" }),
48
+ btnLoading
49
+ ] }) : btnConfirm
50
+ }
51
+ )
52
+ ] })
53
+ ] });
54
+ }
55
+ function NiBinEmpty({ className, variant = "outlined", size = "medium" }) {
56
+ const iconSize = sizeHelper(size);
57
+ const iconStrokeWidth = strokeSizeHelper(iconSize);
58
+ if (variant === "outlined") {
59
+ return /* @__PURE__ */ jsxRuntime.jsxs(
60
+ "svg",
61
+ {
62
+ width: iconSize,
63
+ height: iconSize,
64
+ className,
65
+ viewBox: "0 0 24 24",
66
+ fill: "none",
67
+ xmlns: "http://www.w3.org/2000/svg",
68
+ children: [
69
+ /* @__PURE__ */ jsxRuntime.jsx(
70
+ "path",
71
+ {
72
+ d: "M6 6L5.48806 9.58357C5.16413 11.8511 5.14395 14.1516 5.42806 16.4245L5.51601 17.1281C5.80316 19.4253 7.56538 21.2609 9.84894 21.6415V21.6415C11.2732 21.8789 12.7268 21.8789 14.1511 21.6415V21.6415C16.4346 21.2609 18.1968 19.4253 18.484 17.1281L18.5719 16.4245C18.856 14.1516 18.8359 11.8511 18.5119 9.58357L18 6",
73
+ stroke: "currentColor",
74
+ strokeWidth: iconStrokeWidth,
75
+ strokeLinecap: "round"
76
+ }
77
+ ),
78
+ /* @__PURE__ */ jsxRuntime.jsx(
79
+ "path",
80
+ {
81
+ d: "M15 5L14.9062 4.43717C14.7408 3.4451 14.6582 2.94906 14.3711 2.60286C14.2462 2.45218 14.0957 2.32469 13.9265 2.22623C13.5378 2 13.035 2 12.0292 2L11.9708 2C10.965 2 10.4622 2 10.0735 2.22623C9.90431 2.32469 9.75381 2.45219 9.62888 2.60286C9.34182 2.94906 9.25915 3.4451 9.09381 4.43717L9 5",
82
+ stroke: "currentColor",
83
+ strokeWidth: iconStrokeWidth,
84
+ strokeLinecap: "round",
85
+ strokeLinejoin: "round"
86
+ }
87
+ ),
88
+ /* @__PURE__ */ jsxRuntime.jsx(
89
+ "path",
90
+ {
91
+ d: "M20 6L18.2017 5.77522C14.0833 5.26041 9.91673 5.26041 5.79826 5.77522L4 6",
92
+ stroke: "currentColor",
93
+ strokeWidth: iconStrokeWidth,
94
+ strokeLinecap: "round"
95
+ }
96
+ )
97
+ ]
98
+ }
99
+ );
100
+ } else {
101
+ return /* @__PURE__ */ jsxRuntime.jsxs(
102
+ "svg",
103
+ {
104
+ width: iconSize,
105
+ height: iconSize,
106
+ className,
107
+ viewBox: "0 0 24 24",
108
+ fill: "none",
109
+ xmlns: "http://www.w3.org/2000/svg",
110
+ children: [
111
+ /* @__PURE__ */ jsxRuntime.jsx(
112
+ "path",
113
+ {
114
+ d: "M9.74018 5.12304C9.6721 5.53152 9.28536 5.80813 8.8769 5.74023C8.46843 5.67215 8.19181 5.28541 8.25971 4.87695L8.35444 4.31347C8.43472 3.83178 8.50246 3.41913 8.59077 3.08593C8.68246 2.74003 8.81179 2.41337 9.0517 2.12402C9.23282 1.90562 9.45102 1.72085 9.69623 1.57812C10.0211 1.38906 10.3644 1.31483 10.7206 1.28125C11.0639 1.24892 11.4822 1.25 11.9706 1.25L12.0292 1.25C12.5177 1.25 12.936 1.24892 13.2792 1.28125C13.6355 1.31483 13.9788 1.38906 14.3037 1.57812C14.5489 1.72085 14.7671 1.90562 14.9482 2.12402C15.1881 2.41337 15.3174 2.74003 15.4091 3.08593C15.4974 3.41913 15.5652 3.83177 15.6455 4.31347L15.7402 4.87695L15.749 4.95312C15.7732 5.33241 15.506 5.6764 15.123 5.74023C14.74 5.80389 14.3763 5.56494 14.2763 5.19824L14.2597 5.12304L14.166 4.56054C14.081 4.05049 14.025 3.71896 13.9589 3.46972C13.8964 3.23378 13.8409 3.13889 13.7939 3.08203C13.7252 2.99916 13.6418 2.92817 13.5488 2.87402C13.4849 2.83695 13.3818 2.79831 13.1386 2.77539C12.8819 2.75121 12.5462 2.75 12.0292 2.75L11.9706 2.75C11.4537 2.75 11.1179 2.75121 10.8613 2.77539C10.6181 2.79831 10.515 2.83695 10.4511 2.87402C10.3581 2.92817 10.2747 2.99916 10.206 3.08203C10.1589 3.13889 10.1035 3.23378 10.041 3.46972C9.97489 3.71896 9.91894 4.05049 9.83393 4.56054L9.74018 5.12304Z",
115
+ fill: "currentColor"
116
+ }
117
+ ),
118
+ /* @__PURE__ */ jsxRuntime.jsx(
119
+ "path",
120
+ {
121
+ fillRule: "evenodd",
122
+ clipRule: "evenodd",
123
+ d: "M5.94819 5.00114C9.96612 4.51861 14.0279 4.51807 18.0459 5.00016C18.1288 5.01011 18.212 5.02008 18.2949 5.03043L20.0927 5.25504L20.1689 5.26872C20.5391 5.35382 20.792 5.70788 20.7441 6.09293C20.6958 6.47814 20.3633 6.75806 19.9834 6.74918L19.9072 6.7443L18.8447 6.61051L19.2548 9.4777C19.5881 11.8107 19.6086 14.1783 19.3164 16.5168L19.2285 17.2209C18.9001 19.8471 16.8851 21.9459 14.2744 22.381C12.7685 22.632 11.2314 22.632 9.72554 22.381C7.11486 21.9458 5.09978 19.8471 4.77144 17.2209L4.68355 16.5168C4.39132 14.1783 4.41185 11.8107 4.74507 9.4777L5.15425 6.61051L4.09273 6.7443L4.01655 6.74918C3.63657 6.75805 3.30414 6.47813 3.25581 6.09293C3.20471 5.68211 3.49633 5.30642 3.90718 5.25504L5.70503 5.03043C5.78598 5.02032 5.86721 5.01086 5.94819 5.00114Z",
124
+ fill: "currentColor"
125
+ }
126
+ )
127
+ ]
128
+ }
129
+ );
130
+ }
131
+ }
132
+ var sizeHelper = (size) => {
133
+ if (typeof size === "number") {
134
+ return size;
135
+ } else if (size === "large") {
136
+ return 24;
137
+ } else if (size === "small" || size === "tiny") {
138
+ return 16;
139
+ } else {
140
+ return 20;
141
+ }
142
+ };
143
+ var strokeSizeHelper = (size) => {
144
+ if (size === 32) {
145
+ return 1.15;
146
+ } else if (size >= 20) {
147
+ return 1.5;
148
+ } else {
149
+ return 1.75;
150
+ }
151
+ };
152
+ function ConfirmDeleteDialog({
153
+ open,
154
+ onOpenChange,
155
+ onConfirm,
156
+ isDeleting,
157
+ labels
158
+ }) {
159
+ const title = labels?.title ?? "Delete?";
160
+ const description = labels?.description ?? "Are you sure? This action cannot be undone.";
161
+ const btnCancel = labels?.btnCancel ?? "Cancel";
162
+ const btnConfirm = labels?.btnConfirm ?? "Delete";
163
+ const btnDeleting = labels?.btnDeleting ?? "Deleting...";
164
+ const handleClose = () => {
165
+ if (!isDeleting) onOpenChange(false);
166
+ };
167
+ return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { open, onClose: handleClose, maxWidth: "xs", fullWidth: true, role: "alertdialog", children: [
168
+ /* @__PURE__ */ jsxRuntime.jsxs(material.DialogTitle, { className: "flex items-center gap-2", children: [
169
+ /* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { color: "error.main", display: "inline-flex" }, children: /* @__PURE__ */ jsxRuntime.jsx(NiBinEmpty, { size: "medium" }) }),
170
+ title
171
+ ] }),
172
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogContent, { children: typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(material.DialogContentText, { children: description }) : /* @__PURE__ */ jsxRuntime.jsx(material.DialogContentText, { component: "div", children: description }) }),
173
+ /* @__PURE__ */ jsxRuntime.jsxs(material.DialogActions, { children: [
174
+ /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: handleClose, disabled: isDeleting, children: btnCancel }),
175
+ /* @__PURE__ */ jsxRuntime.jsx(material.Button, { variant: "contained", color: "error", onClick: onConfirm, disabled: isDeleting, children: isDeleting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
176
+ /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 16, color: "inherit", className: "mr-2" }),
177
+ btnDeleting
178
+ ] }) : btnConfirm })
179
+ ] })
180
+ ] });
181
+ }
182
+
183
+ exports.ConfirmActionDialog = ConfirmActionDialog;
184
+ exports.ConfirmDeleteDialog = ConfirmDeleteDialog;
185
+ //# sourceMappingURL=index.cjs.map
186
+ //# sourceMappingURL=index.cjs.map