@loopr-ai/craft 0.1.0 → 0.2.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/dist/TransitionGroupContext-ee5b34c9.js +132 -0
- package/dist/assets/theme.css +1 -0
- package/dist/components/cell/Button/index.d.ts +19 -4
- package/dist/components/cell/Button/index.js +1209 -4
- package/dist/components/cell/ProgressBar/index.d.ts +27 -0
- package/dist/components/cell/ProgressBar/index.js +325 -0
- package/dist/components/cell/Search/index.d.ts +25 -0
- package/dist/components/cell/Search/index.js +26539 -0
- package/dist/components/cell/Typography/index.d.ts +20 -0
- package/dist/components/cell/Typography/index.js +217 -0
- package/dist/createTheme-eb26b87a.js +2221 -0
- package/dist/emotion-react.browser.esm-ff33c213.js +439 -0
- package/dist/exactProp-0925aa6f.js +13 -0
- package/dist/global/colors.d.ts +16 -0
- package/dist/global/colors.js +22 -0
- package/dist/global/constants.js +1 -0
- package/dist/global/enums.js +1 -0
- package/dist/global/interfaces.d.ts +6 -0
- package/dist/global/interfaces.js +1 -0
- package/dist/global/theme.d.ts +35 -0
- package/dist/global/theme.js +76 -0
- package/dist/main.d.ts +6 -2
- package/dist/main.js +8 -2
- package/dist/providers/CraftThemeProvider.d.ts +16 -0
- package/dist/providers/CraftThemeProvider.js +128 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +4 -0
- package/dist/styled-b8bfdd6b.js +699 -0
- package/dist/useTheme-a9e2b32c.js +10 -0
- package/dist/useThemeWithoutDefault-188598a8.js +950 -0
- package/package.json +24 -3
- package/dist/components/cell/Input/index.d.ts +0 -5
- package/dist/components/cell/Input/index.js +0 -6
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LinearProgressProps as MuiLinearProgressProps } from "@mui/material/LinearProgress";
|
|
2
|
+
import { CraftFC } from "../../../global/interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* This ProgressBar Component is a wrapper of MuiLinearProgress Component with some custom styles for the look props
|
|
5
|
+
* @param value The value of the progress indicator should be between 0 and 100 (inclusive)
|
|
6
|
+
* @param extrapolateColor A function that returns a color string based on the value of the progress indicator
|
|
7
|
+
* @param trackColor The color of the track
|
|
8
|
+
*/
|
|
9
|
+
export interface ProgressBarProps extends MuiLinearProgressProps {
|
|
10
|
+
/**
|
|
11
|
+
* The function that returns a color string based on the value of the progress indicator
|
|
12
|
+
* example:
|
|
13
|
+
* ```tsx
|
|
14
|
+
* function extrapolateColor(value: number) {
|
|
15
|
+
*return value >= 55 ? "red" : "green";
|
|
16
|
+
*}
|
|
17
|
+
*<ProgressBar value={55} extrapolateColor={extrapolateColor} trackColor="purple"></ProgressBar>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
extrapolateColor?: (value: number) => string;
|
|
21
|
+
trackColor?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This ProgressBar Component is a wrapper of MuiLinearProgress Component with some custom styles for the look props
|
|
25
|
+
*/
|
|
26
|
+
declare const ProgressBar: CraftFC<ProgressBarProps>;
|
|
27
|
+
export default ProgressBar;
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { jsxs as j, jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import { getColorToHex as $ } from "../../../global/colors.js";
|
|
3
|
+
import { g as D, c as n, _ as l, a as q, P as o, l as E, d as U } from "../../../createTheme-eb26b87a.js";
|
|
4
|
+
import * as z from "react";
|
|
5
|
+
import { g as w, s as h, a as A, c as F, b as K } from "../../../styled-b8bfdd6b.js";
|
|
6
|
+
import { u as V } from "../../../useTheme-a9e2b32c.js";
|
|
7
|
+
import { k as P, c as x } from "../../../emotion-react.browser.esm-ff33c213.js";
|
|
8
|
+
function S(r) {
|
|
9
|
+
return D("MuiLinearProgress", r);
|
|
10
|
+
}
|
|
11
|
+
w("MuiLinearProgress", ["root", "colorPrimary", "colorSecondary", "determinate", "indeterminate", "buffer", "query", "dashed", "dashedColorPrimary", "dashedColorSecondary", "bar", "barColorPrimary", "barColorSecondary", "bar1Indeterminate", "bar1Determinate", "bar1Buffer", "bar2Indeterminate", "bar2Buffer"]);
|
|
12
|
+
const X = ["className", "color", "value", "valueBuffer", "variant"];
|
|
13
|
+
let c = (r) => r, B, N, O, _, I, M;
|
|
14
|
+
const C = 4, Y = P(B || (B = c`
|
|
15
|
+
0% {
|
|
16
|
+
left: -35%;
|
|
17
|
+
right: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
60% {
|
|
21
|
+
left: 100%;
|
|
22
|
+
right: -90%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
100% {
|
|
26
|
+
left: 100%;
|
|
27
|
+
right: -90%;
|
|
28
|
+
}
|
|
29
|
+
`)), H = P(N || (N = c`
|
|
30
|
+
0% {
|
|
31
|
+
left: -200%;
|
|
32
|
+
right: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
60% {
|
|
36
|
+
left: 107%;
|
|
37
|
+
right: -8%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
100% {
|
|
41
|
+
left: 107%;
|
|
42
|
+
right: -8%;
|
|
43
|
+
}
|
|
44
|
+
`)), W = P(O || (O = c`
|
|
45
|
+
0% {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
background-position: 0 -23px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
60% {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
background-position: 0 -23px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
100% {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
background-position: -200px -23px;
|
|
58
|
+
}
|
|
59
|
+
`)), G = (r) => {
|
|
60
|
+
const {
|
|
61
|
+
classes: e,
|
|
62
|
+
variant: a,
|
|
63
|
+
color: t
|
|
64
|
+
} = r, f = {
|
|
65
|
+
root: ["root", `color${n(t)}`, a],
|
|
66
|
+
dashed: ["dashed", `dashedColor${n(t)}`],
|
|
67
|
+
bar1: ["bar", `barColor${n(t)}`, (a === "indeterminate" || a === "query") && "bar1Indeterminate", a === "determinate" && "bar1Determinate", a === "buffer" && "bar1Buffer"],
|
|
68
|
+
bar2: ["bar", a !== "buffer" && `barColor${n(t)}`, a === "buffer" && `color${n(t)}`, (a === "indeterminate" || a === "query") && "bar2Indeterminate", a === "buffer" && "bar2Buffer"]
|
|
69
|
+
};
|
|
70
|
+
return K(f, S, e);
|
|
71
|
+
}, k = (r, e) => e === "inherit" ? "currentColor" : r.vars ? r.vars.palette.LinearProgress[`${e}Bg`] : r.palette.mode === "light" ? E(r.palette[e].main, 0.62) : U(r.palette[e].main, 0.5), J = h("span", {
|
|
72
|
+
name: "MuiLinearProgress",
|
|
73
|
+
slot: "Root",
|
|
74
|
+
overridesResolver: (r, e) => {
|
|
75
|
+
const {
|
|
76
|
+
ownerState: a
|
|
77
|
+
} = r;
|
|
78
|
+
return [e.root, e[`color${n(a.color)}`], e[a.variant]];
|
|
79
|
+
}
|
|
80
|
+
})(({
|
|
81
|
+
ownerState: r,
|
|
82
|
+
theme: e
|
|
83
|
+
}) => l({
|
|
84
|
+
position: "relative",
|
|
85
|
+
overflow: "hidden",
|
|
86
|
+
display: "block",
|
|
87
|
+
height: 4,
|
|
88
|
+
zIndex: 0,
|
|
89
|
+
// Fix Safari's bug during composition of different paint.
|
|
90
|
+
"@media print": {
|
|
91
|
+
colorAdjust: "exact"
|
|
92
|
+
},
|
|
93
|
+
backgroundColor: k(e, r.color)
|
|
94
|
+
}, r.color === "inherit" && r.variant !== "buffer" && {
|
|
95
|
+
backgroundColor: "none",
|
|
96
|
+
"&::before": {
|
|
97
|
+
content: '""',
|
|
98
|
+
position: "absolute",
|
|
99
|
+
left: 0,
|
|
100
|
+
top: 0,
|
|
101
|
+
right: 0,
|
|
102
|
+
bottom: 0,
|
|
103
|
+
backgroundColor: "currentColor",
|
|
104
|
+
opacity: 0.3
|
|
105
|
+
}
|
|
106
|
+
}, r.variant === "buffer" && {
|
|
107
|
+
backgroundColor: "transparent"
|
|
108
|
+
}, r.variant === "query" && {
|
|
109
|
+
transform: "rotate(180deg)"
|
|
110
|
+
})), Q = h("span", {
|
|
111
|
+
name: "MuiLinearProgress",
|
|
112
|
+
slot: "Dashed",
|
|
113
|
+
overridesResolver: (r, e) => {
|
|
114
|
+
const {
|
|
115
|
+
ownerState: a
|
|
116
|
+
} = r;
|
|
117
|
+
return [e.dashed, e[`dashedColor${n(a.color)}`]];
|
|
118
|
+
}
|
|
119
|
+
})(({
|
|
120
|
+
ownerState: r,
|
|
121
|
+
theme: e
|
|
122
|
+
}) => {
|
|
123
|
+
const a = k(e, r.color);
|
|
124
|
+
return l({
|
|
125
|
+
position: "absolute",
|
|
126
|
+
marginTop: 0,
|
|
127
|
+
height: "100%",
|
|
128
|
+
width: "100%"
|
|
129
|
+
}, r.color === "inherit" && {
|
|
130
|
+
opacity: 0.3
|
|
131
|
+
}, {
|
|
132
|
+
backgroundImage: `radial-gradient(${a} 0%, ${a} 16%, transparent 42%)`,
|
|
133
|
+
backgroundSize: "10px 10px",
|
|
134
|
+
backgroundPosition: "0 -23px"
|
|
135
|
+
});
|
|
136
|
+
}, x(_ || (_ = c`
|
|
137
|
+
animation: ${0} 3s infinite linear;
|
|
138
|
+
`), W)), Z = h("span", {
|
|
139
|
+
name: "MuiLinearProgress",
|
|
140
|
+
slot: "Bar1",
|
|
141
|
+
overridesResolver: (r, e) => {
|
|
142
|
+
const {
|
|
143
|
+
ownerState: a
|
|
144
|
+
} = r;
|
|
145
|
+
return [e.bar, e[`barColor${n(a.color)}`], (a.variant === "indeterminate" || a.variant === "query") && e.bar1Indeterminate, a.variant === "determinate" && e.bar1Determinate, a.variant === "buffer" && e.bar1Buffer];
|
|
146
|
+
}
|
|
147
|
+
})(({
|
|
148
|
+
ownerState: r,
|
|
149
|
+
theme: e
|
|
150
|
+
}) => l({
|
|
151
|
+
width: "100%",
|
|
152
|
+
position: "absolute",
|
|
153
|
+
left: 0,
|
|
154
|
+
bottom: 0,
|
|
155
|
+
top: 0,
|
|
156
|
+
transition: "transform 0.2s linear",
|
|
157
|
+
transformOrigin: "left",
|
|
158
|
+
backgroundColor: r.color === "inherit" ? "currentColor" : (e.vars || e).palette[r.color].main
|
|
159
|
+
}, r.variant === "determinate" && {
|
|
160
|
+
transition: `transform .${C}s linear`
|
|
161
|
+
}, r.variant === "buffer" && {
|
|
162
|
+
zIndex: 1,
|
|
163
|
+
transition: `transform .${C}s linear`
|
|
164
|
+
}), ({
|
|
165
|
+
ownerState: r
|
|
166
|
+
}) => (r.variant === "indeterminate" || r.variant === "query") && x(I || (I = c`
|
|
167
|
+
width: auto;
|
|
168
|
+
animation: ${0} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
|
|
169
|
+
`), Y)), rr = h("span", {
|
|
170
|
+
name: "MuiLinearProgress",
|
|
171
|
+
slot: "Bar2",
|
|
172
|
+
overridesResolver: (r, e) => {
|
|
173
|
+
const {
|
|
174
|
+
ownerState: a
|
|
175
|
+
} = r;
|
|
176
|
+
return [e.bar, e[`barColor${n(a.color)}`], (a.variant === "indeterminate" || a.variant === "query") && e.bar2Indeterminate, a.variant === "buffer" && e.bar2Buffer];
|
|
177
|
+
}
|
|
178
|
+
})(({
|
|
179
|
+
ownerState: r,
|
|
180
|
+
theme: e
|
|
181
|
+
}) => l({
|
|
182
|
+
width: "100%",
|
|
183
|
+
position: "absolute",
|
|
184
|
+
left: 0,
|
|
185
|
+
bottom: 0,
|
|
186
|
+
top: 0,
|
|
187
|
+
transition: "transform 0.2s linear",
|
|
188
|
+
transformOrigin: "left"
|
|
189
|
+
}, r.variant !== "buffer" && {
|
|
190
|
+
backgroundColor: r.color === "inherit" ? "currentColor" : (e.vars || e).palette[r.color].main
|
|
191
|
+
}, r.color === "inherit" && {
|
|
192
|
+
opacity: 0.3
|
|
193
|
+
}, r.variant === "buffer" && {
|
|
194
|
+
backgroundColor: k(e, r.color),
|
|
195
|
+
transition: `transform .${C}s linear`
|
|
196
|
+
}), ({
|
|
197
|
+
ownerState: r
|
|
198
|
+
}) => (r.variant === "indeterminate" || r.variant === "query") && x(M || (M = c`
|
|
199
|
+
width: auto;
|
|
200
|
+
animation: ${0} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
|
|
201
|
+
`), H)), T = /* @__PURE__ */ z.forwardRef(function(e, a) {
|
|
202
|
+
const t = A({
|
|
203
|
+
props: e,
|
|
204
|
+
name: "MuiLinearProgress"
|
|
205
|
+
}), {
|
|
206
|
+
className: f,
|
|
207
|
+
color: y = "primary",
|
|
208
|
+
value: d,
|
|
209
|
+
valueBuffer: b,
|
|
210
|
+
variant: s = "indeterminate"
|
|
211
|
+
} = t, R = q(t, X), u = l({}, t, {
|
|
212
|
+
color: y,
|
|
213
|
+
variant: s
|
|
214
|
+
}), m = G(u), L = V(), p = {}, g = {
|
|
215
|
+
bar1: {},
|
|
216
|
+
bar2: {}
|
|
217
|
+
};
|
|
218
|
+
if (s === "determinate" || s === "buffer")
|
|
219
|
+
if (d !== void 0) {
|
|
220
|
+
p["aria-valuenow"] = Math.round(d), p["aria-valuemin"] = 0, p["aria-valuemax"] = 100;
|
|
221
|
+
let i = d - 100;
|
|
222
|
+
L.direction === "rtl" && (i = -i), g.bar1.transform = `translateX(${i}%)`;
|
|
223
|
+
} else
|
|
224
|
+
process.env.NODE_ENV !== "production" && console.error("MUI: You need to provide a value prop when using the determinate or buffer variant of LinearProgress .");
|
|
225
|
+
if (s === "buffer")
|
|
226
|
+
if (b !== void 0) {
|
|
227
|
+
let i = (b || 0) - 100;
|
|
228
|
+
L.direction === "rtl" && (i = -i), g.bar2.transform = `translateX(${i}%)`;
|
|
229
|
+
} else
|
|
230
|
+
process.env.NODE_ENV !== "production" && console.error("MUI: You need to provide a valueBuffer prop when using the buffer variant of LinearProgress.");
|
|
231
|
+
return /* @__PURE__ */ j(J, l({
|
|
232
|
+
className: F(m.root, f),
|
|
233
|
+
ownerState: u,
|
|
234
|
+
role: "progressbar"
|
|
235
|
+
}, p, {
|
|
236
|
+
ref: a
|
|
237
|
+
}, R, {
|
|
238
|
+
children: [s === "buffer" ? /* @__PURE__ */ v(Q, {
|
|
239
|
+
className: m.dashed,
|
|
240
|
+
ownerState: u
|
|
241
|
+
}) : null, /* @__PURE__ */ v(Z, {
|
|
242
|
+
className: m.bar1,
|
|
243
|
+
ownerState: u,
|
|
244
|
+
style: g.bar1
|
|
245
|
+
}), s === "determinate" ? null : /* @__PURE__ */ v(rr, {
|
|
246
|
+
className: m.bar2,
|
|
247
|
+
ownerState: u,
|
|
248
|
+
style: g.bar2
|
|
249
|
+
})]
|
|
250
|
+
}));
|
|
251
|
+
});
|
|
252
|
+
process.env.NODE_ENV !== "production" && (T.propTypes = {
|
|
253
|
+
// ----------------------------- Warning --------------------------------
|
|
254
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
255
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
256
|
+
// ----------------------------------------------------------------------
|
|
257
|
+
/**
|
|
258
|
+
* Override or extend the styles applied to the component.
|
|
259
|
+
*/
|
|
260
|
+
classes: o.object,
|
|
261
|
+
/**
|
|
262
|
+
* @ignore
|
|
263
|
+
*/
|
|
264
|
+
className: o.string,
|
|
265
|
+
/**
|
|
266
|
+
* The color of the component.
|
|
267
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
268
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
269
|
+
* @default 'primary'
|
|
270
|
+
*/
|
|
271
|
+
color: o.oneOfType([o.oneOf(["inherit", "primary", "secondary"]), o.string]),
|
|
272
|
+
/**
|
|
273
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
274
|
+
*/
|
|
275
|
+
sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
|
|
276
|
+
/**
|
|
277
|
+
* The value of the progress indicator for the determinate and buffer variants.
|
|
278
|
+
* Value between 0 and 100.
|
|
279
|
+
*/
|
|
280
|
+
value: o.number,
|
|
281
|
+
/**
|
|
282
|
+
* The value for the buffer variant.
|
|
283
|
+
* Value between 0 and 100.
|
|
284
|
+
*/
|
|
285
|
+
valueBuffer: o.number,
|
|
286
|
+
/**
|
|
287
|
+
* The variant to use.
|
|
288
|
+
* Use indeterminate or query when there is no progress value.
|
|
289
|
+
* @default 'indeterminate'
|
|
290
|
+
*/
|
|
291
|
+
variant: o.oneOf(["buffer", "determinate", "indeterminate", "query"])
|
|
292
|
+
});
|
|
293
|
+
const er = T;
|
|
294
|
+
function ar(r) {
|
|
295
|
+
return r >= 100 ? $("success") : $("primary");
|
|
296
|
+
}
|
|
297
|
+
const cr = ({
|
|
298
|
+
value: r = 0,
|
|
299
|
+
color: e = "primary",
|
|
300
|
+
extrapolateColor: a = ar,
|
|
301
|
+
trackColor: t,
|
|
302
|
+
sx: f,
|
|
303
|
+
...y
|
|
304
|
+
}) => {
|
|
305
|
+
const b = { ...{
|
|
306
|
+
borderRadius: "0.625rem",
|
|
307
|
+
backgroundColor: t ?? "#F3F3F3",
|
|
308
|
+
"& .MuiLinearProgress-bar": {
|
|
309
|
+
backgroundColor: a(r)
|
|
310
|
+
}
|
|
311
|
+
}, ...f };
|
|
312
|
+
return /* @__PURE__ */ v(
|
|
313
|
+
er,
|
|
314
|
+
{
|
|
315
|
+
variant: "determinate",
|
|
316
|
+
value: r,
|
|
317
|
+
color: e,
|
|
318
|
+
sx: b,
|
|
319
|
+
...y
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
};
|
|
323
|
+
export {
|
|
324
|
+
cr as default
|
|
325
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsxImportSource react */
|
|
2
|
+
import { SxProps } from "@mui/material";
|
|
3
|
+
import { BaseTextFieldProps as MuiBaseTextFieldProps } from "@mui/material/TextField";
|
|
4
|
+
import { CraftFC } from "../../../global/interfaces";
|
|
5
|
+
/**
|
|
6
|
+
* The props of the Search component extend the MuiBaseTextFieldProps interface.
|
|
7
|
+
* @see https://mui.com/api/text-field/#props
|
|
8
|
+
*/
|
|
9
|
+
interface SearchProps extends MuiBaseTextFieldProps {
|
|
10
|
+
sx?: SxProps;
|
|
11
|
+
borderColor?: string;
|
|
12
|
+
borderColorHover?: string;
|
|
13
|
+
borderColorFocus?: string;
|
|
14
|
+
backgroundColor?: string;
|
|
15
|
+
iconColor?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The Search component is a custom TextField component that has a search icon
|
|
19
|
+
* as a start adornment.
|
|
20
|
+
*
|
|
21
|
+
* @param {SearchProps} props The props of the Search component.
|
|
22
|
+
* @returns {JSX.Element} The Search component.
|
|
23
|
+
*/
|
|
24
|
+
declare const Search: CraftFC<SearchProps>;
|
|
25
|
+
export default Search;
|